diff options
author | Peter Van der Beken <peterv@propagandism.org> | 2022-02-10 14:14:18 +0000 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2022-05-30 08:26:22 +0000 |
commit | 0fad29313537dc8ee16caf78babeb50e122e0781 (patch) | |
tree | 427316b011f9469c4e9252bd9c1624568173474e /dom/events | |
parent | 612b110946e372452c114d832da8e5b6ec951acc (diff) | |
download | uxp-0fad29313537dc8ee16caf78babeb50e122e0781.tar.gz |
[DOM events] Clear event listener.
Diffstat (limited to 'dom/events')
-rw-r--r-- | dom/events/EventListenerManager.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/dom/events/EventListenerManager.cpp b/dom/events/EventListenerManager.cpp index 4671f89f88..221b464773 100644 --- a/dom/events/EventListenerManager.cpp +++ b/dom/events/EventListenerManager.cpp @@ -751,6 +751,8 @@ EventListenerManager::SetEventHandler(nsIAtom* aName, bool aPermitUntrustedEvents, Element* aElement) { + auto removeEventHandler = MakeScopeExit([&] { RemoveEventHandler(aName, EmptyString()); }); + nsCOMPtr<nsIDocument> doc; nsCOMPtr<nsIScriptGlobalObject> global = GetScriptGlobalAndDocument(getter_AddRefs(doc)); @@ -825,6 +827,8 @@ EventListenerManager::SetEventHandler(nsIAtom* aName, NS_ENSURE_TRUE(context, NS_ERROR_FAILURE); NS_ENSURE_STATE(global->GetGlobalJSObject()); + removeEventHandler.release(); + Listener* listener = SetEventHandlerInternal(aName, EmptyString(), TypedEventHandler(), |