From c8d6b84b896df349325c5ad1bd0d9f1829ec88a2 Mon Sep 17 00:00:00 2001 From: "kairo%kairo.at" Date: Wed, 28 May 2008 18:35:09 +0000 Subject: [PATCH] bug 301119 - Need to allow chrome favicons for XUL error pages, SeaMonkey version, p=hskupin@gmail.com r=Neil git-svn-id: svn://10.0.0.236/trunk@251894 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/suite/browser/tabbrowser.xml | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/mozilla/suite/browser/tabbrowser.xml b/mozilla/suite/browser/tabbrowser.xml index 5c5d97a6a4c..d091961d478 100644 --- a/mozilla/suite/browser/tabbrowser.xml +++ b/mozilla/suite/browser/tabbrowser.xml @@ -972,10 +972,6 @@ const nsIScriptSecurityManager = Components.interfaces.nsIScriptSecurityManager; - const secMan = - Components.classes["@mozilla.org/scriptsecuritymanager;1"] - .getService(nsIScriptSecurityManager); - // Get the IOService so we can make URIs const ioService = Components.classes["@mozilla.org/network/io-service;1"] @@ -985,11 +981,23 @@ // Make a URI out of our href. var uri = ioService.newURI(href, targetDoc.characterSet, null); - try { - secMan.checkLoadURIWithPrincipal(event.target.nodePrincipal, uri, - nsIScriptSecurityManager.DISALLOW_SCRIPT); - } catch (e) { - return; + // Verify that the load of this icon is legal. + // error pages can load their favicon, to be on the safe side, + // only allow chrome:// favicons + const aboutNeterr = /^about:neterror\?/; + if (!(aboutNeterr.test(targetDoc.documentURI) || + !uri.schemeIs("chrome")) { + + const secMan = + Components.classes["@mozilla.org/scriptsecuritymanager;1"] + .getService(nsIScriptSecurityManager); + + try { + secMan.checkLoadURIWithPrincipal(event.target.nodePrincipal, + uri, nsIScriptSecurityManager.DISALLOW_SCRIPT); + } catch(e) { + return; + } } if (isFeed) {