# HG changeset patch # User Ian Neal # Date 1620488332 -3600 # Parent defee7adcb1bd85c422e092d930f5eb2500a8f73 Bug 1710231 - Port |Bug 1095602 - remove the STATE_SECURE_HIGH, STATE_SECURE_MEDIUM, STATE_SECURE_LOW distinction from nsIWebProgressListener| to chatZilla. r=frg a=frg diff --git a/suite/extensions/irc/js/lib/connection-xpcom.js b/suite/extensions/irc/js/lib/connection-xpcom.js --- a/suite/extensions/irc/js/lib/connection-xpcom.js +++ b/suite/extensions/irc/js/lib/connection-xpcom.js @@ -42,19 +42,16 @@ const SEC_ERROR_CA_CERT_INVALID = SEC_ER const SEC_ERROR_INADEQUATE_KEY_USAGE = SEC_ERROR_BASE - 90; const SSL_ERROR_BAD_CERT_DOMAIN = SSL_ERROR_BASE - 12; // Security Constants. const STATE_IS_BROKEN = 1; const STATE_IS_SECURE = 2; const STATE_IS_INSECURE = 3; -const STATE_SECURE_LOW = 1; -const STATE_SECURE_HIGH = 2; - const nsIScriptableInputStream = Components.interfaces.nsIScriptableInputStream; const nsIBinaryInputStream = Components.interfaces.nsIBinaryInputStream; const nsIBinaryOutputStream = Components.interfaces.nsIBinaryOutputStream; function toSInputStream(stream, binary) { var sstream; @@ -533,68 +530,59 @@ function bc_senddatanow(str) this.disconnect(); throw (ex); } return rv; } /** - * Gets an array containing information about the security of the connection. + * Gets information about the security of the connection. * * |STATE_IS_BROKEN| is returned if any errors occur and |STATE_IS_INSECURE| is * returned for disconnected sockets. * - * @returns An array with at least one item, containing a value from the - * |STATE_IS_*| enumeration at the top of this file. Iff this is - * |STATE_IS_SECURE|, the array has a second item indicating the level - * of security - a value from the |STATE_SECURE_*| enumeration. + * @returns A value from the |STATE_IS_*| enumeration at the top of this file. */ CBSConnection.prototype.getSecurityState = function bc_getsecuritystate() { if (!this.isConnected || !this._transport.securityInfo) - return [STATE_IS_INSECURE]; + return STATE_IS_INSECURE; try { - var sslSp = Components.interfaces.nsISSLStatusProvider; - var sslStatus = Components.interfaces.nsISSLStatus; - // Get the actual SSL Status - sslSp = this._transport.securityInfo.QueryInterface(sslSp); - sslStatus = sslSp.SSLStatus.QueryInterface(sslStatus); + let sslSp = this._transport.securityInfo + .QueryInterface(Ci.nsISSLStatusProvider); + let sslStatus = sslSp.SSLStatus.QueryInterface(Ci.nsISSLStatus); // Store appropriate status if (!("keyLength" in sslStatus) || !sslStatus.keyLength) - return [STATE_IS_BROKEN]; - else if (sslStatus.keyLength >= 90) - return [STATE_IS_SECURE, STATE_SECURE_HIGH]; - else - return [STATE_IS_SECURE, STATE_SECURE_LOW]; + return STATE_IS_BROKEN; + + return STATE_IS_SECURE; } catch (ex) { // Something goes wrong -> broken security icon dd("Exception getting certificate for connection: " + ex.message); - return [STATE_IS_BROKEN]; + return STATE_IS_BROKEN; } } CBSConnection.prototype.getCertificate = function bc_getcertificate() { if (!this.isConnected || !this._transport.securityInfo) return null; - var sslSp = Components.interfaces.nsISSLStatusProvider; - var sslStatus = Components.interfaces.nsISSLStatus; - // Get the actual SSL Status - sslSp = this._transport.securityInfo.QueryInterface(sslSp); - sslStatus = sslSp.SSLStatus.QueryInterface(sslStatus); + let sslSp = this._transport.securityInfo + .QueryInterface(Ci.nsISSLStatusProvider); + let sslStatus = sslSp.SSLStatus.QueryInterface(Ci.nsISSLStatus); // return the certificate return sslStatus.serverCert; } CBSConnection.prototype.asyncWrite = function bc_asyncwrite() { diff --git a/suite/extensions/irc/xul/content/static.js b/suite/extensions/irc/xul/content/static.js --- a/suite/extensions/irc/xul/content/static.js +++ b/suite/extensions/irc/xul/content/static.js @@ -1934,25 +1934,20 @@ function updateSecurityIcon() securityButton.removeAttribute("level"); securityButton.removeAttribute("tooltiptext"); if (!o.server || !o.server.isConnected) // No server or connection? { securityButton.setAttribute("tooltiptext", MSG_SECURITY_INFO); return; } - var securityState = o.server.connection.getSecurityState() - switch (securityState[0]) - { + switch (o.server.connection.getSecurityState()) { case STATE_IS_SECURE: securityButton.firstChild.value = o.server.hostname; - if (securityState[1] == STATE_SECURE_HIGH) - securityButton.setAttribute("level", "high"); - else // Because low security is the worst we have when being secure - securityButton.setAttribute("level", "low"); + securityButton.setAttribute("level", "high"); // Add the tooltip: var issuer = o.server.connection.getCertificate().issuerOrganization; var tooltiptext = getMsg(MSG_SECURE_CONNECTION, issuer); securityButton.setAttribute("tooltiptext", tooltiptext); securityButton.firstChild.setAttribute("tooltiptext", tooltiptext); securityButton.lastChild.setAttribute("tooltiptext", tooltiptext); break; diff --git a/suite/extensions/irc/xul/skin/chatzilla.css b/suite/extensions/irc/xul/skin/chatzilla.css --- a/suite/extensions/irc/xul/skin/chatzilla.css +++ b/suite/extensions/irc/xul/skin/chatzilla.css @@ -326,28 +326,24 @@ progressmeter[mode="undetermined"] { #status-text[notice="true"] { font-weight: bold; } #security-button { min-width: 20px; } -#security-button:not([level="high"]):not([level="low"]):not([level="broken"]) { +#security-button:not([level="high"]):not([level="broken"]) { display: none; } #security-button[level="high"] > image { list-style-image: url("chrome://chatzilla/skin/images/secure.png"); } -#security-button[level="low"] > image { - list-style-image: url("chrome://chatzilla/skin/images/secure.png"); -} - #security-button[level="broken"] > image { list-style-image: url("chrome://chatzilla/skin/images/secure-broken.png"); } /* prevent margins of a value-less label from shifting the image */ #security-button > label:not([value]) { display: none; }