Bug 758463 - Windows XP does not clear prefetch on updates. r=jimm
This commit is contained in:
@@ -35,7 +35,8 @@ EXTRA_COMPONENTS = nsSetDefaultBrowser.js nsSetDefaultBrowser.manifest
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
DEFINES += -DMOZ_APP_NAME=\"$(MOZ_APP_NAME)\"
|
||||
DEFINES += -DMOZ_APP_NAME=\"$(MOZ_APP_NAME)\" \
|
||||
-DMOZ_APP_VERSION=\"$(MOZ_APP_VERSION)\"
|
||||
|
||||
CXXFLAGS += $(TK_CFLAGS)
|
||||
|
||||
|
||||
@@ -201,7 +201,8 @@ static SETTING gDDESettings[] = {
|
||||
#include "updatehelper.h"
|
||||
#include "updatehelper.cpp"
|
||||
|
||||
static const char kPrefetchClearedPref[] = "app.update.service.prefetchCleared";
|
||||
static const char *kPrefetchClearedPref =
|
||||
"app.update.service.lastVersionPrefetchCleared";
|
||||
static nsCOMPtr<nsIThread> sThread;
|
||||
#endif
|
||||
|
||||
@@ -1016,17 +1017,20 @@ nsWindowsShellService::nsWindowsShellService() :
|
||||
}
|
||||
|
||||
// check to see if we have attempted to do the one time operation of clearing
|
||||
// the prefetch.
|
||||
bool prefetchCleared;
|
||||
// the prefetch. We do it once per version upgrade.
|
||||
nsCString lastClearedVer;
|
||||
nsCOMPtr<nsIPrefBranch> prefBranch;
|
||||
nsCOMPtr<nsIPrefService> prefs =
|
||||
do_GetService(NS_PREFSERVICE_CONTRACTID);
|
||||
if (!prefs ||
|
||||
NS_FAILED(prefs->GetBranch(nsnull, getter_AddRefs(prefBranch))) ||
|
||||
(NS_SUCCEEDED(prefBranch->GetBoolPref(kPrefetchClearedPref,
|
||||
&prefetchCleared)) &&
|
||||
prefetchCleared)) {
|
||||
return;
|
||||
(NS_SUCCEEDED(prefBranch->GetCharPref(kPrefetchClearedPref,
|
||||
getter_Copies(lastClearedVer))))) {
|
||||
// If the versions are the same, then bail out early. We only want to clear
|
||||
// once per version.
|
||||
if (!strcmp(MOZ_APP_VERSION, lastClearedVer.get())) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// In a minute after startup is definitely complete, launch the
|
||||
@@ -1097,7 +1101,7 @@ nsWindowsShellService::LaunchPrefetchClearCommand(nsITimer *aTimer, void*)
|
||||
do_GetService(NS_PREFSERVICE_CONTRACTID);
|
||||
if (prefs) {
|
||||
if (NS_SUCCEEDED(prefs->GetBranch(nsnull, getter_AddRefs(prefBranch)))) {
|
||||
prefBranch->SetBoolPref(kPrefetchClearedPref, true);
|
||||
prefBranch->SetCharPref(kPrefetchClearedPref, MOZ_APP_VERSION);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,18 +27,6 @@ bool gServiceControlStopping = false;
|
||||
|
||||
BOOL GetLogDirectoryPath(WCHAR *path);
|
||||
|
||||
/**
|
||||
* Wraps all commands that should be executed by the service on each install
|
||||
* and upgrade.
|
||||
*/
|
||||
void
|
||||
RunCommandsForEachUpgrade()
|
||||
{
|
||||
LOG(("Running install/upgrade commands...\n"));
|
||||
ClearKnownPrefetch();
|
||||
LOG(("Finished install/upgrade commands\n"));
|
||||
}
|
||||
|
||||
int
|
||||
wmain(int argc, WCHAR **argv)
|
||||
{
|
||||
@@ -84,9 +72,8 @@ wmain(int argc, WCHAR **argv)
|
||||
}
|
||||
LOG(("Upgrading service if installed...\n"));
|
||||
|
||||
bool ret = SvcInstall(UpgradeSvc);
|
||||
RunCommandsForEachUpgrade();
|
||||
if (!ret) {
|
||||
|
||||
if (!SvcInstall(UpgradeSvc)) {
|
||||
LOG(("Could not upgrade service (%d)\n", GetLastError()));
|
||||
LogFinish();
|
||||
return 1;
|
||||
|
||||
Reference in New Issue
Block a user