Browse Source

[Navigator] Enhance the security status bar panel WITH SECURITY!

master
Matt A. Tobin 2 years ago committed by Roy Tam
parent
commit
e74317a372
  1. 4
      navigator/base/content/navigator.xul
  2. 110
      navigator/base/content/nsBrowserStatusHandler.js
  3. 56
      navigator/themes/classic/mac/navigator/navigator.css
  4. 52
      navigator/themes/classic/navigator/navigator.css
  5. 4
      navigator/themes/modern/jar.mn
  6. 42
      navigator/themes/modern/navigator/navigator.css
  7. BIN
      navigator/themes/modern/navigator/toolbar/ubhist-arrow-act.gif
  8. BIN
      navigator/themes/modern/navigator/toolbar/ubhist-arrow-act.png
  9. BIN
      navigator/themes/modern/navigator/toolbar/ubhist-arrow.gif
  10. BIN
      navigator/themes/modern/navigator/toolbar/ubhist-arrow.png

4
navigator/base/content/navigator.xul

@ -529,8 +529,8 @@
tooltiptext="&popupIcon.tooltiptext;"
context="popupBlockerMenu"/>
<statusbarpanel class="statusbarpanel-iconic" id="offline-status"/>
<statusbarpanel class="statusbarpanel-backgroundbox"
id="security-button" dir="reverse"
<statusbarpanel id="security-button"
class="statusbarpanel-backgroundbox"
context="security-context-menu"
oncommand="BrowserPageInfo(null, 'securityTab')"/>
</statusbar>

110
navigator/base/content/nsBrowserStatusHandler.js

