Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 <?xml version="1.0"?>
2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
3 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
4 <!--
5 https://bugzilla.mozilla.org/show_bug.cgi?id=469613
6 -->
7 <window title="Mozilla Bug 469613"
8 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
10 <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
11 <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
12 <body xmlns="http://www.w3.org/1999/xhtml">
13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=469613">Mozilla Bug 469613</a>
15 <p id="display"></p>
16 <div id="content" style="display: none">
17 </div>
18 </body>
20 <vbox style="height: 100px; overflow: auto;" id="scrollbox">
21 <hbox style="height: 200px;"/>
22 </vbox>
24 <script class="testbody" type="application/javascript;version=1.7"><![CDATA[
26 /** Test for Bug 469613 **/
28 function doTest() {
29 let scrollbox = document.getElementById("scrollbox");
30 scrollbox.scrollTop = 0;
32 // Make sure that the "scroll focus" is inside the scrollbox by moving the
33 // mouse in the scrollbox.
34 synthesizeMouse(scrollbox, 6, 6, { type: "mousemove" });
35 synthesizeMouse(scrollbox, 8, 8, { type: "mousemove" });
37 // Now scroll 10px down.
38 synthesizeWheel(scrollbox, 10, 10, { deltaY: 10.0, deltaMode: WheelEvent.DOM_DELTA_PIXEL });
40 // Send a 0-delta scroll.
41 synthesizeWheel(scrollbox, 10, 10, { deltaY: 0.0, deltaMode: WheelEvent.DOM_DELTA_PIXEL });
43 setTimeout(function() {
44 // Check if the 10px were scrolled.
45 todo(false, "Starting a 0-delta scroll shouldn't cancel a pending async scroll is disabled, see bug 752786");
46 //is(scrollbox.scrollTop, 10, "Starting a 0-delta scroll shouldn't cancel a pending async scroll.");
48 // Second test
49 scrollbox.scrollTop = 20;
51 // Start an async scroll to 30.
52 synthesizeWheel(scrollbox, 10, 10, { deltaY: 10.0, deltaMode: WheelEvent.DOM_DELTA_PIXEL });
54 // Start a sync scroll to 30.
55 scrollbox.scrollTop = 30;
57 is(scrollbox.scrollTop, 30, "Setting scrollTop should have immediate effect, even if there was a pending async scroll to the same position.");
60 // Third test
61 scrollbox.scrollTop = 40;
63 // Start an async scroll to 50.
64 synthesizeWheel(scrollbox, 10, 10, { deltaY: 10.0, deltaMode: WheelEvent.DOM_DELTA_PIXEL });
66 // Cancel the async scroll.
67 scrollbox.scrollTop = 40;
69 // Send a 0-delta scroll.
70 synthesizeWheel(scrollbox, 10, 10, { deltaY: 0.0, deltaMode: WheelEvent.DOM_DELTA_PIXEL });
72 setTimeout(function() {
73 is(scrollbox.scrollTop, 40, "Canceling an async scroll should reset the point of reference for relative scrolls (mDestinationX/Y).");
75 SimpleTest.finish();
76 }, 0);
77 }, 0);
78 }
80 SimpleTest.waitForExplicitFinish();
81 addLoadEvent(function() setTimeout(doTest, 0));
83 ]]></script>
85 </window>