tor-browser

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

helper_fission_setResolution.html (1768B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <head>
      4  <meta charset="utf-8">
      5  <title>setResolutionAndScaleTo is properly delivered to OOP iframes</title>
      6  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      7  <script src="/tests/SimpleTest/paint_listener.js"></script>
      8  <script src="helper_fission_utils.js"></script>
      9  <script src="apz_test_utils.js"></script>
     10  <script>
     11 
     12    async function test() {
     13      let iframeElement = document.getElementById("testframe");
     14      await setupCrossOriginIFrame(iframeElement, "helper_fission_plain.html");
     15 
     16      const scale = 2.0;
     17 
     18      SpecialPowers.getDOMWindowUtils(window).setResolutionAndScaleTo(scale);
     19      await promiseApzFlushedRepaints();
     20      await waitUntilApzStable();
     21 
     22      const originalWidth = originalHeight = 100;
     23      // eslint-disable-next-line no-unused-vars
     24      let { _x, _y, width, height } = await SpecialPowers.spawn(
     25        iframeElement,
     26        [originalWidth, originalHeight],
     27        // eslint-disable-next-line no-shadow
     28        (width, height) => {
     29          // nsIDOMWindowUtils.toScreenRect uses the iframe's transform which should
     30          // have been informed from APZ.
     31          return SpecialPowers.DOMWindowUtils.toScreenRect(0, 0, width, height);
     32        }
     33      );
     34 
     35      is(width, scale * originalWidth * window.devicePixelRatio,
     36        "The resolution value should be properly delivered into OOP iframes");
     37      is(height, scale * originalHeight * window.devicePixelRatio,
     38        "The resolution value should be properly delivered into OOP iframes");
     39    }
     40 
     41    waitUntilApzStable()
     42      .then(test)
     43      .then(subtestDone, subtestFailed);
     44 
     45  </script>
     46  <style>
     47    body,
     48    html {
     49      margin: 0;
     50    }
     51  </style>
     52 </head>
     53 <body>
     54  <iframe id="testframe"></iframe>
     55 </body>
     56 </html>