mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
Bug 1739957 - Clear event listener. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D134713
This commit is contained in:
parent
22c350103d
commit
789bd2360a
@ -1007,6 +1007,8 @@ nsresult EventListenerManager::SetEventHandler(nsAtom* aName,
|
||||
bool aDeferCompilation,
|
||||
bool aPermitUntrustedEvents,
|
||||
Element* aElement) {
|
||||
auto removeEventHandler = MakeScopeExit([&] { RemoveEventHandler(aName); });
|
||||
|
||||
nsCOMPtr<Document> doc;
|
||||
nsCOMPtr<nsIScriptGlobalObject> global =
|
||||
GetScriptGlobalAndDocument(getter_AddRefs(doc));
|
||||
@ -1066,6 +1068,8 @@ nsresult EventListenerManager::SetEventHandler(nsAtom* aName,
|
||||
NS_ENSURE_TRUE(context, NS_ERROR_FAILURE);
|
||||
NS_ENSURE_STATE(global->HasJSGlobal());
|
||||
|
||||
removeEventHandler.release();
|
||||
|
||||
Listener* listener = SetEventHandlerInternal(aName, TypedEventHandler(),
|
||||
aPermitUntrustedEvents);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user