summaryrefslogtreecommitdiffstats
path: root/js/src/builtin/Promise.cpp
diff options
context:
space:
mode:
authorAndré Bargull <andre.bargull@gmail.com>2019-11-12 17:02:16 +0100
committerwolfbeast <mcwerewolf@wolfbeast.com>2019-11-12 17:02:16 +0100
commit899be7cedbef6678280d56a4725f2697f808bbb5 (patch)
tree3a36479c41d486699379a5ffd420c5b236774616 /js/src/builtin/Promise.cpp
parentb00601953bade944cd6df9cde6fcdd1f10d76feb (diff)
downloadUXP-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/builtin/Promise.cpp')
-rw-r--r--js/src/builtin/Promise.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/js/src/builtin/Promise.cpp b/js/src/builtin/Promise.cpp
index ec7845e89..1d068f8c6 100644
--- a/js/src/builtin/Promise.cpp
+++ b/js/src/builtin/Promise.cpp
@@ -2006,6 +2006,13 @@ CommonStaticResolveRejectImpl(JSContext* cx, HandleValue thisVal, HandleValue ar
return promise;
}
+MOZ_MUST_USE JSObject*
+js::PromiseResolve(JSContext* cx, HandleObject constructor, HandleValue value)
+{
+ RootedValue C(cx, ObjectValue(*constructor));
+ return CommonStaticResolveRejectImpl(cx, C, value, ResolveMode);
+}
+
/**
* ES2016, 25.4.4.4, Promise.reject.
*/
@@ -2739,6 +2746,7 @@ CreatePromisePrototype(JSContext* cx, JSProtoKey key)
static const JSFunctionSpec promise_methods[] = {
JS_SELF_HOSTED_FN("catch", "Promise_catch", 1, 0),
JS_FN("then", Promise_then, 2, 0),
+ JS_SELF_HOSTED_FN("finally", "Promise_finally", 1, 0),
JS_FS_END
};