mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 610689 - "No prompt on start of an extension download from AMO" [r=mark.finkle]
This commit is contained in:
parent
916742335f
commit
0360b72dde
@ -325,6 +325,7 @@ var Browser = {
|
||||
|
||||
var os = Services.obs;
|
||||
os.addObserver(XPInstallObserver, "addon-install-blocked", false);
|
||||
os.addObserver(XPInstallObserver, "addon-install-started", false);
|
||||
os.addObserver(SessionHistoryObserver, "browser:purge-session-history", false);
|
||||
os.addObserver(ContentCrashObserver, "ipc:content-shutdown", false);
|
||||
os.addObserver(MemoryObserver, "memory-pressure", false);
|
||||
@ -457,6 +458,7 @@ var Browser = {
|
||||
|
||||
var os = Services.obs;
|
||||
os.removeObserver(XPInstallObserver, "addon-install-blocked");
|
||||
os.removeObserver(XPInstallObserver, "addon-install-started");
|
||||
os.removeObserver(SessionHistoryObserver, "browser:purge-session-history");
|
||||
os.removeObserver(ContentCrashObserver, "ipc:content-shutdown");
|
||||
os.removeObserver(MemoryObserver, "memory-pressure");
|
||||
@ -1993,6 +1995,10 @@ var XPInstallObserver = {
|
||||
{
|
||||
var brandBundle = document.getElementById("bundle_brand");
|
||||
switch (aTopic) {
|
||||
case "addon-install-started":
|
||||
var messageString = Elements.browserBundle.getString("alertAddonsDownloading");
|
||||
ExtensionsView.showAlert(messageString);
|
||||
break;
|
||||
case "addon-install-blocked":
|
||||
var installInfo = aSubject.QueryInterface(Ci.amIWebInstallInfo);
|
||||
var host = installInfo.originatingURI.host;
|
||||
|
@ -711,6 +711,23 @@ var ExtensionsView = {
|
||||
element.setAttribute("updating", "true");
|
||||
break;
|
||||
}
|
||||
},
|
||||
showAlert: function ev_showAlert(aMessage) {
|
||||
if (this.visible)
|
||||
return;
|
||||
|
||||
let strings = Elements.browserBundle;
|
||||
|
||||
let observer = {
|
||||
observe: function (aSubject, aTopic, aData) {
|
||||
if (aTopic == "alertclickcallback")
|
||||
BrowserUI.showPanel("addons-container");
|
||||
}
|
||||
};
|
||||
|
||||
let alerts = Cc["@mozilla.org/alerts-service;1"].getService(Ci.nsIAlertsService);
|
||||
alerts.showAlertNotification(URI_GENERIC_ICON_XPINSTALL, strings.getString("alertAddons"),
|
||||
aMessage, true, "", observer, "addons");
|
||||
}
|
||||
};
|
||||
|
||||
@ -826,7 +843,13 @@ AddonInstallListener.prototype = {
|
||||
},
|
||||
|
||||
onDownloadProgress: function xpidm_onDownloadProgress(aInstall) {
|
||||
var element = ExtensionsView.getElementForAddon(aInstall.sourceURI.spec);
|
||||
let element = ExtensionsView.getElementForAddon(aInstall.sourceURI.spec);
|
||||
|
||||
#ifdef ANDROID
|
||||
let alertsService = Cc["@mozilla.org/alerts-service;1"].getService(Ci.nsIAlertsService);
|
||||
let progressListener = alertsService.QueryInterface(Ci.nsIAlertsProgressListener);
|
||||
progressListener.onProgress("addons", aInstall.progress, aInstall.maxProgress);
|
||||
#endif
|
||||
if (!element)
|
||||
return;
|
||||
|
||||
@ -867,31 +890,13 @@ AddonInstallListener.prototype = {
|
||||
messageString = messageString.replace("#3", brandShortName);
|
||||
messageString = messageString.replace("#4", Services.appinfo.version);
|
||||
|
||||
this._showAlert(messageString);
|
||||
ExtensionsView.showAlert(messageString);
|
||||
},
|
||||
|
||||
_showInstallCompleteAlert: function xpidm_showAlert(aSucceeded) {
|
||||
let strings = Elements.browserBundle;
|
||||
let msg = aSucceeded ? strings.getString("alertAddonsInstalled") :
|
||||
strings.getString("alertAddonsFail");
|
||||
this._showAlert(msg);
|
||||
ExtensionsView.showAlert(msg);
|
||||
},
|
||||
|
||||
_showAlert: function xpidm_showAlert(aMessage) {
|
||||
if (ExtensionsView.visible)
|
||||
return;
|
||||
|
||||
let strings = Elements.browserBundle;
|
||||
|
||||
let observer = {
|
||||
observe: function (aSubject, aTopic, aData) {
|
||||
if (aTopic == "alertclickcallback")
|
||||
BrowserUI.showPanel("addons-container");
|
||||
}
|
||||
};
|
||||
|
||||
let alerts = Cc["@mozilla.org/alerts-service;1"].getService(Ci.nsIAlertsService);
|
||||
alerts.showAlertNotification(URI_GENERIC_ICON_XPINSTALL, strings.getString("alertAddons"),
|
||||
aMessage, true, "", observer, "addons");
|
||||
}
|
||||
};
|
||||
|
@ -84,6 +84,7 @@ downloadsDeleteTitle=Delete File
|
||||
|
||||
# Alerts
|
||||
alertAddons=Add-ons
|
||||
alertAddonsDownloading=Downloading add-on
|
||||
alertAddonsInstalling=Installing add-on
|
||||
alertAddonsInstalled=Installation complete. Restart required.
|
||||
alertAddonsFail=Installation failed
|
||||
|
Loading…
Reference in New Issue
Block a user