choose-_top-002.html (1017B)
1 <!doctype html> 2 <title>HTML Test: Browsing context name - _top</title> 3 <script src="/resources/testharness.js"></script> 4 <script src="/resources/testharnessreport.js"></script> 5 <script src="/common/PrefixedLocalStorage.js"></script> 6 <div id="log"></div> 7 <script> 8 var prefixedStorage; 9 setup (() => prefixedStorage = new PrefixedLocalStorageTest()); 10 11 async_test(t => { 12 t.add_cleanup(() => prefixedStorage.cleanup()); 13 14 var testFunc = (function (t) { 15 var completed = 0; 16 var testCount = 2; 17 return function (actual, expected) { 18 assert_equals(actual, expected); 19 if (++completed >= testCount) { 20 t.done(); 21 } 22 } 23 }(t)); 24 25 prefixedStorage.onSet('isTop', t.step_func(e => { 26 testFunc(e.newValue, 'true'); 27 })); 28 prefixedStorage.onSet('name', t.step_func(e => { 29 testFunc(e.newValue, 'topWin2'); 30 })); 31 window.open(prefixedStorage.url('resources/choose-_top-002-window.html'), '_blank'); 32 }, 'Should choose top browsing context for "_top" if current is not top'); 33 </script>