Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

responsePolicyContainer in "determine navigation params policy container" should be cloned for consistency #11060

Open
Lubrsi opened this issue Feb 20, 2025 · 2 comments
Labels

Comments

@Lubrsi
Copy link

Lubrsi commented Feb 20, 2025

What is the issue with the HTML Standard?

In determine navigation params policy container, step 4 states:

If responsePolicyContainer is not null, then return responsePolicyContainer.

The other steps in this algorithm either return a clone of a policy container, or a brand new policy container. responsePolicyContainer should be cloned to be consistent with the other steps.

This was noticed when implementing this algorithm in Ladybird:
https://github.com/LadybirdBrowser/ladybird/blob/1843a54df77f1b118bed07d92cafad4fef616f09/Libraries/LibWeb/HTML/Navigable.cpp#L640-L643

@domenic
Copy link
Member

domenic commented Feb 21, 2025

This generally appears to be kind of a mess. E.g. https://html.spec.whatwg.org/#beginning-navigation:determining-navigation-params-policy-container passes in a clone for the initiatorPolicyContainer argument, which is unnecessary. Other call sites do not.

I can't remember why we would or would not clone the policy containers here, so it might be equally valid to remove all the cloning.

@domenic domenic added topic: navigation topic: policy container The policy container proposal labels Feb 21, 2025
@annevk
Copy link
Member

annevk commented Feb 21, 2025

We need to clone policies when observing them "live" could result in race conditions. Imagine the referrer policy changing half-way through a fetch. That's something we want to avoid. (And realistically they'll have to pass a process boundary so some kind of copy will be needed anyway. So best to enforce that at a clear point in time.)

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Development

No branches or pull requests

3 participants