mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 579535 - Remove AddScriptBlockerAndPreventAddingRunners() API and warn about script runner failures. r=bz
This commit is contained in:
parent
86d3c4e599
commit
949e30351c
@ -1451,13 +1451,6 @@ public:
|
||||
*/
|
||||
static void AddScriptBlocker();
|
||||
|
||||
/**
|
||||
* Increases the count of blockers preventing scripts from running.
|
||||
* Also, while this script blocker is active, script runners must not be
|
||||
* added --- we'll assert if one is, and ignore it.
|
||||
*/
|
||||
static void AddScriptBlockerAndPreventAddingRunners();
|
||||
|
||||
/**
|
||||
* Decreases the count of blockers preventing scripts from running.
|
||||
* NOTE: You might want to use nsAutoScriptBlocker rather than calling
|
||||
|
@ -260,7 +260,6 @@ PRUint32 nsContentUtils::sDOMNodeRemovedSuppressCount = 0;
|
||||
#endif
|
||||
nsTArray< nsCOMPtr<nsIRunnable> >* nsContentUtils::sBlockedScriptRunners = nsnull;
|
||||
PRUint32 nsContentUtils::sRunnersCountAtFirstBlocker = 0;
|
||||
PRUint32 nsContentUtils::sScriptBlockerCountWhereRunnersPrevented = 0;
|
||||
nsIInterfaceRequestor* nsContentUtils::sSameOriginChecker = nsnull;
|
||||
|
||||
bool nsContentUtils::sIsHandlingKeyBoardEvent = false;
|
||||
@ -4417,25 +4416,12 @@ nsContentUtils::AddScriptBlocker()
|
||||
++sScriptBlockerCount;
|
||||
}
|
||||
|
||||
/* static */
|
||||
void
|
||||
nsContentUtils::AddScriptBlockerAndPreventAddingRunners()
|
||||
{
|
||||
AddScriptBlocker();
|
||||
if (sScriptBlockerCountWhereRunnersPrevented == 0) {
|
||||
sScriptBlockerCountWhereRunnersPrevented = sScriptBlockerCount;
|
||||
}
|
||||
}
|
||||
|
||||
/* static */
|
||||
void
|
||||
nsContentUtils::RemoveScriptBlocker()
|
||||
{
|
||||
NS_ASSERTION(sScriptBlockerCount != 0, "Negative script blockers");
|
||||
--sScriptBlockerCount;
|
||||
if (sScriptBlockerCount < sScriptBlockerCountWhereRunnersPrevented) {
|
||||
sScriptBlockerCountWhereRunnersPrevented = 0;
|
||||
}
|
||||
if (sScriptBlockerCount) {
|
||||
return;
|
||||
}
|
||||
@ -4469,10 +4455,6 @@ nsContentUtils::AddScriptRunner(nsIRunnable* aRunnable)
|
||||
}
|
||||
|
||||
if (sScriptBlockerCount) {
|
||||
if (sScriptBlockerCountWhereRunnersPrevented > 0) {
|
||||
NS_ERROR("Adding a script runner when that is prevented!");
|
||||
return false;
|
||||
}
|
||||
return sBlockedScriptRunners->AppendElement(aRunnable) != nsnull;
|
||||
}
|
||||
|
||||
|
@ -7097,8 +7097,16 @@ nsDocument::BlockOnload()
|
||||
// block onload only when there are no script blockers.
|
||||
++mAsyncOnloadBlockCount;
|
||||
if (mAsyncOnloadBlockCount == 1) {
|
||||
nsContentUtils::AddScriptRunner(
|
||||
bool success = nsContentUtils::AddScriptRunner(
|
||||
NS_NewRunnableMethod(this, &nsDocument::AsyncBlockOnload));
|
||||
|
||||
// The script runner shouldn't fail to add. But if somebody broke
|
||||
// something and it does, we'll thrash at 100% cpu forever. The best
|
||||
// response is just to ignore the onload blocking request. See bug 579535.
|
||||
if (!success) {
|
||||
NS_WARNING("Disaster! Onload blocking script runner failed to add - expect bad things!");
|
||||
mAsyncOnloadBlockCount = 0;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user