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

Unified Diff: LayoutTests/inspector-enabled/console/console-uncaught-promise-no-inspector.html

Issue 693183002: Show correct location of unhandled promise rejection messages when DevTools closed. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
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 side-by-side diff with in-line comments
Download patch
Index: LayoutTests/inspector-enabled/console/console-uncaught-promise-no-inspector.html
diff --git a/LayoutTests/inspector/console/console-uncaught-promise.html b/LayoutTests/inspector-enabled/console/console-uncaught-promise-no-inspector.html
similarity index 57%
copy from LayoutTests/inspector/console/console-uncaught-promise.html
copy to LayoutTests/inspector-enabled/console/console-uncaught-promise-no-inspector.html
index 5f3af25880706a28e5f177bfb58470771d8aa4df..503547331201cfbb4b37b78178d46d3b4142c830 100644
--- a/LayoutTests/inspector/console/console-uncaught-promise.html
+++ b/LayoutTests/inspector-enabled/console/console-uncaught-promise-no-inspector.html
@@ -4,31 +4,14 @@
<script src="../../http/tests/inspector/console-test.js"></script>
<script>
-var tested = 0;
-function runNextPromiseTest()
-{
- ++tested;
- var name = "promiseTest" + tested;
- if (typeof window[name] !== "function")
- return false;
- // setTimeout to cut off VM call frames from the stack trace.
- setTimeout(function timeout() {
- window[name].call(window);
- }, 0);
- return true;
-}
-
-function promiseTest1()
+function createRejectedPromises()
{
Promise.reject(new Error("err1"))
.then()
.then()
.then(); // Last is unhandled.
-}
-function promiseTest2()
-{
- var reject
+ var reject;
var m0 = new Promise(function(res, rej) { reject = rej; });
var m1 = m0.then(function() {});
var m2 = m0.then(function() {});
@@ -38,13 +21,14 @@ function promiseTest2()
m2.catch(function() {
m1.catch(function() {
m4 = m3.then(function() {}); // Unhandled.
+ setTimeout(rejectWithDOMException, 0);
});
});
});
reject(new Error("err2"));
}
-function promiseTest3()
+function rejectWithDOMException()
{
var reject;
var p = new Promise(function(res, rej) {
@@ -57,31 +41,34 @@ function promiseTest3()
function throwDOMException()
{
+ setTimeout(showWebInspector, 0);
var a = document.createElement("div");
var b = document.createElement("div");
a.removeChild(b);
}
}
-function test()
+function onload()
{
- InspectorTest.addConsoleViewSniffer(checkConsoleMessages, true);
- WebInspector.console.showPromise().done();
-
- checkConsoleMessages();
+ if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+ }
+ createRejectedPromises();
+}
- function checkConsoleMessages()
- {
- InspectorTest.evaluateInPage("runNextPromiseTest()", callback);
+function showWebInspector()
+{
+ if (window.testRunner)
+ testRunner.showWebInspector();
+ runTest();
+}
- function callback(result)
- {
- if (!result.value)
- InspectorTest.expandConsoleMessages(dump);
- }
- }
+var test = function()
yurys 2014/11/10 12:40:10 function test() ?
aandrey 2014/11/10 13:17:26 Done.
+{
+ InspectorTest.expandConsoleMessages(onExpanded);
- function dump()
+ function onExpanded()
{
InspectorTest.dumpConsoleMessages(false, false, InspectorTest.textContentWithLineBreaks);
InspectorTest.completeTest();
@@ -91,9 +78,9 @@ function test()
</script>
</head>
-<body onload="runTest()">
+<body onload="onload()">
<p>
-Tests that uncaught promise rejections are logged into console.
+Tests that uncaught promise rejection messages have line numbers when the inspector is closed and stack traces are not collected.
</p>
</body>

Powered by Google App Engine
This is Rietveld 408576698