1<!DOCTYPE HTML> 2<script src="/resources/testharness.js"></script> 3<script src="/resources/testharnessreport.js"></script> 4<script src="/resources/testdriver.js"></script> 5<script src="/resources/testdriver-actions.js"></script> 6<script src="/resources/testdriver-vendor.js"></script> 7<script src="scroll_support.js"></script> 8<style> 9#targetDiv { 10 width: 200px; 11 height: 200px; 12 overflow: scroll; 13} 14 15#innerDiv { 16 width: 400px; 17 height: 400px; 18} 19</style> 20 21<body style="margin:0" onload=runTest()> 22<div id="targetDiv"> 23 <div id="innerDiv"> 24 </div> 25</div> 26</body> 27 28<script> 29var target_div = document.getElementById('targetDiv'); 30var window_received_overscroll = false; 31 32function onOverscroll(event) { 33 assert_false(event.cancelable); 34 // overscroll events targetting document are bubbled to the window. 35 assert_true(event.bubbles); 36 window_received_overscroll = true; 37} 38window.addEventListener("overscroll", onOverscroll); 39 40function runTest() { 41 promise_test (async (t) => { 42 // Make sure that no overscroll event is sent to target_div. 43 target_div.addEventListener("overscroll", 44 t.unreached_func("target_div got unexpected overscroll event.")); 45 // Scroll up on target div and wait for the window to get overscroll event. 46 await touchScrollInTarget(300, target_div, 'up'); 47 await waitFor(() => { return window_received_overscroll; }, 48 'Window did not receive overscroll event after scroll up on target.'); 49 }, 'Tests that the window gets overscroll event when no element scrolls' + 50 'after touch scrolling.'); 51} 52</script> 53