Bug 1266196 - Only open a channel for non whitelisted about pages
MozReview-Commit-ID: IgsN7SU3rmy
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -6995,33 +6995,38 @@ var gIdentityHandler = {
this._uriHasHost = true;
} catch (ex) {
this._uriHasHost = false;
}
let whitelist = /^(?:accounts|addons|cache|config|crashes|customizing|downloads|healthreport|home|license|newaddon|permissions|preferences|privatebrowsing|rights|sessionrestore|support|welcomeback)(?:[?#]|$)/i;
this._isSecureInternalUI = uri.schemeIs("about") && whitelist.test(uri.path);
- // Create a channel for the sole purpose of getting the resolved URI
- // of the request to determine if it's loaded from the file system.
- this._isURILoadedFromFile = false;
- let chanOptions = {uri: this._uri, loadUsingSystemPrincipal: true};
- let resolvedURI;
- try {
- resolvedURI = NetUtil.newChannel(chanOptions).URI;
- if (resolvedURI.schemeIs("jar")) {
- // Given a URI "jar:<jar-file-uri>!/<jar-entry>"
- // create a new URI using <jar-file-uri>!/<jar-entry>
- resolvedURI = NetUtil.newURI(resolvedURI.path);
+ if (this._isSecureInternalUI) {
+ this._isURILoadedFromFile = true;
+ } else {
+ this._isURILoadedFromFile = false;
+ // Create a channel for the sole purpose of getting the resolved URI
+ // of the request to determine if it's loaded from the file system.
+ let chanOptions = {uri: this._uri, loadUsingSystemPrincipal: true};
+ let resolvedURI;
+ try {
+ resolvedURI = NetUtil.newChannel(chanOptions).URI;
+ if (resolvedURI.schemeIs("jar")) {
+ // Given a URI "jar:<jar-file-uri>!/<jar-entry>"
+ // create a new URI using <jar-file-uri>!/<jar-entry>
+ resolvedURI = NetUtil.newURI(resolvedURI.path);
+ }
+ // Check the URI again after resolving.
+ this._isURILoadedFromFile = resolvedURI.schemeIs("file");
+ } catch (ex) {
+ // NetUtil's methods will throw for malformed URIs and the like
}
- // Check the URI again after resolving.
- this._isURILoadedFromFile = resolvedURI.schemeIs("file");
- } catch (ex) {
- // NetUtil's methods will throw for malformed URIs and the like
- }
+ }
+
},
/**
* Click handler for the identity-box element in primary chrome.
*/
handleIdentityButtonEvent : function(event) {
event.stopPropagation();