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

Recalculate network status when navigation ends #215

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

Conversation

xiaochen-z
Copy link
Collaborator

@xiaochen-z xiaochen-z commented Feb 25, 2025

Fix #214.

After some investigations, it seems adding the recalculation step in set the ongoing navigation algorithm makes the most sense.

The only similar feature in the current standard is the navigation API, which has two promises. Their resolution or rejection are done when certain navigation events are fired. See:

However, these promises are only relevant for navigations that are intercepted by the navigation API. When a cross-site navigation is not intercepted by the navigation API, no resolution or rejection steps are run on the promises because they will disappear together with the current document, as stated in the explainer (See the last paragraph in the linked section):

And if they are non-intercepted cross-document navigations, then the returned promises, along with the entire JavaScript global environment, will disappear as the current document gets unloaded.

So simply adding the recalculation steps to where navigation API resolves its promises does not work as the cross-document navigation cases are not handled.

In the implementation, the network status recalculation is done whenever a navigation ends. In other words, when a frame changes from having an ongoing navigation, to not having an ongoing navigation. So it appears set the ongoing navigation algorithm is the best place to add this step because it is the centralized place where the ongoing navigation state is changed.

There was a previous PR that briefly touched on how to spec this, see this comment.


Preview | Diff

@xiaochen-z xiaochen-z added the specification Additions to specifications label Feb 25, 2025
@xiaochen-z xiaochen-z marked this pull request as ready for review March 4, 2025 15:52
@xiaochen-z xiaochen-z requested a review from blu25 March 4, 2025 15:53
@xiaochen-z
Copy link
Collaborator Author

+@blu25 for the first scan. Thank you.

Copy link
Collaborator

@blu25 blu25 left a comment

Choose a reason for hiding this comment

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

LGTM

@xiaochen-z xiaochen-z requested a review from domfarolino March 5, 2025 18:41
@xiaochen-z
Copy link
Collaborator Author

  • @domfarolino for review. I've added some findings in the PR description since I last discussed where to spec this with you. Thanks!

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

Successfully merging this pull request may close these issues.

[Spec] Untrusted network status needs to be recalculated every time a navigation ends.
2 participants