Referrer Policy 介绍「续」

提醒:本文最后更新于 3243 天前,文中所描述的信息可能已发生改变,请谨慎使用。

在「Referrer Policy 介绍」这篇文章的评论中,我提出了一个困惑:

通过 CSP 头部设置「Origin When Cross-origin」策略时,指令值应该用 origin-when-cross-origin,这跟 <meta> 用的 origin-when-crossorigin 不统一。我测试了一下,Chrome 42 的 CSP 和 <meta> 都只支持 origin-when-crossorigin,不支持 origin-when-cross-origin,这样也挺好的,只是跟文档不一致了。不知道后面是文档变还是 Chrome 变。

简单说就是 Chrome 42 的实现和文档不一致,文档本身也不统一。对同一个东西,出现了中间有横线和没横线两种写法。

为了把这个问题搞清楚,我给 public-webapps 邮件组发了邮件咨询。今天收到了 Chrome 一位工程师的答复:

Yup. Typos are fun. Thanks for the bug report!

I've fixed the spec in https://github.com/w3c/webappsec/commit/c992d5cd9c93eaa509ee499efd7ef8f5ab9811d8; I'll upload a patch for Chrome later today.

好吧,没想到理由如此简单粗暴,居然是疏忽拼错了。点开他的 commit 一看,果然,所有 origin-when-crossorigin 都被改成了 origin-when-cross-origin。今天晚些时候他还会把 Chrome 也改一下。

有趣的是,之前的文档只搞错了一部分(只在 <meta> 这一节拼错),Chrome 却把 CSP 和 <meta> 都给实现错了。这是有多心不在焉。。。

然后有同学就在邮件组问了:

So to be absolutely clear, this means there should always be a dash between "cross" and "origin" in the referrer policy tokens, right?

那个犯错的同学回复是:

Yes. That was a typo in the spec.

Since Chrome already ships -crossorigin and sites already use it, we'll probably need to leave that alias in as well, though. Sorry about that. My fault. :/

一失足成千古恨,Chrome 就是这样变臃肿的么?23333333~

好了,这篇短文就写到这。以后再写写其他有关 Web 标准协议的好玩事情。

本文链接:https://imququ.com/post/referrer-policy-2.html参与评论 »

--EOF--

提醒:本文最后更新于 3243 天前,文中所描述的信息可能已发生改变,请谨慎使用。

专题「HTTP 相关」的其他文章 »

Comments