Bug 1266196 - Only open a channel for non whitelisted about pages draft
authorBrian Grinstead <bgrinstead@mozilla.com>
Wed, 20 Apr 2016 14:21:00 -0700
changeset 354430 1c6ad377afbcd2ad33b44939343e7ff33627c89e
parent 352714 1306c789088d5675435586edf04b9a2b70f86dec
child 519004 c3edda8037475b7da43a5ec9809680ac3cfb5595
push id16078
push userbgrinstead@mozilla.com
push dateWed, 20 Apr 2016 21:21:08 +0000
bugs1266196
milestone48.0a1
Bug 1266196 - Only open a channel for non whitelisted about pages MozReview-Commit-ID: IgsN7SU3rmy
browser/base/content/browser.js
--- 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();