Set lastHandledUserGestureTimestamp on all ancestor documents, not just the top document
[WebKit-https.git] / LayoutTests / fast / frames / user-gesture-timestamp-propagation.html
1 <!DOCTYPE html>
2
3 <html>
4 <head>
5     <script src="../../resources/js-test-pre.js"></script>
6     <script>
7         description("Tests that the EventTarget API is no longer working on detached frames.");
8
9         var frame;
10         var innerFrame;
11         var innerFrame2;
12
13         function dispatchClick()
14         {
15             var x = frame.offsetLeft + frame.offsetWidth / 2;
16             var y = frame.offsetTop + frame.offsetHeight / 2;
17
18             eventSender.mouseMoveTo(x, y);
19             eventSender.mouseDown();
20             eventSender.mouseUp();
21         }
22
23         function doTest()
24         {
25             frame = document.getElementById('frame');
26             innerFrame = frame.contentWindow.document.getElementById('frame');
27             innerFrame2 = frame.contentWindow.document.getElementById('frame2');
28
29             shouldBe('internals.lastHandledUserGestureTimestamp()', '0');
30             shouldBe('frame.contentWindow.internals.lastHandledUserGestureTimestamp()', '0');
31             shouldBe('innerFrame.contentWindow.internals.lastHandledUserGestureTimestamp()', '0');
32             shouldBe('innerFrame2.contentWindow.internals.lastHandledUserGestureTimestamp()', '0');
33
34             debug('Dispatching click');
35             dispatchClick();
36
37             shouldNotBe('internals.lastHandledUserGestureTimestamp()', '0');
38             shouldNotBe('frame.contentWindow.internals.lastHandledUserGestureTimestamp()', '0');
39             shouldNotBe('innerFrame.contentWindow.internals.lastHandledUserGestureTimestamp()', '0');
40             // Should have not hit frame2
41             shouldBe('innerFrame2.contentWindow.internals.lastHandledUserGestureTimestamp()', '0');
42         }
43
44         window.addEventListener('load', doTest, false);
45     </script>
46 </head>
47 <body>
48     <iframe id="frame" srcdoc="
49         <body>
50             <iframe id='frame' srcdoc='
51                 Inner frame
52                     '>
53             </iframe>
54             <iframe id='frame2' srcdoc='
55                 Inner frame
56                     '>
57             </iframe>
58         </body>">
59     </iframe>
60     <script src="../../resources/js-test-post.js"></script>
61
62 </body>
63 </html>