summaryrefslogtreecommitdiffstats
path: root/dom/workers/WorkerScope.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:35:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:35:29 +0000
commit59203c63bb777a3bacec32fb8830fba33540e809 (patch)
tree58298e711c0ff0575818c30485b44a2f21bf28a0 /dom/workers/WorkerScope.cpp
parentAdding upstream version 126.0.1. (diff)
downloadfirefox-59203c63bb777a3bacec32fb8830fba33540e809.tar.xz
firefox-59203c63bb777a3bacec32fb8830fba33540e809.zip
Adding upstream version 127.0.upstream/127.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/workers/WorkerScope.cpp')
-rw-r--r--dom/workers/WorkerScope.cpp22
1 files changed, 14 insertions, 8 deletions
diff --git a/dom/workers/WorkerScope.cpp b/dom/workers/WorkerScope.cpp
index 2121a99cb3..cbb61c7055 100644
--- a/dom/workers/WorkerScope.cpp
+++ b/dom/workers/WorkerScope.cpp
@@ -468,6 +468,7 @@ already_AddRefed<CacheStorage> WorkerGlobalScope::GetCaches(ErrorResult& aRv) {
if (!mCacheStorage) {
mCacheStorage = CacheStorage::CreateOnWorker(cache::DEFAULT_NAMESPACE, this,
mWorkerPrivate, aRv);
+ mWorkerPrivate->NotifyStorageKeyUsed();
}
RefPtr<CacheStorage> ref = mCacheStorage;
@@ -735,25 +736,28 @@ already_AddRefed<IDBFactory> WorkerGlobalScope::GetIndexedDB(
if (!indexedDB) {
StorageAccess access = mWorkerPrivate->StorageAccess();
+ bool allowed = true;
if (access == StorageAccess::eDeny) {
NS_WARNING("IndexedDB is not allowed in this worker!");
- aErrorResult = NS_ERROR_DOM_SECURITY_ERR;
- return nullptr;
+ allowed = false;
}
if (ShouldPartitionStorage(access) &&
!StoragePartitioningEnabled(access,
mWorkerPrivate->CookieJarSettings())) {
NS_WARNING("IndexedDB is not allowed in this worker!");
- aErrorResult = NS_ERROR_DOM_SECURITY_ERR;
- return nullptr;
+ allowed = false;
}
- const PrincipalInfo& principalInfo =
- mWorkerPrivate->GetEffectiveStoragePrincipalInfo();
+ auto windowID = mWorkerPrivate->WindowID();
+
+ auto principalInfoPtr =
+ allowed ? MakeUnique<PrincipalInfo>(
+ mWorkerPrivate->GetEffectiveStoragePrincipalInfo())
+ : nullptr;
+ auto res = IDBFactory::CreateForWorker(this, std::move(principalInfoPtr),
+ windowID);
- auto res = IDBFactory::CreateForWorker(this, principalInfo,
- mWorkerPrivate->WindowID());
if (NS_WARN_IF(res.isErr())) {
aErrorResult = res.unwrapErr();
return nullptr;
@@ -763,6 +767,8 @@ already_AddRefed<IDBFactory> WorkerGlobalScope::GetIndexedDB(
mIndexedDB = indexedDB;
}
+ mWorkerPrivate->NotifyStorageKeyUsed();
+
return indexedDB.forget();
}