Index: src/api.cc |
diff --git a/src/api.cc b/src/api.cc |
index ca552fc60f6ba44140461666f730411a92de0fe4..b12534f91f55e2c92bd0af1da898f7440c93a0d6 100644 |
--- a/src/api.cc |
+++ b/src/api.cc |
@@ -5910,6 +5910,26 @@ Local<Promise> Promise::Catch(Handle<Function> handler) { |
} |
+Local<Promise> Promise::Then(Handle<Function> handler) { |
+ i::Handle<i::JSObject> promise = Utils::OpenHandle(this); |
+ i::Isolate* isolate = promise->GetIsolate(); |
+ LOG_API(isolate, "Promise::Then"); |
+ ENTER_V8(isolate); |
+ EXCEPTION_PREAMBLE(isolate); |
+ i::Handle<i::Object> argv[] = { Utils::OpenHandle(*handler) }; |
+ i::Handle<i::Object> result; |
+ has_pending_exception = !i::Execution::Call( |
+ isolate, |
+ handle(isolate->context()->global_object()->native_context()-> |
+ promise_then()), |
+ promise, |
+ ARRAY_SIZE(argv), argv, |
+ false).ToHandle(&result); |
+ EXCEPTION_BAILOUT_CHECK(isolate, Local<Promise>()); |
+ return Local<Promise>::Cast(Utils::ToLocal(result)); |
+} |
+ |
+ |
bool v8::ArrayBuffer::IsExternal() const { |
return Utils::OpenHandle(this)->is_external(); |
} |