Avoid crashes on GCC-compiled binaries by avoiding a use-after-move
[WebKit-https.git] / LayoutTests / fast / events / wheelevent-in-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 a frame with a wheel event handlers doesn't crash.");
18     
19     const maxLoads = 10;
20     var loadCount = 0;
21
22     function makeFrame()
23     {
24         var frame = document.createElement('iframe');
25         frame.addEventListener('load', function() {
26             if (window.internals)
27                 shouldBe("internals.wheelEventHandlerCount()", "0");
28
29             frame.remove();
30             window.setTimeout(checkFrameRemoved, 0);
31         });
32
33         frame.src = 'resources/wheel-event-handler-on-document.html';
34         addFrameToDocument(frame);
35     }
36     
37     function checkFrameRemoved()
38     {
39         gc();
40
41         if (window.internals)
42             shouldBe("internals.wheelEventHandlerCount()", "0");
43
44         if (++loadCount == maxLoads) {
45             isSuccessfullyParsed();
46             if (window.testRunner)
47                 testRunner.notifyDone();
48
49             return;
50         }
51
52         window.setTimeout(makeFrame, 0);
53     }
54
55     function addFrameToDocument(frame)
56     {
57         document.body.appendChild(frame);
58     }
59     
60     makeFrame();
61     </script>
62 </body>
63 </html>