mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-27 02:05:07 +02:00
LibWeb/IDB: Apply default cursor direction
IDBGetAllOptions is supposed to have a default value for direction. When the value passed is not a potentially valid key range, we need to default the direction argument, and not assume its set Spec issue: https://github.com/w3c/IndexedDB/pull/478
This commit is contained in:
committed by
Jelle Raaijmakers
parent
cdbf4f49e1
commit
ced862c460
Notes:
github-actions[bot]
2025-10-17 07:44:08 +00:00
Author: https://github.com/stelar7 Commit: https://github.com/LadybirdBrowser/ladybird/commit/ced862c460c Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6484 Reviewed-by: https://github.com/gmta ✅ Reviewed-by: https://github.com/konradekk
@@ -2405,17 +2405,15 @@ WebIDL::ExceptionOr<GC::Ref<IDBRequest>> create_a_request_to_retrieve_multiple_i
|
||||
// 6. Let range be a key range.
|
||||
GC::Ptr<IDBKeyRange> range;
|
||||
|
||||
// 7. Let direction be a cursor direction.
|
||||
Bindings::IDBCursorDirection direction;
|
||||
// 7. Let direction be "next".
|
||||
// FIXME: Spec bug: https://github.com/w3c/IndexedDB/pull/478
|
||||
Bindings::IDBCursorDirection direction = Bindings::IDBCursorDirection::Next;
|
||||
|
||||
// 8. If running is a potentially valid key range with queryOrOptions is true, then:
|
||||
// AD-HOC: Check if query_or_options is null following https://github.com/w3c/IndexedDB/issues/475
|
||||
if (query_or_options.is_nullish() || is_a_potentially_valid_key_range(realm, query_or_options)) {
|
||||
// 1. Set range to the result of converting a value to a key range with queryOrOptions. Rethrow any exceptions.
|
||||
range = TRY(convert_a_value_to_a_key_range(realm, query_or_options));
|
||||
|
||||
// 2. Set direction to "next".
|
||||
direction = Bindings::IDBCursorDirection::Next;
|
||||
}
|
||||
|
||||
// 9. Else:
|
||||
@@ -2436,8 +2434,6 @@ WebIDL::ExceptionOr<GC::Ref<IDBRequest>> create_a_request_to_retrieve_multiple_i
|
||||
direction = Bindings::IDBCursorDirection::Prev;
|
||||
else if (direction_value == "prevunique")
|
||||
direction = Bindings::IDBCursorDirection::Prevunique;
|
||||
else
|
||||
return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "Invalid direction value"_string };
|
||||
}
|
||||
|
||||
// 10. Let operation be an algorithm to run.
|
||||
|
||||
Reference in New Issue
Block a user