@ -40,8 +40,6 @@ nsBrowserStatusHandler.prototype =
this.statusTextField = document.getElementById("statusbar-display");
this.isImage = document.getElementById("isImage");
this.securityButton = document.getElementById("security-button");
// XXXTobin: This thing is gross
// this.evButton = document.getElementById("ev-button");
this.feedsMenu = document.getElementById("feedsMenu");
this.feedsButton = document.getElementById("feedsButton");
@ -63,7 +61,6 @@ nsBrowserStatusHandler.prototype =
this.statusTextField = null;
this.isImage = null;
this.securityButton = null;
// this.evButton = null;
this.feedsButton = null;
this.feedsMenu = null;
},
@ -362,64 +359,86 @@ nsBrowserStatusHandler.prototype =
onSecurityChange : function(aWebProgress, aRequest, aState)
{
const wpl = Components.interfaces.nsIWebProgressListener;
const wpl_security_bits = wpl.STATE_IS_SECURE |
wpl.STATE_IS_BROKEN |
wpl.STATE_IS_INSECURE;
const wpl_security_bits = wpl.STATE_IS_SECURE | wpl.STATE_IS_BROKEN | wpl.STATE_IS_INSECURE;
const nsISSLStatusProvider = Components.interfaces.nsISSLStatusProvider;
const browser = getBrowser();
var highlightSecure =
Services.prefs.getBoolPref("browser.urlbar.highlight.secure");
const sslStatus = browser.securityUI
.QueryInterface(nsISSLStatusProvider)
.SSLStatus;
const idn = Components.classes["@mozilla.org/network/idn-service;1"]
.getService(Components.interfaces.nsIIDNService);
var highlightSecure = Services.prefs.getBoolPref("browser.urlbar.highlight.secure", true);
var securityButtonTooltip = gNavigatorBundle.getString("securityButtonTooltipInsecure");
var securityButtonLabel = null;
var securityLevel = null;
var host = null;
if (['http', 'https'].includes(browser.currentURI.scheme)) {
host = getBrowser().currentURI.host;
try {
host = idn.convertToDisplayIDN(Services.eTLD.getBaseDomainFromHost(host), {});
} catch (ex) {}
}
/* aState is defined as a bitmask that may be extended in the future.
* We filter out any unknown bits before testing for known values.
*/
switch (aState & wpl_security_bits) {
case wpl.STATE_IS_SECURE:
const nsISSLStatusProvider = Components.interfaces.nsISSLStatusProvider;
var cert = getBrowser().securityUI.QueryInterface(nsISSLStatusProvider)
.SSLStatus.serverCert;
var issuerName = cert.issuerOrganization ||
cert.issuerCommonName || cert.issuerName;
this.securityButton.setAttribute("tooltiptext",
gNavigatorBundle.getFormattedString("securityButtonTooltipSecure",
[issuerName]));
this.securityButton.setAttribute("level", "high");
if (highlightSecure)
this.urlBar.setAttribute("level", "high");
else
this.urlBar.removeAttribute("level");
securityLevel = "high";
var issuerName = sslStatus.serverCert.issuerOrganization ||
sslStatus.serverCert.issuerCommonName ||
sslStatus.serverCert.issuerName;
securityButtonTooltip = gNavigatorBundle.getFormattedString("securityButtonTooltipSecure",
[issuerName]);
break;
case wpl.STATE_IS_BROKEN:
this.securityButton.setAttribute("tooltiptext",
gNavigatorBundle.getString("securityButtonTooltipMixedContent"));
this.securityButton.setAttribute("level", "broken");
if (highlightSecure)
this.urlBar.setAttribute("level", "broken");
else
this.urlBar.removeAttribute("level");
securityLevel = "broken";
securityButtonTooltip = gNavigatorBundle.getString("securityButtonTooltipMixedContent");
break;
case wpl.STATE_IS_INSECURE:
default:
this.securityButton.setAttribute("tooltiptext",
gNavigatorBundle.getString("securityButtonTooltipInsecure"));
this.securityButton.removeAttribute("level");
this.urlBar.removeAttribute("level");
securityLevel = null;
break;
}
if (aState & wpl.STATE_IDENTITY_EV_TOPLEVEL) {
var organization =
getBrowser().securityUI
.QueryInterface(Components.interfaces.nsISSLStatusProvider)
.SSLStatus
.QueryInterface(Components.interfaces.nsISSLStatus)
.serverCert.organization;
this.securityButton.setAttribute("label", organization);
// this.evButton.setAttribute("tooltiptext", organization);
// this.evButton.hidden = false;
} else {
this.securityButton.removeAttribute("label");
// this.evButton.hidden = true;
if (securityLevel != "broken") {
securityLevel = "ultra";
}
securityButtonLabel = sslStatus.serverCert.organization;
}
else {
if (securityLevel && host) {
securityButtonLabel = idn.convertUTF8toACE(host);
}
}
// Set the level on the urlbar and security button
if (securityLevel) {
this.securityButton.setAttribute("level", securityLevel);
highlightSecure ? this.urlBar.setAttribute("level", securityLevel)
: this.urlBar.removeAttribute("level");
}
else {
this.securityButton.removeAttribute("level");
this.urlBar.removeAttribute("level");
}
// Set the tooltip of the security button
this.securityButton.setAttribute("tooltiptext", securityButtonTooltip);
// Set the label of the security button
securityButtonLabel ? this.securityButton.setAttribute("label", securityButtonLabel)
: this.securityButton.removeAttribute("label");
},
startDocumentLoad : function(aRequest)
@ -464,8 +483,7 @@ nsBrowserStatusHandler.prototype =
var notification = Components.isSuccessCode(aStatus) ? "EndDocumentLoad" : "FailDocumentLoad";
try {
Services.obs.notifyObservers(content, notification, urlStr);
} catch (e) {
}
} catch (e) {}
}
}

56
navigator/themes/classic/mac/navigator/navigator.css

