Bug 1547848 - Lay out a cross-origin iframe on a test before calling getComputedStyle on its content window.
authorEmilio Cobos Álvarez <emilio@crisal.io>
Fri, 03 May 2019 12:59:56 +0200
changeset 531388 7921024c9fa6befe8ad1edf3037cb0a7bfacba7a
parent 531387 f8178fdb90bc7673d7079251a2e640cb701c94ba
child 531389 3e4cc0d312d0d4c953484a964a0ef8ecb3201601
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1547848, 1440537
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1547848 - Lay out a cross-origin iframe on a test before calling getComputedStyle on its content window. So that it's guaranteed to work after bug 1440537. See the other test fixes in that bug for similar things.
dom/base/test/test_blocking_image.html
--- a/dom/base/test/test_blocking_image.html
+++ b/dom/base/test/test_blocking_image.html
@@ -48,16 +48,23 @@ function onLoad() {
 
     // image from HTTP should be blocked.
     img.src = "http://example.com/tests/image/test/mochitest/shaver.png";
     doc.body.appendChild(img);
 
     imgListener(img).then(() => {
       ok(true, "img shouldn't be loaded");
 
+      // `iframe` is a content iframe, and thus not in the same docgroup with
+      // us, which are a chrome-privileged test.
+      //
+      // Ensure the frame is laid out so that this cross-origin
+      // getComputedStyle call is guaranteed to work after bug 1440537.
+      iframe.getBoundingClientRect();
+
       // We can't use matches(":-moz-suppressed") here, as -moz-suppressed is
       // chrome-only, however now we are in a content iframe.
       is(iframe.contentWindow.getComputedStyle(img).color, "rgb(0, 128, 0)",
          "color of img should be green");
       is(img.imageBlockingStatus, Ci.nsIContentPolicy.REJECT_SERVER,
          "imageBlockingStatues should be REJECT_SERVER.");
 
       img2.src = "https://test.invalid";