diff --git a/dom/bindings/Codegen.py b/dom/bindings/Codegen.py index 8b070e89cf3..a81abe2e65b 100644 --- a/dom/bindings/Codegen.py +++ b/dom/bindings/Codegen.py @@ -1728,7 +1728,6 @@ class CGConstructNavigatorObject(CGAbstractMethod): JS::Rooted v(aCx); { // Scope to make sure |result| goes out of scope while |v| is rooted RefPtr result = ConstructNavigatorObjectHelper(aCx, global, rv); - rv.WouldReportJSException(); if (rv.MaybeSetPendingException(aCx)) { return nullptr; } @@ -6770,7 +6769,6 @@ class CGCallGenerator(CGThing): self.cgRoot.prepend(CGGeneric("ErrorResult rv;\n")) self.cgRoot.append(CGGeneric(dedent( """ - rv.WouldReportJSException(); if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { return false; } @@ -8243,7 +8241,6 @@ class CGEnumerateHook(CGAbstractBindingMethod): nsAutoTArray names; ErrorResult rv; self->GetOwnPropertyNames(cx, names, rv); - rv.WouldReportJSException(); if (rv.MaybeSetPendingException(cx)) { return false; } @@ -10301,7 +10298,6 @@ class CGEnumerateOwnPropertiesViaGetOwnPropertyNames(CGAbstractBindingMethod): nsAutoTArray names; ErrorResult rv; self->GetOwnPropertyNames(cx, names, rv); - rv.WouldReportJSException(); if (rv.MaybeSetPendingException(cx)) { return false; } diff --git a/dom/bindings/ErrorResult.h b/dom/bindings/ErrorResult.h index d21f677cf1a..a44f3ba3bc1 100644 --- a/dom/bindings/ErrorResult.h +++ b/dom/bindings/ErrorResult.h @@ -160,6 +160,7 @@ public: // after true is returned. bool MaybeSetPendingException(JSContext* cx) { + WouldReportJSException(); if (!Failed()) { return false; } @@ -187,9 +188,8 @@ public: // Facilities for throwing a preexisting JS exception value via this // ErrorResult. The contract is that any code which might end up calling // ThrowJSException() must call MightThrowJSException() even if no exception - // is being thrown. Code that would call MaybeSetPendingException or - // StealJSException as needed must first call WouldReportJSException even if - // this ErrorResult has not failed. + // is being thrown. Code that would call StealJSException as needed must + // first call WouldReportJSException even if this ErrorResult has not failed. // // The exn argument to ThrowJSException can be in any compartment. It does // not have to be in the compartment of cx. If someone later uses it, they diff --git a/dom/fetch/Fetch.cpp b/dom/fetch/Fetch.cpp index 8cd2ec76335..773dff4de13 100644 --- a/dom/fetch/Fetch.cpp +++ b/dom/fetch/Fetch.cpp @@ -1007,7 +1007,6 @@ FetchBody::ContinueConsumeBody(nsresult aStatus, uint32_t aResultLength FetchUtil::ConsumeArrayBuffer(cx, &arrayBuffer, aResultLength, aResult, error); - error.WouldReportJSException(); if (!error.Failed()) { JS::Rooted val(cx); val.setObjectOrNull(arrayBuffer); @@ -1022,7 +1021,6 @@ FetchBody::ContinueConsumeBody(nsresult aStatus, uint32_t aResultLength RefPtr blob = FetchUtil::ConsumeBlob( DerivedClass()->GetParentObject(), NS_ConvertUTF8toUTF16(mMimeType), aResultLength, aResult, error); - error.WouldReportJSException(); if (!error.Failed()) { localPromise->MaybeResolve(blob); // File takes over ownership. diff --git a/js/xpconnect/src/Sandbox.cpp b/js/xpconnect/src/Sandbox.cpp index 1e800beb197..f8fa3c4eeb3 100644 --- a/js/xpconnect/src/Sandbox.cpp +++ b/js/xpconnect/src/Sandbox.cpp @@ -289,7 +289,6 @@ SandboxFetch(JSContext* cx, JS::HandleObject scope, const CallArgs& args) ErrorResult rv; RefPtr response = FetchRequest(global, Constify(request), Constify(options), rv); - rv.WouldReportJSException(); if (rv.MaybeSetPendingException(cx)) { return false; }