summaryrefslogtreecommitdiff
path: root/dom/bindings
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@wolfbeast.com>2019-12-19 01:35:24 +0100
committerwolfbeast <mcwerewolf@wolfbeast.com>2019-12-19 01:35:24 +0100
commitfb96b43b5f6188233710c5f8c9c9e46baa9cb369 (patch)
tree54124a46275f833ecd9f6e63246e092a93843fb0 /dom/bindings
parent8220776c9b2e8291f0414f98ac20fbda30e00d2e (diff)
downloaduxp-fb96b43b5f6188233710c5f8c9c9e46baa9cb369.tar.gz
Issue #1322 - Part 1: Remove the DOM Promise guts.
This removes all the parts guarded by SPIDERMONKEY_PROMISE
Diffstat (limited to 'dom/bindings')
-rw-r--r--dom/bindings/BindingUtils.cpp37
-rw-r--r--dom/bindings/Codegen.py40
-rw-r--r--dom/bindings/ToJSValue.cpp4
-rw-r--r--dom/bindings/ToJSValue.h2
4 files changed, 1 insertions, 82 deletions
diff --git a/dom/bindings/BindingUtils.cpp b/dom/bindings/BindingUtils.cpp
index 6e0db29b10..b244d4d2ad 100644
--- a/dom/bindings/BindingUtils.cpp
+++ b/dom/bindings/BindingUtils.cpp
@@ -2976,42 +2976,6 @@ ConvertExceptionToPromise(JSContext* cx,
JSObject* promiseScope,
JS::MutableHandle<JS::Value> rval)
{
-#ifndef SPIDERMONKEY_PROMISE
- GlobalObject global(cx, promiseScope);
- if (global.Failed()) {
- return false;
- }
-
- JS::Rooted<JS::Value> exn(cx);
- if (!JS_GetPendingException(cx, &exn)) {
- // This is very important: if there is no pending exception here but we're
- // ending up in this code, that means the callee threw an uncatchable
- // exception. Just propagate that out as-is.
- return false;
- }
-
- JS_ClearPendingException(cx);
-
- nsCOMPtr<nsIGlobalObject> globalObj =
- do_QueryInterface(global.GetAsSupports());
- if (!globalObj) {
- ErrorResult rv;
- rv.Throw(NS_ERROR_UNEXPECTED);
- return !rv.MaybeSetPendingException(cx);
- }
-
- ErrorResult rv;
- RefPtr<Promise> promise = Promise::Reject(globalObj, cx, exn, rv);
- if (rv.MaybeSetPendingException(cx)) {
- // We just give up. We put the exception from the ErrorResult on
- // the JSContext just to make sure to not leak memory on the
- // ErrorResult, but now just put the original exception back.
- JS_SetPendingException(cx, exn);
- return false;
- }
-
- return GetOrCreateDOMReflector(cx, promise, rval);
-#else // SPIDERMONKEY_PROMISE
{
JSAutoCompartment ac(cx, promiseScope);
@@ -3037,7 +3001,6 @@ ConvertExceptionToPromise(JSContext* cx,
// Now make sure we rewrap promise back into the compartment we want
return JS_WrapValue(cx, rval);
-#endif // SPIDERMONKEY_PROMISE
}
/* static */
diff --git a/dom/bindings/Codegen.py b/dom/bindings/Codegen.py
index 924241aa0c..9cde82df93 100644
--- a/dom/bindings/Codegen.py
+++ b/dom/bindings/Codegen.py
@@ -3052,23 +3052,6 @@ class CGCreateInterfaceObjectsMethod(CGAbstractMethod):
else:
unforgeableHolderSetup = None
- if self.descriptor.name == "Promise":
- speciesSetup = CGGeneric(fill(
- """
- #ifndef SPIDERMONKEY_PROMISE
- JS::Rooted<JSObject*> promiseConstructor(aCx, *interfaceCache);
- JS::Rooted<jsid> species(aCx,
- SYMBOL_TO_JSID(JS::GetWellKnownSymbol(aCx, JS::SymbolCode::species)));
- if (!JS_DefinePropertyById(aCx, promiseConstructor, species, JS::UndefinedHandleValue,
- JSPROP_SHARED, Promise::PromiseSpecies, nullptr)) {
- $*{failureCode}
- }
- #endif // SPIDERMONKEY_PROMISE
- """,
- failureCode=failureCode))
- else:
- speciesSetup = None
-
if (self.descriptor.interface.isOnGlobalProtoChain() and
needInterfacePrototypeObject):
makeProtoPrototypeImmutable = CGGeneric(fill(
@@ -3094,7 +3077,7 @@ class CGCreateInterfaceObjectsMethod(CGAbstractMethod):
return CGList(
[getParentProto, getConstructorProto, initIds,
prefCache, CGGeneric(call), defineAliases, unforgeableHolderSetup,
- speciesSetup, makeProtoPrototypeImmutable],
+ makeProtoPrototypeImmutable],
"\n").define()
@@ -5414,7 +5397,6 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
$*{exceptionCode}
}
binding_detail::FastErrorResult promiseRv;
- #ifdef SPIDERMONKEY_PROMISE
nsCOMPtr<nsIGlobalObject> global =
do_QueryInterface(promiseGlobal.GetAsSupports());
if (!global) {
@@ -5427,26 +5409,6 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
if (promiseRv.MaybeSetPendingException(cx)) {
$*{exceptionCode}
}
- #else
- JS::Handle<JSObject*> promiseCtor =
- PromiseBinding::GetConstructorObjectHandle(cx);
- if (!promiseCtor) {
- $*{exceptionCode}
- }
- JS::Rooted<JS::Value> resolveThisv(cx, JS::ObjectValue(*promiseCtor));
- JS::Rooted<JS::Value> resolveResult(cx);
- Promise::Resolve(promiseGlobal, resolveThisv, valueToResolve,
- &resolveResult, promiseRv);
- if (promiseRv.MaybeSetPendingException(cx)) {
- $*{exceptionCode}
- }
- nsresult unwrapRv = UNWRAP_OBJECT(Promise, &resolveResult.toObject(), $${declName});
- if (NS_FAILED(unwrapRv)) { // Quite odd
- promiseRv.Throw(unwrapRv);
- promiseRv.MaybeSetPendingException(cx);
- $*{exceptionCode}
- }
- #endif // SPIDERMONKEY_PROMISE
}
""",
getPromiseGlobal=getPromiseGlobal,
diff --git a/dom/bindings/ToJSValue.cpp b/dom/bindings/ToJSValue.cpp
index d84428fb38..19219f4321 100644
--- a/dom/bindings/ToJSValue.cpp
+++ b/dom/bindings/ToJSValue.cpp
@@ -7,9 +7,7 @@
#include "mozilla/dom/ToJSValue.h"
#include "mozilla/dom/DOMException.h"
#include "mozilla/dom/Exceptions.h"
-#ifdef SPIDERMONKEY_PROMISE
#include "mozilla/dom/Promise.h"
-#endif // SPIDERMONKEY_PROMISE
#include "nsAString.h"
#include "nsContentUtils.h"
#include "nsStringBuffer.h"
@@ -66,7 +64,6 @@ ToJSValue(JSContext* aCx,
return true;
}
-#ifdef SPIDERMONKEY_PROMISE
bool
ToJSValue(JSContext* aCx, Promise& aArgument,
JS::MutableHandle<JS::Value> aValue)
@@ -74,7 +71,6 @@ ToJSValue(JSContext* aCx, Promise& aArgument,
aValue.setObject(*aArgument.PromiseObj());
return true;
}
-#endif // SPIDERMONKEY_PROMISE
} // namespace dom
} // namespace mozilla
diff --git a/dom/bindings/ToJSValue.h b/dom/bindings/ToJSValue.h
index 2021c0b4cc..76e91c7bc5 100644
--- a/dom/bindings/ToJSValue.h
+++ b/dom/bindings/ToJSValue.h
@@ -306,13 +306,11 @@ ToJSValue(JSContext* aCx,
return ToJSValue(aCx, *aArgument, aValue);
}
-#ifdef SPIDERMONKEY_PROMISE
// Accept Promise objects, which need special handling.
MOZ_MUST_USE bool
ToJSValue(JSContext* aCx,
Promise& aArgument,
JS::MutableHandle<JS::Value> aValue);
-#endif // SPIDERMONKEY_PROMISE
// Accept arrays of other things we accept
template <typename T>