-
Notifications
You must be signed in to change notification settings - Fork 53
Add an autofill module #706
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
5ad2e27
9551190
9276eb6
6ee27a8
acb45d8
87f2b1f
f835a9d
ec03ec6
65699ab
da1efbf
4083e28
3fd3098
ec3b30b
2b63c0e
7737ae2
caaf014
e80f307
f33441e
caeff54
09495e9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -84,6 +84,7 @@ spec: WEBDRIVER; urlPrefix: https://w3c.github.io/webdriver/ | |||||||||||||||||||||
text: input cancel list; url: dfn-input-cancel-list | ||||||||||||||||||||||
text: intermediary node; url: dfn-intermediary-nodes | ||||||||||||||||||||||
text: invalid argument; url: dfn-invalid-argument | ||||||||||||||||||||||
text: invalid element state; url: dfn-invalid-element-state | ||||||||||||||||||||||
text: invalid selector; url: dfn-invalid-selector | ||||||||||||||||||||||
text: invalid session id; url: dfn-invalid-session-id | ||||||||||||||||||||||
text: is element origin; url: dfn-is-element-origin | ||||||||||||||||||||||
|
@@ -191,9 +192,12 @@ spec: HTML; urlPrefix: https://html.spec.whatwg.org/multipage/ | |||||||||||||||||||||
text: activation notification; url: interaction.html#activation-notification | ||||||||||||||||||||||
text: active window; url: document-sequences.html#nav-window | ||||||||||||||||||||||
text: alert; url: timers-and-user-prompts.html#dom-alert | ||||||||||||||||||||||
text: autofill; url: form-control-infrastructure.html#autofill | ||||||||||||||||||||||
text: autofill detail tokens; url: form-control-infrastructure.html#autofill-detail-tokens | ||||||||||||||||||||||
text: close; url: document-sequences.html#close-a-top-level-traversable | ||||||||||||||||||||||
text: disabled; url: form-control-infrastructure.html#concept-fe-disabled | ||||||||||||||||||||||
text: File Upload state; url: input.html#file-upload-state-(type=file) | ||||||||||||||||||||||
text: form-associated element; url: forms.html#form-associated-element | ||||||||||||||||||||||
text: confirm; url: timers-and-user-prompts.html#dom-confirm | ||||||||||||||||||||||
text: context mode; url: /canvas.html#offscreencanvas-context-mode | ||||||||||||||||||||||
text: create a classic script; url: webappapis.html#creating-a-classic-script | ||||||||||||||||||||||
|
@@ -299,6 +303,9 @@ spec: RFC9110; urlPrefix: https://httpwg.org/specs/rfc9110.html | |||||||||||||||||||||
type: dfn | ||||||||||||||||||||||
text: field-name token; url: #fields.names | ||||||||||||||||||||||
text: method token; url: #method.overview | ||||||||||||||||||||||
spec:infra; urlPrefix: https://infra.spec.whatwg.org/ | ||||||||||||||||||||||
type:dfn; | ||||||||||||||||||||||
text:user agent | ||||||||||||||||||||||
</pre> | ||||||||||||||||||||||
|
||||||||||||||||||||||
<pre class="biblio"> | ||||||||||||||||||||||
|
@@ -436,7 +443,8 @@ CommandData = ( | |||||||||||||||||||||
ScriptCommand // | ||||||||||||||||||||||
SessionCommand // | ||||||||||||||||||||||
StorageCommand // | ||||||||||||||||||||||
WebExtensionCommand | ||||||||||||||||||||||
WebExtensionCommand // | ||||||||||||||||||||||
AutofillCommand | ||||||||||||||||||||||
) | ||||||||||||||||||||||
|
||||||||||||||||||||||
EmptyParams = { | ||||||||||||||||||||||
|
@@ -662,6 +670,7 @@ with the following additional codes: | |||||||||||||||||||||
<pre class="cddl local-cddl"> | ||||||||||||||||||||||
ErrorCode = "invalid argument" / | ||||||||||||||||||||||
"invalid selector" / | ||||||||||||||||||||||
"invalid element state" / | ||||||||||||||||||||||
"invalid session id" / | ||||||||||||||||||||||
"invalid web extension" / | ||||||||||||||||||||||
"move target out of bounds" / | ||||||||||||||||||||||
|
@@ -11984,6 +11993,118 @@ The [=remote end steps=] given |session| and |command parameters| are: | |||||||||||||||||||||
|
||||||||||||||||||||||
</div> | ||||||||||||||||||||||
|
||||||||||||||||||||||
## The autofill Module ## {#module-autofill} | ||||||||||||||||||||||
|
||||||||||||||||||||||
The <dfn export for=modules>autofill module</dfn> contains functionality for triggering autofill. | ||||||||||||||||||||||
|
||||||||||||||||||||||
### Definition ### {#module-autofill-definition} | ||||||||||||||||||||||
|
||||||||||||||||||||||
[=remote end definition=] | ||||||||||||||||||||||
|
||||||||||||||||||||||
<pre class="cddl remote-cddl"> | ||||||||||||||||||||||
|
||||||||||||||||||||||
AutofillCommand = ( | ||||||||||||||||||||||
autofill.trigger // | ||||||||||||||||||||||
autofill.setAddress | ||||||||||||||||||||||
) | ||||||||||||||||||||||
</pre> | ||||||||||||||||||||||
|
||||||||||||||||||||||
### Commands ### {#module-autofill-commands} | ||||||||||||||||||||||
|
||||||||||||||||||||||
#### The autofill.trigger Command #### {#command-autofill-trigger} | ||||||||||||||||||||||
|
||||||||||||||||||||||
The <dfn export for=commands>autofill.trigger</dfn> command triggers autofill | ||||||||||||||||||||||
on a particular form field using the provided fields. | ||||||||||||||||||||||
|
||||||||||||||||||||||
<dl> | ||||||||||||||||||||||
<dt>Command Type</dt> | ||||||||||||||||||||||
<dd> | ||||||||||||||||||||||
<pre class="cddl remote-cddl"> | ||||||||||||||||||||||
autofill.trigger = ( | ||||||||||||||||||||||
method: "autofill.trigger", | ||||||||||||||||||||||
params: autofill.TriggerParameters | ||||||||||||||||||||||
) | ||||||||||||||||||||||
|
||||||||||||||||||||||
autofill.TriggerParameters = { | ||||||||||||||||||||||
context: browsingContext.BrowsingContext, | ||||||||||||||||||||||
element: script.SharedReference, | ||||||||||||||||||||||
field: autofill.Field | ||||||||||||||||||||||
} | ||||||||||||||||||||||
|
||||||||||||||||||||||
autofill.Field = { | ||||||||||||||||||||||
name: autofill.FieldName, | ||||||||||||||||||||||
value: text | ||||||||||||||||||||||
} | ||||||||||||||||||||||
|
||||||||||||||||||||||
autofill.setAddress = ( | ||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe each command should have its own section |
||||||||||||||||||||||
method: "autofill.setAddress", | ||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm a bit confused by this API:
|
||||||||||||||||||||||
params: autofill.AddressParameters | ||||||||||||||||||||||
) | ||||||||||||||||||||||
|
||||||||||||||||||||||
autofill.AddressParameters = { | ||||||||||||||||||||||
context: browsingContext.BrowsingContext, | ||||||||||||||||||||||
fields: [* autofill.Field] | ||||||||||||||||||||||
} | ||||||||||||||||||||||
</pre> | ||||||||||||||||||||||
</dd> | ||||||||||||||||||||||
<dt>Return Type</dt> | ||||||||||||||||||||||
<dd> | ||||||||||||||||||||||
<pre class="cddl"> | ||||||||||||||||||||||
EmptyResult | ||||||||||||||||||||||
</pre> | ||||||||||||||||||||||
</dd> | ||||||||||||||||||||||
</dl> | ||||||||||||||||||||||
|
||||||||||||||||||||||
<div algorithm="remote end steps for autofill.trigger"> | ||||||||||||||||||||||
|
||||||||||||||||||||||
The [=remote end steps=] with |session| and |command parameters| are: | ||||||||||||||||||||||
|
||||||||||||||||||||||
1. Let |navigable id| be the value of the <code>navigable</code> field of | ||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||
|command parameters|. | ||||||||||||||||||||||
|
||||||||||||||||||||||
1. Let |navigable| be the result of [=trying=] to [=get a navigable=] | ||||||||||||||||||||||
with |navigable id|. | ||||||||||||||||||||||
|
||||||||||||||||||||||
1. Let |document| be |navigable|'s [=active document=]. | ||||||||||||||||||||||
|
||||||||||||||||||||||
1. Let |environment settings| be the [=environment settings object=] whose | ||||||||||||||||||||||
[=relevant global object=]'s <a>associated <code>Document</code></a> is | ||||||||||||||||||||||
|document|. | ||||||||||||||||||||||
|
||||||||||||||||||||||
1. Let |realm| be |environment settings|' [=realm execution context=]'s | ||||||||||||||||||||||
Realm component. | ||||||||||||||||||||||
|
||||||||||||||||||||||
1. Let |element id| be the value of the <code>element</code> field of | ||||||||||||||||||||||
|command parameters|. | ||||||||||||||||||||||
|
||||||||||||||||||||||
1. Let |element| be the result of [=trying=] to [=deserialize remote reference=] | ||||||||||||||||||||||
with the |element id|, |realm|, and |session|. | ||||||||||||||||||||||
|
||||||||||||||||||||||
1. Let |field| be the value of the <code>field</code> field of |command | ||||||||||||||||||||||
parameters|. | ||||||||||||||||||||||
|
||||||||||||||||||||||
1. If |element| is not a [=form-associated element=] or |element|'s [=form owner=] is | ||||||||||||||||||||||
yoavweiss marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||
null, return an [=error=] with [=error code=] [=invalid element state=]. | ||||||||||||||||||||||
|
||||||||||||||||||||||
1. If user agent cannot autofill |field|, return an [=error=] with | ||||||||||||||||||||||
[=error code=] [=unsupported operation=]. | ||||||||||||||||||||||
|
||||||||||||||||||||||
1. The user agent should [=autofill=] |element| and |element|'s [=form | ||||||||||||||||||||||
owner=], while taking into account the contents of |field|. | ||||||||||||||||||||||
|
||||||||||||||||||||||
1. Return [=success=] with data null. | ||||||||||||||||||||||
Comment on lines
+12089
to
+12095
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||
|
||||||||||||||||||||||
</div> | ||||||||||||||||||||||
|
||||||||||||||||||||||
#### The autofill.FieldName Type #### {#type-autofill-FieldName} | ||||||||||||||||||||||
|
||||||||||||||||||||||
<pre class="cddl remote-cddl local-cddl"> | ||||||||||||||||||||||
autofill.FieldName = text; | ||||||||||||||||||||||
</pre> | ||||||||||||||||||||||
|
||||||||||||||||||||||
The <code>autofill.FieldName</code> is a token. Valid token values are defined in | ||||||||||||||||||||||
[=autofill detail tokens=]. | ||||||||||||||||||||||
|
||||||||||||||||||||||
### Events ### {#module-input-events} | ||||||||||||||||||||||
|
||||||||||||||||||||||
#### The input.fileDialogOpened Event #### {#event-input-fileDialogOpened} | ||||||||||||||||||||||
|
Uh oh!
There was an error while loading. Please reload this page.