LibWeb: Support Document.onvisibilitychange

We don't have a way to trigger this from a test, but the fix is so
simple that we might as well get it in. :^)
This commit is contained in:
Andreas Kling 2024-10-08 16:27:40 +02:00 committed by Andreas Kling
parent 26be8f865a
commit 274411db97
Notes: github-actions[bot] 2024-10-08 16:50:04 +00:00
3 changed files with 14 additions and 1 deletions

View file

@ -5676,4 +5676,14 @@ void Document::set_onreadystatechange(WebIDL::CallbackType* value)
set_event_handler_attribute(HTML::EventNames::readystatechange, value);
}
WebIDL::CallbackType* Document::onvisibilitychange()
{
return event_handler_attribute(HTML::EventNames::visibilitychange);
}
void Document::set_onvisibilitychange(WebIDL::CallbackType* value)
{
set_event_handler_attribute(HTML::EventNames::visibilitychange, value);
}
}

View file

@ -734,6 +734,9 @@ public:
[[nodiscard]] WebIDL::CallbackType* onreadystatechange();
void set_onreadystatechange(WebIDL::CallbackType*);
[[nodiscard]] WebIDL::CallbackType* onvisibilitychange();
void set_onvisibilitychange(WebIDL::CallbackType*);
protected:
virtual void initialize(JS::Realm&) override;
virtual void visit_edges(Cell::Visitor&) override;

View file

@ -152,7 +152,7 @@ interface Document : Node {
// special event handler IDL attributes that only apply to Document objects
[LegacyLenientThis] attribute EventHandler onreadystatechange;
[FIXME] attribute EventHandler onvisibilitychange;
attribute EventHandler onvisibilitychange;
};
dictionary ElementCreationOptions {