Ignore debug break events when bootstrapper is active. Collecting debug data when the context is not yet setup may lead to subtle errors like in the following Chromium bug: http://crbug.com/28933

Review URL: http://codereview.chromium.org/497006

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3465 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
yurys@chromium.org 2009-12-15 09:17:15 +00:00
parent fce227ea77
commit e88df5b792
2 changed files with 39 additions and 0 deletions

View File

@ -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());

View File

@ -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<v8::Context> 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<v8::Array> NamedEnum(const v8::AccessorInfo&) {
v8::Handle<v8::Array> result = v8::Array::New(3);