[macOS / iOS Debug] Layout Test imported/w3c/web-platform-tests/webrtc/RTCPeerConnect...
[WebKit-https.git] / LayoutTests / performance-api / performance-observer-exception.html
1 <!DOCTYPE HTML>
2 <html>
3 <head>
4 <script src="../resources/js-test-pre.js"></script>
5 </head>
6 <body>
7 <script>
8 description("Ensure PerformanceObserver Exceptions are propogated.");
9 window.jsTestIsAsync = true;
10
11 let seenExceptions = 0;
12
13 window.onerror = function(message) {
14     testPassed("onerror: " + message);
15
16     seenExceptions++;
17     if (seenExceptions === 2)
18         finishJSTest();
19 }
20
21 let observer1 = new PerformanceObserver((list) => {
22     debug("PerformanceObserver callback fired");
23     throw "EXCEPTION MESSAGE IN CALLBACK";
24 });
25
26 class MyObserver {};
27 let observer2 = new PerformanceObserver(MyObserver);
28
29 observer1.observe({entryTypes: ["mark"]});
30 observer2.observe({entryTypes: ["mark"]});
31 performance.mark("mark1");
32 </script>
33 <script src="../resources/js-test-post.js"></script>
34 </body>
35 </html>