Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1461)

Unified Diff: src/api.cc

Issue 607913002: Report promise reject with no handler (behind a flag). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: more comments Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/api.h ('k') | src/bootstrapper.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index bda34bdfacacbb369f5e8db2b18d03c6f38b1ec7..ad544f580e138aade3dbd45004e7265be1b78080 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -2068,6 +2068,17 @@ Local<String> Message::Get() const {
}
+v8::Handle<v8::Promise> Message::GetPromise() const {
+ i::Handle<i::JSMessageObject> message =
+ i::Handle<i::JSMessageObject>::cast(Utils::OpenHandle(this));
+ i::Object* promise = message->promise();
+ if (promise->IsUndefined()) return v8::Handle<v8::Promise>();
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
+ i::Handle<i::JSObject> promise_handle(i::JSObject::cast(promise), isolate);
+ return Utils::PromiseToLocal(promise_handle);
+}
+
+
ScriptOrigin Message::GetScriptOrigin() const {
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
i::Handle<i::JSMessageObject> message =
@@ -5971,6 +5982,20 @@ Local<Promise> Promise::Then(Handle<Function> handler) {
}
+bool Promise::HasRejectHandler() {
+ i::Handle<i::JSObject> promise = Utils::OpenHandle(this);
+ i::Isolate* isolate = promise->GetIsolate();
+ LOG_API(isolate, "Promise::HasRejectHandler");
+ ENTER_V8(isolate);
+ EXCEPTION_PREAMBLE(isolate);
+ i::Handle<i::Object> result;
+ has_pending_exception = !i::Execution::PromiseHasRejectHandler(
+ isolate, promise).ToHandle(&result);
+ EXCEPTION_BAILOUT_CHECK(isolate, false);
+ return result->BooleanValue();
+}
+
+
bool v8::ArrayBuffer::IsExternal() const {
return Utils::OpenHandle(this)->is_external();
}
« no previous file with comments | « src/api.h ('k') | src/bootstrapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698