зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1298989 Don't show notification on theme install from discovery pane r=jaws
MozReview-Commit-ID: 5G8PNFKfJkc --HG-- extra : rebase_source : 85513135d4f2f922dc0cbcf76b0d83955536dcdc
This commit is contained in:
Родитель
e0b8951dbd
Коммит
9e85aad084
|
@ -496,8 +496,27 @@ var LightWeightThemeWebInstaller = {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let uri = makeURI(baseURI);
|
||||||
|
|
||||||
|
// A notification bar with the option to undo is normally shown after a
|
||||||
|
// theme is installed. But the discovery pane served from the url(s)
|
||||||
|
// below has its own toggle switch for quick undos, so don't show the
|
||||||
|
// notification in that case.
|
||||||
|
let notify = uri.prePath != "https://discovery.addons.mozilla.org";
|
||||||
|
if (notify) {
|
||||||
|
try {
|
||||||
|
if (Services.prefs.getBoolPref("extensions.webapi.testing")
|
||||||
|
&& (uri.prePath == "https://discovery.addons.allizom.org"
|
||||||
|
|| uri.prePath == "https://discovery.addons-dev.allizom.org")) {
|
||||||
|
notify = false;
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
// getBoolPref() throws if the testing pref isn't set. ignore it.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (this._isAllowed(baseURI)) {
|
if (this._isAllowed(baseURI)) {
|
||||||
this._install(data);
|
this._install(data, notify);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -507,12 +526,12 @@ var LightWeightThemeWebInstaller = {
|
||||||
gNavigatorBundle.getString("lwthemeInstallRequest.allowButton.accesskey");
|
gNavigatorBundle.getString("lwthemeInstallRequest.allowButton.accesskey");
|
||||||
let message =
|
let message =
|
||||||
gNavigatorBundle.getFormattedString("lwthemeInstallRequest.message",
|
gNavigatorBundle.getFormattedString("lwthemeInstallRequest.message",
|
||||||
[makeURI(baseURI).host]);
|
[uri.host]);
|
||||||
let buttons = [{
|
let buttons = [{
|
||||||
label: allowButtonText,
|
label: allowButtonText,
|
||||||
accessKey: allowButtonAccesskey,
|
accessKey: allowButtonAccesskey,
|
||||||
callback: function () {
|
callback: function () {
|
||||||
LightWeightThemeWebInstaller._install(data);
|
LightWeightThemeWebInstaller._install(data, notify);
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
|
|
||||||
|
@ -526,7 +545,7 @@ var LightWeightThemeWebInstaller = {
|
||||||
notificationBar.persistence = 1;
|
notificationBar.persistence = 1;
|
||||||
},
|
},
|
||||||
|
|
||||||
_install: function (newLWTheme) {
|
_install: function (newLWTheme, notify) {
|
||||||
let previousLWTheme = this._manager.currentTheme;
|
let previousLWTheme = this._manager.currentTheme;
|
||||||
|
|
||||||
let listener = {
|
let listener = {
|
||||||
|
@ -556,8 +575,10 @@ var LightWeightThemeWebInstaller = {
|
||||||
},
|
},
|
||||||
|
|
||||||
onEnabled: function(aAddon) {
|
onEnabled: function(aAddon) {
|
||||||
|
if (notify) {
|
||||||
LightWeightThemeWebInstaller._postInstallNotification(newLWTheme, previousLWTheme);
|
LightWeightThemeWebInstaller._postInstallNotification(newLWTheme, previousLWTheme);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
AddonManager.addAddonListener(listener);
|
AddonManager.addAddonListener(listener);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче