Commit 4b54c07d authored by kozyatinskiy's avatar kozyatinskiy Committed by Commit bot

Ignore pause on debugger statement when breakpoints are disabled

This behavior was changed in https://codereview.chromium.org/1402913002.
It's pretty usefull to have ability to disable debugger statement for our users.

BUG=chromium:583515
LOG=N
R=yangguo@chromium.org

Review URL: https://codereview.chromium.org/1690173002

Cr-Commit-Position: refs/heads/master@{#33960}
parent f3cdf8a9
...@@ -525,6 +525,7 @@ class Debug { ...@@ -525,6 +525,7 @@ class Debug {
return !!base::NoBarrier_Load(&thread_local_.current_debug_scope_); return !!base::NoBarrier_Load(&thread_local_.current_debug_scope_);
} }
void set_break_points_active(bool v) { break_points_active_ = v; } void set_break_points_active(bool v) { break_points_active_ = v; }
bool break_points_active() const { return break_points_active_; }
StackFrame::Id break_frame_id() { return thread_local_.break_frame_id_; } StackFrame::Id break_frame_id() { return thread_local_.break_frame_id_; }
int break_id() { return thread_local_.break_id_; } int break_id() { return thread_local_.break_id_; }
......
...@@ -30,7 +30,9 @@ RUNTIME_FUNCTION(Runtime_DebugBreak) { ...@@ -30,7 +30,9 @@ RUNTIME_FUNCTION(Runtime_DebugBreak) {
RUNTIME_FUNCTION(Runtime_HandleDebuggerStatement) { RUNTIME_FUNCTION(Runtime_HandleDebuggerStatement) {
SealHandleScope shs(isolate); SealHandleScope shs(isolate);
DCHECK(args.length() == 0); DCHECK(args.length() == 0);
if (isolate->debug()->break_points_active()) {
isolate->debug()->HandleDebugBreak(); isolate->debug()->HandleDebugBreak();
}
return isolate->heap()->undefined_value(); return isolate->heap()->undefined_value();
} }
......
...@@ -4327,6 +4327,22 @@ TEST(DisableBreak) { ...@@ -4327,6 +4327,22 @@ TEST(DisableBreak) {
CheckDebuggerUnloaded(env->GetIsolate()); CheckDebuggerUnloaded(env->GetIsolate());
} }
TEST(DisableDebuggerStatement) {
DebugLocalContext env;
v8::HandleScope scope(env->GetIsolate());
// Register a debug event listener which sets the break flag and counts.
v8::Debug::SetDebugEventListener(env->GetIsolate(), DebugEventCounter);
CompileRun("debugger;");
CHECK_EQ(1, break_point_hit_count);
// Check that we ignore debugger statement when breakpoints aren't active.
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(env->GetIsolate());
isolate->debug()->set_break_points_active(false);
CompileRun("debugger;");
CHECK_EQ(1, break_point_hit_count);
}
static const char* kSimpleExtensionSource = static const char* kSimpleExtensionSource =
"(function Foo() {" "(function Foo() {"
" return 4;" " return 4;"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment