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 7576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7587 env->Global()->Set(v8_str("fun"), fun->GetFunction()); | 7587 env->Global()->Set(v8_str("fun"), fun->GetFunction()); |
7588 | 7588 |
7589 CompileRun("var p = new Promise(function(res, rej) { fun(); res(); });"); | 7589 CompileRun("var p = new Promise(function(res, rej) { fun(); res(); });"); |
7590 CompileRun( | 7590 CompileRun( |
7591 "var r;" | 7591 "var r;" |
7592 "p.chain(function() { r = 'resolved'; }," | 7592 "p.chain(function() { r = 'resolved'; }," |
7593 " function(e) { r = 'rejected' + e; });"); | 7593 " function(e) { r = 'rejected' + e; });"); |
7594 CHECK(CompileRun("r")->Equals(v8_str("rejectedrejection"))); | 7594 CHECK(CompileRun("r")->Equals(v8_str("rejectedrejection"))); |
7595 CHECK_EQ(1, exception_event_counter); | 7595 CHECK_EQ(1, exception_event_counter); |
7596 } | 7596 } |
| 7597 |
| 7598 |
| 7599 TEST(DebugBreakOnExceptionInObserveCallback) { |
| 7600 DebugLocalContext env; |
| 7601 v8::Isolate* isolate = env->GetIsolate(); |
| 7602 v8::HandleScope scope(isolate); |
| 7603 v8::Debug::SetDebugEventListener(&DebugEventCountException); |
| 7604 ChangeBreakOnException(false, true); |
| 7605 exception_event_counter = 0; |
| 7606 |
| 7607 v8::Handle<v8::FunctionTemplate> fun = |
| 7608 v8::FunctionTemplate::New(isolate, ThrowCallback); |
| 7609 env->Global()->Set(v8_str("fun"), fun->GetFunction()); |
| 7610 |
| 7611 CompileRun( |
| 7612 "var obj = {};" |
| 7613 "var callbackRan = false;" |
| 7614 "Object.observe(obj, function() {" |
| 7615 " callbackRan = true;" |
| 7616 " throw Error('foo');" |
| 7617 "});" |
| 7618 "obj.prop = 1"); |
| 7619 CHECK(CompileRun("callbackRan")->BooleanValue()); |
| 7620 CHECK_EQ(1, exception_event_counter); |
| 7621 } |
OLD | NEW |