зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1262009 - Refactor isURILoadedFromFile into a setURI function that sets all relevant properties in one place;r=MattN
MozReview-Commit-ID: rIr2CNBv0E
This commit is contained in:
Родитель
04db85aa39
Коммит
ba21337580
|
@ -6615,22 +6615,10 @@ var gIdentityHandler = {
|
||||||
updateIdentity(state, uri) {
|
updateIdentity(state, uri) {
|
||||||
let shouldHidePopup = this._uri && (this._uri.spec != uri.spec);
|
let shouldHidePopup = this._uri && (this._uri.spec != uri.spec);
|
||||||
this._state = state;
|
this._state = state;
|
||||||
this._uri = uri;
|
|
||||||
this._isURILoadedFromFile = this.isURILoadedFromFile();
|
|
||||||
|
|
||||||
// Firstly, populate the state properties required to display the UI. See
|
// Firstly, populate the state properties required to display the UI. See
|
||||||
// the documentation of the individual properties for details.
|
// the documentation of the individual properties for details.
|
||||||
|
this.setURI(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);
|
|
||||||
|
|
||||||
this._sslStatus = gBrowser.securityUI
|
this._sslStatus = gBrowser.securityUI
|
||||||
.QueryInterface(Ci.nsISSLStatusProvider)
|
.QueryInterface(Ci.nsISSLStatusProvider)
|
||||||
.SSLStatus;
|
.SSLStatus;
|
||||||
|
@ -6970,9 +6958,22 @@ var gIdentityHandler = {
|
||||||
this.updateSitePermissions();
|
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
|
// 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.
|
// of the request to determine if it's loaded from the file system.
|
||||||
|
this._isURILoadedFromFile = false;
|
||||||
let chanOptions = {uri: this._uri, loadUsingSystemPrincipal: true};
|
let chanOptions = {uri: this._uri, loadUsingSystemPrincipal: true};
|
||||||
let resolvedURI;
|
let resolvedURI;
|
||||||
try {
|
try {
|
||||||
|
@ -6982,13 +6983,11 @@ var gIdentityHandler = {
|
||||||
// create a new URI using <jar-file-uri>!/<jar-entry>
|
// create a new URI using <jar-file-uri>!/<jar-entry>
|
||||||
resolvedURI = NetUtil.newURI(resolvedURI.path);
|
resolvedURI = NetUtil.newURI(resolvedURI.path);
|
||||||
}
|
}
|
||||||
|
// Check the URI again after resolving.
|
||||||
|
this._isURILoadedFromFile = resolvedURI.schemeIs("file");
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
// NetUtil's methods will throw for malformed URIs and the like
|
// NetUtil's methods will throw for malformed URIs and the like
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check the URI again after resolving.
|
|
||||||
return resolvedURI.schemeIs("file");
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Загрузка…
Ссылка в новой задаче