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 458928 9c47d4f6747ab2f9c1972ec432161d4d67b5225d
parent 458927 6e651b1b00b101795b3bca26d2ff200702db96ae
child 458929 ac92eed544e90b63a12f22e9add85f5e388907b8
push id111902
push usershindli@mozilla.com
push dateWed, 13 Feb 2019 21:37:05 +0000
treeherdermozilla-inbound@87ed9a736435 [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