tor-browser

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

helper_fission_large_subframe.html (2969B)


      1 <!DOCTYPE HTML>
      2 <html id="rcd_docelement">
      3 <head>
      4  <meta charset="utf-8">
      5  <meta name="viewport" content="width=device-width,initial-scale=1">
      6  <title>Test that large OOPIF does not get a too-large displayport</title>
      7  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      8  <script src="/tests/SimpleTest/paint_listener.js"></script>
      9  <script src="helper_fission_utils.js"></script>
     10  <script src="apz_test_utils.js"></script>
     11  <script src="apz_test_native_event_utils.js"></script>
     12  <script>
     13 
     14    async function test() {
     15      let iframe = document.getElementById("testframe");
     16      await setupCrossOriginIFrame(iframe, "helper_fission_plain.html");
     17 
     18      const remoteType = await SpecialPowers.spawn(iframe, [], async () => {
     19        return await SpecialPowers.spawnChrome([], () => {
     20          return windowGlobalParent.domProcess.remoteType;
     21        });
     22      });
     23      if (remoteType === "web") {
     24        is(SpecialPowers.effectiveIsolationStrategy(), SpecialPowers.ISOLATION_STRATEGY.IsolateHighValue);
     25        ok(true, "Skipping this test since the document on example.com got loaded in the same content process");
     26        return;
     27      }
     28 
     29      // Give the page a scroll range and make sure APZ sets non-empty displayport margins.
     30      document.body.style.height = "500vh";
     31      await promiseApzFlushedRepaints();
     32 
     33      let iframeDp = await SpecialPowers.spawn(iframe, [], async () => {
     34        // Give the page a scroll range. This will make the unclamped displayport
     35        // even taller.
     36        content.document.body.style.height = "200vh";
     37        await content.wrappedJSObject.promiseApzFlushedRepaints();
     38 
     39        // Query the composed displayport and report it to the embedder.
     40        return content.wrappedJSObject.getLastContentDisplayportFor("fission_empty_docelement");
     41      });
     42      dump("iframe page displayport is " + JSON.stringify(iframeDp) + "\n");
     43 
     44      // Query the page's displayport.
     45      let dp = getLastContentDisplayportFor("rcd_docelement");
     46      dump("page displayport is " + JSON.stringify(dp) + "\n");
     47 
     48      // Check that the iframe's displayport is no more than twice as tall as
     49      // the page's displayport. The reason it can be up to twice as tall is
     50      // described in bug 1690697; we may be able to assert a tighter bound
     51      // after making improvements in that bug.
     52      ok(iframeDp.height <= (dp.height * 2), "iframe displayport should be no more than twice as tall as page displayport");
     53    }
     54 
     55    if (!SpecialPowers.Services.appinfo.fissionAutostart) {
     56      ok(true, "This test doesn't need to run with disabling Fission");
     57      subtestDone();
     58    } else {
     59      waitUntilApzStable()
     60        .then(test)
     61        .then(subtestDone, subtestFailed);
     62    }
     63 
     64  </script>
     65 </head>
     66 <body>
     67  <!-- Make the iframe's viewport very tall // todo: maybe rather use viewport units to make it scrollable -->
     68  <iframe style="margin-top: 200px" id="testframe" height="10000px"></iframe>
     69 </body>
     70 </html>