| 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 3365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3376 // of debug event exception callbacks and message callbacks are collected. The | 3376 // of debug event exception callbacks and message callbacks are collected. The |
| 3377 // number of debug event exception callbacks are used to check that the | 3377 // number of debug event exception callbacks are used to check that the |
| 3378 // debugger is called correctly and the number of message callbacks is used to | 3378 // debugger is called correctly and the number of message callbacks is used to |
| 3379 // check that uncaught exceptions are still returned even if there is a break | 3379 // check that uncaught exceptions are still returned even if there is a break |
| 3380 // for them. | 3380 // for them. |
| 3381 TEST(BreakOnException) { | 3381 TEST(BreakOnException) { |
| 3382 v8::HandleScope scope; | 3382 v8::HandleScope scope; |
| 3383 DebugLocalContext env; | 3383 DebugLocalContext env; |
| 3384 env.ExposeDebug(); | 3384 env.ExposeDebug(); |
| 3385 | 3385 |
| 3386 v8::internal::Top::TraceException(false); | 3386 v8::internal::Isolate::Current()->TraceException(false); |
| 3387 | 3387 |
| 3388 // Create functions for testing break on exception. | 3388 // Create functions for testing break on exception. |
| 3389 v8::Local<v8::Function> throws = | 3389 v8::Local<v8::Function> throws = |
| 3390 CompileFunction(&env, "function throws(){throw 1;}", "throws"); | 3390 CompileFunction(&env, "function throws(){throw 1;}", "throws"); |
| 3391 v8::Local<v8::Function> caught = | 3391 v8::Local<v8::Function> caught = |
| 3392 CompileFunction(&env, | 3392 CompileFunction(&env, |
| 3393 "function caught(){try {throws();} catch(e) {};}", | 3393 "function caught(){try {throws();} catch(e) {};}", |
| 3394 "caught"); | 3394 "caught"); |
| 3395 v8::Local<v8::Function> notCaught = | 3395 v8::Local<v8::Function> notCaught = |
| 3396 CompileFunction(&env, "function notCaught(){throws();}", "notCaught"); | 3396 CompileFunction(&env, "function notCaught(){throws();}", "notCaught"); |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3520 } | 3520 } |
| 3521 | 3521 |
| 3522 | 3522 |
| 3523 // Test break on exception from compiler errors. When compiling using | 3523 // Test break on exception from compiler errors. When compiling using |
| 3524 // v8::Script::Compile there is no JavaScript stack whereas when compiling using | 3524 // v8::Script::Compile there is no JavaScript stack whereas when compiling using |
| 3525 // eval there are JavaScript frames. | 3525 // eval there are JavaScript frames. |
| 3526 TEST(BreakOnCompileException) { | 3526 TEST(BreakOnCompileException) { |
| 3527 v8::HandleScope scope; | 3527 v8::HandleScope scope; |
| 3528 DebugLocalContext env; | 3528 DebugLocalContext env; |
| 3529 | 3529 |
| 3530 v8::internal::Top::TraceException(false); | 3530 v8::internal::Isolate::Current()->TraceException(false); |
| 3531 | 3531 |
| 3532 // Create a function for checking the function when hitting a break point. | 3532 // Create a function for checking the function when hitting a break point. |
| 3533 frame_count = CompileFunction(&env, frame_count_source, "frame_count"); | 3533 frame_count = CompileFunction(&env, frame_count_source, "frame_count"); |
| 3534 | 3534 |
| 3535 v8::V8::AddMessageListener(MessageCallbackCount); | 3535 v8::V8::AddMessageListener(MessageCallbackCount); |
| 3536 v8::Debug::SetDebugEventListener(DebugEventCounter); | 3536 v8::Debug::SetDebugEventListener(DebugEventCounter); |
| 3537 | 3537 |
| 3538 DebugEventCounterClear(); | 3538 DebugEventCounterClear(); |
| 3539 MessageCallbackCountClear(); | 3539 MessageCallbackCountClear(); |
| 3540 | 3540 |
| (...skipping 3024 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6565 expected_context = v8::Context::New(); | 6565 expected_context = v8::Context::New(); |
| 6566 v8::Context::Scope context_scope(expected_context); | 6566 v8::Context::Scope context_scope(expected_context); |
| 6567 v8::Script::Compile(v8::String::New("(function(){debugger;})();"))->Run(); | 6567 v8::Script::Compile(v8::String::New("(function(){debugger;})();"))->Run(); |
| 6568 expected_context.Dispose(); | 6568 expected_context.Dispose(); |
| 6569 expected_context.Clear(); | 6569 expected_context.Clear(); |
| 6570 v8::Debug::SetDebugEventListener(NULL); | 6570 v8::Debug::SetDebugEventListener(NULL); |
| 6571 expected_context_data = v8::Handle<v8::Value>(); | 6571 expected_context_data = v8::Handle<v8::Value>(); |
| 6572 CheckDebuggerUnloaded(); | 6572 CheckDebuggerUnloaded(); |
| 6573 } | 6573 } |
| 6574 | 6574 |
| OLD | NEW |