diff --git a/image/src/imgLoader.cpp b/image/src/imgLoader.cpp index 9d0742234802..52f1e5466c60 100644 --- a/image/src/imgLoader.cpp +++ b/image/src/imgLoader.cpp @@ -28,6 +28,7 @@ #include "nsIAsyncVerifyRedirectCallback.h" #include "nsIFileURL.h" #include "nsCRT.h" +#include "nsIDocument.h" #include "nsINetworkPredictor.h" #include "nsIApplicationCache.h" @@ -2045,6 +2046,12 @@ nsresult imgLoader::LoadImage(nsIURI *aURI, timedChannel->SetInitiatorType(initiatorType); } + // Pass the inner window ID of the loading document, if possible. + nsCOMPtr doc = do_QueryInterface(aCX); + if (doc) { + request->SetInnerWindowID(doc->InnerWindowID()); + } + // create the proxy listener nsCOMPtr pl = new ProxyListener(request.get()); @@ -2508,8 +2515,7 @@ NS_IMPL_ISUPPORTS(imgCacheValidator, nsIStreamListener, nsIRequestObserver, imgCacheValidator::imgCacheValidator(nsProgressNotificationProxy* progress, imgLoader* loader, imgRequest *request, - nsISupports* aContext, - bool forcePrincipalCheckForCacheEntry) + void *aContext, bool forcePrincipalCheckForCacheEntry) : mProgressProxy(progress), mRequest(request), mContext(aContext), diff --git a/image/src/imgLoader.h b/image/src/imgLoader.h index 8fbb872c8de3..e6a38fda575f 100644 --- a/image/src/imgLoader.h +++ b/image/src/imgLoader.h @@ -497,8 +497,7 @@ class imgCacheValidator : public nsIStreamListener, { public: imgCacheValidator(nsProgressNotificationProxy* progress, imgLoader* loader, - imgRequest* aRequest, nsISupports* aContext, - bool forcePrincipalCheckForCacheEntry); + imgRequest *request, void *aContext, bool forcePrincipalCheckForCacheEntry); void AddProxy(imgRequestProxy *aProxy); @@ -524,7 +523,7 @@ private: nsRefPtr mNewRequest; nsRefPtr mNewEntry; - nsCOMPtr mContext; + void *mContext; imgLoader* mImgLoader; }; diff --git a/image/src/imgRequest.cpp b/image/src/imgRequest.cpp index b12d36a6e51e..8aef9b748ee4 100644 --- a/image/src/imgRequest.cpp +++ b/image/src/imgRequest.cpp @@ -18,7 +18,6 @@ #include "nsIChannel.h" #include "nsICachingChannel.h" -#include "nsIDocument.h" #include "nsIThreadRetargetableRequest.h" #include "nsIInputStream.h" #include "nsIMultiPartChannel.h" @@ -96,7 +95,7 @@ nsresult imgRequest::Init(nsIURI *aURI, nsIRequest *aRequest, nsIChannel *aChannel, imgCacheEntry *aCacheEntry, - nsISupports* aCX, + void *aLoadId, nsIPrincipal* aLoadingPrincipal, int32_t aCORSMode, ReferrerPolicy aReferrerPolicy) @@ -133,13 +132,7 @@ nsresult imgRequest::Init(nsIURI *aURI, mCacheEntry = aCacheEntry; - SetLoadId(aCX); - - // Grab the inner window ID of the loading document, if possible. - nsCOMPtr doc = do_QueryInterface(aCX); - if (doc) { - mInnerWindowId = doc->InnerWindowID(); - } + SetLoadId(aLoadId); return NS_OK; } diff --git a/image/src/imgRequest.h b/image/src/imgRequest.h index e81afb0f0e53..179afdd34b4c 100644 --- a/image/src/imgRequest.h +++ b/image/src/imgRequest.h @@ -65,7 +65,7 @@ public: nsIRequest *aRequest, nsIChannel *aChannel, imgCacheEntry *aCacheEntry, - nsISupports* aCX, + void *aLoadId, nsIPrincipal* aLoadingPrincipal, int32_t aCORSMode, ReferrerPolicy aReferrerPolicy); @@ -91,6 +91,10 @@ public: // Request that we start decoding the image as soon as data becomes available. void RequestDecode() { mDecodeRequested = true; } + inline void SetInnerWindowID(uint64_t aInnerWindowId) { + mInnerWindowId = aInnerWindowId; + } + inline uint64_t InnerWindowID() const { return mInnerWindowId; }