[tbb-commits] [tor-browser/esr24] Bug 1023618 - Always call FlushRendering in the reftest harness. r=roc, a=test-only
mikeperry at torproject.org
mikeperry at torproject.org
Fri Aug 29 05:26:42 UTC 2014
commit 9192077d0d22be236936c29a4a87a7d2246869a8
Author: Seth Fowler <seth at mozilla.com>
Date: Wed Jun 11 20:21:08 2014 -0700
Bug 1023618 - Always call FlushRendering in the reftest harness. r=roc, a=test-only
---
layout/tools/reftest/reftest-content.js | 51 +++++++++++++++++--------------
1 file changed, 28 insertions(+), 23 deletions(-)
diff --git a/layout/tools/reftest/reftest-content.js b/layout/tools/reftest/reftest-content.js
index 09ee3e2..efadf82 100644
--- a/layout/tools/reftest/reftest-content.js
+++ b/layout/tools/reftest/reftest-content.js
@@ -268,43 +268,45 @@ const STATE_WAITING_FOR_SPELL_CHECKS = 2;
const STATE_WAITING_TO_FINISH = 3;
const STATE_COMPLETED = 4;
-function WaitForTestEnd(contentRootElement, inPrintMode, spellCheckedElements) {
- var stopAfterPaintReceived = false;
- var currentDoc = content.document;
- var state = STATE_WAITING_TO_FIRE_INVALIDATE_EVENT;
-
- function FlushRendering() {
- var anyPendingPaintsGeneratedInDescendants = false;
+function FlushRendering() {
+ var anyPendingPaintsGeneratedInDescendants = false;
- function flushWindow(win) {
- var utils = win.QueryInterface(CI.nsIInterfaceRequestor)
- .getInterface(CI.nsIDOMWindowUtils);
- var afterPaintWasPending = utils.isMozAfterPaintPending;
+ function flushWindow(win) {
+ var utils = win.QueryInterface(CI.nsIInterfaceRequestor)
+ .getInterface(CI.nsIDOMWindowUtils);
+ var afterPaintWasPending = utils.isMozAfterPaintPending;
+ if (win.document.documentElement) {
try {
// Flush pending restyles and reflows for this window
win.document.documentElement.getBoundingClientRect();
} catch (e) {
LogWarning("flushWindow failed: " + e + "\n");
}
+ }
- if (!afterPaintWasPending && utils.isMozAfterPaintPending) {
- LogInfo("FlushRendering generated paint for window " + win.location.href);
- anyPendingPaintsGeneratedInDescendants = true;
- }
+ if (!afterPaintWasPending && utils.isMozAfterPaintPending) {
+ LogInfo("FlushRendering generated paint for window " + win.location.href);
+ anyPendingPaintsGeneratedInDescendants = true;
+ }
- for (var i = 0; i < win.frames.length; ++i) {
- flushWindow(win.frames[i]);
- }
+ for (var i = 0; i < win.frames.length; ++i) {
+ flushWindow(win.frames[i]);
}
+ }
- flushWindow(content);
+ flushWindow(content);
- if (anyPendingPaintsGeneratedInDescendants &&
- !windowUtils().isMozAfterPaintPending) {
- LogWarning("Internal error: descendant frame generated a MozAfterPaint event, but the root document doesn't have one!");
- }
+ if (anyPendingPaintsGeneratedInDescendants &&
+ !windowUtils().isMozAfterPaintPending) {
+ LogWarning("Internal error: descendant frame generated a MozAfterPaint event, but the root document doesn't have one!");
}
+}
+
+function WaitForTestEnd(contentRootElement, inPrintMode, spellCheckedElements) {
+ var stopAfterPaintReceived = false;
+ var currentDoc = content.document;
+ var state = STATE_WAITING_TO_FIRE_INVALIDATE_EVENT;
function AfterPaintListener(event) {
LogInfo("AfterPaintListener in " + event.target.document.location.href);
@@ -541,6 +543,9 @@ function OnDocumentLoad(event)
var contentRootElement =
content.document ? content.document.documentElement : null;
+ // Flush the document in case it got modified in a load event handler.
+ FlushRendering();
+
// Take a snapshot now. We need to do this before we check whether
// we should wait, since this might trigger dispatching of
// MozPaintWait events and make shouldWaitForExplicitPaintWaiters() true
More information about the tbb-commits
mailing list