@@ -112,6 +112,7 @@ spec: WEBDRIVER; urlPrefix: https://w3c.github.io/webdriver/
112
112
text: unable to capture screen; url: dfn-unable-to-capture-screen
113
113
text: unknown command; url: dfn-unknown-command
114
114
text: unknown error; url: dfn-unknown-error
115
+ text: user prompt handler; url: dfn-user-prompt-handler
115
116
text: unsupported operation; url: dfn-unsupported-operation
116
117
text: web element reference; url: dfn-web-element-reference
117
118
text: webdriver-active flag; url: dfn-webdriver-active-flag
@@ -1711,13 +1712,17 @@ session.UserPromptHandler = {
1711
1712
? beforeUnload: session.UserPromptHandlerType,
1712
1713
? confirm: session.UserPromptHandlerType,
1713
1714
? default: session.UserPromptHandlerType,
1715
+ ? file: session.UserPromptHandlerType,
1714
1716
? prompt: session.UserPromptHandlerType,
1715
1717
};
1716
1718
</pre>
1717
1719
1718
1720
The <code> session.UserPromptHandler</code> type represents the configuration of
1719
1721
the user prompt handler.
1720
1722
1723
+ Note: <code> file</code> handles file picker. "accept" and "dismiss" dismisses
1724
+ the picker. "ignore" keeps the picker open.
1725
+
1721
1726
#### The session.UserPromptHandlerType Type #### {#type-session-UserPromptHandlerType}
1722
1727
1723
1728
[=Remote end definition=] and [=local end definition=]
@@ -11801,6 +11806,90 @@ The [=remote end steps=] given |session| and |command parameters| are:
11801
11806
11802
11807
</div>
11803
11808
11809
+ ### Events ### {#module-input-events}
11810
+
11811
+ #### The input.fileDialogOpened Event #### {#event-input-fileDialogOpened}
11812
+
11813
+ <dl>
11814
+ <dt> Event Type</dt>
11815
+ <dd>
11816
+ <pre class="cddl local-cddl remote-cddl">
11817
+ input.FileDialogOpened = (
11818
+ method: "input.fileDialogOpened",
11819
+ params: input.FileDialogInfo
11820
+ )
11821
+
11822
+ input.FileDialogInfo = {
11823
+ context: browsingContext.BrowsingContext,
11824
+ ? element: script.SharedReference,
11825
+ multiple: bool,
11826
+ }
11827
+ </pre>
11828
+ </dd>
11829
+ </dl>
11830
+
11831
+ <div algorithm>
11832
+ The [=remote end event trigger=] is the
11833
+ <dfn export>WebDriver BiDi file dialog opened</dfn> steps, given |element| and optionally
11834
+ |file picker options| (default: null):
11835
+
11836
+ 1. Let |navigable| be the |element|'s [=node document=]' s [=/navigable=] .
11837
+
11838
+ 1. Let |navigable id| be |navigable|'s [=navigable id=] .
11839
+
11840
+ 1. Let |multiple| be <code> false</code> .
11841
+
11842
+ 1. If |element| is not null and |element|'s <{input/multiple}> attribute is set,
11843
+ set |multiple| to <code> true</code> .
11844
+
11845
+ 1. If |file picker options| is not null:
11846
+
11847
+ 1. If |file picker options|["<code>multiple</code>"] is true, set |multiple| to
11848
+ <code> true</code> .
11849
+
11850
+ 1. Let |related navigables| be a [=/set=] containing |navigable|.
11851
+
11852
+ 1. For each |session| in the [=set of sessions for which an event is enabled=] given
11853
+ "<code> input.fileDialogOpened</code> " and |related navigables|:
11854
+
11855
+ 1. Let |params| be a [=/map=] matching the <code> input.FileDialogInfo</code>
11856
+ production with the <code> context</code> field set to |navigable id| and
11857
+ <code> multiple</code> field set to |multiple|.
11858
+
11859
+ 1. If |element| is not null:
11860
+
11861
+ 1. Let |shared id| be [=get shared id for a node=] with |element| and |session|.
11862
+
11863
+ 1. Set |params|["<code>element</code>"] to |shared id|.
11864
+
11865
+ 1. Let |body| be a [=/map=] matching the <code> input.fileDialogOpened</code>
11866
+ production, with the <code> params</code> field set to |params|.
11867
+
11868
+ 1. [=Emit an event=] with |session| and |body|.
11869
+
11870
+ 1. Let |dismissed| be false.
11871
+
11872
+ 1. For each |session| in [=active BiDi sessions=] :
11873
+
11874
+ 1. Let |user prompt handler| be |session|'s [=user prompt handler=] .
11875
+
11876
+ 1. If |user prompt handler| is not null:
11877
+
11878
+ 1. Assert |user prompt handler| is a [=/map=] .
11879
+
11880
+ 1. If |user prompt handler| [=map/contains=] "<code> file</code> ":
11881
+
11882
+ 1. If |user prompt handler|["<code>file</code>"] is not equal to
11883
+ "<code> ignore</code> ", set |dismissed| to true.
11884
+
11885
+ 1. Otherwise if |user prompt handler| [=map/contains=] "<code> default</code> " and
11886
+ |user prompt handler|["<code>default</code>"] is not equal to
11887
+ "<code> ignore</code> ", set |dismissed| to true.
11888
+
11889
+ 1. Return |dismissed|.
11890
+
11891
+ </div>
11892
+
11804
11893
11805
11894
## The webExtension Module ## {#module-webExtension}
11806
11895
0 commit comments