Backout of bug 135007 due to Tp regression

This commit is contained in:
Dave Townsend 2008-08-18 15:08:44 +01:00
Родитель 15ad1ed095 4f9235f7b3
Коммит 87f67ddbf7
9 изменённых файлов: 19 добавлений и 127 удалений

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

@ -321,16 +321,6 @@ nsresult imgRequest::GetPrincipal(nsIPrincipal **aPrincipal)
return NS_ERROR_FAILURE;
}
nsresult imgRequest::GetSecurityInfo(nsISupports **aSecurityInfo)
{
LOG_FUNC(gImgLog, "imgRequest::GetSecurityInfo");
// Missing security info means this is not a security load
// i.e. it is not an error when security info is missing
NS_IF_ADDREF(*aSecurityInfo = mSecurityInfo);
return NS_OK;
}
void imgRequest::RemoveFromCache()
{
LOG_SCOPE(gImgLog, "imgRequest::RemoveFromCache");
@ -606,10 +596,6 @@ NS_IMETHODIMP imgRequest::OnStartRequest(nsIRequest *aRequest, nsISupports *ctxt
mImageStatus = imgIRequest::STATUS_NONE;
mState = onStartRequest;
nsCOMPtr<nsIChannel> channel(do_QueryInterface(aRequest));
if (channel)
channel->GetSecurityInfo(getter_AddRefs(mSecurityInfo));
/* set our loading flag to true */
mLoading = PR_TRUE;

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

@ -123,7 +123,6 @@ private:
void Cancel(nsresult aStatus);
nsresult GetURI(nsIURI **aURI);
nsresult GetPrincipal(nsIPrincipal **aPrincipal);
nsresult GetSecurityInfo(nsISupports **aSecurityInfo);
void RemoveFromCache();
inline const char *GetMimeType() const {
return mContentType.get();
@ -158,7 +157,6 @@ private:
nsCOMPtr<imgIContainer> mImage;
nsCOMPtr<imgIDecoder> mDecoder;
nsCOMPtr<nsIProperties> mProperties;
nsCOMPtr<nsISupports> mSecurityInfo;
nsTObserverArray<imgRequestProxy*> mObservers;

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

@ -55,8 +55,8 @@
#include "nspr.h"
NS_IMPL_ISUPPORTS4(imgRequestProxy, imgIRequest, nsIRequest,
nsISupportsPriority, nsISecurityInfoProvider)
NS_IMPL_ISUPPORTS3(imgRequestProxy, imgIRequest, nsIRequest,
nsISupportsPriority)
imgRequestProxy::imgRequestProxy() :
mOwner(nsnull),
@ -383,17 +383,6 @@ NS_IMETHODIMP imgRequestProxy::AdjustPriority(PRInt32 priority)
return NS_OK;
}
/** nsISecurityInfoProvider methods **/
NS_IMETHODIMP imgRequestProxy::GetSecurityInfo(nsISupports** retval)
{
if (mOwner)
return mOwner->GetSecurityInfo(retval);
*retval = nsnull;
return NS_OK;
}
/** imgIContainerObserver methods **/
void imgRequestProxy::FrameChanged(imgIContainer *container, gfxIImageFrame *newframe, nsIntRect * dirtyRect)

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

@ -39,7 +39,6 @@
#include "imgIRequest.h"
#include "imgIDecoderObserver.h"
#include "nsISecurityInfoProvider.h"
#include "imgIContainer.h"
#include "imgIDecoder.h"
@ -60,14 +59,13 @@
{0x8f, 0x65, 0x9c, 0x46, 0x2e, 0xe2, 0xbc, 0x95} \
}
class imgRequestProxy : public imgIRequest, public nsISupportsPriority, public nsISecurityInfoProvider
class imgRequestProxy : public imgIRequest, public nsISupportsPriority
{
public:
NS_DECL_ISUPPORTS
NS_DECL_IMGIREQUEST
NS_DECL_NSIREQUEST
NS_DECL_NSISUPPORTSPRIORITY
NS_DECL_NSISECURITYINFOPROVIDER
imgRequestProxy();
virtual ~imgRequestProxy();

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

@ -100,7 +100,6 @@ XPIDLSRCS = \
nsIServerSocket.idl \
nsIResumableChannel.idl \
nsIRequestObserverProxy.idl \
nsISecurityInfoProvider.idl \
nsIStreamListenerTee.idl \
nsISimpleStreamListener.idl \
nsIStreamTransportService.idl \

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

@ -1,44 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is mozilla.org
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Honza Bambas <honzab@firemni.cz>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
[scriptable, uuid(9E03B4C6-8B79-41a8-A3E5-C41F9E015598)]
interface nsISecurityInfoProvider : nsISupports
{
readonly attribute nsISupports securityInfo;
};

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

@ -76,7 +76,6 @@ REQUIRES = nspr \
caps \
pref \
pipnss \
imglib2 \
$(NULL)
include $(topsrcdir)/config/rules.mk

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

@ -78,9 +78,7 @@
#include "nsIPrompt.h"
#include "nsIFormSubmitObserver.h"
#include "nsISecurityWarningDialogs.h"
#include "nsISecurityInfoProvider.h"
#include "nsIProxyObjectManager.h"
#include "imgIRequest.h"
#include "nsThreadUtils.h"
#include "nsNetUtil.h"
#include "nsCRT.h"
@ -273,24 +271,6 @@ nsSecureBrowserUIImpl::GetState(PRUint32* aState)
return MapInternalToExternalState(aState, mNotifiedSecurityState, mNotifiedToplevelIsEV);
}
// static
already_AddRefed<nsISupports>
nsSecureBrowserUIImpl::ExtractSecurityInfo(nsIRequest* aRequest)
{
nsISupports *retval = nsnull;
nsCOMPtr<nsIChannel> channel(do_QueryInterface(aRequest));
if (channel)
channel->GetSecurityInfo(&retval);
if (!retval) {
nsCOMPtr<nsISecurityInfoProvider> provider(do_QueryInterface(aRequest));
if (provider)
provider->GetSecurityInfo(&retval);
}
return retval;
}
nsresult
nsSecureBrowserUIImpl::MapInternalToExternalState(PRUint32* aState, lockIconState lock, PRBool ev)
{
@ -758,11 +738,13 @@ nsSecureBrowserUIImpl::OnStateChange(nsIWebProgress* aWebProgress,
}
#endif
nsCOMPtr<nsISupports> securityInfo(ExtractSecurityInfo(aRequest));
nsCOMPtr<nsISupports> securityInfo;
nsCOMPtr<nsIChannel> channel(do_QueryInterface(aRequest));
if (channel)
{
channel->GetSecurityInfo(getter_AddRefs(securityInfo));
nsCOMPtr<nsIURI> uri;
channel->GetURI(getter_AddRefs(uri));
if (uri)
@ -807,7 +789,6 @@ nsSecureBrowserUIImpl::OnStateChange(nsIWebProgress* aWebProgress,
#endif
PRBool isSubDocumentRelevant = PR_TRUE;
PRBool isImageRequest = PR_FALSE;
// We are only interested in requests that load in the browser window...
nsCOMPtr<nsIHttpChannel> httpRequest(do_QueryInterface(aRequest));
@ -818,18 +799,9 @@ nsSecureBrowserUIImpl::OnStateChange(nsIWebProgress* aWebProgress,
if (!wyciwygRequest) {
nsCOMPtr<nsIFTPChannel> ftpRequest(do_QueryInterface(aRequest));
if (!ftpRequest) {
nsCOMPtr<imgIRequest> imgRequest(do_QueryInterface(aRequest));
if (!imgRequest) {
PR_LOG(gSecureDocLog, PR_LOG_DEBUG,
("SecureUI:%p: OnStateChange: not relevant for sub content\n", this));
isSubDocumentRelevant = PR_FALSE;
} else {
// Remember this is an image request. Because image loads doesn't
// support any TRANSFERRING notifications but only START and
// STOP we must simply predict there were a content transferred.
// See bug 432685 for details.
isImageRequest = PR_TRUE;
}
PR_LOG(gSecureDocLog, PR_LOG_DEBUG,
("SecureUI:%p: OnStateChange: not relevant for sub content\n", this));
isSubDocumentRelevant = PR_FALSE;
}
}
}
@ -979,20 +951,13 @@ nsSecureBrowserUIImpl::OnStateChange(nsIWebProgress* aWebProgress,
&&
aProgressStateFlags & STATE_IS_REQUEST)
{
if (isImageRequest)
nsAutoMonitor lock(mMonitor);
PLDHashEntryHdr *entry = PL_DHashTableOperate(&mTransferringRequests, aRequest, PL_DHASH_LOOKUP);
if (PL_DHASH_ENTRY_IS_BUSY(entry))
{
requestHasTransferedData = PR_TRUE;
}
else
{
nsAutoMonitor lock(mMonitor);
PLDHashEntryHdr *entry = PL_DHashTableOperate(&mTransferringRequests, aRequest, PL_DHASH_LOOKUP);
if (PL_DHASH_ENTRY_IS_BUSY(entry))
{
PL_DHashTableOperate(&mTransferringRequests, aRequest, PL_DHASH_REMOVE);
PL_DHashTableOperate(&mTransferringRequests, aRequest, PL_DHASH_REMOVE);
requestHasTransferedData = PR_TRUE;
}
requestHasTransferedData = PR_TRUE;
}
}
@ -1485,7 +1450,10 @@ nsSecureBrowserUIImpl::OnLocationChange(nsIWebProgress* aWebProgress,
nsCOMPtr<nsIDOMWindow> windowForProgress;
aWebProgress->GetDOMWindow(getter_AddRefs(windowForProgress));
nsCOMPtr<nsISupports> securityInfo(ExtractSecurityInfo(aRequest));
nsCOMPtr<nsISupports> securityInfo;
nsCOMPtr<nsIChannel> channel(do_QueryInterface(aRequest));
if (channel)
channel->GetSecurityInfo(getter_AddRefs(securityInfo));
if (windowForProgress.get() == window.get()) {
// For toplevel channels, update the security state right away.

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

@ -126,7 +126,6 @@ protected:
PRInt32 mSubRequestsBrokenSecurity;
PRInt32 mSubRequestsNoSecurity;
static already_AddRefed<nsISupports> ExtractSecurityInfo(nsIRequest* aRequest);
static nsresult MapInternalToExternalState(PRUint32* aState, lockIconState lock, PRBool ev);
nsresult UpdateSecurityState(nsIRequest* aRequest);
void UpdateMyFlags(PRBool &showWarning, lockIconState &warnSecurityState);