mirror of
https://github.com/zebrajr/ladybird.git
synced 2025-12-06 12:20:00 +01:00
LibWeb: Guard MediaQueryList event listener removal against null
A recently imported WPT test has a subtest that effectively does the
following:
const mql = window.matchMedia("");
mql.removeListener(null);
This commit is contained in:
parent
213155ad7d
commit
3e5476c9e0
|
|
@ -99,6 +99,7 @@ void MediaQueryList::remove_listener(JS::GCPtr<DOM::IDLEventListener> listener)
|
|||
// 1. Remove an event listener from the associated list of event listeners, whose type is change, callback is listener, and capture is false.
|
||||
// NOTE: While the spec doesn't technically use remove_event_listener and instead manipulates the list directly, every major engine uses remove_event_listener.
|
||||
// This means if an event listener removes another event listener that comes after it, the removed event listener will not be invoked.
|
||||
if (listener)
|
||||
remove_event_listener_without_options(HTML::EventNames::change, *listener);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user