@ -225,10 +225,30 @@ toolbar[mode="text"] > #window-controls > toolbarbutton > .toolbarbutton-icon {
color: #000000;
}
#urlbar[level="high"] > .autocomplete-textbox-container {
background-color: #FFFFC7;
}
#urlbar[level="high"] > .autocomplete-history-dropmarker {
background-color: #FFFFC7 !important;
}
#urlbar[level="ultra"] > .autocomplete-textbox-container {
background-color: #d2ffc7;
}
#urlbar[level="ultra"] > .autocomplete-history-dropmarker {
background-color: #d2ffc7 !important;
}
#urlbar[level="broken"] > .autocomplete-textbox-container {
background-color: #ffc7c7;
}
#urlbar[level="broken"] > .autocomplete-history-dropmarker {
background-color: #ffc7c7 !important;
}
#wrapper-nav-bar-inner[place="palette"] > #nav-bar-inner > .button-toolbar,
#wrapper-nav-bar-inner[place="palette"] > #nav-bar-inner > #urlbar > .urlbar-icons {
display: none;
@ -586,39 +606,35 @@ toolbar[mode="icons"] #search-button > .button-box > .button-text {
#security-button {
list-style-image: url("chrome://communicator/skin/icons/lock-insecure.png");
margin-top: 2px;
}
#security-button[level="high"] > .statusbarpanel-contentbox {
#security-button[level="high"] > .statusbarpanel-contentbox,
#security-button[level="ultra"] > .statusbarpanel-contentbox {
list-style-image: url("chrome://communicator/skin/icons/lock-secure.png");
background-color: #E8DB99;
}
#security-button[level="broken"] > .statusbarpanel-contentbox {
list-style-image: url("chrome://communicator/skin/icons/lock-broken.png");
background-color: #E83404;
}
#security-button[label] > .statusbarpanel-contentbox {
background-color: #62C441;
#security-button[level="high"] > .statusbarpanel-contentbox {
background-color: #FFFFC7;
}
#security-button > .statusbarpanel-contentbox > .statusbarpanel-text {
margin: 0px;
color: #FFFFFF;
text-shadow: none;
#security-button[level="ultra"] > .statusbarpanel-contentbox {
background-color: #d2ffc7;
}
/* make same background-color translucent on lwthemes */
#security-button[level="high"] > .statusbarpanel-contentbox:-moz-lwtheme {
background-color: rgba(232, 219, 153, .8);
#security-button[level="broken"] > .statusbarpanel-contentbox {
list-style-image: url("chrome://communicator/skin/icons/lock-broken.png");
background-color: #ffc7c7;
}
#security-button[level="broken"] > .statusbarpanel-contentbox:-moz-lwtheme {
background-color: rgba(232, 52, 4, .8);
#security-button > .statusbarpanel-contentbox > .statusbarpanel-text {
margin: 0px;
}
#security-button[label] > .statusbarpanel-contentbox:-moz-lwtheme {
background-color: rgba(98, 196, 65, .8);
#security-button > .statusbarpanel-contentbox > .statusbarpanel-text[value] {
padding-left: 2px;
padding-right: 4px;
font-weight: bold;
}
#ev-button {

52
navigator/themes/classic/navigator/navigator.css

@ -255,9 +255,23 @@ toolbar[mode="text"] > #window-controls > toolbarbutton > .toolbarbutton-icon {
min-width: 0px;
}
.urlbar-security-level[level="high"],
.urlbar-security-level[level="ultra"],
.urlbar-security-level[level="broken"] {
box-shadow: none;
color: #000000;
}
.urlbar-security-level[level="high"] {
background-color: #FFFFC7;
color: #000000;
}
.urlbar-security-level[level="ultra"] {
background-color: #d2ffc7;
}
.urlbar-security-level[level="broken"] {
background-color: #ffc7c7;
}
@media (-moz-windows-theme: aero) {
@ -623,39 +637,35 @@ toolbar[mode="icons"] #search-button > .button-box > .button-text {
#security-button {
list-style-image: url("chrome://communicator/skin/icons/lock-insecure.png");
margin-top: 2px;
}
#security-button[level="high"] > .statusbarpanel-contentbox {
#security-button[level="high"] > .statusbarpanel-contentbox,
#security-button[level="ultra"] > .statusbarpanel-contentbox {
list-style-image: url("chrome://communicator/skin/icons/lock-secure.png");
background-color: #E8DB99;
}
#security-button[level="broken"] > .statusbarpanel-contentbox {
list-style-image: url("chrome://communicator/skin/icons/lock-broken.png");
background-color: #E83404;
}
#security-button[label] > .statusbarpanel-contentbox {
background-color: #62C441;
#security-button[level="high"] > .statusbarpanel-contentbox {
background-color: #FFFFC7;
}
#security-button > .statusbarpanel-contentbox > .statusbarpanel-text {
margin: 0px;
color: #FFFFFF;
text-shadow: none;
#security-button[level="ultra"] > .statusbarpanel-contentbox {
background-color: #d2ffc7;
}
/* make same background-color translucent on lwthemes */
#security-button[level="high"] > .statusbarpanel-contentbox:-moz-lwtheme {
background-color: rgba(232, 219, 153, .8);
#security-button[level="broken"] > .statusbarpanel-contentbox {
list-style-image: url("chrome://communicator/skin/icons/lock-broken.png");
background-color: #ffc7c7;
}
#security-button[level="broken"] > .statusbarpanel-contentbox:-moz-lwtheme {
background-color: rgba(232, 52, 4, .8);
#security-button > .statusbarpanel-contentbox > .statusbarpanel-text {
margin: 0px;
}
#security-button[label] > .statusbarpanel-contentbox:-moz-lwtheme {
background-color: rgba(98, 196, 65, .8);
#security-button > .statusbarpanel-contentbox > .statusbarpanel-text[value] {
padding-left: 2px;
padding-right: 4px;
font-weight: bold;
}
#ev-button {

