tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 5f98792acd9dcd4c90718fbae42bb3865435376c
parent 5818f3bf33d737ab644709c4f1ff3ae74b22c7ab
Author: Keith Cirkel <keithamus@users.noreply.github.com>
Date:   Mon,  8 Dec 2025 13:23:44 +0000

Bug 2004364 - Return early in input activationbehaviour if form actions are handled r=dom-core,edgar

Currently an `<input type=reset popovertarget=foo>` will reset the form
_in addition_ to invoking the popover. This is not per spec, and we're
currently failing two WPT subtests because of this.

This change introduces an early return (while also making EndSubmitClick
a scope exit call to avoid accidentally missing it in subsequent changes).
This fixes the WPT subtests, ensuring that an
`<input type=reset popovertarget=foo>` will _only_ reset the form, aligning the
behaviour with `<button type=reset>`.

Differential Revision: https://phabricator.services.mozilla.com/D275212

Diffstat:
Mdom/html/HTMLInputElement.cpp | 6+++---
Dtesting/web-platform/meta/html/semantics/popovers/input-type-popovertarget.html.ini | 6------
2 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/dom/html/HTMLInputElement.cpp b/dom/html/HTMLInputElement.cpp @@ -4162,13 +4162,14 @@ void EndSubmitClick(EventChainPostVisitor& aVisitor) { void HTMLInputElement::ActivationBehavior(EventChainPostVisitor& aVisitor) { auto oldType = FormControlType(NS_CONTROL_TYPE(aVisitor.mItemFlags)); + auto endSubmit = MakeScopeExit([&] { EndSubmitClick(aVisitor); }); + if (IsDisabled() && oldType != FormControlType::InputCheckbox && oldType != FormControlType::InputRadio) { // Behave as if defaultPrevented when the element becomes disabled by event // listeners. Checkboxes and radio buttons should still process clicks for // web compat. See: // https://html.spec.whatwg.org/multipage/input.html#the-input-element:activation-behaviour - EndSubmitClick(aVisitor); return; } @@ -4216,6 +4217,7 @@ void HTMLInputElement::ActivationBehavior(EventChainPostVisitor& aVisitor) { form->MaybeSubmit(this); } aVisitor.mEventStatus = nsEventStatus_eConsumeNoDefault; + return; } break; @@ -4227,8 +4229,6 @@ void HTMLInputElement::ActivationBehavior(EventChainPostVisitor& aVisitor) { do_QueryInterface(aVisitor.mEvent->mOriginalTarget); HandlePopoverTargetAction(eventTarget); } - - EndSubmitClick(aVisitor); } void HTMLInputElement::LegacyCanceledActivationBehavior( diff --git a/testing/web-platform/meta/html/semantics/popovers/input-type-popovertarget.html.ini b/testing/web-platform/meta/html/semantics/popovers/input-type-popovertarget.html.ini @@ -1,6 +0,0 @@ -[input-type-popovertarget.html] - [input type=reset in form should trigger form reset and not toggle popover] - expected: FAIL - - [input type=reset with form attr should trigger form reset and not toggle popover] - expected: FAIL