Bug 1477610 - Wait for the load event before running viewport-unscaled-size-iframe.html. r=hiro
authorBotond Ballo <botond@mozilla.com>
Thu, 09 May 2019 03:57:08 +0000
changeset 531987 a7ec57d41cbbaf766097d735ba76908a2a587e16
parent 531986 695609f420a1f42efb91dbd552d4e75e1dc00c3f
child 531988 6d0c3c2fda714601e6fb61019ed2a9b9db0eeb81
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)
reviewershiro
bugs1477610
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 1477610 - Wait for the load event before running viewport-unscaled-size-iframe.html. r=hiro This ensures that the iframe is loaded by the time we query its visual viewport size. Differential Revision: https://phabricator.services.mozilla.com/D30417
testing/web-platform/meta/visual-viewport/viewport-unscaled-size-iframe.html.ini
testing/web-platform/tests/visual-viewport/viewport-unscaled-size-iframe.html
deleted file mode 100644
--- a/testing/web-platform/meta/visual-viewport/viewport-unscaled-size-iframe.html.ini
+++ /dev/null
@@ -1,13 +0,0 @@
-[viewport-unscaled-size-iframe.html]
-  [window.visualViewport.width of iframe viewport should match iframe width.]
-    expected: FAIL
-
-  [window.visualViewport.height of iframe viewport should match iframe height.]
-    expected: FAIL
-
-  [window.visualViewport.width of iframe viewport should not include scrollbar.]
-    expected: FAIL
-
-  [window.visualViewport.height of iframe viewport should not include scrollbar.]
-    expected: FAIL
-
--- a/testing/web-platform/tests/visual-viewport/viewport-unscaled-size-iframe.html
+++ b/testing/web-platform/tests/visual-viewport/viewport-unscaled-size-iframe.html
@@ -21,33 +21,45 @@
     <iframe></iframe>
     <div id="complete-notice">
         <p>frames[0].window.visualViewport width and height is (<span id="size-log"></span>).</p>
         <p>frames[0].window.visualViewport width and height when scrollbars are present is (<span id="size-scrollbars-log"></span>).</p>
     </div>
     <div id="log"></div>
     </body>
     <script>
-        var scrollbarThickness = calculateScrollbarThickness();
+        setup({ explicit_done: true });
+
+        function runTest() {
+          var scrollbarThickness = calculateScrollbarThickness();
 
-        test(function() {
-              assert_equals(frames[0].window.visualViewport.width, 200);
-            }, "window.visualViewport.width of iframe viewport should match iframe width.");
-        test(function() {
-              assert_equals(frames[0].window.visualViewport.height, 300);
-            }, "window.visualViewport.height of iframe viewport should match iframe height.");
+          test(function() {
+                assert_equals(frames[0].window.visualViewport.width, 200);
+              }, "window.visualViewport.width of iframe viewport should match iframe width.");
+          test(function() {
+                assert_equals(frames[0].window.visualViewport.height, 300);
+              }, "window.visualViewport.height of iframe viewport should match iframe height.");
 
-        document.getElementById("size-log").innerText = frames[0].window.visualViewport.width + ", " + frames[0].window.visualViewport.height;
+          document.getElementById("size-log").innerText = frames[0].window.visualViewport.width + ", " + frames[0].window.visualViewport.height;
+
+          // Add overflow so scrollbars appear.
+          window.frames[0].window.document.body.style.width = "2000px";
+          window.frames[0].window.document.body.style.height = "2000px";
 
-        // Add overflow so scrollbars appear.
-        window.frames[0].window.document.body.style.width = "2000px";
-        window.frames[0].window.document.body.style.height = "2000px";
+          test(function() {
+                assert_equals(frames[0].window.visualViewport.width, 200 - scrollbarThickness);
+              }, "window.visualViewport.width of iframe viewport should not include scrollbar.");
+          test(function() {
+                assert_equals(frames[0].window.visualViewport.height, 300 - scrollbarThickness);
+              }, "window.visualViewport.height of iframe viewport should not include scrollbar.");
 
-        test(function() {
-              assert_equals(frames[0].window.visualViewport.width, 200 - scrollbarThickness);
-            }, "window.visualViewport.width of iframe viewport should not include scrollbar.");
-        test(function() {
-              assert_equals(frames[0].window.visualViewport.height, 300 - scrollbarThickness);
-            }, "window.visualViewport.height of iframe viewport should not include scrollbar.");
+          document.getElementById("size-scrollbars-log").innerText = frames[0].window.visualViewport.width + ", " + frames[0].window.visualViewport.height;
+        }
 
-        document.getElementById("size-scrollbars-log").innerText = frames[0].window.visualViewport.width + ", " + frames[0].window.visualViewport.height;
+        window.onload = function() {
+          try {
+            runTest();
+          } finally {
+            done();
+          }
+        }
     </script>
 </html>