Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Side by Side Diff: test/cctest/test-debug.cc

Issue 1909433003: Remove support for Object.observe (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/cctest/test-api.cc ('k') | test/cctest/test-field-type-tracking.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 7864 matching lines...) Expand 10 before | Expand all | Expand 10 after
7875 CompileRun( 7875 CompileRun(
7876 "var r;" 7876 "var r;"
7877 "p.chain(function() { r = 'resolved'; }," 7877 "p.chain(function() { r = 'resolved'; },"
7878 " function(e) { r = 'rejected' + e; });"); 7878 " function(e) { r = 'rejected' + e; });");
7879 CHECK( 7879 CHECK(
7880 CompileRun("r")->Equals(context, v8_str("rejectedrejection")).FromJust()); 7880 CompileRun("r")->Equals(context, v8_str("rejectedrejection")).FromJust());
7881 CHECK_EQ(1, exception_event_counter); 7881 CHECK_EQ(1, exception_event_counter);
7882 } 7882 }
7883 7883
7884 7884
7885 TEST(DebugBreakOnExceptionInObserveCallback) {
7886 i::FLAG_harmony_object_observe = true;
7887 DebugLocalContext env;
7888 v8::Isolate* isolate = env->GetIsolate();
7889 v8::HandleScope scope(isolate);
7890 v8::Debug::SetDebugEventListener(isolate, &DebugEventCountException);
7891 v8::Local<v8::Context> context = env.context();
7892 // Break on uncaught exception
7893 ChangeBreakOnException(false, true);
7894 exception_event_counter = 0;
7895
7896 v8::Local<v8::FunctionTemplate> fun =
7897 v8::FunctionTemplate::New(isolate, ThrowCallback);
7898 CHECK(env->Global()
7899 ->Set(context, v8_str("fun"),
7900 fun->GetFunction(context).ToLocalChecked())
7901 .FromJust());
7902
7903 CompileRun(
7904 "var obj = {};"
7905 "var callbackRan = false;"
7906 "Object.observe(obj, function() {"
7907 " callbackRan = true;"
7908 " throw Error('foo');"
7909 "});"
7910 "obj.prop = 1");
7911 CHECK(CompileRun("callbackRan")->BooleanValue(context).FromJust());
7912 CHECK_EQ(1, exception_event_counter);
7913 }
7914
7915
7916 static void DebugHarmonyScopingListener( 7885 static void DebugHarmonyScopingListener(
7917 const v8::Debug::EventDetails& event_details) { 7886 const v8::Debug::EventDetails& event_details) {
7918 v8::DebugEvent event = event_details.GetEvent(); 7887 v8::DebugEvent event = event_details.GetEvent();
7919 if (event != v8::Break) return; 7888 if (event != v8::Break) return;
7920 7889
7921 int break_id = CcTest::i_isolate()->debug()->break_id(); 7890 int break_id = CcTest::i_isolate()->debug()->break_id();
7922 7891
7923 char script[128]; 7892 char script[128];
7924 i::Vector<char> script_vector(script, sizeof(script)); 7893 i::Vector<char> script_vector(script, sizeof(script));
7925 SNPrintF(script_vector, "%%GetFrameCount(%d)", break_id); 7894 SNPrintF(script_vector, "%%GetFrameCount(%d)", break_id);
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
8211 "function foo() {\n" 8180 "function foo() {\n"
8212 " try { throw new Error(); } catch (e) {}\n" 8181 " try { throw new Error(); } catch (e) {}\n"
8213 "}\n" 8182 "}\n"
8214 "debugger;\n" 8183 "debugger;\n"
8215 "foo();\n" 8184 "foo();\n"
8216 "foo();\n"); 8185 "foo();\n");
8217 8186
8218 v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); 8187 v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr);
8219 CHECK_EQ(break_point_hit_count, 4); 8188 CHECK_EQ(break_point_hit_count, 4);
8220 } 8189 }
OLDNEW
« no previous file with comments | « test/cctest/test-api.cc ('k') | test/cctest/test-field-type-tracking.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698