tor-browser

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

localstorage-cross-origin-iframe.https.window.js (945B)


      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=/html/anonymous-iframe/resources/common.js
      6 
      7 promise_test(async test => {
      8    const same_origin= get_host_info().HTTPS_ORIGIN;
      9    const cross_origin = get_host_info().HTTPS_REMOTE_ORIGIN;
     10    const reply_token = token();
     11 
     12    for(iframe of [
     13      newIframe(same_origin),
     14      newIframe(cross_origin),
     15    ]) {
     16      send(iframe, `
     17        try {
     18          let c = window.localStorage;
     19          send("${reply_token}","OK");
     20        } catch (exception) {
     21          send("${reply_token}","ERROR");
     22        }
     23      `);
     24    }
     25    assert_equals(await receive(reply_token), "OK");
     26    assert_equals(await receive(reply_token), "OK");
     27  }, "LocalStorage should be accessible on both same_origin and cross_origin iframes");