-
Notifications
You must be signed in to change notification settings - Fork 331
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
Align CH processing model with implementation and HTML#3774 #773
Conversation
fetch.bs
Outdated
<dfn export for=request id=concept-request-client-hints-list>client hints list</dfn>, | ||
which is a <a lt="client hints list" for=client>client-hints list</a>. Unless stated | ||
otherwise, it is the empty list. | ||
<dfn export for=request id=concept-request-client-hints-set>client hints set</dfn>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's preserve the original ID. I don't think it matters much that it doesn't match the text anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
fetch.bs
Outdated
which is a <a lt="client hints list" for=client>client-hints list</a>. Unless stated | ||
otherwise, it is the empty list. | ||
<dfn export for=request id=concept-request-client-hints-set>client hints set</dfn>, | ||
which is a <a lt="client hints set" for=client>client-hints set</a>. Unless stated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A primitive cannot belong to something else. I guess this was originally wrong as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When is the hyphen to be used by the way? I'd rather consistently use or not use it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed "for=client".
Agreed regarding consistency. Added hyphen everywhere.
fetch.bs
Outdated
@@ -1825,14 +1825,14 @@ run these steps: | |||
</ol> | |||
|
|||
|
|||
<h3 id=client-hints-list>Client hints list</h3> | |||
<h3 id=client-hints-set>Client hints set</h3> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ID preservation please.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
fetch.bs
Outdated
|
||
<p class=note>This section will be integrated into HTTP Client Hints. | ||
[[!CLIENT-HINTS]] | ||
<!-- XXX --> | ||
|
||
<p>A <dfn export id=concept-client-hints-list for=client>client hints list</dfn> is a | ||
<a for=/>list</a> of | ||
<p>A <dfn export id=concept-client-hints-set for=client>client hints set</dfn> is a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we should remove for=client here since it doesn't actually belong to a client, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
fetch.bs
Outdated
@@ -2640,6 +2640,10 @@ the request. | |||
<a for=request>origin</a> to <var>request</var>'s | |||
<a for=request>client</a>'s <a for="environment settings object">origin</a>. | |||
|
|||
<li><p>Set <var>request</var>'s <a for=request>client-hints set</a> to be a copy of the <a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
client-hints set won't link due to the hyphen. Also, instead of copy you want https://infra.spec.whatwg.org/#list-clone.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a direct link to the definition, but not sure that's the best way to do that. Let me know if there's a better way
fetch.bs
Outdated
<p>If <var>request</var> is a <a>subresource request</a>, then: | ||
<p>If <var>request</var>'s <a for=request>current url</a>'s | ||
<a for=url>origin</a> is <a>same origin</a> with <var>request</var>'s | ||
<a for=request>origin</a>, then: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This means that a cross-origin URL inbetween doesn't influence this. I'm not sure that's what we want? Also, can we not obtain this state from something else that has already done the check? Lots of independent same-origin checks seem like a code smell.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This means that a cross-origin URL inbetween doesn't influence this
Do you mean a cross-origin redirection between two same origin requests? or something else?
fetch.bs
Outdated
|
||
<ol> | ||
<li> | ||
<li> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One space indentation was correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
fetch.bs
Outdated
<p><a for=list>For each</a> <var>hintName</var> of <var>request</var>'s | ||
<a for=client>client hints list</a>: | ||
<a for=client>client-hints set</a>: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hyphen again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ack
</ol> | ||
</ol> | ||
|
||
<li><p>If <var>request</var> is a <a>subresource request</a>, then: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The indentation is off here as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ack
@yoavweiss same-origin request -> redirect to cross-origin URL -> redirect to same-origin URL. |
fetch.bs
Outdated
@@ -2640,6 +2640,11 @@ the request. | |||
<a for=request>origin</a> to <var>request</var>'s | |||
<a for=request>client</a>'s <a for="environment settings object">origin</a>. | |||
|
|||
<li><p>Set <var>request</var>'s <a for=request>client-hints set</a> to be a <a | |||
href="https://infra.spec.whatwg.org/#list-clone">clone</a> of the <a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use <a for=list>clone</a>
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, no newlines inside tags or inline elements (slightly different rules from HTML, sorry).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A comment message detailing the changes made here would help. It also seems this adds more Client-Hints headers that are not CORS-safelisted. Is that intentional?
fetch.bs
Outdated
|
||
<p class=note>This section will be integrated into HTTP Client Hints. | ||
<p class=note>This section will be integrated into HTTP Client-Hints. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that still the plan? In any event, this section should have a <p class=XXX>
explaining that currently the integration is not well defined.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what further integration is needed, tbh. I'll change to "XXX"
fetch.bs
Outdated
<li> | ||
|
||
<p class=note>The following step should be applicable only for same-origin requests. See | ||
<a href="https://github.com/whatwg/fetch/issues/800">issue</a> for more details.</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be class=XXX and should be placed at the end of the step per convention.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ack
those are added to the list at #725 |
I'll squash and add a meaningful commit message |
dd44296
to
ee93d96
Compare
fetch.bs
Outdated
|
||
<p class=note>This section will be integrated into HTTP Client Hints. | ||
<p class=XXX>This section will be integrated into HTTP Client-Hints. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for being unclear, this issue marker should indicate that Client Hints integration with Fetch is far from finished, similar to the issue marker you added below. I was thinking it would be good to stress that in multiple places.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to point at #726
Let me know if that works
The commit message needs to explain the removal of DPR and Viewport-Width from the first table as well. |
df666da
to
bea7cde
Compare
added |
Having considered this further I'm not sure how to accept this as it has the same problems as #725:
|
This is currently implemented by Chromium, but not elsewhere. What's the typical process for integrating such features before they gain wider adoption?
That is not true. See https://wpt.fyi/results/client-hints?label=experimental
Are you suggesting that we need the feature policy (w3c/webappsec-permissions-policy#129) and redirection logic (#800) pieces in place before any of this can land? |
@yoavweiss typically we don't merge until there's at least two implementers committed to some extent (no need for two implementations). As for tests, I meant tests covering the problematic bits. And since the redirection logic is vital to how this ends up being defined, yes. It would be less problematic if that were a simple change, but basically all the existing infrastructure is in the wrong place for it, and we might need new primitives as well depending on how we deal with UA-set vs developer-set headers. |
https://whatwg.org/working-mode#changes has a more formal description of WHATWG's changes policy. |
I agree that the redirection logic is critical once we start doing same-origin checks. This PR (as well as current Chromium implementation) does not do that. And indeed, things may move once that logic is settled and lands. At the same time, I thought it'd be worthwhile to define the current behavior and then iterate on that. (as the current spec definition doesn't match the current implementation) |
2f8047a
to
d73c83b
Compare
<p>A <dfn export id=concept-client-hints-list for=client>client hints list</dfn> is a | ||
<a for=/>list</a> of | ||
<p>A <dfn export id=concept-client-hints-list>client-hints set</dfn> is a | ||
<a for=/>set</a> of | ||
<a href=http://httpwg.org/http-extensions/client-hints.html#accept-ch>Client hint tokens</a>, each | ||
of which is one of `<code>DPR</code>`, `<code>Save-Data</code>`, `<code>Viewport-Width</code>`, or | ||
`<code>Width</code>`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add the other new hints here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup
This change aligns the processing of Client-Hints with the shipped Chromium implementation, by changing the following: * Clone the environment settings object's client-hints set to the request's client-hints set. * Apply CH processing to all requests, rather than only subresource requests. * Add processing of new CH headers, added in whatwg#725 * Remove `DPR` and `Viewport-Width` from headers that are sent by default for navigation requests. It also renames "client-hints list" to "client-hints set", and changes it to be a set, to match related HTML spec changes.
56c7c7b
to
5067615
Compare
I've moved most of the processing defined in this PR to https://yoavweiss.github.io/client-hints-infrastructure/ I'm therefore closing this PR. |
This PR tackles a part of #726, by copying the request's client-hints list from the environment settings object's one (as defined in whatwg/html#3774). It also aligns the addition of CH headers to current implementations, and adds the Device-Memory, RTT, Downlink and ECT hints.
Preview | Diff