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

Unified Diff: LayoutTests/inspector/sources/debugger/debugger-uncaught-promise-on-pause.html

Issue 625943002: Catch uncaught promise rejections from V8 and log to console. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: added promise.catch in test-helpers.js Created 6 years, 2 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: LayoutTests/inspector/sources/debugger/debugger-uncaught-promise-on-pause.html
diff --git a/LayoutTests/inspector/sources/debugger/debugger-uncaught-promise-on-pause.html b/LayoutTests/inspector/sources/debugger/debugger-uncaught-promise-on-pause.html
new file mode 100644
index 0000000000000000000000000000000000000000..a7420df5dbf95a89a4c56d5ef8425c9fd9399d3d
--- /dev/null
+++ b/LayoutTests/inspector/sources/debugger/debugger-uncaught-promise-on-pause.html
@@ -0,0 +1,83 @@
+<html>
+<head>
+<script src="../../../http/tests/inspector/inspector-test.js"></script>
+<script src="../../../http/tests/inspector/console-test.js"></script>
+<script src="../../../http/tests/inspector/debugger-test.js"></script>
+<script>
+
+function testFunction()
+{
+ console.clear();
+ debugger;
+}
+
+function runPromises(source)
+{
+ Promise.reject(new Error(source + ".err1"))
+ .then()
+ .then()
+ .then(); // Last is unhandled.
+
+ var reject
+ var m0 = new Promise(function(res, rej) { reject = rej; });
+ var m1 = m0.then(function() {});
+ var m2 = m0.then(function() {});
+ var m3 = m0.then(function() {});
+ var m4 = 0;
+ m0.catch(function() {
+ m2.catch(function() {
+ m1.catch(function() {
+ m4 = m3.then(function() {}); // Unhandled.
+ });
+ });
+ });
+ reject(new Error(source + ".err2"));
+}
+
+function test()
+{
+ InspectorTest.setQuiet(true);
+ InspectorTest.startDebuggerTest(step1);
+
+ function step1()
+ {
+ InspectorTest.addConsoleViewSniffer(addMessage, true);
+ InspectorTest.runTestFunctionAndWaitUntilPaused(didPause);
+ }
+
+ function didPause(callFrames, reason, breakpointIds, asyncStackTrace)
+ {
+ InspectorTest.evaluateInPage("runPromises('inspector')", resumeExecution);
+ }
+
+ function resumeExecution()
+ {
+ InspectorTest.resumeExecution();
+ }
+
+ var count = 0;
+ function addMessage(uiMessage)
+ {
+ if (uiMessage.toString().indexOf("inspector.err") !== -1)
+ ++count;
+ if (count === 2)
+ InspectorTest.expandConsoleMessages(dump);
+ }
+
+ function dump()
+ {
+ InspectorTest.dumpConsoleMessages(false, false, InspectorTest.textContentWithLineBreaks);
+ InspectorTest.completeTest();
+ }
+}
+
+</script>
+</head>
+
+<body onload="runTest()">
+<p>
+Tests uncaught promise rejections fired during pause.
+</p>
+
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698