Bug 1950152 - Rename cache clearing APIs r=necko-reviewers,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D244664
This commit is contained in:
@@ -695,7 +695,8 @@ NS_IMETHODIMP CacheStorageService::Clear() {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP CacheStorageService::ClearOrigin(nsIPrincipal* aPrincipal) {
|
||||
NS_IMETHODIMP CacheStorageService::ClearOriginsByPrincipal(
|
||||
nsIPrincipal* aPrincipal) {
|
||||
nsresult rv;
|
||||
|
||||
if (NS_WARN_IF(!aPrincipal)) {
|
||||
@@ -715,7 +716,7 @@ NS_IMETHODIMP CacheStorageService::ClearOrigin(nsIPrincipal* aPrincipal) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP CacheStorageService::ClearOriginAttributes(
|
||||
NS_IMETHODIMP CacheStorageService::ClearOriginsByOriginAttributes(
|
||||
const nsAString& aOriginAttributes) {
|
||||
nsresult rv;
|
||||
|
||||
|
||||
@@ -46,12 +46,12 @@ interface nsICacheStorageService : nsISupports
|
||||
nsICacheStorage pinningCacheStorage(in nsILoadContextInfo aLoadContextInfo);
|
||||
|
||||
/**
|
||||
* Evict any cache entry having the same origin of aPrincipal.
|
||||
* Evict any cache entry having the same principal origin and OriginAttributes
|
||||
*
|
||||
* @param aPrincipal
|
||||
* The principal to compare the entries with.
|
||||
*/
|
||||
void clearOrigin(in nsIPrincipal aPrincipal);
|
||||
void clearOriginsByPrincipal(in nsIPrincipal aPrincipal);
|
||||
|
||||
/**
|
||||
* Evict any cache entry which belongs to a base domain. This includes entries
|
||||
@@ -68,7 +68,7 @@ interface nsICacheStorageService : nsISupports
|
||||
* @param aOriginAttributes
|
||||
* The origin attributes in string format to compare the entries with.
|
||||
*/
|
||||
void clearOriginAttributes(in AString aOriginAttributes);
|
||||
void clearOriginsByOriginAttributes(in AString aOriginAttributes);
|
||||
|
||||
/**
|
||||
* Evict the whole cache.
|
||||
|
||||
@@ -37,7 +37,7 @@ function run_test() {
|
||||
{}
|
||||
);
|
||||
|
||||
Services.cache2.clearOrigin(principal);
|
||||
Services.cache2.clearOriginsByPrincipal(principal);
|
||||
|
||||
asyncOpenCacheEntry(
|
||||
URL + "/a",
|
||||
|
||||
@@ -67,9 +67,9 @@ async function test(oaLoad, oaClear, shouldExist) {
|
||||
let exists = cache_storage.exists(make_uri(url), null);
|
||||
Assert.ok(exists, "Entry should be in cache");
|
||||
|
||||
Services.cache2.clearOrigin(clearPrincipal);
|
||||
Services.cache2.clearOriginsByPrincipal(clearPrincipal);
|
||||
|
||||
// clearOrigin is async, so we block on cacheIOThread
|
||||
// clearOriginsByPrincipal is async, so we block on cacheIOThread
|
||||
await new Promise(resolve => {
|
||||
syncWithCacheIOThread(resolve, true);
|
||||
});
|
||||
|
||||
@@ -47,9 +47,9 @@ async function test(oaLoad, oaClear, shouldExist) {
|
||||
let exists = cache_storage.exists(make_uri(url), null);
|
||||
Assert.ok(exists, "Entry should be in cache");
|
||||
|
||||
Services.cache2.clearOriginAttributes(JSON.stringify(oaClear));
|
||||
Services.cache2.clearOriginsByOriginAttributes(JSON.stringify(oaClear));
|
||||
|
||||
// clearOriginAttributes is async, so we block on cacheIOThread
|
||||
// clearOriginsByOriginAttributes is async, so we block on cacheIOThread
|
||||
await new Promise(resolve => {
|
||||
syncWithCacheIOThread(resolve, true);
|
||||
});
|
||||
|
||||
@@ -492,8 +492,8 @@ const NetworkCacheCleaner = {
|
||||
aOriginAttributes
|
||||
);
|
||||
|
||||
Services.cache2.clearOrigin(httpPrincipal);
|
||||
Services.cache2.clearOrigin(httpsPrincipal);
|
||||
Services.cache2.clearOriginsByPrincipal(httpPrincipal);
|
||||
Services.cache2.clearOriginsByPrincipal(httpsPrincipal);
|
||||
},
|
||||
|
||||
async deleteBySite(aSchemelessSite, _aOriginAttributesPattern) {
|
||||
@@ -503,14 +503,14 @@ const NetworkCacheCleaner = {
|
||||
|
||||
deleteByPrincipal(aPrincipal) {
|
||||
return new Promise(aResolve => {
|
||||
Services.cache2.clearOrigin(aPrincipal);
|
||||
Services.cache2.clearOriginsByPrincipal(aPrincipal);
|
||||
aResolve();
|
||||
});
|
||||
},
|
||||
|
||||
deleteByOriginAttributes(aOriginAttributesString) {
|
||||
return new Promise(aResolve => {
|
||||
Services.cache2.clearOriginAttributes(aOriginAttributesString);
|
||||
Services.cache2.clearOriginsByOriginAttributes(aOriginAttributesString);
|
||||
aResolve();
|
||||
});
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user