Skip to content

Commit 8bec0af

Browse files
committed
Fix #677: SSL indicator broken in FF51
I use a different method to indicate SSL status. The element of "#connection-icon" is the icon for ssl, so I copied its style to ssl field of statusline. In case of InsecureLoginForms, connection-icon is updated after page load, so ssl field has to be updated on InsecureLoginFormsStateChange.
1 parent 036d645 commit 8bec0af

File tree

1 file changed

+53
-29
lines changed

1 file changed

+53
-29
lines changed

common/content/statusline.js

Lines changed: 53 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,14 @@ const StatusLine = Module("statusline", {
7474
this._statuslineWidget = document.getElementById("liberator-status");
7575
// initialize setVisibility static variables
7676
this.setVisibility(-1);
77+
// In case of insecure login forms, connection icon is updated after page load.
78+
const VERSION = Services.appinfo.platformVersion;
79+
if (services.get("vc").compare(VERSION, "51") >= 0) {
80+
gBrowser.addEventListener("InsecureLoginFormsStateChange",
81+
function () {
82+
statusline.updateField('ssl', null);
83+
});
84+
}
7785
},
7886

7987
/**
@@ -241,37 +249,53 @@ const StatusLine = Module("statusline", {
241249
});
242250
statusline.addField("ssl", "The currently SSL status", "liberator-status-ssl",
243251
function updateSSLState (node, state) {
244-
var className = "notSecure";
245-
var tooltip = gNavigatorBundle.getString("identity.unknown.tooltip");
246-
if (!state) {
247-
let securityUI = config.tabbrowser.securityUI;
248-
if (securityUI)
249-
state = securityUI.state || 0;
250-
}
251-
const WPL = Components.interfaces.nsIWebProgressListener;
252-
if (state & WPL.STATE_IDENTITY_EV_TOPLEVEL) {
253-
className = "verifiedIdentity";
254-
if (state & WPL.STATE_BLOCKED_MIXED_ACTIVE_CONTENT)
255-
className = "mixedActiveBlocked";
256-
tooltip = gNavigatorBundle.getFormattedString(
257-
"identity.identified.verifier",
258-
[gIdentityHandler.getIdentityData().caOrg]);
259-
} else if (state & WPL.STATE_IS_SECURE) {
260-
className = "verifiedDomain";
261-
if (state & WPL.STATE_BLOCKED_MIXED_ACTIVE_CONTENT)
262-
className = "mixedActiveBlocked";
263-
tooltip = gNavigatorBundle.getFormattedString(
264-
"identity.identified.verifier",
265-
[gIdentityHandler.getIdentityData().caOrg]);
266-
} else if (state & WPL.STATE_IS_BROKEN) {
267-
if (state & WPL.STATE_LOADED_MIXED_ACTIVE_CONTENT)
268-
className = "mixedActiveContent";
252+
const VERSION = Services.appinfo.platformVersion;
253+
if (services.get("vc").compare(VERSION, "51") >= 0) {
254+
conn_icon = document.getElementById("connection-icon");
255+
node.style.listStyleImage = window.getComputedStyle(conn_icon).getPropertyValue("list-style-image");
256+
if (node.style.listStyleImage === "none")
257+
node.style.listStyleImage = "url(chrome://browser/skin/identity-icon.svg#normal)";
258+
259+
node.style.visibility = "visible";
260+
261+
var tooltip = conn_icon.tooltipText;
262+
if (tooltip)
263+
node.setAttribute("tooltiptext", tooltip);
269264
else
270-
className = "mixedDisplayContent";
271-
tooltip = gNavigatorBundle.getString("identity.unknown.tooltip");
265+
node.removeAttribute("tooltiptext");
266+
} else {
267+
var className = "notSecure";
268+
var tooltip = gNavigatorBundle.getString("identity.unknown.tooltip");
269+
if (!state) {
270+
let securityUI = config.tabbrowser.securityUI;
271+
if (securityUI)
272+
state = securityUI.state || 0;
273+
}
274+
const WPL = Components.interfaces.nsIWebProgressListener;
275+
if (state & WPL.STATE_IDENTITY_EV_TOPLEVEL) {
276+
className = "verifiedIdentity";
277+
if (state & WPL.STATE_BLOCKED_MIXED_ACTIVE_CONTENT)
278+
className = "mixedActiveBlocked";
279+
tooltip = gNavigatorBundle.getFormattedString(
280+
"identity.identified.verifier",
281+
[gIdentityHandler.getIdentityData().caOrg]);
282+
} else if (state & WPL.STATE_IS_SECURE) {
283+
className = "verifiedDomain";
284+
if (state & WPL.STATE_BLOCKED_MIXED_ACTIVE_CONTENT)
285+
className = "mixedActiveBlocked";
286+
tooltip = gNavigatorBundle.getFormattedString(
287+
"identity.identified.verifier",
288+
[gIdentityHandler.getIdentityData().caOrg]);
289+
} else if (state & WPL.STATE_IS_BROKEN) {
290+
if (state & WPL.STATE_LOADED_MIXED_ACTIVE_CONTENT)
291+
className = "mixedActiveContent";
292+
else
293+
className = "mixedDisplayContent";
294+
tooltip = gNavigatorBundle.getString("identity.unknown.tooltip");
295+
}
296+
node.className = className;
297+
node.setAttribute("tooltiptext", tooltip);
272298
}
273-
node.className = className;
274-
node.setAttribute("tooltiptext", tooltip);
275299
}, {
276300
openPopup: function (anchor) {
277301
var handler = window.gIdentityHandler;

0 commit comments

Comments
 (0)