Bug 1527374: Always remove --allow-downgrade from the command line. r=bzbarsky
authorDave Townsend <dtownsend@oxymoronical.com>
Wed, 13 Feb 2019 16:36:02 +0000
changeset 458912 9c47d4f6747a
parent 458911 6e651b1b00b1
child 458913 ac92eed544e9
push id35551
push usershindli@mozilla.com
push dateWed, 13 Feb 2019 21:34:09 +0000
treeherdermozilla-central@08f794a4928e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbzbarsky
bugs1527374
milestone67.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 1527374: Always remove --allow-downgrade from the command line. r=bzbarsky Currently we only check and remove the --allow-downgrade command line argument if the run is actually a downgrade. When we don't the --allow-downgrade argument makes it to Firefox's default command line handler which doesn't know how to handle it and so ignores it and the next argument on the command line. Flipping the ordering of the check makes sure we always remove the argument. Differential Revision: https://phabricator.services.mozilla.com/D19569
toolkit/xre/nsAppRunner.cpp
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -4235,17 +4235,19 @@ int XREMain::XRE_mainStartup(bool* aExit
   bool cachesOK;
   bool isDowngrade;
   nsCString lastVersion;
   bool versionOK = CheckCompatibility(
       mProfD, version, osABI, mDirProvider.GetGREDir(), mAppData->directory,
       flagFile, &cachesOK, &isDowngrade, lastVersion);
 
 #ifdef MOZ_BLOCK_PROFILE_DOWNGRADE
-  if (isDowngrade && !CheckArg("allow-downgrade")) {
+  // The argument check must come first so the argument is always removed from
+  // the command line regardless of whether this is a downgrade or not.
+  if (!CheckArg("allow-downgrade") && isDowngrade) {
     rv = CheckDowngrade(mProfD, mNativeApp, mProfileSvc, lastVersion);
     if (rv == NS_ERROR_LAUNCHED_CHILD_PROCESS || rv == NS_ERROR_ABORT) {
       *aExitFlag = true;
       return 0;
     }
   }
 #endif