mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-28 12:45:27 +00:00
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:
parent
b8f68ba5dd
commit
1b65e844ad
@ -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.
|
||||
|
@ -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.");
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user