Bug 1527374: Always remove --allow-downgrade from the command line. r=bzbarsky
☠☠ backed out by 875a93046d84 ☠ ☠
authorDave Townsend <dtownsend@oxymoronical.com>
Tue, 12 Feb 2019 13:15:42 -0800
changeset 458725 91bfef9d7343
parent 458724 6f86eefc83a5
child 458726 3a58833843ab
push id35546
push userrmaries@mozilla.com
push dateWed, 13 Feb 2019 04:27:59 +0000
treeherdermozilla-central@636d2c00234d [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
@@ -4236,17 +4236,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, mProfLD, mProfileName, mNativeApp, mProfileSvc,
                         lastVersion);
     if (rv == NS_ERROR_LAUNCHED_CHILD_PROCESS || rv == NS_ERROR_ABORT) {
       *aExitFlag = true;
       return 0;
     }
   }
 #endif