зеркало из https://github.com/mozilla/pjs.git
fixing bug 62108. basic auth of inline images. r=cbiesinger@web.de sr=darin a=shaver
This commit is contained in:
Родитель
fcef6c0a4a
Коммит
21fef82dbd
|
@ -28,6 +28,7 @@
|
||||||
#include "nsIChannel.h"
|
#include "nsIChannel.h"
|
||||||
#include "nsIHttpChannel.h"
|
#include "nsIHttpChannel.h"
|
||||||
#include "nsICachingChannel.h"
|
#include "nsICachingChannel.h"
|
||||||
|
#include "nsIInterfaceRequestor.h"
|
||||||
#include "nsIIOService.h"
|
#include "nsIIOService.h"
|
||||||
#include "nsILoadGroup.h"
|
#include "nsILoadGroup.h"
|
||||||
#include "nsIProxyObjectManager.h"
|
#include "nsIProxyObjectManager.h"
|
||||||
|
@ -42,8 +43,6 @@
|
||||||
|
|
||||||
#include "ImageLogging.h"
|
#include "ImageLogging.h"
|
||||||
|
|
||||||
#include "nsMimeTypes.h"
|
|
||||||
|
|
||||||
#ifdef DEBUG_pavlov
|
#ifdef DEBUG_pavlov
|
||||||
#include "nsIEnumerator.h"
|
#include "nsIEnumerator.h"
|
||||||
#include "nsISupportsPrimitives.h"
|
#include "nsISupportsPrimitives.h"
|
||||||
|
@ -109,16 +108,9 @@ inline int merge_flags(const nsLoadFlags& inFlags, nsLoadFlags& outFlags)
|
||||||
|
|
||||||
/* 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 parentURI, in nsILoadGroup aLoadGroup, in imgIDecoderObserver aObserver, in nsISupports aCX, in nsLoadFlags aLoadFlags, in nsISupports cacheKey, in imgIRequest aRequest); */
|
||||||
|
|
||||||
NS_IMETHODIMP imgLoader::LoadImage(
|
NS_IMETHODIMP imgLoader::LoadImage(nsIURI *aURI, nsIURI *parentURI, nsILoadGroup *aLoadGroup,
|
||||||
nsIURI *aURI,
|
imgIDecoderObserver *aObserver, nsISupports *aCX, nsLoadFlags aLoadFlags,
|
||||||
nsIURI *parentURI,
|
nsISupports *cacheKey, imgIRequest *aRequest, imgIRequest **_retval)
|
||||||
nsILoadGroup *aLoadGroup,
|
|
||||||
imgIDecoderObserver *aObserver,
|
|
||||||
nsISupports *aCX,
|
|
||||||
nsLoadFlags aLoadFlags,
|
|
||||||
nsISupports *cacheKey,
|
|
||||||
imgIRequest *aRequest,
|
|
||||||
imgIRequest **_retval)
|
|
||||||
{
|
{
|
||||||
NS_ASSERTION(aURI, "imgLoader::LoadImage -- NULL URI pointer");
|
NS_ASSERTION(aURI, "imgLoader::LoadImage -- NULL URI pointer");
|
||||||
|
|
||||||
|
@ -325,8 +317,6 @@ NS_IMETHODIMP imgLoader::LoadImage(
|
||||||
|
|
||||||
request->Init(newChannel, entry, cacheId, aCX);
|
request->Init(newChannel, entry, cacheId, aCX);
|
||||||
|
|
||||||
PR_LOG(gImgLog, PR_LOG_DEBUG,
|
|
||||||
("[this=%p] imgLoader::LoadImage -- Calling channel->AsyncOpen()\n", this));
|
|
||||||
|
|
||||||
// create the proxy listener
|
// create the proxy listener
|
||||||
ProxyListener *pl = new ProxyListener(NS_STATIC_CAST(nsIStreamListener *, request));
|
ProxyListener *pl = new ProxyListener(NS_STATIC_CAST(nsIStreamListener *, request));
|
||||||
|
@ -337,33 +327,41 @@ NS_IMETHODIMP imgLoader::LoadImage(
|
||||||
|
|
||||||
NS_ADDREF(pl);
|
NS_ADDREF(pl);
|
||||||
|
|
||||||
// set the referrer if this is an HTTP request
|
if (aLoadGroup) {
|
||||||
nsCOMPtr<nsIHttpChannel> httpChannel(do_QueryInterface(newChannel));
|
// Get the notification callbacks from the load group and set them on the channel
|
||||||
if (aLoadGroup && httpChannel) {
|
nsCOMPtr<nsIInterfaceRequestor> interfaceRequestor;
|
||||||
nsresult rv;
|
aLoadGroup->GetNotificationCallbacks(getter_AddRefs(interfaceRequestor));
|
||||||
// Get the defloadRequest from the loadgroup
|
if (interfaceRequestor)
|
||||||
nsCOMPtr<nsIRequest> defLoadRequest;
|
newChannel->SetNotificationCallbacks(interfaceRequestor);
|
||||||
rv = aLoadGroup->GetDefaultLoadRequest(getter_AddRefs(defLoadRequest));
|
|
||||||
|
|
||||||
if (NS_SUCCEEDED(rv) && defLoadRequest) {
|
// set the referrer if this is an HTTP request
|
||||||
nsCOMPtr<nsIChannel> reqChannel(do_QueryInterface(defLoadRequest));
|
nsCOMPtr<nsIHttpChannel> httpChannel(do_QueryInterface(newChannel));
|
||||||
|
|
||||||
if (reqChannel) {
|
if (httpChannel) {
|
||||||
// Get the referrer from the loadchannel
|
nsresult rv;
|
||||||
nsCOMPtr<nsIURI> referrer;
|
// Get the defloadRequest from the loadgroup
|
||||||
rv = reqChannel->GetURI(getter_AddRefs(referrer));
|
nsCOMPtr<nsIRequest> defLoadRequest;
|
||||||
if (NS_SUCCEEDED(rv)) {
|
rv = aLoadGroup->GetDefaultLoadRequest(getter_AddRefs(defLoadRequest));
|
||||||
// Set the referrer
|
|
||||||
httpChannel->SetReferrer(referrer, nsIHttpChannel::REFERRER_INLINES);
|
if (NS_SUCCEEDED(rv) && defLoadRequest) {
|
||||||
|
nsCOMPtr<nsIChannel> reqChannel(do_QueryInterface(defLoadRequest));
|
||||||
|
|
||||||
|
if (reqChannel) {
|
||||||
|
// Get the referrer from the loadchannel
|
||||||
|
nsCOMPtr<nsIURI> referrer;
|
||||||
|
rv = reqChannel->GetURI(getter_AddRefs(referrer));
|
||||||
|
if (NS_SUCCEEDED(rv)) {
|
||||||
|
// Set the referrer
|
||||||
|
httpChannel->SetReferrer(referrer, nsIHttpChannel::REFERRER_INLINES);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* XXX Are we calling AsyncOpen() too early? Is it possible for
|
PR_LOG(gImgLog, PR_LOG_DEBUG,
|
||||||
AsyncOpen to result in an OnStartRequest to the channel before
|
("[this=%p] imgLoader::LoadImage -- Calling channel->AsyncOpen()\n", this));
|
||||||
we call CreateNewProxyForRequest() ?
|
|
||||||
*/
|
|
||||||
nsresult asyncOpenResult = newChannel->AsyncOpen(NS_STATIC_CAST(nsIStreamListener *, pl), nsnull);
|
nsresult asyncOpenResult = newChannel->AsyncOpen(NS_STATIC_CAST(nsIStreamListener *, pl), nsnull);
|
||||||
|
|
||||||
NS_RELEASE(pl);
|
NS_RELEASE(pl);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче