From 38aafc9504e38323decb8b764f564f6e04541e77 Mon Sep 17 00:00:00 2001 From: "alqahira%ardisson.org" Date: Thu, 24 Jun 2010 03:44:15 +0000 Subject: [PATCH] Bug 569522: Try to ensure that update checks never run with out-of-date URLs. Patch by smorgan, sr=pink, a/Cm2.0.4=me git-svn-id: svn://10.0.0.236/trunk@260548 18797224-902f-48f8-a5cc-f745e15eee43 --- .../camino/src/preferences/PreferenceManager.mm | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/mozilla/camino/src/preferences/PreferenceManager.mm b/mozilla/camino/src/preferences/PreferenceManager.mm index 8463d0a1740..51802444988 100644 --- a/mozilla/camino/src/preferences/PreferenceManager.mm +++ b/mozilla/camino/src/preferences/PreferenceManager.mm @@ -672,20 +672,31 @@ static BOOL gMadePrefManager; // This block can be removed in some later release, after we can assume that // everyone has run something later than 1.6.x NSString* const kSparkleCheckIntervalKey = @"SUScheduledCheckInterval"; + NSString* const kSparkleUpdateChecksEnabled = @"SUEnableAutomaticChecks"; NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; if ([defaults objectForKey:kSparkleCheckIntervalKey]) { BOOL wasEnabled = [defaults integerForKey:kSparkleCheckIntervalKey] > 0; [defaults removeObjectForKey:kSparkleCheckIntervalKey]; if (wasEnabled) - [defaults removeObjectForKey:@"SUEnableAutomaticChecks"]; + [defaults removeObjectForKey:kSparkleUpdateChecksEnabled]; else [[SUUpdater sharedUpdater] setAutomaticallyChecksForUpdates:NO]; } - // If updates are disabled for this build, don't bother setting up the manifest URL. NSBundle* mainBundle = [NSBundle mainBundle]; - if (![[mainBundle objectForInfoDictionaryKey:@"SUEnableAutomaticChecks"] boolValue]) + if (![[mainBundle objectForInfoDictionaryKey:kSparkleUpdateChecksEnabled] boolValue]) { + // If SUEnableAutomaticChecks is set to YES in the user's prefs, that will + // override our plist setting, and Sparkle will check for updates anyway, + // which shouldn't happen. In the 2.0+ setup, SUEnableAutomaticChecks should + // never be set to YES at the defaults level (the options are NO at the + // defaults level, or YES at the plist level and nothing at the user level), + // so just unconditionally clear it if that somehow happens. + if ([[defaults objectForKey:kSparkleUpdateChecksEnabled] boolValue]) + [defaults removeObjectForKey:kSparkleUpdateChecksEnabled]; + // If updates are disabled for this build, don't bother setting up the + // manifest URL. return; + } // Get the base auto-update manifest URL. NSString* baseURL = [self getStringPref:kGeckoPrefUpdateURLOverride