mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-12 11:09:18 +00:00
Bindings: Make item_value return an Optional<JS::Value>
This removes some ambiguity about what the return value should be if the index is out of range. Previously, we would sometimes return a JS null, and other times a JS undefined. It will also let us fold together the checks for whether an index is a supported property index, followed by getting the value just afterwards.
This commit is contained in:
parent
9b59dc5e8b
commit
c5c1a8fcc7
Notes:
github-actions[bot]
2024-07-26 12:27:19 +00:00
Author: https://github.com/shannonbooth
Commit: c5c1a8fcc7
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/827
31 changed files with 53 additions and 47 deletions
|
@ -96,7 +96,7 @@ JS::ThrowCompletionOr<Optional<JS::PropertyDescriptor>> PlatformObject::legacy_p
|
|||
// 2. Let value be an uninitialized variable.
|
||||
// 3. If operation was defined without an identifier, then set value to the result of performing the steps listed in the interface description to determine the value of an indexed property with index as the index.
|
||||
// 4. Otherwise, operation was defined with an identifier. Set value to the result of performing the method steps of operation with O as this and « index » as the argument values.
|
||||
auto value = item_value(index);
|
||||
auto value = *item_value(index);
|
||||
|
||||
// 5. Let desc be a newly created Property Descriptor with no fields.
|
||||
JS::PropertyDescriptor descriptor;
|
||||
|
@ -481,9 +481,9 @@ WebIDL::ExceptionOr<PlatformObject::DidDeletionFail> PlatformObject::delete_valu
|
|||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
JS::Value PlatformObject::item_value(size_t) const
|
||||
Optional<JS::Value> PlatformObject::item_value(size_t) const
|
||||
{
|
||||
return JS::js_undefined();
|
||||
return {};
|
||||
}
|
||||
|
||||
JS::Value PlatformObject::named_item_value(FlyString const&) const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue