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

Unified Diff: src/debug/debug.cc

Issue 2655253004: [inspector] introduced stepIntoAsync for chained callbacks (Closed)
Patch Set: fixed async/await and added tests Created 3 years, 10 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/debug/debug.h ('k') | src/debug/debug-interface.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/debug/debug.cc
diff --git a/src/debug/debug.cc b/src/debug/debug.cc
index 84a16754e1d8c453dd5930addcefbb15a43df9c2..e3d4066db8832900b4b06d1d8a710d3f0a19e263 100644
--- a/src/debug/debug.cc
+++ b/src/debug/debug.cc
@@ -1722,12 +1722,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) {
@@ -1982,6 +1977,26 @@ bool Debug::IsBlackboxed(Handle<SharedFunctionInfo> shared) {
return shared->debug_is_blackboxed();
}
+bool Debug::HasPromiseBuiltinOnStack() {
+ for (JavaScriptFrameIterator it(isolate_); !it.done(); it.Advance()) {
+ List<SharedFunctionInfo*> raw_shareds;
+ it.frame()->GetFunctions(&raw_shareds);
+ for (int i = 0; i < raw_shareds.length(); ++i) {
+ if (raw_shareds[i]->is_promise_builtin()) return true;
+ }
+ }
+ return false;
+}
+
+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;
@@ -1992,7 +2007,13 @@ 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);
+ // Promise.all and Promise.race implementations use .then internally,
+ // we don't allow to break on these calls.
+ bool breakable = type == debug::kDebugPromiseCreated &&
+ !HasPromiseBuiltinOnStack() &&
+ HasNonBlackboxedFrameOnStack();
+ debug_delegate_->PromiseEventOccurred(
+ Utils::ToLocal(debug_scope.GetContext()), type, id, parent_id, breakable);
}
void Debug::ProcessCompileEvent(v8::DebugEvent event, Handle<Script> script) {
@@ -2266,7 +2287,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 breakable) {
Handle<Object> event_data;
if (isolate_->debug()->MakeAsyncTaskEvent(type, id).ToHandle(&event_data)) {
ProcessDebugEvent(v8::AsyncTaskEvent, Handle<JSObject>::cast(event_data));
« no previous file with comments | « src/debug/debug.h ('k') | src/debug/debug-interface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698