window-reuse.tentative.html (1395B)
1 <!doctype html> 2 <meta charset=utf-8> 3 <title>Test window reuse on initial navigation away from about:blank</title> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 <div id=log></div> 7 <script> 8 promise_test(async t => { 9 const w = window.open("/common/blank.html"); 10 t.add_cleanup(() => w.close()); 11 12 assert_equals(w.location.href, 'about:blank', 'window initially on a transient about:blank'); 13 w.foo = 'bar'; 14 15 await new Promise(res => w.onload = res); 16 assert_true(w.location.href.endsWith('/common/blank.html'), 'loaded initial navigation target'); 17 assert_equals(w.foo, 'bar', 'did reuse window'); 18 }, 'Initially navigating window to non-about:blank page should reuse synchonously available window'); 19 20 promise_test(async t => { 21 const name = 'unique-name-11sep25'; 22 const channel = new BroadcastChannel(name); 23 const w = window.open("about:blank", name); 24 t.add_cleanup(() => w.close()); 25 26 assert_equals(w.location.href, 'about:blank', 'loaded about:blank'); 27 w.foo = 'bar'; 28 29 w.location.href = 'support/window-open-popup-target.html'; 30 await new Promise(res => channel.onmessage = res); 31 assert_true(true, 'completed non-initial load onto initial about:blank'); 32 assert_equals(w.foo, undefined, 'did reuse window'); 33 }, 'synchronously navigating window away from initial about:blank should not reuse window'); 34 </script>