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

Unified Diff: LayoutTests/inspector/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: 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/console/console-uncaught-promise-no-inspector.html
diff --git a/LayoutTests/inspector/console/console-uncaught-promise-no-inspector.html b/LayoutTests/inspector/console/console-uncaught-promise-no-inspector.html
new file mode 100644
index 0000000000000000000000000000000000000000..088440a7bbe892eb7c5216f3731dbc8f7911d2c1
--- /dev/null
+++ b/LayoutTests/inspector/console/console-uncaught-promise-no-inspector.html
@@ -0,0 +1,80 @@
+<html>
+<head>
+<script>
+
+function test()
+{
+ Promise.reject(new Error("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() {
vsevik 2014/11/07 06:26:38 { on the next line
+ m2.catch(function() {
+ m1.catch(function() {
+ m4 = m3.then(function() {}); // Unhandled.
+ setTimeout(testDOMException, 0);
+ });
+ });
+ });
+ reject(new Error("err2"));
+}
+
+function testDOMException()
+{
+ var reject;
+ var p = new Promise(function(res, rej) {
+ reject = rej;
+ });
+ p.then().catch(function catcher() {
+ throwDOMException();
+ });
+ reject(new Error("FAIL: Should not be printed to console"));
+
+ function throwDOMException()
+ {
+ notifyDone();
+ var a = document.createElement("div");
+ var b = document.createElement("div");
+ a.removeChild(b);
+ }
+}
+
+function runTest()
vsevik 2014/11/07 06:26:38 Why do you do this manually and not reuse inspecto
yurys 2014/11/07 12:49:27 I believe the intent was to run this test without
aandrey 2014/11/10 11:44:33 Done.
+{
+ if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+ }
+ try {
+ test();
+ } catch (e) {
+ notifyDone();
+ throw e;
+ }
+}
+
+function notifyDone()
+{
+ setTimeout(function() {
+ if (window.testRunner)
+ testRunner.notifyDone();
+ }, 0);
+}
+
+</script>
+</head>
+
+<body onload="runTest()">
+<p>
+Tests that uncaught promise rejection messages have line numbers when the inspector is closed and stack traces are not collected.
+</p>
+
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698