@@ -53,6 +53,7 @@ spec: WEBDRIVER; urlPrefix: https://w3c.github.io/webdriver/
53
53
text: local end; url: dfn-local-ends
54
54
text: matched capability serialization algorithm; url: dfn-matched-capability-serialization-algorithm
55
55
text: maximum active sessions; url: dfn-maximum-active-sessions
56
+ text: no such alert; url: dfn-no-such-alert
56
57
text: no such element; url: dfn-no-such-element
57
58
text: no such frame; url: dfn-no-such-frame
58
59
text: process capabilities; url: dfn-processing-capabilities
@@ -130,14 +131,18 @@ spec: GEOMETRY; urlPrefix: https://drafts.fxtf.org/geometry/
130
131
spec: HTML; urlPrefix: https://html.spec.whatwg.org/multipage/
131
132
type: dfn
132
133
text: a browsing context is discarded; url: window-object.html#a-browsing-context-is-discarded
134
+ text: alert; url: timers-and-user-prompts.html#dom-alert
133
135
text: close; url: window-object.html#close-a-browsing-context
134
136
text: create a classic script; url: webappapis.html#creating-a-classic-script
135
137
text: create a new browsing context; url: browsers.html#creating-a-new-browsing-context
138
+ text: confirm; url: timers-and-user-prompts.html#dom-confirm
136
139
text: default classic script fetch options; url: webappapis.html#default-classic-script-fetch-options
137
140
text: environment settings object's Realm; url: webappapis.html#environment-settings-object's-realm
138
141
text: handled; url: webappapis.html#concept-error-handled
139
142
text: history handling behavior; url: browsing-the-web.html#history-handling-behavior
140
143
text: navigation id; url: browsing-the-web.html#navigation-id
144
+ text: prompt; url: timers-and-user-prompts.html#dom-prompt
145
+ text: prompt to unload; url: browsing-the-web.html#prompt-to-unload-a-document
141
146
text: report an error; url: webappapis.html#report-the-error
142
147
text: remove a browsing context; url: browsers.html#bcg-remove
143
148
text: run the animation frame callbacks; url: imagebitmap-and-animations.html#run-the-animation-frame-callbacks
@@ -2460,6 +2465,7 @@ BrowsingContextCommand = (
2460
2465
BrowsingContextCloseCommand //
2461
2466
BrowsingContextCreateCommand //
2462
2467
BrowsingContextGetTreeCommand //
2468
+ BrowsingContextHandleUserPromptCommand //
2463
2469
BrowsingContextNavigateCommand //
2464
2470
BrowsingContextReloadCommand
2465
2471
)
@@ -2485,7 +2491,9 @@ BrowsingContextEvent = (
2485
2491
BrowsingContextLoadEvent //
2486
2492
BrowsingContextDownloadWillBegin //
2487
2493
BrowsingContextNavigationAbortedEvent //
2488
- BrowsingContextNavigationFailedEvent
2494
+ BrowsingContextNavigationFailedEvent //
2495
+ BrowsingContextUserPromptClosedEvent //
2496
+ BrowsingContextUserPromptOpenedEvent
2489
2497
)
2490
2498
2491
2499
</pre>
@@ -2953,6 +2961,70 @@ The [=remote end steps=] with <var ignore>session</var> and |command parameters|
2953
2961
2954
2962
</div>
2955
2963
2964
+ #### The browsingContext.handleUserPrompt Command #### {#command-browsingContext-handleUserPrompt}
2965
+
2966
+ The <dfn export for=commands>browsingContext.handleUserPrompt</dfn>
2967
+ command allows closing an open prompt
2968
+
2969
+ <dl>
2970
+ <dt> Command Type</dt>
2971
+ <dd>
2972
+ <pre class="cddl remote-cddl">
2973
+ BrowsingContextHandleUserPromptCommand = {
2974
+ method: "browsingContext.handleUserPrompt",
2975
+ params: BrowsingContextHandleUserPromptParameters
2976
+ }
2977
+
2978
+ BrowsingContextHandleUserPromptParameters = {
2979
+ context: BrowsingContext,
2980
+ ? accept: bool,
2981
+ ? userText: text,
2982
+ }
2983
+ </pre>
2984
+ </dd>
2985
+ <dt> Return Type</dt>
2986
+ <dd>
2987
+ <pre class="cddl local-cddl">
2988
+ EmptyResult
2989
+ </pre>
2990
+ </dd>
2991
+ </dl>
2992
+
2993
+ <div algorithm="remote end steps for browsingContext.handleUserPrompt">
2994
+
2995
+ 1. Let |context id| be the value of the <code> context</code> field of
2996
+ |command parameters|.
2997
+
2998
+ 1. Let |context| be the result of [=trying=] to [=get a browsing context=]
2999
+ with |context id|.
3000
+
3001
+ 1. Let |accept| be the value of the <code> accept</code> field of |command
3002
+ parameters| if present, or true otherwise.
3003
+
3004
+ 1. Let |text| be the value of the <code> text</code> field of |command
3005
+ parameters| if present, or the empty string otherwise.
3006
+
3007
+ 1. If |context| is currently showing a simple dialog from a call to [=alert=] then
3008
+ acknowledge the prompt.
3009
+
3010
+ Otherwise if |context| is currently showing a simple dialog from a call to
3011
+ [=confirm=] , then respond positively if |accept| is true, or respond
3012
+ negatively if |accept| is false.
3013
+
3014
+ Otherwise if |context| is currently showing a simple dialog from a call to
3015
+ [=prompt=] , then respond with the string value |text| if |accept| is
3016
+ true, or abort if |accept| is false.
3017
+
3018
+ Otherwise, if |context| is currently showing a prompt as part of the [=prompt
3019
+ to unload=] steps, then confirm the navigation if |accept| is true, otherwise
3020
+ refuse the navigation.
3021
+
3022
+ Otherwise return [=error=] with [=error code=] [=no such alert=] .
3023
+
3024
+ 1. Return [=success=] with data null.
3025
+
3026
+ </div>
3027
+
2956
3028
#### The browsingContext.navigate Command #### {#command-browsingContext-navigate}
2957
3029
2958
3030
The <dfn export for=commands>browsingContext.navigate</dfn> command navigates a
@@ -3461,6 +3533,96 @@ failed</dfn> steps given |context| and |navigation status|:
3461
3533
3462
3534
</div>
3463
3535
3536
+ #### The browsingContext.userPromptClosed Event #### {#event-browsingContext-userPromptClosed}
3537
+
3538
+ <dl>
3539
+ <dt> Event Type</dt>
3540
+ <dd>
3541
+ <pre class="cddl local-cddl">
3542
+ BrowsingContextUserPromptClosedEvent = {
3543
+ method: "browsingContext.userPromptClosed",
3544
+ params: UserPromptInfo
3545
+ }
3546
+ UserPromptResult = {
3547
+ context: BrowsingContext,
3548
+ accepted: bool,
3549
+ ? userText: text
3550
+ }
3551
+ </pre>
3552
+ </dd>
3553
+ </dl>
3554
+
3555
+ <div algorithm>
3556
+ The [=remote end event trigger=] is the <dfn export>WebDriver BiDi user prompt
3557
+ closed</dfn> steps given |window|, |accepted| and optional |user text|
3558
+ (default: null).
3559
+
3560
+ 1. Let |context| be |window|'s [=browsing context=] .
3561
+
3562
+ 1. Let |context id| be the [=browsing context id=] for |context|.
3563
+
3564
+ 1. Let |params| be a [=map=] matching the <code> UserPromptResult</code>
3565
+ production with the <code> context</code> field set to |context id|, the
3566
+ <code> accepted</code> field set to |accepted|, and the <code> userText</code> field set
3567
+ to |user text| if |user text| is not null or omitted otherwise.
3568
+
3569
+ 1. Let |body| be a [=map=] matching the
3570
+ <code> BrowsingContextUserPromptClosed</code> production, with the
3571
+ <code> params</code> field set to |params|.
3572
+
3573
+ 1. Let |related browsing contexts| be a [=set=] containing |context|.
3574
+
3575
+ 1. For each |session| in the [=set of sessions for which an event is enabled=]
3576
+ given "<code> browsingContext.userPromptClosed</code> " and |related browsing contexts|:
3577
+
3578
+ 1. [=Emit an event=] with |session| and |body|.
3579
+
3580
+ </div>
3581
+
3582
+ #### The browsingContext.userPromptOpened Event #### {#event-browsingContext-userPromptOpened}
3583
+
3584
+ <dl>
3585
+ <dt> Event Type</dt>
3586
+ <dd>
3587
+ <pre class="cddl local-cddl">
3588
+ BrowsingContextUserPromptOpenedEvent = {
3589
+ method: "browsingContext.userPromptOpened",
3590
+ params: UserPromptInfo
3591
+ }
3592
+ UserPromptInfo = {
3593
+ context: BrowsingContext,
3594
+ type: "alert" / "confirm" / "prompt" / "beforeunload",
3595
+ message: text
3596
+ }
3597
+ </pre>
3598
+ </dd>
3599
+ </dl>
3600
+
3601
+ <div algorithm>
3602
+ The [=remote end event trigger=] is the <dfn export>WebDriver BiDi user prompt
3603
+ opened</dfn> steps given |window|, |type| and |message|.
3604
+
3605
+ 1. Let |context| be |window|'s [=browsing context=] .
3606
+
3607
+ 1. Let |context id| be the [=browsing context id=] for |context|.
3608
+
3609
+ 1. Let |params| be a [=map=] matching the <code> UserPromptInfo</code>
3610
+ production with the <code> context</code> field set to |context id|, the
3611
+ <code> type</code> field set to |type|, and the <code> message</code> field set
3612
+ to |message|.
3613
+
3614
+ 1. Let |body| be a [=map=] matching the
3615
+ <code> BrowsingContextUserPromptOpened</code> production, with the
3616
+ <code> params</code> field set to |params|.
3617
+
3618
+ 1. Let |related browsing contexts| be a [=set=] containing |context|.
3619
+
3620
+ 1. For each |session| in the [=set of sessions for which an event is enabled=]
3621
+ given "<code> browsingContext.userPromptOpened</code> " and |related browsing contexts|:
3622
+
3623
+ 1. [=Emit an event=] with |session| and |body|.
3624
+
3625
+ </div>
3464
3626
3465
3627
## The script Module ## {#module-script}
3466
3628
0 commit comments