mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-21 14:47:31 +09:00
[Pale-Moon] Issue #1737 - Part 4: Scope gXPInstallObserver.observe case statements.
This is needed because the large blocks of code otherwise have redeclarations of let variables.
This commit is contained in:
parent
6c51c7704a
commit
fa4c122fad
1 changed files with 12 additions and 6 deletions
|
|
@ -74,7 +74,7 @@ const gXPInstallObserver = {
|
||||||
var options = { timeout: Date.now() + 30000 };
|
var options = { timeout: Date.now() + 30000 };
|
||||||
|
|
||||||
switch (aTopic) {
|
switch (aTopic) {
|
||||||
case "addon-install-disabled":
|
case "addon-install-disabled": {
|
||||||
notificationID = "xpinstall-disabled"
|
notificationID = "xpinstall-disabled"
|
||||||
|
|
||||||
if (gPrefService.prefIsLocked("xpinstall.enabled")) {
|
if (gPrefService.prefIsLocked("xpinstall.enabled")) {
|
||||||
|
|
@ -95,7 +95,8 @@ const gXPInstallObserver = {
|
||||||
PopupNotifications.show(browser, notificationID, messageString, anchorID,
|
PopupNotifications.show(browser, notificationID, messageString, anchorID,
|
||||||
action, null, options);
|
action, null, options);
|
||||||
break;
|
break;
|
||||||
case "addon-install-origin-blocked":
|
}
|
||||||
|
case "addon-install-origin-blocked": {
|
||||||
messageString = gNavigatorBundle.getFormattedString("xpinstallPromptWarningOrigin",
|
messageString = gNavigatorBundle.getFormattedString("xpinstallPromptWarningOrigin",
|
||||||
[brandShortName]);
|
[brandShortName]);
|
||||||
|
|
||||||
|
|
@ -104,7 +105,8 @@ const gXPInstallObserver = {
|
||||||
null, null, options);
|
null, null, options);
|
||||||
removeNotificationOnEnd(popup, installInfo.installs);
|
removeNotificationOnEnd(popup, installInfo.installs);
|
||||||
break;
|
break;
|
||||||
case "addon-install-blocked":
|
}
|
||||||
|
case "addon-install-blocked": {
|
||||||
let originatingHost;
|
let originatingHost;
|
||||||
try {
|
try {
|
||||||
originatingHost = installInfo.originatingURI.host;
|
originatingHost = installInfo.originatingURI.host;
|
||||||
|
|
@ -128,7 +130,8 @@ const gXPInstallObserver = {
|
||||||
anchorID, action, null, options);
|
anchorID, action, null, options);
|
||||||
removeNotificationOnEnd(popup, installInfo.installs);
|
removeNotificationOnEnd(popup, installInfo.installs);
|
||||||
break;
|
break;
|
||||||
case "addon-install-started":
|
}
|
||||||
|
case "addon-install-started": {
|
||||||
var needsDownload = function needsDownload(aInstall) {
|
var needsDownload = function needsDownload(aInstall) {
|
||||||
return aInstall.state != AddonManager.STATE_DOWNLOADED;
|
return aInstall.state != AddonManager.STATE_DOWNLOADED;
|
||||||
}
|
}
|
||||||
|
|
@ -153,7 +156,8 @@ const gXPInstallObserver = {
|
||||||
PopupNotifications.show(browser, notificationID, messageString, anchorID,
|
PopupNotifications.show(browser, notificationID, messageString, anchorID,
|
||||||
null, null, options);
|
null, null, options);
|
||||||
break;
|
break;
|
||||||
case "addon-install-failed":
|
}
|
||||||
|
case "addon-install-failed": {
|
||||||
// TODO This isn't terribly ideal for the multiple failure case
|
// TODO This isn't terribly ideal for the multiple failure case
|
||||||
for (let install of installInfo.installs) {
|
for (let install of installInfo.installs) {
|
||||||
let host = (installInfo.originatingURI instanceof Ci.nsIStandardURL) &&
|
let host = (installInfo.originatingURI instanceof Ci.nsIStandardURL) &&
|
||||||
|
|
@ -186,7 +190,8 @@ const gXPInstallObserver = {
|
||||||
action, null, options);
|
action, null, options);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "addon-install-complete":
|
}
|
||||||
|
case "addon-install-complete": {
|
||||||
var needsRestart = installInfo.installs.some(function(i) {
|
var needsRestart = installInfo.installs.some(function(i) {
|
||||||
return i.addon.pendingOperations != AddonManager.PENDING_NONE;
|
return i.addon.pendingOperations != AddonManager.PENDING_NONE;
|
||||||
});
|
});
|
||||||
|
|
@ -218,6 +223,7 @@ const gXPInstallObserver = {
|
||||||
PopupNotifications.show(browser, notificationID, messageString, anchorID,
|
PopupNotifications.show(browser, notificationID, messageString, anchorID,
|
||||||
action, null, options);
|
action, null, options);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue