Chromium Code Reviews| Index: src/debug/debug.cc |
| diff --git a/src/debug/debug.cc b/src/debug/debug.cc |
| index 32d1e8f1131903f7dd8062c704d211223e7536bd..71409cbacb9ac3cb41689e9cb51964431613dcfa 100644 |
| --- a/src/debug/debug.cc |
| +++ b/src/debug/debug.cc |
| @@ -1724,12 +1724,7 @@ bool Debug::IsExceptionBlackboxed(bool uncaught) { |
| // caught exception if top frame is blackboxed. |
| bool is_top_frame_blackboxed = IsFrameBlackboxed(it.frame()); |
| if (!uncaught || !is_top_frame_blackboxed) return is_top_frame_blackboxed; |
| - it.Advance(); |
| - while (!it.done()) { |
| - if (!IsFrameBlackboxed(it.frame())) return false; |
| - it.Advance(); |
| - } |
| - return true; |
| + return !HasNonBlackboxedFrameOnStack(); |
| } |
| bool Debug::IsFrameBlackboxed(JavaScriptFrame* frame) { |
| @@ -1984,6 +1979,15 @@ bool Debug::IsBlackboxed(Handle<SharedFunctionInfo> shared) { |
| return shared->debug_is_blackboxed(); |
| } |
| +bool Debug::HasNonBlackboxedFrameOnStack() { |
| + HandleScope scope(isolate_); |
| + for (StackTraceFrameIterator it(isolate_); !it.done(); it.Advance()) { |
| + if (!it.is_javascript()) continue; |
| + if (!IsFrameBlackboxed(it.javascript_frame())) return true; |
| + } |
| + return false; |
| +} |
| + |
| void Debug::OnAsyncTaskEvent(debug::PromiseDebugActionType type, int id, |
| int parent_id) { |
| if (in_debug_scope() || ignore_events()) return; |
| @@ -1994,7 +1998,19 @@ void Debug::OnAsyncTaskEvent(debug::PromiseDebugActionType type, int id, |
| HandleScope scope(isolate_); |
| PostponeInterruptsScope no_interrupts(isolate_); |
| DisableBreak no_recursive_break(this); |
| - debug_delegate_->PromiseEventOccurred(type, id, parent_id); |
| + bool created_by_user = false; |
| + if (type == debug::kDebugPromiseCreated) { |
| + JavaScriptFrameIterator it(isolate_); |
| + // We need to skip top frame which contains instrumentation. |
|
dgozman
2017/03/03 19:47:06
Looks a bit sketchy, as it heavily relies on the i
kozy
2017/03/03 20:17:02
We skip not a Promise.all or Promise.race here, we
|
| + it.Advance(); |
| + created_by_user = |
| + !it.done() && |
| + it.frame()->function()->shared()->IsSubjectToDebugging() && |
| + !IsFrameBlackboxed(it.frame()); |
| + } |
| + debug_delegate_->PromiseEventOccurred( |
| + Utils::ToLocal(debug_scope.GetContext()), type, id, parent_id, |
| + created_by_user); |
| } |
| void Debug::ProcessCompileEvent(v8::DebugEvent event, Handle<Script> script) { |
| @@ -2274,7 +2290,8 @@ bool Debug::PerformSideEffectCheckForCallback(Address function) { |
| } |
| void LegacyDebugDelegate::PromiseEventOccurred( |
| - v8::debug::PromiseDebugActionType type, int id, int parent_id) { |
| + v8::Local<v8::Context> context, v8::debug::PromiseDebugActionType type, |
| + int id, int parent_id, bool created_by_user) { |
| Handle<Object> event_data; |
| if (isolate_->debug()->MakeAsyncTaskEvent(type, id).ToHandle(&event_data)) { |
| ProcessDebugEvent(v8::AsyncTaskEvent, Handle<JSObject>::cast(event_data)); |