mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-20 16:55:40 +00:00
Bug 619432 - AUS notification fails and is not offered again if Fennec closes during update [r=mfinkle]
This commit is contained in:
parent
9b2f29ebbe
commit
8b9bd8c0e4
@ -508,6 +508,12 @@ var BrowserUI = {
|
||||
PageActions.init();
|
||||
FullScreenVideo.init();
|
||||
NewTabPopup.init();
|
||||
|
||||
#ifdef MOZ_UPDATER
|
||||
// Check for updates in progress
|
||||
let updatePrompt = Cc["@mozilla.org/updates/update-prompt;1"].createInstance(Ci.nsIUpdatePrompt);
|
||||
updatePrompt.checkForUpdates();
|
||||
#endif
|
||||
}, false);
|
||||
},
|
||||
|
||||
|
@ -40,6 +40,7 @@ const Ci = Components.interfaces;
|
||||
const Cu = Components.utils;
|
||||
|
||||
const UPDATE_NOTIFICATION_NAME = "update-app";
|
||||
const UPDATE_NOTIFICATION_ICON = "drawable://alert_download_progress";
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
@ -114,8 +115,7 @@ UpdatePrompt.prototype = {
|
||||
let aus = Cc["@mozilla.org/updates/update-service;1"].getService(Ci.nsIApplicationUpdateService);
|
||||
if (aus.downloadUpdate(aUpdate, true) != "failed") {
|
||||
let title = gBrowserBundle.formatStringFromName("alertDownloadsStart", [aUpdate.name], 1);
|
||||
let imageUrl = "drawable://alert_download_progress";
|
||||
this._showNotification(aUpdate, title, "", imageUrl, "download");
|
||||
this._showNotification(aUpdate, title, "", UPDATE_NOTIFICATION_ICON, "download");
|
||||
|
||||
// Add this UI as a listener for active downloads
|
||||
aus.addDownloadListener(this);
|
||||
@ -144,9 +144,25 @@ UpdatePrompt.prototype = {
|
||||
// -------------------------
|
||||
// nsIUpdatePrompt interface
|
||||
// -------------------------
|
||||
|
||||
|
||||
// Right now this is used only to check for updates in progress
|
||||
checkForUpdates: function UP_checkForUpdates() {
|
||||
// NOT IMPL
|
||||
if (!this._enabled)
|
||||
return;
|
||||
|
||||
let aus = Cc["@mozilla.org/updates/update-service;1"].getService(Ci.nsIApplicationUpdateService);
|
||||
if (!aus.isDownloading)
|
||||
return;
|
||||
|
||||
let updateManager = Cc["@mozilla.org/updates/update-manager;1"].getService(Ci.nsIUpdateManager);
|
||||
|
||||
let updateName = updateManager.activeUpdate ? updateManager.activeUpdate.name : gBrandBundle.GetStringFromName("brandShortName");
|
||||
let title = gBrowserBundle.formatStringFromName("alertDownloadsStart", [updateName], 1);
|
||||
|
||||
this._showNotification(updateManager.activeUpdate, title, "", UPDATE_NOTIFICATION_ICON, "downloading");
|
||||
|
||||
aus.removeDownloadListener(this); // just in case it's already added
|
||||
aus.addDownloadListener(this);
|
||||
},
|
||||
|
||||
showUpdateAvailable: function UP_showUpdateAvailable(aUpdate) {
|
||||
|
Loading…
Reference in New Issue
Block a user