Skip to content

Commit 95b8398

Browse files
committed
Bug 1322920 - Remove DOM Promise implementation. r=bz
MozReview-Commit-ID: 1zzd0x2LNNb
1 parent 398a438 commit 95b8398

30 files changed

+63
-4035
lines changed

build/docs/mozinfo.rst

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -136,14 +136,6 @@ release_or_beta
136136

137137
Always defined.
138138

139-
sm_promise
140-
Whether spidermonkey promises have been enabled or not. This is set
141-
by adding --enable-sm-promise to the mozconfig file.
142-
143-
Values are ``true`` and ``false``.
144-
145-
Always defined.
146-
147139
stylo
148140
Whether the Stylo styling system is being used.
149141

dom/bindings/BindingUtils.cpp

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2961,42 +2961,6 @@ ConvertExceptionToPromise(JSContext* cx,
29612961
JSObject* promiseScope,
29622962
JS::MutableHandle<JS::Value> rval)
29632963
{
2964-
#ifndef SPIDERMONKEY_PROMISE
2965-
GlobalObject global(cx, promiseScope);
2966-
if (global.Failed()) {
2967-
return false;
2968-
}
2969-
2970-
JS::Rooted<JS::Value> exn(cx);
2971-
if (!JS_GetPendingException(cx, &exn)) {
2972-
// This is very important: if there is no pending exception here but we're
2973-
// ending up in this code, that means the callee threw an uncatchable
2974-
// exception. Just propagate that out as-is.
2975-
return false;
2976-
}
2977-
2978-
JS_ClearPendingException(cx);
2979-
2980-
nsCOMPtr<nsIGlobalObject> globalObj =
2981-
do_QueryInterface(global.GetAsSupports());
2982-
if (!globalObj) {
2983-
ErrorResult rv;
2984-
rv.Throw(NS_ERROR_UNEXPECTED);
2985-
return !rv.MaybeSetPendingException(cx);
2986-
}
2987-
2988-
ErrorResult rv;
2989-
RefPtr<Promise> promise = Promise::Reject(globalObj, cx, exn, rv);
2990-
if (rv.MaybeSetPendingException(cx)) {
2991-
// We just give up. We put the exception from the ErrorResult on
2992-
// the JSContext just to make sure to not leak memory on the
2993-
// ErrorResult, but now just put the original exception back.
2994-
JS_SetPendingException(cx, exn);
2995-
return false;
2996-
}
2997-
2998-
return GetOrCreateDOMReflector(cx, promise, rval);
2999-
#else // SPIDERMONKEY_PROMISE
30002964
{
30012965
JSAutoCompartment ac(cx, promiseScope);
30022966

@@ -3022,7 +2986,6 @@ ConvertExceptionToPromise(JSContext* cx,
30222986

30232987
// Now make sure we rewrap promise back into the compartment we want
30242988
return JS_WrapValue(cx, rval);
3025-
#endif // SPIDERMONKEY_PROMISE
30262989
}
30272990

30282991
/* static */

dom/bindings/Codegen.py

Lines changed: 1 addition & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -3038,23 +3038,6 @@ def defineAliasesFor(m):
30383038
else:
30393039
unforgeableHolderSetup = None
30403040

3041-
if self.descriptor.name == "Promise":
3042-
speciesSetup = CGGeneric(fill(
3043-
"""
3044-
#ifndef SPIDERMONKEY_PROMISE
3045-
JS::Rooted<JSObject*> promiseConstructor(aCx, *interfaceCache);
3046-
JS::Rooted<jsid> species(aCx,
3047-
SYMBOL_TO_JSID(JS::GetWellKnownSymbol(aCx, JS::SymbolCode::species)));
3048-
if (!JS_DefinePropertyById(aCx, promiseConstructor, species, JS::UndefinedHandleValue,
3049-
JSPROP_SHARED, Promise::PromiseSpecies, nullptr)) {
3050-
$*{failureCode}
3051-
}
3052-
#endif // SPIDERMONKEY_PROMISE
3053-
""",
3054-
failureCode=failureCode))
3055-
else:
3056-
speciesSetup = None
3057-
30583041
if (self.descriptor.interface.isOnGlobalProtoChain() and
30593042
needInterfacePrototypeObject):
30603043
makeProtoPrototypeImmutable = CGGeneric(fill(
@@ -3080,7 +3063,7 @@ def defineAliasesFor(m):
30803063
return CGList(
30813064
[getParentProto, getConstructorProto, initIds,
30823065
prefCache, CGGeneric(call), defineAliases, unforgeableHolderSetup,
3083-
speciesSetup, makeProtoPrototypeImmutable],
3066+
makeProtoPrototypeImmutable],
30843067
"\n").define()
30853068

30863069

@@ -5319,7 +5302,6 @@ def handleNull(templateBody, setToNullVar, extraConditionForNull=""):
53195302
$*{exceptionCode}
53205303
}
53215304
binding_detail::FastErrorResult promiseRv;
5322-
#ifdef SPIDERMONKEY_PROMISE
53235305
nsCOMPtr<nsIGlobalObject> global =
53245306
do_QueryInterface(promiseGlobal.GetAsSupports());
53255307
if (!global) {
@@ -5332,26 +5314,6 @@ def handleNull(templateBody, setToNullVar, extraConditionForNull=""):
53325314
if (promiseRv.MaybeSetPendingException(cx)) {
53335315
$*{exceptionCode}
53345316
}
5335-
#else
5336-
JS::Handle<JSObject*> promiseCtor =
5337-
PromiseBinding::GetConstructorObjectHandle(cx);
5338-
if (!promiseCtor) {
5339-
$*{exceptionCode}
5340-
}
5341-
JS::Rooted<JS::Value> resolveThisv(cx, JS::ObjectValue(*promiseCtor));
5342-
JS::Rooted<JS::Value> resolveResult(cx);
5343-
Promise::Resolve(promiseGlobal, resolveThisv, valueToResolve,
5344-
&resolveResult, promiseRv);
5345-
if (promiseRv.MaybeSetPendingException(cx)) {
5346-
$*{exceptionCode}
5347-
}
5348-
nsresult unwrapRv = UNWRAP_OBJECT(Promise, &resolveResult.toObject(), $${declName});
5349-
if (NS_FAILED(unwrapRv)) { // Quite odd
5350-
promiseRv.Throw(unwrapRv);
5351-
promiseRv.MaybeSetPendingException(cx);
5352-
$*{exceptionCode}
5353-
}
5354-
#endif // SPIDERMONKEY_PROMISE
53555317
}
53565318
""",
53575319
getPromiseGlobal=getPromiseGlobal,

dom/bindings/ToJSValue.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@
77
#include "mozilla/dom/ToJSValue.h"
88
#include "mozilla/dom/DOMException.h"
99
#include "mozilla/dom/Exceptions.h"
10-
#ifdef SPIDERMONKEY_PROMISE
1110
#include "mozilla/dom/Promise.h"
12-
#endif // SPIDERMONKEY_PROMISE
1311
#include "nsAString.h"
1412
#include "nsContentUtils.h"
1513
#include "nsStringBuffer.h"
@@ -66,15 +64,13 @@ ToJSValue(JSContext* aCx,
6664
return true;
6765
}
6866

69-
#ifdef SPIDERMONKEY_PROMISE
7067
bool
7168
ToJSValue(JSContext* aCx, Promise& aArgument,
7269
JS::MutableHandle<JS::Value> aValue)
7370
{
7471
aValue.setObject(*aArgument.PromiseObj());
7572
return true;
7673
}
77-
#endif // SPIDERMONKEY_PROMISE
7874

7975
} // namespace dom
8076
} // namespace mozilla

dom/bindings/ToJSValue.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,13 +306,11 @@ ToJSValue(JSContext* aCx,
306306
return ToJSValue(aCx, *aArgument, aValue);
307307
}
308308

309-
#ifdef SPIDERMONKEY_PROMISE
310309
// Accept Promise objects, which need special handling.
311310
MOZ_MUST_USE bool
312311
ToJSValue(JSContext* aCx,
313312
Promise& aArgument,
314313
JS::MutableHandle<JS::Value> aValue);
315-
#endif // SPIDERMONKEY_PROMISE
316314

317315
// Accept arrays of other things we accept
318316
template <typename T>

0 commit comments

Comments
 (0)