Bug 329509 - allow dispatching event when element is disabled. r=annevk,smaug
Allow untrusted Events and Custom events to be dispatched at disabled form element. This is for interop and some developers have asked for this. Differential Revision: https://phabricator.services.mozilla.com/D10000
This commit is contained in:
@@ -2180,10 +2180,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:
|
||||
@@ -2440,8 +2447,9 @@ nsGenericHTMLFormElement::GetFormAction(nsString& aValue)
|
||||
void
|
||||
nsGenericHTMLElement::Click(CallerType aCallerType)
|
||||
{
|
||||
if (HandlingClick())
|
||||
if (IsDisabled() || HandlingClick()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Strong in case the event kills it
|
||||
nsCOMPtr<nsIDocument> doc = GetComposedDoc();
|
||||
|
||||
Reference in New Issue
Block a user