blob: e335ce18723645ebbf8e260f0d2a54486ff952fc [file] [log] [blame]
<!-- webkit-test-runner [ UsesBackForwardCache=true ] -->
<!DOCTYPE html>
<html>
<body>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
if (location.search == '?third') {
alert('PASS');
if (window.testRunner)
testRunner.notifyDone();
} else if (self == top) {
document.write(`<p>This tests navigating via an anchor element with a non-existent target name, which should create a new window.<br>
WebKit should not hit any assertions and alert "PASS".</p>`);
const frame = document.createElement('iframe');
frame.src = '?first';
let step = 0;
frame.onload = () => {
switch (step++) {
case 0:
setTimeout(() => frame.src = '?second', 0);
break;
case 1:
setTimeout(() => history.back(), 0);
break;
}
}
document.body.appendChild(frame);
} else {
if (location.search == '?first') {
if (localStorage.getItem('loaded')) {
localStorage.removeItem('loaded');
window.onload = () => {
setTimeout(() => document.querySelector('a').click(), 0);
}
} else
localStorage.setItem('loaded', 'true');
}
document.write(location.search);
document.write(` <a href="?third" target="unknownTarget">go</a>`);
}
</script>
</body>
</html>