Skip to content

Commit a8b68a1

Browse files
Extend browser.createUserContext with unhandledPromptBehavior parameter (#896)
Addressing #789 Analogue of `acceptInsecureCerts`, add `unhandledPromptBehavior` parameter to `browser.createUserContext`.
1 parent f89d8e9 commit a8b68a1

File tree

1 file changed

+40
-5
lines changed

1 file changed

+40
-5
lines changed

index.bs

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2713,7 +2713,8 @@ The <dfn export for=commands>browser.createUserContext</dfn> command creates a
27132713

27142714
browser.CreateUserContextParameters = {
27152715
? acceptInsecureCerts: bool,
2716-
? proxy: session.ProxyConfiguration
2716+
? proxy: session.ProxyConfiguration,
2717+
? unhandledPromptBehavior: session.UserPromptHandler
27172718
}
27182719
</pre>
27192720
</dd>
@@ -2747,6 +2748,10 @@ The [=remote end steps=] with |session| and |command parameters| are:
27472748
[=user context to accept insecure certificates override map=][|user context|]
27482749
to |acceptInsecureCerts|.
27492750

2751+
1. If |command parameters| [=map/contains=] "<code>unhandledPromptBehavior</code>",
2752+
[=map/set=] [=unhandled prompt behavior overrides map=][|user context|] to
2753+
|command parameters|["<code>unhandledPromptBehavior</code>"].
2754+
27502755
1. If |command parameters| [=map/contains=] "<code>proxy</code>":
27512756

27522757
1. Let |proxy configuration| be |command parameters|["<code>proxy</code>"].
@@ -3115,11 +3120,22 @@ A <dfn>viewport configuration</dfn> is a [=struct=] with an [=struct/item=] name
31153120
<dfn attribute for="viewport-configuration">viewport</dfn> which is a [=viewport-configuration/viewport dimensions=]
31163121
or null and an [=struct/item=] named <dfn attribute for="viewport-configuration">devicePixelRatio</dfn> which is a float or null.
31173122

3123+
An <dfn>unhandled prompt behavior struct</dfn> is a [=struct=] with:
3124+
* [=struct/Item=] named <dfn attribute for="unhandled-prompt-behavior-alert">alert</dfn> which is a string or null;
3125+
* [=struct/Item=] named <dfn attribute for="unhandled-prompt-behavior-beforeUnload">beforeUnload</dfn> which is a string or null;
3126+
* [=struct/Item=] named <dfn attribute for="unhandled-prompt-behavior-confirm">confirm</dfn> which is a string or null;
3127+
* [=struct/Item=] named <dfn attribute for="unhandled-prompt-behavior-default">default</dfn> which is a string or null;
3128+
* [=struct/Item=] named <dfn attribute for="unhandled-prompt-behavior-file">file</dfn> which is a string or null;
3129+
* [=struct/Item=] named <dfn attribute for="unhandled-prompt-behavior-prompt">prompt</dfn> which is a string or null.
3130+
31183131
A [=remote end=] has a <dfn>viewport overrides map</dfn> which is a weak map between [=user contexts=] and [=viewport configuration=].
31193132

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

3136+
A [=remote end=] has an <dfn>unhandled prompt behavior overrides map</dfn> which is a
3137+
weak map between [=user contexts=] and [=unhandled prompt behavior struct=].
3138+
31233139
### Types ### {#module-browsingcontext-types}
31243140

31253141
#### The browsingContext.BrowsingContext Type #### {#type-browsingContext-Browsingcontext}
@@ -5721,6 +5737,27 @@ closed</dfn> steps given |window|, |type|, |accepted| and optional |user text|
57215737
</dd>
57225738
</dl>
57235739

5740+
<div algorithm>
5741+
To <dfn>get navigable's user prompt handler</dfn> given |type| and |navigable|:
5742+
5743+
1. Let |user context| be |navigable|'s [=associated user context=].
5744+
5745+
1. If [=unhandled prompt behavior overrides map=] [=map/contains=] |user context|:
5746+
5747+
1. Let |unhandled prompt behavior override| be [=unhandled prompt behavior overrides map=][|user context|].
5748+
5749+
1. If |unhandled prompt behavior override|[|type|] is not null, return
5750+
|unhandled prompt behavior override|[|type|].
5751+
5752+
1. If |unhandled prompt behavior override|[<code>"default"</code>] is not null,
5753+
return |unhandled prompt behavior override|[<code>"default"</code>].
5754+
5755+
1. Let |handler configuration| be [=get the prompt handler=] with |type|.
5756+
5757+
1. Return |handler configuration|'s [=prompt handler configuration/handler=].
5758+
5759+
</div>
5760+
57245761
<div algorithm>
57255762
The [=remote end event trigger=] is the <dfn export>WebDriver BiDi user prompt
57265763
opened</dfn> steps given |window|, |type|, |message|, and optional |default value|
@@ -5730,10 +5767,8 @@ opened</dfn> steps given |window|, |type|, |message|, and optional |default valu
57305767

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

5733-
1. Let |handler configuration| be [=get the prompt handler=] with |type|.
5734-
5735-
1. Let |handler| be |handler configuration|'s [=prompt handler
5736-
configuration/handler=].
5770+
1. Let |handler| be [=get navigable's user prompt handler=] with |type| and
5771+
|navigable|.
57375772

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

0 commit comments

Comments
 (0)