1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 19:38:12 +00:00

LibWeb: Use correct dictionary semantics for NavigateEvent

Every property in an IDL dictionary is implied to be optional, unless it
is marked as required. If a dictionary is passed to a method with
optional, but it has at least one required or defaulted member, the
bindings will skip the optionality of the parameter and always pass a
struct with the required parameters filled in.
This commit is contained in:
Andrew Kaster 2023-08-24 16:15:54 -06:00 committed by Andreas Kling
parent d8cfe79a20
commit 268fd93352
2 changed files with 33 additions and 31 deletions

View file

@ -23,7 +23,7 @@ struct NavigateEventInit : public DOM::EventInit {
JS::GCPtr<DOM::AbortSignal> signal;
JS::GCPtr<XHR::FormData> form_data = nullptr;
Optional<String> download_request = {};
JS::Value info;
Optional<JS::Value> info;
bool has_ua_visual_transition = false;
};
@ -33,8 +33,8 @@ using NavigationInterceptHandler = JS::NonnullGCPtr<WebIDL::CallbackType>;
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#navigationinterceptoptions
struct NavigationInterceptOptions {
JS::GCPtr<WebIDL::CallbackType> handler;
Bindings::NavigationFocusReset focus_reset;
Bindings::NavigationScrollBehavior scroll;
Optional<Bindings::NavigationFocusReset> focus_reset;
Optional<Bindings::NavigationScrollBehavior> scroll;
};
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#navigateevent
@ -57,7 +57,7 @@ public:
JS::Value info() const { return m_info; }
bool has_ua_visual_transition() const { return m_has_ua_visual_transition; }
WebIDL::ExceptionOr<void> intercept(Optional<NavigationInterceptOptions> const& = {});
WebIDL::ExceptionOr<void> intercept(NavigationInterceptOptions const&);
WebIDL::ExceptionOr<void> scroll();
virtual ~NavigateEvent() override;