diff options
author | New Tobin Paradigm <email@mattatobin.com> | 2018-04-13 19:05:06 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-13 19:05:06 -0400 |
commit | 60c526db500f4f0d177cd7467c0b40bc2a205c1d (patch) | |
tree | eb7f53ae594606ca2536a40ea3f493f562f7191a /application/palemoon/base/content | |
parent | 386266fab1d56b6ca116271d4670155653fa43ff (diff) | |
parent | 7494a278ae7ec40f82979e182bf7c1c72c22b4df (diff) | |
download | UXP-60c526db500f4f0d177cd7467c0b40bc2a205c1d.tar UXP-60c526db500f4f0d177cd7467c0b40bc2a205c1d.tar.gz UXP-60c526db500f4f0d177cd7467c0b40bc2a205c1d.tar.lz UXP-60c526db500f4f0d177cd7467c0b40bc2a205c1d.tar.xz UXP-60c526db500f4f0d177cd7467c0b40bc2a205c1d.zip |
Merge pull request #152 from JustOff/PR_Favicons_principal
Use document's principal for favicons in browser
Diffstat (limited to 'application/palemoon/base/content')
-rw-r--r-- | application/palemoon/base/content/browser.js | 2 | ||||
-rw-r--r-- | application/palemoon/base/content/tabbrowser.xml | 27 |
2 files changed, 19 insertions, 10 deletions
diff --git a/application/palemoon/base/content/browser.js b/application/palemoon/base/content/browser.js index 6af11af3d..b2d260101 100644 --- a/application/palemoon/base/content/browser.js +++ b/application/palemoon/base/content/browser.js @@ -2849,7 +2849,7 @@ const DOMLinkHandler = { break; let tab = gBrowser.tabs[browserIndex]; - gBrowser.setIcon(tab, uri.spec); + gBrowser.setIcon(tab, uri.spec, link.ownerDocument.nodePrincipal); iconAdded = true; } break; diff --git a/application/palemoon/base/content/tabbrowser.xml b/application/palemoon/base/content/tabbrowser.xml index e73384209..4b10855a7 100644 --- a/application/palemoon/base/content/tabbrowser.xml +++ b/application/palemoon/base/content/tabbrowser.xml @@ -778,19 +778,28 @@ <method name="setIcon"> <parameter name="aTab"/> <parameter name="aURI"/> + <parameter name="aLoadingPrincipal"/> <body> <![CDATA[ - var browser = this.getBrowserForTab(aTab); + let browser = this.getBrowserForTab(aTab); browser.mIconURL = aURI instanceof Ci.nsIURI ? aURI.spec : aURI; if (aURI && this.mFaviconService) { - if (!(aURI instanceof Ci.nsIURI)) + if (!(aURI instanceof Ci.nsIURI)) { aURI = makeURI(aURI); - this.mFaviconService.setAndFetchFaviconForPage(browser.currentURI, - aURI, false, - PrivateBrowsingUtils.isWindowPrivate(window) ? - this.mFaviconService.FAVICON_LOAD_PRIVATE : - this.mFaviconService.FAVICON_LOAD_NON_PRIVATE); + } + // We do not serialize the principal from within SessionStore.jsm, + // hence if aLoadingPrincipal is null we default to the + // systemPrincipal which will allow the favicon to load. + let loadingPrincipal = aLoadingPrincipal + ? aLoadingPrincipal + : Services.scriptSecurityManager.getSystemPrincipal(); + let loadType = PrivateBrowsingUtils.isWindowPrivate(window) + ? this.mFaviconService.FAVICON_LOAD_PRIVATE + : this.mFaviconService.FAVICON_LOAD_NON_PRIVATE; + + this.mFaviconService.setAndFetchFaviconForPage( + browser.currentURI, aURI, false, loadType, null, loadingPrincipal); } let sizedIconUrl = browser.mIconURL || ""; @@ -886,7 +895,7 @@ if (!this.isFailedIcon(url)) icon = url; } - this.setIcon(aTab, icon); + this.setIcon(aTab, icon, browser.contentPrincipal); ]]> </body> </method> @@ -2146,7 +2155,7 @@ // Workarounds for bug 458697 // Icon might have been set on DOMLinkAdded, don't override that. if (!ourBrowser.mIconURL && otherBrowser.mIconURL) - this.setIcon(aOurTab, otherBrowser.mIconURL); + this.setIcon(aOurTab, otherBrowser.mIconURL, otherBrowser.contentPrincipal); var isBusy = aOtherTab.hasAttribute("busy"); if (isBusy) { aOurTab.setAttribute("busy", "true"); |