blob: 35ccb34fe7e9a64ad8009db8bd20c4008fa29a46 [file] [log] [blame]
<!DOCTYPE html>
<html>
<body>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
testRunner.setCanOpenWindows();
testRunner.setCloseRemainingWindowsWhenComplete();
testRunner.overridePreference("WebKitUsesPageCachePreferenceKey", 1);
}
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>