diff --git a/widget/nsBaseAppShell.cpp b/widget/nsBaseAppShell.cpp index aa6468554b9..be813c6b735 100644 --- a/widget/nsBaseAppShell.cpp +++ b/widget/nsBaseAppShell.cpp @@ -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 diff --git a/widget/nsBaseAppShell.h b/widget/nsBaseAppShell.h index b2b9479ecbf..b528e88e484 100644 --- a/widget/nsBaseAppShell.h +++ b/widget/nsBaseAppShell.h @@ -134,6 +134,7 @@ private: }; EventloopNestingState mEventloopNestingState; nsTArray mSyncSections; + bool mRunningSyncSections; bool mRunning; bool mExiting; /**