Remove conditional MOZ_MAINTENANCE_SERVICE code

Tag #145
This commit is contained in:
wolfbeast 2019-02-20 10:54:51 +01:00 committed by Roy Tam
commit 03821e0bfc
30 changed files with 1 additions and 1423 deletions

View file

@ -119,9 +119,6 @@ struct UpdateServerThreadArgs
#endif
#ifdef XP_WIN
#ifdef MOZ_MAINTENANCE_SERVICE
#include "registrycertificates.h"
#endif
BOOL PathAppendSafe(LPWSTR base, LPCWSTR extra);
BOOL PathGetSiblingFilePath(LPWSTR destinationBuffer,
LPCWSTR siblingFilePath,
@ -2024,13 +2021,6 @@ LaunchWinPostProcess(const WCHAR *installationDir,
return false;
}
#if !defined(TEST_UPDATER) && defined(MOZ_MAINTENANCE_SERVICE)
if (sUsingService &&
!DoesBinaryMatchAllowedCertificates(installationDir, exefullpath)) {
return false;
}
#endif
WCHAR dlogFile[MAX_PATH + 1];
if (!PathGetSiblingFilePath(dlogFile, exefullpath, L"uninstall.update")) {
return false;
@ -2188,40 +2178,6 @@ WriteStatusFile(int status)
WriteStatusFile(text);
}
#ifdef MOZ_MAINTENANCE_SERVICE
/*
* Read the update.status file and sets isPendingService to true if
* the status is set to pending-service.
*
* @param isPendingService Out parameter for specifying if the status
* is set to pending-service or not.
* @return true if the information was retrieved and it is pending
* or pending-service.
*/
static bool
IsUpdateStatusPendingService()
{
NS_tchar filename[MAXPATHLEN];
NS_tsnprintf(filename, sizeof(filename)/sizeof(filename[0]),
NS_T("%s/update.status"), gPatchDirPath);
AutoFile file(NS_tfopen(filename, NS_T("rb")));
if (file == nullptr)
return false;
char buf[32] = { 0 };
fread(buf, sizeof(buf), 1, file);
const char kPendingService[] = "pending-service";
const char kAppliedService[] = "applied-service";
return (strncmp(buf, kPendingService,
sizeof(kPendingService) - 1) == 0) ||
(strncmp(buf, kAppliedService,
sizeof(kAppliedService) - 1) == 0);
}
#endif
#ifdef XP_WIN
/*
* Read the update.status file and sets isSuccess to true if
@ -2813,20 +2769,6 @@ int NS_main(int argc, NS_tchar **argv)
bool testOnlyFallbackKeyExists = false;
bool noServiceFallback = false;
// We never want the service to be used unless we build with
// the maintenance service.
#ifdef MOZ_MAINTENANCE_SERVICE
useService = IsUpdateStatusPendingService();
#ifdef TEST_UPDATER
noServiceFallback = EnvHasValue("MOZ_NO_SERVICE_FALLBACK");
putenv(const_cast<char*>("MOZ_NO_SERVICE_FALLBACK="));
// Our tests run with a different apply directory for each test.
// We use this registry key on our test slaves to store the
// allowed name/issuers.
testOnlyFallbackKeyExists = DoesFallbackKeyExist();
#endif
#endif
// Remove everything except close window from the context menu
{
HKEY hkApp = nullptr;
@ -3030,10 +2972,6 @@ int NS_main(int argc, NS_tchar **argv)
#endif
#ifdef XP_WIN
#ifdef MOZ_MAINTENANCE_SERVICE
sUsingService = EnvHasValue("MOZ_USING_SERVICE");
putenv(const_cast<char*>("MOZ_USING_SERVICE="));
#endif
// lastFallbackError keeps track of the last error for the service not being
// used, in case of an error when fallback is not enabled we write the
// error to the update.status file.