From 4389d95a7f04df9c809ad7d6f6492e7b308197cf Mon Sep 17 00:00:00 2001 From: "kaie%netscape.com" Date: Fri, 8 Mar 2002 22:27:16 +0000 Subject: [PATCH] b=125807 Fix Lock Icon Set Incorrectly Checking in for ddrinan r=kaie sr=mscott a=asa git-svn-id: svn://10.0.0.236/trunk@116204 18797224-902f-48f8-a5cc-f745e15eee43 --- .../boot/src/nsSecureBrowserUIImpl.cpp | 26 ++++++++++++++----- .../manager/boot/src/nsSecureBrowserUIImpl.h | 1 + 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/mozilla/security/manager/boot/src/nsSecureBrowserUIImpl.cpp b/mozilla/security/manager/boot/src/nsSecureBrowserUIImpl.cpp index 7158b192344..fd6a69b5f56 100644 --- a/mozilla/security/manager/boot/src/nsSecureBrowserUIImpl.cpp +++ b/mozilla/security/manager/boot/src/nsSecureBrowserUIImpl.cpp @@ -334,10 +334,17 @@ nsSecureBrowserUIImpl::OnStateChange(nsIWebProgress* aWebProgress, mMixContentAlertShown = PR_FALSE; mFirstRequest = PR_TRUE; mSSLStatus = nsnull; + mRedirecting = PR_FALSE; } } - - // A Document is starting to load... + + // We need to keep track of redirects. This tells us that the current request is going + // to be redirected after it finishes loading. + if ((aProgressStateFlags & STATE_IS_REQUEST) && (aProgressStateFlags & STATE_REDIRECTING)) { + mRedirecting = PR_TRUE; + } + + // Request has completed. if ((aProgressStateFlags & (STATE_STOP)) && (aProgressStateFlags & STATE_IS_REQUEST)) { @@ -350,6 +357,16 @@ nsSecureBrowserUIImpl::OnStateChange(nsIWebProgress* aWebProgress, return NS_OK; } + // The document is going to be redirected. + // We must reset our state and start again because the new document may have different security. + if (mRedirecting) { + mMixContentAlertShown = PR_FALSE; + mFirstRequest = PR_TRUE; + mSSLStatus = nsnull; + mRedirecting = PR_FALSE; + return NS_OK; + } + // If this is the first request, then do a protocol check if (mFirstRequest) { mFirstRequest = PR_FALSE; @@ -556,11 +573,6 @@ nsSecureBrowserUIImpl::CheckMixedContext(nsISecurityEventSink *eventSink, newSecurityState = GetSecurityStateFromChannel(aChannel); - // Deal with http redirect to https // - if (mSecurityState == STATE_IS_INSECURE && newSecurityState != STATE_IS_INSECURE) { - return CheckProtocolContextSwitch(eventSink, aRequest, aChannel); - } - if ((newSecurityState == STATE_IS_INSECURE || newSecurityState == STATE_IS_BROKEN) && IS_SECURE(mSecurityState)) { diff --git a/mozilla/security/manager/boot/src/nsSecureBrowserUIImpl.h b/mozilla/security/manager/boot/src/nsSecureBrowserUIImpl.h index a04f3eff806..0107dd20080 100644 --- a/mozilla/security/manager/boot/src/nsSecureBrowserUIImpl.h +++ b/mozilla/security/manager/boot/src/nsSecureBrowserUIImpl.h @@ -86,6 +86,7 @@ protected: PRBool mMixContentAlertShown; PRInt32 mSecurityState; PRBool mFirstRequest; + PRBool mRedirecting; nsCOMPtr mSSLStatus;