Skip to content

Commit f57532d

Browse files
Automate file dialog via WebDriver BiDi (WICG#452)
* Respect "dismissed" from "WebDriver BiDi file dialog opened" * showDirectoryPicker * Pass |File Picker Options| to "WebDriver BiDi file dialog opened" * remove "directory" * fix reference to BiDi spec * Update index.bs Co-authored-by: Austin Sullivan <[email protected]> * Update index.bs Co-authored-by: Austin Sullivan <[email protected]> * Update index.bs Co-authored-by: Austin Sullivan <[email protected]> * filePickerOptions --------- Co-authored-by: Austin Sullivan <[email protected]>
1 parent 8764848 commit f57532d

File tree

1 file changed

+30
-13
lines changed

1 file changed

+30
-13
lines changed

index.bs

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ urlPrefix: https://tc39.github.io/ecma262/; spec: ECMA-262
2626
type: dfn; text: realm; url: realm
2727
urlPrefix: https://storage.spec.whatwg.org/; spec: storage
2828
type: dfn; text: storage; url: site-storage
29+
urlPrefix: https://www.w3.org/TR/webdriver-bidi/; spec: webdriver-bidi
30+
type: dfn; text: WebDriver BiDi file dialog opened; url: webdriver-bidi-file-dialog-opened
2931
</pre>
3032

3133
<style>
@@ -706,19 +708,26 @@ these steps:
706708

707709
1. Optionally, wait until any prior execution of this algorithm has terminated.
708710

709-
1. Display a prompt to the user requesting that the user pick some files.
710-
If |options|["{{OpenFilePickerOptions/multiple}}"] is false,
711-
there must be no more than one file selected;
712-
otherwise any number may be selected.
711+
1. Let |filePickerOptions| be an empty [=/map=].
713712

714-
The displayed prompt should let the user pick one of the |accepts options| to filter the list of displayed files.
715-
Exactly how this is implemented, and what this prompt looks like is [=implementation-defined=].
713+
1. Set |filePickerOptions|["multiple"] to |options|["{{OpenFilePickerOptions/multiple}}"].
716714

717-
When possible, this prompt should start out showing |starting directory|.
715+
1. Let |dismissed| be the result of [=WebDriver BiDi file dialog opened=] with null and |filePickerOptions|.
718716

719-
1. Wait for the user to have made their selection.
717+
1. If |dismissed| is false:
720718

721-
1. If the user dismissed the prompt without making a selection,
719+
1. Display a prompt to the user requesting that the user pick some files.
720+
If |filePickerOptions|["multiple"] is false, there must be no more than one file selected;
721+
otherwise any number may be selected.
722+
723+
The displayed prompt should let the user pick one of the |accepts options| to filter the list of displayed files.
724+
Exactly how this is implemented, and what this prompt looks like is [=implementation-defined=].
725+
726+
When possible, this prompt should start out showing |starting directory|.
727+
728+
1. Wait for the user to have made their selection.
729+
730+
1. If |dismissed| is true or if the user dismissed the prompt without making a selection,
722731
[=/reject=] |p| with an "{{AbortError}}" {{DOMException}} and abort.
723732

724733
1. Let |entries| be a [=/list=] of [=file entries=] representing the selected files or directories.
@@ -873,13 +882,21 @@ these steps:
873882

874883
1. Optionally, wait until any prior execution of this algorithm has terminated.
875884

876-
1. Display a prompt to the user requesting that the user pick a directory.
885+
1. Let |filePickerOptions| be an empty [=/map=].
877886

878-
When possible, this prompt should start out showing |starting directory|.
887+
1. Set |filePickerOptions|["multiple"] to false.
879888

880-
1. Wait for the user to have made their selection.
889+
1. Let |dismissed| be the result of [=WebDriver BiDi file dialog opened=] with null and |filePickerOptions|.
881890

882-
1. If the user dismissed the prompt without making a selection,
891+
1. If |dismissed| is false:
892+
893+
1. Display a prompt to the user requesting that the user pick a directory.
894+
895+
When possible, this prompt should start out showing |starting directory|.
896+
897+
1. Wait for the user to have made their selection.
898+
899+
1. If |dismissed| is true or if the user dismissed the prompt without making a selection,
883900
[=/reject=] |p| with an "{{AbortError}}" {{DOMException}} and abort.
884901

885902
1. Let |entry| be a [=directory entry=] representing the selected directory.

0 commit comments

Comments
 (0)