Bug 852413 - Wait even more for painting to finish before forcing a paint. r=mattwoodrow
authorJoe Drew <joe@drew.ca>
Tue, 19 Mar 2013 21:47:11 -0400
changeset 125550 3ec52a8caf731e214fda17144379594975f38c44
parent 125549 5b4e1e56815ee405d5e93f85fbf2f4795171e61d
child 125551 cd08011c06f782ceb7e505463994ebdb478abc00
push id24459
push useremorley@mozilla.com
push dateWed, 20 Mar 2013 11:46:36 +0000
treeherdermozilla-central@1d6fe70c79c5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs852413
milestone22.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 852413 - Wait even more for painting to finish before forcing a paint. r=mattwoodrow
layout/base/tests/test_image_layers.html
--- a/layout/base/tests/test_image_layers.html
+++ b/layout/base/tests/test_image_layers.html
@@ -14,35 +14,46 @@
 if (!navigator.platform.startsWith("Linux")) {
   SimpleTest.expectAssertions(0, 3);
 }
 
 SimpleTest.waitForExplicitFinish();
 
 var image = document.getElementById("image");
 var lastPaintCount;
+var utils = SpecialPowers.getDOMWindowUtils(window);
 
 function changeImage() {
-  var utils = SpecialPowers.getDOMWindowUtils(window);
   utils.checkAndClearPaintedState(image);
 
   image.src = "./image_rrgg-256x256.png";
   image.onload = function() {
     lastPaintCount = window.mozPaintCount;
-    document.body.style.background = "black";
-    checkDone();
+    checkDonePainting();
   }
 }
 
+// Wait until we've painted after the image loads, then force a paint and make
+// sure the image doesn't get drawn.
+function checkDonePainting() {
+  if (window.mozPaintCount == lastPaintCount || utils.isMozAfterPaintPending) {
+    setTimeout(checkDonePainting, 30);
+    return;
+  }
+
+  lastPaintCount = window.mozPaintCount;
+  document.body.style.background = "black";
+  checkDone();
+}
+
 function checkDone() {
-  if (window.mozPaintCount == lastPaintCount) {
+  if (window.mozPaintCount == lastPaintCount || utils.isMozAfterPaintPending) {
     setTimeout(checkDone, 30);
     return;
   }
 
-  var utils = SpecialPowers.getDOMWindowUtils(window);
   ok(!utils.checkAndClearPaintedState(image), "Should not paint any thebes layers for our image!");
   SimpleTest.finish();
 }
 </script>
 </pre>
 </body>
 </html>