Index: LayoutTests/inspector/console/console-uncaught-promise.html |
diff --git a/LayoutTests/inspector/console/console-uncaught-promise.html b/LayoutTests/inspector/console/console-uncaught-promise.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..3a5c6983f8c9a5ba4dd67fe1ad8b03cda366999e |
--- /dev/null |
+++ b/LayoutTests/inspector/console/console-uncaught-promise.html |
@@ -0,0 +1,73 @@ |
+<html> |
+<head> |
+<script src="../../http/tests/inspector/inspector-test.js"></script> |
+<script src="../../http/tests/inspector/console-test.js"></script> |
+<script> |
+ |
+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 onload() |
+{ |
+ runPromises("onload"); |
+ runTest(); |
+} |
+ |
+function test() |
+{ |
+ InspectorTest.addConsoleViewSniffer(addMessage, true); |
+ |
+ WebInspector.console.showPromise().then(function() { |
+ InspectorTest.evaluateInPage("runPromises('inspector')"); |
+ }); |
+ |
+ var count = 0; |
+ function addMessage(uiMessage) |
+ { |
+ if (uiMessage.toString().indexOf("inspector.err") !== -1) |
+ ++count; |
+ if (count === 2) |
+ InspectorTest.expandConsoleMessages(dump); |
+ } |
+ |
+ function dump() |
+ { |
+ // Sort console messages from async Promises to avoid flakiness. |
+ var results = InspectorTest.dumpConsoleMessagesIntoArray(false, false, InspectorTest.textContentWithLineBreaks); |
+ results.sort(); |
+ InspectorTest.addResults(results); |
+ InspectorTest.completeTest(); |
+ } |
+ |
+} |
+ |
+</script> |
+</head> |
+ |
+<body onload="onload()"> |
+<p> |
+Tests that uncaught promise rejections are logged into console. |
+</p> |
+ |
+</body> |
+</html> |