зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 4b22cab7e989
This commit is contained in:
Родитель
0b04049fcd
Коммит
70b2823255
|
@ -1012,8 +1012,8 @@ NS_IMETHODIMP imgLoader::LoadImage(nsIURI *aURI,
|
|||
// for correctly dealing with image load requests that are a result
|
||||
// of post data.
|
||||
imgCacheTable &cache = GetCache(aURI);
|
||||
|
||||
nsCAutoString spec;
|
||||
|
||||
aURI->GetSpec(spec);
|
||||
|
||||
if (cache.Get(spec, getter_AddRefs(entry)) && entry) {
|
||||
|
@ -1061,7 +1061,7 @@ NS_IMETHODIMP imgLoader::LoadImage(nsIURI *aURI,
|
|||
newChannel->SetLoadGroup(loadGroup);
|
||||
|
||||
void *cacheId = NS_GetCurrentThread();
|
||||
request->Init(aURI, loadGroup, newChannel, entry, cacheId, aCX);
|
||||
request->Init(aURI, loadGroup, entry, cacheId, aCX);
|
||||
|
||||
// create the proxy listener
|
||||
ProxyListener *pl = new ProxyListener(static_cast<nsIStreamListener *>(request.get()));
|
||||
|
@ -1193,12 +1193,19 @@ NS_IMETHODIMP imgLoader::LoadImageWithChannel(nsIChannel *channel, imgIDecoderOb
|
|||
|
||||
*listener = nsnull; // give them back a null nsIStreamListener
|
||||
} else {
|
||||
|
||||
// Get the current Thread... This is used as a cacheId to prevent
|
||||
// sharing requests which are being loaded across multiple threads...
|
||||
nsIThread *thread = NS_GetCurrentThread();
|
||||
|
||||
NewRequestAndEntry(uri, getter_AddRefs(request), getter_AddRefs(entry));
|
||||
|
||||
// We use originalURI here to fulfil the imgIRequest contract on GetURI.
|
||||
// XXX(darin): I'm not sure that using the original URI is correct here.
|
||||
// Perhaps we should use the same URI that indexes the cache? Or, perhaps
|
||||
// the cache should use the original URI? See bug 89419.
|
||||
nsCOMPtr<nsIURI> originalURI;
|
||||
channel->GetOriginalURI(getter_AddRefs(originalURI));
|
||||
request->Init(originalURI, channel, channel, entry, NS_GetCurrentThread(), aCX);
|
||||
request->Init(originalURI, channel, entry, thread, aCX);
|
||||
|
||||
ProxyListener *pl = new ProxyListener(static_cast<nsIStreamListener *>(request.get()));
|
||||
if (!pl)
|
||||
|
@ -1468,10 +1475,12 @@ NS_IMETHODIMP imgCacheValidator::OnStartRequest(nsIRequest *aRequest, nsISupport
|
|||
if (!NewRequestAndEntry(uri, &request, getter_AddRefs(entry)))
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
// We use originalURI here to fulfil the imgIRequest contract on GetURI.
|
||||
// XXX(darin): I'm not sure that using the original URI is correct here.
|
||||
// Perhaps we should use the same URI that indexes the cache? Or, perhaps
|
||||
// the cache should use the original URI? See bug 89419.
|
||||
nsCOMPtr<nsIURI> originalURI;
|
||||
channel->GetOriginalURI(getter_AddRefs(originalURI));
|
||||
request->Init(originalURI, channel, channel, entry, NS_GetCurrentThread(), mContext);
|
||||
request->Init(originalURI, channel, entry, NS_GetCurrentThread(), mContext);
|
||||
|
||||
ProxyListener *pl = new ProxyListener(static_cast<nsIStreamListener *>(request));
|
||||
if (!pl) {
|
||||
|
|
|
@ -58,7 +58,6 @@
|
|||
#include "nsIHttpChannel.h"
|
||||
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsIProxyObjectManager.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsISupportsPrimitives.h"
|
||||
|
@ -74,12 +73,10 @@
|
|||
PRLogModuleInfo *gImgLog = PR_NewLogModule("imgRequest");
|
||||
#endif
|
||||
|
||||
NS_IMPL_ISUPPORTS8(imgRequest, imgILoad,
|
||||
NS_IMPL_ISUPPORTS6(imgRequest, imgILoad,
|
||||
imgIDecoderObserver, imgIContainerObserver,
|
||||
nsIStreamListener, nsIRequestObserver,
|
||||
nsISupportsWeakReference,
|
||||
nsIChannelEventSink,
|
||||
nsIInterfaceRequestor)
|
||||
nsISupportsWeakReference)
|
||||
|
||||
imgRequest::imgRequest() :
|
||||
mLoading(PR_FALSE), mProcessing(PR_FALSE), mHadLastPart(PR_FALSE),
|
||||
|
@ -97,7 +94,6 @@ imgRequest::~imgRequest()
|
|||
|
||||
nsresult imgRequest::Init(nsIURI *aURI,
|
||||
nsIRequest *aRequest,
|
||||
nsIChannel *aChannel,
|
||||
imgCacheEntry *aCacheEntry,
|
||||
void *aCacheId,
|
||||
void *aLoadId)
|
||||
|
@ -107,7 +103,6 @@ nsresult imgRequest::Init(nsIURI *aURI,
|
|||
NS_ASSERTION(!mImage, "Multiple calls to init");
|
||||
NS_ASSERTION(aURI, "No uri");
|
||||
NS_ASSERTION(aRequest, "No request");
|
||||
NS_ASSERTION(aChannel, "No channel");
|
||||
|
||||
mProperties = do_CreateInstance("@mozilla.org/properties;1");
|
||||
if (!mProperties)
|
||||
|
@ -115,13 +110,6 @@ nsresult imgRequest::Init(nsIURI *aURI,
|
|||
|
||||
mURI = aURI;
|
||||
mRequest = aRequest;
|
||||
mChannel = aChannel;
|
||||
mChannel->GetNotificationCallbacks(getter_AddRefs(mPrevChannelSink));
|
||||
|
||||
NS_ASSERTION(mPrevChannelSink != this,
|
||||
"Initializing with a channel that already calls back to us!");
|
||||
|
||||
mChannel->SetNotificationCallbacks(this);
|
||||
|
||||
/* set our loading flag to true here.
|
||||
Setting it here lets checks to see if the load is in progress
|
||||
|
@ -749,21 +737,15 @@ NS_IMETHODIMP imgRequest::OnStopRequest(nsIRequest *aRequest, nsISupports *ctxt,
|
|||
}
|
||||
|
||||
// XXXldb What if this is a non-last part of a multipart request?
|
||||
// xxx before we release our reference to mRequest, lets
|
||||
// xxx before we release our reference to mChannel, lets
|
||||
// save the last status that we saw so that the
|
||||
// imgRequestProxy will have access to it.
|
||||
if (mRequest) {
|
||||
if (mRequest)
|
||||
{
|
||||
mRequest->GetStatus(&mNetworkStatus);
|
||||
mRequest = nsnull; // we no longer need the request
|
||||
}
|
||||
|
||||
// stop holding a ref to the channel, since we don't need it anymore
|
||||
if (mChannel) {
|
||||
mChannel->SetNotificationCallbacks(mPrevChannelSink);
|
||||
mPrevChannelSink = nsnull;
|
||||
mChannel = nsnull;
|
||||
}
|
||||
|
||||
// If mImage is still null, we didn't properly load the image.
|
||||
if (NS_FAILED(status) || !mImage) {
|
||||
this->Cancel(status); // sets status, stops animations, removes from cache
|
||||
|
@ -975,48 +957,3 @@ imgRequest::GetNetworkStatus()
|
|||
|
||||
return status;
|
||||
}
|
||||
|
||||
/** nsIInterfaceRequestor methods **/
|
||||
|
||||
NS_IMETHODIMP
|
||||
imgRequest::GetInterface(const nsIID & aIID, void **aResult)
|
||||
{
|
||||
if (!mPrevChannelSink || aIID.Equals(NS_GET_IID(nsIChannelEventSink)))
|
||||
return QueryInterface(aIID, aResult);
|
||||
|
||||
NS_ASSERTION(mPrevChannelSink != this,
|
||||
"Infinite recursion - don't keep track of channel sinks that are us!");
|
||||
return mPrevChannelSink->GetInterface(aIID, aResult);
|
||||
}
|
||||
|
||||
/** nsIChannelEventSink methods **/
|
||||
|
||||
/* void onChannelRedirect (in nsIChannel oldChannel, in nsIChannel newChannel, in unsigned long flags); */
|
||||
NS_IMETHODIMP
|
||||
imgRequest::OnChannelRedirect(nsIChannel *oldChannel, nsIChannel *newChannel, PRUint32 flags)
|
||||
{
|
||||
NS_ASSERTION(mRequest && mChannel, "Got an OnChannelRedirect after we nulled out mRequest!");
|
||||
NS_ASSERTION(mChannel == oldChannel, "Got a channel redirect for an unknown channel!");
|
||||
NS_ASSERTION(newChannel, "Got a redirect to a NULL channel!");
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
nsCOMPtr<nsIChannelEventSink> sink(do_GetInterface(mPrevChannelSink));
|
||||
if (sink) {
|
||||
rv = sink->OnChannelRedirect(oldChannel, newChannel, flags);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
}
|
||||
|
||||
RemoveFromCache();
|
||||
|
||||
mChannel = newChannel;
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
newChannel->GetOriginalURI(getter_AddRefs(uri));
|
||||
|
||||
// If we don't still have a cache entry, we don't want to refresh the cache.
|
||||
if (uri && mCacheEntry)
|
||||
imgLoader::PutIntoCache(uri, mCacheEntry);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -46,9 +46,7 @@
|
|||
#include "imgIDecoder.h"
|
||||
#include "imgIDecoderObserver.h"
|
||||
|
||||
#include "nsIChannelEventSink.h"
|
||||
#include "nsIContentSniffer.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
#include "nsIRequest.h"
|
||||
#include "nsIProperties.h"
|
||||
#include "nsIStreamListener.h"
|
||||
|
@ -78,9 +76,7 @@ enum {
|
|||
class imgRequest : public imgILoad,
|
||||
public imgIDecoderObserver,
|
||||
public nsIStreamListener,
|
||||
public nsSupportsWeakReference,
|
||||
public nsIChannelEventSink,
|
||||
public nsIInterfaceRequestor
|
||||
public nsSupportsWeakReference
|
||||
{
|
||||
public:
|
||||
imgRequest();
|
||||
|
@ -90,7 +86,6 @@ public:
|
|||
|
||||
nsresult Init(nsIURI *aURI,
|
||||
nsIRequest *aRequest,
|
||||
nsIChannel *aChannel,
|
||||
imgCacheEntry *aCacheEntry,
|
||||
void *aCacheId,
|
||||
void *aLoadId);
|
||||
|
@ -155,8 +150,6 @@ public:
|
|||
NS_DECL_IMGICONTAINEROBSERVER
|
||||
NS_DECL_NSISTREAMLISTENER
|
||||
NS_DECL_NSIREQUESTOBSERVER
|
||||
NS_DECL_NSICHANNELEVENTSINK
|
||||
NS_DECL_NSIINTERFACEREQUESTOR
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsIRequest> mRequest;
|
||||
|
@ -166,8 +159,6 @@ private:
|
|||
nsCOMPtr<imgIDecoder> mDecoder;
|
||||
nsCOMPtr<nsIProperties> mProperties;
|
||||
nsCOMPtr<nsISupports> mSecurityInfo;
|
||||
nsCOMPtr<nsIChannel> mChannel;
|
||||
nsCOMPtr<nsIInterfaceRequestor> mPrevChannelSink;
|
||||
|
||||
nsTObserverArray<imgRequestProxy*> mObservers;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче