LibWeb/HTML: Port Window.localStorage to IDL

This commit is contained in:
Linus Groh 2023-03-07 18:18:20 +00:00
parent 5cc6b1c4db
commit 37e9302dd9
Notes: sideshowbarker 2024-07-17 05:02:35 +09:00
4 changed files with 8 additions and 8 deletions

View file

@ -897,7 +897,6 @@ WebIDL::ExceptionOr<void> Window::initialize_web_interfaces(Badge<WindowEnvironm
define_direct_property("CSS", MUST_OR_THROW_OOM(heap().allocate<Bindings::CSSNamespace>(realm, realm)), 0);
define_native_accessor(realm, "localStorage", local_storage_getter, {}, attr);
define_native_accessor(realm, "sessionStorage", session_storage_getter, {}, attr);
// FIXME: Implement codegen for readonly properties with [PutForwards]
@ -1619,12 +1618,6 @@ JS_DEFINE_NATIVE_FUNCTION(Window::structured_clone)
}));
}
JS_DEFINE_NATIVE_FUNCTION(Window::local_storage_getter)
{
auto* impl = TRY(impl_from(vm));
return impl->local_storage();
}
JS_DEFINE_NATIVE_FUNCTION(Window::session_storage_getter)
{
auto* impl = TRY(impl_from(vm));

View file

@ -253,7 +253,6 @@ private:
JS_DECLARE_NATIVE_FUNCTION(structured_clone);
JS_DECLARE_NATIVE_FUNCTION(local_storage_getter);
JS_DECLARE_NATIVE_FUNCTION(session_storage_getter);
JS_DECLARE_NATIVE_FUNCTION(set_interval);

View file

@ -7,6 +7,7 @@
#import <HighResolutionTime/Performance.idl>
#import <HTML/AnimationFrameProvider.idl>
#import <HTML/Navigator.idl>
#import <HTML/WindowLocalStorage.idl>
#import <HTML/WindowOrWorkerGlobalScope.idl>
#import <RequestIdleCallback/IdleRequest.idl>
@ -96,6 +97,7 @@ interface Window : EventTarget {
Window includes AnimationFrameProvider;
Window includes GlobalEventHandlers;
Window includes WindowEventHandlers;
Window includes WindowLocalStorage;
Window includes WindowOrWorkerGlobalScope;
enum ScrollBehavior { "auto", "instant", "smooth" };

View file

@ -0,0 +1,6 @@
#import <HTML/Storage.idl>
// https://html.spec.whatwg.org/multipage/webstorage.html#windowlocalstorage
interface mixin WindowLocalStorage {
readonly attribute Storage localStorage;
};