Bug 1352408. Restore imgICache::RemoveEntry. r=ehsan

It was removed in bug 1202085 because there were no callers and changes made in that bug would have required it to be updated.
This commit is contained in:
Timothy Nikkel 2017-04-11 03:14:09 -05:00
Родитель ab1587da50
Коммит c1bda06e96
2 изменённых файлов: 33 добавлений и 0 удалений

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

@ -30,6 +30,16 @@ interface imgICache : nsISupports
*/
void clearCache(in boolean chrome);
/**
* Evict images from the cache.
*
* @param uri The URI to remove.
* @param doc The document to remove the cache entry for.
* @throws NS_ERROR_NOT_AVAILABLE if \a uri was unable to be removed from
* the cache.
*/
[noscript] void removeEntry(in nsIURI uri, [optional] in nsIDOMDocument doc);
/**
* Find Properties
* Used to get properties such as 'type' and 'content-disposition'

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

@ -1369,6 +1369,29 @@ imgLoader::ClearCache(bool chrome)
}
NS_IMETHODIMP
imgLoader::RemoveEntry(nsIURI* aURI,
nsIDOMDocument* aDOMDoc)
{
nsCOMPtr<nsIDocument> doc = do_QueryInterface(aDOMDoc);
if (aURI) {
OriginAttributes attrs;
if (doc) {
nsCOMPtr<nsIPrincipal> principal = doc->NodePrincipal();
if (principal) {
attrs = principal->OriginAttributesRef();
}
}
nsresult rv = NS_OK;
ImageCacheKey key(aURI, attrs, doc, rv);
if (NS_SUCCEEDED(rv) && RemoveFromCache(key)) {
return NS_OK;
}
}
return NS_ERROR_NOT_AVAILABLE;
}
NS_IMETHODIMP
imgLoader::FindEntryProperties(nsIURI* uri,
nsIDOMDocument* aDOMDoc,