4
navigator/themes/modern/jar.mn

@ -473,8 +473,8 @@ modern.jar:
skin/modern/navigator/btn1/up-dis.gif (navigator/btn1/up-dis.gif)
skin/modern/navigator/btn1/up-hov.gif (navigator/btn1/up-hov.gif)
skin/modern/navigator/btn1/up.gif (navigator/btn1/up.gif)
skin/modern/navigator/toolbar/ubhist-arrow-act.gif (navigator/toolbar/ubhist-arrow-act.gif)
skin/modern/navigator/toolbar/ubhist-arrow.gif (navigator/toolbar/ubhist-arrow.gif)
skin/modern/navigator/toolbar/ubhist-arrow-act.png (navigator/toolbar/ubhist-arrow-act.png)
skin/modern/navigator/toolbar/ubhist-arrow.png (navigator/toolbar/ubhist-arrow.png)
skin/modern/navigator/icons/browser.png (navigator/icons/browser.png)
skin/modern/navigator/icons/browser-small.png (navigator/icons/browser-small.png)
skin/modern/navigator/icons/identity.png (navigator/icons/identity.png)

42
navigator/themes/modern/navigator/navigator.css

@ -476,9 +476,22 @@ toolbar[mode="icons"] #search-button > .button-box > .button-text {
box-shadow: inset 0px -2px #E9F3F6;
}
#urlbar[level="high"],
#urlbar[level="ultra"],
#urlbar[level="broken"] {
box-shadow: none;
}
#urlbar[level="high"] {
background-color: #E8DB99;
box-shadow: none;
}
#urlbar[level="ultra"] {
background-color: #a4e89a;
}
#urlbar[level="broken"] {
background-color: #e89a9a;
}
#urlbar-search-splitter {
@ -752,11 +765,11 @@ panel[nomatch="true"] > .autocomplete-search-box {
margin-bottom: 0px;
margin-inline-start: 0px;
margin-inline-end: 3px;
list-style-image: url("chrome://navigator/skin/toolbar/ubhist-arrow.gif");
list-style-image: url("chrome://navigator/skin/toolbar/ubhist-arrow.png");
}
.autocomplete-history-dropmarker[open="true"] {
list-style-image: url("chrome://navigator/skin/toolbar/ubhist-arrow-act.gif");
list-style-image: url("chrome://navigator/skin/toolbar/ubhist-arrow-act.png");
}
.autocomplete-treebody::-moz-tree-cell-text(treecolAutoCompleteComment) {
@ -876,23 +889,32 @@ toolbar[mode="text"] toolbarbutton.chevron > .toolbarbutton-icon {
list-style-image: url("chrome://communicator/skin/icons/lock-insecure.png");
}
#security-button[level="high"] > .statusbarpanel-contentbox {
#security-button[level="high"] > .statusbarpanel-contentbox,
#security-button[level="ultra"] > .statusbarpanel-contentbox {
list-style-image: url("chrome://communicator/skin/icons/lock-secure.png");
}
#security-button[level="high"] > .statusbarpanel-contentbox {
background-color: #E8DB99;
}
#security-button[level="broken"] > .statusbarpanel-contentbox {
list-style-image: url("chrome://communicator/skin/icons/lock-broken.png");
background-color: #E83404;
#security-button[level="ultra"] > .statusbarpanel-contentbox {
background-color: #a4e89a;
}
#security-button[label] > .statusbarpanel-contentbox {
background-color: #62C441;
#security-button[level="broken"] > .statusbarpanel-contentbox {
list-style-image: url("chrome://communicator/skin/icons/lock-broken.png");
background-color: #e89a9a;
}
#security-button > .statusbarpanel-contentbox > .statusbarpanel-text {
margin: 0px;
color: #FFFFFF;
}
#security-button > .statusbarpanel-contentbox > .statusbarpanel-text[value] {
padding-left: 2px;
padding-right: 4px;
font-weight: bold;
}
#ev-button {

BIN
navigator/themes/modern/navigator/toolbar/ubhist-arrow-act.gif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 67 B

BIN
navigator/themes/modern/navigator/toolbar/ubhist-arrow-act.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 396 B

BIN
navigator/themes/modern/navigator/toolbar/ubhist-arrow.gif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 67 B

BIN
navigator/themes/modern/navigator/toolbar/ubhist-arrow.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 389 B

Loading…
Cancel
Save