1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-09 17:44:56 +09:00

LibWeb/IDB: Update spec step wording

This commit is contained in:
stelar7 2025-05-16 08:30:12 +02:00 committed by Sam Atkins
parent c1d63b5b28
commit 9e7fb5efbc
Notes: github-actions[bot] 2025-05-16 11:23:57 +00:00

View file

@ -1540,9 +1540,9 @@ GC::Ptr<IDBCursor> iterate_a_cursor(JS::Realm& realm, GC::Ref<IDBCursor> cursor,
// NOTE: This is handled by the default parameter
auto next_requirements = [&](Variant<Record, IndexRecord> const& record) -> bool {
// * If key is defined,
// * If key is defined:
if (key) {
// * the records key is greater than or equal to key.
// * The records key is greater than or equal to key.
auto is_greater_than_or_equal = record.visit(
[](Empty) { VERIFY_NOT_REACHED(); },
[key](auto const& inner_record) {
@ -1553,37 +1553,37 @@ GC::Ptr<IDBCursor> iterate_a_cursor(JS::Realm& realm, GC::Ref<IDBCursor> cursor,
return false;
}
// * If primaryKey is defined,
// * If primaryKey is defined:
if (primary_key) {
auto const& inner_record = record.get<IndexRecord>();
// * the records key is equal to key and the records value is greater than or equal to primaryKey,
// * The records key is equal to key and the records value is greater than or equal to primaryKey
if (!(Key::equals(inner_record.key, *key) && (Key::greater_than(inner_record.value, *primary_key) || Key::equals(inner_record.value, *primary_key))))
return false;
// * or the records key is greater than key.
// * The records key is greater than key.
if (!Key::greater_than(inner_record.key, *key))
return false;
}
// * If position is defined, and source is an object store,
// * If position is defined and source is an object store:
if (position && source.has<GC::Ref<ObjectStore>>()) {
auto const& inner_record = record.get<Record>();
// * the records key is greater than position.
// * The records key is greater than position.
if (!Key::greater_than(inner_record.key, *position))
return false;
}
// * If position is defined, and source is an index,
// * If position is defined and source is an index:
if (position && source.has<GC::Ref<Index>>()) {
auto const& inner_record = record.get<IndexRecord>();
// * the records key is equal to position and the records value is greater than object store position
// * The records key is equal to position and the records value is greater than object store position
if (!(Key::equals(inner_record.key, *position) && (Key::greater_than(inner_record.value, *object_store_position))))
return false;
// * or the records key is greater than position.
// * The records key is greater than position.
if (!Key::greater_than(inner_record.key, *position))
return false;
}
@ -1599,9 +1599,9 @@ GC::Ptr<IDBCursor> iterate_a_cursor(JS::Realm& realm, GC::Ref<IDBCursor> cursor,
};
auto next_unique_requirements = [&](Variant<Record, IndexRecord> const& record) -> bool {
// * If key is defined,
// * If key is defined:
if (key) {
// * the records key is greater than or equal to key.
// * The records key is greater than or equal to key.
auto is_greater_than_or_equal = record.visit(
[](Empty) { VERIFY_NOT_REACHED(); },
[key](auto const& inner_record) {
@ -1612,9 +1612,9 @@ GC::Ptr<IDBCursor> iterate_a_cursor(JS::Realm& realm, GC::Ref<IDBCursor> cursor,
return false;
}
// * If position is defined,
// * If position is defined:
if (position) {
// * the records key is greater than position.
// * The records key is greater than position.
auto is_greater_than_position = record.visit(
[](Empty) { VERIFY_NOT_REACHED(); },
[position](auto const& inner_record) {
@ -1636,9 +1636,9 @@ GC::Ptr<IDBCursor> iterate_a_cursor(JS::Realm& realm, GC::Ref<IDBCursor> cursor,
};
auto prev_requirements = [&](Variant<Record, IndexRecord> const& record) -> bool {
// * If key is defined,
// * If key is defined:
if (key) {
// * the records key is less than or equal to key.
// * The records key is less than or equal to key.
auto is_less_than_or_equal = record.visit(
[](Empty) { VERIFY_NOT_REACHED(); },
[key](auto const& inner_record) {
@ -1649,37 +1649,37 @@ GC::Ptr<IDBCursor> iterate_a_cursor(JS::Realm& realm, GC::Ref<IDBCursor> cursor,
return false;
}
// * If primaryKey is defined,
// * If primaryKey is defined:
if (primary_key) {
auto const& inner_record = record.get<IndexRecord>();
// * the records key is equal to key and the records value is less than or equal to primaryKey,
// * The records key is equal to key and the records value is less than or equal to primaryKey
if (!(Key::equals(inner_record.key, *key) && (Key::less_than(inner_record.value, *primary_key) || Key::equals(inner_record.value, *primary_key))))
return false;
// * or the records key is less than key.
// * The records key is less than key.
if (!Key::less_than(inner_record.key, *key))
return false;
}
// * If position is defined, and source is an object store,
// * If position is defined and source is an object store:
if (position && source.has<GC::Ref<ObjectStore>>()) {
auto const& inner_record = record.get<Record>();
// * the records key is less than position.
// * The records key is less than position.
if (!Key::less_than(inner_record.key, *position))
return false;
}
// * If position is defined, and source is an index,
// * If position is defined and source is an index:
if (position && source.has<GC::Ref<Index>>()) {
auto const& inner_record = record.get<IndexRecord>();
// * the records key is equal to position and the records value is less than object store position
// * The records key is equal to position and the records value is less than object store position
if (!(Key::equals(inner_record.key, *position) && Key::less_than(inner_record.value, *object_store_position)))
return false;
// * or the records key is less than position.
// * The records key is less than position.
if (!Key::less_than(inner_record.key, *position))
return false;
}
@ -1695,9 +1695,9 @@ GC::Ptr<IDBCursor> iterate_a_cursor(JS::Realm& realm, GC::Ref<IDBCursor> cursor,
};
auto prev_unique_requirements = [&](Variant<Record, IndexRecord> const& record) -> bool {
// * If key is defined,
// * If key is defined:
if (key) {
// * the records key is less than or equal to key.
// * The records key is less than or equal to key.
auto is_less_than_or_equal = record.visit(
[](Empty) { VERIFY_NOT_REACHED(); },
[key](auto const& inner_record) {
@ -1708,9 +1708,9 @@ GC::Ptr<IDBCursor> iterate_a_cursor(JS::Realm& realm, GC::Ref<IDBCursor> cursor,
return false;
}
//* If position is defined,
//* If position is defined:
if (position) {
// * the records key is less than position.
// * The records key is less than position.
auto is_less_than_position = record.visit(
[](Empty) { VERIFY_NOT_REACHED(); },
[position](auto const& inner_record) {