Bug 386681, nsIWebProgressListener security: Test for bits, not for absolute values

r=neil
This commit is contained in:
kaie%kuix.de 2007-07-23 11:01:03 +00:00
Родитель 1462d73d35
Коммит 429717cbc8
1 изменённых файлов: 11 добавлений и 1 удалений

Просмотреть файл

@ -387,12 +387,22 @@ 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 |
wpl.STATE_SECURE_HIGH |
wpl.STATE_SECURE_MED |
wpl.STATE_SECURE_LOW;
switch (aState) {
/* 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 | wpl.STATE_SECURE_HIGH:
this.securityButton.setAttribute("level", "high");
this.urlBar.setAttribute("level", "high");
break;
case wpl.STATE_IS_SECURE | wpl.STATE_SECURE_MED:
case wpl.STATE_IS_SECURE | wpl.STATE_SECURE_LOW:
this.securityButton.setAttribute("level", "low");
this.urlBar.setAttribute("level", "low");