Commit 8ce1ebb5 authored by yangguo@chromium.org's avatar yangguo@chromium.org

Do not enter the debugger when debugger is not active.

R=mstarzinger@chromium.org
BUG=
TEST=test-debug/DebuggerCreatesContextIffActive

Review URL: https://chromiumcodereview.appspot.com/10702166

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12059 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent b6a6ef9a
...@@ -832,6 +832,11 @@ Object* Execution::DebugBreakHelper() { ...@@ -832,6 +832,11 @@ Object* Execution::DebugBreakHelper() {
return isolate->heap()->undefined_value(); return isolate->heap()->undefined_value();
} }
// Ignore debug break if debugger is not active.
if (!isolate->debugger()->IsDebuggerActive()) {
return isolate->heap()->undefined_value();
}
StackLimitCheck check(isolate); StackLimitCheck check(isolate);
if (check.HasOverflowed()) { if (check.HasOverflowed()) {
return isolate->heap()->undefined_value(); return isolate->heap()->undefined_value();
......
...@@ -7392,4 +7392,32 @@ TEST(Regress131642) { ...@@ -7392,4 +7392,32 @@ TEST(Regress131642) {
v8::Debug::SetDebugEventListener(NULL); v8::Debug::SetDebugEventListener(NULL);
} }
// Import from test-heap.cc
int CountGlobalContexts();
static void NopListener(v8::DebugEvent event,
v8::Handle<v8::Object> exec_state,
v8::Handle<v8::Object> event_data,
v8::Handle<v8::Value> data) {
}
TEST(DebuggerCreatesContextIffActive) {
v8::HandleScope scope;
DebugLocalContext env;
CHECK_EQ(1, CountGlobalContexts());
v8::Debug::SetDebugEventListener(NULL);
CompileRun("debugger;");
CHECK_EQ(1, CountGlobalContexts());
v8::Debug::SetDebugEventListener(NopListener);
CompileRun("debugger;");
CHECK_EQ(2, CountGlobalContexts());
v8::Debug::SetDebugEventListener(NULL);
}
#endif // ENABLE_DEBUGGER_SUPPORT #endif // ENABLE_DEBUGGER_SUPPORT
...@@ -984,7 +984,7 @@ TEST(TestCodeFlushing) { ...@@ -984,7 +984,7 @@ TEST(TestCodeFlushing) {
// Count the number of global contexts in the weak list of global contexts. // Count the number of global contexts in the weak list of global contexts.
static int CountGlobalContexts() { int CountGlobalContexts() {
int count = 0; int count = 0;
Object* object = HEAP->global_contexts_list(); Object* object = HEAP->global_contexts_list();
while (!object->IsUndefined()) { while (!object->IsUndefined()) {
......
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