tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

navigation-unload-same-origin-fragment.html (1284B)


      1 <!DOCTYPE html>
      2 <meta charset="utf-8">
      3 <script src="/resources/testharness.js"></script>
      4 <script src="/resources/testharnessreport.js"></script>
      5 <link rel="help" href="https://html.spec.whatwg.org/multipage/browsers.html#navigating-across-documents">
      6 <link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me">
      7 
      8 <iframe id="i" src="navigation-unload-same-origin-fragment-1.html"></iframe>
      9 
     10 <!-- a timeout indicates that setting i.contentWindow.location.hash (a second navigation) aborted the first navigation,
     11    and so it stayed on a.html and finishedLoading was never called -->
     12 
     13 <script>
     14 var test = async_test('Tests that a fragment navigation in the unload handler will not block the initial navigation');
     15 window.onload = test.step_func(function() {
     16    var i = document.querySelector('#i');
     17 
     18    i.contentWindow.onunload = test.step_func(function() {
     19        i.contentWindow.location.hash = '#fragment';
     20    });
     21 
     22    window.finishedLoading = test.step_func_done(function () {
     23        assert_equals(i.contentWindow.location.pathname.split('/').pop(), 'navigation-unload-same-origin-fragment-2.html');
     24        assert_equals(i.contentWindow.location.hash, '');
     25    });
     26 
     27    i.contentWindow.location.href = 'navigation-unload-same-origin-fragment-2.html';
     28 });
     29 </script>