Skip to content

Commit

Permalink
Bug 1588802 [wpt PR 19701] - Implement Sec-CH-UA-Mobile, a=testonly
Browse files Browse the repository at this point in the history
Automatic update from web-platform-tests
Implement `Sec-CH-UA-Mobile`

Mobile is a boolean client hint that informs whether a "mobile" or
"desktop" user experience should be supplied.

Relevant changes to the spec can be found here:
WICG/ua-client-hints#8
That was manually added via this commit:
WICG/ua-client-hints@db6fab2

Bug: 928669
Change-Id: Ia983cfa516c28b6a747b270abcc44e71ed39e1b5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1829793
Commit-Queue: Aaron Tagliaboschi <aarontag@chromium.org>
Reviewed-by: Yoav Weiss <yoavweiss@chromium.org>
Reviewed-by: Dominick Ng <dominickn@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Takashi Toyoshima <toyoshim@chromium.org>
Cr-Commit-Position: refs/heads/master@{#723037}

--

wpt-commits: 98e81ec707999187b087b3671e93a3625188b35a
wpt-pr: 19701
  • Loading branch information
amtunlimited authored and moz-wptsync-bot committed Dec 11, 2019
1 parent 226e0f6 commit 6157b99
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@

assert_in_array(r.headers.get("ect-received"), ["slow-2g", "2g",
"3g", "4g"], 'ect-received is unexpected');

assert_true(r.headers.has("mobile-received"));
assert_in_array(r.headers.get("mobile-received"), ["?0", "?1"], 'mobile is unexpected');
});
}, "Accept-CH header test");

Expand All @@ -53,6 +56,7 @@
assert_false(r.headers.has("rtt-received"), "rtt-received");
assert_false(r.headers.has("downlink-received"), "downlink-received");
assert_false(r.headers.has("ect-received"), "ect-received");
assert_false(r.headers.has("mobile-received"), "mobile-received");
});
}, "Cross-Origin Accept-CH header test");

Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Accept-CH: device-memory, dpr, viewport-width, rtt, downlink, ect, lang
Feature-Policy: ch-device-memory *; ch-dpr 'none'; ch-viewport-width 'self'; ch-lang 'none'
Accept-CH: device-memory, dpr, viewport-width, rtt, downlink, ect, lang, mobile
Feature-Policy: ch-device-memory *; ch-dpr 'none'; ch-viewport-width 'self'; ch-lang 'none'; ch-mobile
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ def main(request, response):
response.headers.set("ect-received", request.headers.get("ect"))
if "Sec-CH-Lang" in request.headers:
response.headers.set("lang-received", request.headers.get("Sec-CH-Lang"))
if "sec-ch-ua-mobile" in request.headers:
response.headers.set("mobile-received", request.headers.get("sec-ch-ua-mobile"))

0 comments on commit 6157b99

Please sign in to comment.