bug 801090. Display a lock in the url bar for tabs that have loaded secure pages. Remove the lock when the user types in the URL bar, or switches to a tab displaying an insecure page. r=mbrubeck

This commit is contained in:
Tim Abraldes 2013-05-16 11:57:26 -07:00
parent 7be5d9d4f8
commit ef4d8a79ac
3 changed files with 31 additions and 16 deletions

View File

@ -16,6 +16,11 @@ const WebProgress = {
messageManager.addMessageListener("Content:LocationChange", this);
messageManager.addMessageListener("Content:SecurityChange", this);
Elements.progress.addEventListener("transitionend", this._progressTransEnd, true);
Elements.tabList.addEventListener("TabSelect", this._onTabSelect, true);
let urlBar = document.getElementById("urlbar-edit");
urlBar.addEventListener("input", this._onUrlBarInput, false);
return this;
},
@ -58,12 +63,17 @@ const WebProgress = {
},
_securityChange: function _securityChange(aJson, aTab) {
// Don't need to do anything if the data we use to update the UI hasn't changed
if (aTab.state == aJson.state && !aTab.hostChanged)
return;
let state = aJson.state;
let identityBox = document.getElementById("identity-box-inner");
let nsIWebProgressListener = Ci.nsIWebProgressListener;
aTab.hostChanged = false;
aTab.state = aJson.state;
if (state & nsIWebProgressListener.STATE_IDENTITY_EV_TOPLEVEL) {
aTab._identityState = identityBox.className = "verifiedIdentity";
} else if (state & nsIWebProgressListener.STATE_IS_SECURE) {
aTab._identityState = identityBox.className = "verifiedDomain";
} else {
aTab._identityState = identityBox.className = "";
}
},
_locationChange: function _locationChange(aJson, aTab) {
@ -77,7 +87,6 @@ const WebProgress = {
if (locationHasChanged) {
Browser.getNotificationBox(aTab.browser).removeTransientNotifications();
aTab.resetZoomLevel();
aTab.hostChanged = true;
aTab.browser.lastLocation = location;
aTab.browser.userTypedValue = "";
aTab.browser.appIcon = { href: null, size:-1 };
@ -204,6 +213,15 @@ const WebProgress = {
Elements.progressContainer.setAttribute("collapsed", true);
}
},
_onTabSelect: function(aEvent) {
let identityBox = document.getElementById("identity-box-inner");
let tab = Browser.getTabFromChrome(aEvent.originalTarget);
identityBox.className = tab._identityState || "";
},
_onUrlBarInput: function(aEvent) {
let identityBox = document.getElementById("identity-box-inner");
Browser.selectedTab._identityState = identityBox.className = "";
},
};

View File

@ -1392,9 +1392,6 @@ function Tab(aURI, aParams, aOwner) {
this.owner = aOwner || null;
this.hostChanged = false;
this.state = null;
// Set to 0 since new tabs that have not been viewed yet are good tabs to
// toss if app needs more memory.
this.lastSelected = 0;

View File

@ -377,12 +377,12 @@ documenttab[selected] .documenttab-selection {
list-style-image: url(chrome://browser/skin/images/identity-icons-generic.png);
}
#identity-box[mode="verifiedDomain"] > #identity-icon[pageproxystate="valid"] {
list-style-image: url(chrome://browser/skin/images/identity-icons-https.png);
#identity-box-inner.verifiedDomain > #identity-icon {
list-style-image: url(chrome://browser/skin/images/locked-hdpi.png);
}
#identity-box[mode="verifiedIdentity"] > #identity-icon[pageproxystate="valid"] {
list-style-image: url(chrome://browser/skin/identity-icons-https-ev.png);
#identity-box-inner.verifiedIdentity > #identity-icon {
list-style-image: url(chrome://browser/skin/images/locked-hdpi.png);
}
/* Main URL textbox */