tor-browser

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

coop-bcg-swap.https.html (1387B)


      1 <!DOCTYPE html>
      2 <title>Test window.name after bcg swap</title>
      3 <script src="/resources/testharness.js"></script>
      4 <script src="/resources/testharnessreport.js"></script>
      5 <script src="/common/dispatcher/dispatcher.js"></script>
      6 <script src="/common/utils.js"></script>
      7 <script src="resources/utils.js"></script>
      8 
      9 <body>
     10 <script>
     11 promise_test(async () => {
     12  const fenced_frame = attachFencedFrameContext();
     13 
     14  // This test verifies that COOP is not enabled in fenced frames. To do so, we
     15  // set the fenced frame's `window.name` and navigate it to a cross-origin page
     16  // with the `Cross-Origin-Opener-Policy: same-origin` response header.
     17  await fenced_frame.execute(() => {
     18    const remote_origin = get_host_info().REMOTE_ORIGIN;
     19    window.name = "test";
     20    const remote_url = new URL(location.pathname + location.search, remote_origin);
     21 
     22    let existing_pipe_query = remote_url.searchParams.get('pipe');
     23    const all_pipes = existing_pipe_query.split('|');
     24    all_pipes.push('header(Cross-Origin-Opener-Policy, same-origin)');
     25 
     26    remote_url.searchParams.set('pipe', all_pipes.join('|'));
     27 
     28    window.executor.suspend(() => {
     29      location.href = remote_url;
     30    });
     31  });
     32 
     33  // Verify that the fenced frame's `window.name` is still there
     34  await fenced_frame.execute(() => {
     35    assert_equals(window.name, 'test');
     36  });
     37 
     38 }, "window.name after bcg swap");
     39 </script>
     40 </body>