2 <script src=
"../../../../resources/js-test.js"></script>
9 <iframe id=
"target" src=
"resources/event-delegator.html"></iframe>
10 <div id=console
></div>
12 var scrollbarEventType
;
14 function onEventInFrame(e
) {
15 debug("Received " + e
.type
+ " in child frame");
16 if (e
.type
== scrollbarEventType
) {
17 debug('Adding scrollbars to iframe');
18 target
.contentDocument
.body
.style
.height
= "500px";
22 function eventLogger(e
) {
23 debug("Received " + e
.type
+ " in main frame");
26 document
.addEventListener('mousemove', eventLogger
);
27 document
.addEventListener('mousedown', eventLogger
);
28 document
.addEventListener('mouseup', eventLogger
);
29 document
.addEventListener('click', eventLogger
);
31 description("Taps at a point that becomes a scrollbar (i.e. hit test with innerNode=null) during the tap and verifies we don't crash.");
33 // Tap at the right edge of the frame, where its scrollbar would live.
34 var rect
= target
.getBoundingClientRect();
37 y
: rect
.top
+ rect
.height
/ 2
42 return new Promise(function(resolve
, reject
) {
44 debug('Test case: Add scrollbars during ' + type
);
45 scrollbarEventType
= type
;
46 target
.contentDocument
.body
.style
.height
= "0";
48 debug('Test case: Tap on consistent scrollbar');
51 eventSender
.gestureTapDown(point
.x
, point
.y
);
52 eventSender
.gestureShowPress(point
.x
, point
.y
);
53 debug("Sending GestureTap");
54 eventSender
.gestureTap(point
.x
, point
.y
);
56 setTimeout(function() {
63 if (window
.eventSender
) {
66 // Some versions of MacOS native scrollbars intercept events differently, so
67 // use mock scrollbars for consistency.
68 internals
.settings
.setMockScrollbarsEnabled(true);
70 target
.onload = function() {
72 .then(function() { return doTap('mousemove'); })
73 .then(function() { return doTap('mousedown'); })
74 .then(function() { return doTap('mouseup'); })
75 .catch(function(err
) {
76 testFailed("Promise rejected: " + err
.message
);
77 }).then(finishJSTest
);
80 debug("This test requires eventSender");