-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
What should happen when the last valid <meta name="referrer" content="..."> tag is removed? #8525
Comments
Yeah, that seems totally broken. Good catch! I can't find any good tests for this part of the spec in a quick browse through https://wpt.fyi/results/referrer-policy?label=experimental&label=master&aligned . I think the best path here is:
Another thing which this section of the spec implies which I don't see tested is that if such meta elements are inside a shadow tree, they should not have any impact. Fun... |
FWIW, I was reading some relevant code in Firefox and I think it is also following the current spec where removing meta doesn't change anything. And it is also doing the same as Chrome that it uses that last meta valid element, not tree order. cc @sefeng211 |
@a4sriniv wrote some tests for the current spec behavior in web-platform-tests/wpt#37095. According to https://wpt.fyi/results/referrer-policy/generic?label=pr_head&max-count=1&pr=37095, nobody passes them. It sounds likely that Chrome and Firefox have the same behavior here, and maybe Safari too. (We'll work to confirm that with tests.) In that case, are people generally OK with changing the spec to match implementations? Or do they think the spec is good and we should try to do a coordinated implementation move? I guess we should also investigate theme-color and color-scheme, which use similar (but not the same...) algorithms. |
It turns out they only look at the most-recently-inserted-or-mutated <meta> element. Closes #8525.
@a4sriniv updated his tests and confirm that everyone matches Chrome's behavior. So, I put up a PR in #8587 to fix that. I think we should just merge that, and if we want to reconsider changing to better behavior in the future, we can do that separately. I investigated theme-color, color-scheme, and supports-reduced-motion for Chromium (source), and they all work in the more-reasonable way the current spec suggests. |
It turns out they only look at the most-recently-inserted-or-mutated <meta> element. Closes #8525.
It turns out they only look at the most-recently-inserted-or-mutated <meta> element. Closes whatwg#8525.
Context: https://html.spec.whatwg.org/multipage/semantics.html#meta-referrer
My interpretation of the current spec is that when we remove the last valid
<meta name="referrer">
, we just leave the document's referrer policy unchanged. But that isn't consistent with the scenario where we have two valid<meta name="referrer">
s and we removed one of them; in that situation the document's referrer policy is updated to the policy specified by the remaining<meta>
. To me the expected behaviour for scenario 1 would be to reset the document's referrer policy to the default (whatever it was before we encountered the first<meta>
tag, so either the value in the response-header or "strict-origin-when-cross-origin").Chromium's implementation seems to not change the document's referrer policy in both scenarios, which doesn't seem right to me either. It also sets the document's referrer policy to the policy of the last valid that has been processed ("processed" here also includes any modifications to the content attribute). This doesn't follow the spec which says that we should use the last valid
<meta name="referrer">
in tree order.The text was updated successfully, but these errors were encountered: