Revision: 15523
Author: [email protected]
Date: Fri Jul 5 06:33:20 2013
Log: Make cctest/test-debug pass with extensions installed
Compiling extensions during context creation triggers debug events.
Work around this by installing the event listener after creating
the context
BUG=v8:2745
[email protected]
Review URL: https://codereview.chromium.org/18441005
Patch from Jochen Eisinger <[email protected]>.
http://code.google.com/p/v8/source/detail?r=15523
Modified:
/branches/bleeding_edge/test/cctest/test-debug.cc
=======================================
--- /branches/bleeding_edge/test/cctest/test-debug.cc Fri Jul 5 02:52:11
2013
+++ /branches/bleeding_edge/test/cctest/test-debug.cc Fri Jul 5 06:33:20
2013
@@ -6288,8 +6288,6 @@
v8::Isolate* isolate = v8::Isolate::GetCurrent();
v8::HandleScope scope(isolate);
- v8::Debug::SetMessageHandler2(ContextCheckMessageHandler);
-
// Create two contexts.
v8::Handle<v8::Context> context_1;
v8::Handle<v8::Context> context_2;
@@ -6299,6 +6297,8 @@
context_1 = v8::Context::New(isolate, NULL, global_template,
global_object);
context_2 = v8::Context::New(isolate, NULL, global_template,
global_object);
+ v8::Debug::SetMessageHandler2(ContextCheckMessageHandler);
+
// Default data value is undefined.
CHECK(context_1->GetEmbedderData(0)->IsUndefined());
CHECK(context_2->GetEmbedderData(0)->IsUndefined());
@@ -6456,7 +6456,8 @@
// Common part of EvalContextData and NestedBreakEventContextData tests.
-static void ExecuteScriptForContextCheck() {
+static void ExecuteScriptForContextCheck(
+ v8::Debug::MessageHandler2 message_handler) {
// Create a context.
v8::Handle<v8::Context> context_1;
v8::Handle<v8::ObjectTemplate> global_template =
@@ -6464,6 +6465,8 @@
context_1 =
v8::Context::New(v8::Isolate::GetCurrent(), NULL, global_template);
+ v8::Debug::SetMessageHandler2(message_handler);
+
// Default data value is undefined.
CHECK(context_1->GetEmbedderData(0)->IsUndefined());
@@ -6483,6 +6486,8 @@
v8::Local<v8::Function> f = CompileFunction(source, "f");
f->Call(context_1->Global(), 0, NULL);
}
+
+ v8::Debug::SetMessageHandler2(NULL);
}
@@ -6492,13 +6497,11 @@
// Message.GetEventContext.
TEST(EvalContextData) {
v8::HandleScope scope(v8::Isolate::GetCurrent());
- v8::Debug::SetMessageHandler2(ContextCheckMessageHandler);
- ExecuteScriptForContextCheck();
+ ExecuteScriptForContextCheck(ContextCheckMessageHandler);
// One time compile event and one time break event.
CHECK_GT(message_handler_hit_count, 2);
- v8::Debug::SetMessageHandler2(NULL);
CheckDebuggerUnloaded();
}
@@ -6557,16 +6560,14 @@
v8::HandleScope scope(v8::Isolate::GetCurrent());
break_count = 0;
message_handler_hit_count = 0;
- v8::Debug::SetMessageHandler2(DebugEvalContextCheckMessageHandler);
- ExecuteScriptForContextCheck();
+ ExecuteScriptForContextCheck(DebugEvalContextCheckMessageHandler);
// One time compile event and two times break event.
CHECK_GT(message_handler_hit_count, 3);
// One break from the source and another from the evaluate request.
CHECK_EQ(break_count, 2);
- v8::Debug::SetMessageHandler2(NULL);
CheckDebuggerUnloaded();
}
@@ -7137,9 +7138,9 @@
v8::Isolate* isolate = v8::Isolate::GetCurrent();
v8::HandleScope scope(isolate);
expected_callback_data = v8::Int32::New(2010);
+ expected_context = v8::Context::New(isolate);
v8::Debug::SetDebugEventListener2(DebugEventContextChecker,
expected_callback_data);
- expected_context = v8::Context::New(isolate);
v8::Context::Scope context_scope(expected_context);
v8::Script::Compile(v8::String::New("(function(){debugger;})();"))->Run();
expected_context.Clear();
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.