test_suppressed_events_and_scrolling.html (1399B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>Test event suppression and scrolling</title> 6 <script src="/tests/SimpleTest/SimpleTest.js"></script> 7 <link rel="stylesheet" href="/tests/SimpleTest/test.css"/> 8 <script> 9 SimpleTest.waitForExplicitFinish(); 10 11 function run() { 12 let testWin = window.open("file_suppressed_events_and_scrolling.html"); 13 // The order of xhrDone and didScroll is random. 14 let xhrDone = false; 15 let didScroll = false; 16 window.onmessage = function(e) { 17 let iframeWindow = testWin.document.body.firstChild.contentWindow; 18 info(e.data); 19 if (e.data == "doscroll") { 20 iframeWindow.scrollTo(0, 1500); 21 } else if (e.data == "xhr_done") { 22 xhrDone = true; 23 if (didScroll) { 24 iframeWindow.scrollTo(0, 3000); 25 } 26 } else if (e.data == "didscroll") { 27 if (didScroll && xhrDone) { 28 // We got the second scroll event. 29 ok(true, "Should have got two scroll events"); 30 testWin.close(); 31 SimpleTest.finish(); 32 } 33 didScroll = true; 34 if (xhrDone) { 35 iframeWindow.scrollTo(0, 3000); 36 } 37 } 38 } 39 } 40 </script> 41 </head> 42 <body onload="run()"> 43 <p id="display"></p> 44 <div id="content" style="display: none"></div> 45 <pre id="test"></pre> 46 </body> 47 </html>