mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00: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
Notes:
github-actions[bot]
2024-11-13 14:00:10 +00:00
Author: https://github.com/trflynn89 Commit: https://github.com/LadybirdBrowser/ladybird/commit/3e5476c9e09 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2313 Reviewed-by: https://github.com/gmta ✅
1 changed files with 2 additions and 1 deletions
|
@ -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 a new issue