Skip to content

Extend browser.createUserContext with unhandledPromptBehavior parameter #896

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
44 changes: 39 additions & 5 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -2712,7 +2712,8 @@ The <dfn export for=commands>browser.createUserContext</dfn> command creates a

browser.CreateUserContextParameters = {
? acceptInsecureCerts: bool,
? proxy: session.ProxyConfiguration
? proxy: session.ProxyConfiguration,
? unhandledPromptBehavior: session.UserPromptHandler
}
</pre>
</dd>
Expand Down Expand Up @@ -2746,6 +2747,10 @@ The [=remote end steps=] with |session| and |command parameters| are:
[=user context to accept insecure certificates override map=][|user context|]
to |acceptInsecureCerts|.

1. If |command parameters| [=map/contains=] "<code>unhandledPromptBehavior</code>",
[=map/set=] [=unhandled prompt behavior overrides map=][|user context|] to
|command parameters|["<code>unhandledPromptBehavior</code>"].

1. If |command parameters| [=map/contains=] "<code>proxy</code>":

1. Let |proxy configuration| be |command parameters|["<code>proxy</code>"].
Expand Down Expand Up @@ -3114,11 +3119,22 @@ A <dfn>viewport configuration</dfn> is a [=struct=] with an [=struct/item=] name
<dfn attribute for="viewport-configuration">viewport</dfn> which is a [=viewport-configuration/viewport dimensions=]
or null and an [=struct/item=] named <dfn attribute for="viewport-configuration">devicePixelRatio</dfn> which is a float or null.

An <dfn>unhandled prompt behavior</dfn> is a [=struct=] with:
* [=struct/Item=] named <dfn attribute for="unhandled-prompt-behavior-alert">alert</dfn> which is a string or null (default: null);
* [=struct/Item=] named <dfn attribute for="unhandled-prompt-behavior-beforeUnload">beforeUnload</dfn> which is a string or null (default: null);
* [=struct/Item=] named <dfn attribute for="unhandled-prompt-behavior-confirm">confirm</dfn> which is a string or null (default: null);
* [=struct/Item=] named <dfn attribute for="unhandled-prompt-behavior-default">default</dfn> which is a string or null (default: null);
* [=struct/Item=] named <dfn attribute for="unhandled-prompt-behavior-file">file</dfn> which is a string or null (default: null);
* [=struct/Item=] named <dfn attribute for="unhandled-prompt-behavior-prompt">prompt</dfn> which is a string or null (default: null).

A [=remote end=] has a <dfn>viewport overrides map</dfn> which is a weak map between [=user contexts=] and [=viewport configuration=].

A [=remote end=] has a <dfn>locale overrides map</dfn> which is a weak map between
[=navigables=] or [=user contexts=] and string or null.

A [=remote end=] has an <dfn>unhandled prompt behavior overrides map</dfn> which is a
weak map between [=user contexts=] and [=unhandled prompt behavior=].

### Types ### {#module-browsingcontext-types}

#### The browsingContext.BrowsingContext Type #### {#type-browsingContext-Browsingcontext}
Expand Down Expand Up @@ -5720,6 +5736,26 @@ closed</dfn> steps given |window|, |type|, |accepted| and optional |user text|
</dd>
</dl>

<div algorithm>
To <dfn>get navigable's user prompt handler</dfn> given |type| and |navigable|:

1. Let |user context| be |navigable|'s [=associated user context=].

1. If [=unhandled prompt behavior overrides map=] contains |user context|:

1. Let |behavior map| be [=unhandled prompt behavior overrides map=][|user context|].

1. If |behavior map|[|type|] is not null, return |behavior map|[|type|].

1. If |behavior map|[<code>"default"</code>] is not null, return
|behavior map|[<code>"default"</code>].

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

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

</div>

<div algorithm>
The [=remote end event trigger=] is the <dfn export>WebDriver BiDi user prompt
opened</dfn> steps given |window|, |type|, |message|, and optional |default value|
Expand All @@ -5729,10 +5765,8 @@ opened</dfn> steps given |window|, |type|, |message|, and optional |default valu

1. Let |navigable id| be the [=navigable id=] for |navigable|.

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

1. Let |handler| be |handler configuration|'s [=prompt handler
configuration/handler=].
1. Let |handler| be [=get navigable's user prompt handler=] with |type| and
|navigable|.

1. Let |params| be a [=/map=] matching the
<code>browsingContext.UserPromptOpenedParameters</code> production with the
Expand Down