Bug 1206858 - Ensure that multiple concurrent calls to waitForAllPaints are handled properly. r=mattwoodrow

--HG--
extra : commitid : 1em2BrTkdxf
This commit is contained in:
Kartikaya Gupta 2015-09-22 09:01:08 -04:00
parent c810a2f09a
commit 905fe40dd6

View File

@ -1,6 +1,6 @@
(function() {
var accumulatedRect = null;
var onpaint = function() {};
var onpaint = new Array();
var debug = false;
const FlushModes = {
FLUSH: 0,
@ -24,7 +24,9 @@
Math.max(accumulatedRect[2], eventRect[2]),
Math.max(accumulatedRect[3], eventRect[3]) ]
: eventRect;
onpaint();
while (onpaint.length > 0) {
window.setTimeout(onpaint.pop(), 0);
}
}
window.addEventListener("MozAfterPaint", paintListener, false);
@ -35,7 +37,6 @@
if (debug) {
dump("waiting for paint suppression to end...\n");
}
onpaint = function() {};
window.setTimeout(function() {
waitForPaints(callback, subdoc, flushMode);
}, 0);
@ -56,8 +57,8 @@
if (debug) {
dump("waiting for paint...\n");
}
onpaint =
function() { waitForPaints(callback, subdoc, FlushModes.NOFLUSH); };
onpaint.push(
function() { waitForPaints(callback, subdoc, FlushModes.NOFLUSH); });
if (utils.isTestControllingRefreshes) {
utils.advanceTimeAndRefresh(0);
}
@ -69,7 +70,6 @@
}
var result = accumulatedRect || [ 0, 0, 0, 0 ];
accumulatedRect = null;
onpaint = function() {};
callback.apply(null, result);
}