diff options
author | André Bargull <andre.bargull@gmail.com> | 2019-11-12 17:02:16 +0100 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2019-11-12 17:02:16 +0100 |
commit | 899be7cedbef6678280d56a4725f2697f808bbb5 (patch) | |
tree | 3a36479c41d486699379a5ffd420c5b236774616 /js/src/vm | |
parent | b00601953bade944cd6df9cde6fcdd1f10d76feb (diff) | |
download | UXP-899be7cedbef6678280d56a4725f2697f808bbb5.tar UXP-899be7cedbef6678280d56a4725f2697f808bbb5.tar.gz UXP-899be7cedbef6678280d56a4725f2697f808bbb5.tar.lz UXP-899be7cedbef6678280d56a4725f2697f808bbb5.tar.xz UXP-899be7cedbef6678280d56a4725f2697f808bbb5.zip |
Issue #1283 - Implement Promise.prototype.finally()
This resolves #1283.
Diffstat (limited to 'js/src/vm')
-rw-r--r-- | js/src/vm/SelfHosting.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/js/src/vm/SelfHosting.cpp b/js/src/vm/SelfHosting.cpp index 82d2cde64..833410465 100644 --- a/js/src/vm/SelfHosting.cpp +++ b/js/src/vm/SelfHosting.cpp @@ -2102,6 +2102,21 @@ intrinsic_ModuleNamespaceExports(JSContext* cx, unsigned argc, Value* vp) return true; } +static bool +intrinsic_PromiseResolve(JSContext* cx, unsigned argc, Value* vp) +{ + CallArgs args = CallArgsFromVp(argc, vp); + MOZ_ASSERT(args.length() == 2); + + RootedObject constructor(cx, &args[0].toObject()); + JSObject* promise = js::PromiseResolve(cx, constructor, args[1]); + if (!promise) + return false; + + args.rval().setObject(*promise); + return true; +} + // The self-hosting global isn't initialized with the normal set of builtins. // Instead, individual C++-implemented functions that're required by // self-hosted code are defined as global functions. Accessing these @@ -2498,6 +2513,10 @@ static const JSFunctionSpec intrinsic_functions[] = { JS_FN("AddModuleNamespaceBinding", intrinsic_AddModuleNamespaceBinding, 4, 0), JS_FN("ModuleNamespaceExports", intrinsic_ModuleNamespaceExports, 1, 0), + JS_FN("IsPromiseObject", intrinsic_IsInstanceOfBuiltin<PromiseObject>, 1, 0), + JS_FN("CallPromiseMethodIfWrapped", CallNonGenericSelfhostedMethod<Is<PromiseObject>>, 2, 0), + JS_FN("PromiseResolve", intrinsic_PromiseResolve, 2, 0), + JS_FS_END }; |