mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-10 22:09:32 +00:00
1 of 2 - Main patch for Bug 813322 - Add ability to control time interval for restart prompt to apply update. r=bbondy
This commit is contained in:
parent
a82041371e
commit
df6dccf8c7
@ -87,7 +87,7 @@ interface nsIUpdatePatch : nsISupports
|
||||
* that the front end and other application services can use to learn more
|
||||
* about what is going on.
|
||||
*/
|
||||
[scriptable, uuid(b10bbf29-5a54-4e1e-aa64-c4e4e5819a52)]
|
||||
[scriptable, uuid(8f7185a7-056a-45a8-985c-1cb39cf7b7a8)]
|
||||
interface nsIUpdate : nsISupports
|
||||
{
|
||||
/**
|
||||
@ -182,6 +182,13 @@ interface nsIUpdate : nsISupports
|
||||
* present in the app.update.surveyURL preference.
|
||||
*/
|
||||
attribute boolean showSurvey;
|
||||
|
||||
/**
|
||||
* Allows overriding the default amount of time in seconds before prompting the
|
||||
* user to apply an update. If not specified, the value of
|
||||
* app.update.promptWaitTime will be used.
|
||||
*/
|
||||
attribute long long promptWaitTime;
|
||||
|
||||
/**
|
||||
* Whether or not the update being downloaded is a complete replacement of
|
||||
|
@ -1251,7 +1251,8 @@ function Update(update) {
|
||||
this.showPrompt = false;
|
||||
this.showSurvey = false;
|
||||
this.showNeverForVersion = false;
|
||||
this.channel = "default"
|
||||
this.channel = "default";
|
||||
this.promptWaitTime = getPref("getIntPref", PREF_APP_UPDATE_PROMPTWAITTIME, 43200);
|
||||
|
||||
// Null <update>, assume this is a message container and do no
|
||||
// further initialization
|
||||
@ -1314,6 +1315,11 @@ function Update(update) {
|
||||
this.showNeverForVersion = attr.value == "true";
|
||||
else if (attr.name == "showPrompt")
|
||||
this.showPrompt = attr.value == "true";
|
||||
else if (attr.name == "promptWaitTime")
|
||||
{
|
||||
if(!isNaN(attr.value))
|
||||
this.promptWaitTime = parseInt(attr.value);
|
||||
}
|
||||
else if (attr.name == "showSurvey")
|
||||
this.showSurvey = attr.value == "true";
|
||||
else if (attr.name == "version") {
|
||||
@ -1453,6 +1459,7 @@ Update.prototype = {
|
||||
update.setAttribute("serviceURL", this.serviceURL);
|
||||
update.setAttribute("showNeverForVersion", this.showNeverForVersion);
|
||||
update.setAttribute("showPrompt", this.showPrompt);
|
||||
update.setAttribute("promptWaitTime", this.promptWaitTime);
|
||||
update.setAttribute("showSurvey", this.showSurvey);
|
||||
update.setAttribute("type", this.type);
|
||||
// for backwards compatibility in case the user downgrades
|
||||
@ -3932,11 +3939,11 @@ UpdatePrompt.prototype = {
|
||||
return;
|
||||
}
|
||||
|
||||
// Give the user x seconds to react before showing the big UI
|
||||
var promptWaitTime = getPref("getIntPref", PREF_APP_UPDATE_PROMPTWAITTIME, 43200);
|
||||
// Give the user x seconds to react before prompting as defined by
|
||||
// promptWaitTime
|
||||
observer.timer = Cc["@mozilla.org/timer;1"].
|
||||
createInstance(Ci.nsITimer);
|
||||
observer.timer.initWithCallback(observer, promptWaitTime * 1000,
|
||||
observer.timer.initWithCallback(observer, update.promptWaitTime * 1000,
|
||||
observer.timer.TYPE_ONE_SHOT);
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user