Bug 1442020 - Ensure neither style nor layout flushes are required when running promiseDocumentFlushed callbacks. r=bz

MozReview-Commit-ID: INGpltVvNmZ

--HG--
extra : rebase_source : 2f67f7c28211d0b78cd906c4b6e8da8eda7430f3
This commit is contained in:
Mike Conley 2018-02-28 16:15:51 -05:00
parent b8f68ba5dd
commit 1b65e844ad
2 changed files with 10 additions and 4 deletions

View File

@ -7434,7 +7434,8 @@ nsGlobalWindowInner::PromiseDocumentFlushed(PromiseDocumentFlushedCallback& aCal
UniquePtr<PromiseDocumentFlushedResolver> flushResolver(
new PromiseDocumentFlushedResolver(resultPromise, aCallback));
if (!shell->NeedFlush(FlushType::Style)) {
if (!shell->NeedFlush(FlushType::Style) &&
!shell->NeedFlush(FlushType::Layout)) {
flushResolver->Call();
return resultPromise.forget();
}
@ -7489,7 +7490,8 @@ nsGlobalWindowInner::DidRefresh()
nsIPresShell* shell = mDoc->GetShell();
MOZ_ASSERT(shell);
if (shell->NeedStyleFlush() || shell->HasPendingReflow()) {
if (shell->NeedFlush(FlushType::Style) ||
shell->NeedFlush(FlushType::Layout)) {
// By the time our observer fired, something has already invalidated
// style and maybe layout. We'll wait until the next refresh driver
// tick instead.

View File

@ -31,7 +31,9 @@ const gWindowUtils = window.QueryInterface(Ci.nsIInterfaceRequestor)
*/
function assertNoFlushesRequired() {
Assert.ok(!gWindowUtils.needsFlush(Ci.nsIDOMWindowUtils.FLUSH_STYLE),
"No flushes are required.");
"No style flushes are required.");
Assert.ok(!gWindowUtils.needsFlush(Ci.nsIDOMWindowUtils.FLUSH_LAYOUT),
"No layout flushes are required.");
}
/**
@ -39,8 +41,10 @@ function assertNoFlushesRequired() {
* are required.
*/
function assertFlushesRequired() {
Assert.ok(gWindowUtils.needsFlush(Ci.nsIDOMWindowUtils.FLUSH_STYLE),
"Style flush required.");
Assert.ok(gWindowUtils.needsFlush(Ci.nsIDOMWindowUtils.FLUSH_LAYOUT),
"Style and layout flushes are required.");
"Layout flush required.");
}
/**