Chromium Code Reviews| Index: src/debug/debug.cc |
| diff --git a/src/debug/debug.cc b/src/debug/debug.cc |
| index 747093e7492cb2119ee3d8008ef9492f713d56cf..4bdd18de4c6493bbbe021a26afeb769253f03398 100644 |
| --- a/src/debug/debug.cc |
| +++ b/src/debug/debug.cc |
| @@ -1682,43 +1682,34 @@ void Debug::OnThrow(Handle<Object> exception) { |
| } |
| } |
| - |
| -void Debug::OnPromiseReject(Handle<JSObject> promise, Handle<Object> value) { |
| +void Debug::OnPromiseReject(Handle<Object> promise, Handle<Object> value) { |
| if (in_debug_scope() || ignore_events()) return; |
| HandleScope scope(isolate_); |
| // Check whether the promise has been marked as having triggered a message. |
| Handle<Symbol> key = isolate_->factory()->promise_debug_marker_symbol(); |
| - if (JSReceiver::GetDataProperty(promise, key)->IsUndefined(isolate_)) { |
| + if (!promise->IsJSObject() || |
| + JSReceiver::GetDataProperty(Handle<JSObject>::cast(promise), key) |
| + ->IsUndefined(isolate_)) { |
| OnException(value, promise); |
| } |
| } |
| -MaybeHandle<Object> Debug::PromiseHasUserDefinedRejectHandler( |
| - Handle<JSObject> promise) { |
| - Handle<JSFunction> fun = isolate_->promise_has_user_defined_reject_handler(); |
| - return Execution::Call(isolate_, fun, promise, 0, NULL); |
| -} |
| - |
| - |
| void Debug::OnException(Handle<Object> exception, Handle<Object> promise) { |
| Isolate::CatchType catch_type = isolate_->PredictExceptionCatcher(); |
| // Don't notify listener of exceptions that are internal to a desugaring. |
| if (catch_type == Isolate::CAUGHT_BY_DESUGARING) return; |
| - bool uncaught = (catch_type == Isolate::NOT_CAUGHT); |
| + bool uncaught = (catch_type == Isolate::NOT_CAUGHT || |
| + catch_type == Isolate::CAUGHT_BY_ASYNC_AWAIT); |
|
jgruber
2016/09/08 10:19:58
Could you add a comment about why CAUGHT_BY_ASYNC_
|
| if (promise->IsJSObject()) { |
| Handle<JSObject> jspromise = Handle<JSObject>::cast(promise); |
| // Mark the promise as already having triggered a message. |
| Handle<Symbol> key = isolate_->factory()->promise_debug_marker_symbol(); |
| JSObject::SetProperty(jspromise, key, key, STRICT).Assert(); |
| // Check whether the promise reject is considered an uncaught exception. |
| - Handle<Object> has_reject_handler; |
| - ASSIGN_RETURN_ON_EXCEPTION_VALUE( |
| - isolate_, has_reject_handler, |
| - PromiseHasUserDefinedRejectHandler(jspromise), /* void */); |
| - uncaught = has_reject_handler->IsFalse(isolate_); |
| + uncaught = !isolate_->PromiseHasUserDefinedRejectHandler(jspromise); |
| } |
| // Bail out if exception breaks are not active |
| if (uncaught) { |