void DOMStorageManager::ClearCaches(uint32_t aUnloadFlags, const OriginAttributesPattern& aPattern, const nsACString& aOriginScope) { for (auto iter1 = mCaches.Iter(); !iter1.Done(); iter1.Next()) { PrincipalOriginAttributes oa; DebugOnly<bool> rv = oa.PopulateFromSuffix(iter1.Key()); MOZ_ASSERT(rv); if (!aPattern.Matches(oa)) { // This table doesn't match the given origin attributes pattern continue; } CacheOriginHashtable* table = iter1.Data(); for (auto iter2 = table->Iter(); !iter2.Done(); iter2.Next()) { DOMStorageCache* cache = iter2.Get()->cache(); if (aOriginScope.IsEmpty() || StringBeginsWith(cache->OriginNoSuffix(), aOriginScope)) { cache->UnloadItems(aUnloadFlags); } } } }
bool DOMStorageDBChild::RecvLoadItem(const nsCString& aScope, const nsString& aKey, const nsString& aValue) { DOMStorageCache* aCache = mManager->GetCache(aScope); if (aCache) { aCache->LoadItem(aKey, aValue); } return true; }
bool DOMStorageDBChild::RecvLoadDone(const nsCString& aScope, const nsresult& aRv) { DOMStorageCache* aCache = mManager->GetCache(aScope); if (aCache) { aCache->LoadDone(aRv); // Just drop reference to this cache now since the load is done. mLoadingCaches.RemoveEntry(static_cast<DOMStorageCacheBridge*>(aCache)); } return true; }
void DOMStorageManager::ClearCaches(uint32_t aUnloadFlags, const nsACString& aKeyPrefix) { for (auto iter = mCaches.Iter(); !iter.Done(); iter.Next()) { DOMStorageCache* cache = iter.Get()->cache(); nsCString& key = const_cast<nsCString&>(cache->Scope()); if (aKeyPrefix.IsEmpty() || StringBeginsWith(key, aKeyPrefix)) { cache->UnloadItems(aUnloadFlags); } } }
PLDHashOperator DOMStorageManager::ClearCacheEnumerator(DOMStorageCacheHashKey* aEntry, void* aClosure) { DOMStorageCache* cache = aEntry->cache(); nsCString& key = const_cast<nsCString&>(cache->Scope()); ClearCacheEnumeratorData* data = static_cast<ClearCacheEnumeratorData*>(aClosure); if (data->mKeyPrefix.IsEmpty() || StringBeginsWith(key, data->mKeyPrefix)) { cache->UnloadItems(data->mUnloadFlags); } return PL_DHASH_NEXT; }