Bug 1600906 - Use scoped enums in IDBCursor. r=dom-workers-and-storage-reviewers,ytausky

Depends on D57990

Differential Revision: https://phabricator.services.mozilla.com/D57991

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Simon Giesecke 2020-01-06 14:19:39 +00:00
Родитель 34a5e80ee4
Коммит 0d5b4fd7af
6 изменённых файлов: 119 добавлений и 114 удалений

Просмотреть файл

@ -1278,11 +1278,11 @@ void DispatchFileHandleSuccessEvent(FileHandleResultHelper* aResultHelper) {
auto GetKeyOperator(const IDBCursor::Direction aDirection) {
switch (aDirection) {
case IDBCursor::NEXT:
case IDBCursor::NEXT_UNIQUE:
case IDBCursor::Direction::Next:
case IDBCursor::Direction::NextUnique:
return &Key::operator>=;
case IDBCursor::PREV:
case IDBCursor::PREV_UNIQUE:
case IDBCursor::Direction::Prev:
case IDBCursor::Direction::PrevUnique:
return &Key::operator<=;
default:
MOZ_CRASH("Should never get here.");
@ -3457,18 +3457,18 @@ void BackgroundCursorChild::CompleteContinueRequestFromCache() {
auto& item = mDelayedResponses.front();
switch (mCursor->GetType()) {
case IDBCursor::Type_ObjectStore:
case IDBCursor::Type::ObjectStore:
mCursor->Reset(std::move(item.mKey), std::move(item.mCloneInfo));
break;
case IDBCursor::Type_Index:
case IDBCursor::Type::Index:
mCursor->Reset(std::move(item.mKey), std::move(item.mLocaleAwareKey),
std::move(item.mObjectStoreKey),
std::move(item.mCloneInfo));
break;
case IDBCursor::Type_ObjectStoreKey:
case IDBCursor::Type::ObjectStoreKey:
mCursor->Reset(std::move(item.mKey));
break;
case IDBCursor::Type_IndexKey:
case IDBCursor::Type::IndexKey:
mCursor->Reset(std::move(item.mKey), std::move(item.mLocaleAwareKey),
std::move(item.mObjectStoreKey));
break;

Просмотреть файл

@ -9397,20 +9397,23 @@ nsAutoCString MakeColumnPairSelectionList(
}
constexpr bool IsIncreasingOrder(const IDBCursor::Direction aDirection) {
MOZ_ASSERT(
aDirection == IDBCursor::NEXT || aDirection == IDBCursor::NEXT_UNIQUE ||
aDirection == IDBCursor::PREV || aDirection == IDBCursor::PREV_UNIQUE);
MOZ_ASSERT(aDirection == IDBCursor::Direction::Next ||
aDirection == IDBCursor::Direction::NextUnique ||
aDirection == IDBCursor::Direction::Prev ||
aDirection == IDBCursor::Direction::PrevUnique);
return aDirection == IDBCursor::NEXT || aDirection == IDBCursor::NEXT_UNIQUE;
return aDirection == IDBCursor::Direction::Next ||
aDirection == IDBCursor::Direction::NextUnique;
}
constexpr bool IsUnique(const IDBCursor::Direction aDirection) {
MOZ_ASSERT(
aDirection == IDBCursor::NEXT || aDirection == IDBCursor::NEXT_UNIQUE ||
aDirection == IDBCursor::PREV || aDirection == IDBCursor::PREV_UNIQUE);
MOZ_ASSERT(aDirection == IDBCursor::Direction::Next ||
aDirection == IDBCursor::Direction::NextUnique ||
aDirection == IDBCursor::Direction::Prev ||
aDirection == IDBCursor::Direction::PrevUnique);
return aDirection == IDBCursor::NEXT_UNIQUE ||
aDirection == IDBCursor::PREV_UNIQUE;
return aDirection == IDBCursor::Direction::NextUnique ||
aDirection == IDBCursor::Direction::PrevUnique;
}
constexpr bool IsKeyCursor(const Cursor::Type aType) {
@ -15393,16 +15396,16 @@ bool Cursor::VerifyRequestParams(const CursorRequestParams& aParams,
const Key& key = aParams.get_ContinueParams().key();
if (!key.IsUnset()) {
switch (mDirection) {
case IDBCursor::NEXT:
case IDBCursor::NEXT_UNIQUE:
case IDBCursor::Direction::Next:
case IDBCursor::Direction::NextUnique:
if (NS_WARN_IF(key <= sortKey)) {
ASSERT_UNLESS_FUZZING();
return false;
}
break;
case IDBCursor::PREV:
case IDBCursor::PREV_UNIQUE:
case IDBCursor::Direction::Prev:
case IDBCursor::Direction::PrevUnique:
if (NS_WARN_IF(key >= sortKey)) {
ASSERT_UNLESS_FUZZING();
return false;
@ -15423,7 +15426,7 @@ bool Cursor::VerifyRequestParams(const CursorRequestParams& aParams,
MOZ_ASSERT(!key.IsUnset());
MOZ_ASSERT(!primaryKey.IsUnset());
switch (mDirection) {
case IDBCursor::NEXT:
case IDBCursor::Direction::Next:
if (NS_WARN_IF(key < sortKey ||
(key == sortKey &&
primaryKey <= aPosition.mObjectStorePosition))) {
@ -15432,7 +15435,7 @@ bool Cursor::VerifyRequestParams(const CursorRequestParams& aParams,
}
break;
case IDBCursor::PREV:
case IDBCursor::Direction::Prev:
if (NS_WARN_IF(key > sortKey ||
(key == sortKey &&
primaryKey >= aPosition.mObjectStorePosition))) {
@ -26219,8 +26222,8 @@ void Cursor::OpenOp::PrepareIndexKeyConditionClause(
kStmtParamNameCurrentKey);
switch (mCursor->mDirection) {
case IDBCursor::NEXT:
case IDBCursor::PREV:
case IDBCursor::Direction::Next:
case IDBCursor::Direction::Prev:
continueQuery =
aQueryStart + NS_LITERAL_CSTRING(" AND ") +
GetSortKeyClause(isIncreasingOrder
@ -26259,8 +26262,8 @@ void Cursor::OpenOp::PrepareIndexKeyConditionClause(
NS_LITERAL_CSTRING(")");
break;
case IDBCursor::NEXT_UNIQUE:
case IDBCursor::PREV_UNIQUE:
case IDBCursor::Direction::NextUnique:
case IDBCursor::Direction::PrevUnique:
continueQuery =
aQueryStart + NS_LITERAL_CSTRING(" AND ") +
GetSortKeyClause(isIncreasingOrder ? ComparisonOperator::GreaterThan
@ -26475,16 +26478,16 @@ nsresult Cursor::OpenOp::DoIndexDatabaseWork(DatabaseConnection* aConnection) {
NS_LITERAL_CSTRING(" ORDER BY ") + kColumnNameAliasSortKey;
switch (mCursor->mDirection) {
case IDBCursor::NEXT:
case IDBCursor::NEXT_UNIQUE:
case IDBCursor::Direction::Next:
case IDBCursor::Direction::NextUnique:
directionClause.AppendLiteral(" ASC, index_table.object_data_key ASC");
break;
case IDBCursor::PREV:
case IDBCursor::Direction::Prev:
directionClause.AppendLiteral(" DESC, index_table.object_data_key DESC");
break;
case IDBCursor::PREV_UNIQUE:
case IDBCursor::Direction::PrevUnique:
directionClause.AppendLiteral(" DESC, index_table.object_data_key ASC");
break;
@ -26570,16 +26573,16 @@ nsresult Cursor::OpenOp::DoIndexKeyDatabaseWork(
NS_LITERAL_CSTRING(" ORDER BY ") + kColumnNameAliasSortKey;
switch (mCursor->mDirection) {
case IDBCursor::NEXT:
case IDBCursor::NEXT_UNIQUE:
case IDBCursor::Direction::Next:
case IDBCursor::Direction::NextUnique:
directionClause.AppendLiteral(" ASC, object_data_key ASC");
break;
case IDBCursor::PREV:
case IDBCursor::Direction::Prev:
directionClause.AppendLiteral(" DESC, object_data_key DESC");
break;
case IDBCursor::PREV_UNIQUE:
case IDBCursor::Direction::PrevUnique:
directionClause.AppendLiteral(" DESC, object_data_key ASC");
break;
@ -26691,8 +26694,8 @@ nsresult Cursor::ContinueOp::DoDatabaseWork(DatabaseConnection* aConnection) {
mCursor->mType == OpenCursorParams::TIndexOpenCursorParams ||
mCursor->mType == OpenCursorParams::TIndexOpenKeyCursorParams;
MOZ_ASSERT_IF(isIndex && (mCursor->mDirection == IDBCursor::NEXT ||
mCursor->mDirection == IDBCursor::PREV),
MOZ_ASSERT_IF(isIndex && (mCursor->mDirection == IDBCursor::Direction::Next ||
mCursor->mDirection == IDBCursor::Direction::Prev),
!mCursor->mContinueQueries->mContinuePrimaryKeyQuery.IsEmpty());
MOZ_ASSERT_IF(isIndex, mCursor->mIndexId);
MOZ_ASSERT_IF(isIndex, !mCurrentPosition.mObjectStorePosition.IsUnset());
@ -26734,8 +26737,8 @@ nsresult Cursor::ContinueOp::DoDatabaseWork(DatabaseConnection* aConnection) {
MOZ_ASSERT(!mParams.get_ContinuePrimaryKeyParams().key().IsUnset());
MOZ_ASSERT(
!mParams.get_ContinuePrimaryKeyParams().primaryKey().IsUnset());
MOZ_ASSERT(mCursor->mDirection == IDBCursor::NEXT ||
mCursor->mDirection == IDBCursor::PREV);
MOZ_ASSERT(mCursor->mDirection == IDBCursor::Direction::Next ||
mCursor->mDirection == IDBCursor::Direction::Prev);
hasContinueKey = true;
hasContinuePrimaryKey = true;
explicitContinueKey = mParams.get_ContinuePrimaryKeyParams().key();
@ -26812,8 +26815,8 @@ nsresult Cursor::ContinueOp::DoDatabaseWork(DatabaseConnection* aConnection) {
// Bind object store position if duplicates are allowed and we're not
// continuing to a specific key.
if (isIndex && !hasContinueKey &&
(mCursor->mDirection == IDBCursor::NEXT ||
mCursor->mDirection == IDBCursor::PREV)) {
(mCursor->mDirection == IDBCursor::Direction::Next ||
mCursor->mDirection == IDBCursor::Direction::Prev)) {
rv = mCurrentPosition.mObjectStorePosition.BindToStatement(
&*stmt, kStmtParamNameObjectStorePosition);
if (NS_WARN_IF(NS_FAILED(rv))) {

Просмотреть файл

@ -49,9 +49,9 @@ IDBCursor::IDBCursor(Type aType, BackgroundCursorChild* aBackgroundActor,
MOZ_ASSERT(aBackgroundActor);
aBackgroundActor->AssertIsOnOwningThread();
MOZ_ASSERT(mRequest);
MOZ_ASSERT_IF(aType == Type_ObjectStore || aType == Type_ObjectStoreKey,
MOZ_ASSERT_IF(aType == Type::ObjectStore || aType == Type::ObjectStoreKey,
mSourceObjectStore);
MOZ_ASSERT_IF(aType == Type_Index || aType == Type_IndexKey, mSourceIndex);
MOZ_ASSERT_IF(aType == Type::Index || aType == Type::IndexKey, mSourceIndex);
MOZ_ASSERT(mTransaction);
MOZ_ASSERT(!aKey.IsUnset());
@ -86,7 +86,7 @@ RefPtr<IDBCursor> IDBCursor::Create(BackgroundCursorChild* aBackgroundActor,
MOZ_ASSERT(!aKey.IsUnset());
RefPtr<IDBCursor> cursor =
new IDBCursor(Type_ObjectStore, aBackgroundActor, std::move(aKey));
new IDBCursor(Type::ObjectStore, aBackgroundActor, std::move(aKey));
cursor->mCloneInfo = std::move(aCloneInfo);
@ -103,7 +103,7 @@ RefPtr<IDBCursor> IDBCursor::Create(BackgroundCursorChild* aBackgroundActor,
MOZ_ASSERT(!aKey.IsUnset());
RefPtr<IDBCursor> cursor =
new IDBCursor(Type_ObjectStoreKey, aBackgroundActor, std::move(aKey));
new IDBCursor(Type::ObjectStoreKey, aBackgroundActor, std::move(aKey));
return cursor;
}
@ -120,7 +120,7 @@ RefPtr<IDBCursor> IDBCursor::Create(BackgroundCursorChild* aBackgroundActor,
MOZ_ASSERT(!aPrimaryKey.IsUnset());
RefPtr<IDBCursor> cursor =
new IDBCursor(Type_Index, aBackgroundActor, std::move(aKey));
new IDBCursor(Type::Index, aBackgroundActor, std::move(aKey));
cursor->mSortKey = std::move(aSortKey);
cursor->mPrimaryKey = std::move(aPrimaryKey);
@ -140,7 +140,7 @@ RefPtr<IDBCursor> IDBCursor::Create(BackgroundCursorChild* aBackgroundActor,
MOZ_ASSERT(!aPrimaryKey.IsUnset());
RefPtr<IDBCursor> cursor =
new IDBCursor(Type_IndexKey, aBackgroundActor, std::move(aKey));
new IDBCursor(Type::IndexKey, aBackgroundActor, std::move(aKey));
cursor->mSortKey = std::move(aSortKey);
cursor->mPrimaryKey = std::move(aPrimaryKey);
@ -152,16 +152,16 @@ RefPtr<IDBCursor> IDBCursor::Create(BackgroundCursorChild* aBackgroundActor,
auto IDBCursor::ConvertDirection(IDBCursorDirection aDirection) -> Direction {
switch (aDirection) {
case mozilla::dom::IDBCursorDirection::Next:
return NEXT;
return Direction::Next;
case mozilla::dom::IDBCursorDirection::Nextunique:
return NEXT_UNIQUE;
return Direction::NextUnique;
case mozilla::dom::IDBCursorDirection::Prev:
return PREV;
return Direction::Prev;
case mozilla::dom::IDBCursorDirection::Prevunique:
return PREV_UNIQUE;
return Direction::PrevUnique;
default:
MOZ_CRASH("Unknown direction!");
@ -197,7 +197,7 @@ bool IDBCursor::IsSourceDeleted() const {
MOZ_ASSERT(mTransaction->CanAcceptRequests());
IDBObjectStore* sourceObjectStore;
if (mType == Type_Index || mType == Type_IndexKey) {
if (mType == Type::Index || mType == Type::IndexKey) {
MOZ_ASSERT(mSourceIndex);
if (mSourceIndex->IsDeleted()) {
@ -240,16 +240,16 @@ IDBCursorDirection IDBCursor::GetDirection() const {
AssertIsOnOwningThread();
switch (mDirection) {
case NEXT:
case Direction::Next:
return IDBCursorDirection::Next;
case NEXT_UNIQUE:
case Direction::NextUnique:
return IDBCursorDirection::Nextunique;
case PREV:
case Direction::Prev:
return IDBCursorDirection::Prev;
case PREV_UNIQUE:
case Direction::PrevUnique:
return IDBCursorDirection::Prevunique;
default:
@ -263,14 +263,14 @@ void IDBCursor::GetSource(OwningIDBObjectStoreOrIDBIndex& aSource) const {
AssertIsOnOwningThread();
switch (mType) {
case Type_ObjectStore:
case Type_ObjectStoreKey:
case Type::ObjectStore:
case Type::ObjectStoreKey:
MOZ_ASSERT(mSourceObjectStore);
aSource.SetAsIDBObjectStore() = mSourceObjectStore;
return;
case Type_Index:
case Type_IndexKey:
case Type::Index:
case Type::IndexKey:
MOZ_ASSERT(mSourceIndex);
aSource.SetAsIDBIndex() = mSourceIndex;
return;
@ -323,9 +323,10 @@ void IDBCursor::GetPrimaryKey(JSContext* aCx,
mRooted = true;
}
const Key& key = (mType == Type_ObjectStore || mType == Type_ObjectStoreKey)
? mKey
: mPrimaryKey;
const Key& key =
(mType == Type::ObjectStore || mType == Type::ObjectStoreKey)
? mKey
: mPrimaryKey;
MOZ_ASSERT(!key.IsUnset());
@ -343,7 +344,7 @@ void IDBCursor::GetPrimaryKey(JSContext* aCx,
void IDBCursor::GetValue(JSContext* aCx, JS::MutableHandle<JS::Value> aResult,
ErrorResult& aRv) {
AssertIsOnOwningThread();
MOZ_ASSERT(mType == Type_ObjectStore || mType == Type_Index);
MOZ_ASSERT(mType == Type::ObjectStore || mType == Type::Index);
if (!mHaveValue) {
aResult.setUndefined();
@ -410,16 +411,16 @@ void IDBCursor::Continue(JSContext* aCx, JS::Handle<JS::Value> aKey,
if (!key.IsUnset()) {
switch (mDirection) {
case NEXT:
case NEXT_UNIQUE:
case Direction::Next:
case Direction::NextUnique:
if (key <= sortKey) {
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_DATA_ERR);
return;
}
break;
case PREV:
case PREV_UNIQUE:
case Direction::Prev:
case Direction::PrevUnique:
if (key >= sortKey) {
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_DATA_ERR);
return;
@ -434,7 +435,7 @@ void IDBCursor::Continue(JSContext* aCx, JS::Handle<JS::Value> aKey,
const uint64_t requestSerialNumber = IDBRequest::NextSerialNumber();
mRequest->SetLoggingSerialNumber(requestSerialNumber);
if (mType == Type_ObjectStore || mType == Type_ObjectStoreKey) {
if (mType == Type::ObjectStore || mType == Type::ObjectStoreKey) {
IDB_LOG_MARK_CHILD_TRANSACTION_REQUEST(
"database(%s).transaction(%s).objectStore(%s)."
"cursor(%s).continue(%s)",
@ -475,8 +476,8 @@ void IDBCursor::ContinuePrimaryKey(JSContext* aCx, JS::Handle<JS::Value> aKey,
return;
}
if ((mType != Type_Index && mType != Type_IndexKey) ||
(mDirection != NEXT && mDirection != PREV)) {
if ((mType != Type::Index && mType != Type::IndexKey) ||
(mDirection != Direction::Next && mDirection != Direction::Prev)) {
aRv.Throw(NS_ERROR_DOM_INVALID_ACCESS_ERR);
return;
}
@ -529,14 +530,14 @@ void IDBCursor::ContinuePrimaryKey(JSContext* aCx, JS::Handle<JS::Value> aKey,
const Key& sortKey = IsLocaleAware() ? mSortKey : mKey;
switch (mDirection) {
case NEXT:
case Direction::Next:
if (key < sortKey || (key == sortKey && primaryKey <= mPrimaryKey)) {
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_DATA_ERR);
return;
}
break;
case PREV:
case Direction::Prev:
if (key > sortKey || (key == sortKey && primaryKey >= mPrimaryKey)) {
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_DATA_ERR);
return;
@ -587,7 +588,7 @@ void IDBCursor::Advance(uint32_t aCount, ErrorResult& aRv) {
const uint64_t requestSerialNumber = IDBRequest::NextSerialNumber();
mRequest->SetLoggingSerialNumber(requestSerialNumber);
if (mType == Type_ObjectStore || mType == Type_ObjectStoreKey) {
if (mType == Type::ObjectStore || mType == Type::ObjectStoreKey) {
IDB_LOG_MARK_CHILD_TRANSACTION_REQUEST(
"database(%s).transaction(%s).objectStore(%s)."
"cursor(%s).advance(%ld)",
@ -628,20 +629,20 @@ RefPtr<IDBRequest> IDBCursor::Update(JSContext* aCx,
}
if (mTransaction->GetMode() == IDBTransaction::Mode::Cleanup ||
IsSourceDeleted() || !mHaveValue || mType == Type_ObjectStoreKey ||
mType == Type_IndexKey || mContinueCalled) {
IsSourceDeleted() || !mHaveValue || mType == Type::ObjectStoreKey ||
mType == Type::IndexKey || mContinueCalled) {
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_NOT_ALLOWED_ERR);
return nullptr;
}
MOZ_ASSERT(mType == Type_ObjectStore || mType == Type_Index);
MOZ_ASSERT(mType == Type::ObjectStore || mType == Type::Index);
MOZ_ASSERT(!mKey.IsUnset());
MOZ_ASSERT_IF(mType == Type_Index, !mPrimaryKey.IsUnset());
MOZ_ASSERT_IF(mType == Type::Index, !mPrimaryKey.IsUnset());
mTransaction->InvalidateCursorCaches();
IDBObjectStore* objectStore;
if (mType == Type_ObjectStore) {
if (mType == Type::ObjectStore) {
objectStore = mSourceObjectStore;
} else {
objectStore = mSourceIndex->ObjectStore();
@ -651,7 +652,7 @@ RefPtr<IDBRequest> IDBCursor::Update(JSContext* aCx,
IDBObjectStore::ValueWrapper valueWrapper(aCx, aValue);
const Key& primaryKey = (mType == Type_ObjectStore) ? mKey : mPrimaryKey;
const Key& primaryKey = (mType == Type::ObjectStore) ? mKey : mPrimaryKey;
RefPtr<IDBRequest> request;
@ -699,7 +700,7 @@ RefPtr<IDBRequest> IDBCursor::Update(JSContext* aCx,
request->SetSource(this);
if (mType == Type_ObjectStore) {
if (mType == Type::ObjectStore) {
IDB_LOG_MARK_CHILD_TRANSACTION_REQUEST(
"database(%s).transaction(%s).objectStore(%s)."
"cursor(%s).update(%s)",
@ -737,24 +738,24 @@ RefPtr<IDBRequest> IDBCursor::Delete(JSContext* aCx, ErrorResult& aRv) {
return nullptr;
}
if (IsSourceDeleted() || !mHaveValue || mType == Type_ObjectStoreKey ||
mType == Type_IndexKey || mContinueCalled) {
if (IsSourceDeleted() || !mHaveValue || mType == Type::ObjectStoreKey ||
mType == Type::IndexKey || mContinueCalled) {
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_NOT_ALLOWED_ERR);
return nullptr;
}
MOZ_ASSERT(mType == Type_ObjectStore || mType == Type_Index);
MOZ_ASSERT(mType == Type::ObjectStore || mType == Type::Index);
MOZ_ASSERT(!mKey.IsUnset());
mTransaction->InvalidateCursorCaches();
IDBObjectStore* const objectStore = mType == Type_ObjectStore
IDBObjectStore* const objectStore = mType == Type::ObjectStore
? mSourceObjectStore.get()
: mSourceIndex->ObjectStore();
MOZ_ASSERT(objectStore);
const Key& primaryKey = (mType == Type_ObjectStore) ? mKey : mPrimaryKey;
const Key& primaryKey = (mType == Type::ObjectStore) ? mKey : mPrimaryKey;
JS::Rooted<JS::Value> key(aCx);
aRv = primaryKey.ToJSVal(aCx, &key);
@ -770,7 +771,7 @@ RefPtr<IDBRequest> IDBCursor::Delete(JSContext* aCx, ErrorResult& aRv) {
request->SetSource(this);
if (mType == Type_ObjectStore) {
if (mType == Type::ObjectStore) {
IDB_LOG_MARK_CHILD_TRANSACTION_REQUEST(
"database(%s).transaction(%s).objectStore(%s)."
"cursor(%s).delete(%s)",
@ -797,7 +798,7 @@ RefPtr<IDBRequest> IDBCursor::Delete(JSContext* aCx, ErrorResult& aRv) {
void IDBCursor::Reset(Key&& aKey, StructuredCloneReadInfo&& aValue) {
AssertIsOnOwningThread();
MOZ_ASSERT(mType == Type_ObjectStore);
MOZ_ASSERT(mType == Type::ObjectStore);
Reset();
@ -809,7 +810,7 @@ void IDBCursor::Reset(Key&& aKey, StructuredCloneReadInfo&& aValue) {
void IDBCursor::Reset(Key&& aKey) {
AssertIsOnOwningThread();
MOZ_ASSERT(mType == Type_ObjectStoreKey);
MOZ_ASSERT(mType == Type::ObjectStoreKey);
Reset();
@ -821,7 +822,7 @@ void IDBCursor::Reset(Key&& aKey) {
void IDBCursor::Reset(Key&& aKey, Key&& aSortKey, Key&& aPrimaryKey,
StructuredCloneReadInfo&& aValue) {
AssertIsOnOwningThread();
MOZ_ASSERT(mType == Type_Index);
MOZ_ASSERT(mType == Type::Index);
Reset();
@ -835,7 +836,7 @@ void IDBCursor::Reset(Key&& aKey, Key&& aSortKey, Key&& aPrimaryKey,
void IDBCursor::Reset(Key&& aKey, Key&& aSortKey, Key&& aPrimaryKey) {
AssertIsOnOwningThread();
MOZ_ASSERT(mType == Type_IndexKey);
MOZ_ASSERT(mType == Type::IndexKey);
Reset();
@ -894,12 +895,12 @@ JSObject* IDBCursor::WrapObject(JSContext* aCx,
AssertIsOnOwningThread();
switch (mType) {
case Type_ObjectStore:
case Type_Index:
case Type::ObjectStore:
case Type::Index:
return IDBCursorWithValue_Binding::Wrap(aCx, this, aGivenProto);
case Type_ObjectStoreKey:
case Type_IndexKey:
case Type::ObjectStoreKey:
case Type::IndexKey:
return IDBCursor_Binding::Wrap(aCx, this, aGivenProto);
default:

Просмотреть файл

@ -38,24 +38,24 @@ class BackgroundCursorChild;
// distinctions.
class IDBCursor final : public nsISupports, public nsWrapperCache {
public:
typedef indexedDB::Key Key;
typedef indexedDB::StructuredCloneReadInfo StructuredCloneReadInfo;
using Key = indexedDB::Key;
using StructuredCloneReadInfo = indexedDB::StructuredCloneReadInfo;
enum Direction {
NEXT = 0,
NEXT_UNIQUE,
PREV,
PREV_UNIQUE,
enum struct Direction {
Next = 0,
NextUnique,
Prev,
PrevUnique,
// Only needed for IPC serialization helper, should never be used in code.
DIRECTION_INVALID
Invalid
};
enum Type {
Type_ObjectStore,
Type_ObjectStoreKey,
Type_Index,
Type_IndexKey,
enum struct Type {
ObjectStore,
ObjectStoreKey,
Index,
IndexKey,
};
private:

Просмотреть файл

@ -191,16 +191,16 @@ class MOZ_STACK_CLASS LoggingString final : public nsAutoCString {
explicit LoggingString(const IDBCursor::Direction aDirection) {
switch (aDirection) {
case IDBCursor::NEXT:
case IDBCursor::Direction::Next:
AssignLiteral("\"next\"");
break;
case IDBCursor::NEXT_UNIQUE:
case IDBCursor::Direction::NextUnique:
AssignLiteral("\"nextunique\"");
break;
case IDBCursor::PREV:
case IDBCursor::Direction::Prev:
AssignLiteral("\"prev\"");
break;
case IDBCursor::PREV_UNIQUE:
case IDBCursor::Direction::PrevUnique:
AssignLiteral("\"prevunique\"");
break;
default:

Просмотреть файл

@ -71,8 +71,9 @@ struct ParamTraits<mozilla::dom::indexedDB::KeyPath> {
template <>
struct ParamTraits<mozilla::dom::IDBCursor::Direction>
: public ContiguousEnumSerializer<
mozilla::dom::IDBCursor::Direction, mozilla::dom::IDBCursor::NEXT,
mozilla::dom::IDBCursor::DIRECTION_INVALID> {};
mozilla::dom::IDBCursor::Direction,
mozilla::dom::IDBCursor::Direction::Next,
mozilla::dom::IDBCursor::Direction::Invalid> {};
template <>
struct ParamTraits<mozilla::dom::IDBTransaction::Mode>