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

Side by Side Diff: src/debug/debug.cc

Issue 2816373004: [inspector] don't enter to debugger context for PromiseEventOccurred (Closed)
Patch Set: Created 3 years, 8 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 unified diff | Download patch
« no previous file with comments | « src/debug/debug.h ('k') | src/debug/debug-interface.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/debug/debug.h" 5 #include "src/debug/debug.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "src/api.h" 9 #include "src/api.h"
10 #include "src/arguments.h" 10 #include "src/arguments.h"
(...skipping 2026 matching lines...) Expand 10 before | Expand all | Expand 10 after
2037 if (!IsFrameBlackboxed(it.javascript_frame())) return false; 2037 if (!IsFrameBlackboxed(it.javascript_frame())) return false;
2038 } 2038 }
2039 return true; 2039 return true;
2040 } 2040 }
2041 2041
2042 void Debug::OnAsyncTaskEvent(debug::PromiseDebugActionType type, int id, 2042 void Debug::OnAsyncTaskEvent(debug::PromiseDebugActionType type, int id,
2043 int parent_id) { 2043 int parent_id) {
2044 if (in_debug_scope() || ignore_events()) return; 2044 if (in_debug_scope() || ignore_events()) return;
2045 if (!debug_delegate_) return; 2045 if (!debug_delegate_) return;
2046 SuppressDebug while_processing(this); 2046 SuppressDebug while_processing(this);
2047 DebugScope debug_scope(isolate_->debug());
2048 if (debug_scope.failed()) return;
2049 HandleScope scope(isolate_);
2050 PostponeInterruptsScope no_interrupts(isolate_); 2047 PostponeInterruptsScope no_interrupts(isolate_);
2051 DisableBreak no_recursive_break(this); 2048 DisableBreak no_recursive_break(this);
2052 bool created_by_user = false; 2049 bool created_by_user = false;
2053 if (type == debug::kDebugPromiseCreated) { 2050 if (type == debug::kDebugPromiseCreated) {
2054 JavaScriptFrameIterator it(isolate_); 2051 JavaScriptFrameIterator it(isolate_);
2055 // We need to skip top frame which contains instrumentation. 2052 // We need to skip top frame which contains instrumentation.
2056 it.Advance(); 2053 it.Advance();
2057 created_by_user = 2054 created_by_user =
2058 !it.done() && 2055 !it.done() &&
2059 !IsFrameBlackboxed(it.frame()); 2056 !IsFrameBlackboxed(it.frame());
2060 } 2057 }
2061 debug_delegate_->PromiseEventOccurred( 2058 debug_delegate_->PromiseEventOccurred(type, id, parent_id, created_by_user);
2062 Utils::ToLocal(debug_scope.GetContext()), type, id, parent_id,
2063 created_by_user);
2064 } 2059 }
2065 2060
2066 void Debug::ProcessCompileEvent(v8::DebugEvent event, Handle<Script> script) { 2061 void Debug::ProcessCompileEvent(v8::DebugEvent event, Handle<Script> script) {
2067 // Attach the correct debug id to the script. The debug id is used by the 2062 // Attach the correct debug id to the script. The debug id is used by the
2068 // inspector to filter scripts by native context. 2063 // inspector to filter scripts by native context.
2069 script->set_context_data(isolate_->native_context()->debug_context_id()); 2064 script->set_context_data(isolate_->native_context()->debug_context_id());
2070 if (ignore_events()) return; 2065 if (ignore_events()) return;
2071 if (!script->IsUserJavaScript() && script->type() != i::Script::TYPE_WASM) { 2066 if (!script->IsUserJavaScript() && script->type() != i::Script::TYPE_WASM) {
2072 return; 2067 return;
2073 } 2068 }
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
2339 DCHECK(isolate_->needs_side_effect_check()); 2334 DCHECK(isolate_->needs_side_effect_check());
2340 if (DebugEvaluate::CallbackHasNoSideEffect(function)) return true; 2335 if (DebugEvaluate::CallbackHasNoSideEffect(function)) return true;
2341 side_effect_check_failed_ = true; 2336 side_effect_check_failed_ = true;
2342 // Throw an uncatchable termination exception. 2337 // Throw an uncatchable termination exception.
2343 isolate_->TerminateExecution(); 2338 isolate_->TerminateExecution();
2344 isolate_->OptionalRescheduleException(false); 2339 isolate_->OptionalRescheduleException(false);
2345 return false; 2340 return false;
2346 } 2341 }
2347 2342
2348 void LegacyDebugDelegate::PromiseEventOccurred( 2343 void LegacyDebugDelegate::PromiseEventOccurred(
2349 v8::Local<v8::Context> context, v8::debug::PromiseDebugActionType type, 2344 v8::debug::PromiseDebugActionType type, int id, int parent_id,
2350 int id, int parent_id, bool created_by_user) { 2345 bool created_by_user) {
2346 DebugScope debug_scope(isolate_->debug());
2347 if (debug_scope.failed()) return;
2348 HandleScope scope(isolate_);
2351 Handle<Object> event_data; 2349 Handle<Object> event_data;
2352 if (isolate_->debug()->MakeAsyncTaskEvent(type, id).ToHandle(&event_data)) { 2350 if (isolate_->debug()->MakeAsyncTaskEvent(type, id).ToHandle(&event_data)) {
2353 ProcessDebugEvent(v8::AsyncTaskEvent, Handle<JSObject>::cast(event_data)); 2351 ProcessDebugEvent(v8::AsyncTaskEvent, Handle<JSObject>::cast(event_data));
2354 } 2352 }
2355 } 2353 }
2356 2354
2357 void LegacyDebugDelegate::ScriptCompiled(v8::Local<v8::debug::Script> script, 2355 void LegacyDebugDelegate::ScriptCompiled(v8::Local<v8::debug::Script> script,
2358 bool is_compile_error) { 2356 bool is_compile_error) {
2359 Handle<Object> event_data; 2357 Handle<Object> event_data;
2360 v8::DebugEvent event = is_compile_error ? v8::CompileError : v8::AfterCompile; 2358 v8::DebugEvent event = is_compile_error ? v8::CompileError : v8::AfterCompile;
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
2494 isolate_->Throw(*isolate_->factory()->NewEvalError( 2492 isolate_->Throw(*isolate_->factory()->NewEvalError(
2495 MessageTemplate::kNoSideEffectDebugEvaluate)); 2493 MessageTemplate::kNoSideEffectDebugEvaluate));
2496 } 2494 }
2497 isolate_->set_needs_side_effect_check(old_needs_side_effect_check_); 2495 isolate_->set_needs_side_effect_check(old_needs_side_effect_check_);
2498 isolate_->debug()->UpdateHookOnFunctionCall(); 2496 isolate_->debug()->UpdateHookOnFunctionCall();
2499 isolate_->debug()->side_effect_check_failed_ = false; 2497 isolate_->debug()->side_effect_check_failed_ = false;
2500 } 2498 }
2501 2499
2502 } // namespace internal 2500 } // namespace internal
2503 } // namespace v8 2501 } // namespace v8
OLDNEW
« 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