mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 851781. Make sure that we don't reenter scriptblocker removal when we don't expect to. r=smaug
This commit is contained in:
parent
4584da5dc6
commit
17e7741d9a
@ -5035,10 +5035,15 @@ nsContentUtils::AddScriptBlocker()
|
||||
++sScriptBlockerCount;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
static bool sRemovingScriptBlockers = false;
|
||||
#endif
|
||||
|
||||
/* static */
|
||||
void
|
||||
nsContentUtils::RemoveScriptBlocker()
|
||||
{
|
||||
MOZ_ASSERT(!sRemovingScriptBlockers);
|
||||
NS_ASSERTION(sScriptBlockerCount != 0, "Negative script blockers");
|
||||
--sScriptBlockerCount;
|
||||
if (sScriptBlockerCount) {
|
||||
@ -5054,14 +5059,23 @@ nsContentUtils::RemoveScriptBlocker()
|
||||
"bad sRunnersCountAtFirstBlocker");
|
||||
|
||||
while (firstBlocker < lastBlocker) {
|
||||
nsCOMPtr<nsIRunnable> runnable = (*sBlockedScriptRunners)[firstBlocker];
|
||||
nsCOMPtr<nsIRunnable> runnable;
|
||||
runnable.swap((*sBlockedScriptRunners)[firstBlocker]);
|
||||
++firstBlocker;
|
||||
|
||||
// Calling the runnable can reenter us
|
||||
runnable->Run();
|
||||
// So can dropping the reference to the runnable
|
||||
runnable = nullptr;
|
||||
|
||||
NS_ASSERTION(sRunnersCountAtFirstBlocker == 0,
|
||||
"Bad count");
|
||||
NS_ASSERTION(!sScriptBlockerCount, "This is really bad");
|
||||
}
|
||||
#ifdef DEBUG
|
||||
AutoRestore<bool> removingScriptBlockers(sRemovingScriptBlockers);
|
||||
sRemovingScriptBlockers = true;
|
||||
#endif
|
||||
sBlockedScriptRunners->RemoveElementsAt(originalFirstBlocker, blockersCount);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user