Backed out changeset 6e7d21f9e8ef (bug 1598562) causing bug 1600450 in 72 beta
authorDaniel Varga <dvarga@mozilla.com>
Mon, 02 Dec 2019 01:19:09 +0200
changeset 566640 3b2676056584688eb47f8ad9b2b4070fe7ca00c8
parent 566639 4f9740b2be4e8cda8913bb17a02917b1fe506306
child 566641 1e4ac843ccbb2fbbbd97f48f6c921d78da0a98aa
push id12351
push userffxbld-merge
push dateMon, 02 Dec 2019 11:32:26 +0000
treeherdermozilla-beta@dba4410526a2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1598562, 1600450
milestone72.0a1
backs out6e7d21f9e8efc7c6b657b2e28884fc3bb2b9861b
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 6e7d21f9e8ef (bug 1598562) causing bug 1600450 in 72 beta
services/settings/RemoteSettingsClient.jsm
services/settings/Utils.jsm
services/settings/remote-settings.js
--- a/services/settings/RemoteSettingsClient.jsm
+++ b/services/settings/RemoteSettingsClient.jsm
@@ -55,16 +55,21 @@ ChromeUtils.defineModuleGetter(
 XPCOMUtils.defineLazyGlobalGetters(this, ["fetch"]);
 
 // IndexedDB name.
 const DB_NAME = "remote-settings";
 
 const TELEMETRY_COMPONENT = "remotesettings";
 
 XPCOMUtils.defineLazyGetter(this, "console", () => Utils.log);
+XPCOMUtils.defineLazyPreferenceGetter(
+  this,
+  "gServerURL",
+  "services.settings.server"
+);
 
 /**
  * cacheProxy returns an object Proxy that will memoize properties of the target.
  * @param {Object} target the object to wrap.
  * @returns {Proxy}
  */
 function cacheProxy(target) {
   const cache = new Map();
@@ -267,17 +272,17 @@ class RemoteSettingsClient extends Event
   get lastCheckTimePref() {
     return (
       this._lastCheckTimePref ||
       `services.settings.${this.bucketName}.${this.collectionName}.last_check`
     );
   }
 
   httpClient() {
-    const api = new KintoHttpClient(Utils.SERVER_URL);
+    const api = new KintoHttpClient(gServerURL);
     return api.bucket(this.bucketName).collection(this.collectionName);
   }
 
   /**
    * Retrieve the collection timestamp for the last synchronization.
    *
    * @returns {number}
    *          The timestamp in milliseconds, returns -1 if retrieving
@@ -388,17 +393,17 @@ class RemoteSettingsClient extends Event
   /**
    * Synchronize the local database with the remote server.
    *
    * @param {Object} options See #maybeSync() options.
    */
   async sync(options) {
     // We want to know which timestamp we are expected to obtain in order to leverage
     // cache busting. We don't provide ETag because we don't want a 304.
-    const { changes } = await Utils.fetchLatestChanges(Utils.SERVER_URL, {
+    const { changes } = await Utils.fetchLatestChanges(gServerURL, {
       filters: {
         collection: this.collectionName,
         bucket: this.bucketName,
       },
     });
     if (changes.length === 0) {
       throw new RemoteSettingsClient.UnknownCollectionError(this.identifier);
     }
@@ -537,17 +542,17 @@ class RemoteSettingsClient extends Event
             updated: [],
             deleted: [],
           };
         } else {
           // Local data is outdated.
           // Fetch changes from server, and make sure we overwrite local data.
           const strategy = Kinto.syncStrategy.PULL_ONLY;
           syncResult = await kintoCollection.sync({
-            remote: Utils.SERVER_URL,
+            remote: gServerURL,
             strategy,
             expectedTimestamp,
           });
           if (!syncResult.ok) {
             // With PULL_ONLY, there cannot be any conflicts, but don't silent it anyway.
             throw new Error("Sync failed");
           }
           // The records imported from the dump should be considered as "created" for the
--- a/services/settings/Utils.jsm
+++ b/services/settings/Utils.jsm
@@ -3,21 +3,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 var EXPORTED_SYMBOLS = ["Utils"];
 
 const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 const { XPCOMUtils } = ChromeUtils.import(
   "resource://gre/modules/XPCOMUtils.jsm"
 );
-ChromeUtils.defineModuleGetter(
-  this,
-  "AppConstants",
-  "resource://gre/modules/AppConstants.jsm"
-);
 
 XPCOMUtils.defineLazyGlobalGetters(this, ["fetch"]);
 
 // Create a new instance of the ConsoleAPI so we can control the maxLogLevel with a pref.
 // See LOG_LEVELS in Console.jsm. Common examples: "all", "debug", "info", "warn", "error".
 XPCOMUtils.defineLazyGetter(this, "log", () => {
   const { ConsoleAPI } = ChromeUtils.import(
     "resource://gre/modules/Console.jsm",
@@ -25,29 +20,17 @@ XPCOMUtils.defineLazyGetter(this, "log",
   );
   return new ConsoleAPI({
     maxLogLevel: "warn",
     maxLogLevelPref: "services.settings.loglevel",
     prefix: "services.settings",
   });
 });
 
-XPCOMUtils.defineLazyPreferenceGetter(
-  this,
-  "gServerURL",
-  "services.settings.server"
-);
-
 var Utils = {
-  get SERVER_URL() {
-    return AppConstants.RELEASE_OR_BETA && !Cu.isInAutomation
-      ? "https://firefox.settings.services.mozilla.com/v1"
-      : gServerURL;
-  },
-
   CHANGES_PATH: "/buckets/monitor/collections/changes/records",
 
   /**
    * Logger instance.
    */
   log,
 
   /**
--- a/services/settings/remote-settings.js
+++ b/services/settings/remote-settings.js
@@ -42,16 +42,17 @@ ChromeUtils.defineModuleGetter(
   "FilterExpressions",
   "resource://gre/modules/components-utils/FilterExpressions.jsm"
 );
 
 XPCOMUtils.defineLazyGlobalGetters(this, ["fetch"]);
 
 const PREF_SETTINGS_DEFAULT_BUCKET = "services.settings.default_bucket";
 const PREF_SETTINGS_BRANCH = "services.settings.";
+const PREF_SETTINGS_SERVER = "server";
 const PREF_SETTINGS_DEFAULT_SIGNER = "default_signer";
 const PREF_SETTINGS_SERVER_BACKOFF = "server.backoff";
 const PREF_SETTINGS_LAST_UPDATE = "last_update_seconds";
 const PREF_SETTINGS_LAST_ETAG = "last_etag";
 const PREF_SETTINGS_CLOCK_SKEW_SECONDS = "clock_skew_seconds";
 const PREF_SETTINGS_LOAD_DUMP = "load_dump";
 
 // Telemetry identifiers.
@@ -64,16 +65,21 @@ const BROADCAST_ID = "remote-settings/mo
 
 // Signer to be used when not specified (see Ci.nsIContentSignatureVerifier).
 const DEFAULT_SIGNER = "remote-settings.content-signature.mozilla.org";
 
 XPCOMUtils.defineLazyGetter(this, "gPrefs", () => {
   return Services.prefs.getBranch(PREF_SETTINGS_BRANCH);
 });
 XPCOMUtils.defineLazyGetter(this, "console", () => Utils.log);
+XPCOMUtils.defineLazyPreferenceGetter(
+  this,
+  "gServerURL",
+  PREF_SETTINGS_BRANCH + PREF_SETTINGS_SERVER
+);
 
 /**
  * Default entry filtering function, in charge of excluding remote settings entries
  * where the JEXL expression evaluates into a falsy value.
  * @param {Object}            entry       The Remote Settings entry to be excluded or kept.
  * @param {ClientEnvironment} environment Information about version, language, platform etc.
  * @returns {?Object} the entry or null if excluded.
  */
@@ -217,17 +223,17 @@ function remoteSettingsFunction() {
     // Do we have the latest version already?
     // Every time we register a new client, we have to fetch the whole list again.
     const lastEtag = _invalidatePolling
       ? ""
       : gPrefs.getCharPref(PREF_SETTINGS_LAST_ETAG, "");
 
     let pollResult;
     try {
-      pollResult = await Utils.fetchLatestChanges(Utils.SERVER_URL, {
+      pollResult = await Utils.fetchLatestChanges(gServerURL, {
         expectedTimestamp,
         lastEtag,
       });
     } catch (e) {
       // Report polling error to Uptake Telemetry.
       let reportStatus;
       if (/JSON\.parse/.test(e.message)) {
         reportStatus = UptakeTelemetry.STATUS.PARSE_ERROR;
@@ -364,17 +370,17 @@ function remoteSettingsFunction() {
   /**
    * Returns an object with polling status information and the list of
    * known remote settings collections.
    */
   remoteSettings.inspect = async () => {
     const {
       changes,
       currentEtag: serverTimestamp,
-    } = await Utils.fetchLatestChanges(Utils.SERVER_URL);
+    } = await Utils.fetchLatestChanges(gServerURL);
 
     const collections = await Promise.all(
       changes.map(async change => {
         const { bucket, collection, last_modified: serverTimestamp } = change;
         const client = await _client(bucket, collection);
         if (!client) {
           return null;
         }
@@ -391,18 +397,18 @@ function remoteSettingsFunction() {
           serverTimestamp,
           lastCheck,
           signerName: client.signerName,
         };
       })
     );
 
     return {
-      serverURL: Utils.SERVER_URL,
-      pollingEndpoint: Utils.SERVER_URL + Utils.CHANGES_PATH,
+      serverURL: gServerURL,
+      pollingEndpoint: gServerURL + Utils.CHANGES_PATH,
       serverTimestamp,
       localTimestamp: gPrefs.getCharPref(PREF_SETTINGS_LAST_ETAG, null),
       lastCheck: gPrefs.getIntPref(PREF_SETTINGS_LAST_UPDATE, 0),
       mainBucket: Services.prefs.getCharPref(PREF_SETTINGS_DEFAULT_BUCKET),
       defaultSigner: DEFAULT_SIGNER,
       collections: collections.filter(c => !!c),
     };
   };