REGRESSION (r195305): Web Inspector: WebInspector.Object can dispatch constructor...
[WebKit-https.git] / LayoutTests / inspector / unit-tests / object.html
1 <!doctype html>
2 <html>
3 <head>
4 <script src="../../http/tests/inspector/resources/inspector-test.js"></script>
5 <script>
6 function test()
7 {
8     let suite = InspectorTest.createSyncSuite("Object");
9
10     suite.addTestCase({
11         name: "Events propagation",
12         description: "WebInspector.Object shouldn't dispatch constructor-level events multiple times",
13         test: function() {
14             class Parent extends WebInspector.Object {}
15             class Child extends Parent {}
16
17             const eventName = "clicked";
18             let dispatchCount = 0;
19
20             Parent.addEventListener(eventName, () => dispatchCount++);
21
22             let child = new Child;
23             child.dispatchEventToListeners(eventName);
24
25             InspectorTest.log("Dispatch count: " + dispatchCount);
26         }
27     });
28
29     suite.runTestCasesAndFinish();
30 }
31 </script>
32 </head>
33 <body onload="runTest()">
34     <p>Testing WebInspector.Object.</p>
35 </body>
36 </html>