OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <body> | 3 <body> |
4 <script src="../../../resources/js-test.js"></script> | 4 <script src="../../../resources/js-test.js"></script> |
5 <iframe id="childFrame" src="./resources/shadow-tree-listener-clearance-frame.ht
ml"></iframe> | 5 <iframe id="childFrame" src="./resources/shadow-tree-listener-clearance-frame.ht
ml"></iframe> |
6 <script> | 6 <script> |
7 | 7 |
8 var child = document.getElementById("childFrame"); | 8 var child = document.getElementById("childFrame"); |
9 var firedCount = 0; | 9 var firedCount = 0; |
10 | 10 |
11 function getChildTarget() | 11 function getChildTarget() |
12 { | 12 { |
13 return child.contentDocument.targetInShadow; | 13 return child.contentDocument.targetInShadow; |
14 } | 14 } |
15 | 15 |
16 function test() | 16 function test() |
17 { | 17 { |
18 var toBeListened = getChildTarget(); | 18 var toBeListened = getChildTarget(); |
19 toBeListened.addEventListener("test", function(event) { firedCount++; }); | 19 toBeListened.addEventListener("test", function(event) { firedCount++; }); |
20 | 20 |
21 toBeListened.dispatchEvent(new CustomEvent("test")); | 21 toBeListened.dispatchEvent(new CustomEvent("test")); |
22 shouldBe("firedCount", "1"); | 22 shouldBe("firedCount", "1"); |
23 | 23 |
24 window.child.contentDocument.open(); // This should clear event listeners | 24 window.child.contentDocument.open(); // This should clear event listeners |
25 toBeListened.dispatchEvent(new CustomEvent("test")); | 25 toBeListened.dispatchEvent(new CustomEvent("test")); |
26 shouldBe("firedCount", "1"); | 26 shouldBe("firedCount", "1"); |
| 27 window.child.contentDocument.close(); |
27 | 28 |
28 finishJSTest(); | 29 finishJSTest(); |
29 } | 30 } |
30 | 31 |
31 jsTestIsAsync = true; | 32 jsTestIsAsync = true; |
32 child.addEventListener("load", test); | 33 child.addEventListener("load", test); |
33 | 34 |
34 </script> | 35 </script> |
35 </body> | 36 </body> |
36 </html> | 37 </html> |
OLD | NEW |