diff --git a/dom/base/nsIScriptGlobalObject.h b/dom/base/nsIScriptGlobalObject.h index b836b69658f2..3173446019dc 100644 --- a/dom/base/nsIScriptGlobalObject.h +++ b/dom/base/nsIScriptGlobalObject.h @@ -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; } diff --git a/dom/indexedDB/IndexedDatabaseManager.cpp b/dom/indexedDB/IndexedDatabaseManager.cpp index 4a9dc007b5cf..cdd54dec0c5f 100644 --- a/dom/indexedDB/IndexedDatabaseManager.cpp +++ b/dom/indexedDB/IndexedDatabaseManager.cpp @@ -562,7 +562,7 @@ IndexedDatabaseManager::CommonPostHandleEvent(EventChainPostVisitor& aVisitor, nsCOMPtr 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 { diff --git a/dom/workers/WorkerError.cpp b/dom/workers/WorkerError.cpp index f0d1c0b67fa0..298ab181b417 100644 --- a/dom/workers/WorkerError.cpp +++ b/dom/workers/WorkerError.cpp @@ -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; } diff --git a/dom/workers/WorkerPrivate.cpp b/dom/workers/WorkerPrivate.cpp index fd1bcf8f7d5f..769efa9ed0b6 100644 --- a/dom/workers/WorkerPrivate.cpp +++ b/dom/workers/WorkerPrivate.cpp @@ -2295,7 +2295,6 @@ WorkerPrivate::BroadcastErrorToSharedWorkers( } AutoTArray 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; }