diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index 225fe4e1a734..98b23357fe08 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -6615,22 +6615,10 @@ var gIdentityHandler = { updateIdentity(state, uri) { let shouldHidePopup = this._uri && (this._uri.spec != uri.spec); this._state = state; - this._uri = uri; - this._isURILoadedFromFile = this.isURILoadedFromFile(); // Firstly, populate the state properties required to display the UI. See // the documentation of the individual properties for details. - - try { - this._uri.host; - 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); - + this.setURI(uri); this._sslStatus = gBrowser.securityUI .QueryInterface(Ci.nsISSLStatusProvider) .SSLStatus; @@ -6970,9 +6958,22 @@ var gIdentityHandler = { this.updateSitePermissions(); }, - isURILoadedFromFile() { + setURI(uri) { + this._uri = uri; + + try { + this._uri.host; + 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 { @@ -6982,13 +6983,11 @@ var gIdentityHandler = { // create a new URI using !/ 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 - return false; } - - // Check the URI again after resolving. - return resolvedURI.schemeIs("file"); }, /**