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 7816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7827 v8::Local<v8::FunctionTemplate> fun = | 7827 v8::Local<v8::FunctionTemplate> fun = |
7828 v8::FunctionTemplate::New(isolate, TryCatchWrappedThrowCallback); | 7828 v8::FunctionTemplate::New(isolate, TryCatchWrappedThrowCallback); |
7829 CHECK(env->Global() | 7829 CHECK(env->Global() |
7830 ->Set(context, v8_str("fun"), | 7830 ->Set(context, v8_str("fun"), |
7831 fun->GetFunction(context).ToLocalChecked()) | 7831 fun->GetFunction(context).ToLocalChecked()) |
7832 .FromJust()); | 7832 .FromJust()); |
7833 | 7833 |
7834 CompileRun("var p = new Promise(function(res, rej) { fun(); res(); });"); | 7834 CompileRun("var p = new Promise(function(res, rej) { fun(); res(); });"); |
7835 CompileRun( | 7835 CompileRun( |
7836 "var r;" | 7836 "var r;" |
7837 "p.chain(function() { r = 'resolved'; }," | 7837 "p.then(function() { r = 'resolved'; }," |
7838 " function() { r = 'rejected'; });"); | 7838 " function() { r = 'rejected'; });"); |
7839 CHECK(CompileRun("r")->Equals(context, v8_str("resolved")).FromJust()); | 7839 CHECK(CompileRun("r")->Equals(context, v8_str("resolved")).FromJust()); |
7840 } | 7840 } |
7841 | 7841 |
7842 | 7842 |
7843 static int exception_event_counter = 0; | 7843 static int exception_event_counter = 0; |
7844 | 7844 |
7845 | 7845 |
7846 static void DebugEventCountException( | 7846 static void DebugEventCountException( |
7847 const v8::Debug::EventDetails& event_details) { | 7847 const v8::Debug::EventDetails& event_details) { |
7848 v8::DebugEvent event = event_details.GetEvent(); | 7848 v8::DebugEvent event = event_details.GetEvent(); |
(...skipping 18 matching lines...) Expand all Loading... |
7867 v8::Local<v8::FunctionTemplate> fun = | 7867 v8::Local<v8::FunctionTemplate> fun = |
7868 v8::FunctionTemplate::New(isolate, ThrowCallback); | 7868 v8::FunctionTemplate::New(isolate, ThrowCallback); |
7869 CHECK(env->Global() | 7869 CHECK(env->Global() |
7870 ->Set(context, v8_str("fun"), | 7870 ->Set(context, v8_str("fun"), |
7871 fun->GetFunction(context).ToLocalChecked()) | 7871 fun->GetFunction(context).ToLocalChecked()) |
7872 .FromJust()); | 7872 .FromJust()); |
7873 | 7873 |
7874 CompileRun("var p = new Promise(function(res, rej) { fun(); res(); });"); | 7874 CompileRun("var p = new Promise(function(res, rej) { fun(); res(); });"); |
7875 CompileRun( | 7875 CompileRun( |
7876 "var r;" | 7876 "var r;" |
7877 "p.chain(function() { r = 'resolved'; }," | 7877 "p.then(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 static void DebugHarmonyScopingListener( | 7885 static void DebugHarmonyScopingListener( |
7886 const v8::Debug::EventDetails& event_details) { | 7886 const v8::Debug::EventDetails& event_details) { |
7887 v8::DebugEvent event = event_details.GetEvent(); | 7887 v8::DebugEvent event = event_details.GetEvent(); |
7888 if (event != v8::Break) return; | 7888 if (event != v8::Break) return; |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8180 "function foo() {\n" | 8180 "function foo() {\n" |
8181 " try { throw new Error(); } catch (e) {}\n" | 8181 " try { throw new Error(); } catch (e) {}\n" |
8182 "}\n" | 8182 "}\n" |
8183 "debugger;\n" | 8183 "debugger;\n" |
8184 "foo();\n" | 8184 "foo();\n" |
8185 "foo();\n"); | 8185 "foo();\n"); |
8186 | 8186 |
8187 v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); | 8187 v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); |
8188 CHECK_EQ(break_point_hit_count, 4); | 8188 CHECK_EQ(break_point_hit_count, 4); |
8189 } | 8189 } |
OLD | NEW |