зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1261499 - Make nsContentUtils::AddScriptRunner return void, r=khuey
This commit is contained in:
Родитель
bf94e2fc4e
Коммит
1d3df2ccde
|
@ -5029,28 +5029,27 @@ nsContentUtils::WarnScriptWasIgnored(nsIDocument* aDocument)
|
|||
}
|
||||
|
||||
/* static */
|
||||
bool
|
||||
void
|
||||
nsContentUtils::AddScriptRunner(already_AddRefed<nsIRunnable> aRunnable)
|
||||
{
|
||||
nsCOMPtr<nsIRunnable> runnable = aRunnable;
|
||||
if (!runnable) {
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (sScriptBlockerCount) {
|
||||
return sBlockedScriptRunners->AppendElement(runnable.forget()) != nullptr;
|
||||
sBlockedScriptRunners->AppendElement(runnable.forget());
|
||||
return;
|
||||
}
|
||||
|
||||
runnable->Run();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* static */
|
||||
bool
|
||||
void
|
||||
nsContentUtils::AddScriptRunner(nsIRunnable* aRunnable) {
|
||||
nsCOMPtr<nsIRunnable> runnable = aRunnable;
|
||||
return AddScriptRunner(runnable.forget());
|
||||
AddScriptRunner(runnable.forget());
|
||||
}
|
||||
|
||||
/* static */
|
||||
|
|
|
@ -1606,10 +1606,9 @@ public:
|
|||
* scripts. Passing null is allowed and results in nothing
|
||||
* happening. It is also allowed to pass an object that
|
||||
* has not yet been AddRefed.
|
||||
* @return false on out of memory, true otherwise.
|
||||
*/
|
||||
static bool AddScriptRunner(already_AddRefed<nsIRunnable> aRunnable);
|
||||
static bool AddScriptRunner(nsIRunnable* aRunnable);
|
||||
static void AddScriptRunner(already_AddRefed<nsIRunnable> aRunnable);
|
||||
static void AddScriptRunner(nsIRunnable* aRunnable);
|
||||
|
||||
/**
|
||||
* Returns true if it's safe to execute content script and false otherwise.
|
||||
|
|
|
@ -9082,16 +9082,8 @@ nsDocument::BlockOnload()
|
|||
// block onload only when there are no script blockers.
|
||||
++mAsyncOnloadBlockCount;
|
||||
if (mAsyncOnloadBlockCount == 1) {
|
||||
bool success = nsContentUtils::AddScriptRunner(
|
||||
nsContentUtils::AddScriptRunner(
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -1196,9 +1196,8 @@ nsTextEditorState::BindToFrame(nsTextControlFrame* aFrame)
|
|||
// otherwise, inherit the content node's direction
|
||||
}
|
||||
|
||||
if (!nsContentUtils::AddScriptRunner(
|
||||
new PrepareEditorEvent(*this, content, currentValue)))
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
nsContentUtils::AddScriptRunner(
|
||||
new PrepareEditorEvent(*this, content, currentValue));
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
|
|
@ -159,7 +159,8 @@ nsPluginInstanceOwner::NotifyPaintWaiter(nsDisplayListBuilder* aBuilder)
|
|||
nsCOMPtr<nsIRunnable> event = new AsyncPaintWaitEvent(content, false);
|
||||
// Run this event as soon as it's safe to do so, since listeners need to
|
||||
// receive it immediately
|
||||
mWaitingForPaint = nsContentUtils::AddScriptRunner(event);
|
||||
nsContentUtils::AddScriptRunner(event);
|
||||
mWaitingForPaint = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1012,8 +1012,7 @@ nsComboboxControlFrame::RedisplayText(int32_t aIndex)
|
|||
|
||||
RefPtr<RedisplayTextEvent> event = new RedisplayTextEvent(this);
|
||||
mRedisplayTextEvent = event;
|
||||
if (!nsContentUtils::AddScriptRunner(event))
|
||||
mRedisplayTextEvent.Forget();
|
||||
nsContentUtils::AddScriptRunner(event);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -394,12 +394,7 @@ nsTextControlFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
|
|||
}
|
||||
initializer = new EditorInitializer(this);
|
||||
Properties().Set(TextControlInitializer(),initializer);
|
||||
if (!nsContentUtils::AddScriptRunner(initializer)) {
|
||||
initializer->Revoke(); // paranoia
|
||||
Properties().Delete(TextControlInitializer());
|
||||
delete initializer;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
nsContentUtils::AddScriptRunner(initializer);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
|
Загрузка…
Ссылка в новой задаче