зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1052471: Adjust test_bug453650.xhtml to perform its reflow-causing restyle a bit later, *after* the reflow observer is registered. r=jfkthame
I'm hoping this fixes (or at least helps with) this intermittent test failure (an intermittent test-timeout). Before this patch, the test did the following: it made a layout-impacting restyle, and then it registered a reflow observer, and then it waited for the previously-performed restyle to be flushed, which it then expects to cause a reflow and trigger the reflow observer. When the test times out and intermittently fails, it seems that the reflow observer is successfully registered but never fires. I'm guessing that's because the reflow is getting flushed eagerly for some reason, and happens *before* the reflow observer is registered. We can avoid this problem by holding off on the restyle until after the reflow observer has been registered; that's the approach that this patch takes. (Note that this reflow-observer API isn't web-exposed; it's an internal API that we use to report reflows in our devtools.) Differential Revision: https://phabricator.services.mozilla.com/D100517
This commit is contained in:
Родитель
3ad026b52e
Коммит
f86b6c2086
|
@ -30,25 +30,27 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=453650
|
|||
info("iframe loaded");
|
||||
|
||||
var h1 = iframe.contentDocument.getElementById("h");
|
||||
h1.style.width = "400px";
|
||||
info("Adjusted h1.style.width; now calling waitForInterruptibleReflow");
|
||||
yield waitForInterruptibleReflow(iframe.docShell);
|
||||
let myCallback = function() { h1.style.width = "400px"; };
|
||||
info("Calling waitForInterruptibleReflow");
|
||||
yield waitForInterruptibleReflow(iframe.docShell, myCallback);
|
||||
info("got past top-level waitForInterruptibleReflow");
|
||||
|
||||
h1.style.width = "300px";
|
||||
info("Adjusted h1.style.width; now calling waitForReflow");
|
||||
waitForReflow(iframe.docShell);
|
||||
myCallback = function() { h1.style.width = "300px"; };
|
||||
info("Calling waitForReflow");
|
||||
waitForReflow(iframe.docShell, myCallback);
|
||||
info("got past top-level waitForReflow");
|
||||
yield is(300, h1.offsetWidth, "h1 has correct width");
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
function waitForInterruptibleReflow(docShell) {
|
||||
waitForReflow(docShell, true);
|
||||
function waitForInterruptibleReflow(docShell,
|
||||
callbackThatShouldTriggerReflow) {
|
||||
waitForReflow(docShell, callbackThatShouldTriggerReflow, true);
|
||||
}
|
||||
|
||||
function waitForReflow(docShell, interruptible = false) {
|
||||
function waitForReflow(docShell, callbackThatShouldTriggerReflow,
|
||||
interruptible = false) {
|
||||
info("Entering waitForReflow");
|
||||
function done() {
|
||||
info("Entering done (inside of waitForReflow)");
|
||||
|
@ -92,6 +94,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=453650
|
|||
|
||||
info("waitForReflow is adding a reflow observer");
|
||||
docShell.addWeakReflowObserver(observer);
|
||||
callbackThatShouldTriggerReflow();
|
||||
}
|
||||
|
||||
function whenLoaded(iframe) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче