tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_bug469613.xhtml (2884B)


      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">
      9 
     10  <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
     11  <script 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>
     14 
     15  <p id="display"></p>
     16 <div id="content" style="display: none">
     17 </div>
     18 </body>
     19 
     20 <vbox style="height: 100px; overflow: auto;" id="scrollbox">
     21  <hbox style="min-height: 200px;"/>
     22 </vbox>
     23 
     24 <script class="testbody" type="application/javascript"><![CDATA[
     25 
     26 /** Test for Bug 469613 */
     27 
     28 function doTest() {
     29  let scrollbox = document.getElementById("scrollbox");
     30  scrollbox.scrollTop = 0;
     31 
     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" });
     36 
     37  // Now scroll 10px down.
     38  synthesizeWheel(scrollbox, 10, 10, { deltaY: 10.0, deltaMode: WheelEvent.DOM_DELTA_PIXEL });
     39 
     40  // Send a 0-delta scroll.
     41  synthesizeWheel(scrollbox, 10, 10, { deltaY: 0.0, deltaMode: WheelEvent.DOM_DELTA_PIXEL });
     42 
     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.");
     47 
     48    // Second test
     49    scrollbox.scrollTop = 20;
     50 
     51    // Start an async scroll to 30.
     52    synthesizeWheel(scrollbox, 10, 10, { deltaY: 10.0, deltaMode: WheelEvent.DOM_DELTA_PIXEL });
     53 
     54    // Start a sync scroll to 30.
     55    scrollbox.scrollTop = 30;
     56 
     57    is(scrollbox.scrollTop, 30, "Setting scrollTop should have immediate effect, even if there was a pending async scroll to the same position.");
     58 
     59 
     60    // Third test
     61    scrollbox.scrollTop = 40;
     62 
     63    // Start an async scroll to 50.
     64    synthesizeWheel(scrollbox, 10, 10, { deltaY: 10.0, deltaMode: WheelEvent.DOM_DELTA_PIXEL });
     65 
     66    // Cancel the async scroll.
     67    scrollbox.scrollTop = 40;
     68 
     69    // Send a 0-delta scroll.
     70    synthesizeWheel(scrollbox, 10, 10, { deltaY: 0.0, deltaMode: WheelEvent.DOM_DELTA_PIXEL });
     71 
     72    setTimeout(function() {
     73      is(scrollbox.scrollTop, 40, "Canceling an async scroll should reset the point of reference for relative scrolls (mDestinationX/Y).");
     74 
     75      SimpleTest.finish();
     76    }, 0);
     77  }, 0);
     78 }
     79 
     80 SimpleTest.waitForExplicitFinish();
     81 addLoadEvent(() => setTimeout(doTest, 0));
     82 
     83 ]]></script>
     84 
     85 </window>