3 <script src=
"../../http/tests/inspector/inspector-test.js"></script>
4 <script src=
"../../http/tests/inspector/console-test.js"></script>
9 function createPromises()
11 for (var i
= 0; i
< 3; ++i
)
12 p
.push(Promise
.reject(new Error("Handled error")));
15 function handleSomeRejections()
17 p
[0].catch(function() {});
18 p
[2].catch(function() {});
23 InspectorTest
.consoleModel
.addEventListener(WebInspector
.ConsoleModel
.Events
.MessageAdded
, messageAdded
);
25 InspectorTest
.addResult("Creating promise");
26 InspectorTest
.evaluateInPageWithTimeout("createPromises()");
28 var messageNumber
= 0;
29 function messageAdded(event
)
31 InspectorTest
.addResult("Message added: " + event
.data
.level
+ " " + event
.data
.type
);
32 if (++messageNumber
< 3)
36 InspectorTest
.consoleModel
.removeEventListener(WebInspector
.ConsoleModel
.Events
.MessageAdded
, messageAdded
);
37 InspectorTest
.addResult("");
38 InspectorTest
.addResult("errors: " + InspectorTest
.consoleModel
.errors());
39 InspectorTest
.addResult("revokedErrors: " + InspectorTest
.consoleModel
.revokedErrors());
41 // Process array as a batch.
42 InspectorTest
.consoleModel
.addEventListener(WebInspector
.ConsoleModel
.Events
.MessageUpdated
, messageUpdated
);
43 InspectorTest
.dumpConsoleClassesBrief();
44 InspectorTest
.addResult("");
45 InspectorTest
.addResult("Handling promise");
46 InspectorTest
.evaluateInPageWithTimeout("handleSomeRejections()");
49 function messageUpdated()
51 if (++messageNumber
< 2)
53 InspectorTest
.dumpConsoleClassesBrief();
54 InspectorTest
.addResult("errors: " + InspectorTest
.consoleModel
.errors());
55 InspectorTest
.addResult("revokedErrors: " + InspectorTest
.consoleModel
.revokedErrors());
56 InspectorTest
.completeTest();
63 <body onload=
"runTest()">
64 <p>Tests that console revokes lazily handled promise rejections.
</p>