tor-browser

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

report-event-sandboxed-iframe.https.html (1186B)


      1 <!DOCTYPE html>
      2 <title>Test that window.fence.reportEvent does not crash in sandboxed iframes</title>
      3 <script src="/resources/testharness.js"></script>
      4 <script src="/resources/testharnessreport.js"></script>
      5 <script src="/common/utils.js"></script>
      6 <script src="/common/dispatcher/dispatcher.js"></script>
      7 <script src="resources/utils.js"></script>
      8 
      9 <body>
     10 <script>
     11 promise_test(async(t) => {
     12  const fencedframe = await attachFencedFrameContext({generator_api: 'fledge'});
     13  await fencedframe.execute(async () => {
     14    const iframe = await attachIFrameContext();
     15    await iframe.execute(() => {
     16      let event = {};
     17      event.eventType = "click";
     18      event.eventData = "dummy";
     19      event.destination = ["buyer"];
     20      window.fence.reportEvent(event);
     21    });
     22 
     23    const sandbox_iframe = await attachIFrameContext({attributes: [['sandbox', 'allow-scripts']]});
     24    await sandbox_iframe.execute(() => {
     25      let event = {};
     26      event.eventType = "click";
     27      event.eventData = "dummy";
     28      event.destination = ["buyer"];
     29      window.fence.reportEvent(event);
     30    });
     31  });
     32 }, 'window.fence.reportEvent in sandboxed (effectively cross-origin) iframe');
     33 </script>
     34 </body>