Bug 1157488 - Assert against re-entrant sync sections. r=bent

This commit is contained in:
Bobby Holley 2015-04-22 15:32:43 -07:00
parent 593c23f2d0
commit 345531a4ce
2 changed files with 8 additions and 0 deletions

View File

@ -31,6 +31,7 @@ nsBaseAppShell::nsBaseAppShell()
, mSwitchTime(0)
, mLastNativeEventTime(0)
, mEventloopNestingState(eEventloopNone)
, mRunningSyncSections(false)
, mRunning(false)
, mExiting(false)
, mBlockNativeEvent(false)
@ -350,6 +351,11 @@ nsBaseAppShell::RunSyncSectionsInternal(bool aStable,
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
NS_ASSERTION(!mSyncSections.IsEmpty(), "Nothing to do!");
// We don't support re-entering sync sections. This effectively means that
// sync sections may not spin the event loop.
MOZ_RELEASE_ASSERT(!mRunningSyncSections);
mRunningSyncSections = true;
// We've got synchronous sections. Run all of them that are are awaiting a
// stable state if aStable is true (i.e. we really are in a stable state).
// Also run the synchronous sections that are simply waiting for the right
@ -377,6 +383,7 @@ nsBaseAppShell::RunSyncSectionsInternal(bool aStable,
}
mSyncSections.SwapElements(pendingSyncSections);
mRunningSyncSections = false;
}
void

View File

@ -134,6 +134,7 @@ private:
};
EventloopNestingState mEventloopNestingState;
nsTArray<SyncSection> mSyncSections;
bool mRunningSyncSections;
bool mRunning;
bool mExiting;
/**