tor-browser

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

browser_bug1018066_resetScrollPosition.js (963B)


      1 /* Any copyright is dedicated to the Public Domain.
      2 * http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 var originalWindowHeight;
      5 registerCleanupFunction(function () {
      6  window.resizeTo(window.outerWidth, originalWindowHeight);
      7  while (gBrowser.tabs[1]) {
      8    gBrowser.removeTab(gBrowser.tabs[1]);
      9  }
     10 });
     11 
     12 add_task(async function () {
     13  originalWindowHeight = window.outerHeight;
     14  window.resizeTo(window.outerWidth, 300);
     15  let prefs = await openPreferencesViaOpenPreferencesAPI("paneSearch", {
     16    leaveOpen: true,
     17  });
     18  is(prefs.selectedPane, "paneSearch", "Search pane was selected");
     19  let mainContent = gBrowser.contentDocument.querySelector(".main-content");
     20  mainContent.scrollTop = 50;
     21  is(mainContent.scrollTop, 50, "main-content should be scrolled 50 pixels");
     22 
     23  await gBrowser.contentWindow.gotoPref("paneGeneral");
     24 
     25  is(
     26    mainContent.scrollTop,
     27    0,
     28    "Switching to a different category should reset the scroll position"
     29  );
     30 });