Skip to content

Commit

Permalink
Update index.bs
Browse files Browse the repository at this point in the history
Co-authored-by: Alex Rudenko <[email protected]>
  • Loading branch information
jrandolf-2 and OrKoN committed Dec 8, 2023
1 parent dc921f7 commit a1e64ec
Showing 1 changed file with 87 additions and 3 deletions.
90 changes: 87 additions & 3 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,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: multiple; url: input.html#attr-input-multiple
Expand All @@ -192,17 +193,19 @@ 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: session history; url: history.html#session-history
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
text: set up a window environment settings object; url: window-object.html#set-up-a-window-environment-settings-object
text: set up a worker environment settings object; url: workers.html#set-up-a-worker-environment-settings-object
text: set up a worklet environment settings object; url: worklets.html#set-up-a-worklet-environment-settings-object
text: shared worker; url: workers.html#shared-workers
text: system visibility state; url: document-sequences.html#system-visibility-state
text: traversable navigable; url:document-sequences.html#traversable-navigable
text: visible; url: document-sequences.html#system-visibility-state
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
text: worklet global scopes; url:worklets.html#concept-document-worklet-global-scopes
Expand Down Expand Up @@ -545,6 +548,9 @@ with the following additional codes:

<dt><dfn>unable to close browser</dfn>
<dd>Tried to close the browser, but failed to do so.

<dt><dfn>unable to set file input</dfn>
<dd>Tried to set a file input, but failed to do so.
</dl>

<pre class="cddl local-cddl">
Expand Down Expand Up @@ -9328,7 +9334,8 @@ simulated user input.

InputCommand = (
input.PerformActions //
input.ReleaseActions
input.ReleaseActions //
input.SetFiles
)
</pre>

Expand Down Expand Up @@ -9619,6 +9626,83 @@ The [=remote end steps=] given |session|, and |command parameters| are:

</div>

#### The input.setFiles Command #### {#command-input-setFiles}

The <dfn export for=commands>input.setFiles</dfn> command sets a given file
input with a given set of file paths.

<dl>
<dt>Command Type</dt>
<dd>
<pre class="cddl remote-cddl">
input.SetFiles = (
method: "input.setFiles",
params: input.SetFilesParameters
)

input.SetFilesParameters = {
context: browsingContext.BrowsingContext,
element: script.SharedReference,
files: [*text]
}
</pre>
</dd>
<dt>Return Type</dt>
<dd>
<pre class="cddl">
EmptyResult
</pre>
</dd>
</dl>

<div algorithm="remote end steps for input.setFiles">

The [=remote end steps=] given |session| and |command parameters| are:

1. Let |context id| be the value of the |command
parameters|["<code>context</code>"] 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 <a>associated <code>Document</code></a> 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|["<code>element</code>"], |realm|, and |session|.

1. Let |files| be the value of the |command parameters|["<code>files</code>"]
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|:

1. [=Queue an element task=] on the [=user interaction task source=] given
|element| to fire an event named <code>cancel</code> at |element|, with
the <code>bubbles</code> attribute initialized to true.

Note: Although there may not be any dialog, cancellation in a browser is
typically determined by changes in file selection. In other words, if
there is no change, a "cancel" event should be sent.

1. Return [=success=] with data null.

1. Otherwise, [=update the file selection=] for |element| with |files| as the
user's selection.

1. Return [=success=] with data null.

</div>


### Events ### {#module-input-events}

#### The input.fileDialogOpened Event #### {#event-input-fileDialogOpened}
Expand Down

0 comments on commit a1e64ec

Please sign in to comment.