OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 119 matching lines...) Loading... |
130 inline DebugLocalContext( | 130 inline DebugLocalContext( |
131 v8::ExtensionConfiguration* extensions = 0, | 131 v8::ExtensionConfiguration* extensions = 0, |
132 v8::Handle<v8::ObjectTemplate> global_template = | 132 v8::Handle<v8::ObjectTemplate> global_template = |
133 v8::Handle<v8::ObjectTemplate>(), | 133 v8::Handle<v8::ObjectTemplate>(), |
134 v8::Handle<v8::Value> global_object = v8::Handle<v8::Value>()) | 134 v8::Handle<v8::Value> global_object = v8::Handle<v8::Value>()) |
135 : context_(v8::Context::New(extensions, global_template, global_object)) { | 135 : context_(v8::Context::New(extensions, global_template, global_object)) { |
136 context_->Enter(); | 136 context_->Enter(); |
137 } | 137 } |
138 inline ~DebugLocalContext() { | 138 inline ~DebugLocalContext() { |
139 context_->Exit(); | 139 context_->Exit(); |
140 context_.Dispose(); | 140 context_.Dispose(context_->GetIsolate()); |
141 } | 141 } |
142 inline v8::Context* operator->() { return *context_; } | 142 inline v8::Context* operator->() { return *context_; } |
143 inline v8::Context* operator*() { return *context_; } | 143 inline v8::Context* operator*() { return *context_; } |
144 inline bool IsReady() { return !context_.IsEmpty(); } | 144 inline bool IsReady() { return !context_.IsEmpty(); } |
145 void ExposeDebug() { | 145 void ExposeDebug() { |
146 v8::internal::Isolate* isolate = v8::internal::Isolate::Current(); | 146 v8::internal::Isolate* isolate = v8::internal::Isolate::Current(); |
147 v8::internal::Debug* debug = isolate->debug(); | 147 v8::internal::Debug* debug = isolate->debug(); |
148 // Expose the debug context global object in the global object for testing. | 148 // Expose the debug context global object in the global object for testing. |
149 debug->Load(); | 149 debug->Load(); |
150 debug->debug_context()->set_security_token( | 150 debug->debug_context()->set_security_token( |
(...skipping 4073 matching lines...) Loading... |
4224 v8::Debug::DebugBreak(); | 4224 v8::Debug::DebugBreak(); |
4225 break_point_hit_count = 0; | 4225 break_point_hit_count = 0; |
4226 { | 4226 { |
4227 // Create a context with an extension to make sure that some JavaScript | 4227 // Create a context with an extension to make sure that some JavaScript |
4228 // code is executed during bootstrapping. | 4228 // code is executed during bootstrapping. |
4229 v8::RegisterExtension(new v8::Extension("simpletest", | 4229 v8::RegisterExtension(new v8::Extension("simpletest", |
4230 kSimpleExtensionSource)); | 4230 kSimpleExtensionSource)); |
4231 const char* extension_names[] = { "simpletest" }; | 4231 const char* extension_names[] = { "simpletest" }; |
4232 v8::ExtensionConfiguration extensions(1, extension_names); | 4232 v8::ExtensionConfiguration extensions(1, extension_names); |
4233 v8::Persistent<v8::Context> context = v8::Context::New(&extensions); | 4233 v8::Persistent<v8::Context> context = v8::Context::New(&extensions); |
4234 context.Dispose(); | 4234 context.Dispose(context->GetIsolate()); |
4235 } | 4235 } |
4236 // Check that no DebugBreak events occured during the context creation. | 4236 // Check that no DebugBreak events occured during the context creation. |
4237 CHECK_EQ(0, break_point_hit_count); | 4237 CHECK_EQ(0, break_point_hit_count); |
4238 | 4238 |
4239 // Get rid of the debug event listener. | 4239 // Get rid of the debug event listener. |
4240 v8::Debug::SetDebugEventListener(NULL); | 4240 v8::Debug::SetDebugEventListener(NULL); |
4241 CheckDebuggerUnloaded(); | 4241 CheckDebuggerUnloaded(); |
4242 } | 4242 } |
4243 | 4243 |
4244 static v8::Handle<v8::Array> NamedEnum(const v8::AccessorInfo&) { | 4244 static v8::Handle<v8::Array> NamedEnum(const v8::AccessorInfo&) { |
(...skipping 2817 matching lines...) Loading... |
7062 | 7062 |
7063 // Check that event details contain context where debug event occured. | 7063 // Check that event details contain context where debug event occured. |
7064 TEST(DebugEventContext) { | 7064 TEST(DebugEventContext) { |
7065 v8::HandleScope scope; | 7065 v8::HandleScope scope; |
7066 expected_callback_data = v8::Int32::New(2010); | 7066 expected_callback_data = v8::Int32::New(2010); |
7067 v8::Debug::SetDebugEventListener2(DebugEventContextChecker, | 7067 v8::Debug::SetDebugEventListener2(DebugEventContextChecker, |
7068 expected_callback_data); | 7068 expected_callback_data); |
7069 expected_context = v8::Context::New(); | 7069 expected_context = v8::Context::New(); |
7070 v8::Context::Scope context_scope(expected_context); | 7070 v8::Context::Scope context_scope(expected_context); |
7071 v8::Script::Compile(v8::String::New("(function(){debugger;})();"))->Run(); | 7071 v8::Script::Compile(v8::String::New("(function(){debugger;})();"))->Run(); |
7072 expected_context.Dispose(); | 7072 expected_context.Dispose(expected_context->GetIsolate()); |
7073 expected_context.Clear(); | 7073 expected_context.Clear(); |
7074 v8::Debug::SetDebugEventListener(NULL); | 7074 v8::Debug::SetDebugEventListener(NULL); |
7075 expected_context_data = v8::Handle<v8::Value>(); | 7075 expected_context_data = v8::Handle<v8::Value>(); |
7076 CheckDebuggerUnloaded(); | 7076 CheckDebuggerUnloaded(); |
7077 } | 7077 } |
7078 | 7078 |
7079 | 7079 |
7080 static void* expected_break_data; | 7080 static void* expected_break_data; |
7081 static bool was_debug_break_called; | 7081 static bool was_debug_break_called; |
7082 static bool was_debug_event_called; | 7082 static bool was_debug_event_called; |
(...skipping 440 matching lines...) Loading... |
7523 TEST(LiveEditDisabled) { | 7523 TEST(LiveEditDisabled) { |
7524 v8::internal::FLAG_allow_natives_syntax = true; | 7524 v8::internal::FLAG_allow_natives_syntax = true; |
7525 v8::HandleScope scope; | 7525 v8::HandleScope scope; |
7526 LocalContext context; | 7526 LocalContext context; |
7527 v8::Debug::SetLiveEditEnabled(false); | 7527 v8::Debug::SetLiveEditEnabled(false); |
7528 CompileRun("%LiveEditCompareStrings('', '')"); | 7528 CompileRun("%LiveEditCompareStrings('', '')"); |
7529 } | 7529 } |
7530 | 7530 |
7531 | 7531 |
7532 #endif // ENABLE_DEBUGGER_SUPPORT | 7532 #endif // ENABLE_DEBUGGER_SUPPORT |
OLD | NEW |