OLD | NEW |
---|---|
(Empty) | |
1 <html> | |
2 <head> | |
3 <script> | |
4 | |
5 function test() | |
6 { | |
7 Promise.reject(new Error("err1")) | |
8 .then() | |
9 .then() | |
10 .then(); // Last is unhandled. | |
11 | |
12 var reject; | |
13 var m0 = new Promise(function(res, rej) { reject = rej; }); | |
14 var m1 = m0.then(function() {}); | |
15 var m2 = m0.then(function() {}); | |
16 var m3 = m0.then(function() {}); | |
17 var m4 = 0; | |
18 m0.catch(function() { | |
vsevik
2014/11/07 06:26:38
{ on the next line
| |
19 m2.catch(function() { | |
20 m1.catch(function() { | |
21 m4 = m3.then(function() {}); // Unhandled. | |
22 setTimeout(testDOMException, 0); | |
23 }); | |
24 }); | |
25 }); | |
26 reject(new Error("err2")); | |
27 } | |
28 | |
29 function testDOMException() | |
30 { | |
31 var reject; | |
32 var p = new Promise(function(res, rej) { | |
33 reject = rej; | |
34 }); | |
35 p.then().catch(function catcher() { | |
36 throwDOMException(); | |
37 }); | |
38 reject(new Error("FAIL: Should not be printed to console")); | |
39 | |
40 function throwDOMException() | |
41 { | |
42 notifyDone(); | |
43 var a = document.createElement("div"); | |
44 var b = document.createElement("div"); | |
45 a.removeChild(b); | |
46 } | |
47 } | |
48 | |
49 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.
| |
50 { | |
51 if (window.testRunner) { | |
52 testRunner.dumpAsText(); | |
53 testRunner.waitUntilDone(); | |
54 } | |
55 try { | |
56 test(); | |
57 } catch (e) { | |
58 notifyDone(); | |
59 throw e; | |
60 } | |
61 } | |
62 | |
63 function notifyDone() | |
64 { | |
65 setTimeout(function() { | |
66 if (window.testRunner) | |
67 testRunner.notifyDone(); | |
68 }, 0); | |
69 } | |
70 | |
71 </script> | |
72 </head> | |
73 | |
74 <body onload="runTest()"> | |
75 <p> | |
76 Tests that uncaught promise rejection messages have line numbers when the inspec tor is closed and stack traces are not collected. | |
77 </p> | |
78 | |
79 </body> | |
80 </html> | |
OLD | NEW |