4e67f0784a13eb6c50b1b7c19eadf8d0f036964e
[WebKit-https.git] / LayoutTests / fast / events / wheel-event-destroys-frame.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4     <script>
5         if (window.testRunner) {
6             testRunner.waitUntilDone();
7             testRunner.dumpAsText();
8         }
9
10         function frameLoaded(iframe)
11         {
12             iframe.contentWindow.addEventListener('wheel', function() {
13                 // Removing the window during event firing causes crash.
14                 window.document.body.removeChild(iframe);
15                 window.setTimeout(function() {
16                     if (window.testRunner)
17                         testRunner.notifyDone();
18                 }, 0);
19             });
20
21             if (!window.eventSender)
22                 return;
23
24             var iframeTarget = document.getElementById('iframe');
25             var iframeBounds = iframeTarget.getBoundingClientRect();
26
27             eventSender.mouseMoveTo(iframeBounds.left + 10, iframeBounds.top + 10);
28             eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'began', 'none');
29             eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'changed', 'none');
30             eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'changed', 'none');
31             eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 0, 'ended', 'none');
32         }
33     </script>
34 </head>
35 <body>
36     <p>This test should not crash</p>
37     <iframe id="iframe" onload="frameLoaded(this)" src="data:text/html,<body>Wheel here</body>"></iframe>
38 </body>
39 </html>