Bug 1369801 - dt-addon: clear extensions.lastAppVersion when creating browser toolbox profile;r=ochameau
authorJulian Descottes <jdescottes@mozilla.com>
Thu, 06 Jul 2017 02:48:41 +0200
changeset 419873 0462e7a66185a233fe9cbd389c9ca45a7e860565
parent 419872 3ab3a5481b90874cf6900cdd001653bca213b2de
child 419874 082ece5eba4d5005058a7c8e1b11d8cbe5e3061f
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersochameau
bugs1369801
milestone56.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 1369801 - dt-addon: clear extensions.lastAppVersion when creating browser toolbox profile;r=ochameau This is needed to: 1. force the devtools system addon installation when starting the BT instance of FF 2. avoid the addon update prompt Another approach is to create a separate user.js pref file to fix 1. However with this approach there is currently no way to fix 2. MozReview-Commit-ID: palK2hION0
devtools/client/framework/ToolboxProcess.jsm
--- a/devtools/client/framework/ToolboxProcess.jsm
+++ b/devtools/client/framework/ToolboxProcess.jsm
@@ -182,25 +182,39 @@ BrowserToolboxProcess.prototype = {
       return;
     }
 
     this._dbgProfilePath = debuggingProfileDir.path;
 
     // We would like to copy prefs into this new profile...
     let prefsFile = debuggingProfileDir.clone();
     prefsFile.append("prefs.js");
+
     // ... but unfortunately, when we run tests, it seems the starting profile
     // clears out the prefs file before re-writing it, and in practice the
     // file is empty when we get here. So just copying doesn't work in that
     // case.
     // We could force a sync pref flush and then copy it... but if we're doing
     // that, we might as well just flush directly to the new profile, which
     // always works:
+
+    // Before dumping the preferences to prefsFile, clear the current pref for
+    // extensions.lastAppVersion. The AddonManager expects this pref to be undefined
+    // when loading a new profile, this will trigger the installation of system addons
+    // without showing the addon update popup.
+    let appVersion = Services.prefs.getCharPref("extensions.lastAppVersion", "");
+    Services.prefs.clearUserPref("extensions.lastAppVersion");
+
     Services.prefs.savePrefFile(prefsFile);
 
+    // Restore the overridden extensions.lastAppVersion preference.
+    if (appVersion) {
+      Services.prefs.setCharPref("extensions.lastAppVersion", appVersion);
+    }
+
     dumpn("Finished creating the chrome toolbox user profile at: " +
           this._dbgProfilePath);
   },
 
   /**
    * Originally, the profile was placed in `ProfLD` instead of `ProfD`.  On some systems,
    * such as macOS, `ProfLD` is in the user's Caches directory, which is not an
    * appropriate place to store supposedly persistent profile data.