Bug 1335016 - Add tooltip to identity popup expander button. r=MarcoZ,florian
MozReview-Commit-ID: 7ulEwzyYFsW
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -6854,16 +6854,20 @@ var gIdentityHandler = {
get _permissionEmptyHint() {
delete this._permissionEmptyHint;
return this._permissionEmptyHint = document.getElementById("identity-popup-permission-empty-hint");
},
get _permissionReloadHint() {
delete this._permissionReloadHint;
return this._permissionReloadHint = document.getElementById("identity-popup-permission-reload-hint");
},
+ get _popupExpander() {
+ delete this._popupExpander;
+ return this._popupExpander = document.getElementById("identity-popup-security-expander");
+ },
get _permissionAnchors() {
delete this._permissionAnchors;
let permissionAnchors = {};
for (let anchor of document.getElementById("blocked-permissions-container").children) {
permissionAnchors[anchor.getAttribute("data-permission-id")] = anchor;
}
return this._permissionAnchors = permissionAnchors;
},
@@ -6875,20 +6879,28 @@ var gIdentityHandler = {
handleMoreInfoClick(event) {
displaySecurityInfo();
event.stopPropagation();
this._identityPopup.hidePopup();
},
toggleSubView(name, anchor) {
let view = this._identityPopupMultiView;
+ let id = `identity-popup-${name}View`;
+ let subView = document.getElementById(id);
+
+ // Listen for the subview showing or hiding to change
+ // the tooltip on the expander button.
+ subView.addEventListener("ViewShowing", this);
+ subView.addEventListener("ViewHiding", this);
+
if (view.showingSubView) {
view.showMainView();
} else {
- view.showSubView(`identity-popup-${name}View`, anchor);
+ view.showSubView(id, anchor);
}
// If an element is focused that's not the anchor, clear the focus.
// Elements of hidden views have -moz-user-focus:ignore but setting that
// per CSS selector doesn't blur a focused element in those hidden views.
if (Services.focus.focusedElement != anchor) {
Services.focus.clearFocus(window);
}
@@ -7187,16 +7199,19 @@ var gIdentityHandler = {
refreshIdentityPopup() {
// Update "Learn More" for Mixed Content Blocking and Insecure Login Forms.
let baseURL = Services.urlFormatter.formatURLPref("app.support.baseURL");
this._identityPopupMixedContentLearnMore
.setAttribute("href", baseURL + "mixed-content");
this._identityPopupInsecureLoginFormsLearnMore
.setAttribute("href", baseURL + "insecure-password");
+ // The expander switches its tooltip when toggled, change it to the default.
+ this._popupExpander.tooltipText = gNavigatorBundle.getString("identity.showDetails.tooltip");
+
// Determine connection security information.
let connection = "not-secure";
if (this._isSecureInternalUI) {
connection = "chrome";
} else if (this._isURILoadedFromFile) {
connection = "file";
} else if (this._isEV) {
connection = "secure-ev";
@@ -7396,16 +7411,26 @@ var gIdentityHandler = {
onPopupHidden(event) {
if (event.target == this._identityPopup) {
window.removeEventListener("focus", this, true);
this._identityBox.removeAttribute("open");
}
},
handleEvent(event) {
+ // If the subview is shown or hidden, change the tooltip on the expander button.
+ if (event.type == "ViewShowing") {
+ this._popupExpander.tooltipText = gNavigatorBundle.getString("identity.hideDetails.tooltip");
+ return;
+ }
+ if (event.type == "ViewHiding") {
+ this._popupExpander.tooltipText = gNavigatorBundle.getString("identity.showDetails.tooltip");
+ return;
+ }
+
let elem = document.activeElement;
let position = elem.compareDocumentPosition(this._identityPopup);
if (!(position & (Node.DOCUMENT_POSITION_CONTAINS |
Node.DOCUMENT_POSITION_CONTAINED_BY)) &&
!this._identityPopup.hasAttribute("noautohide")) {
// Hide the panel when focusing an element that is
// neither an ancestor nor descendant unless the panel has
--- a/browser/locales/en-US/chrome/browser/browser.properties
+++ b/browser/locales/en-US/chrome/browser/browser.properties
@@ -438,16 +438,18 @@ offlineApps.usage=This website (%S) is n
offlineApps.manageUsage=Show settings
offlineApps.manageUsageAccessKey=S
identity.identified.verifier=Verified by: %S
identity.identified.verified_by_you=You have added a security exception for this site.
identity.identified.state_and_country=%S, %S
identity.icon.tooltip=Show site information
+identity.showDetails.tooltip=Show connection details
+identity.hideDetails.tooltip=Hide connection details
trackingProtection.intro.title=How Tracking Protection works
# LOCALIZATION NOTE (trackingProtection.intro.description2):
# %S is brandShortName. This string should match the one from Step 1 of the tour
# when it starts from the button shown when a new private window is opened.
trackingProtection.intro.description2=When you see the shield, %S is blocking some parts of the page that could track your browsing activity.
# LOCALIZATION NOTE (trackingProtection.intro.step1of3): Indicates that the intro panel is step one of three in a tour.
trackingProtection.intro.step1of3=1 of 3