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; }