Bug 885641 - Force an update check if the build is older than some reasonable value. r=gavin, r=rstrong

This commit is contained in:
Doug Turner 2013-07-30 20:19:58 -07:00
parent 03519cc80e
commit db228ccd35
6 changed files with 53 additions and 0 deletions

View File

@ -67,6 +67,13 @@ pref("extensions.autoDisableScopes", 15);
// Dictionary download preference
pref("browser.dictionaries.download.url", "https://addons.mozilla.org/%LOCALE%/firefox/dictionaries/");
// At startup, should we check to see if the installation
// date is older than some threshold
pref("app.update.checkInstallTime", true);
// The number of days a binary is permitted to be old without checking is defined in
// firefox-branding.js (app.update.checkInstallTime.days)
// The minimum delay in seconds for the timer to fire.
// default=2 minutes
pref("app.update.timerMinimumDelay", 120);

View File

@ -21,6 +21,11 @@ pref("app.update.url.manual", "https://www.mozilla.org/firefox/aurora/");
// supplied in the "An update is available" page of the update wizard.
pref("app.update.url.details", "https://www.mozilla.org/firefox/aurora/");
// The number of days a binary is permitted to be old
// without checking for an update. This assumes that
// app.update.checkInstallTime is true.
pref("app.update.checkInstallTime.days", 2);
// Search codes belong only in builds with official branding
pref("browser.search.param.yahoo-fr", "");
pref("browser.search.param.yahoo-fr-cjkt", ""); // now unused

View File

@ -18,6 +18,11 @@ pref("app.update.url.manual", "https://nightly.mozilla.org");
// supplied in the "An update is available" page of the update wizard.
pref("app.update.url.details", "https://nightly.mozilla.org");
// The number of days a binary is permitted to be old
// without checking for an update. This assumes that
// app.update.checkInstallTime is true.
pref("app.update.checkInstallTime.days", 2);
// Search codes belong only in builds with official branding
pref("browser.search.param.yahoo-fr", "");
pref("browser.search.param.yahoo-fr-cjkt", ""); // now unused

View File

@ -18,6 +18,11 @@ pref("app.update.url.manual", "https://www.mozilla.org/firefox/");
// supplied in the "An update is available" page of the update wizard.
pref("app.update.url.details", "https://www.mozilla.org/%LOCALE%/firefox/notes");
// The number of days a binary is permitted to be old
// without checking for an update. This assumes that
// app.update.checkInstallTime is true.
pref("app.update.checkInstallTime.days", 63);
pref("browser.search.param.ms-pc", "MOZI");
pref("browser.search.param.yahoo-fr", "moz35");
pref("browser.search.param.yahoo-fr-cjkt", "moz35"); // now unused

View File

@ -18,6 +18,11 @@ pref("app.update.url.manual", "https://nightly.mozilla.org");
// supplied in the "An update is available" page of the update wizard.
pref("app.update.url.details", "https://nightly.mozilla.org");
// The number of days a binary is permitted to be old
// without checking for an update. This assumes that
// app.update.checkInstallTime is true.
pref("app.update.checkInstallTime.days", 2);
// Search codes belong only in builds with official branding
pref("browser.search.param.yahoo-fr", "");
pref("browser.search.param.yahoo-fr-cjkt", ""); // now unused

View File

@ -466,6 +466,30 @@ BrowserGlue.prototype = {
Services.obs.notifyObservers(null, "browser-ui-startup-complete", "");
},
_checkForOldBuildUpdates: function () {
// check for update if our build is old
if (Services.prefs.getBoolPref("app.update.enabled") &&
Services.prefs.getBoolPref("app.update.checkInstallTime")) {
let buildID = Services.appinfo.appBuildID;
let today = new Date().getTime();
let buildDate = new Date(buildID.slice(0,4), // year
buildID.slice(4,6) - 1, // months are zero-based.
buildID.slice(6,8), // day
buildID.slice(8,10), // hour
buildID.slice(10,12), // min
buildID.slice(12,14)) // ms
.getTime();
const millisecondsIn24Hours = 86400000;
let acceptableAge = Services.prefs.getIntPref("app.update.checkInstallTime.days") * millisecondsIn24Hours;
if (buildDate + acceptableAge < today) {
Cc["@mozilla.org/updates/update-service;1"].getService(Ci.nsIApplicationUpdateService).checkForBackgroundUpdates();
}
}
},
_trackSlowStartup: function () {
if (Services.startup.interrupted ||
Services.prefs.getBoolPref("browser.slowStartup.notificationDisabled"))
@ -583,6 +607,8 @@ BrowserGlue.prototype = {
Date.now() - lastUse >= OFFER_PROFILE_RESET_INTERVAL_MS) {
this._resetUnusedProfileNotification();
}
this._checkForOldBuildUpdates();
},
/**