Commit graph

287 commits

Author SHA1 Message Date
Emilio Cobos Álvarez
4cc6758558 Bug 1839922 - Remove usage of {Has,Get}Attr(kNameSpaceID_None, ..). r=edgar
We have more readable and faster versions (that just omit the namespace
arg).

Mostly done via sed, with a couple helpers to use the faster lookups
where possible.

Differential Revision: https://phabricator.services.mozilla.com/D181795
2023-06-23 10:01:32 +00:00
Peter Van der Beken
4ac9139cc3 Bug 1825745 - Fix intermittent failure of testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/replace-before-load/form-requestsubmit.html. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D181792
2023-06-22 18:32:21 +00:00
june wilde
d4e5590f40 Bug 1550743 - Change DoSecureToInsecureSubmitCheck to use IsSecureContext; r=ckerschb
Differential Revision: https://phabricator.services.mozilla.com/D176319
2023-06-06 15:04:41 +00:00
Masayuki Nakano
e16a783838 Bug 1829570 - part 2: Add an overload of AsyncEventDispatcher::RunDOMEventWhenSafe r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D176488
2023-05-15 01:07:29 +00:00
Adam Vandolder
020a417143 Bug 1653625 - Make the submission from default action of a submit button also deferred. r=edgar
The submission from requestSubmit() call is non-deferred due to
mDeferSubmission
being cleared in HTMLFormElement::PostHandleEvent when handling a submit
event. The
mDeferSubmission clearing is also to make the submission from the default
action
of a submit button non-deferred.

This patch makes the submission from default action of a submit button
deferred
which could fix this bug, and also simplify the logic a bit.

Since gecko would also trigger submission for untrusted submit event,
see
bug 1370630, we need to handle that case specially.

Differential Revision: https://phabricator.services.mozilla.com/D170941
2023-05-12 23:11:28 +00:00
Emilio Cobos Álvarez
25b79c7b15 Bug 1829225 - Make BeforeSetAttr take the parsed nsAttrValue. r=smaug
ParseAttribute ideally would be const (see bug 1829138), but the SVG and
SMIL code is rather messy. Still, now that BeforeSetAttr can't really
fail, swapping the order of ParseAttribute and BeforeSetAttr shouldn't
really change behavior.

Sorry for the extra `virtual` keyword removal and such. I had to do this
one by hand unlike the dependent bugs, and I went a bit drive-by, lmk if
you want me to split those changes.

Differential Revision: https://phabricator.services.mozilla.com/D176086
2023-04-21 09:25:17 +00:00
Emilio Cobos Álvarez
ee4c38a50c Bug 1829189 - Make BeforeSetAttr infallible. r=smaug
rg BeforeSetAttr -l | xargs sed -i 's/nsresult BeforeSetAttr/void BeforeSetAttr/g'
  rg ::BeforeSetAttr -l | xargs sed -i 's/nsresult \(.*\)::BeforeSetAttr/void \1::BeforeSetAttr/g'

Plus trivial fixes, plus clang-format.

The only meaningful changes are in nsXULElement::BeforeSetAttr. Two
things could fail:

chromemargin: I removed it because we don't use the parsed attribute any
other place than here:

  https://searchfox.org/mozilla-central/rev/31f5847a4494b3646edabbdd7ea39cb88509afe2/dom/xul/ChromeObserver.cpp#136

And that deals just fine with it not being parsed.

usercontextid: We have a debug assertion that we don't dynamically change it.
I kept it but I don't think it's worth failing to set the attribute on release for that

Differential Revision: https://phabricator.services.mozilla.com/D176069
2023-04-21 08:56:27 +00:00
Jon Jensen
159a19ad5c Bug 1812696 - Implement FormData constructor submitter parameter r=webidl,smaug
Also improve error messages for current submitter validations

Spec PR: https://github.com/whatwg/xhr/pull/366
WPT PR: https://github.com/web-platform-tests/wpt/pull/37895

