Index: test/cctest/test-debug.cc |
diff --git a/test/cctest/test-debug.cc b/test/cctest/test-debug.cc |
index 9f52cea2b3d490a846ecdacb86a68e7cd131fd6f..39d918d25e610a3ebc9df587907ca375638a8a35 100644 |
--- a/test/cctest/test-debug.cc |
+++ b/test/cctest/test-debug.cc |
@@ -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 |