window-open-cross-scheduling.html (1485B)
1 <!doctype html> 2 <html> 3 <head> 4 <meta charset="utf-8" /> 5 <title>Scheduling soft navigations across windows.</title> 6 <script src="/resources/testharness.js"></script> 7 <script src="/resources/testharnessreport.js"></script> 8 <script src="/resources/testdriver.js"></script> 9 <script src="/resources/testdriver-vendor.js"></script> 10 <script></script> 11 </head> 12 <body> 13 <button id="button" onclick="navigateChild()">Press Me!</button> 14 15 <script> 16 const child = window.open('resources/other_window.html'); 17 const childLoaded = new Promise(resolve => child.onload = resolve); 18 19 function navigateChild() { 20 // `child.navigate()` is a function declared in the `other_window.html`. 21 child.navigate(); 22 } 23 24 promise_test(async (t) => { 25 await childLoaded; 26 27 if (test_driver) { 28 test_driver.click(document.getElementById("button")); 29 } 30 31 new PerformanceObserver((list, observer) => t.step(() => { 32 observer.disconnect(); 33 assert_unreached("Parent window should not detect a soft-navigation."); 34 })).observe({ type: "soft-navigation" }); 35 36 child.getNextSoftNavEntry().then((entry) => { 37 assert_unreached("Child window should not detect a soft-navigation."); 38 }); 39 40 await new Promise(resolve => t.step_timeout(resolve, 2000)); 41 42 }, "Opening a new window and updating a URL in it shouldn't crash"); 43 </script> 44 </body> 45 </html>