LibWeb: Fix bogus callback comparisons in EventTarget

When CallbackType::callback was converted from Object& to NNGCP<Object>,
we started comparing the addresses of NNGCPs instead of the addresses of
Objects.

That broke the Discord login form, and this patch fixes it.

Regression from 7c0c1c8f49.
This commit is contained in:
Andreas Kling 2023-03-18 16:37:09 +01:00
parent 7d6bab2256
commit 7f632ee6f8
Notes: sideshowbarker 2024-07-17 05:01:20 +09:00

View File

@ -162,7 +162,7 @@ void EventTarget::add_an_event_listener(DOMEventListener& listener)
// and capture is listeners capture, then append listener to eventTargets event listener list.
auto it = m_event_listener_list.find_if([&](auto& entry) {
return entry->type == listener.type
&& &entry->callback->callback().callback == &listener.callback->callback().callback
&& entry->callback->callback().callback == listener.callback->callback().callback
&& entry->capture == listener.capture;
});
if (it == m_event_listener_list.end())
@ -191,7 +191,7 @@ void EventTarget::remove_event_listener(DeprecatedFlyString const& type, IDLEven
return true;
if (!entry.callback || !callback)
return false;
return &entry.callback->callback().callback == &callback->callback().callback;
return entry.callback->callback().callback == callback->callback().callback;
};
auto it = m_event_listener_list.find_if([&](auto& entry) {
return entry->type == type