3 <script src=
"../../http/tests/inspector/inspector-test.js"></script>
4 <script src=
"../../http/tests/inspector/console-test.js"></script>
9 function createPromise()
11 worker
= new Worker("resources/worker-with-defer-handled-promise.js");
14 function handlePromiseRejection()
16 worker
.postMessage("");
21 WebInspector
.multitargetConsoleModel
.addEventListener(WebInspector
.ConsoleModel
.Events
.MessageAdded
, messageAdded
);
22 WebInspector
.multitargetConsoleModel
.addEventListener(WebInspector
.ConsoleModel
.Events
.MessageUpdated
, messageUpdated
);
24 InspectorTest
.addResult("Creating worker with promise");
25 InspectorTest
.evaluateInPageWithTimeout("createPromise()");
27 function messageAdded(event
)
29 InspectorTest
.addResult("");
30 InspectorTest
.addResult("Message added: " + event
.data
.level
+ " " + event
.data
.type
);
31 var counter
= WebInspector
.Main
.WarningErrorCounter
._instanceForTest
;
32 for (var counter
of counter
._counters
)
33 InspectorTest
.addResult(" " + counter
.title
);
35 if (event
.data
.level
=== WebInspector
.ConsoleMessage
.MessageLevel
.Error
) {
36 InspectorTest
.dumpConsoleClassesBrief();
37 InspectorTest
.addResult("");
38 InspectorTest
.addResult("Handling promise");
39 InspectorTest
.evaluateInPageWithTimeout("handlePromiseRejection()");
43 function messageUpdated()
45 InspectorTest
.dumpConsoleClassesBrief();
46 InspectorTest
.completeTest();
53 <body onload=
"runTest()">
54 <p>Tests that console revokes lazily handled promise rejections.
</p>