OLD | NEW |
1 // Copyright 2007-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2008 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 5239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5250 v8::Local<v8::Function> f = | 5250 v8::Local<v8::Function> f = |
5251 v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("f"))); | 5251 v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("f"))); |
5252 f->Call(env->Global(), 0, NULL); | 5252 f->Call(env->Global(), 0, NULL); |
5253 | 5253 |
5254 // Setting message handler to NULL should cause debugger unload. | 5254 // Setting message handler to NULL should cause debugger unload. |
5255 v8::Debug::SetMessageHandler2(NULL); | 5255 v8::Debug::SetMessageHandler2(NULL); |
5256 CheckDebuggerUnloaded(); | 5256 CheckDebuggerUnloaded(); |
5257 | 5257 |
5258 CHECK_EQ(1, exception_event_count); | 5258 CHECK_EQ(1, exception_event_count); |
5259 } | 5259 } |
| 5260 |
| 5261 |
| 5262 // Tests after compile event is sent when there are some provisional |
| 5263 // breakpoints out of the scripts lines range. |
| 5264 TEST(ProvisionalBreakpointOnLineOutOfRange) { |
| 5265 v8::HandleScope scope; |
| 5266 DebugLocalContext env; |
| 5267 env.ExposeDebug(); |
| 5268 const char* script = "function f() {};"; |
| 5269 const char* resource_name = "test_resource"; |
| 5270 |
| 5271 // Set a couple of provisional breakpoint on lines out of the script lines |
| 5272 // range. |
| 5273 int sbp1 = SetScriptBreakPointByNameFromJS(resource_name, 3, |
| 5274 -1 /* no column */); |
| 5275 int sbp2 = SetScriptBreakPointByNameFromJS(resource_name, 5, 5); |
| 5276 |
| 5277 after_compile_message_count = 0; |
| 5278 v8::Debug::SetMessageHandler2(AfterCompileMessageHandler); |
| 5279 |
| 5280 v8::ScriptOrigin origin( |
| 5281 v8::String::New(resource_name), |
| 5282 v8::Integer::New(10), |
| 5283 v8::Integer::New(1)); |
| 5284 // Compile a script whose first line number is greater than the breakpoints' |
| 5285 // lines. |
| 5286 v8::Script::Compile(v8::String::New(script), &origin)->Run(); |
| 5287 |
| 5288 // If the script is compiled successfully there is exactly one after compile |
| 5289 // event. In case of an exception in debugger code after compile event is not |
| 5290 // sent. |
| 5291 CHECK_EQ(1, after_compile_message_count); |
| 5292 |
| 5293 ClearBreakPointFromJS(sbp1); |
| 5294 ClearBreakPointFromJS(sbp2); |
| 5295 v8::Debug::SetMessageHandler2(NULL); |
| 5296 } |
OLD | NEW |