Bug 1596662 - make the addresses and credit-cards engines available if we find they are enabled. r=eoger
authorMark Hammond <mhammond@skippinet.com.au>
Fri, 15 Nov 2019 19:09:41 +0000
changeset 502337 5ea9b3f1de720e8500ad9dc4c1511ddbad2d02b0
parent 502336 adfdc1b55325d4b7e93381b903d186d73f2cd8f2
child 502338 f1c44a2eb6041bc202b27d9d3a65254de00285af
push id114172
push userdluca@mozilla.com
push dateTue, 19 Nov 2019 11:31:10 +0000
treeherdermozilla-inbound@b5c5ba07d3db [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerseoger
bugs1596662
milestone72.0a1
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
Bug 1596662 - make the addresses and credit-cards engines available if we find they are enabled. r=eoger Differential Revision: https://phabricator.services.mozilla.com/D53143
browser/components/preferences/in-content/syncChooseWhatToSync.js
--- a/browser/components/preferences/in-content/syncChooseWhatToSync.js
+++ b/browser/components/preferences/in-content/syncChooseWhatToSync.js
@@ -36,22 +36,25 @@ let gSyncChooseWhatToSync = {
     }
   },
 
   // make whatever tweaks we need based on preferences.
   _adjustForPrefs() {
     // These 2 engines are unique in that there are prefs that make the
     // entire engine unavailable (which is distinct from "disabled").
     let enginePrefs = [
-      ["services.sync.engine.addresses.available", ".sync-engine-addresses"],
-      [
-        "services.sync.engine.creditcards.available",
-        ".sync-engine-creditcards",
-      ],
+      ["services.sync.engine.addresses", ".sync-engine-addresses"],
+      ["services.sync.engine.creditcards", ".sync-engine-creditcards"],
     ];
-    for (let [availablePref, className] of enginePrefs) {
+    for (let [enabledPref, className] of enginePrefs) {
+      let availablePref = enabledPref + ".available";
+      // If the engine is enabled we force it to be available, otherwise we see
+      // spooky things happen (like it magically re-appear later)
+      if (Services.prefs.getBoolPref(enabledPref, false)) {
+        Services.prefs.setBoolPref(availablePref, true);
+      }
       if (!Services.prefs.getBoolPref(availablePref)) {
         let elt = document.querySelector(className);
         elt.hidden = true;
       }
     }
   },
 };