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

Specify navigation committed event #855

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

OrKoN
Copy link
Contributor

@OrKoN OrKoN commented Jan 13, 2025

Closes #788
HTML spec: whatwg/html#10910


Preview | Diff

@OrKoN OrKoN force-pushed the orkon/navigation-committed branch from 1573c2f to 31fd732 Compare January 13, 2025 13:07
@OrKoN OrKoN requested a review from sadym-chromium January 13, 2025 13:07
@OrKoN OrKoN changed the title Handle navigation committed event Specify navigation committed event Jan 13, 2025
index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
@@ -3168,7 +3173,7 @@ To <dfn>get the navigation info</dfn>, given |navigable| and |navigation status|
#### The browsingContext.ReadinessState Type #### {#type-browsingContext-ReadinessState}

<pre class="cddl remote-cddl">
browsingContext.ReadinessState = "none" / "interactive" / "complete"
browsingContext.ReadinessState = "none" / "committed" / "interactive" / "complete"
Copy link
Contributor

Choose a reason for hiding this comment

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

So this means that we are fine for the wait argument of browsingContext.navigate to allow committed as well? Asking because it causes a side-effect.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Could you please clarify what you mean by the side-effect?

Copy link
Contributor

Choose a reason for hiding this comment

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

So far we spoke about a committed event but not that we have another readiness state that could be used by other APIs to control the navigation flow like for browsingContext.navigate. In the current form this value for the wait argument wouldn't be denied but also not used in await a navigation because we don't have a check. So it's basically a no-op.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe the value is checked on line 3045 (part of the await navigation algorithm you linked) so it does not appear to be no-op. I think it's needed for internal consistency but we can discuss it separately.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah indeed. Even through I opened the preview in a different tab I actually checked the public BiDi spec page. Sorry for that.

While investigating some more Playwright tests I saw the following:

await page.goto(server.EMPTY_PAGE, { waitUntil: 'commit' })

Is that a condition that would help Puppeteer users as well that we should add to the navigate steps to return on the committed step? Or do it in a follow-up PR?

Copy link
Contributor

Choose a reason for hiding this comment

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

No that is fine. So lets keep it in. Thanks.

It would be great if you could actually write some WPT tests for the event and the wait argument given that it seems to be easy for you to add support for committed (CDP already supports it).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I filed GoogleChromeLabs/chromium-bidi#2982 to write the tests as part of the implementation.

Copy link
Member

Choose a reason for hiding this comment

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

I tend to think we want this to continue to match the document.readyState property, but for the purposes of awaiting a navigation make "none" work like "committed", unless we have a use case where you really don't even care if the navigation started or not, but still need the return value of the command for some reason.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I guess if we are not concerned about breaking changes, I am in favor of replacing none to mean committed (cc @sadym-chromium)

Copy link
Contributor

Choose a reason for hiding this comment

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

I am in favor of replacing none to mean committed

YES!

Copy link
Contributor

@whimboo whimboo left a comment

Choose a reason for hiding this comment

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

What should we do with the browsingContext.navigationAborted event? Should we deprecate it? See #788 (comment)

index.bs Outdated Show resolved Hide resolved
@@ -3168,7 +3173,7 @@ To <dfn>get the navigation info</dfn>, given |navigable| and |navigation status|
#### The browsingContext.ReadinessState Type #### {#type-browsingContext-ReadinessState}

<pre class="cddl remote-cddl">
browsingContext.ReadinessState = "none" / "interactive" / "complete"
browsingContext.ReadinessState = "none" / "committed" / "interactive" / "complete"
Copy link
Contributor

Choose a reason for hiding this comment

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

No that is fine. So lets keep it in. Thanks.

It would be great if you could actually write some WPT tests for the event and the wait argument given that it seems to be easy for you to add support for committed (CDP already supports it).

@OrKoN
Copy link
Contributor Author

OrKoN commented Jan 15, 2025

What should we do with the browsingContext.navigationAborted event? Should we deprecate it? See #788 (comment)

what is the specific reason for deprecating navigationAborted? I think we can discuss it separately.

Co-authored-by: Henrik Skupin <[email protected]>
@OrKoN OrKoN requested a review from jgraham January 15, 2025 08:08
@whimboo
Copy link
Contributor

whimboo commented Jan 15, 2025

What should we do with the browsingContext.navigationAborted event? Should we deprecate it? See #788 (comment)

what is the specific reason for deprecating navigationAborted? I think we can discuss it separately.

See the details in the referenced comment. That's all what I got. Happy to move it to a follow-up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Request for a navigationCommitted event to inform immediately about the navigation status
4 participants