-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Implement input.fileDialogOpened
#568
Closed
+81
−1
Closed
Changes from 13 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
c65f82b
`WebDriver BiDi picker shown` + `input.fileDialogOpened`
sadym-chromium d41574f
todo
sadym-chromium 1802ae1
Extend capabilities
sadym-chromium 689694a
Explain behavior
sadym-chromium b1a76df
rename capability to `fileUpload`
sadym-chromium e2be155
Suppress file dialog
sadym-chromium bf64757
Return pair (|suppressed|, |dismissed|)
sadym-chromium 8accc43
remove suppress file dialog
sadym-chromium 0610177
update note
sadym-chromium 44ec72c
Rename to "WebDriver BiDi file dialog shown"
sadym-chromium 64ab989
fix arguments
sadym-chromium be8a54e
"WebDriver BiDi file dialog opened"
sadym-chromium 5b8ff04
fix css2 reference
sadym-chromium 1d7bf4b
fix loop
sadym-chromium 935699b
fix condition
sadym-chromium 0b4f673
Rename capability to `file`
sadym-chromium File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -112,6 +112,7 @@ spec: WEBDRIVER; urlPrefix: https://w3c.github.io/webdriver/ | |
text: unable to capture screen; url: dfn-unable-to-capture-screen | ||
text: unknown command; url: dfn-unknown-command | ||
text: unknown error; url: dfn-unknown-error | ||
text: user prompt handler; url: dfn-user-prompt-handler | ||
text: unsupported operation; url: dfn-unsupported-operation | ||
text: web element reference; url: dfn-web-element-reference | ||
text: webdriver-active flag; url: dfn-webdriver-active-flag | ||
|
@@ -1711,13 +1712,17 @@ session.UserPromptHandler = { | |
? beforeUnload: session.UserPromptHandlerType, | ||
? confirm: session.UserPromptHandlerType, | ||
? default: session.UserPromptHandlerType, | ||
? fileDialog: session.UserPromptHandlerType, | ||
? prompt: session.UserPromptHandlerType, | ||
}; | ||
</pre> | ||
|
||
The <code>session.UserPromptHandler</code> type represents the configuration of | ||
the user prompt handler. | ||
|
||
Note: <code>fileDialog</code> handles file picker. "accept" and "dismiss" dismisses | ||
the picker. "ignore" keeps the picker open. | ||
|
||
#### The session.UserPromptHandlerType Type #### {#type-session-UserPromptHandlerType} | ||
|
||
[=Remote end definition=] and [=local end definition=] | ||
|
@@ -2282,7 +2287,7 @@ BrowserResult = ( | |
|
||
Each [=/top-level traversable=] is associated with a single <dfn>client | ||
window</dfn> which represents a rectangular area containing the | ||
<a spec=css22>viewport</a> that will be used to render that [=/top-level | ||
<a spec=css2>viewport</a> that will be used to render that [=/top-level | ||
traversable=]'s [=active document=] when its [=visibility state=] is | ||
"<code>visible</code>", as well as any browser-specific user interface elements | ||
associated with displaying the traversable (e.g. any URL bar, toolbars, or OS | ||
|
@@ -11705,6 +11710,81 @@ The [=remote end steps=] given |session| and |command parameters| are: | |
|
||
</div> | ||
|
||
### Events ### {#module-input-events} | ||
|
||
#### The input.fileDialogOpened Event #### {#event-input-fileDialogOpened} | ||
|
||
<dl> | ||
<dt>Event Type</dt> | ||
<dd> | ||
<pre class="cddl local-cddl remote-cddl"> | ||
input.FileDialogOpened = ( | ||
method: "input.fileDialogOpened", | ||
params: input.FileDialogInfo | ||
) | ||
|
||
input.FileDialogInfo = { | ||
sadym-chromium marked this conversation as resolved.
Show resolved
Hide resolved
|
||
context: browsingContext.BrowsingContext, | ||
element: script.SharedReference, | ||
multiple: bool, | ||
} | ||
</pre> | ||
</dd> | ||
</dl> | ||
|
||
<div algorithm> | ||
The [=remote end event trigger=] is the | ||
<dfn export>WebDriver BiDi file dialog opened</dfn> steps, given |element|. | ||
|
||
1. Assert |element| implements {{HTMLInputElement}}. | ||
|
||
1. Let |navigable| be the |element|'s [=node document=]'s [=/navigable=]. | ||
|
||
1. Let |navigable id| be |navigable|'s [=navigable id=]. | ||
|
||
1. Let |multiple| be <code>true</code> if |element|'s <{input/multiple}> attribute is | ||
set, or <code>false</code> otherwise. | ||
|
||
1. Let |related navigables| be a [=/set=] containing |navigable|. | ||
|
||
1. For each |session| in the [=set of sessions for which an event is enabled=] given | ||
"<code>input.fileDialogOpened</code>" and |related navigables|: | ||
|
||
1. Let |shared id| be [=get shared id for a node=] with |element| and |session|. | ||
|
||
1. Let |params| be a [=/map=] matching the <code>input.FileDialogInfo</code> | ||
production with the <code>context</code> field set to |navigable id|, the | ||
<code>element</code> field set to |shared id| and <code>multiple</code> field | ||
set to |multiple|. | ||
|
||
1. Let |body| be a [=/map=] matching the <code>input.fileDialogOpened</code> | ||
production, with the <code>params</code> field set to |params|. | ||
|
||
1. [=Emit an event=] with |session| and |body|. | ||
|
||
1. Let |dismissed| be false. | ||
|
||
1. 1. For each |session| in [=active BiDI sessions=]: | ||
|
||
1. Let |user prompt handler| be |session|'s [=user prompt handler=]. | ||
|
||
1. If |user prompt handler| is not null: | ||
|
||
1. Assert |user prompt handler| is a [=/map=]. | ||
|
||
1. If |user prompt handler| [=map/contains=] "<code>fileDialog</code>": | ||
|
||
1. if |user prompt handler|["<code>fileDialog</code>"] is not equal to | ||
"<code>ignore</code>", set |dismissed| to true. | ||
|
||
1. Otherwise if |user prompt handler| [=map/contains=] "<code>default</code>" and | ||
|user prompt handler|["<code>fileDialog</code>"] is not equal to | ||
"<code>ignore</code>", set |dismissed| to true. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Respecting default behavior makes sense, but it is a breaking change, as default of "accept" and "dismiss" starts suppressing file dialog. |
||
|
||
1. Return |dismissed|. | ||
|
||
</div> | ||
|
||
|
||
## The webExtension Module ## {#module-webExtension} | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My local build didn't work with
css22
for whatever reason.