tor-browser

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

test_browserGlue_migration_places_xulstore.js (1391B)


      1 /* Any copyright is dedicated to the Public Domain.
      2 http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 const TOPIC_BROWSERGLUE_TEST = "browser-glue-test";
      7 const TOPICDATA_BROWSERGLUE_TEST = "force-ui-migration";
      8 const UI_VERSION = 120;
      9 
     10 const { AppConstants } = ChromeUtils.importESModule(
     11  "resource://gre/modules/AppConstants.sys.mjs"
     12 );
     13 const { PlacesUIUtils } = ChromeUtils.importESModule(
     14  "moz-src:///browser/components/places/PlacesUIUtils.sys.mjs"
     15 );
     16 
     17 add_task(async function has_not_used_ctrl_tab_and_its_off() {
     18  const gBrowserGlue = Cc["@mozilla.org/browser/browserglue;1"].getService(
     19    Ci.nsIObserver
     20  );
     21  registerCleanupFunction(() => {
     22    Services.prefs.clearUserPref("browser.migration.version");
     23  });
     24  Services.prefs.setIntPref("browser.migration.version", UI_VERSION);
     25 
     26  Services.xulStore.setValue(
     27    AppConstants.BROWSER_CHROME_URL,
     28    "place:test",
     29    "open",
     30    "true"
     31  );
     32 
     33  // Simulate a migration.
     34  gBrowserGlue.observe(
     35    null,
     36    TOPIC_BROWSERGLUE_TEST,
     37    TOPICDATA_BROWSERGLUE_TEST
     38  );
     39 
     40  Assert.equal(
     41    Services.xulStore.getValue(
     42      AppConstants.BROWSER_CHROME_URL,
     43      PlacesUIUtils.obfuscateUrlForXulStore("place:test"),
     44      "open"
     45    ),
     46    "true"
     47  );
     48 
     49  Assert.greater(
     50    Services.prefs.getIntPref("browser.migration.version"),
     51    UI_VERSION,
     52    "Check migration version has been bumped up"
     53  );
     54 });