Recalculate network status when navigation ends #215
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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):
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