diff --git a/mozilla/content/html/content/src/nsHTMLImageElement.cpp b/mozilla/content/html/content/src/nsHTMLImageElement.cpp
index 9efda6f3dd7..7cd393c99b1 100644
--- a/mozilla/content/html/content/src/nsHTMLImageElement.cpp
+++ b/mozilla/content/html/content/src/nsHTMLImageElement.cpp
@@ -957,12 +957,17 @@ nsHTMLImageElement::SetSrcInner(nsIURI* aBaseURL,
nsCOMPtr doc;
nsCOMPtr loadGroup;
+ nsCOMPtr documentURI;
shell->GetDocument(getter_AddRefs(doc));
if (doc) {
doc->GetDocumentLoadGroup(getter_AddRefs(loadGroup));
+
+ // Get the documment URI for the referrer.
+ doc->GetDocumentURL(getter_AddRefs(documentURI));
}
- il->LoadImage(uri, nsnull, loadGroup, this, sup, nsIRequest::LOAD_NORMAL,
+ // XXX: initialDocumentURI is NULL!
+ il->LoadImage(uri, nsnull, documentURI, loadGroup, this, context, nsIRequest::LOAD_NORMAL,
nsnull, nsnull, getter_AddRefs(mRequest));
}
}
diff --git a/mozilla/content/xbl/src/nsXBLResourceLoader.cpp b/mozilla/content/xbl/src/nsXBLResourceLoader.cpp
index 72371e128da..d64d991666d 100644
--- a/mozilla/content/xbl/src/nsXBLResourceLoader.cpp
+++ b/mozilla/content/xbl/src/nsXBLResourceLoader.cpp
@@ -125,9 +125,11 @@ nsXBLResourceLoader::LoadResources(PRBool* aResult)
if (!il) continue;
}
- // Now kick off the image load
+ // Now kick off the image load...
+ // Passing NULL for pretty much everything -- cause we don't care!
+ // XXX: initialDocumentURI is NULL!
nsCOMPtr req;
- il->LoadImage(url, nsnull, nsnull, nsnull, nsnull, nsIRequest::LOAD_BACKGROUND, nsnull, nsnull, getter_AddRefs(req));
+ il->LoadImage(url, nsnull, nsnull, nsnull, nsnull, nsnull, nsIRequest::LOAD_BACKGROUND, nsnull, nsnull, getter_AddRefs(req));
}
else if (curr->mType == nsXBLAtoms::stylesheet) {
if (!cssLoader) {
diff --git a/mozilla/layout/base/src/nsImageLoader.cpp b/mozilla/layout/base/src/nsImageLoader.cpp
index 804e1181c66..d55da36de68 100644
--- a/mozilla/layout/base/src/nsImageLoader.cpp
+++ b/mozilla/layout/base/src/nsImageLoader.cpp
@@ -92,8 +92,6 @@ nsImageLoader::Load(nsIURI *aURI)
return NS_ERROR_FAILURE;
nsCOMPtr loadGroup;
- nsCOMPtr uri;
- nsCOMPtr baseURI;
nsCOMPtr shell;
nsresult rv = mPresContext->GetShell(getter_AddRefs(shell));
@@ -106,6 +104,10 @@ nsImageLoader::Load(nsIURI *aURI)
// Get the document's loadgroup
doc->GetDocumentLoadGroup(getter_AddRefs(loadGroup));
+ // Get the document URI (for the referrer).
+ nsCOMPtr documentURI;
+ doc->GetDocumentURL(getter_AddRefs(documentURI));
+
if (mRequest) {
nsCOMPtr oldURI;
mRequest->GetURI(getter_AddRefs(oldURI));
@@ -119,7 +121,8 @@ nsImageLoader::Load(nsIURI *aURI)
nsCOMPtr il(do_GetService("@mozilla.org/image/loader;1", &rv));
if (NS_FAILED(rv)) return rv;
- return il->LoadImage(aURI, nsnull, loadGroup, NS_STATIC_CAST(imgIDecoderObserver *, this),
+ // XXX: initialDocumentURI is NULL!
+ return il->LoadImage(aURI, nsnull, documentURI, loadGroup, NS_STATIC_CAST(imgIDecoderObserver *, this),
nsnull, nsIRequest::LOAD_BACKGROUND, nsnull, nsnull, getter_AddRefs(mRequest));
}
diff --git a/mozilla/layout/html/base/src/nsBulletFrame.cpp b/mozilla/layout/html/base/src/nsBulletFrame.cpp
index 73b75460007..e495af50502 100644
--- a/mozilla/layout/html/base/src/nsBulletFrame.cpp
+++ b/mozilla/layout/html/base/src/nsBulletFrame.cpp
@@ -135,6 +135,16 @@ nsBulletFrame::Init(nsIPresContext* aPresContext,
nsCOMPtr imgURI;
NS_NewURI(getter_AddRefs(imgURI), myList->mListStyleImage, nsnull, baseURI);
+ // Get the document URI for the referrer...
+ nsCOMPtr documentURI;
+ nsCOMPtr doc;
+ if (mContent) {
+ (void) mContent->GetDocument(*getter_AddRefs(doc));
+ if (doc) {
+ doc->GetDocumentURL(getter_AddRefs(documentURI));
+ }
+ }
+
if (!mListener) {
nsBulletListener *listener;
NS_NEWXPCOM(listener, nsBulletListener);
@@ -145,7 +155,8 @@ nsBulletFrame::Init(nsIPresContext* aPresContext,
NS_RELEASE(listener);
}
- il->LoadImage(imgURI, nsnull, loadGroup, mListener, aPresContext, nsIRequest::LOAD_NORMAL, nsnull, nsnull, getter_AddRefs(mImageRequest));
+ // XXX: initialDocumentURI is NULL !
+ il->LoadImage(imgURI, nsnull, documentURI, loadGroup, mListener, aPresContext, nsIRequest::LOAD_NORMAL, nsnull, nsnull, getter_AddRefs(mImageRequest));
}
return NS_OK;
@@ -1481,7 +1492,19 @@ nsBulletFrame::Reflow(nsIPresContext* aPresContext,
nsCOMPtr loadGroup;
GetLoadGroup(aPresContext, getter_AddRefs(loadGroup));
- il->LoadImage(newURI, nsnull, loadGroup, mListener, aPresContext, nsIRequest::LOAD_NORMAL, nsnull, nsnull, getter_AddRefs(mImageRequest));
+ // Get the document URI for the referrer...
+ nsCOMPtr documentURI;
+ nsCOMPtr doc;
+ if (mContent) {
+ (void) mContent->GetDocument(*getter_AddRefs(doc));
+ if (doc) {
+ doc->GetDocumentURL(getter_AddRefs(documentURI));
+ }
+ }
+
+
+ // XXX: initialDocumentURI is NULL !
+ il->LoadImage(newURI, nsnull, documentURI, loadGroup, mListener, aPresContext, nsIRequest::LOAD_NORMAL, nsnull, nsnull, getter_AddRefs(mImageRequest));
}
}
}
diff --git a/mozilla/layout/html/base/src/nsImageFrame.cpp b/mozilla/layout/html/base/src/nsImageFrame.cpp
index 2a81b58f47f..ef06d363e9a 100644
--- a/mozilla/layout/html/base/src/nsImageFrame.cpp
+++ b/mozilla/layout/html/base/src/nsImageFrame.cpp
@@ -1980,8 +1980,19 @@ nsImageFrame::RealLoadImage(const nsAString& aSpec, nsIPresContext *aPresContext
nsCOMPtr baseURI;
rv = aPresContext->GetBaseURL(getter_AddRefs(baseURI));
+
+ // Get the document URI for the referrer...
+ nsCOMPtr documentURI;
+ nsCOMPtr doc;
+ if (mContent) {
+ (void) mContent->GetDocument(*getter_AddRefs(doc));
+ if (doc) {
+ doc->GetDocumentURL(getter_AddRefs(documentURI));
+ }
+ }
+
nsCOMPtr tempRequest;
- return il->LoadImage(uri, baseURI, loadGroup, mListener, aPresContext, loadFlags, nsnull, aRequest, getter_AddRefs(tempRequest));
+ return il->LoadImage(uri, baseURI, documentURI, loadGroup, mListener, aPresContext, loadFlags, nsnull, aRequest, getter_AddRefs(tempRequest));
}
#define INTERNAL_GOPHER_LENGTH 16 /* "internal-gopher-" length */
diff --git a/mozilla/layout/xul/base/src/nsImageBoxFrame.cpp b/mozilla/layout/xul/base/src/nsImageBoxFrame.cpp
index b624e327ddf..72ecdec5b65 100644
--- a/mozilla/layout/xul/base/src/nsImageBoxFrame.cpp
+++ b/mozilla/layout/xul/base/src/nsImageBoxFrame.cpp
@@ -457,8 +457,18 @@ nsImageBoxFrame::UpdateImage(nsIPresContext* aPresContext, PRBool& aResize)
nsCOMPtr loadGroup;
GetLoadGroup(aPresContext, getter_AddRefs(loadGroup));
- il->LoadImage(srcURI, nsnull, loadGroup, mListener, aPresContext, mLoadFlags, nsnull, nsnull, getter_AddRefs(mImageRequest));
+ // Get the document URI for the referrer...
+ nsCOMPtr documentURI;
+ nsCOMPtr doc;
+ if (mContent) {
+ (void) mContent->GetDocument(*getter_AddRefs(doc));
+ if (doc) {
+ doc->GetDocumentURL(getter_AddRefs(documentURI));
+ }
+ }
+ // XXX: initialDocumentURI is NULL!
+ il->LoadImage(srcURI, nsnull, documentURI, loadGroup, mListener, aPresContext, mLoadFlags, nsnull, nsnull, getter_AddRefs(mImageRequest));
aResize = PR_TRUE;
}
diff --git a/mozilla/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp b/mozilla/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp
index 4d19ada9497..533cc6dbdb3 100644
--- a/mozilla/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp
+++ b/mozilla/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp
@@ -1725,8 +1725,14 @@ nsTreeBodyFrame::GetImage(PRInt32 aRowIndex, const PRUnichar* aColID, PRBool aUs
nsresult rv;
nsCOMPtr il(do_GetService("@mozilla.org/image/loader;1", &rv));
+
+ // Get the documment URI for the referrer.
+ nsCOMPtr documentURI;
+ doc->GetDocumentURL(getter_AddRefs(documentURI));
+
mImageGuard = PR_TRUE;
- rv = il->LoadImage(srcURI, nsnull, nsnull, listener, mPresContext, nsIRequest::LOAD_NORMAL, nsnull, nsnull, getter_AddRefs(imageRequest));
+ // XXX: initialDocumentURI is NULL!
+ rv = il->LoadImage(srcURI, nsnull, documentURI, nsnull, listener, mPresContext, nsIRequest::LOAD_NORMAL, nsnull, nsnull, getter_AddRefs(imageRequest));
mImageGuard = PR_FALSE;
// In a case it was already cached.
diff --git a/mozilla/modules/libpr0n/public/imgILoader.idl b/mozilla/modules/libpr0n/public/imgILoader.idl
index 4a99e6aafd2..d592ceca798 100644
--- a/mozilla/modules/libpr0n/public/imgILoader.idl
+++ b/mozilla/modules/libpr0n/public/imgILoader.idl
@@ -48,6 +48,8 @@ interface imgILoader : nsISupports
/**
* Start the load and decode of an image.
* @param aURI the URI to load
+ * @param aInitialDocumentURI the URI that 'initiated' the load -- used for 3rd party cookie blocking
+ * @param aReferrerURI the 'referring' URI
* @param aLoadGroup Loadgroup to put the image load into
* @param aObserver the observer
* @param aCX some random data
@@ -57,9 +59,14 @@ interface imgILoader : nsISupports
* @param aRequest A newly created, unused imgIRequest object or NULL for one to
be created for you.
*/
- imgIRequest loadImage(in nsIURI aURI, in nsIURI parentURL, in nsILoadGroup aLoadGroup,
- in imgIDecoderObserver aObserver, in nsISupports aCX,
- in nsLoadFlags aLoadFlags, in nsISupports cacheKey,
+ imgIRequest loadImage(in nsIURI aURI,
+ in nsIURI aInitialDocumentURL,
+ in nsIURI aReferrerURI,
+ in nsILoadGroup aLoadGroup,
+ in imgIDecoderObserver aObserver,
+ in nsISupports aCX,
+ in nsLoadFlags aLoadFlags,
+ in nsISupports cacheKey,
in imgIRequest aRequest);
/**
diff --git a/mozilla/modules/libpr0n/src/imgLoader.cpp b/mozilla/modules/libpr0n/src/imgLoader.cpp
index ef2d46cea84..88a1444c805 100644
--- a/mozilla/modules/libpr0n/src/imgLoader.cpp
+++ b/mozilla/modules/libpr0n/src/imgLoader.cpp
@@ -111,11 +111,18 @@ inline int merge_flags(const nsLoadFlags& inFlags, nsLoadFlags& outFlags)
return 1;
}
-/* imgIRequest loadImage (in nsIURI aURI, in nsIURI parentURI, in nsILoadGroup aLoadGroup, in imgIDecoderObserver aObserver, in nsISupports aCX, in nsLoadFlags aLoadFlags, in nsISupports cacheKey, in imgIRequest aRequest); */
+/* imgIRequest loadImage (in nsIURI aURI, in nsIURI initialDocumentURI, in nsILoadGroup aLoadGroup, in imgIDecoderObserver aObserver, in nsISupports aCX, in nsLoadFlags aLoadFlags, in nsISupports cacheKey, in imgIRequest aRequest); */
-NS_IMETHODIMP imgLoader::LoadImage(nsIURI *aURI, nsIURI *parentURI, nsILoadGroup *aLoadGroup,
- imgIDecoderObserver *aObserver, nsISupports *aCX, nsLoadFlags aLoadFlags,
- nsISupports *cacheKey, imgIRequest *aRequest, imgIRequest **_retval)
+NS_IMETHODIMP imgLoader::LoadImage(nsIURI *aURI,
+ nsIURI *initialDocumentURI,
+ nsIURI *referrerURI,
+ nsILoadGroup *aLoadGroup,
+ imgIDecoderObserver *aObserver,
+ nsISupports *aCX,
+ nsLoadFlags aLoadFlags,
+ nsISupports *cacheKey,
+ imgIRequest *aRequest,
+ imgIRequest **_retval)
{
NS_ASSERTION(aURI, "imgLoader::LoadImage -- NULL URI pointer");
@@ -298,7 +305,7 @@ NS_IMETHODIMP imgLoader::LoadImage(nsIURI *aURI, nsIURI *parentURI, nsILoadGroup
nsCOMPtr newHttpChannel = do_QueryInterface(newChannel);
if (newHttpChannel) {
- newHttpChannel->SetDocumentURI(parentURI);
+ newHttpChannel->SetDocumentURI(initialDocumentURI);
}
if (aLoadGroup) {
@@ -343,24 +350,8 @@ NS_IMETHODIMP imgLoader::LoadImage(nsIURI *aURI, nsIURI *parentURI, nsILoadGroup
nsCOMPtr httpChannel(do_QueryInterface(newChannel));
if (httpChannel) {
- nsresult rv;
- // Get the defloadRequest from the loadgroup
- nsCOMPtr defLoadRequest;
- rv = aLoadGroup->GetDefaultLoadRequest(getter_AddRefs(defLoadRequest));
-
- if (NS_SUCCEEDED(rv) && defLoadRequest) {
- nsCOMPtr reqChannel(do_QueryInterface(defLoadRequest));
-
- if (reqChannel) {
- // Get the referrer from the loadchannel
- nsCOMPtr referrer;
- rv = reqChannel->GetURI(getter_AddRefs(referrer));
- if (NS_SUCCEEDED(rv)) {
- // Set the referrer
- httpChannel->SetReferrer(referrer, nsIHttpChannel::REFERRER_INLINES);
- }
- }
- }
+ // Set the referrer
+ httpChannel->SetReferrer(referrerURI, nsIHttpChannel::REFERRER_INLINES);
}
}