choose-_top-001.html (1025B)
1 <!doctype html> 2 <title>HTML Test: Browsing context name - _top (current is 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, 'topWin1'); 30 })); 31 32 window.open(prefixedStorage.url('resources/open-in-_top.html'), '_blank'); 33 }, 'Should choose current browsing context for "_top" if current is top'); 34 </script>