summaryrefslogtreecommitdiffstats
path: root/dom/indexedDB/IDBDatabase.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:35:49 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:35:49 +0000
commitd8bbc7858622b6d9c278469aab701ca0b609cddf (patch)
treeeff41dc61d9f714852212739e6b3738b82a2af87 /dom/indexedDB/IDBDatabase.cpp
parentReleasing progress-linux version 125.0.3-1~progress7.99u1. (diff)
downloadfirefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.tar.xz
firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.zip
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--dom/indexedDB/IDBDatabase.cpp26
1 files changed, 23 insertions, 3 deletions
diff --git a/dom/indexedDB/IDBDatabase.cpp b/dom/indexedDB/IDBDatabase.cpp
index 4bbc0fc68a..c1a70e9401 100644
--- a/dom/indexedDB/IDBDatabase.cpp
+++ b/dom/indexedDB/IDBDatabase.cpp
@@ -20,6 +20,7 @@
#include "MainThreadUtils.h"
#include "mozilla/ResultExtensions.h"
#include "mozilla/Services.h"
+#include "mozilla/dom/IDBTransactionBinding.h"
#include "mozilla/storage.h"
#include "mozilla/Telemetry.h"
#include "mozilla/dom/BindingDeclarations.h"
@@ -474,7 +475,8 @@ void IDBDatabase::DeleteObjectStore(const nsAString& aName, ErrorResult& aRv) {
RefPtr<IDBTransaction> IDBDatabase::Transaction(
JSContext* aCx, const StringOrStringSequence& aStoreNames,
- IDBTransactionMode aMode, ErrorResult& aRv) {
+ IDBTransactionMode aMode, const IDBTransactionOptions& aOptions,
+ ErrorResult& aRv) {
AssertIsOnOwningThread();
if ((aMode == IDBTransactionMode::Readwriteflush ||
@@ -598,8 +600,26 @@ RefPtr<IDBTransaction> IDBDatabase::Transaction(
MOZ_CRASH("Unknown mode!");
}
+ auto durability = IDBTransaction::Durability::Default;
+ if (aOptions.IsAnyMemberPresent()) {
+ switch (aOptions.mDurability) {
+ case mozilla::dom::IDBTransactionDurability::Default:
+ durability = IDBTransaction::Durability::Default;
+ break;
+ case mozilla::dom::IDBTransactionDurability::Strict:
+ durability = IDBTransaction::Durability::Strict;
+ break;
+ case mozilla::dom::IDBTransactionDurability::Relaxed:
+ durability = IDBTransaction::Durability::Relaxed;
+ break;
+
+ default:
+ MOZ_CRASH("Unknown durability hint!");
+ }
+ }
+
SafeRefPtr<IDBTransaction> transaction =
- IDBTransaction::Create(aCx, this, sortedStoreNames, mode);
+ IDBTransaction::Create(aCx, this, sortedStoreNames, mode, durability);
if (NS_WARN_IF(!transaction)) {
IDB_REPORT_INTERNAL_ERR();
MOZ_ASSERT(!NS_IsMainThread(),
@@ -617,7 +637,7 @@ RefPtr<IDBTransaction> IDBDatabase::Transaction(
IDB_LOG_STRINGIFY(*transaction));
if (!mBackgroundActor->SendPBackgroundIDBTransactionConstructor(
- actor, sortedStoreNames, mode)) {
+ actor, sortedStoreNames, mode, durability)) {
IDB_REPORT_INTERNAL_ERR();
aRv.ThrowUnknownError("Failed to create IndexedDB transaction");
return nullptr;