summaryrefslogtreecommitdiff
path: root/deps/v8/test/debugger/debug/es6/debug-promises/throw-caught-uncaught.js
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/test/debugger/debug/es6/debug-promises/throw-caught-uncaught.js')
-rw-r--r--deps/v8/test/debugger/debug/es6/debug-promises/throw-caught-uncaught.js35
1 files changed, 35 insertions, 0 deletions
diff --git a/deps/v8/test/debugger/debug/es6/debug-promises/throw-caught-uncaught.js b/deps/v8/test/debugger/debug/es6/debug-promises/throw-caught-uncaught.js
new file mode 100644
index 0000000000..756c0f1301
--- /dev/null
+++ b/deps/v8/test/debugger/debug/es6/debug-promises/throw-caught-uncaught.js
@@ -0,0 +1,35 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+
+// Test debug events when we only listen to uncaught exceptions and
+// there is a catch handler for the exception thrown in a Promise.
+// We expect no debug event to be triggered.
+
+Debug = debug.Debug;
+
+var p = new Promise(function(resolve, reject) {
+ resolve();
+});
+
+var q = p.then(
+ function() {
+ throw new Error("caught throw");
+ });
+
+q.catch(
+ function(e) {
+ assertEquals("caught throw", e.message);
+ });
+
+function listener(event, exec_state, event_data, data) {
+ try {
+ assertTrue(event != Debug.DebugEvent.Exception);
+ } catch (e) {
+ %AbortJS(e + "\n" + e.stack);
+ }
+}
+
+Debug.setBreakOnUncaughtException();
+Debug.setListener(listener);