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

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

Issue 692313003: Allow uncaught exception messaging in Object.observe callbacks. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed Created 6 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « test/cctest/test-api.cc ('k') | test/cctest/test-object-observe.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 7576 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 // Break on uncaught exception
7605 ChangeBreakOnException(false, true);
7606 exception_event_counter = 0;
7607
7608 v8::Handle<v8::FunctionTemplate> fun =
7609 v8::FunctionTemplate::New(isolate, ThrowCallback);
7610 env->Global()->Set(v8_str("fun"), fun->GetFunction());
7611
7612 CompileRun(
7613 "var obj = {};"
7614 "var callbackRan = false;"
7615 "Object.observe(obj, function() {"
7616 " callbackRan = true;"
7617 " throw Error('foo');"
7618 "});"
7619 "obj.prop = 1");
7620 CHECK(CompileRun("callbackRan")->BooleanValue());
7621 CHECK_EQ(1, exception_event_counter);
7622 }
OLDNEW
« no previous file with comments | « test/cctest/test-api.cc ('k') | test/cctest/test-object-observe.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698