Add more `Sec-CH` Client Hint headers
Summary
Adds the following Client Heights as supported by Chrome:
Sec-CH-Device-MemorySec-CH-DPRSec-CH-Viewport-HeightSec-CH-Viewport-Width
Test results and supporting details
Visiting https://browserleaks.com/client-hints with Chrome shows the following:
Note that Sec-CH-Device-Memory is currently still specced as Device-Memory but I've opened a PR to change that
Device-Memory, DPR and Width were added in Chrome 97: https://chromestatus.com/feature/6658223894429696 (note Device-Memory was not noted there)
Height was added in Chrome 105: https://chromestatus.com/feature/5646861215989760
Related issues
MDN Content PR: https://github.com/mdn/content/pull/42351
Tip: Review these changes grouped by change (recommended for most PRs), or grouped by feature (for large PRs).
LGTM overall, just some nits about documenting alternative names.
Assuming I need
Accept-CH: Viewport-Widthto getViewport-Width, andAccept-CH: Sec-CH-Viewport-Widthto getSec-CH-Viewport-Width, maybe these aren't strictly equivalent
That is correct. You can in theory also ask for them both and get both! Though not sure why you'd want to do that...
but it might be useful for readers to find these mentioned in the BCD table of the corresponding
SEC-CH-*headers.
I think alternative_name is a good solution here. I'd still keep the old names as separate entries too since just using alternative_name would suggest the old names stopped working once the new names came along and that's not true.
Are there plans to remove those unprefixed headers, or does this depend on usage counts?
Yeah, ideally we'd drop them, but usage count is too high for that. Part of my reasoning for documenting this in MDN (and marking old names as deprecated) is an effort to push that along. Can't blame people for not switching when we only doucment the old ones! Anyway, TLDR I think they will continue to both be supported for some time.
Should be good for another look @caugner
FYI Sec-CH-Viewport-Height didn't have an old name as it was introduced after the migration.