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 8754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8765 CHECK(trouble_caller->IsFunction()); | 8765 CHECK(trouble_caller->IsFunction()); |
8766 Function::Cast(*trouble_caller) | 8766 Function::Cast(*trouble_caller) |
8767 ->Call(env.local(), global, 0, NULL) | 8767 ->Call(env.local(), global, 0, NULL) |
8768 .FromMaybe(v8::Local<v8::Value>()); | 8768 .FromMaybe(v8::Local<v8::Value>()); |
8769 CHECK_EQ(1, report_count); | 8769 CHECK_EQ(1, report_count); |
8770 isolate->RemoveMessageListeners(ApiUncaughtExceptionTestListener); | 8770 isolate->RemoveMessageListeners(ApiUncaughtExceptionTestListener); |
8771 } | 8771 } |
8772 | 8772 |
8773 | 8773 |
8774 TEST(ApiUncaughtExceptionInObjectObserve) { | 8774 TEST(ApiUncaughtExceptionInObjectObserve) { |
| 8775 v8::internal::FLAG_harmony_object_observe = true; |
8775 v8::internal::FLAG_stack_size = 150; | 8776 v8::internal::FLAG_stack_size = 150; |
8776 report_count = 0; | 8777 report_count = 0; |
8777 LocalContext env; | 8778 LocalContext env; |
8778 v8::Isolate* isolate = env->GetIsolate(); | 8779 v8::Isolate* isolate = env->GetIsolate(); |
8779 v8::HandleScope scope(isolate); | 8780 v8::HandleScope scope(isolate); |
8780 isolate->AddMessageListener(ApiUncaughtExceptionTestListener); | 8781 isolate->AddMessageListener(ApiUncaughtExceptionTestListener); |
8781 CompileRun( | 8782 CompileRun( |
8782 "var obj = {};" | 8783 "var obj = {};" |
8783 "var observe_count = 0;" | 8784 "var observe_count = 0;" |
8784 "function observer1() { ++observe_count; };" | 8785 "function observer1() { ++observe_count; };" |
(...skipping 11345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
20130 Local<Object> exec_state = event_details.GetExecutionState(); | 20131 Local<Object> exec_state = event_details.GetExecutionState(); |
20131 Local<Value> break_id = exec_state->Get(v8_str("break_id")); | 20132 Local<Value> break_id = exec_state->Get(v8_str("break_id")); |
20132 CompileRun("function f(id) { new FrameDetails(id, 0); }"); | 20133 CompileRun("function f(id) { new FrameDetails(id, 0); }"); |
20133 Local<Function> fun = | 20134 Local<Function> fun = |
20134 Local<Function>::Cast(CcTest::global()->Get(v8_str("f"))); | 20135 Local<Function>::Cast(CcTest::global()->Get(v8_str("f"))); |
20135 fun->Call(CcTest::global(), 1, &break_id); | 20136 fun->Call(CcTest::global(), 1, &break_id); |
20136 } | 20137 } |
20137 | 20138 |
20138 | 20139 |
20139 TEST(Regress385349) { | 20140 TEST(Regress385349) { |
| 20141 i::FLAG_harmony_object_observe = true; |
20140 i::FLAG_allow_natives_syntax = true; | 20142 i::FLAG_allow_natives_syntax = true; |
20141 v8::Isolate* isolate = CcTest::isolate(); | 20143 v8::Isolate* isolate = CcTest::isolate(); |
20142 HandleScope handle_scope(isolate); | 20144 HandleScope handle_scope(isolate); |
20143 isolate->SetAutorunMicrotasks(false); | 20145 isolate->SetAutorunMicrotasks(false); |
20144 Local<Context> context = Context::New(isolate); | 20146 Local<Context> context = Context::New(isolate); |
20145 v8::Debug::SetDebugEventListener(isolate, DebugEventInObserver); | 20147 v8::Debug::SetDebugEventListener(isolate, DebugEventInObserver); |
20146 { | 20148 { |
20147 Context::Scope context_scope(context); | 20149 Context::Scope context_scope(context); |
20148 CompileRun("var obj = {};" | 20150 CompileRun("var obj = {};" |
20149 "Object.observe(obj, function(changes) { debugger; });" | 20151 "Object.observe(obj, function(changes) { debugger; });" |
(...skipping 3675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
23825 env2->Global()->Set(env2.local(), v8_str("obj2"), object2).FromJust()); | 23827 env2->Global()->Set(env2.local(), v8_str("obj2"), object2).FromJust()); |
23826 ExpectString("typeof obj2.values", "function"); | 23828 ExpectString("typeof obj2.values", "function"); |
23827 CHECK_NE(*object->Get(v8_str("values")), *object2->Get(v8_str("values"))); | 23829 CHECK_NE(*object->Get(v8_str("values")), *object2->Get(v8_str("values"))); |
23828 | 23830 |
23829 auto values2 = Local<Function>::Cast(object2->Get(v8_str("values"))); | 23831 auto values2 = Local<Function>::Cast(object2->Get(v8_str("values"))); |
23830 auto fn2 = i::Handle<i::JSFunction>::cast(v8::Utils::OpenHandle(*values2)); | 23832 auto fn2 = i::Handle<i::JSFunction>::cast(v8::Utils::OpenHandle(*values2)); |
23831 auto ctx2 = v8::Utils::OpenHandle(*env2.local()); | 23833 auto ctx2 = v8::Utils::OpenHandle(*env2.local()); |
23832 CHECK_EQ(fn2->GetCreationContext(), *ctx2); | 23834 CHECK_EQ(fn2->GetCreationContext(), *ctx2); |
23833 } | 23835 } |
23834 } | 23836 } |
OLD | NEW |