зеркало из https://github.com/mozilla/gecko-dev.git
Bug 552605 - Keep images in the image cache based on their original URI, not the URI they're redirected to. r=jrmuizel
This commit is contained in:
Родитель
2a4e32e300
Коммит
de61bfdcd4
|
@ -1847,7 +1847,7 @@ NS_IMETHODIMP imgLoader::LoadImageWithChannel(nsIChannel *channel, imgIDecoderOb
|
|||
NS_RELEASE(pl);
|
||||
|
||||
// Try to add the new request into the cache.
|
||||
PutIntoCache(uri, entry);
|
||||
PutIntoCache(originalURI, entry);
|
||||
|
||||
rv = CreateNewProxyForRequest(request, loadGroup, aObserver,
|
||||
requestFlags, nsnull, _retval);
|
||||
|
@ -2141,7 +2141,7 @@ NS_IMETHODIMP imgCacheValidator::OnStartRequest(nsIRequest *aRequest, nsISupport
|
|||
// Try to add the new request into the cache. Note that the entry must be in
|
||||
// the cache before the proxies' ownership changes, because adding a proxy
|
||||
// changes the caching behaviour for imgRequests.
|
||||
sImgLoader.PutIntoCache(uri, entry);
|
||||
sImgLoader.PutIntoCache(originalURI, entry);
|
||||
|
||||
PRUint32 count = mProxies.Count();
|
||||
for (PRInt32 i = count-1; i>=0; i--) {
|
||||
|
|
|
@ -1275,13 +1275,12 @@ imgRequest::OnRedirectVerifyCallback(nsresult result)
|
|||
mTimedChannel = do_QueryInterface(mChannel);
|
||||
mNewRedirectChannel = nsnull;
|
||||
|
||||
// Don't make any cache changes if we're going to point to the same thing. We
|
||||
// compare specs and not just URIs here because URIs that compare as
|
||||
// .Equals() might have different hashes.
|
||||
#if defined(PR_LOGGING)
|
||||
nsCAutoString oldspec;
|
||||
if (mKeyURI)
|
||||
mKeyURI->GetSpec(oldspec);
|
||||
LOG_MSG_WITH_PARAM(gImgLog, "imgRequest::OnChannelRedirect", "old", oldspec.get());
|
||||
#endif
|
||||
|
||||
// make sure we have a protocol that returns data rather than opens
|
||||
// an external application, e.g. mailto:
|
||||
|
@ -1301,34 +1300,6 @@ imgRequest::OnRedirectVerifyCallback(nsresult result)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIURI> newURI;
|
||||
mChannel->GetOriginalURI(getter_AddRefs(newURI));
|
||||
nsCAutoString newspec;
|
||||
if (newURI)
|
||||
newURI->GetSpec(newspec);
|
||||
LOG_MSG_WITH_PARAM(gImgLog, "imgRequest::OnChannelRedirect", "new", newspec.get());
|
||||
|
||||
if (oldspec != newspec) {
|
||||
if (mIsInCache) {
|
||||
// Remove the cache entry from the cache, but don't null out mCacheEntry
|
||||
// (as imgRequest::RemoveFromCache() does), because we need it to put
|
||||
// ourselves back in the cache.
|
||||
if (mCacheEntry)
|
||||
imgLoader::RemoveFromCache(mCacheEntry);
|
||||
else
|
||||
imgLoader::RemoveFromCache(mKeyURI);
|
||||
}
|
||||
|
||||
mKeyURI = newURI;
|
||||
|
||||
if (mIsInCache) {
|
||||
// If we don't still have a URI or cache entry, we don't want to put
|
||||
// ourselves back into the cache.
|
||||
if (mKeyURI && mCacheEntry)
|
||||
imgLoader::PutIntoCache(mKeyURI, mCacheEntry);
|
||||
}
|
||||
}
|
||||
|
||||
mRedirectCallback->OnRedirectVerifyCallback(NS_OK);
|
||||
mRedirectCallback = nsnull;
|
||||
return NS_OK;
|
||||
|
|
Загрузка…
Ссылка в новой задаче