Bug 1475065 part 6. Remove nsIDOMOfflineResourceList::MozRemove. r=nika

This commit is contained in:
Boris Zbarsky 2018-07-13 15:42:05 -07:00
Родитель c218ddae59
Коммит 6dfe289674
3 изменённых файлов: 23 добавлений и 25 удалений

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

@ -13,16 +13,6 @@ interface nsIDOMOfflineResourceList : nsISupports
*/
readonly attribute nsISupports mozItems;
/**
* Remove an item from the list of dynamically-managed entries. If this
* was the last reference to a URI in the application cache, the cache
* entry will be removed.
*
* @param uri
* The resource to remove.
*/
void mozRemove(in DOMString uri);
/**
* State of the application cache this object is associated with.
*/

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

@ -438,27 +438,37 @@ nsDOMOfflineResourceList::MozAdd(const nsAString& aURI, ErrorResult& aRv)
}
}
NS_IMETHODIMP
nsDOMOfflineResourceList::MozRemove(const nsAString& aURI)
void
nsDOMOfflineResourceList::MozRemove(const nsAString& aURI, ErrorResult& aRv)
{
if (IS_CHILD_PROCESS())
return NS_ERROR_NOT_IMPLEMENTED;
if (IS_CHILD_PROCESS()) {
aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
return;
}
nsresult rv = Init();
NS_ENSURE_SUCCESS(rv, rv);
if (NS_WARN_IF(NS_FAILED(rv))) {
aRv.Throw(rv);
return;
}
if (!nsContentUtils::OfflineAppAllowed(mDocumentURI)) {
return NS_ERROR_DOM_SECURITY_ERR;
aRv.Throw(NS_ERROR_DOM_SECURITY_ERR);
return;
}
nsCOMPtr<nsIApplicationCache> appCache = GetDocumentAppCache();
if (!appCache) {
return NS_ERROR_DOM_INVALID_STATE_ERR;
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
return;
}
nsAutoCString key;
rv = GetCacheKey(aURI, key);
NS_ENSURE_SUCCESS(rv, rv);
if (NS_WARN_IF(NS_FAILED(rv))) {
aRv.Throw(rv);
return;
}
ClearCachedKeys();
@ -469,9 +479,10 @@ nsDOMOfflineResourceList::MozRemove(const nsAString& aURI)
// finished. Need to bring this issue up.
rv = appCache->UnmarkEntry(key, nsIApplicationCache::ITEM_DYNAMIC);
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
if (NS_WARN_IF(NS_FAILED(rv))) {
aRv.Throw(rv);
return;
}
}
NS_IMETHODIMP

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

@ -105,10 +105,7 @@ public:
return rv.Failed() ? 0 : length;
}
void MozAdd(const nsAString& aURI, ErrorResult& aRv);
void MozRemove(const nsAString& aURI, ErrorResult& aRv)
{
aRv = MozRemove(aURI);
}
void MozRemove(const nsAString& aURI, ErrorResult& aRv);
protected:
virtual ~nsDOMOfflineResourceList();