Keep background images from sending progress events (bug 133250, checkin #1). From Antonio.Xu@sun.com. r=bbaetz, sr=darin

This commit is contained in:
jkeiser%netscape.com 2002-06-27 06:46:25 +00:00
parent b55fead160
commit fff44ac8f7
4 changed files with 21 additions and 11 deletions

View File

@ -255,6 +255,8 @@ NS_IMETHODIMP imgLoader::LoadImage(nsIURI *aURI, nsIURI *parentURI, nsILoadGroup
if (aLoadGroup) {
PRUint32 flags;
aLoadGroup->GetLoadFlags(&flags);
if (aLoadFlags & nsIRequest::LOAD_BACKGROUND)
flags |= nsIRequest::LOAD_BACKGROUND;
newChannel->SetLoadFlags(flags | nsIRequest::VALIDATE_ALWAYS);
}
@ -304,6 +306,8 @@ NS_IMETHODIMP imgLoader::LoadImage(nsIURI *aURI, nsIURI *parentURI, nsILoadGroup
if (aLoadGroup) {
PRUint32 flags;
aLoadGroup->GetLoadFlags(&flags);
if (aLoadFlags & nsIRequest::LOAD_BACKGROUND)
flags |= nsIRequest::LOAD_BACKGROUND;
newChannel->SetLoadFlags(flags);
}

View File

@ -78,6 +78,7 @@ typedef PRUint8 nsHttpVersion;
// http connection capabilities
#define NS_HTTP_ALLOW_KEEPALIVE (1<<0)
#define NS_HTTP_ALLOW_PIPELINING (1<<1)
#define NS_HTTP_DONT_REPORT_PROGRESS (1<<2)
// hard upper limit on the number of requests that can be pipelined
#define NS_HTTP_MAX_PIPELINED_REQUESTS 10

View File

@ -392,6 +392,9 @@ nsHttpChannel::SetupTransaction()
LOG(("nsHttpChannel::SetupTransaction [this=%x] pipelining disallowed\n", this));
caps &= ~NS_HTTP_ALLOW_PIPELINING;
}
if (mLoadFlags & nsIRequest::LOAD_BACKGROUND)
caps |= NS_HTTP_DONT_REPORT_PROGRESS;
// create the transaction object
mTransaction = new nsHttpTransaction(listenerProxy, this, caps);

View File

@ -136,17 +136,19 @@ nsHttpTransaction::SetupRequest(nsHttpRequestHead *requestHead,
eqs->ResolveEventQueue(NS_CURRENT_EVENTQ, getter_AddRefs(mConsumerEventQ));
// build a proxy for the progress event sink
if (mCallbacks && mConsumerEventQ) {
nsCOMPtr<nsIProgressEventSink> temp = do_GetInterface(mCallbacks);
if (temp) {
nsCOMPtr<nsIProxyObjectManager> mgr;
nsHttpHandler::get()->GetProxyObjectManager(getter_AddRefs(mgr));
if (mgr)
mgr->GetProxyForObject(mConsumerEventQ,
NS_GET_IID(nsIProgressEventSink),
temp,
PROXY_ASYNC | PROXY_ALWAYS,
getter_AddRefs(mProgressSink));
if (!(mCapabilities & NS_HTTP_DONT_REPORT_PROGRESS)) {
if (mCallbacks && mConsumerEventQ) {
nsCOMPtr<nsIProgressEventSink> temp = do_GetInterface(mCallbacks);
if (temp) {
nsCOMPtr<nsIProxyObjectManager> mgr;
nsHttpHandler::get()->GetProxyObjectManager(getter_AddRefs(mgr));
if (mgr)
mgr->GetProxyForObject(mConsumerEventQ,
NS_GET_IID(nsIProgressEventSink),
temp,
PROXY_ASYNC | PROXY_ALWAYS,
getter_AddRefs(mProgressSink));
}
}
}