Bug 1204616 - Control Center should show full host name (w/ subdomains) in security block. r=MattN,liuche

--HG--
extra : commitid : CCWgbbWihKu
extra : rebase_source : 294f5ae1654926cad1c54ac72741a2ee7c2c9edd
This commit is contained in:
Richard Barnes 2015-09-16 18:01:27 -07:00
parent 5958359894
commit d1f14337d5
4 changed files with 14 additions and 13 deletions

View File

@ -6983,16 +6983,14 @@ var gIdentityHandler = {
},
/**
* Return the eTLD+1 version of the current hostname
* Attempt to provide proper IDN treatment for host names
*/
getEffectiveHost : function() {
getEffectiveHost: function() {
if (!this._IDNService)
this._IDNService = Cc["@mozilla.org/network/idn-service;1"]
.getService(Ci.nsIIDNService);
try {
let baseDomain =
Services.eTLD.getBaseDomainFromHost(this._uri.host);
return this._IDNService.convertToDisplayIDN(baseDomain, {});
return this._IDNService.convertToDisplayIDN(this._uri.host, {});
} catch (e) {
// If something goes wrong (e.g. host is an IP address) just fail back
// to the full domain.
@ -7162,6 +7160,7 @@ var gIdentityHandler = {
let verifier = "";
let host = "";
let owner = "";
let crop = "start";
try {
host = this.getEffectiveHost();
@ -7181,6 +7180,8 @@ var gIdentityHandler = {
// Fill in organization information if we have a valid EV certificate.
if (isEV) {
crop = "end";
let iData = this.getIdentityData();
host = owner = iData.subjectOrg;
verifier = this._identityBox.tooltipText;
@ -7200,6 +7201,7 @@ var gIdentityHandler = {
// Push the appropriate strings out to the UI. Need to use |value| for the
// host as it's a <label> that will be cropped if too long. Using
// |textContent| would simply wrap the value.
this._identityPopupContentHost.setAttribute("crop", crop);
this._identityPopupContentHost.setAttribute("value", host);
this._identityPopupContentOwner.textContent = owner;
this._identityPopupContentSupp.textContent = supplemental;

View File

@ -17,7 +17,7 @@ var tests = [
{
name: "normal domain",
location: "http://test1.example.org/",
effectiveHost: "example.org"
effectiveHost: "test1.example.org"
},
{
name: "view-source",
@ -33,17 +33,17 @@ var tests = [
{
name: "IDN subdomain",
location: "http://sub1." + idnDomain + "/",
effectiveHost: idnDomain
effectiveHost: "sub1." + idnDomain
},
{
name: "subdomain with port",
location: "http://sub1.test1.example.org:8000/",
effectiveHost: "example.org"
effectiveHost: "sub1.test1.example.org"
},
{
name: "subdomain HTTPS",
location: "https://test1.example.com/",
effectiveHost: "example.com",
effectiveHost: "test1.example.com",
isHTTPS: true
},
{

View File

@ -10,7 +10,7 @@
orient="vertical">
<broadcasterset>
<broadcaster id="identity-popup-content-host" class="identity-popup-headline" crop="end"/>
<broadcaster id="identity-popup-content-host" class="identity-popup-headline" crop="start"/>
<broadcaster id="identity-popup-mcb-learn-more" class="text-link plain" value="&identity.learnMore;"/>
</broadcasterset>

View File

@ -6549,15 +6549,14 @@ var IdentityHandler = {
},
/**
* Return the eTLD+1 version of the current hostname
* Attempt to provide proper IDN treatment for host names
*/
getEffectiveHost: function getEffectiveHost() {
if (!this._IDNService)
this._IDNService = Cc["@mozilla.org/network/idn-service;1"]
.getService(Ci.nsIIDNService);
try {
let baseDomain = Services.eTLD.getBaseDomainFromHost(this._lastLocation.hostname);
return this._IDNService.convertToDisplayIDN(baseDomain, {});
return this._IDNService.convertToDisplayIDN(this._uri.host, {});
} catch (e) {
// If something goes wrong (e.g. hostname is an IP address) just fail back
// to the full domain.