tor-browser

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

popup-inheritance-form-submission.html (1314B)


      1 <!doctype html>
      2 <meta charset="utf-8">
      3 <title>Referrer Policy: popup src="about:blank"</title>
      4 <link rel="help" href="https://bugs.chromium.org/p/chromium/issues/detail?id=1370425">
      5 <link rel="help" href="https://html.spec.whatwg.org/#creating-a-new-browsing-context">
      6 <script src="/resources/testharness.js"></script>
      7 <script src="/resources/testharnessreport.js"></script>
      8 <body>
      9 
     10 <iframe src="resources/submit-form-and-remove-frame.html"></iframe>
     11 <script>
     12 async_test(t => {
     13  // Called by the child frame once it has submitted its form that creates a new
     14  // `about:blank` window in our browsing context group (therefore, the window
     15  // is reachable by us).
     16  window.removeIframe = t.step_func(() => {
     17    const iframe = document.querySelector('iframe');
     18    const expected_referrer = iframe.contentWindow.location.href;
     19    iframe.remove();
     20 
     21    // The child frame is removed, but its form submission navigation is still
     22    // queued on the opened window's global. Wait until it is run and then
     23    // evaluate script.
     24    t.step_timeout(t.step_func_done(() => {
     25      const window_opened_from_form = window.open("", "does-not-exist");
     26      assert_equals(document.referrer, expected_referrer);
     27    }));
     28  });
     29 }, "A new frame's document.referrer is correct even if its initiator frame is gone");
     30 </script>