tor-browser

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

third-party.all.tentative.sub.https.window.js (1354B)


      1 // META: script=/resources/testdriver.js
      2 // META: script=/resources/testdriver-vendor.js
      3 // META: script=/workers/same-site-cookies/resources/util.js
      4 
      5 'use strict';
      6 
      7 // Here's the set-up for this test:
      8 // Step 1 (window) Set cookies.
      9 // Step 2 (top-frame) Set up listener for "DidNotStart" message and open cross-site iframe.
     10 // Step 3 (sub-frame) Open iframe same-site to top-frame.
     11 // Step 4 (sub-sub-frame) Set up listener for message and start worker.
     12 // Step 5 (redirect) Skipped.
     13 // Step 6 (worker) Skipped.
     14 // Step 7 (sub-sub-frame) Worker failed to start and window messages "DidNotStart".
     15 // Step 8 (top-frame) Receive "DidNotStart" message and cleanup.
     16 
     17 async_test(t => {
     18  // Step 1
     19  const cookie_set_window = window.open("/workers/same-site-cookies/resources/set_cookies.py");
     20  cookie_set_window.onload =  t.step_func(_ => {
     21    // Step 2
     22    window.addEventListener("message", t.step_func(e => {
     23      // Step 8
     24      assert_equals(e.data, "DidNotStart", "Worker should not have started");
     25      cookie_set_window.close();
     26      t.done();
     27    }));
     28    let iframe = document.createElement("iframe");
     29    iframe.src = "https://{{hosts[alt][]}}:{{ports[https][0]}}/workers/same-site-cookies/resources/iframe.sub.html?type=all";
     30    document.body.appendChild(iframe);
     31  });
     32 }, "Check SharedWorker sameSiteCookies option all for third-party");