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. :^)

(cherry picked from commit 274411db9756a9dffe44e21b4da09c7808e9f465)
This commit is contained in:
Andreas Kling authored and Nico Weber committed 2024-11-28 21:31:42 -05:00
1 parent a5e6fd3b5f
commit 3fe7d96fa7
3 files changed
+14 -1

No files matched your search

@@ -5637,4 +5637,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);
}
}
+3
View File
@@ -722,6 +722,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;
+1 -1
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 {