tor-browser

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

element-ready-check-not-allowed-cross-origin.sub.html (1604B)


      1 <!DOCTYPE html>
      2 <title>Element ready check with no allowfullscreen attribute</title>
      3 <script src="/resources/testharness.js"></script>
      4 <script src="/resources/testharnessreport.js"></script>
      5 <script src="/resources/testdriver.js"></script>
      6 <script src="/resources/testdriver-vendor.js"></script>
      7 <script src="../trusted-click.js"></script>
      8 <body>
      9  <iframe name="cross-origin-default"></iframe>
     10 </body>
     11 
     12 <script>
     13  // Allow the time bomb to be triggered.
     14  setup({ allow_uncaught_exception: true });
     15 
     16  promise_test(async (t) => {
     17    t.add_cleanup(() => {
     18      if (document.fullscreenElement) return document.exitFullscreen();
     19    });
     20    const iframe = document.querySelector("iframe");
     21    await new Promise((resolve) => {
     22      iframe.onload = resolve;
     23      iframe.src =
     24        "http://{{hosts[alt][]}}:{{ports[http][0]}}/fullscreen/api/resources/attempt-fullscreen.html";
     25    });
     26    // Trigger the child frame to report as soon as its content is loaded.
     27    await trusted_click();
     28    const timeBomb = new Promise((resolve, reject) => {
     29      t.step_timeout(() => {
     30        const error = new Error("Timed out waiting for message");
     31        reject(error);
     32      }, 5000);
     33    });
     34    const data = await Promise.race([promiseMessage(iframe), timeBomb]);
     35    // When a message is received from a child frame, ensure that the report
     36    // matches the expectations.
     37    assert_false(
     38      data.report.result,
     39      `${data.report.frame} frame entered fullscreen, but allowfullscreen was not set`
     40    );
     41  }, "Cross-origin element ready check with no allowfullscreen or allow attribute");
     42 </script>