mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 00:01:50 +00:00
Bug 1555189 - Enable partitioning of DOM cache in the third-party context; r=baku
Differential Revision: https://phabricator.services.mozilla.com/D32922 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
97fc0e9aaf
commit
56221ac188
@ -4594,9 +4594,9 @@ already_AddRefed<CacheStorage> nsGlobalWindowInner::GetCaches(
|
||||
if (!mCacheStorage) {
|
||||
bool forceTrustedOrigin =
|
||||
GetOuterWindow()->GetServiceWorkersTestingEnabled();
|
||||
mCacheStorage = CacheStorage::CreateOnMainThread(cache::DEFAULT_NAMESPACE,
|
||||
this, GetPrincipal(),
|
||||
forceTrustedOrigin, aRv);
|
||||
mCacheStorage = CacheStorage::CreateOnMainThread(
|
||||
cache::DEFAULT_NAMESPACE, this, GetEffectiveStoragePrincipal(),
|
||||
forceTrustedOrigin, aRv);
|
||||
}
|
||||
|
||||
RefPtr<CacheStorage> ref = mCacheStorage;
|
||||
@ -6984,6 +6984,9 @@ void nsGlobalWindowInner::StorageAccessGranted() {
|
||||
|
||||
// Reset the IndexedDB factory.
|
||||
mIndexedDB = nullptr;
|
||||
|
||||
// Reset DOM Cache
|
||||
mCacheStorage = nullptr;
|
||||
}
|
||||
|
||||
mozilla::dom::TabGroup* nsPIDOMWindowInner::TabGroup() {
|
||||
|
3
dom/cache/CacheStorage.cpp
vendored
3
dom/cache/CacheStorage.cpp
vendored
@ -197,7 +197,8 @@ already_AddRefed<CacheStorage> CacheStorage::CreateOnWorker(
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const PrincipalInfo& principalInfo = aWorkerPrivate->GetPrincipalInfo();
|
||||
const PrincipalInfo& principalInfo =
|
||||
aWorkerPrivate->GetEffectiveStoragePrincipalInfo();
|
||||
|
||||
if (NS_WARN_IF(!QuotaManager::IsPrincipalInfoValid(principalInfo))) {
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
|
@ -507,7 +507,11 @@ WorkerGlobalScope::GetOrCreateServiceWorkerRegistration(
|
||||
}
|
||||
|
||||
void WorkerGlobalScope::FirstPartyStorageAccessGranted() {
|
||||
// Reset the IndexedDB factory.
|
||||
mIndexedDB = nullptr;
|
||||
|
||||
// Reset DOM Cache
|
||||
mCacheStorage = nullptr;
|
||||
}
|
||||
|
||||
DedicatedWorkerGlobalScope::DedicatedWorkerGlobalScope(
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* import-globals-from storageprincipal_head.js */
|
||||
/* import-globals-from partitionedstorage_head.js */
|
||||
|
||||
StoragePrincipalHelper.runTest("DOMCache",
|
||||
PartitionedStorageHelper.runTest("DOMCache",
|
||||
async (win3rdParty, win1stParty, allowed) => {
|
||||
// DOM Cache is not supported. Always blocked.
|
||||
await win3rdParty.caches.open("wow").then(
|
||||
@ -9,8 +9,8 @@ StoragePrincipalHelper.runTest("DOMCache",
|
||||
);
|
||||
|
||||
await win1stParty.caches.open("wow").then(
|
||||
_ => { ok(true, "DOM Cache shoulw be available"); },
|
||||
_ => { ok(false, "DOM Cache shoulw be available"); },
|
||||
_ => { ok(true, "DOM Cache should be available"); },
|
||||
_ => { ok(false, "DOM Cache should be available"); },
|
||||
);
|
||||
},
|
||||
|
||||
@ -18,4 +18,8 @@ StoragePrincipalHelper.runTest("DOMCache",
|
||||
await new Promise(resolve => {
|
||||
Services.clearData.deleteData(Ci.nsIClearDataService.CLEAR_ALL, value => resolve());
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
[
|
||||
["dom.caches.testing.enabled", true],
|
||||
]);
|
||||
|
Loading…
Reference in New Issue
Block a user