mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
d9a9041a7c
When comparing compatibility versions we first compare the version part. If that shows us to be a downgrade then we stop checking at that point. But we must also stop checking if it shows us to be an upgrade since we don't need to check the build IDs at that point. This also applies to the check for the app build ID. This means that a newer version with an older build id will appear to be a downgrade. This is problematic for safe mode because when safe mode runs it sets the compatibility version to "Safe Mode" (bug 1556831) to ensure that caches are invalidated on next startup. On the next run the Firefox version is considered as newer than "Safe Mode" so we would move on to comparing the build IDs. But the Firefox build ID gets version compared to "" (since there isn't a build ID part in "Safe Mode"). Since build ID's are larger than 32-bit numbers we trigger bug 1556829 and the actual comparison depends on the value of the build ID truncated to 32-bits. This seems to often be negative and so lower than the apparent previous build ID causing us to think this is a downgrade. Cue nfroydnj saying I told you so because if I'd written this as a more traditional compare function as he suggested I probably would have caught this. Differential Revision: https://phabricator.services.mozilla.com/D33702 --HG-- extra : rebase_source : bb506c4ba4d75a68976bb114015d53cd41b4d4c3
157 lines
4.3 KiB
C++
157 lines
4.3 KiB
C++
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
#ifndef nsAppRunner_h__
|
|
#define nsAppRunner_h__
|
|
|
|
#ifdef XP_WIN
|
|
# include <windows.h>
|
|
# include "mozilla/WindowsConsole.h"
|
|
#else
|
|
# include <limits.h>
|
|
#endif
|
|
|
|
#ifndef MAXPATHLEN
|
|
# ifdef PATH_MAX
|
|
# define MAXPATHLEN PATH_MAX
|
|
# elif defined(_MAX_PATH)
|
|
# define MAXPATHLEN _MAX_PATH
|
|
# elif defined(CCHMAXPATH)
|
|
# define MAXPATHLEN CCHMAXPATH
|
|
# else
|
|
# define MAXPATHLEN 1024
|
|
# endif
|
|
#endif
|
|
|
|
#include "nsStringFwd.h"
|
|
#include "nsXULAppAPI.h"
|
|
|
|
class nsINativeAppSupport;
|
|
class nsXREDirProvider;
|
|
class nsIToolkitProfileService;
|
|
class nsIFile;
|
|
class nsIProfileLock;
|
|
class nsIProfileUnlocker;
|
|
class nsIFactory;
|
|
|
|
extern nsXREDirProvider* gDirServiceProvider;
|
|
|
|
// NOTE: gAppData will be null in embedded contexts.
|
|
extern const mozilla::XREAppData* gAppData;
|
|
extern bool gSafeMode;
|
|
|
|
extern int gArgc;
|
|
extern char** gArgv;
|
|
extern int gRestartArgc;
|
|
extern char** gRestartArgv;
|
|
extern bool gRestartedByOS;
|
|
extern bool gLogConsoleErrors;
|
|
extern nsString gAbsoluteArgv0Path;
|
|
|
|
extern bool gIsGtest;
|
|
|
|
namespace mozilla {
|
|
nsresult AppInfoConstructor(nsISupports* aOuter, const nsID& aIID,
|
|
void** aResult);
|
|
} // namespace mozilla
|
|
|
|
// Exported for gtests.
|
|
void BuildCompatVersion(const char* aAppVersion, const char* aAppBuildID,
|
|
const char* aToolkitBuildID, nsACString& aBuf);
|
|
|
|
/**
|
|
* Compares the provided compatibility versions. Returns 0 if they match,
|
|
* < 0 if the new version is considered an upgrade from the old version and
|
|
* > 0 if the new version is considered a downgrade from the old version.
|
|
*/
|
|
int32_t CompareCompatVersions(const nsACString& aOldCompatVersion,
|
|
const nsACString& aNewCompatVersion);
|
|
|
|
/**
|
|
* Create the nativeappsupport implementation.
|
|
*
|
|
* @note XPCOMInit has not happened yet.
|
|
*/
|
|
nsresult NS_CreateNativeAppSupport(nsINativeAppSupport** aResult);
|
|
already_AddRefed<nsINativeAppSupport> NS_GetNativeAppSupport();
|
|
|
|
nsresult NS_NewToolkitProfileService(nsIToolkitProfileService** aResult);
|
|
|
|
nsresult NS_NewToolkitProfileFactory(nsIFactory** aResult);
|
|
|
|
/**
|
|
* Try to acquire exclusive access to the specified profile directory.
|
|
*
|
|
* @param aPath
|
|
* The profile directory to lock.
|
|
* @param aTempPath
|
|
* The corresponding profile temporary directory.
|
|
* @param aUnlocker
|
|
* A callback interface used to attempt to unlock a profile that
|
|
* appears to be locked.
|
|
* @param aResult
|
|
* The resulting profile lock object (or null if the profile could
|
|
* not be locked).
|
|
*
|
|
* @return NS_ERROR_FILE_ACCESS_DENIED to indicate that the profile
|
|
* directory cannot be unlocked.
|
|
*/
|
|
nsresult NS_LockProfilePath(nsIFile* aPath, nsIFile* aTempPath,
|
|
nsIProfileUnlocker** aUnlocker,
|
|
nsIProfileLock** aResult);
|
|
|
|
void WriteConsoleLog();
|
|
|
|
void OverrideDefaultLocaleIfNeeded();
|
|
|
|
/**
|
|
* Allow exit() calls to complete. This should be done from a proper Gecko
|
|
* shutdown path. Otherwise we aim to catch improper shutdowns.
|
|
*/
|
|
void MozExpectedExit();
|
|
|
|
#ifdef XP_WIN
|
|
|
|
BOOL WinLaunchChild(const wchar_t* exePath, int argc, char** argv,
|
|
HANDLE userToken = nullptr, HANDLE* hProcess = nullptr);
|
|
|
|
# define PREF_WIN_REGISTER_APPLICATION_RESTART \
|
|
"toolkit.winRegisterApplicationRestart"
|
|
|
|
# if defined(MOZ_LAUNCHER_PROCESS)
|
|
# define PREF_WIN_LAUNCHER_PROCESS_ENABLED "browser.launcherProcess.enabled"
|
|
# endif // defined(MOZ_LAUNCHER_PROCESS)
|
|
#endif
|
|
|
|
namespace mozilla {
|
|
namespace startup {
|
|
Result<nsCOMPtr<nsIFile>, nsresult> GetIncompleteStartupFile(nsIFile* aProfLD);
|
|
|
|
extern GeckoProcessType sChildProcessType;
|
|
} // namespace startup
|
|
|
|
const char* PlatformBuildID();
|
|
|
|
} // namespace mozilla
|
|
|
|
/**
|
|
* Set up platform specific error handling such as suppressing DLL load dialog
|
|
* and the JIT debugger on Windows, and install unix signal handlers.
|
|
*/
|
|
void SetupErrorHandling(const char* progname);
|
|
|
|
#ifdef MOZ_ASAN_REPORTER
|
|
extern "C" {
|
|
void MOZ_EXPORT __sanitizer_set_report_path(const char* path);
|
|
}
|
|
void setASanReporterPath(nsIFile* aDir);
|
|
#endif
|
|
|
|
#ifdef MOZ_WAYLAND
|
|
bool IsWaylandDisabled();
|
|
#endif
|
|
|
|
#endif // nsAppRunner_h__
|