Skip to content

Commit

Permalink
Add browsingContext.navigationCommitted event and wait for it when no…
Browse files Browse the repository at this point in the history
… wait condition is provided (#855)

* Handle navigation committed event

* Update index.bs

* Update index.bs

Co-authored-by: Henrik Skupin <[email protected]>

* default to committed for none

---------

Co-authored-by: Henrik Skupin <[email protected]>
  • Loading branch information
OrKoN and whimboo authored Jan 31, 2025
1 parent d1d5f2a commit 0713f9c
Showing 1 changed file with 54 additions and 15 deletions.
69 changes: 54 additions & 15 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -2952,6 +2952,7 @@ BrowsingContextEvent = (
browsingContext.HistoryUpdated //
browsingContext.Load //
browsingContext.NavigationAborted //
browsingContext.NavigationCommitted //
browsingContext.NavigationFailed //
browsingContext.NavigationStarted //
browsingContext.UserPromptClosed //
Expand Down Expand Up @@ -3143,19 +3144,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 @@ -4382,8 +4377,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>].

1. Let |url| be the value of the <code>url</code> field of |command
parameters|.
Expand Down Expand Up @@ -4599,8 +4597,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 @@ -5232,6 +5233,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

0 comments on commit 0713f9c

Please sign in to comment.