diff options
author | athenian200 <athenian200@outlook.com> | 2020-05-21 01:31:48 -0500 |
---|---|---|
committer | athenian200 <athenian200@outlook.com> | 2020-05-21 01:31:48 -0500 |
commit | 0a19762d3bb5f6bcaa00a8f168e469d9fdda76b9 (patch) | |
tree | a718c93bec7faed8e7da1a11c5ecafac43b6d571 /dom/html/nsGenericHTMLElement.cpp | |
parent | a965486fcbf3f199b5c7564bfc0526df72c862d5 (diff) | |
download | uxp-0a19762d3bb5f6bcaa00a8f168e469d9fdda76b9.tar.gz |
Issue #1557 - Allow event dispatch on disabled form controls.
Based on https://bugzilla.mozilla.org/show_bug.cgi?id=329509
This seems to resolve #1356 without causing #1557.
Also reverts previous changes as they no longer appear to serve a purpose.
Diffstat (limited to 'dom/html/nsGenericHTMLElement.cpp')
-rw-r--r-- | dom/html/nsGenericHTMLElement.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/dom/html/nsGenericHTMLElement.cpp b/dom/html/nsGenericHTMLElement.cpp index aa70f9cdfe..17dba6da98 100644 --- a/dom/html/nsGenericHTMLElement.cpp +++ b/dom/html/nsGenericHTMLElement.cpp @@ -2285,10 +2285,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: @@ -2454,8 +2461,9 @@ nsGenericHTMLFormElement::IsLabelable() const void nsGenericHTMLElement::Click() { - if (HandlingClick()) + if (IsDisabled() || HandlingClick()) { return; + } // Strong in case the event kills it nsCOMPtr<nsIDocument> doc = GetComposedDoc(); |