Differential Revision: https://phabricator.services.mozilla.com/D167576
2023-02-02 12:26:50 +00:00
Adam Vandolder
1267f7d14f Bug 1509346 - Add support for <form rel>. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D166489
2023-01-18 16:41:04 +00:00
Butkovits Atila
a7d3e99d52 Backed out changeset 704407d7ca31 (bug 1509346) for causing wpt failures at put-forwards.html. 2023-01-17 20:04:52 +02:00
Adam Vandolder
629f0f42e1 Bug 1509346 - Add support for <form rel>. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D166489
2023-01-17 16:11:06 +00:00
Sandor Molnar
06e631d4a6 Backed out changeset 5ad22146a015 (bug 1509346) for causing failures in docshell/base/nsDocShell.cpp 2023-01-17 03:16:20 +02:00
Adam Vandolder
b2b544c7ed Bug 1509346 - Add support for <form rel>. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D166489
2023-01-16 21:32:19 +00:00
Mark Banner
9594c03938 Bug 1808115 - Remove the separate EmbedPrompter wrapper, use Prompter instead. r=Gijs,necko-reviewers,geckoview-reviewers,valentin,m_kato
We no longer support the legacy add-ons, so this should not be necessary.

Differential Revision: https://phabricator.services.mozilla.com/D165764
2023-01-03 17:19:48 +00:00
Edgar Chen
e054662a5a Bug 1793075 - Part 2: Do not clear pending submission in HTMLFormElement.submit(); r=smaug
So if the submit call doesn't trigger a submission, it won't clear the existing
pending submission.

Now we allow to override the unflushed pending submission, and add some assertion to
ensure form won't submit a submission if it is in defer state or there is an
unflushed pending submission.

Differential Revision: https://phabricator.services.mozilla.com/D121765
2022-10-05 12:24:28 +00:00
Emilio Cobos Álvarez
255763ef57 Bug 1773070 - Unify Gecko and Servo EventState/ElementState bits. r=smaug
Add a dom/base/rust crate called just "dom" where we can share these.

Most of the changes are automatic:

  s/mozilla::EventStates/mozilla::dom::ElementState/
  s/EventStates/ElementState/
  s/NS_EVENT_STATE_/ElementState::/
  s/NS_DOCUMENT_STATE_/DocumentState::/

And so on. This requires a new cbindgen version to avoid ugly casts for
large shifts.

Differential Revision: https://phabricator.services.mozilla.com/D148537
2022-06-07 23:09:52 +00:00
Jan Varga
3127935527 Bug 1757575 - Fix non-unified-build bustage in dom/html/HTMLFormElement.cpp; r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D139947
2022-03-01 17:39:18 +00:00
Kagami Sascha Rosylight
d4de9cf54d Bug 1743439 - Part 5: Mark callers in dom/events and dom/html as MOZ_CAN_RUN_SCRIPT_BOUNDARY r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D133364
2021-12-09 19:56:09 +00:00
Alexandru Michis
8941bcbb1e Backed out 6 changesets (bug 1743439) for causing bustages in AnimationEventDispatcher.h
CLOSED TREE

Backed out changeset 792c405d4afc (bug 1743439)
Backed out changeset 0376e73c7dce (bug 1743439)
Backed out changeset 23202094bc00 (bug 1743439)
Backed out changeset ba0fa3a8fa0e (bug 1743439)
Backed out changeset 7ad2746ec876 (bug 1743439)
Backed out changeset a919ef50cf33 (bug 1743439)
2021-12-09 19:36:12 +02:00
Kagami Sascha Rosylight
b2f44fade5 Bug 1743439 - Part 5: Mark callers in dom/events and dom/html as MOZ_CAN_RUN_SCRIPT_BOUNDARY r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D133364
2021-12-09 17:16:50 +00:00
Edgar Chen
be408c368a Bug 1742714 - Get rid of nsIFormSubmitObserver; r=geckoview-reviewers,agi,smaug
Differential Revision: https://phabricator.services.mozilla.com/D132091
2021-12-06 12:23:08 +00:00
Edgar Chen
0b76ecfebd Bug 1556367 - Part 2: Factor dispatching invalid event code into a common place; r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D130274
2021-12-03 15:47:34 +00:00
Emilio Cobos Álvarez
a5f66c95e1 Bug 1740230 - Remove some prefs for pseudo-classes that we have shipped/unshipped successfully. r=dholbert
And remove code for :-moz-submit-invalid completely.

Differential Revision: https://phabricator.services.mozilla.com/D130737
2021-11-10 13:27:47 +00:00
Edgar Chen
36107cfddf Bug 1556363 - Part 1: Check disabled state for submission in a common place; r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D129048
2021-10-25 20:43:10 +00:00
Edgar Chen
495e0b741d Bug 1556351 - Part 5: Make nsGenericHTMLFormControlElement implement nsIFormControl; r=smaug
nsGenericHTMLFormElement doesn't implement nsIFormControl now as HTMLElement would
inherit it to be able to be added into HTMLFormElement and HTMLFieldSetElement and
support some common form feature.

