blob: bcf60f561f6cc7a984ba9ef271061e0fad1234ae [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('form').submit(), 0);
}
} else
localStorage.setItem('loaded', 'true');
}
document.write(location.search);
document.write(` <form action="?third" method="post" target="unknownTarget"><input type="text" name="query"><input type="submit"></a>`);
}
</script>
</body>
</html>