bug 402574, Identity UI lost when switching between tabs r=rrelyea, blocking-ff3=mconnor Also includes merged fix for: Bug 405145, Mixed SSL/non-SSL content reporting inconsistent between standard and EV Certs Patch contributed by Bill Gianopoulos r=kengert, a=dsicore

This commit is contained in:
kaie@kuix.de 2007-12-03 14:09:27 -08:00
Родитель a18fce5218
Коммит 2365c28fb2
2 изменённых файлов: 17 добавлений и 31 удалений

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

@ -137,6 +137,7 @@ static PLDHashTableOps gMapOps = {
nsSecureBrowserUIImpl::nsSecureBrowserUIImpl()
: mPreviousSecurityState(lis_no_security),
mPreviousToplevelWasEV(PR_FALSE),
mIsViewSource(PR_FALSE)
{
mTransferringRequests.ops = nsnull;
@ -233,10 +234,16 @@ nsSecureBrowserUIImpl::Init(nsIDOMWindow *window)
NS_IMETHODIMP
nsSecureBrowserUIImpl::GetState(PRUint32* aState)
{
return MapInternalToExternalState(aState, mPreviousSecurityState, mPreviousToplevelWasEV);
}
nsresult
nsSecureBrowserUIImpl::MapInternalToExternalState(PRUint32* aState, lockIconState lock, PRBool ev)
{
NS_ENSURE_ARG(aState);
switch (mPreviousSecurityState)
switch (lock)
{
case lis_broken_security:
*aState = STATE_IS_BROKEN;
@ -258,9 +265,11 @@ nsSecureBrowserUIImpl::GetState(PRUint32* aState)
case lis_no_security:
*aState = STATE_IS_INSECURE;
break;
}
if (ev && (*aState & STATE_IS_SECURE))
*aState |= nsIWebProgressListener::STATE_IDENTITY_EV_TOPLEVEL;
return NS_OK;
}
@ -1109,6 +1118,8 @@ nsresult nsSecureBrowserUIImpl::UpdateSecurityState(nsIRequest* aRequest)
}
mPreviousSecurityState = newSecurityState;
mPreviousToplevelWasEV = mNewToplevelIsEV;
if (lis_no_security == newSecurityState)
{
@ -1120,39 +1131,12 @@ nsresult nsSecureBrowserUIImpl::UpdateSecurityState(nsIRequest* aRequest)
if (mToplevelEventSink)
{
PRUint32 newState = STATE_IS_INSECURE;
switch (newSecurityState)
{
case lis_broken_security:
newState = STATE_IS_BROKEN;
break;
case lis_mixed_security:
newState = STATE_IS_BROKEN;
break;
case lis_low_security:
newState = STATE_IS_SECURE | STATE_SECURE_LOW;
break;
case lis_high_security:
newState = STATE_IS_SECURE | STATE_SECURE_HIGH;
break;
default:
case lis_no_security:
newState = STATE_IS_INSECURE;
break;
}
MapInternalToExternalState(&newState, newSecurityState, mNewToplevelIsEV);
PR_LOG(gSecureDocLog, PR_LOG_DEBUG,
("SecureUI:%p: UpdateSecurityState: calling OnSecurityChange\n", this
));
if (mNewToplevelIsEV)
newState |= nsIWebProgressListener::STATE_IDENTITY_EV_TOPLEVEL;
mToplevelEventSink->OnSecurityChange(aRequest, newState);
}
else

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

@ -107,6 +107,7 @@ protected:
};
lockIconState mPreviousSecurityState;
PRBool mPreviousToplevelWasEV;
void ResetStateTracking();
PRUint32 mNewToplevelSecurityState;
@ -122,6 +123,7 @@ protected:
PRInt32 mSubRequestsBrokenSecurity;
PRInt32 mSubRequestsNoSecurity;
nsresult MapInternalToExternalState(PRUint32* aState, lockIconState lock, PRBool ev);
nsresult UpdateSecurityState(nsIRequest* aRequest);
nsresult EvaluateAndUpdateSecurityState(nsIRequest *aRequest);
void UpdateSubrequestMembers(nsIRequest *aRequest);