diff --git a/src/execution.cc b/src/execution.cc index 2f646a5638..8a50864266 100644 --- a/src/execution.cc +++ b/src/execution.cc @@ -30,6 +30,7 @@ #include "v8.h" #include "api.h" +#include "bootstrapper.h" #include "codegen-inl.h" #include "debug.h" #include "simulator.h" @@ -607,6 +608,11 @@ Object* Execution::DebugBreakHelper() { return Heap::undefined_value(); } + // Ignore debug break during bootstrapping. + if (Bootstrapper::IsActive()) { + return Heap::undefined_value(); + } + { JavaScriptFrameIterator it; ASSERT(!it.done()); diff --git a/test/cctest/test-debug.cc b/test/cctest/test-debug.cc index 5b7219301e..382189cdd0 100644 --- a/test/cctest/test-debug.cc +++ b/test/cctest/test-debug.cc @@ -3141,6 +3141,39 @@ TEST(DisableBreak) { CheckDebuggerUnloaded(); } +static const char* kSimpleExtensionSource = + "(function Foo() {" + " return 4;" + "})() "; + +// http://crbug.com/28933 +// Test that debug break is disabled when bootstrapper is active. +TEST(NoBreakWhenBootstrapping) { + v8::HandleScope scope; + + // Register a debug event listener which sets the break flag and counts. + v8::Debug::SetDebugEventListener(DebugEventCounter); + + // Set the debug break flag. + v8::Debug::DebugBreak(); + break_point_hit_count = 0; + { + // Create a context with an extension to make sure that some JavaScript + // code is executed during bootstrapping. + v8::RegisterExtension(new v8::Extension("simpletest", + kSimpleExtensionSource)); + const char* extension_names[] = { "simpletest" }; + v8::ExtensionConfiguration extensions(1, extension_names); + v8::Persistent context = v8::Context::New(&extensions); + context.Dispose(); + } + // Check that no DebugBreak events occured during the context creation. + CHECK_EQ(0, break_point_hit_count); + + // Get rid of the debug event listener. + v8::Debug::SetDebugEventListener(NULL); + CheckDebuggerUnloaded(); +} static v8::Handle NamedEnum(const v8::AccessorInfo&) { v8::Handle result = v8::Array::New(3);