diff --git a/index.bs b/index.bs index 616d147c4..cfd32278d 100644 --- a/index.bs +++ b/index.bs @@ -199,6 +199,7 @@ spec: HTML; urlPrefix: https://html.spec.whatwg.org/multipage/ text: hidden; url: document-sequences.html#system-visibility-state text: history handling behavior; url: browsing-the-web.html#history-handling-behavior text: innerText getter steps; url:dom.html#dom-innertext + text: input type; url: input.html#dom-input-type text: navigables; url: document-sequences.html#navigables text: navigation id; url: browsing-the-web.html#navigation-id text: origin-clean; url: canvas.html#concept-canvas-origin-clean @@ -209,6 +210,7 @@ spec: HTML; urlPrefix: https://html.spec.whatwg.org/multipage/ text: report an error; url: webappapis.html#report-the-error text: run the animation frame callbacks; url: imagebitmap-and-animations.html#run-the-animation-frame-callbacks text: same origin domain; url: browsers.html#same-origin-domain + text: selected files; url: input.html#concept-input-type-file-selected text: session history entry; url: browsing-the-web.html#session-history-entry text: session history traversal queue; url: document-sequences.html#tn-session-history-traversal-queue text: session history; url: history.html#session-history @@ -219,6 +221,7 @@ spec: HTML; urlPrefix: https://html.spec.whatwg.org/multipage/ text: system visibility state; url: document-sequences.html#system-visibility-state text: traversable navigable; url:document-sequences.html#traversable-navigable text: traverse the history by a delta; url: browsing-the-web.html#traverse-the-history-by-a-delta + text: update the file selection; url: input.html#update-the-file-selection text: visible; url: document-sequences.html#system-visibility-state text: window open steps; url: window-object.html#window-open-steps text: worker event loop; url: webappapis.html#worker-event-loop-2 @@ -603,6 +606,9 @@ with the following additional codes:
@@ -9834,7 +9840,8 @@ simulated user input. InputCommand = ( input.PerformActions // - input.ReleaseActions + input.ReleaseActions // + input.SetFiles )@@ -10125,6 +10132,87 @@ The [=remote end steps=] given |session|, and |command parameters| are: +#### The input.setFiles Command #### {#command-input-setFiles} + +The input.setFiles command sets the
files property of a given input element with type file
+to a set of file paths.
+
+
+ input.SetFiles = (
+ method: "input.setFiles",
+ params: input.SetFilesParameters
+ )
+
+ input.SetFilesParameters = {
+ context: browsingContext.BrowsingContext,
+ element: script.SharedReference,
+ files: [*text]
+ }
+
+ + EmptyResult ++
context"] field.
+
+1. Let |context| be the result of [=trying=] to [=get a browsing context=] with
+ |context id|.
+
+1. Let |document| be |context|'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|'s [=realm execution context=]'s
+ Realm component.
+
+1. Let |element| be the result of [=trying=] to [=deserialize remote reference=]
+ with |command parameters|["element"], |realm|, and |session|.
+
+1. If |element| doesn't implement {{Element}}, return [=error=] with [=error code=]
+ [=no such element=].
+
+1. If |element| doesn't implement {{HTMLInputElement}},
+ |element|["type"] is not "file", or
+ |element|["disabled"] is true, return [=error=] with [=error
+ code=]
+ [=unable to set file input=].
+
+1. Let |files| be the value of the |command parameters|["files"]
+ field.
+
+1. Let |selected files| be |element|'s [=selected files=].
+
+1. If the [=set/size=] of the [=set/intersection=] of |files| and |selected
+ files| is equal to the [=set/size=] of |selected files|, [=queue an element
+ task=] on the [=user interaction task source=] given |element| to fire an
+ event named cancel at |element|, with the bubbles
+ attribute initialized to true.
+
+ Note: Cancellation in a browser is typically determined by changes in file
+ selection. In other words, if there is no change, a "cancel" event is sent.
+
+1. Otherwise, [=update the file selection=] for |element| with |files| as the
+ user's selection.
+
+1. Return [=success=] with data null.
+
+