So some places that call the nsIFormControl method on nsGenericHTMLFormElement
directly would need to queryInterface it to nsIFormControl first, this should be
fine as those places are not in a hot path.

Differential Revision: https://phabricator.services.mozilla.com/D124788
2021-10-04 20:51:27 +00:00
Edgar Chen
71a718fbc8 Bug 1729008 - Part 2: Make HTMLFormElement::IsLastActiveElement take nsGenericHTMLFormElement as argument; r=smaug
Depends on D124459

Differential Revision: https://phabricator.services.mozilla.com/D124462
2021-09-03 17:21:44 +00:00
Edgar Chen
862d12eb53 Bug 1729008 - Part 1: Make HTMLFormElement::IsDefaultSubmitElement take nsGenericHTMLFormElement as argument; r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D124459
2021-09-03 17:21:44 +00:00
Edgar Chen
262f7ec893 Bug 1728081 - Part 4: Make HTMLFormElement::GetDefaultSubmitElement return nsGenericHTMLFormElement; r=smaug
so that the callers don't need to queryInterface it back to nsIContent.

Differential Revision: https://phabricator.services.mozilla.com/D123952
2021-08-30 18:44:51 +00:00
Edgar Chen
bae585f79e Bug 1728081 - Part 3: Merge nsIForm into HTMLFormElement; r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D123951
2021-08-30 18:44:51 +00:00
Edgar Chen
09f6c7e2de Bug 1728081 - Part 2: Remove nsIForm::GetElementAt; r=smaug
as it is only used internally.

Depends on D123949

Differential Revision: https://phabricator.services.mozilla.com/D123950
2021-08-30 18:44:51 +00:00
Edgar Chen
bb4c23a6e6 Bug 1728081 - Part 1: Remove nsIForm::GetElementCount; r=smaug
as it is only used internally.

Differential Revision: https://phabricator.services.mozilla.com/D123949
2021-08-30 18:44:50 +00:00
Andi-Bogdan Postelnicu
250fa0d795 Bug 1725145 - header files fixes in the hybrid build env. r=valentin
Differential Revision: https://phabricator.services.mozilla.com/D122343
2021-08-22 10:21:55 +00:00
Edgar Chen
3d5334b444 Bug 1726393 - Part 2: Rename nsIFormControl::GetFormElement to GetForm; r=smaug
Depends on D122995

Differential Revision: https://phabricator.services.mozilla.com/D122996
2021-08-19 09:20:24 +00:00
Edgar Chen
2482297bf5 Bug 1720314 - Part 1: Remove HTMLFormElement::mSubmittingRequest; r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D119776
2021-07-13 16:32:51 +00:00
Edgar Chen
3a387e8175 Bug 1719872 - Dialog submission triggered by form.submit() in click handler of submit button should not be deferred; r=smaug
Per https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#submit-dialog,
dialog submission won't run https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#planned-navigation
and the steps are synchronous.

Differential Revision: https://phabricator.services.mozilla.com/D119667
2021-07-12 19:39:25 +00:00
Masayuki Nakano
63d372da2f Bug 1676702 - part 2: Make TextControlState initialize TextEditor with PasswordMaskData r=m_kato
During a `TextControlState` alive, `PasswordMaskData` should be alive too.
Otherwise, we cannot keep unmasked range at reframing.

Depends on D118756

Differential Revision: https://phabricator.services.mozilla.com/D118757
2021-06-28 04:37:54 +00:00
Dimi Lee
32e7bc465a Bug 1708455 - P10. Add signon.usernameOnlyForm.enabled preference r=sfoster,tgiles
Differential Revision: https://phabricator.services.mozilla.com/D116238
2021-06-11 11:56:05 +00:00
Dimi Lee
a8a701a4a6 Bug 1708455 - P4. Add DOMFormHasPossibleUsernameField event to notify the password manager when a form has a text input or an email input. r=sfoster,tgiles,smaug
Right now, we limit the type of a username field in username-only forms to be either text or email.
This is different from what the password manager currently support in LoginHelper.isUsernameFieldType.
This is because text and email type are the most common cases for a username field, and we want to focus
on the cases that are more likely a username field.

This patch adds "DOMFormHasPossibleUsername" event to notify the password manager when a form has a possible
username field (text or email). The event works similar to the existing "DOMFormHasPassword" event.

Depends on D113797

