You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -603,6 +606,9 @@ with the following additional codes:
603
606
604
607
<dt><dfn>underspecified storage partition</dfn>
605
608
<dd>Tried to interact with data in a storage partition which was not adequately specified.
609
+
610
+
<dt><dfn>unable to set file input</dfn>
611
+
<dd>Tried to set a file input, but failed to do so.
606
612
</dl>
607
613
608
614
<pre class="cddl local-cddl">
@@ -9835,7 +9841,8 @@ simulated user input.
9835
9841
9836
9842
InputCommand = (
9837
9843
input.PerformActions //
9838
-
input.ReleaseActions
9844
+
input.ReleaseActions //
9845
+
input.SetFiles
9839
9846
)
9840
9847
</pre>
9841
9848
@@ -10126,6 +10133,87 @@ The [=remote end steps=] given |session|, and |command parameters| are:
10126
10133
10127
10134
</div>
10128
10135
10136
+
#### The input.setFiles Command #### {#command-input-setFiles}
10137
+
10138
+
The <dfn export for=commands>input.setFiles</dfn> command sets the <code>files</code> property of a given <code>input</code> element with type <code>file</code>
10139
+
to a set of file paths.
10140
+
10141
+
<dl>
10142
+
<dt>Command Type</dt>
10143
+
<dd>
10144
+
<pre class="cddl remote-cddl">
10145
+
input.SetFiles = (
10146
+
method: "input.setFiles",
10147
+
params: input.SetFilesParameters
10148
+
)
10149
+
10150
+
input.SetFilesParameters = {
10151
+
context: browsingContext.BrowsingContext,
10152
+
element: script.SharedReference,
10153
+
files: [*text]
10154
+
}
10155
+
</pre>
10156
+
</dd>
10157
+
<dt>Return Type</dt>
10158
+
<dd>
10159
+
<pre class="cddl">
10160
+
EmptyResult
10161
+
</pre>
10162
+
</dd>
10163
+
</dl>
10164
+
10165
+
<div algorithm="remote end steps for input.setFiles">
10166
+
10167
+
The [=remote end steps=] given |session| and |command parameters| are:
10168
+
10169
+
1. Let |context id| be the value of the |command
10170
+
parameters|["<code>context</code>"] field.
10171
+
10172
+
1. Let |context| be the result of [=trying=] to [=get a browsing context=] with
10173
+
|context id|.
10174
+
10175
+
1. Let |document| be |context|'s [=active document=].
10176
+
10177
+
1. Let |environment settings| be the [=environment settings object=] whose
10178
+
[=relevant global object=]'s <a>associated <code>Document</code></a> is
10179
+
|document|.
10180
+
10181
+
1. Let |realm| be |environment settings|'s [=realm execution context=]'s
10182
+
Realm component.
10183
+
10184
+
1. Let |element| be the result of [=trying=] to [=deserialize remote reference=]
10185
+
with |command parameters|["<code>element</code>"], |realm|, and |session|.
10186
+
10187
+
1. If |element| doesn't implement {{Element}}, return [=error=] with [=error code=]
10188
+
[=no such element=].
10189
+
10190
+
1. If |element| doesn't implement {{HTMLInputElement}},
10191
+
|element|["<code>type</code>"] is not "file", or
10192
+
|element|["<code>disabled</code>"] is true, return [=error=] with [=error
10193
+
code=]
10194
+
[=unable to set file input=].
10195
+
10196
+
1. Let |files| be the value of the |command parameters|["<code>files</code>"]
10197
+
field.
10198
+
10199
+
1. Let |selected files| be |element|'s [=selected files=].
10200
+
10201
+
1. If the [=set/size=] of the [=set/intersection=] of |files| and |selected
10202
+
files| is equal to the [=set/size=] of |selected files|, [=queue an element
10203
+
task=] on the [=user interaction task source=] given |element| to fire an
10204
+
event named <code>cancel</code> at |element|, with the <code>bubbles</code>
10205
+
attribute initialized to true.
10206
+
10207
+
Note: Cancellation in a browser is typically determined by changes in file
10208
+
selection. In other words, if there is no change, a "cancel" event is sent.
10209
+
10210
+
1. Otherwise, [=update the file selection=] for |element| with |files| as the
10211
+
user's selection.
10212
+
10213
+
1. Return [=success=] with data null.
10214
+
10215
+
</div>
10216
+
10129
10217
# Patches to Other Specifications # {#patches}
10130
10218
10131
10219
This specification requires some changes to external specifications to provide the necessary
0 commit comments