mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 10:44:56 +00:00
Bug 1363829 P9 Make docshell chrome tests wait for next paint to avoid races. r=smaug
This commit is contained in:
parent
9a57bd14ec
commit
e89c30f6c4
@ -58,7 +58,7 @@
|
||||
0, 0, 0, 0,
|
||||
false, false, false, false, 0, null);
|
||||
TestWindow.getDocument().getElementById("link1").dispatchEvent(event);
|
||||
setTimeout(nextTest, 0);
|
||||
waitForNextPaint(nextTest);
|
||||
yield undefined;
|
||||
|
||||
// Store the fragment url for later comparison.
|
||||
|
@ -283,7 +283,7 @@ function pageEventListener(event) {
|
||||
// doPageNavigation() to return.
|
||||
if ((typeof(gExpectedEvents) == "undefined") && event.type == "pageshow")
|
||||
{
|
||||
setTimeout(function() { gFinalEvent = true; }, 0);
|
||||
waitForNextPaint(function() { gFinalEvent = true; });
|
||||
return;
|
||||
}
|
||||
|
||||
@ -332,7 +332,7 @@ function pageEventListener(event) {
|
||||
|
||||
// If we're out of expected events, let doPageNavigation() return.
|
||||
if (gExpectedEvents.length == 0)
|
||||
setTimeout(function() { gFinalEvent = true; }, 0);
|
||||
waitForNextPaint(function() { gFinalEvent = true; });
|
||||
}
|
||||
|
||||
/**
|
||||
@ -417,6 +417,10 @@ function waitForTrue(fn, onWaitComplete, timeout) {
|
||||
}, 20);
|
||||
}
|
||||
|
||||
function waitForNextPaint(cb) {
|
||||
requestAnimationFrame(_ => requestAnimationFrame(cb));
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable or disable the bfcache.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user