Backed out changeset c00551ce36e7 (bug 1135977)

--HG--
extra : rebase_source : 60e58453045c9cfa3e95e74d8c5e95b36754a146
This commit is contained in:
Carsten "Tomcat" Book 2015-03-04 09:04:35 +01:00
Родитель 619e5a287e
Коммит 68c3948482
1 изменённых файлов: 23 добавлений и 15 удалений

Просмотреть файл

@ -930,7 +930,8 @@ nsresult imgLoader::CreateNewProxyForRequest(imgRequest *aRequest, nsILoadGroup
proxy calls to |aObserver|.
*/
nsRefPtr<imgRequestProxy> proxyRequest = new imgRequestProxy();
imgRequestProxy *proxyRequest = new imgRequestProxy();
NS_ADDREF(proxyRequest);
/* It is important to call |SetLoadFlags()| before calling |Init()| because
|Init()| adds the request to the loadgroup.
@ -942,11 +943,14 @@ nsresult imgLoader::CreateNewProxyForRequest(imgRequest *aRequest, nsILoadGroup
// init adds itself to imgRequest's list of observers
nsresult rv = proxyRequest->Init(aRequest, aLoadGroup, uri, aObserver);
if (NS_WARN_IF(NS_FAILED(rv))) {
if (NS_FAILED(rv)) {
NS_RELEASE(proxyRequest);
return rv;
}
proxyRequest.forget(_retval);
// transfer reference to caller
*_retval = proxyRequest;
return NS_OK;
}
@ -1235,8 +1239,8 @@ NS_IMETHODIMP imgLoader::FindEntryProperties(nsIURI *uri, nsIProperties **_retva
nsRefPtr<imgRequest> request = entry->GetRequest();
if (request) {
nsCOMPtr<nsIProperties> properties = request->Properties();
properties.forget(_retval);
*_retval = request->Properties();
NS_ADDREF(*_retval);
}
}
@ -1531,25 +1535,26 @@ bool imgLoader::ValidateRequestWithNewChannel(imgRequest *request,
request->mValidator = hvc;
imgRequestProxy* proxy = static_cast<imgRequestProxy*>
(static_cast<imgIRequest*>(req.get()));
// We will send notifications from imgCacheValidator::OnStartRequest().
// In the mean time, we must defer notifications because we are added to
// the imgRequest's proxy list, and we can get extra notifications
// resulting from methods such as RequestDecode(). See bug 579122.
req->SetNotificationsDeferred(true);
proxy->SetNotificationsDeferred(true);
// Add the proxy without notifying
hvc->AddProxy(req);
hvc->AddProxy(proxy);
mozilla::net::PredictorLearn(aURI, aInitialDocumentURI,
nsINetworkPredictor::LEARN_LOAD_SUBRESOURCE, aLoadGroup);
rv = newChannel->AsyncOpen(listener, nullptr);
if (NS_WARN_IF(NS_FAILED(rv))) {
return false;
}
if (NS_SUCCEEDED(rv))
NS_ADDREF(*aProxyRequest = req.get());
req.forget(aProxyRequest);
return true;
return NS_SUCCEEDED(rv);
}
}
@ -2274,10 +2279,13 @@ nsresult imgLoader::LoadImageWithChannel(nsIChannel *channel, imgINotificationOb
request->Init(originalURI, uri, channel, channel, entry,
aCX, nullptr, imgIRequest::CORS_NONE, RP_Default);
nsRefPtr<ProxyListener> pl =
new ProxyListener(static_cast<nsIStreamListener*>(request.get()));
pl.forget(listener);
ProxyListener *pl = new ProxyListener(static_cast<nsIStreamListener *>(request.get()));
NS_ADDREF(pl);
*listener = static_cast<nsIStreamListener*>(pl);
NS_ADDREF(*listener);
NS_RELEASE(pl);
// Try to add the new request into the cache.
PutIntoCache(originalURI, entry);