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

Add browsingContext.navigationCommitted event and wait for it when no wait condition is provided #855

Merged
merged 4 commits into from
Jan 31, 2025
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
69 changes: 54 additions & 15 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -2840,6 +2840,7 @@ BrowsingContextEvent = (
browsingContext.HistoryUpdated //
browsingContext.Load //
browsingContext.NavigationAborted //
browsingContext.NavigationCommitted //
browsingContext.NavigationFailed //
browsingContext.NavigationStarted //
browsingContext.UserPromptClosed //
Expand Down Expand Up @@ -3031,19 +3032,13 @@ To <dfn>await a navigation</dfn> given |navigable|, |request|, |wait condition|,
1. Assert: |navigate status|'s status is "<code>pending</code>" and
|navigation id| is not null.

1. If |wait condition| is "<code>none</code>":
1. If |wait condition| is "<code>committed</code>", let |event name| be
"<code>committed</code>".

1. Let |body| be a [=/map=] matching the
<code>browsingContext.NavigateResult</code> production, with the
<code>navigation</code> field set to |navigation id|, and the
<code>url</code> field set to the result of the [=URL serializer=] given
|navigate status|'s url.
1. Otherwise, if |wait condition| is "<code>interactive</code>", let |event name| be
"<code>domContentLoaded</code>".

1. Return [=success=] with data |body|.

1. If |wait condition| is "<code>interactive</code>", let |event name| be
"<code>domContentLoaded</code>", otherwise let |event name| be
"<code>load</code>".
1. Otherwise, let |event name| be "<code>load</code>".

1. Let (|event received|, |status|) be [=await=] given «|event name|,
"<code>download started</code>", "<code>navigation aborted</code>",
Expand Down Expand Up @@ -4268,8 +4263,11 @@ The [=remote end steps=] with <var ignore>session</var> and |command parameters|

1. Assert: |navigable| is not null.

1. Let |wait condition| be the value of the <code>wait</code> field of |command
parameters| if present, or "<code>none</code>" otherwise.
1. Let |wait condition| be "<code>committed</code>".

1. If |command parameters| [=map/contains=] <code>wait</code>
and |command parameters|[<code>wait</code>] is not "<code>none</code>",
set |wait condition| to |command parameters|[<code>wait</code>].
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
set |wait condition| to |command parameters|[<code>wait</code>].
set |wait condition| to |command parameters|[<code>wait</code>].
Note: "<code>none</code>" condition is a synonym for "<code>committed</code>".


1. Let |url| be the value of the <code>url</code> field of |command
parameters|.
Expand Down Expand Up @@ -4483,8 +4481,11 @@ The [=remote end steps=] with |command parameters| are:
1. Let |ignore cache| be the the value of the <code>ignoreCache</code> field of |command
parameters| if present, or false otherwise.

1. Let |wait condition| be the value of the <code>wait</code> field of |command
parameters| if present, or "<code>none</code>" otherwise.
1. Let |wait condition| be "<code>committed</code>".

1. If |command parameters| [=map/contains=] <code>wait</code>
and |command parameters|[<code>wait</code>] is not "<code>none</code>",
set |wait condition| to |command parameters|[<code>wait</code>].

1. Let |document| be |navigable|'s [=active document=].

Expand Down Expand Up @@ -5116,6 +5117,44 @@ aborted</dfn> steps given |navigable| and |navigation status|:

</div>

#### The browsingContext.navigationCommitted Event #### {#event-browsingContext-navigationCommitted}

<dl>
<dt>Event Type</dt>
<dd>
<pre class="cddl local-cddl">
browsingContext.NavigationCommitted = (
method: "browsingContext.navigationCommitted",
params: browsingContext.NavigationInfo
)
</pre>
</dd>
</dl>

<div algorithm>
The [=remote end event trigger=] is the <dfn export>WebDriver BiDi navigation committed</dfn> steps
given |navigable| and |navigation status|:

1. Let |params| be the result of [=get the navigation info=] given |navigable|
and |navigation status|.

1. Let |body| be a [=/map=] matching the
<code>browsingContext.NavigationCommitted</code> production, with the
<code>params</code> field set to |params|.

1. Let |related navigables| be a [=/set=] containing |navigable|.

1. Let |navigation id| be |navigation status|'s id.

1. [=Resume=] with "<code>navigation committed</code>", |navigation id|, and |navigation status|.

1. For each |session| in the [=set of sessions for which an event is enabled=]
given "<code>browsingContext.navigationCommitted</code>" and |related navigables|:

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

</div>


#### The browsingContext.navigationFailed Event #### {#event-browsingContext-navigationFailed}

Expand Down