Backed out changeset 0637dca8a971 (bug 1410736) for eslint failure at toolkit/components/extensions/test/xpcshell/test_ext_i18n_css.js:130: Unexpected var, use let or const instead. r=backout on a CLOSED TREE
authorSebastian Hengst <archaeopteryx@coole-files.de>
Sat, 04 Nov 2017 00:51:02 +0100
changeset 443409 fd9b6dde9feeec0c4b8406e1ea5920647878824d
parent 443408 0de94b56338e29e469b762fe9e98f2b6e7b99c49
child 443410 272831b3dc4093667c06e166612d72b28e2133ef
push id1618
push userCallek@gmail.com
push dateThu, 11 Jan 2018 17:45:48 +0000
treeherdermozilla-release@882ca853e05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs1410736
milestone58.0a1
backs out0637dca8a9718ca67b57fc879c8be0f22658452b
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset 0637dca8a971 (bug 1410736) for eslint failure at toolkit/components/extensions/test/xpcshell/test_ext_i18n_css.js:130: Unexpected var, use let or const instead. r=backout on a CLOSED TREE
browser/components/search/test/browser_google_codes.js
browser/components/search/test/browser_google_nocodes.js
chrome/test/unit/test_bug848297.js
dom/animation/test/chrome/test_animation_performance_warning.html
toolkit/components/extensions/test/xpcshell/test_ext_i18n.js
toolkit/components/extensions/test/xpcshell/test_ext_i18n_css.js
toolkit/components/extensions/test/xpcshell/test_ext_startup_cache.js
toolkit/components/reputationservice/test/unit/test_app_rep_maclinux.js
toolkit/components/reputationservice/test/unit/test_app_rep_windows.js
toolkit/components/search/nsSearchService.js
toolkit/components/search/tests/xpcshell/head_search.js
toolkit/mozapps/extensions/test/xpcshell/test_bug335238.js
toolkit/mozapps/extensions/test/xpcshell/test_bug397778.js
toolkit/mozapps/extensions/test/xpcshell/test_bug430120.js
toolkit/mozapps/extensions/test/xpcshell/test_locale.js
toolkit/mozapps/extensions/test/xpcshell/test_update.js
toolkit/mozapps/extensions/test/xpcshell/test_update_strictcompat.js
toolkit/mozapps/extensions/test/xpcshell/test_webextension.js
--- a/browser/components/search/test/browser_google_codes.js
+++ b/browser/components/search/test/browser_google_codes.js
@@ -50,22 +50,24 @@ function asyncInit() {
     Services.search.init(function() {
       ok(Services.search.isInitialized, "search service should be initialized");
       resolve();
     });
   });
 }
 
 function asyncReInit() {
+  const kLocalePref = "general.useragent.locale";
+
   let promise = new Promise(resolve => {
     waitForSearchNotification("reinit-complete", resolve);
   });
 
   Services.search.QueryInterface(Ci.nsIObserver)
-          .observe(null, "intl:requested-locales-changed", null);
+          .observe(null, "nsPref:changed", kLocalePref);
 
   return promise;
 }
 
 let gEngineCount;
 
 add_task(async function preparation() {
   // ContentSearch is interferring with our async re-initializations of the
--- a/browser/components/search/test/browser_google_nocodes.js
+++ b/browser/components/search/test/browser_google_nocodes.js
@@ -50,22 +50,24 @@ function asyncInit() {
     Services.search.init(function() {
       ok(Services.search.isInitialized, "search service should be initialized");
       resolve();
     });
   });
 }
 
 function asyncReInit() {
+  const kLocalePref = "general.useragent.locale";
+
   let promise = new Promise(resolve => {
     waitForSearchNotification("reinit-complete", resolve);
   });
 
   Services.search.QueryInterface(Ci.nsIObserver)
-          .observe(null, "intl:requested-locales-changed", null);
+          .observe(null, "nsPref:changed", kLocalePref);
 
   return promise;
 }
 
 let gEngineCount;
 
 add_task(async function preparation() {
   // ContentSearch is interferring with our async re-initializations of the
--- a/chrome/test/unit/test_bug848297.js
+++ b/chrome/test/unit/test_bug848297.js
@@ -4,17 +4,16 @@
  */
 
 var MANIFESTS = [
   do_get_file("data/test_bug848297.manifest")
 ];
 
 // Stub in the locale service so we can control what gets returned as the OS locale setting
 Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
-Components.utils.import("resource://gre/modules/Services.jsm");
 
 registerManifests(MANIFESTS);
 
 var chromeReg = Cc["@mozilla.org/chrome/chrome-registry;1"]
                 .getService(Ci.nsIXULChromeRegistry)
                 .QueryInterface(Ci.nsIToolkitChromeRegistry);
 chromeReg.checkForNewChrome();
 
@@ -29,17 +28,17 @@ function enum_to_array(strings) {
   }
   rv.sort();
   return rv;
 }
 
 function run_test() {
 
   // without override
-  Services.locale.setRequestedLocales(["de"]);
+  prefService.setCharPref("general.useragent.locale", "de");
   do_check_eq(chromeReg.getSelectedLocale("basepack"), "en-US");
   do_check_eq(chromeReg.getSelectedLocale("overpack"), "de");
   do_check_matches(enum_to_array(chromeReg.getLocalesForPackage("basepack")),
                    ["en-US", "fr"]);
 
   // with override
   prefService.setCharPref("chrome.override_package.basepack", "overpack");
   do_check_eq(chromeReg.getSelectedLocale("basepack"), "de");
--- a/dom/animation/test/chrome/test_animation_performance_warning.html
+++ b/dom/animation/test/chrome/test_animation_performance_warning.html
@@ -26,20 +26,18 @@
 <script>
 'use strict';
 
 // This is used for obtaining localized strings.
 var gStringBundle;
 
 W3CTest.runner.requestLongerTimeout(2);
 
-const { Services } = SpecialPowers.Cu.import("resource://gre/modules/Services.jsm");
-Services.locale.setRequestedLocales(["en-US"]);
-
 SpecialPowers.pushPrefEnv({ "set": [
+                            ["general.useragent.locale", "en-US"],
                             // Need to set devPixelsPerPx explicitly to gain
                             // consistent pixel values in warning messages
                             // regardless of platform DPIs.
                             ["layout.css.devPixelsPerPx", 1],
                           ] },
                           start);
 
 function compare_property_state(a, b) {
--- a/toolkit/components/extensions/test/xpcshell/test_ext_i18n.js
+++ b/toolkit/components/extensions/test/xpcshell/test_ext_i18n.js
@@ -6,21 +6,20 @@ Cu.import("resource://gre/modules/Prefer
 // to use the right timeout for content scripts executed at document_idle.
 ExtensionTestUtils.mockAppInfo();
 
 const server = createHttpServer();
 server.registerDirectory("/data/", do_get_file("data"));
 
 const BASE_URL = `http://localhost:${server.identity.primaryPort}/data`;
 
-var originalReqLocales = Services.locale.getRequestedLocales();
-
 do_register_cleanup(() => {
   Preferences.reset("intl.accept_languages");
-  Services.locale.setRequestedLocales(originalReqLocales);
+  Preferences.reset("intl.locale.matchOS");
+  Preferences.reset("general.useragent.locale");
 });
 
 
 add_task(async function test_i18n() {
   function runTests(assertEq) {
     let _ = browser.i18n.getMessage.bind(browser.i18n);
 
     let url = browser.runtime.getURL("/");
@@ -214,30 +213,31 @@ add_task(async function test_i18n_negoti
       });
     } + `(${runTests})`,
   };
 
   Components.manager.addBootstrappedManifestLocation(do_get_file("data/locales/"));
 
   let contentPage = await ExtensionTestUtils.loadContentPage(`${BASE_URL}/file_sample.html`);
 
+  Preferences.set("intl.locale.matchOS", false);
   for (let [lang, msg] of [["en-US", "English."], ["jp", "\u65e5\u672c\u8a9e"]]) {
-    Services.locale.setRequestedLocales([lang]);
+    Preferences.set("general.useragent.locale", lang);
 
     let extension = ExtensionTestUtils.loadExtension(extensionData);
     await extension.startup();
     await extension.awaitMessage("content-ready");
 
     extension.sendMessage(msg);
     await extension.awaitMessage("background-script-finished");
     await extension.awaitMessage("content-script-finished");
 
     await extension.unload();
   }
-  Services.locale.setRequestedLocales(originalReqLocales);
+  Preferences.reset("general.useragent.locale");
 
   await contentPage.close();
 });
 
 
 add_task(async function test_get_accept_languages() {
   function checkResults(source, results, expected) {
     browser.test.assertEq(
@@ -372,17 +372,17 @@ add_task(async function test_get_ui_lang
 
   extension.sendMessage(["expect-results", "en-US"]);
 
   await extension.awaitMessage("background-done");
   await extension.awaitMessage("content-done");
 
   // We don't currently have a good way to mock this.
   if (false) {
-    Services.locale.setRequestedLocales(["he"]);
+    Preferences.set("general.useragent.locale", "he");
 
     extension.sendMessage(["expect-results", "he"]);
 
     await extension.awaitMessage("background-done");
     await extension.awaitMessage("content-done");
   }
 
   await contentPage.close();
--- a/toolkit/components/extensions/test/xpcshell/test_ext_i18n_css.js
+++ b/toolkit/components/extensions/test/xpcshell/test_ext_i18n_css.js
@@ -117,30 +117,33 @@ async function test_i18n_css(options = {
 
   cssURL = cssURL.replace(/foo.css$/, "locale.css");
 
   css = await fetch(cssURL);
   equal(css, '* { content: "en-US ltr rtl left right" }', "CSS file localized in mochitest scope");
 
   // We don't currently have a good way to mock this.
   if (false) {
+    const LOCALE = "general.useragent.locale";
     const DIR = "intl.uidirection";
+    const DIR_LEGACY = "intl.uidirection.en"; // Needed for Android until bug 1215247 is resolved
 
     // We don't wind up actually switching the chrome registry locale, since we
     // don't have a chrome package for Hebrew. So just override it, and force
     // RTL directionality.
-    var origReqLocales = Services.locale.getRequestedLocales();
-    Services.locale.setRequestedLocales(["he"]);
+    Preferences.set(LOCALE, "he");
     Preferences.set(DIR, 1);
+    Preferences.set(DIR_LEGACY, "rtl");
 
     css = await fetch(cssURL);
     equal(css, '* { content: "he rtl ltr right left" }', "CSS file localized in mochitest scope");
 
-    Services.locale.setRequestedLocales(origReqLocales);
+    Preferences.reset(LOCALE);
     Preferences.reset(DIR);
+    Preferences.reset(DIR_LEGACY);
   }
 
   await extension.awaitFinish("i18n-css");
   await extension.unload();
 }
 
 add_task(async function startup() {
   await promiseStartupManager();
--- a/toolkit/components/extensions/test/xpcshell/test_ext_startup_cache.js
+++ b/toolkit/components/extensions/test/xpcshell/test_ext_startup_cache.js
@@ -75,17 +75,18 @@ add_task(async function() {
   await extension.awaitStartup();
 
   equal(extension.version, "1.0", "Expected extension version");
   manifest = await getManifest();
   equal(manifest.name, "en-US 1.0", "Got expected manifest name");
 
 
   do_print("Change locale to 'fr' and restart");
-  Services.locale.setRequestedLocales(["fr"]);
+  Preferences.set("intl.locale.matchOS", false);
+  Preferences.set("general.useragent.locale", "fr");
   await AddonTestUtils.promiseRestartManager();
   await extension.awaitStartup();
 
   equal(extension.version, "1.0", "Expected extension version");
   manifest = await getManifest();
   equal(manifest.name, "fr 1.0", "Got expected manifest name");
 
 
@@ -93,17 +94,17 @@ add_task(async function() {
   await extension.upgrade(makeExtension({version: "1.1"}));
 
   equal(extension.version, "1.1", "Expected extension version");
   manifest = await getManifest();
   equal(manifest.name, "fr 1.1", "Got expected manifest name");
 
 
   do_print("Change locale to 'en-US' and restart");
-  Services.locale.setRequestedLocales(["en-US"]);
+  Preferences.set("general.useragent.locale", "en-US");
   await AddonTestUtils.promiseRestartManager();
   await extension.awaitStartup();
 
   equal(extension.version, "1.1", "Expected extension version");
   manifest = await getManifest();
   equal(manifest.name, "en-US 1.1", "Got expected manifest name");
 
 
--- a/toolkit/components/reputationservice/test/unit/test_app_rep_maclinux.js
+++ b/toolkit/components/reputationservice/test/unit/test_app_rep_maclinux.js
@@ -69,24 +69,24 @@ add_task(function test_setup() {
   // Ensure safebrowsing is enabled for this test, even if the app
   // doesn't have it enabled.
   Services.prefs.setBoolPref("browser.safebrowsing.malware.enabled", true);
   Services.prefs.setBoolPref("browser.safebrowsing.downloads.enabled", true);
   // Set block table explicitly, no need for the allow table though
   Services.prefs.setCharPref("urlclassifier.downloadBlockTable",
                              "goog-badbinurl-shavar");
   // SendRemoteQueryInternal needs locale preference.
-  let originalReqLocales = Services.locale.getRequestedLocales();
-  Services.locale.setRequestedLocales(["en-US"]);
+  let locale = Services.prefs.getCharPref("general.useragent.locale");
+  Services.prefs.setCharPref("general.useragent.locale", "en-US");
 
   do_register_cleanup(function() {
     Services.prefs.clearUserPref("browser.safebrowsing.malware.enabled");
     Services.prefs.clearUserPref("browser.safebrowsing.downloads.enabled");
     Services.prefs.clearUserPref("urlclassifier.downloadBlockTable");
-    Services.locale.setRequestedLocales(originalReqLocales);
+    Services.prefs.setCharPref("general.useragent.locale", locale);
   });
 
   gHttpServer = new HttpServer();
   gHttpServer.registerDirectory("/", do_get_cwd());
 
   function createVerdict(aShouldBlock) {
     // We can't programmatically create a protocol buffer here, so just
     // hardcode some already serialized ones.
--- a/toolkit/components/reputationservice/test/unit/test_app_rep_windows.js
+++ b/toolkit/components/reputationservice/test/unit/test_app_rep_windows.js
@@ -158,25 +158,25 @@ add_task(async function test_setup() {
   Services.prefs.setBoolPref("browser.safebrowsing.downloads.enabled", true);
   // Set block and allow tables explicitly, since the allowlist is normally
   // disabled on comm-central.
   Services.prefs.setCharPref("urlclassifier.downloadBlockTable",
                              "goog-badbinurl-shavar");
   Services.prefs.setCharPref("urlclassifier.downloadAllowTable",
                              "goog-downloadwhite-digest256");
   // SendRemoteQueryInternal needs locale preference.
-  let originalReqLocales = Services.locale.getRequestedLocales();
-  Services.locale.setRequestedLocales(["en-US"]);
+  let locale = Services.prefs.getCharPref("general.useragent.locale");
+  Services.prefs.setCharPref("general.useragent.locale", "en-US");
 
   do_register_cleanup(function() {
     Services.prefs.clearUserPref("browser.safebrowsing.malware.enabled");
     Services.prefs.clearUserPref("browser.safebrowsing.downloads.enabled");
     Services.prefs.clearUserPref("urlclassifier.downloadBlockTable");
     Services.prefs.clearUserPref("urlclassifier.downloadAllowTable");
-    Services.locale.setRequestedLocales(originalReqLocales);
+    Services.prefs.setCharPref("general.useragent.locale", locale);
   });
 
   gHttpServer = new HttpServer();
   gHttpServer.registerDirectory("/", do_get_cwd());
 
   function createVerdict(aShouldBlock) {
     // We can't programmatically create a protocol buffer here, so just
     // hardcode some already serialized ones.
--- a/toolkit/components/search/nsSearchService.js
+++ b/toolkit/components/search/nsSearchService.js
@@ -62,17 +62,16 @@ const NS_APP_USER_PROFILE_50_DIR = "Prof
 
 // Loading plugins from NS_APP_SEARCH_DIR is no longer supported.
 // Instead, we now load plugins from APP_SEARCH_PREFIX, where a
 // list.txt file needs to exist to list available engines.
 const APP_SEARCH_PREFIX = "resource://search-plugins/";
 
 // See documentation in nsIBrowserSearchService.idl.
 const SEARCH_ENGINE_TOPIC        = "browser-search-engine-modified";
-const REQ_LOCALES_CHANGED_TOPIC  = "intl:requested-locales-changed";
 const QUIT_APPLICATION_TOPIC     = "quit-application";
 
 const SEARCH_ENGINE_REMOVED      = "engine-removed";
 const SEARCH_ENGINE_ADDED        = "engine-added";
 const SEARCH_ENGINE_CHANGED      = "engine-changed";
 const SEARCH_ENGINE_LOADED       = "engine-loaded";
 const SEARCH_ENGINE_CURRENT      = "engine-current";
 const SEARCH_ENGINE_DEFAULT      = "engine-default";
@@ -133,16 +132,17 @@ const OPENSEARCH_LOCALNAME = "OpenSearch
 const MOZSEARCH_NS_10     = "http://www.mozilla.org/2006/browser/search/";
 const MOZSEARCH_LOCALNAME = "SearchPlugin";
 
 const URLTYPE_SUGGEST_JSON = "application/x-suggestions+json";
 const URLTYPE_SEARCH_HTML  = "text/html";
 const URLTYPE_OPENSEARCH   = "application/opensearchdescription+xml";
 
 const BROWSER_SEARCH_PREF = "browser.search.";
+const LOCALE_PREF = "general.useragent.locale";
 
 const USER_DEFINED = "searchTerms";
 
 // Custom search parameters
 const MOZ_PARAM_LOCALE         = "moz:locale";
 const MOZ_PARAM_DIST_ID        = "moz:distributionID";
 const MOZ_PARAM_OFFICIAL       = "moz:official";
 
@@ -2285,17 +2285,17 @@ Engine.prototype = {
     // or distribution directory.
     if (/^(?:jar:)?(?:\[app\]|\[distribution\])/.test(this._loadPath))
       return true;
 
     // If we are using a non-default locale or in the xpcshell test case,
     // we'll accept as a 'default' engine anything that has been registered at
     // resource://search-plugins/ even if the file doesn't come from the
     // application folder.  If not, skip costly additional checks.
-    if (Services.locale.defaultLocale !== Services.locale.getRequestedLocale() &&
+    if (!Services.prefs.prefHasUserValue(LOCALE_PREF) &&
         !gEnvironment.get("XPCSHELL_TEST_PROFILE_DIR"))
       return false;
 
     // Some xpcshell tests use the search service without registering
     // resource://search-plugins/.
     if (!Services.io.getProtocolHandler("resource")
                  .QueryInterface(Ci.nsIResProtocolHandler)
                  .hasSubstitution("search-plugins"))
@@ -4661,21 +4661,23 @@ SearchService.prototype = {
             break;
         }
         break;
 
       case QUIT_APPLICATION_TOPIC:
         this._removeObservers();
         break;
 
-      case REQ_LOCALES_CHANGED_TOPIC:
-        // Locale changed. Re-init. We rely on observers, because we can't
-        // return this promise to anyone.
-        this._asyncReInit();
-        break;
+      case "nsPref:changed":
+        if (aVerb == LOCALE_PREF) {
+          // Locale changed. Re-init. We rely on observers, because we can't
+          // return this promise to anyone.
+          this._asyncReInit();
+          break;
+        }
     }
   },
 
   // nsITimerCallback
   notify: function SRCH_SVC_notify(aTimer) {
     LOG("_notify: checking for updates");
 
     if (!getBoolPref(BROWSER_SEARCH_PREF + "update", true))
@@ -4720,17 +4722,17 @@ SearchService.prototype = {
       return;
     }
     this._observersAdded = true;
 
     Services.obs.addObserver(this, SEARCH_ENGINE_TOPIC);
     Services.obs.addObserver(this, QUIT_APPLICATION_TOPIC);
 
     if (AppConstants.MOZ_BUILD_APP == "mobile/android") {
-      Services.obs.addObserver(this, REQ_LOCALES_CHANGED_TOPIC);
+      Services.prefs.addObserver(LOCALE_PREF, this);
     }
 
     // The current stage of shutdown. Used to help analyze crash
     // signatures in case of shutdown timeout.
     let shutdownState = {
       step: "Not started",
       latestError: {
         message: undefined,
@@ -4765,17 +4767,17 @@ SearchService.prototype = {
   },
   _observersAdded: false,
 
   _removeObservers: function SRCH_SVC_removeObservers() {
     Services.obs.removeObserver(this, SEARCH_ENGINE_TOPIC);
     Services.obs.removeObserver(this, QUIT_APPLICATION_TOPIC);
 
     if (AppConstants.MOZ_BUILD_APP == "mobile/android") {
-      Services.obs.removeObserver(this, REQ_LOCALES_CHANGED_TOPIC);
+      Services.prefs.removeObserver(LOCALE_PREF, this);
     }
   },
 
   QueryInterface: XPCOMUtils.generateQI([
     Ci.nsIBrowserSearchService,
     Ci.nsIObserver,
     Ci.nsITimerCallback
   ])
--- a/toolkit/components/search/tests/xpcshell/head_search.js
+++ b/toolkit/components/search/tests/xpcshell/head_search.js
@@ -249,24 +249,24 @@ function isUSTimezone() {
   // Hawaii-Aleutian Standard Time (http://www.timeanddate.com/time/zones/hast)
 
   let UTCOffset = (new Date()).getTimezoneOffset();
   return UTCOffset >= 150 && UTCOffset <= 600;
 }
 
 const kDefaultenginenamePref = "browser.search.defaultenginename";
 const kTestEngineName = "Test search engine";
-const REQ_LOCALES_CHANGED_TOPIC = "intl:requested-locales-changed";
+const kLocalePref = "general.useragent.locale";
 
 function getDefaultEngineName(isUS) {
   const nsIPLS = Ci.nsIPrefLocalizedString;
   // Copy the logic from nsSearchService
   let pref = kDefaultenginenamePref;
   if (isUS === undefined)
-    isUS = Services.locale.getRequestedLocale() == "en-US" && isUSTimezone();
+    isUS = Services.prefs.getCharPref(kLocalePref) == "en-US" && isUSTimezone();
   if (isUS) {
     pref += ".US";
   }
   return Services.prefs.getComplexValue(pref, nsIPLS).data;
 }
 
 /**
  * Waits for the cache file to be saved.
@@ -504,17 +504,17 @@ function asyncInit() {
     });
   });
 }
 
 function asyncReInit() {
   let promise = waitForSearchNotification("reinit-complete");
 
   Services.search.QueryInterface(Ci.nsIObserver)
-          .observe(null, REQ_LOCALES_CHANGED_TOPIC, null);
+          .observe(null, "nsPref:changed", kLocalePref);
 
   return promise;
 }
 
 // This "enum" from nsSearchService.js
 const TELEMETRY_RESULT_ENUM = {
   SUCCESS: 0,
   SUCCESS_WITHOUT_DATA: 1,
--- a/toolkit/mozapps/extensions/test/xpcshell/test_bug335238.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_bug335238.js
@@ -1,13 +1,16 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
+const PREF_MATCH_OS_LOCALE = "intl.locale.matchOS";
+const PREF_SELECTED_LOCALE = "general.useragent.locale";
+
 // Disables security checking our updates which haven't been signed
 Services.prefs.setBoolPref("extensions.checkUpdateSecurity", false);
 
 var Ci = Components.interfaces;
 var Cu = Components.utils;
 
 Cu.import("resource://testing-common/httpd.js");
 Cu.import("resource://testing-common/MockRegistrar.jsm");
@@ -152,17 +155,18 @@ function run_test() {
 
   server = new HttpServer();
   server.registerPathHandler("/0", requestHandler);
   server.registerPathHandler("/1", requestHandler);
   server.registerPathHandler("/2", requestHandler);
   server.registerPathHandler("/3", requestHandler);
   server.start(4444);
 
-  Services.locale.setRequestedLocales(["en-US"]);
+  Services.prefs.setBoolPref(PREF_MATCH_OS_LOCALE, false);
+  Services.prefs.setCharPref(PREF_SELECTED_LOCALE, "en-US");
 
   startupManager();
   installAllFiles(ADDONS.map(a => do_get_addon(a.addon)), function() {
 
     restartManager();
     AddonManager.getAddonByID(ADDONS[1].id, callback_soon(function(addon) {
       do_check_true(!(!addon));
       addon.userDisabled = true;
--- a/toolkit/mozapps/extensions/test/xpcshell/test_bug397778.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_bug397778.js
@@ -1,21 +1,25 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
+const PREF_MATCH_OS_LOCALE = "intl.locale.matchOS";
+const PREF_SELECTED_LOCALE = "general.useragent.locale";
+
 const ADDON = "test_bug397778";
 const ID = "bug397778@tests.mozilla.org";
 
 function run_test() {
   // Setup for test
   do_test_pending();
   createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1");
-  Services.locale.setRequestedLocales(["fr-FR"]);
+  Services.prefs.setBoolPref(PREF_MATCH_OS_LOCALE, false);
+  Services.prefs.setCharPref(PREF_SELECTED_LOCALE, "fr-FR");
 
   // Install test add-on
   startupManager();
   installAllFiles([do_get_addon(ADDON)], function() {
     restartManager();
 
     run_test_1();
   });
@@ -37,74 +41,74 @@ function run_test_1() {
 
       do_execute_soon(run_test_2);
     });
   }));
 }
 
 function run_test_2() {
   // Change locale. The more specific de-DE is the best match
-  Services.locale.setRequestedLocales(["de"]);
+  Services.prefs.setCharPref(PREF_SELECTED_LOCALE, "de");
   restartManager();
 
   AddonManager.getAddonByID(ID, function(addon) {
     do_check_neq(addon, null);
     do_check_eq(addon.name, "de-DE Name");
     do_check_eq(addon.description, null);
 
     do_execute_soon(run_test_3);
   });
 }
 
 function run_test_3() {
   // Change locale. Locale case should have no effect
-  Services.locale.setRequestedLocales(["DE-de"]);
+  Services.prefs.setCharPref(PREF_SELECTED_LOCALE, "DE-de");
   restartManager();
 
   AddonManager.getAddonByID(ID, function(addon) {
     do_check_neq(addon, null);
     do_check_eq(addon.name, "de-DE Name");
     do_check_eq(addon.description, null);
 
     do_execute_soon(run_test_4);
   });
 }
 
 function run_test_4() {
   // Change locale. es-ES should closely match
-  Services.locale.setRequestedLocales(["es-AR"]);
+  Services.prefs.setCharPref(PREF_SELECTED_LOCALE, "es-AR");
   restartManager();
 
   AddonManager.getAddonByID(ID, function(addon) {
     do_check_neq(addon, null);
     do_check_eq(addon.name, "es-ES Name");
     do_check_eq(addon.description, "es-ES Description");
 
     do_execute_soon(run_test_5);
   });
 }
 
 function run_test_5() {
   // Change locale. Either zh-CN or zh-TW could match
-  Services.locale.setRequestedLocales(["zh"]);
+  Services.prefs.setCharPref(PREF_SELECTED_LOCALE, "zh");
   restartManager();
 
   AddonManager.getAddonByID(ID, function(addon) {
     do_check_neq(addon, null);
     if (addon.name != "zh-TW Name" && addon.name != "zh-CN Name")
       do_throw("zh matched to " + addon.name);
 
     do_execute_soon(run_test_6);
   });
 }
 
 function run_test_6() {
   // Unknown locale should try to match against en-US as well. Of en,en-GB
   // en should match as being less specific
-  Services.locale.setRequestedLocales(["nl-NL"]);
+  Services.prefs.setCharPref(PREF_SELECTED_LOCALE, "nl-NL");
   restartManager();
 
   AddonManager.getAddonByID(ID, function(addon) {
     do_check_neq(addon, null);
     do_check_eq(addon.name, "en Name");
     do_check_eq(addon.description, "en Description");
 
     do_execute_soon(do_test_finished);
--- a/toolkit/mozapps/extensions/test/xpcshell/test_bug430120.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_bug430120.js
@@ -4,16 +4,17 @@
  */
 
 const BLOCKLIST_TIMER                 = "blocklist-background-update-timer";
 const PREF_BLOCKLIST_URL              = "extensions.blocklist.url";
 const PREF_BLOCKLIST_ENABLED          = "extensions.blocklist.enabled";
 const PREF_APP_DISTRIBUTION           = "distribution.id";
 const PREF_APP_DISTRIBUTION_VERSION   = "distribution.version";
 const PREF_APP_UPDATE_CHANNEL         = "app.update.channel";
+const PREF_GENERAL_USERAGENT_LOCALE   = "general.useragent.locale";
 const CATEGORY_UPDATE_TIMER           = "update-timer";
 
 // Get the HTTP server.
 Components.utils.import("resource://testing-common/httpd.js");
 Components.utils.import("resource://testing-common/MockRegistrar.jsm");
 var testserver;
 var gOSVersion;
 var gBlocklist;
@@ -115,17 +116,17 @@ function run_test() {
   timerService.fireTimer(BLOCKLIST_TIMER);
 
   // Some values have to be on the default branch to work
   var defaults = Services.prefs.QueryInterface(Components.interfaces.nsIPrefService)
                        .getDefaultBranch(null);
   defaults.setCharPref(PREF_APP_UPDATE_CHANNEL, "updatechannel");
   defaults.setCharPref(PREF_APP_DISTRIBUTION, "distribution");
   defaults.setCharPref(PREF_APP_DISTRIBUTION_VERSION, "distribution-version");
-  Services.locale.setRequestedLocales(["locale"]);
+  defaults.setCharPref(PREF_GENERAL_USERAGENT_LOCALE, "locale");
 
   // This should correctly escape everything
   Services.prefs.setCharPref(PREF_BLOCKLIST_URL, "http://localhost:" + gPort + "/2?" +
                      "%APP_ID%&%APP_VERSION%&%PRODUCT%&%VERSION%&%BUILD_ID%&" +
                      "%BUILD_TARGET%&%LOCALE%&%CHANNEL%&" +
                      "%OS_VERSION%&%PLATFORM_VERSION%&%DISTRIBUTION%&%DISTRIBUTION_VERSION%");
   Services.prefs.setBoolPref(PREF_BLOCKLIST_ENABLED, true);
   timerService.fireTimer(BLOCKLIST_TIMER);
--- a/toolkit/mozapps/extensions/test/xpcshell/test_locale.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_locale.js
@@ -1,18 +1,25 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
+// This verifies that localized properties work as expected
+
+const PREF_MATCH_OS_LOCALE = "intl.locale.matchOS";
+const PREF_SELECTED_LOCALE = "general.useragent.locale";
+
+
 function run_test() {
   do_test_pending();
 
   // Setup for test
   createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
-  Services.locale.setRequestedLocales(["fr-FR"]);
+  Services.prefs.setBoolPref(PREF_MATCH_OS_LOCALE, false);
+  Services.prefs.setCharPref(PREF_SELECTED_LOCALE, "fr-FR");
 
   startupManager();
 
   run_test_1();
 }
 
 // Tests that the localized properties are visible before installation
 function run_test_1() {
@@ -76,32 +83,32 @@ function run_test_4() {
     do_check_eq(contributors[2], "Fr Contributor 3");
 
     do_execute_soon(run_test_5);
   });
 }
 
 // Test that changing locale works
 function run_test_5() {
-  Services.locale.setRequestedLocales(["de-DE"]);
+  Services.prefs.setCharPref(PREF_SELECTED_LOCALE, "de-DE");
   restartManager();
 
   AddonManager.getAddonByID("addon1@tests.mozilla.org", function(addon) {
     do_check_neq(addon, null);
 
     do_check_eq(addon.name, "de-DE Name");
     do_check_eq(addon.description, null);
 
     do_execute_soon(run_test_6);
   });
 }
 
 // Test that missing locales use the fallbacks
 function run_test_6() {
-  Services.locale.setRequestedLocales(["nl-NL"]);
+  Services.prefs.setCharPref(PREF_SELECTED_LOCALE, "nl-NL");
   restartManager();
 
   AddonManager.getAddonByID("addon1@tests.mozilla.org", callback_soon(function(addon) {
     do_check_neq(addon, null);
 
     do_check_eq(addon.name, "Fallback Name");
     do_check_eq(addon.description, "Fallback Description");
 
@@ -120,17 +127,17 @@ function run_test_7() {
     do_check_eq(addon.name, "Name from prefs");
 
     do_execute_soon(run_test_8);
   });
 }
 
 // Test that the prefs will override localized values from the manifest
 function run_test_8() {
-  Services.locale.setRequestedLocales(["fr-FR"]);
+  Services.prefs.setCharPref(PREF_SELECTED_LOCALE, "fr-FR");
   restartManager();
 
   AddonManager.getAddonByID("addon1@tests.mozilla.org", function(addon) {
     do_check_neq(addon, null);
 
     do_check_eq(addon.name, "Name from prefs");
     let contributors = addon.contributors;
     do_check_eq(contributors.length, 2);
--- a/toolkit/mozapps/extensions/test/xpcshell/test_update.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_update.js
@@ -1,14 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 // This verifies that add-on update checks work
 
+const PREF_MATCH_OS_LOCALE = "intl.locale.matchOS";
+const PREF_SELECTED_LOCALE = "general.useragent.locale";
 const PREF_GETADDONS_CACHE_ENABLED = "extensions.getAddons.cache.enabled";
 
 // The test extension uses an insecure update url.
 Services.prefs.setBoolPref(PREF_EM_CHECK_UPDATE_SECURITY, false);
 Services.prefs.setBoolPref(PREF_EM_STRICT_COMPATIBILITY, false);
 // This test requires lightweight themes update to be enabled even if the app
 // doesn't support lightweight themes.
 Services.prefs.setBoolPref("lightweightThemes.update.enabled", true);
@@ -31,17 +33,18 @@ testserver.registerDirectory("/addons/",
 const profileDir = gProfD.clone();
 profileDir.append("extensions");
 
 var originalSyncGUID;
 
 function run_test() {
   createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1");
 
-  Services.locale.setRequestedLocales(["fr-FR"]);
+  Services.prefs.setBoolPref(PREF_MATCH_OS_LOCALE, false);
+  Services.prefs.setCharPref(PREF_SELECTED_LOCALE, "fr-FR");
 
   run_next_test();
 }
 
 let testParams = [
   { updateFile: "test_update.rdf",
     appId: "xpcshell@tests.mozilla.org" },
   { updateFile: "test_update.json",
--- a/toolkit/mozapps/extensions/test/xpcshell/test_update_strictcompat.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_update_strictcompat.js
@@ -1,14 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 // This verifies that add-on update checks work
 
+const PREF_MATCH_OS_LOCALE = "intl.locale.matchOS";
+const PREF_SELECTED_LOCALE = "general.useragent.locale";
 const PREF_GETADDONS_CACHE_ENABLED = "extensions.getAddons.cache.enabled";
 
 // The test extension uses an insecure update url.
 Services.prefs.setBoolPref(PREF_EM_CHECK_UPDATE_SECURITY, false);
 Services.prefs.setBoolPref(PREF_EM_STRICT_COMPATIBILITY, true);
 // This test requires lightweight themes update to be enabled even if the app
 // doesn't support lightweight themes.
 Services.prefs.setBoolPref("lightweightThemes.update.enabled", true);
@@ -29,17 +31,18 @@ mapFile("/data/test_update.xml", testser
 testserver.registerDirectory("/addons/", do_get_file("addons"));
 
 const profileDir = gProfD.clone();
 profileDir.append("extensions");
 
 function run_test() {
   createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1");
 
-  Services.locale.setRequestedLocales(["fr-FR"]);
+  Services.prefs.setBoolPref(PREF_MATCH_OS_LOCALE, false);
+  Services.prefs.setCharPref(PREF_SELECTED_LOCALE, "fr-FR");
 
   run_next_test();
 }
 
 let testParams = [
   { updateFile: "test_update.rdf",
     appId: "xpcshell@tests.mozilla.org" },
   { updateFile: "test_update.json",
--- a/toolkit/mozapps/extensions/test/xpcshell/test_webextension.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_webextension.js
@@ -1,16 +1,18 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 Components.utils.import("resource://gre/modules/AppConstants.jsm");
 
 const ID = "webextension1@tests.mozilla.org";
 
+const PREF_SELECTED_LOCALE = "general.useragent.locale";
+
 const profileDir = gProfD.clone();
 profileDir.append("extensions");
 
 createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "42");
 startupManager();
 
 const { GlobalManager } = Components.utils.import("resource://gre/modules/Extension.jsm", {});
 
@@ -141,25 +143,25 @@ add_task(async function test_manifest_lo
   await promiseWebExtensionStartup();
 
   let addon = await promiseAddonByID(extensionId);
   addon.userDisabled = true;
 
   equal(addon.name, "Web Extensiøn foo ☹");
   equal(addon.description, "Descriptïon bar ☹ of add-on");
 
-  Services.locale.setRequestedLocales(["fr-FR"]);
+  Services.prefs.setCharPref(PREF_SELECTED_LOCALE, "fr-FR");
   await promiseRestartManager();
 
   addon = await promiseAddonByID(extensionId);
 
   equal(addon.name, "Web Extensiøn le foo ☺");
   equal(addon.description, "Descriptïon le bar ☺ of add-on");
 
-  Services.locale.setRequestedLocales(["de"]);
+  Services.prefs.setCharPref(PREF_SELECTED_LOCALE, "de");
   await promiseRestartManager();
 
   addon = await promiseAddonByID(extensionId);
 
   equal(addon.name, "Web Extensiøn foo ☹");
   equal(addon.description, "Descriptïon bar ☹ of add-on");
 
   addon.uninstall();