Differential Revision: https://phabricator.services.mozilla.com/D113798
2021-06-11 11:56:03 +00:00
Emilio Cobos Álvarez
2b0eae6061 Bug 1715134 - Make form control type an enum class. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D117087
2021-06-08 09:43:59 +00:00
Kagami Sascha Rosylight
4d0c7b86de Bug 1708228 - Part 2: Remove redundant flush param from nsIRadioGroupContainer r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D113806
2021-04-30 11:25:23 +00:00
Kagami Sascha Rosylight
ca32f5ec18 Bug 1708228 - Part 1: Remove redundant flushing from HTMLFormControlsCollection r=smaug
This was done in bug 324828 to workaround bug 22480 but shouldn't be needed anymore.

Differential Revision: https://phabricator.services.mozilla.com/D113805
2021-04-30 11:25:22 +00:00
Kagami Sascha Rosylight
bebdcea92b Bug 1707126 - Part 2: Use RadioGroupManager in HTMLFormElement r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D113578
2021-04-28 16:01:35 +00:00
Emilio Cobos Álvarez
168b2347b3 Bug 1700871 - Only allow focus move for links / form submission iff actually handling user input. r=smaug
The other navigation that allows focus moves (window.open) already goes
through the popup blocker, so that one is fine.

I think given how weird yet conservative other browsers are, this should
be a good trade-off to avoid false positives.

Differential Revision: https://phabricator.services.mozilla.com/D110196
2021-03-31 01:51:46 +00:00
Dimi Lee
f39a177e9a Bug 1166995 - P2. Call onFormSubmit when a form or a password field is removed from the DOM tree r=sfoster,tgiles,smaug
This patch adds two events - `DOMFormRemoved` and `DOMInputPasswordRemoved`.
These events are notified when a form/password field is removed from
the DOM tree. When the LoginManagerChild receives the event, it calls
_onFormSubmit as the form is submitted.

This patch also adds a WeakFieldSet formlessModifiedPasswordFields to
record all the form-less password fields that users have interacted
with to track whether a formless password is removed

Depends on D106024

Differential Revision: https://phabricator.services.mozilla.com/D106025
2021-03-16 09:15:19 +00:00
Simon Giesecke
2586ff14b9 Bug 1693541 - Improve uses of nsBaseHashtable and descendants and avoid multiple subsequent lookups in dom/html. r=mattwoodrow
Differential Revision: https://phabricator.services.mozilla.com/D106112
2021-03-01 09:59:29 +00:00
Simon Giesecke
b399a8194c Bug 1691913 - Add some convenience methods to LookupResult and EntryHandle. r=xpcom-reviewers,nika
Differential Revision: https://phabricator.services.mozilla.com/D105475
2021-03-01 09:59:29 +00:00
Simon Giesecke
9af107a839 Bug 1691913 - Rename nsBaseHashtable::Put to InsertOrUpdate. r=xpcom-reviewers,necko-reviewers,jgilbert,dragana,nika
This makes the naming more consistent with other functions called
Insert and/or Update. Also, it removes the ambiguity whether
Put expects that an entry already exists or not, in particular because
it differed from nsTHashtable::PutEntry in that regard.

Differential Revision: https://phabricator.services.mozilla.com/D105473
2021-02-26 09:11:46 +00:00
Simon Giesecke
4f75368dcb Bug 1691913 - Rename nsBaseHashtable::GetOrInsert(With) to LookupOrInsert(With). r=xpcom-reviewers,necko-reviewers,jgilbert,dragana,nika
The functions should be called "Lookup" rather than "Get" because they return
a DataType& (rather than UserDataType).

Differential Revision: https://phabricator.services.mozilla.com/D105472
2021-02-26 09:11:45 +00:00
Emilio Cobos Álvarez
b0bc0f75a5 Bug 1693969 - Remove <form novalidate> handling from :-moz-ui-{valid,invalid} pseudo-classes. r=smaug
There's no way to know whether the submission will actually be
validated, because formnovalidate on submit buttons is a thing (and even
if all the submit controls had formnovalidate, you could still submit
the form and validate it via form.submit()), so it seems better to make
these pseudo-classes not depend on this.

Differential Revision: https://phabricator.services.mozilla.com/D105968
2021-02-23 11:26:17 +00:00
Simon Giesecke
d2caea36fa Bug 1691894 - Simplify uses of WithEntryHandle that only use OrInsert(With) by using GetOrInsertWith. r=xpcom-reviewers,necko-reviewers,jgilbert,nika
Differential Revision: https://phabricator.services.mozilla.com/D104676
2021-02-22 12:07:46 +00:00