mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1224007 part 3. Push down WouldReportJSException into MaybeSetPendingException, since anyone calling the latter will propagate the JS exception as needed. r=peterv
This commit is contained in:
parent
e8c630e0ad
commit
939138a7a4
@ -1728,7 +1728,6 @@ class CGConstructNavigatorObject(CGAbstractMethod):
|
||||
JS::Rooted<JS::Value> v(aCx);
|
||||
{ // Scope to make sure |result| goes out of scope while |v| is rooted
|
||||
RefPtr<mozilla::dom::${descriptorName}> 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<nsString, 8> names;
|
||||
ErrorResult rv;
|
||||
self->GetOwnPropertyNames(cx, names, rv);
|
||||
rv.WouldReportJSException();
|
||||
if (rv.MaybeSetPendingException(cx)) {
|
||||
return false;
|
||||
}
|
||||
@ -10301,7 +10298,6 @@ class CGEnumerateOwnPropertiesViaGetOwnPropertyNames(CGAbstractBindingMethod):
|
||||
nsAutoTArray<nsString, 8> names;
|
||||
ErrorResult rv;
|
||||
self->GetOwnPropertyNames(cx, names, rv);
|
||||
rv.WouldReportJSException();
|
||||
if (rv.MaybeSetPendingException(cx)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -1007,7 +1007,6 @@ FetchBody<Derived>::ContinueConsumeBody(nsresult aStatus, uint32_t aResultLength
|
||||
FetchUtil::ConsumeArrayBuffer(cx, &arrayBuffer, aResultLength, aResult,
|
||||
error);
|
||||
|
||||
error.WouldReportJSException();
|
||||
if (!error.Failed()) {
|
||||
JS::Rooted<JS::Value> val(cx);
|
||||
val.setObjectOrNull(arrayBuffer);
|
||||
@ -1022,7 +1021,6 @@ FetchBody<Derived>::ContinueConsumeBody(nsresult aStatus, uint32_t aResultLength
|
||||
RefPtr<dom::Blob> blob = FetchUtil::ConsumeBlob(
|
||||
DerivedClass()->GetParentObject(), NS_ConvertUTF8toUTF16(mMimeType),
|
||||
aResultLength, aResult, error);
|
||||
error.WouldReportJSException();
|
||||
if (!error.Failed()) {
|
||||
localPromise->MaybeResolve(blob);
|
||||
// File takes over ownership.
|
||||
|
@ -289,7 +289,6 @@ SandboxFetch(JSContext* cx, JS::HandleObject scope, const CallArgs& args)
|
||||
ErrorResult rv;
|
||||
RefPtr<dom::Promise> response =
|
||||
FetchRequest(global, Constify(request), Constify(options), rv);
|
||||
rv.WouldReportJSException();
|
||||
if (rv.MaybeSetPendingException(cx)) {
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user