diff --git a/dom/indexedDB/ActorsChild.cpp b/dom/indexedDB/ActorsChild.cpp index 40b1a8ad9f1e..bced12c4de6d 100644 --- a/dom/indexedDB/ActorsChild.cpp +++ b/dom/indexedDB/ActorsChild.cpp @@ -2053,7 +2053,7 @@ bool BackgroundDatabaseChild::DeallocPBackgroundMutableFileChild( } mozilla::ipc::IPCResult BackgroundDatabaseChild::RecvVersionChange( - const uint64_t& aOldVersion, const NullableVersion& aNewVersion) { + const uint64_t& aOldVersion, const Maybe& aNewVersion) { AssertIsOnOwningThread(); MaybeCollectGarbageOnIPCMessage(); @@ -2092,21 +2092,14 @@ mozilla::ipc::IPCResult BackgroundDatabaseChild::RecvVersionChange( RefPtr versionChangeEvent; - switch (aNewVersion.type()) { - case NullableVersion::Tnull_t: - versionChangeEvent = - IDBVersionChangeEvent::Create(kungFuDeathGrip, type, aOldVersion); - MOZ_ASSERT(versionChangeEvent); - break; - - case NullableVersion::Tuint64_t: - versionChangeEvent = IDBVersionChangeEvent::Create( - kungFuDeathGrip, type, aOldVersion, aNewVersion.get_uint64_t()); - MOZ_ASSERT(versionChangeEvent); - break; - - default: - MOZ_CRASH("Should never get here!"); + if (aNewVersion.isNothing()) { + versionChangeEvent = + IDBVersionChangeEvent::Create(kungFuDeathGrip, type, aOldVersion); + MOZ_ASSERT(versionChangeEvent); + } else { + versionChangeEvent = IDBVersionChangeEvent::Create( + kungFuDeathGrip, type, aOldVersion, aNewVersion.value()); + MOZ_ASSERT(versionChangeEvent); } IDB_LOG_MARK("IndexedDB %s: Child : Firing \"versionchange\" event", diff --git a/dom/indexedDB/ActorsChild.h b/dom/indexedDB/ActorsChild.h index 8c113e3b5dd8..3702f67d3efc 100644 --- a/dom/indexedDB/ActorsChild.h +++ b/dom/indexedDB/ActorsChild.h @@ -351,7 +351,7 @@ class BackgroundDatabaseChild final : public PBackgroundIDBDatabaseChild { PBackgroundMutableFileChild* aActor) override; virtual mozilla::ipc::IPCResult RecvVersionChange( - const uint64_t& aOldVersion, const NullableVersion& aNewVersion) override; + const uint64_t& aOldVersion, const Maybe& aNewVersion) override; virtual mozilla::ipc::IPCResult RecvInvalidate() override; diff --git a/dom/indexedDB/ActorsParent.cpp b/dom/indexedDB/ActorsParent.cpp index 95bd5dbbcb58..8dd9e1732347 100644 --- a/dom/indexedDB/ActorsParent.cpp +++ b/dom/indexedDB/ActorsParent.cpp @@ -6600,7 +6600,7 @@ class FactoryOp : public DatabaseOperationBase, nsresult SendVersionChangeMessages(DatabaseActorInfo* aDatabaseActorInfo, Database* aOpeningDatabase, uint64_t aOldVersion, - const NullableVersion& aNewVersion); + const Maybe& aNewVersion); // Methods that subclasses must implement. virtual nsresult DatabaseOpen() = 0; @@ -19394,7 +19394,7 @@ nsresult FactoryOp::CheckPermission( nsresult FactoryOp::SendVersionChangeMessages( DatabaseActorInfo* aDatabaseActorInfo, Database* aOpeningDatabase, - uint64_t aOldVersion, const NullableVersion& aNewVersion) { + uint64_t aOldVersion, const Maybe& aNewVersion) { AssertIsOnOwningThread(); MOZ_ASSERT(aDatabaseActorInfo); MOZ_ASSERT(mState == State::BeginVersionChange); @@ -20426,7 +20426,7 @@ nsresult OpenDatabaseOp::BeginVersionChange() { MOZ_ASSERT(info->mMetadata != mMetadata); mMetadata = info->mMetadata; - NullableVersion newVersion = mRequestedVersion; + Maybe newVersion = Some(mRequestedVersion); nsresult rv = SendVersionChangeMessages( info, mDatabase, mMetadata->mCommonMetadata.version(), newVersion); @@ -21185,10 +21185,8 @@ nsresult DeleteDatabaseOp::BeginVersionChange() { if (gLiveDatabaseHashtable->Get(mDatabaseId, &info)) { MOZ_ASSERT(!info->mWaitingFactoryOp); - NullableVersion newVersion = null_t(); - nsresult rv = - SendVersionChangeMessages(info, nullptr, mPreviousVersion, newVersion); + SendVersionChangeMessages(info, nullptr, mPreviousVersion, Nothing()); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } diff --git a/dom/indexedDB/PBackgroundIDBDatabase.ipdl b/dom/indexedDB/PBackgroundIDBDatabase.ipdl index 6af7a45ba5da..efe6e978f6a3 100644 --- a/dom/indexedDB/PBackgroundIDBDatabase.ipdl +++ b/dom/indexedDB/PBackgroundIDBDatabase.ipdl @@ -40,12 +40,6 @@ union DatabaseRequestParams CreateFileParams; }; -union NullableVersion -{ - null_t; - uint64_t; -}; - sync protocol PBackgroundIDBDatabase { manager PBackgroundIDBFactory; @@ -72,7 +66,7 @@ parent: child: async __delete__(); - async VersionChange(uint64_t oldVersion, NullableVersion newVersion); + async VersionChange(uint64_t oldVersion, uint64_t? newVersion); async Invalidate();