Index: src/runtime/runtime.cc |
diff --git a/src/runtime/runtime.cc b/src/runtime/runtime.cc |
index 427b8217456c165f4ba8884fbb689043bb76ccbd..01b08e99611490e8bdbdb9927c7826fae391986c 100644 |
--- a/src/runtime/runtime.cc |
+++ b/src/runtime/runtime.cc |
@@ -2657,16 +2657,42 @@ RUNTIME_FUNCTION(Runtime_DebugPromiseEvent) { |
} |
-RUNTIME_FUNCTION(Runtime_DebugPromiseRejectEvent) { |
- DCHECK(args.length() == 2); |
+RUNTIME_FUNCTION(Runtime_PromiseRejectEvent) { |
+ DCHECK(args.length() == 3); |
HandleScope scope(isolate); |
CONVERT_ARG_HANDLE_CHECKED(JSObject, promise, 0); |
CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); |
- isolate->debug()->OnPromiseReject(promise, value); |
+ CONVERT_BOOLEAN_ARG_CHECKED(debug_event, 2); |
+ if (debug_event) isolate->debug()->OnPromiseReject(promise, value); |
+ Handle<Symbol> key = isolate->factory()->promise_has_handler_symbol(); |
+ // Do not report if we actually have a handler. |
+ if (JSObject::GetDataProperty(promise, key)->IsUndefined()) { |
+ isolate->ReportPromiseReject(promise, value, |
+ v8::kPromiseRejectWithNoHandler); |
+ } |
+ return isolate->heap()->undefined_value(); |
+} |
+ |
+ |
+RUNTIME_FUNCTION(Runtime_PromiseRevokeReject) { |
+ DCHECK(args.length() == 1); |
+ HandleScope scope(isolate); |
+ CONVERT_ARG_HANDLE_CHECKED(JSObject, promise, 0); |
+ Handle<Symbol> key = isolate->factory()->promise_has_handler_symbol(); |
+ // At this point, no revocation has been issued before |
+ RUNTIME_ASSERT(JSObject::GetDataProperty(promise, key)->IsUndefined()); |
+ isolate->ReportPromiseReject(promise, Handle<Object>(), |
+ v8::kPromiseHandlerAddedAfterReject); |
return isolate->heap()->undefined_value(); |
} |
+RUNTIME_FUNCTION(Runtime_PromiseHasHandlerSymbol) { |
+ DCHECK(args.length() == 0); |
+ return isolate->heap()->promise_has_handler_symbol(); |
+} |
+ |
+ |
RUNTIME_FUNCTION(Runtime_DebugAsyncTaskEvent) { |
DCHECK(args.length() == 1); |
HandleScope scope(isolate); |