diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -3812,25 +3812,43 @@ }, setIconFromLink(aBrowser, aPageURL, aOriginalURL, aCanUseForTab, aExpiration, aIconURL) { let tab = gBrowser.getTabForBrowser(aBrowser); if (!tab) { - return false; + return; + } + + if (aCanUseForTab) { + this.clearPendingIcon(aBrowser); + } + + let iconURI; + try { + iconURI = Services.io.newURI(aIconURL); + } catch (ex) { + Cu.reportError(ex); + return; + } + if (iconURI.scheme != "data") { + try { + Services.scriptSecurityManager.checkLoadURIWithPrincipal( + aBrowser.contentPrincipal, iconURI, Services.scriptSecurityManager.ALLOW_CHROME); + } catch (ex) { + return; + } } try { PlacesUIUtils.loadFavicon(aBrowser, Services.scriptSecurityManager.getSystemPrincipal(), makeURI(aPageURL), makeURI(aOriginalURL), - aExpiration, makeURI(aIconURL)); + aExpiration, iconURI); } catch (ex) { Cu.reportError(ex); } if (aCanUseForTab) { - this.clearPendingIcon(aBrowser); gBrowser.setIcon(tab, aIconURL, aOriginalURL); } - return true; }, addSearch(aBrowser, aEngine, aURL) { let tab = gBrowser.getTabForBrowser(aBrowser); if (!tab) diff --git a/browser/modules/FaviconLoader.jsm b/browser/modules/FaviconLoader.jsm --- a/browser/modules/FaviconLoader.jsm +++ b/browser/modules/FaviconLoader.jsm @@ -376,10 +376,16 @@ if (this._loader) { this._loader.cancel(); } if (LOCAL_FAVICON_SCHEMES.includes(iconInfo.iconUri.scheme)) { + // We need to do a manual security check because the channel won't do + // it for us. + try { + Services.scriptSecurityManager.checkLoadURIWithPrincipal( + iconInfo.node.nodePrincipal, iconInfo.iconUri, Services.scriptSecurityManager.ALLOW_CHROME); + } catch (ex) { return; } this.mm.sendAsyncMessage("Link:SetIcon", { pageURL: iconInfo.pageUri.spec, originalURL: iconInfo.iconUri.spec, canUseForTab: !iconInfo.isRichIcon, expiration: undefined,