Commit graph

273 commits

Author SHA1 Message Date
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
Alexis Beingessner
07f2f659c6 Bug 1686616 - make StringBundle use Components instead of Services. r=kmag
Differential Revision: https://phabricator.services.mozilla.com/D105531
2021-02-18 13:26:32 +00:00
Simon Giesecke
661e25bf09 Bug 1692880 - Make Put accept DataType instead of wrapping UserDataType. r=xpcom-reviewers,necko-reviewers,nika
Differential Revision: https://phabricator.services.mozilla.com/D104850
2021-02-16 15:53:33 +00:00
smolnar
1afbbe67e1 Backed out 5 changesets (bug 1691894) for causing hazard failures in nsXULPrototypeCache. CLOSED TREE
Backed out changeset 22dc870ee609 (bug 1691894)
Backed out changeset 58c31e9d6ae3 (bug 1691894)
Backed out changeset 7483e84149d8 (bug 1691894)
Backed out changeset f977d6cfa973 (bug 1691894)
Backed out changeset db4503476f34 (bug 1691894)
2021-02-15 16:43:23 +02:00
Simon Giesecke
3c29a68440 Bug 1691894 - Make Put accept DataType instead of wrapping UserDataType. r=xpcom-reviewers,necko-reviewers,nika
Differential Revision: https://phabricator.services.mozilla.com/D104850
2021-02-15 10:04:46 +00:00
Simon Giesecke
91f2fa3021 Bug 1688833 - Migrate LookupForAdd to WithEntryHandle in dom/html. r=mattwoodrow
Differential Revision: https://phabricator.services.mozilla.com/D104226
2021-02-09 18:19:43 +00:00
Edgar Chen
845a098958 Bug 1691357 - Add UserCounter and deprecate warnning message for form submission via untrusted submit event; r=smaug,flod
Differential Revision: https://phabricator.services.mozilla.com/D104070
2021-02-09 00:35:23 +00:00
Edgar Chen
448e1644a0 Bug 1690897 - Get rid of dom.formdata.event.enabled pref; r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D104103
2021-02-05 13:51:33 +00:00
Stone Shih
c8284bad50 Bug 1370630 - Untrusted submit event shouldn't trigger form submission; r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D28070
2021-02-04 19:38:47 +00:00
Simon Giesecke
971b645fe3 Bug 1660470 - Add missing include directives/forward declarations. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D87865
2020-11-23 16:21:38 +00:00
Sylvestre Ledru
fde06f6d21 Bug 1674637 - Use nested namespaces in dom/ r=sg,andi
Also add some missing namespace qualifications

Done with:
./mach static-analysis check --checks="-*,modernize-concat-nested-namespaces" --fix dom/
./mach clang-format -p $(hg status dom/|grep ^M|awk '{print $2}')

Differential Revision: https://phabricator.services.mozilla.com/D95456
2020-11-04 17:04:01 +00:00
Butkovits Atila
964cca3198 Backed out changeset c0adbf7522dc (bug 1674637) for bustage on GMPParent.cpp. CLOSED TREE 2020-11-04 10:54:36 +02:00
Sylvestre Ledru
5f29324f60 Bug 1674637 - Use nested namespaces in dom/ r=sg,andi
Also add some missing namespace qualifications

Done with:
./mach static-analysis check --checks="-*,modernize-concat-nested-namespaces" --fix dom/
./mach clang-format -p $(hg status dom/|grep ^M|awk '{print $2}')

Differential Revision: https://phabricator.services.mozilla.com/D95456
2020-11-04 08:29:00 +00:00
Simon Giesecke
de7bab0f06 Bug 1650145 - Replace all value uses of Empty[C]String by 0-length _ns literals. r=froydnj,geckoview-reviewers,agi
Differential Revision: https://phabricator.services.mozilla.com/D82325
2020-09-23 15:17:15 +00:00
Frederik Braun
88ca83241c Bug 1661423 - dont apply upgrade-insecure-requests to localhost form submissions r=ckerschb
Differential Revision: https://phabricator.services.mozilla.com/D88577
2020-08-31 10:11:37 +00:00