diff --git a/dom/base/nsGlobalWindowInner.cpp b/dom/base/nsGlobalWindowInner.cpp index ee2fd4aabc7c..c9a41bb0adfc 100644 --- a/dom/base/nsGlobalWindowInner.cpp +++ b/dom/base/nsGlobalWindowInner.cpp @@ -7434,7 +7434,8 @@ nsGlobalWindowInner::PromiseDocumentFlushed(PromiseDocumentFlushedCallback& aCal UniquePtr 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. diff --git a/dom/base/test/browser_promiseDocumentFlushed.js b/dom/base/test/browser_promiseDocumentFlushed.js index a1c0ea362b19..b24480c84a62 100644 --- a/dom/base/test/browser_promiseDocumentFlushed.js +++ b/dom/base/test/browser_promiseDocumentFlushed.js @@ -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."); } /**