LibWeb/Storage: Return undefined for non-existent key/index access

All tests at now pass: http://wpt.live/webstorage/defineProperty.window.html
This commit is contained in:
Jim Broadbent 2024-10-20 20:40:17 +01:00 committed by Andrew Kaster
commit 7a66316297
Notes: github-actions[bot] 2024-10-23 17:32:41 +00:00
3 changed files with 14 additions and 1 deletions

View file

@ -182,7 +182,9 @@ JS::Value Storage::named_item_value(FlyString const& name) const
{
auto value = get_item(name);
if (!value.has_value())
return JS::js_null();
// AD-HOC: Spec leaves open to a description at: https://html.spec.whatwg.org/multipage/webstorage.html#the-storage-interface
// However correct behavior expected here: https://github.com/whatwg/html/issues/8684
return JS::js_undefined();
return JS::PrimitiveString::create(vm(), value.release_value());
}