Esempio n. 1
0
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);
    }
  }
}
Esempio n. 2
0
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;
}