mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
LibWeb/HTML: Port Window.sessionStorage to IDL
This commit is contained in:
parent
37e9302dd9
commit
a31c561a5a
Notes:
sideshowbarker
2024-07-17 03:05:16 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/a31c561a5a Pull-request: https://github.com/SerenityOS/serenity/pull/17752 Reviewed-by: https://github.com/awesomekling
4 changed files with 8 additions and 10 deletions
|
@ -897,8 +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, "sessionStorage", session_storage_getter, {}, attr);
|
||||
|
||||
// FIXME: Implement codegen for readonly properties with [PutForwards]
|
||||
auto& location_accessor = storage_get("location")->value.as_accessor();
|
||||
location_accessor.set_setter(JS::NativeFunction::create(realm, location_setter, 1, "location", &realm, {}, "set"sv));
|
||||
|
@ -1618,10 +1616,4 @@ JS_DEFINE_NATIVE_FUNCTION(Window::structured_clone)
|
|||
}));
|
||||
}
|
||||
|
||||
JS_DEFINE_NATIVE_FUNCTION(Window::session_storage_getter)
|
||||
{
|
||||
auto* impl = TRY(impl_from(vm));
|
||||
return impl->session_storage();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -253,8 +253,6 @@ private:
|
|||
|
||||
JS_DECLARE_NATIVE_FUNCTION(structured_clone);
|
||||
|
||||
JS_DECLARE_NATIVE_FUNCTION(session_storage_getter);
|
||||
|
||||
JS_DECLARE_NATIVE_FUNCTION(set_interval);
|
||||
JS_DECLARE_NATIVE_FUNCTION(set_timeout);
|
||||
JS_DECLARE_NATIVE_FUNCTION(clear_interval);
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#import <HTML/Navigator.idl>
|
||||
#import <HTML/WindowLocalStorage.idl>
|
||||
#import <HTML/WindowOrWorkerGlobalScope.idl>
|
||||
#import <HTML/WindowSessionStorage.idl>
|
||||
#import <RequestIdleCallback/IdleRequest.idl>
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#window
|
||||
|
@ -98,6 +99,7 @@ Window includes AnimationFrameProvider;
|
|||
Window includes GlobalEventHandlers;
|
||||
Window includes WindowEventHandlers;
|
||||
Window includes WindowLocalStorage;
|
||||
Window includes WindowSessionStorage;
|
||||
Window includes WindowOrWorkerGlobalScope;
|
||||
|
||||
enum ScrollBehavior { "auto", "instant", "smooth" };
|
||||
|
|
6
Userland/Libraries/LibWeb/HTML/WindowSessionStorage.idl
Normal file
6
Userland/Libraries/LibWeb/HTML/WindowSessionStorage.idl
Normal file
|
@ -0,0 +1,6 @@
|
|||
#import <HTML/Storage.idl>
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/webstorage.html#windowsessionstorage
|
||||
interface mixin WindowSessionStorage {
|
||||
readonly attribute Storage sessionStorage;
|
||||
};
|
Loading…
Reference in a new issue