Commit 793612ba authored by alwu's avatar alwu
Browse files

Bug 1509933 - part2 : migrate the old pref to the new pref. r=mconley

This patch will do :
- set the value of the new pref based on the value of the old pref

The advantage of doing so :
- ensure that the value of the pref can be transformed correctly

Differential Revision: https://phabricator.services.mozilla.com/D73972
parent f986ca0c
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -3055,7 +3055,7 @@ BrowserGlue.prototype = {
  _migrateUI: function BG__migrateUI() {
    // Use an increasing number to keep track of the current migration state.
    // Completely unrelated to the current Firefox release number.
    const UI_VERSION = 94;
    const UI_VERSION = 95;
    const BROWSER_DOCURL = AppConstants.BROWSER_CHROME_URL;

    if (!Services.prefs.prefHasUserValue("browser.migration.version")) {
@@ -3625,6 +3625,14 @@ BrowserGlue.prototype = {
      }
    }

    if (currentUIVersion < 95) {
      const oldPrefName = "media.autoplay.enabled.user-gestures-needed";
      const oldPrefValue = Services.prefs.getBoolPref(oldPrefName, true);
      const newPrefValue = oldPrefValue ? 0 : 1;
      Services.prefs.setIntPref("media.autoplay.blocking_policy", newPrefValue);
      Services.prefs.clearUserPref(oldPrefName);
    }

    // Update the migration version.
    Services.prefs.setIntPref("browser.migration.version", UI_VERSION);
  },