tor-browser

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

fenced-frame.tentative.https.window.js (1751B)


      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 // META: timeout=long
      7 
      8 setup(() => {
      9  assert_implements(window.HTMLFencedFrameElement,
     10    "HTMLFencedFrameElement is not supported.");
     11 })
     12 
     13 // Check whether this credentialless bit propagates toward FencedFrame. It
     14 // shouldn't.
     15 promise_test(async test => {
     16  const origin = get_host_info().HTTPS_ORIGIN;
     17  const msg_queue = token();
     18 
     19  // 1. Create a credentialless iframe.
     20  const iframe_credentialless = newIframeCredentialless(origin);
     21 
     22  // 2. Create a FencedFrame within it.
     23  send(iframe_credentialless, `
     24    const importScript = ${importScript};
     25    await importScript("/common/utils.js");
     26    await importScript("/fenced-frame/resources/utils.js");
     27    await importScript("/html/cross-origin-embedder-policy/credentialless" +
     28      "/resources/common.js");
     29    await importScript("/html/anonymous-iframe/resources/common.js");
     30    const frame_fenced = await newFencedFrame("${origin}");
     31    send("${msg_queue}", frame_fenced);
     32  `);
     33  // TODO: Properly generate a fenced frame to check credentialless.
     34  assert_true(false, "Fenced frame cannot be created.");
     35  const frame_fenced = await receive(msg_queue);
     36 
     37  // 3. Expect it not to be considered credentialless.
     38  send(frame_fenced, `
     39    send("${msg_queue}", window.credentialless);
     40  `);
     41  // TODO: Properly generate a fenced frame which can perform this check.
     42  assert_equals(await receive(msg_queue), "false",
     43    "Check window.credentialless in FencedFrame");
     44 }, 'FencedFrame within a credentialless iframe is not credentialless')