Bug 101723: security icon only works for the first tab

Bug 117203: Insecure POST warning only comes up for first tab
Bug 120043: Page Info shows information about a page in the first tab
r=sgehani, r=kaie/ddrinan (for security stuff), sr=sspitzer (for mail/news stuff), sr=hyatt, a=asa. Work based on patch by Smaug <smaug@jippii.fi>.
This commit is contained in:
jaggernaut%netscape.com 2006-09-14 06:04:44 +00:00
parent 2d67cbb974
commit fa4459e05e
2 changed files with 33 additions and 3 deletions

View File

@ -110,7 +110,11 @@ nsBrowserStatusHandler.prototype =
this.stopContext = document.getElementById("context-stop");
this.statusTextField = document.getElementById("statusbar-display");
this.isImage = document.getElementById("isImage");
this.securityButton = document.getElementById("security-button");
// Initialize the security button's state and tooltip text
const nsIWebProgressListener = Components.interfaces.nsIWebProgressListener;
this.onSecurityChange(null, null, nsIWebProgressListener.STATE_IS_INSECURE);
},
destroy : function()
@ -124,6 +128,7 @@ nsBrowserStatusHandler.prototype =
this.stopContext = null;
this.statusTextField = null;
this.isImage = null;
this.securityButton = null;
this.userTyped = null;
},
@ -161,9 +166,8 @@ nsBrowserStatusHandler.prototype =
// check the current value so we don't trigger an attribute change
// and cause needless (slow!) UI updates
if (this.statusTextField.label != text) {
if (this.statusTextField.label != text)
this.statusTextField.label = text;
}
},
onLinkIconAvailable : function(aHref) {
@ -340,6 +344,29 @@ nsBrowserStatusHandler.prototype =
onSecurityChange : function(aWebProgress, aRequest, aState)
{
const wpl = Components.interfaces.nsIWebProgressListener;
switch (aState) {
case wpl.STATE_IS_SECURE | wpl.STATE_SECURE_HIGH:
this.securityButton.setAttribute("level", "high");
break;
case wpl.STATE_IS_SECURE | wpl.STATE_SECURE_LOW:
this.securityButton.setAttribute("level", "low");
break;
case wpl.STATE_IS_BROKEN:
this.securityButton.setAttribute("level", "broken");
break;
case wpl.STATE_IS_INSECURE:
default:
this.securityButton.removeAttribute("level");
break;
}
var securityUI = getBrowser().securityUI;
if (securityUI)
this.securityButton.setAttribute("tooltiptext", securityUI.tooltipText);
else
this.securityButton.removeAttribute("tooltiptext");
},
startDocumentLoad : function(aRequest)

View File

@ -94,7 +94,10 @@ function onLoadPageInfo()
}
else
{
theWindow = window.opener.frames[0];
if ("gBrowser" in window.opener)
theWindow = window.opener.gBrowser.contentWindow;
else
theWindow = window.opener.frames[0];
theDocument = theWindow.document;
docTitle = theBundle.getString("pageInfo.title");
}