From a3124c55a13fba4877e0eaa7a6b31f17832b6ce1 Mon Sep 17 00:00:00 2001 From: athenian200 Date: Thu, 21 May 2020 01:31:48 -0500 Subject: Issue #1557 - Allow event dispatch on disabled form controls. (uplift) --- dom/html/nsGenericHTMLElement.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'dom/html/nsGenericHTMLElement.cpp') diff --git a/dom/html/nsGenericHTMLElement.cpp b/dom/html/nsGenericHTMLElement.cpp index 2f890325a..1e2f1c186 100644 --- a/dom/html/nsGenericHTMLElement.cpp +++ b/dom/html/nsGenericHTMLElement.cpp @@ -2286,10 +2286,17 @@ nsGenericHTMLFormElement::FormIdUpdated(Element* aOldElement, } bool -nsGenericHTMLFormElement::IsElementDisabledForEvents(EventMessage aMessage, +nsGenericHTMLFormElement::IsElementDisabledForEvents(WidgetEvent* aEvent, nsIFrame* aFrame) { - switch (aMessage) { + MOZ_ASSERT(aEvent); + + // Allow dispatch of CustomEvent and untrusted Events. + if (!aEvent->IsTrusted()) { + return false; + } + + switch (aEvent->mMessage) { case eMouseMove: case eMouseOver: case eMouseOut: @@ -2455,8 +2462,9 @@ nsGenericHTMLFormElement::IsLabelable() const void nsGenericHTMLElement::Click() { - if (HandlingClick()) + if (IsDisabled() || HandlingClick()) { return; + } // Strong in case the event kills it nsCOMPtr doc = GetComposedDoc(); -- cgit v1.2.3