diff options
Diffstat (limited to 'www/waterfox/files/patch-bug1449548')
-rw-r--r-- | www/waterfox/files/patch-bug1449548 | 186 |
1 files changed, 0 insertions, 186 deletions
diff --git a/www/waterfox/files/patch-bug1449548 b/www/waterfox/files/patch-bug1449548 deleted file mode 100644 index 61af0136f6a7..000000000000 --- a/www/waterfox/files/patch-bug1449548 +++ /dev/null @@ -1,186 +0,0 @@ -commit d422b5f2f8bd -Author: Gijs Kruitbosch <gijskruitbosch@gmail.com> -Date: Wed Mar 28 13:48:09 2018 +0100 - - Bug 1449548. r=mconley, r=aswan, a=RyanVM - - --HG-- - extra : source : a578a9117c193ecfd6c7abdca5fbb841e46155ab ---- - browser/base/content/browser-addons.js | 73 ++++++++++++++++++---------------- - browser/base/content/content.js | 4 +- - 2 files changed, 41 insertions(+), 36 deletions(-) - -diff --git browser/base/content/browser-addons.js browser/base/content/browser-addons.js -index 902011f9f2a0..077626a29ee1 100644 ---- browser/base/content/browser-addons.js -+++ browser/base/content/browser-addons.js -@@ -575,6 +575,8 @@ var LightWeightThemeWebInstaller = { - mm.addMessageListener("LightWeightThemeWebInstaller:Install", this); - mm.addMessageListener("LightWeightThemeWebInstaller:Preview", this); - mm.addMessageListener("LightWeightThemeWebInstaller:ResetPreview", this); -+ -+ XPCOMUtils.defineLazyPreferenceGetter(this, "_apiTesting", "extensions.webapi.testing", false); - }, - - receiveMessage(message) { -@@ -587,15 +589,15 @@ var LightWeightThemeWebInstaller = { - - switch (message.name) { - case "LightWeightThemeWebInstaller:Install": { -- this._installRequest(data.themeData, data.baseURI); -+ this._installRequest(data.themeData, data.principal, data.baseURI); - break; - } - case "LightWeightThemeWebInstaller:Preview": { -- this._preview(data.themeData, data.baseURI); -+ this._preview(data.themeData, data.principal, data.baseURI); - break; - } - case "LightWeightThemeWebInstaller:ResetPreview": { -- this._resetPreview(data && data.baseURI); -+ this._resetPreview(data && data.principal); - break; - } - } -@@ -617,33 +619,24 @@ var LightWeightThemeWebInstaller = { - return this._manager = temp.LightweightThemeManager; - }, - -- _installRequest(dataString, baseURI) { -+ _installRequest(dataString, principal, baseURI) { -+ // Don't allow installing off null principals. -+ if (!principal.URI) { -+ return; -+ } -+ - 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)) { -+ let notify = this._shouldShowUndoPrompt(principal); -+ if (this._isAllowed(principal)) { - this._install(data, notify); - return; - } -@@ -652,7 +645,7 @@ var LightWeightThemeWebInstaller = { - header: gNavigatorBundle.getFormattedString("webextPerms.header", ["<>"]), - addonName: data.name, - text: gNavigatorBundle.getFormattedString("lwthemeInstallRequest.message2", -- [uri.host]), -+ [principal.URI.host]), - acceptText: gNavigatorBundle.getString("lwthemeInstallRequest.allowButton2"), - acceptKey: gNavigatorBundle.getString("lwthemeInstallRequest.allowButton.accesskey2"), - cancelText: gNavigatorBundle.getString("webextPerms.cancel.label"), -@@ -706,8 +699,8 @@ var LightWeightThemeWebInstaller = { - AddonManager.removeAddonListener(listener); - }, - -- _preview(dataString, baseURI) { -- if (!this._isAllowed(baseURI)) -+ _preview(dataString, principal, baseURI) { -+ if (!this._isAllowed(principal)) - return; - - let data = this._manager.parseTheme(dataString, baseURI); -@@ -719,27 +712,37 @@ var LightWeightThemeWebInstaller = { - this._manager.previewTheme(data); - }, - -- _resetPreview(baseURI) { -- if (baseURI && !this._isAllowed(baseURI)) -+ _resetPreview(principal) { -+ if (!this._isAllowed(principal)) - return; - gBrowser.tabContainer.removeEventListener("TabSelect", this); - this._manager.resetPreview(); - }, - -- _isAllowed(srcURIString) { -- let uri; -- try { -- uri = makeURI(srcURIString); -- } catch (e) { -- // makeURI fails if srcURIString is a nonsense URI -+ _isAllowed(principal) { -+ if (!principal || !principal.URI || !principal.URI.schemeIs("https")) { -+ return false; -+ } -+ -+ let pm = Services.perms; -+ return pm.testPermission(principal.URI, "install") == pm.ALLOW_ACTION; -+ }, -+ -+ _shouldShowUndoPrompt(principal) { -+ if (!principal || !principal.URI) { -+ return true; -+ } -+ -+ let prePath = principal.URI.prePath; -+ if (prePath == "https://discovery.addons.mozilla.org") { - return false; - } - -- if (!uri.schemeIs("https")) { -+ if (this._apiTesting && (prePath == "https://discovery.addons.allizom.org" || -+ prePath == "https://discovery.addons-dev.allizom.org")) { - return false; - } -+ return true; -+ }, - -- let pm = Services.perms; -- return pm.testPermission(uri, "install") == pm.ALLOW_ACTION; -- } - }; -diff --git browser/base/content/content.js browser/base/content/content.js -index 8b3f6af14783..08fe4ba2efe3 100644 ---- browser/base/content/content.js -+++ browser/base/content/content.js -@@ -749,6 +749,7 @@ var LightWeightThemeWebInstallListener = { - case "InstallBrowserTheme": { - sendAsyncMessage("LightWeightThemeWebInstaller:Install", { - baseURI: event.target.baseURI, -+ principal: event.target.nodePrincipal, - themeData: event.target.getAttribute("data-browsertheme"), - }); - break; -@@ -756,6 +757,7 @@ var LightWeightThemeWebInstallListener = { - case "PreviewBrowserTheme": { - sendAsyncMessage("LightWeightThemeWebInstaller:Preview", { - baseURI: event.target.baseURI, -+ principal: event.target.nodePrincipal, - themeData: event.target.getAttribute("data-browsertheme"), - }); - this._previewWindow = event.target.ownerGlobal; -@@ -770,7 +772,7 @@ var LightWeightThemeWebInstallListener = { - case "ResetBrowserThemePreview": { - if (this._previewWindow) { - sendAsyncMessage("LightWeightThemeWebInstaller:ResetPreview", -- {baseURI: event.target.baseURI}); -+ {principal: event.target.nodePrincipal}); - this._resetPreviewWindow(); - } - break; |