tor-browser

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

anonymous-window.tentative.https.window.js (2124B)


      1 // META: script=/common/get-host-info.sub.js
      2 // META: script=/common/dispatcher/dispatcher.js
      3 // META: script=/html/cross-origin-embedder-policy/credentialless/resources/common.js
      4 
      5 const {ORIGIN} = get_host_info();
      6 
      7 promise_test_parallel(async t => {
      8  const iframe = document.createElement("iframe");
      9  iframe.src = ORIGIN + "/common/blank.html?pipe=status(204)";
     10  iframe.credentialless = false;
     11  document.body.appendChild(iframe);
     12  iframe.credentialless = true;
     13  iframe.contentWindow.modified = true;
     14  iframe.src = ORIGIN + "/common/blank.html";
     15  // Wait for navigation to complete.
     16  await new Promise(resolve => iframe.onload = resolve);
     17  assert_true(iframe.credentialless);
     18  assert_true(iframe.contentWindow.credentialless);
     19  assert_equals(undefined, iframe.contentWindow.modified);
     20 }, "Credentialless (false => true) => window not reused.");
     21 
     22 promise_test_parallel(async t => {
     23  const iframe = document.createElement("iframe");
     24  iframe.src = ORIGIN + "/common/blank.html?pipe=status(204)";
     25  iframe.credentialless = true;
     26  document.body.appendChild(iframe);
     27  iframe.credentialless = false;
     28  iframe.contentWindow.modified = true;
     29  iframe.src = ORIGIN + "/common/blank.html";
     30  // Wait for navigation to complete.
     31  await new Promise(resolve => iframe.onload = resolve);
     32  assert_false(iframe.credentialless);
     33  assert_false(iframe.contentWindow.credentialless);
     34  assert_equals(undefined, iframe.contentWindow.modified);
     35 }, "Credentialless (true => false) => window not reused.");
     36 
     37 promise_test_parallel(async t => {
     38  const iframe = document.createElement("iframe");
     39  iframe.credentialless = true;
     40  iframe.src = ORIGIN + "/common/blank.html?pipe=status(204)";
     41  document.body.appendChild(iframe);
     42  iframe.credentialless = true;
     43  iframe.contentWindow.modified = true;
     44  iframe.src = ORIGIN + "/common/blank.html";
     45  // Wait for navigation to complete.
     46  await new Promise(resolve => iframe.onload = resolve);
     47  assert_true(iframe.credentialless);
     48  assert_true(iframe.contentWindow.credentialless);
     49  assert_true(iframe.contentWindow.modified);
     50 }, "Credentialless (true => true) => window reused.");