diff --git a/index.bs b/index.bs index 91f93bab..bfb9eaac 100644 --- a/index.bs +++ b/index.bs @@ -91,6 +91,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 @@ -215,9 +216,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 @@ -263,6 +267,7 @@ spec: HTML; urlPrefix: https://html.spec.whatwg.org/multipage/ spec: INFRA; urlPrefix: https://infra.spec.whatwg.org/ type: dfn text: convert a JSON-derived JavaScript value to an Infra value; url: convert-a-json-derived-javascript-value-to-an-infra-value + text: values spec: RESOURCE-TIMING; urlPrefix: https://w3c.github.io/resource-timing/ type: dfn text: convert fetch timestamp; url: dfn-convert-fetch-timestamp @@ -455,7 +460,8 @@ CommandData = ( ScriptCommand // SessionCommand // StorageCommand // - WebExtensionCommand + WebExtensionCommand // + AutofillCommand ) EmptyParams = { @@ -691,6 +697,7 @@ with the following additional codes:
 ErrorCode = "invalid argument" /
             "invalid selector" /
+            "invalid element state" /
             "invalid session id" /
             "invalid web extension" /
             "move target out of bounds" /
@@ -13616,6 +13623,189 @@ The [=remote end steps=] given |session| and |command parameters| are:
 
 
 
+## The autofill Module ## {#module-autofill}
+
+The autofill module contains functionality for triggering autofill.
+
+### Definition ### {#module-autofill-definition}
+
+{^remote end definition^}
+
+
+
+AutofillCommand = (
+  autofill.Trigger
+)
+
+ +### Commands ### {#module-autofill-commands} + +#### The autofill.trigger Command #### {#command-autofill-trigger} + +The autofill.trigger command triggers autofill +on a particular form field using the provided fields. + +
+
Command Type
+
+
+      autofill.Trigger = (
+        method: "autofill.trigger",
+        params: autofill.TriggerParameters
+      )
+
+      autofill.TriggerParameters = {
+        context: browsingContext.BrowsingContext,
+        element: script.SharedReference,
+        ? card: autofill.Card,
+        ? address: autofill.Address
+      }
+
+      autofill.Field = {
+        name: autofill.FieldName,
+        value: text
+      }
+
+      autofill.Card = {
+        number: text,
+        name: text,
+        expiryMonth: text,
+        expiryYear: text,
+        cvc: text
+      }
+
+      autofill.Address = {
+        fields: [* autofill.Field]
+      }
+
+    
+
+
Return Type
+
+ + EmptyResult + +
+
+ +
+ +The [=remote end steps=] with |session| and |command parameters| are: + +1. Let |navigable id| be the value of the context field of + |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 associated Document is + |document|. + +1. Let |realm| be |environment settings|' [=realm execution context=]'s + Realm component. + +1. Let |element id| be the value of the element field of + |command parameters|. + +1. Let |element| be the result of [=trying=] to [=deserialize remote reference=] + with the |element id|, |realm|, and |session|. + +1. If |element| is not a [=form-associated element=] or |element|'s [=form owner=] is + null, return an [=error=] with [=error code=] [=invalid element state=]. + +1. Let |card| be the value of the card field of |command parameters| if present, or null otherwise. + +1. Let |address| be the value of the address field of |command parameters| if present, or null otherwise. + +1. If, for any reason, the remote end is unable to [=autofill=], return error with + [=error code=] [=unsupported operation=]. + +1. If both |card| and |address| are not null, return error with [=error code=] + [=invalid argument=]. + +1. If both |card| and |address| are null, return error with [=error code=] + [=invalid argument=]. + +1. Let |parsed card| be the result of parsing |card| as an autofill.Card. + +1. Let |parsed address| be the result of parsing |card| as an autofill.Address. + +1. The [=/user agent=] should [=autofill=] |element| and |element|'s [=form + owner=], while taking into account the contents of |parsed card| and |parsed address|. + +1. Return [=success=] with data null. + +
+ +#### The autofill.FieldName Type #### {#type-autofill-FieldName} + +
+AutofillToken = "name" /
+                "honorific-prefix" /
+                "given-name" /
+                "additional-name" /
+                "family-name" /
+                "honorific-suffix" /
+                "nickname" /
+                "username" /
+                "new-password" /
+                "current-password" /
+                "one-time-code" /
+                "organization-title" /
+                "organization" /
+                "street-address" /
+                "address-line1" /
+                "address-line2" /
+                "address-line3" /
+                "address-level4" /
+                "address-level3" /
+                "address-level2" /
+                "address-level1" /
+                "country" /
+                "country-name" /
+                "postal-code" /
+                "cc-name" /
+                "cc-given-name" /
+                "cc-additional-name" /
+                "cc-family-name" /
+                "cc-number" /
+                "cc-exp" /
+                "cc-exp-month" /
+                "cc-exp-year" /
+                "cc-csc" /
+                "cc-type" /
+                "transaction-currency" /
+                "transaction-amount" /
+                "language" /
+                "bday" /
+                "bday-day" /
+                "bday-month" /
+                "bday-year" /
+                "sex" /
+                "url" /
+                "photo" /
+                "tel" /
+                "tel-country-code" /
+                "tel-national" /
+                "tel-area-code" /
+                "tel-local" /
+                "tel-local-prefix" /
+                "tel-local-suffix" /
+                "tel-extension" /
+                "email" /
+                "impp"
+
+ +
+   autofill.FieldName = AutofillToken;
+
+ +The autofill.FieldName is an AutofillToken. Valid token +values are defined in [=autofill detail tokens=]. + ### Events ### {#module-input-events} #### The input.fileDialogOpened Event #### {#event-input-fileDialogOpened}