| 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 6908 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6919 v8::Isolate* isolate = env->GetIsolate(); | 6919 v8::Isolate* isolate = env->GetIsolate(); |
| 6920 v8::HandleScope scope(isolate); | 6920 v8::HandleScope scope(isolate); |
| 6921 v8::Debug::SetDebugEventListener(DebugEventBreakDataChecker); | 6921 v8::Debug::SetDebugEventListener(DebugEventBreakDataChecker); |
| 6922 | 6922 |
| 6923 TestClientData::constructor_call_counter = 0; | 6923 TestClientData::constructor_call_counter = 0; |
| 6924 TestClientData::destructor_call_counter = 0; | 6924 TestClientData::destructor_call_counter = 0; |
| 6925 | 6925 |
| 6926 expected_break_data = NULL; | 6926 expected_break_data = NULL; |
| 6927 was_debug_event_called = false; | 6927 was_debug_event_called = false; |
| 6928 was_debug_break_called = false; | 6928 was_debug_break_called = false; |
| 6929 v8::Debug::DebugBreakForCommand(NULL, isolate); | 6929 v8::Debug::DebugBreakForCommand(isolate, NULL); |
| 6930 v8::Script::Compile(v8::String::NewFromUtf8(env->GetIsolate(), | 6930 v8::Script::Compile(v8::String::NewFromUtf8(env->GetIsolate(), |
| 6931 "(function(x){return x;})(1);")) | 6931 "(function(x){return x;})(1);")) |
| 6932 ->Run(); | 6932 ->Run(); |
| 6933 CHECK(was_debug_event_called); | 6933 CHECK(was_debug_event_called); |
| 6934 CHECK(!was_debug_break_called); | 6934 CHECK(!was_debug_break_called); |
| 6935 | 6935 |
| 6936 TestClientData* data1 = new TestClientData(); | 6936 TestClientData* data1 = new TestClientData(); |
| 6937 expected_break_data = data1; | 6937 expected_break_data = data1; |
| 6938 was_debug_event_called = false; | 6938 was_debug_event_called = false; |
| 6939 was_debug_break_called = false; | 6939 was_debug_break_called = false; |
| 6940 v8::Debug::DebugBreakForCommand(data1, isolate); | 6940 v8::Debug::DebugBreakForCommand(isolate, data1); |
| 6941 v8::Script::Compile(v8::String::NewFromUtf8(env->GetIsolate(), | 6941 v8::Script::Compile(v8::String::NewFromUtf8(env->GetIsolate(), |
| 6942 "(function(x){return x+1;})(1);")) | 6942 "(function(x){return x+1;})(1);")) |
| 6943 ->Run(); | 6943 ->Run(); |
| 6944 CHECK(was_debug_event_called); | 6944 CHECK(was_debug_event_called); |
| 6945 CHECK(!was_debug_break_called); | 6945 CHECK(!was_debug_break_called); |
| 6946 | 6946 |
| 6947 expected_break_data = NULL; | 6947 expected_break_data = NULL; |
| 6948 was_debug_event_called = false; | 6948 was_debug_event_called = false; |
| 6949 was_debug_break_called = false; | 6949 was_debug_break_called = false; |
| 6950 v8::Debug::DebugBreak(isolate); | 6950 v8::Debug::DebugBreak(isolate); |
| 6951 v8::Script::Compile(v8::String::NewFromUtf8(env->GetIsolate(), | 6951 v8::Script::Compile(v8::String::NewFromUtf8(env->GetIsolate(), |
| 6952 "(function(x){return x+2;})(1);")) | 6952 "(function(x){return x+2;})(1);")) |
| 6953 ->Run(); | 6953 ->Run(); |
| 6954 CHECK(!was_debug_event_called); | 6954 CHECK(!was_debug_event_called); |
| 6955 CHECK(was_debug_break_called); | 6955 CHECK(was_debug_break_called); |
| 6956 | 6956 |
| 6957 TestClientData* data2 = new TestClientData(); | 6957 TestClientData* data2 = new TestClientData(); |
| 6958 expected_break_data = data2; | 6958 expected_break_data = data2; |
| 6959 was_debug_event_called = false; | 6959 was_debug_event_called = false; |
| 6960 was_debug_break_called = false; | 6960 was_debug_break_called = false; |
| 6961 v8::Debug::DebugBreak(isolate); | 6961 v8::Debug::DebugBreak(isolate); |
| 6962 v8::Debug::DebugBreakForCommand(data2, isolate); | 6962 v8::Debug::DebugBreakForCommand(isolate, data2); |
| 6963 v8::Script::Compile(v8::String::NewFromUtf8(env->GetIsolate(), | 6963 v8::Script::Compile(v8::String::NewFromUtf8(env->GetIsolate(), |
| 6964 "(function(x){return x+3;})(1);")) | 6964 "(function(x){return x+3;})(1);")) |
| 6965 ->Run(); | 6965 ->Run(); |
| 6966 CHECK(was_debug_event_called); | 6966 CHECK(was_debug_event_called); |
| 6967 CHECK(was_debug_break_called); | 6967 CHECK(was_debug_break_called); |
| 6968 | 6968 |
| 6969 CHECK_EQ(2, TestClientData::constructor_call_counter); | 6969 CHECK_EQ(2, TestClientData::constructor_call_counter); |
| 6970 CHECK_EQ(TestClientData::constructor_call_counter, | 6970 CHECK_EQ(TestClientData::constructor_call_counter, |
| 6971 TestClientData::destructor_call_counter); | 6971 TestClientData::destructor_call_counter); |
| 6972 | 6972 |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7340 CHECK_EQ(2, CountNativeContexts()); | 7340 CHECK_EQ(2, CountNativeContexts()); |
| 7341 | 7341 |
| 7342 v8::Debug::SetDebugEventListener(NULL); | 7342 v8::Debug::SetDebugEventListener(NULL); |
| 7343 } | 7343 } |
| 7344 | 7344 |
| 7345 | 7345 |
| 7346 TEST(LiveEditEnabled) { | 7346 TEST(LiveEditEnabled) { |
| 7347 v8::internal::FLAG_allow_natives_syntax = true; | 7347 v8::internal::FLAG_allow_natives_syntax = true; |
| 7348 LocalContext env; | 7348 LocalContext env; |
| 7349 v8::HandleScope scope(env->GetIsolate()); | 7349 v8::HandleScope scope(env->GetIsolate()); |
| 7350 v8::Debug::SetLiveEditEnabled(true, env->GetIsolate()); | 7350 v8::Debug::SetLiveEditEnabled(env->GetIsolate(), true); |
| 7351 CompileRun("%LiveEditCompareStrings('', '')"); | 7351 CompileRun("%LiveEditCompareStrings('', '')"); |
| 7352 } | 7352 } |
| 7353 | 7353 |
| 7354 | 7354 |
| 7355 TEST(LiveEditDisabled) { | 7355 TEST(LiveEditDisabled) { |
| 7356 v8::internal::FLAG_allow_natives_syntax = true; | 7356 v8::internal::FLAG_allow_natives_syntax = true; |
| 7357 LocalContext env; | 7357 LocalContext env; |
| 7358 v8::HandleScope scope(env->GetIsolate()); | 7358 v8::HandleScope scope(env->GetIsolate()); |
| 7359 v8::Debug::SetLiveEditEnabled(false, env->GetIsolate()); | 7359 v8::Debug::SetLiveEditEnabled(env->GetIsolate(), false); |
| 7360 CompileRun("%LiveEditCompareStrings('', '')"); | 7360 CompileRun("%LiveEditCompareStrings('', '')"); |
| 7361 } | 7361 } |
| 7362 | 7362 |
| 7363 | 7363 |
| 7364 TEST(PrecompiledFunction) { | 7364 TEST(PrecompiledFunction) { |
| 7365 // Regression test for crbug.com/346207. If we have preparse data, parsing the | 7365 // Regression test for crbug.com/346207. If we have preparse data, parsing the |
| 7366 // function in the presence of the debugger (and breakpoints) should still | 7366 // function in the presence of the debugger (and breakpoints) should still |
| 7367 // succeed. The bug was that preparsing was done lazily and parsing was done | 7367 // succeed. The bug was that preparsing was done lazily and parsing was done |
| 7368 // eagerly, so, the symbol streams didn't match. | 7368 // eagerly, so, the symbol streams didn't match. |
| 7369 DebugLocalContext env; | 7369 DebugLocalContext env; |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7464 TEST(DebugBreakOffThreadTerminate) { | 7464 TEST(DebugBreakOffThreadTerminate) { |
| 7465 DebugLocalContext env; | 7465 DebugLocalContext env; |
| 7466 v8::Isolate* isolate = env->GetIsolate(); | 7466 v8::Isolate* isolate = env->GetIsolate(); |
| 7467 v8::HandleScope scope(isolate); | 7467 v8::HandleScope scope(isolate); |
| 7468 v8::Debug::SetDebugEventListener(DebugBreakTriggerTerminate); | 7468 v8::Debug::SetDebugEventListener(DebugBreakTriggerTerminate); |
| 7469 TerminationThread terminator(isolate); | 7469 TerminationThread terminator(isolate); |
| 7470 terminator.Start(); | 7470 terminator.Start(); |
| 7471 v8::Debug::DebugBreak(isolate); | 7471 v8::Debug::DebugBreak(isolate); |
| 7472 CompileRun("while (true);"); | 7472 CompileRun("while (true);"); |
| 7473 } | 7473 } |
| OLD | NEW |