From 1c88daaf1fbbdd2fe5f69bc085108dddb5406c2f Mon Sep 17 00:00:00 2001 From: "kaie%kuix.de" Date: Wed, 2 Apr 2008 06:36:17 +0000 Subject: [PATCH] Bug 420246, gBrowser.securityUI doesn't clear invalid cert data after using back button r=rrelyea, r=johnath, sr=gavin, blocking1.9=beltzner git-svn-id: svn://10.0.0.236/trunk@248993 18797224-902f-48f8-a5cc-f745e15eee43 --- .../browser/base/content/pageinfo/security.js | 6 ++++-- .../manager/boot/src/nsSecureBrowserUIImpl.cpp | 16 ++++++++++++++++ .../pki/resources/content/PageInfoOverlay.xul | 10 ++++++---- 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/mozilla/browser/base/content/pageinfo/security.js b/mozilla/browser/base/content/pageinfo/security.js index be2255d4e80..57790747578 100644 --- a/mozilla/browser/base/content/pageinfo/security.js +++ b/mozilla/browser/base/content/pageinfo/security.js @@ -68,13 +68,15 @@ var security = { return null; var isBroken = - (ui.state == Components.interfaces.nsIWebProgressListener.STATE_IS_BROKEN); + (ui.state & Components.interfaces.nsIWebProgressListener.STATE_IS_BROKEN); + var isInsecure = + (ui.state & Components.interfaces.nsIWebProgressListener.STATE_IS_INSECURE); var isEV = (ui.state & Components.interfaces.nsIWebProgressListener.STATE_IDENTITY_EV_TOPLEVEL); ui.QueryInterface(nsISSLStatusProvider); var status = ui.SSLStatus; - if (status) { + if (!isInsecure && status) { status.QueryInterface(nsISSLStatus); var cert = status.serverCert; var issuerName = diff --git a/mozilla/security/manager/boot/src/nsSecureBrowserUIImpl.cpp b/mozilla/security/manager/boot/src/nsSecureBrowserUIImpl.cpp index 98049c5c468..5ff20d6f718 100644 --- a/mozilla/security/manager/boot/src/nsSecureBrowserUIImpl.cpp +++ b/mozilla/security/manager/boot/src/nsSecureBrowserUIImpl.cpp @@ -1441,6 +1441,22 @@ nsSecureBrowserUIImpl::GetSSLStatus(nsISupports** _result) NS_ENSURE_ARG_POINTER(_result); nsAutoMonitor lock(mMonitor); + + switch (mNotifiedSecurityState) + { + case lis_mixed_security: + case lis_low_security: + case lis_high_security: + break; + + default: + NS_NOTREACHED("if this is reached you must add more entries to the switch"); + case lis_no_security: + case lis_broken_security: + *_result = nsnull; + return NS_OK; + } + *_result = mSSLStatus; NS_IF_ADDREF(*_result); diff --git a/mozilla/security/manager/pki/resources/content/PageInfoOverlay.xul b/mozilla/security/manager/pki/resources/content/PageInfoOverlay.xul index c3e520364a4..e3851dca6d3 100644 --- a/mozilla/security/manager/pki/resources/content/PageInfoOverlay.xul +++ b/mozilla/security/manager/pki/resources/content/PageInfoOverlay.xul @@ -88,10 +88,12 @@ var sp = null; var isBroken = false; if (ui) { - isBroken = (ui.state == Components.interfaces.nsIWebProgressListener.STATE_IS_BROKEN); - sp = ui.QueryInterface(nsISSLStatusProvider); - if (sp) - status = sp.SSLStatus; + isBroken = (ui.state & Components.interfaces.nsIWebProgressListener.STATE_IS_BROKEN); + if (!(ui.state & Components.interfaces.nsIWebProgressListener.STATE_IS_INSECURE)) { + sp = ui.QueryInterface(nsISSLStatusProvider); + if (sp) + status = sp.SSLStatus; + } } if (status) { status = status.QueryInterface(nsISSLStatus);