Skip to content
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

Prompt handler #681

Merged
merged 4 commits into from
Jun 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 60 additions & 8 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ spec: WEBDRIVER; urlPrefix: https://w3c.github.io/webdriver/
text: no such element; url: dfn-no-such-element
text: no such frame; url: dfn-no-such-frame
text: parse a page range; url: dfn-parse-a-page-range
text: handler; for: prompt handler configuration; url: dfn-handler
text: process capabilities; url: dfn-processing-capabilities
text: readiness state; url: dfn-readiness-state
text: remote end steps; url: dfn-remote-end-steps
Expand Down Expand Up @@ -231,6 +232,9 @@ spec: HTML; urlPrefix: https://html.spec.whatwg.org/multipage/
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
spec: INFRA; urlPrefix: https://infra.spec.whatwg.org/
type: dfn
text: convert a JSON-derived JavaScript value to an Infra value; url: convert-a-json-derived-javascript-value-to-an-infra-value
spec: RESOURCE-TIMING; urlPrefix: https://w3c.github.io/resource-timing/
type: dfn
text: convert fetch timestamp; url: dfn-convert-fetch-timestamp
Expand Down Expand Up @@ -1567,7 +1571,7 @@ session.CapabilityRequest = {
? browserVersion: text,
? platformName: text,
? proxy: session.ProxyConfiguration,
? webSocketUrl: bool,
whimboo marked this conversation as resolved.
Show resolved Hide resolved
? unhandledPromptBehavior: session.UserPromptHandler,
Extensible
};
</pre>
Expand Down Expand Up @@ -1658,6 +1662,25 @@ session.SystemProxyConfiguration = (

</pre>

#### The session.UserPromptHandler Type #### {#type-session-UserPromptHandler}

[=Remote end definition=] and [=local end definition=]

<pre class="cddl remote-cddl local-cddl">
session.UserPromptHandlerType = "accept" / "dismiss" / "ignore";

session.UserPromptHandler = {
? alert: session.UserPromptHandlerType,
? beforeUnload: session.UserPromptHandlerType,
? confirm: session.UserPromptHandlerType,
? default: session.UserPromptHandlerType,
jgraham marked this conversation as resolved.
Show resolved Hide resolved
? prompt: session.UserPromptHandlerType,
};
</pre>

The <code>session.UserPromptHandler</code> type represents the configuration of
the user prompt handler.

#### The session.SubscriptionRequest Type #### {#type-session-SubscriptionRequest}

<pre class="cddl remote-cddl">
Expand Down Expand Up @@ -1758,6 +1781,7 @@ This is a [=static command=].
setWindowRect: bool,
userAgent: text,
? proxy: session.ProxyConfiguration,
? unahandledPromptBehavior: session.UserPromptHandler,
? webSocketUrl: text,
Extensible
}
Expand All @@ -1777,9 +1801,12 @@ The [=remote end steps=] given |session| and |command parameters| are:

1. Let |flags| be a [=/set=] containing "<code>bidi</code>".

1. Let |capabilities| be the result of [=trying=] to [=process capabilities=]
1. Let |capabilities json| be the result of [=trying=] to [=process capabilities=]
with |command parameters| and |flags|.

1. Let |capabilities| be [=convert a JSON-derived JavaScript value to an Infra
value=] with |capabilities json|.

1. Let |session| be the result of [=trying=] to [=create a session=] with
|capabilities| and |flags|.

Expand Down Expand Up @@ -2631,6 +2658,17 @@ browsingContext.ReadinessState = "none" / "interactive" / "complete"
The <code>browsingContext.ReadinessState</code> type represents the stage of
document loading at which a navigation command will return.

#### The browsingContext.UserPrompt Type #### {#type-browsingContext-UserPrompt}

[=Remote end definition=] and [=local end definition=]

<pre class="cddl remote-cddl local-cddl">
browsingContext.UserPromptType = "alert" / "confirm" / "prompt" / "beforeunload";
</pre>

The <code>browsingContext.UserPrompt</code> type represents the possible user
prompt types.

### Commands ### {#module-browsingContext-commands}

#### The browsingContext.activate Command #### {#command-browsingContext-activate}
Expand Down Expand Up @@ -4536,6 +4574,7 @@ failed</dfn> steps given |context| and |navigation status|:
browsingContext.UserPromptClosedParameters = {
context: browsingContext.BrowsingContext,
accepted: bool,
type: browsingContext.UserPromptType,
sadym-chromium marked this conversation as resolved.
Show resolved Hide resolved
? userText: text
}
</pre>
Expand All @@ -4544,7 +4583,7 @@ failed</dfn> steps given |context| and |navigation status|:

<div algorithm>
The [=remote end event trigger=] is the <dfn export>WebDriver BiDi user prompt
closed</dfn> steps given |window|, |accepted| and optional |user text|
closed</dfn> steps given |window|, |type|, |accepted| and optional |user text|
(default: null).

1. Let |context| be |window|'s [=/browsing context=].
Expand All @@ -4554,8 +4593,9 @@ closed</dfn> steps given |window|, |accepted| and optional |user text|
1. Let |params| be a [=/map=] matching the
<code>browsingContext.UserPromptClosedParameters</code> production with the
<code>context</code> field set to |context id|, the <code>accepted</code>
field set to |accepted|, and the <code>userText</code> field set to |user
text| if |user text| is not null or omitted otherwise.
field set to |accepted|, the <code>type</code> field set to |type|, and the
<code>userText</code> field set to |user text| if |user text| is not null or
omitted otherwise.

1. Let |body| be a [=/map=] matching the
<code>BrowsingContextUserPromptClosedEvent</code> production, with the
Expand Down Expand Up @@ -4583,8 +4623,9 @@ closed</dfn> steps given |window|, |accepted| and optional |user text|

browsingContext.UserPromptOpenedParameters = {
context: browsingContext.BrowsingContext,
type: "alert" / "confirm" / "prompt" / "beforeunload",
handler: "accept" / "dismiss" / "ignore",
whimboo marked this conversation as resolved.
Show resolved Hide resolved
message: text,
type: browsingContext.UserPromptType,
? defaultValue: text
}
</pre>
Expand All @@ -4600,12 +4641,18 @@ opened</dfn> steps given |window|, |type|, |message|, and optional |default valu

1. Let |context id| be the [=browsing context id=] for |context|.

1. Let |handler configuration| be [=get the prompt handler=] with |type|.

1. Let |handler| be |handler configuration|'s [=prompt handler
configuration/handler=].

1. Let |params| be a [=/map=] matching the
<code>browsingContext.UserPromptOpenedParameters</code> production with the
<code>context</code> field set to |context id|, the <code>type</code> field
set to |type|, the <code>message</code> field set to |message|, and the
set to |type|, the <code>message</code> field set to |message|, the
<code>defaultValue</code> field set to |default value| if |default value| is
not null or omitted otherwise.
not null or omitted otherwise, and the <code>handler</code> field set to
|handler|.

1. Let |body| be a [=/map=] matching the
<code>browsingContext.UserPromptOpened</code> production, with the
Expand All @@ -4618,6 +4665,10 @@ opened</dfn> steps given |window|, |type|, |message|, and optional |default valu

1. [=Emit an event=] with |session| and |body|.

1. If |handler| is "<code>ignore</code>", set handler to "<code>none</code>".

1. Return |handler|.

</div>

## The network Module ## {#module-network}
Expand Down Expand Up @@ -10720,6 +10771,7 @@ The [=remote end steps=] given |session| and |command parameters| are:

</div>


# Patches to Other Specifications # {#patches}

This specification requires some changes to external specifications to provide the necessary
Expand Down
Loading