6f7ebb5359f38ca049f2632eab8e09e966f18c62
[WebKit-https.git] / LayoutTests / platform / mac-wk2 / tiled-drawing / scrolling / non-fast-region / destroy-element-with-multiple-handlers-crash.html
1 <!DOCTYPE html>
2
3 <html>
4 <head>
5     <style>
6         .popover {
7             position: absolute;
8             z-index: 1;
9             top: 100px;
10             left: 100px;
11             width: 300px;
12             height: 200px;
13             border: 1px solid black;
14         }
15         
16         .container {
17             position: absolute;
18             width: 100%;
19             height: 100%;
20         }
21         
22     </style>
23
24     <script src="../../../../../resources/js-test-pre.js" type="text/javascript" charset="utf-8"></script>
25     <script>
26         if (window.testRunner) {
27             testRunner.waitUntilDone();
28             testRunner.dumpAsText();
29         }
30         
31         var popover;
32         function createPopover()
33         {
34             popover = document.createElement('div');
35             popover.className = 'popover';
36             var container = document.createElement('div');
37             container.className = 'container';
38             popover.appendChild(container);
39         }
40         
41         function doTest()
42         {
43             createPopover();
44             document.body.appendChild(popover);
45             popover.addEventListener("mousewheel", function() { }, true);
46             popover.addEventListener("mousewheel", function() { }, true);
47             window.setTimeout(dismiss, 0);
48         }
49
50         var count = 0;
51         function dismiss()
52         {
53             document.body.removeChild(popover);
54             gc();
55             
56             document.getElementById('count').textContent = ++count;
57             if (count > 3) {
58                 if (window.testRunner)
59                     testRunner.notifyDone();
60                 return;
61             }
62             doTest();
63         }
64         
65         window.addEventListener('load', doTest, false);
66     </script>
67 </head>
68 <body>
69     <p>Test that elements with multiple wheel event handlers are removed from the document's event handler set when the element is destroyed. Test passes if it does not crash.</p>
70 <p>Iterations: <span id="count"></span></p>
71 </body>
72 </html>