tor-browser

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

hasStorageAccess.tentative.https.window.js (1060B)


      1 // META: script=/common/get-host-info.sub.js
      2 // META: script=/common/utils.js
      3 // META: script=/common/dispatcher/dispatcher.js
      4 // META: script=/html/cross-origin-embedder-policy/credentialless/resources/common.js
      5 // META: script=./resources/common.js
      6 
      7 setup(() => {
      8  assert_implements(document.hasStorageAccess,
      9    "requestStorageAccess is not supported.");
     10 })
     11 
     12 const hasStorageAccess = (iframe) => {
     13  const reply = token();
     14  send(iframe, `
     15    send("${reply}", await document.hasStorageAccess());
     16  `);
     17  return receive(reply);
     18 }
     19 
     20 promise_test(async test => {
     21  const same_origin = window.origin;
     22  const iframe = newIframeCredentialless(same_origin);
     23  assert_equals(await hasStorageAccess(iframe), "false");
     24 }, "Same-origin credentialless iframe can't request storage access");
     25 
     26 promise_test(async test => {
     27  const cross_origin = get_host_info().HTTPS_REMOTE_ORIGIN;
     28  const iframe = newIframeCredentialless(cross_origin);
     29  assert_equals(await hasStorageAccess(iframe), "false");
     30 }, "Cross-origin credentialless iframe can't request storage access");