Source code
Revision control
Copy as Markdown
Other Tools
<!DOCTYPE HTML>
<html>
<head>
  <meta charset="utf-8">
  <title>setResolutionAndScaleTo is properly delivered to OOP iframes</title>
  <script src="/tests/SimpleTest/SimpleTest.js"></script>
  <script src="/tests/SimpleTest/paint_listener.js"></script>
  <script src="helper_fission_utils.js"></script>
  <script src="apz_test_utils.js"></script>
  <script>
    async function test() {
      let iframeElement = document.getElementById("testframe");
      await setupCrossOriginIFrame(iframeElement, "helper_fission_plain.html");
      const scale = 2.0;
      SpecialPowers.getDOMWindowUtils(window).setResolutionAndScaleTo(scale);
      await promiseApzFlushedRepaints();
      await waitUntilApzStable();
      const originalWidth = originalHeight = 100;
      // eslint-disable-next-line no-unused-vars
      let { _x, _y, width, height } = await SpecialPowers.spawn(
        iframeElement,
        [originalWidth, originalHeight],
        // eslint-disable-next-line no-shadow
        (width, height) => {
          // nsIDOMWindowUtils.toScreenRect uses the iframe's transform which should
          // have been informed from APZ.
          return SpecialPowers.DOMWindowUtils.toScreenRect(0, 0, width, height);
        }
      );
      is(width, scale * originalWidth * window.devicePixelRatio,
        "The resolution value should be properly delivered into OOP iframes");
      is(height, scale * originalHeight * window.devicePixelRatio,
        "The resolution value should be properly delivered into OOP iframes");
    }
    waitUntilApzStable()
      .then(test)
      .then(subtestDone, subtestFailed);
  </script>
  <style>
    body,
    html {
      margin: 0;
    }
  </style>
</head>
<body>
  <iframe id="testframe"></iframe>
</body>
</html>