Bug 1209994 - Fix a couple of issues that make the percentage-height-calculation.html test unreliable. r=bz, a=sylvestre
authorRobert O'Callahan <robert@ocallahan.org>
Thu, 29 Oct 2015 16:56:30 +1300
changeset 296686 26ef30e81468
parent 296685 fabe9ce33dc2
child 296687 278b5140a696
push id5289
push userrocallahan@mozilla.com
push date2015-11-11 03:13 +0000
treeherdermozilla-beta@278b5140a696 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz, sylvestre
bugs1209994
milestone43.0
Bug 1209994 - Fix a couple of issues that make the percentage-height-calculation.html test unreliable. r=bz, a=sylvestre
testing/web-platform/meta/quirks-mode/percentage-height-calculation.html.ini
testing/web-platform/tests/quirks-mode/percentage-height-calculation.html
--- a/testing/web-platform/meta/quirks-mode/percentage-height-calculation.html.ini
+++ b/testing/web-platform/meta/quirks-mode/percentage-height-calculation.html.ini
@@ -9,17 +9,8 @@
   [The percentage height calculation quirk, <html><head xmlns="{html}"><style>#test { height:100% }</style></head><body xmlns="{html}"><div id="test"/></body></html>]
     expected: FAIL
 
   [The percentage height calculation quirk, <div xmlns="{html}"><head><style>#test { height:100% }</style></head><body><div id="test"/></body></div>]
     expected: FAIL
 
   [The percentage height calculation quirk, <HTML xmlns="{html}"><head><style>#test { height:100% }</style></head><body><div id="test"/></body></HTML>]
     expected: FAIL
-
-  [The percentage height calculation quirk, <img id=test src="{png}" height=100% border=10>]
-    expected:
-      if (os == "mac") and (version == "OS X 10.8") and (processor == "x86_64") and (bits == 64): FAIL
-      if (os == "mac") and (version == "OS X 10.10.2") and (processor == "x86") and (bits == 32): FAIL
-      if not debug and (os == "mac") and (version == "OS X 10.6.8") and (processor == "x86_64") and (bits == 64): FAIL
-      if debug and (os == "mac") and (version == "OS X 10.6.8") and (processor == "x86_64") and (bits == 64): FAIL
-      if debug and (os == "mac") and (version == "OS X 10.10.2") and (processor == "x86_64") and (bits == 64): FAIL
-
--- a/testing/web-platform/tests/quirks-mode/percentage-height-calculation.html
+++ b/testing/web-platform/tests/quirks-mode/percentage-height-calculation.html
@@ -6,21 +6,26 @@
   <script src="/resources/testharnessreport.js"></script>
   <style> iframe { width:20px; height:200px } </style>
  </head>
  <body>
   <div id=log></div>
   <iframe id=quirks></iframe>
   <iframe id=almost></iframe>
   <iframe id=standards></iframe>
+  <img id="preload">
   <script>
+    var png = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACklEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==";
+    // Ensure png is loaded and cached before we run the tests. Otherwise
+    // the tests that use it may run while it's not fully loaded and get <img>
+    // fallback layout (i.e., not an image with a 1x1 intrinsic size).
+    document.getElementById('preload').src = png;
     setup({explicit_done:true});
     onload = function() {
         var html = "<style id=style></style>";
-        var png = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACklEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==";
         var a_doctype = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">';
         var s_doctype = '<!DOCTYPE HTML>';
         var q = document.getElementById('quirks').contentWindow;
         var a = document.getElementById('almost').contentWindow;
         var s = document.getElementById('standards').contentWindow;
         q.document.open();
         q.document.write(html);
         q.document.close();
@@ -75,17 +80,19 @@
         {style:'body { margin:99px 0 } #test { height:100% }', body:'<div id=test></div>', q:2, s:0},
         {style:'body { margin:110px 0 } #test { height:100% }', body:'<div id=test></div>', q:0, s:0},
         {style:'html, body { border:10px none } #test { height:100% }', body:'<div id=test></div>', q:184, s:0},
         {style:'html, body { border:10px hidden } #test { height:100% }', body:'<div id=test></div>', q:184, s:0},
         ];
 
         tests.forEach(function(t) {
             test(function() {
-                var style = t.style.replace(/\{png\}/g, png);
+                // Hide scrollbars in all subdocuments so that a horizontal
+                // scrollbar doesn't appear and upset our calculations.
+                var style = t.style.replace(/\{png\}/g, png) + " html { overflow:hidden; }";
                 var body = t.body.replace(/\{png\}/g, png);
                 q.style.textContent = style;
                 a.style.textContent = style;
                 s.style.textContent = style;
                 q.document.body.innerHTML = body;
                 a.document.body.innerHTML = body;
                 s.document.body.innerHTML = body;