Bug 1474045. Make nsIScriptGlobalObject::HandleScriptError non-virtual. r=qdot

This commit is contained in:
Boris Zbarsky 2018-07-11 14:17:01 -07:00
Родитель 4a390e2fc4
Коммит 9f65fcc29a
4 изменённых файлов: 8 добавлений и 12 удалений

Просмотреть файл

@ -71,11 +71,9 @@ public:
/**
* Handle a script error. Generally called by a script context.
*/
virtual nsresult HandleScriptError(
const mozilla::dom::ErrorEventInit &aErrorEventInit,
nsEventStatus *aEventStatus) {
NS_ENSURE_STATE(NS_HandleScriptError(this, aErrorEventInit, aEventStatus));
return NS_OK;
bool HandleScriptError(const mozilla::dom::ErrorEventInit &aErrorEventInit,
nsEventStatus *aEventStatus) {
return NS_HandleScriptError(this, aErrorEventInit, aEventStatus);
}
virtual bool IsBlackForCC(bool aTracingNeeded = true) { return false; }

Просмотреть файл

@ -562,7 +562,7 @@ IndexedDatabaseManager::CommonPostHandleEvent(EventChainPostVisitor& aVisitor,
nsCOMPtr<nsIScriptGlobalObject> sgo = do_QueryInterface(window);
MOZ_ASSERT(sgo);
if (NS_WARN_IF(NS_FAILED(sgo->HandleScriptError(init, &status)))) {
if (NS_WARN_IF(!sgo->HandleScriptError(init, &status))) {
status = nsEventStatus_eIgnore;
}
} else {

Просмотреть файл

@ -132,7 +132,7 @@ public:
else if (nsGlobalWindowInner* win = xpc::WindowOrNull(global)) {
MOZ_ASSERT(NS_IsMainThread());
if (NS_FAILED(win->HandleScriptError(init, &status))) {
if (!win->HandleScriptError(init, &status)) {
NS_WARNING("Failed to dispatch main thread error event!");
status = nsEventStatus_eIgnore;
}
@ -385,7 +385,7 @@ WorkerErrorReport::ReportError(JSContext* aCx, WorkerPrivate* aWorkerPrivate,
else if (nsGlobalWindowInner* win = xpc::WindowOrNull(global)) {
MOZ_ASSERT(NS_IsMainThread());
if (NS_FAILED(win->HandleScriptError(init, &status))) {
if (!win->HandleScriptError(init, &status)) {
NS_WARNING("Failed to dispatch main thread error event!");
status = nsEventStatus_eIgnore;
}

Просмотреть файл

@ -2295,7 +2295,6 @@ WorkerPrivate::BroadcastErrorToSharedWorkers(
}
AutoTArray<WindowAction, 10> windowActions;
nsresult rv;
// First fire the error event at all SharedWorker objects. This may include
// multiple objects in a single window as well as objects in different
@ -2389,9 +2388,8 @@ WorkerPrivate::BroadcastErrorToSharedWorkers(
init.mBubbles = true;
nsEventStatus status = nsEventStatus_eIgnore;
rv = sgo->HandleScriptError(init, &status);
if (NS_FAILED(rv)) {
ThrowAndReport(windowAction.mWindow, rv);
if (!sgo->HandleScriptError(init, &status)) {
ThrowAndReport(windowAction.mWindow, NS_ERROR_UNEXPECTED);
continue;
}