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

Unified Diff: test/mjsunit/es6/debug-promises/throw-uncaught-uncaught.js

Issue 440773004: Trigger exception debug events on Promise reject. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: comments Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: test/mjsunit/es6/debug-promises/throw-uncaught-uncaught.js
diff --git a/test/mjsunit/es6/debug-promises-uncaught-uncaught.js b/test/mjsunit/es6/debug-promises/throw-uncaught-uncaught.js
similarity index 65%
rename from test/mjsunit/es6/debug-promises-uncaught-uncaught.js
rename to test/mjsunit/es6/debug-promises/throw-uncaught-uncaught.js
index d79f1ceb544e333228a84d3afe845b5f42ad8fc2..45e7e0db849a198008bb000a37b2e3037f57ddc7 100644
--- a/test/mjsunit/es6/debug-promises-uncaught-uncaught.js
+++ b/test/mjsunit/es6/debug-promises/throw-uncaught-uncaught.js
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Flags: --expose-debug-as debug
+// Flags: --expose-debug-as debug --allow-natives-syntax
// Test debug events when we only listen to uncaught exceptions and
// there is a catch handler for the exception thrown in a Promise.
@@ -10,8 +10,8 @@
Debug = debug.Debug;
+var expected_events = 1;
var log = [];
-var step = 0;
var p = new Promise(function(resolve, reject) {
log.push("resolve");
@@ -27,25 +27,18 @@ var q = p.chain(
function listener(event, exec_state, event_data, data) {
if (event == Debug.DebugEvent.AsyncTaskEvent) return;
try {
- // Ignore exceptions during startup in stress runs.
- if (step >= 1) return;
- assertEquals(["resolve", "end main", "throw"], log);
if (event == Debug.DebugEvent.Exception) {
- assertEquals(0, step);
+ expected_events--;
+ assertTrue(expected_events >= 0);
assertEquals("uncaught", event_data.exception().message);
assertTrue(event_data.promise() instanceof Promise);
assertEquals(q, event_data.promise());
assertTrue(event_data.uncaught());
// Assert that the debug event is triggered at the throw site.
assertTrue(exec_state.frame(0).sourceLineText().indexOf("// event") > 0);
- step++;
}
} catch (e) {
- // Signal a failure with exit code 1. This is necessary since the
- // debugger swallows exceptions and we expect the chained function
- // and this listener to be executed after the main script is finished.
- print("Unexpected exception: " + e + "\n" + e.stack);
- quit(1);
+ %AbortJS(e + "\n" + e.stack);
}
}
@@ -53,3 +46,25 @@ Debug.setBreakOnUncaughtException();
Debug.setListener(listener);
log.push("end main");
+
+function testDone(iteration) {
+ function checkResult() {
+ try {
+ assertTrue(iteration < 10);
+ if (expected_events === 0) {
+ assertEquals(["resolve", "end main", "throw"], log);
+ } else {
+ testDone(iteration + 1);
+ }
+ } catch (e) {
+ %AbortJS(e + "\n" + e.stack);
+ }
+ }
+
+ // Run testDone through the Object.observe processing loop.
+ var dummy = {};
+ Object.observe(dummy, checkResult);
+ dummy.dummy = dummy;
+}
+
+testDone(0);
« no previous file with comments | « test/mjsunit/es6/debug-promises/throw-uncaught-all.js ('k') | test/mjsunit/es6/debug-promises/throw-with-throw-in-reject.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698