author | Andrew Swan <aswan@mozilla.com> |
Tue, 06 Sep 2016 22:32:31 -0700 | |
changeset 319315 | ea865d0587762a8b2dd02ea95661745ae00d9c47 |
parent 319314 | 7bd25d3fff7426578e5ac4c2d1e499f53b54bc8f |
child 319316 | 7bc2c36d07d4aaac8cbc5384f50b3beb4f27c66e |
push id | 30869 |
push user | philringnalda@gmail.com |
push date | Wed, 26 Oct 2016 04:57:48 +0000 |
treeherder | mozilla-central@9471b3c49b2c [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | jaws |
bugs | 1298989 |
milestone | 52.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/browser/base/content/browser-addons.js +++ b/browser/base/content/browser-addons.js @@ -491,47 +491,66 @@ var LightWeightThemeWebInstaller = { _installRequest: function (dataString, baseURI) { let data = this._manager.parseTheme(dataString, baseURI); if (!data) { 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)) { - this._install(data); + this._install(data, notify); return; } let allowButtonText = gNavigatorBundle.getString("lwthemeInstallRequest.allowButton"); let allowButtonAccesskey = gNavigatorBundle.getString("lwthemeInstallRequest.allowButton.accesskey"); let message = gNavigatorBundle.getFormattedString("lwthemeInstallRequest.message", - [makeURI(baseURI).host]); + [uri.host]); let buttons = [{ label: allowButtonText, accessKey: allowButtonAccesskey, callback: function () { - LightWeightThemeWebInstaller._install(data); + LightWeightThemeWebInstaller._install(data, notify); } }]; this._removePreviousNotifications(); let notificationBox = gBrowser.getNotificationBox(); let notificationBar = notificationBox.appendNotification(message, "lwtheme-install-request", "", notificationBox.PRIORITY_INFO_MEDIUM, buttons); notificationBar.persistence = 1; }, - _install: function (newLWTheme) { + _install: function (newLWTheme, notify) { let previousLWTheme = this._manager.currentTheme; let listener = { onEnabling: function(aAddon, aRequiresRestart) { if (!aRequiresRestart) { return; } @@ -551,17 +570,19 @@ var LightWeightThemeWebInstaller = { }; PopupNotifications.show(gBrowser.selectedBrowser, "addon-theme-change", messageString, "addons-notification-icon", action, null, options); }, onEnabled: function(aAddon) { - LightWeightThemeWebInstaller._postInstallNotification(newLWTheme, previousLWTheme); + if (notify) { + LightWeightThemeWebInstaller._postInstallNotification(newLWTheme, previousLWTheme); + } } }; AddonManager.addAddonListener(listener); this._manager.currentTheme = newLWTheme; AddonManager.removeAddonListener(listener); },