mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:07:45 +00:00
LibWeb: Add window.sessionStorage
This commit is contained in:
parent
1535fe0324
commit
83eb5ac8fd
4 changed files with 21 additions and 0 deletions
|
@ -114,6 +114,7 @@ void WindowObject::initialize_global_object()
|
|||
define_direct_property("CSS", heap().allocate<CSSNamespace>(*this, *this), 0);
|
||||
|
||||
define_native_accessor("localStorage", local_storage_getter, {}, attr);
|
||||
define_native_accessor("sessionStorage", session_storage_getter, {}, attr);
|
||||
define_native_accessor("origin", origin_getter, {}, attr);
|
||||
|
||||
// Legacy
|
||||
|
@ -649,6 +650,13 @@ JS_DEFINE_NATIVE_FUNCTION(WindowObject::local_storage_getter)
|
|||
return wrap(global_object, *impl->local_storage());
|
||||
}
|
||||
|
||||
JS_DEFINE_NATIVE_FUNCTION(WindowObject::session_storage_getter)
|
||||
{
|
||||
auto* impl = TRY(impl_from(vm, global_object));
|
||||
// FIXME: sessionStorage may throw. We have to deal with that here.
|
||||
return wrap(global_object, *impl->session_storage());
|
||||
}
|
||||
|
||||
#define __ENUMERATE(attribute, event_name) \
|
||||
JS_DEFINE_NATIVE_FUNCTION(WindowObject::attribute##_getter) \
|
||||
{ \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue