зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1433056: Account for pres shell destruction. r=smaug
The underlying issue here is that the pres shell was already being torn down when we flush. The less risky change here is to just change the assertions instead of IsSafeToFlush too, but the !isSafeToFlush || mViewManager assertion was also firing already, because we null out the view manager from Destroy. So this change is effectively idempotent behavior-wise (we tighten a bit the view manager assertion, but that should be fine). Just let me know if you want me to just loosen the assertions, but I think the IsSafeToFlush change is nicer too. MozReview-Commit-ID: 240qLlLi7RE --HG-- extra : rebase_source : df5dacb849a93e62f90e278c0d99f1034b341b79
This commit is contained in:
Родитель
fca1cd0193
Коммит
411705ebde
|
@ -4062,8 +4062,9 @@ PresShell::HandlePostedReflowCallbacks(bool aInterruptible)
|
|||
bool
|
||||
nsIPresShell::IsSafeToFlush() const
|
||||
{
|
||||
// Not safe if we are reflowing or in the middle of frame construction
|
||||
if (mIsReflowing || mChangeNestCount) {
|
||||
// Not safe if we are getting torn down, reflowing, or in the middle of frame
|
||||
// construction.
|
||||
if (mIsReflowing || mChangeNestCount || mIsDestroying) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -4102,8 +4103,6 @@ PresShell::DoFlushPendingNotifications(mozilla::ChangesToFlush aFlush)
|
|||
FlushType flushType = aFlush.mFlushType;
|
||||
|
||||
MOZ_ASSERT(NeedFlush(flushType), "Why did we get called?");
|
||||
MOZ_DIAGNOSTIC_ASSERT(mDocument->HasShellOrBFCacheEntry());
|
||||
MOZ_DIAGNOSTIC_ASSERT(mDocument->GetShell() == this);
|
||||
|
||||
#ifdef MOZ_GECKO_PROFILER
|
||||
static const EnumeratedArray<FlushType,
|
||||
|
@ -4153,12 +4152,16 @@ PresShell::DoFlushPendingNotifications(mozilla::ChangesToFlush aFlush)
|
|||
isSafeToFlush = isSafeToFlush && nsContentUtils::IsSafeToRunScript();
|
||||
}
|
||||
|
||||
NS_ASSERTION(!isSafeToFlush || mViewManager, "Must have view manager");
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mIsDestroying || !isSafeToFlush);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mIsDestroying || mViewManager);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mIsDestroying || mDocument->HasShellOrBFCacheEntry());
|
||||
MOZ_DIAGNOSTIC_ASSERT(mIsDestroying || mDocument->GetShell() == this);
|
||||
|
||||
// Make sure the view manager stays alive.
|
||||
RefPtr<nsViewManager> viewManager = mViewManager;
|
||||
bool didStyleFlush = false;
|
||||
bool didLayoutFlush = false;
|
||||
if (isSafeToFlush && viewManager) {
|
||||
if (isSafeToFlush) {
|
||||
// Record that we are in a flush, so that our optimization in
|
||||
// nsDocument::FlushPendingNotifications doesn't skip any re-entrant
|
||||
// calls to us. Otherwise, we might miss some needed flushes, since
|
||||
|
|
Загрузка…
Ссылка в новой задаче