REGRESSION (r240909): Release assert in FrameLoader::loadURL when navigating with...
[WebKit-https.git] / LayoutTests / fast / loader / navigate-with-new-target-after-back-forward-navigation.html
1 <!DOCTYPE html>
2 <html>
3 <body>
4 <script>
5
6 if (window.testRunner) {
7     testRunner.dumpAsText();
8     testRunner.waitUntilDone();
9     testRunner.setCanOpenWindows();
10     testRunner.setCloseRemainingWindowsWhenComplete();
11     testRunner.overridePreference("WebKitUsesPageCachePreferenceKey", 1);
12 }
13
14 if (location.search == '?third') {
15     alert('PASS');
16     if (window.testRunner)
17         testRunner.notifyDone();
18 } else if (self == top) {
19     document.write(`<p>This tests navigating via an anchor element with a non-existent target name, which should create a new window.<br>
20 WebKit should not hit any assertions and alert "PASS".</p>`);
21     const frame = document.createElement('iframe');
22     frame.src = '?first';
23     let step = 0;
24     frame.onload = () => {
25         switch (step++) {
26         case 0:
27             setTimeout(() => frame.src = '?second', 0);
28             break;
29         case 1:
30             setTimeout(() => history.back(), 0);
31             break;
32         }
33     }
34     document.body.appendChild(frame);
35 } else {
36     if (location.search == '?first') {
37         if (localStorage.getItem('loaded')) {
38             localStorage.removeItem('loaded');
39             window.onload = () => {
40                 setTimeout(() => document.querySelector('a').click(), 0);
41             }
42         } else
43             localStorage.setItem('loaded', 'true');
44     }
45     document.write(location.search);
46     document.write(` <a href="?third" target="unknownTarget">go</a>`);
47 }
48
49 </script>
50 </body>
51 </html>