Crash at WebCore::Document::absoluteRegionForEventTargets
[WebKit-https.git] / LayoutTests / fast / events / wheelevent-in-reattached-frame.html
1 <!DOCTYPE html>
2
3 <html>
4 <head>
5     <style>
6     </style>
7     <script src="../../resources/js-test-pre.js"></script>
8     <script>
9     </script>
10 </head>
11 <body>
12
13     <script>
14     if (window.testRunner)
15         testRunner.waitUntilDone();
16
17     description("Tests that detaching and reattaching a frame with a wheel event handlers doesn't crash.");
18     
19     const maxLoads = 10;
20     var loadCount = 0;
21
22     var frame;
23     function makeFrame()
24     {
25         frame = document.createElement('iframe');
26         frame.addEventListener('load', function() {
27             if (window.internals)
28                 shouldBe("internals.wheelEventHandlerCount()", "0");
29
30             frame.remove();
31             window.setTimeout(checkFrameRemoved, 0);
32         });
33
34         frame.src = 'resources/wheel-event-handlers-dynamic.html';
35         addFrameToDocument(frame);
36     }
37     
38     function checkFrameRemoved()
39     {
40         gc();
41
42         if (window.internals)
43             shouldBe("internals.wheelEventHandlerCount()", "0");
44
45         if (++loadCount == maxLoads) {
46             isSuccessfullyParsed();
47             if (window.testRunner)
48                 testRunner.notifyDone();
49
50             return;
51         }
52
53         window.setTimeout(function() {
54             addFrameToDocument(frame);
55         }, 0);
56     }
57
58     function addFrameToDocument(frame)
59     {
60         document.body.appendChild(frame);
61     }
62     
63     makeFrame();
64     </script>
65 </body>
66 </html>