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
This commit is contained in:
parent
b6a6ef9a95
commit
8ce1ebb5cf
@ -832,6 +832,11 @@ Object* Execution::DebugBreakHelper() {
|
||||
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);
|
||||
if (check.HasOverflowed()) {
|
||||
return isolate->heap()->undefined_value();
|
||||
|
@ -7392,4 +7392,32 @@ TEST(Regress131642) {
|
||||
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
|
||||
|
@ -984,7 +984,7 @@ TEST(TestCodeFlushing) {
|
||||
|
||||
|
||||
// Count the number of global contexts in the weak list of global contexts.
|
||||
static int CountGlobalContexts() {
|
||||
int CountGlobalContexts() {
|
||||
int count = 0;
|
||||
Object* object = HEAP->global_contexts_list();
|
||||
while (!object->IsUndefined()) {
|
||||
|
Loading…
Reference in New Issue
Block a user