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 4309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4320 } | 4320 } |
4321 | 4321 |
4322 f->Call(context, env->Global(), 0, NULL).ToLocalChecked(); | 4322 f->Call(context, env->Global(), 0, NULL).ToLocalChecked(); |
4323 CHECK_EQ(2, break_point_hit_count); | 4323 CHECK_EQ(2, break_point_hit_count); |
4324 | 4324 |
4325 // Get rid of the debug event listener. | 4325 // Get rid of the debug event listener. |
4326 v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); | 4326 v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); |
4327 CheckDebuggerUnloaded(env->GetIsolate()); | 4327 CheckDebuggerUnloaded(env->GetIsolate()); |
4328 } | 4328 } |
4329 | 4329 |
| 4330 TEST(DisableDebuggerStatement) { |
| 4331 DebugLocalContext env; |
| 4332 v8::HandleScope scope(env->GetIsolate()); |
| 4333 |
| 4334 // Register a debug event listener which sets the break flag and counts. |
| 4335 v8::Debug::SetDebugEventListener(env->GetIsolate(), DebugEventCounter); |
| 4336 CompileRun("debugger;"); |
| 4337 CHECK_EQ(1, break_point_hit_count); |
| 4338 |
| 4339 // Check that we ignore debugger statement when breakpoints aren't active. |
| 4340 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(env->GetIsolate()); |
| 4341 isolate->debug()->set_break_points_active(false); |
| 4342 CompileRun("debugger;"); |
| 4343 CHECK_EQ(1, break_point_hit_count); |
| 4344 } |
| 4345 |
4330 static const char* kSimpleExtensionSource = | 4346 static const char* kSimpleExtensionSource = |
4331 "(function Foo() {" | 4347 "(function Foo() {" |
4332 " return 4;" | 4348 " return 4;" |
4333 "})() "; | 4349 "})() "; |
4334 | 4350 |
4335 // http://crbug.com/28933 | 4351 // http://crbug.com/28933 |
4336 // Test that debug break is disabled when bootstrapper is active. | 4352 // Test that debug break is disabled when bootstrapper is active. |
4337 TEST(NoBreakWhenBootstrapping) { | 4353 TEST(NoBreakWhenBootstrapping) { |
4338 v8::Isolate* isolate = CcTest::isolate(); | 4354 v8::Isolate* isolate = CcTest::isolate(); |
4339 v8::HandleScope scope(isolate); | 4355 v8::HandleScope scope(isolate); |
(...skipping 3709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8049 CHECK_EQ(22, iterator->GetBreakLocation().position()); | 8065 CHECK_EQ(22, iterator->GetBreakLocation().position()); |
8050 iterator->Next(); | 8066 iterator->Next(); |
8051 CHECK(iterator->GetBreakLocation().IsReturn()); | 8067 CHECK(iterator->GetBreakLocation().IsReturn()); |
8052 CHECK_EQ(50, iterator->GetBreakLocation().position()); | 8068 CHECK_EQ(50, iterator->GetBreakLocation().position()); |
8053 iterator->Next(); | 8069 iterator->Next(); |
8054 CHECK(iterator->Done()); | 8070 CHECK(iterator->Done()); |
8055 delete iterator; | 8071 delete iterator; |
8056 | 8072 |
8057 DisableDebugger(isolate); | 8073 DisableDebugger(isolate); |
8058 } | 8074 } |
OLD | NEW |