mirror of
https://github.com/HeyPuter/firefox.git
synced 2026-11-25 02:40:22 -10:00
Automatic update from web-platform-tests Fix duplicate value of client hint headers on asynchronous validation requests Fix issue where asynchronous validation requests (specifically, revalidation on stale-while-revalidate requests) result in a duplicate value for client hint headers (i.e. `Sec-CH-UA: Chromium 76, Chromium 76` instead of `Sec-CH-UA: Chromium 76`) Bug: 959611 Change-Id: Iac16b84b129108b9ebe1258e11722cdc9eaa52de Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1645455 Commit-Queue: Aaron Tagliaboschi <[email protected]> Reviewed-by: Robert Ma <[email protected]> Reviewed-by: Yoav Weiss <[email protected]> Reviewed-by: Maks Orlovich <[email protected]> Cr-Commit-Position: refs/heads/master@{#694763} -- wpt-commits: 8b2e7c95c621390fbdb0c0c064c932016c22d224 wpt-pr: 17232
49 lines
1.4 KiB
HTML
49 lines
1.4 KiB
HTML
<!DOCTYPE html>
|
|
<meta charset="utf-8">
|
|
<title>Tests Stale While Revalidate is not executed for fetch API</title>
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
<script src="/common/utils.js"></script>
|
|
<script>
|
|
function wait25ms(test) {
|
|
return new Promise(resolve => {
|
|
test.step_timeout(() => {
|
|
resolve();
|
|
}, 25);
|
|
});
|
|
}
|
|
|
|
promise_test(async (test) => {
|
|
var request_token = token();
|
|
var client_hint_headers = [
|
|
"device-memory",
|
|
"dpr",
|
|
"width",
|
|
"viewport-width",
|
|
"rtt",
|
|
"downlink",
|
|
"ect",
|
|
"sec-ch-lang",
|
|
"sec-ch-ua",
|
|
"sec-ch-ua-arch",
|
|
"sec-ch-ua-platform",
|
|
"sec-ch-ua-model",
|
|
];
|
|
|
|
const response = await fetch(`resources/stale-echo-client-hints.py?token=` + request_token);
|
|
const response2 = await fetch(`resources/stale-echo-client-hints.py?token=` + request_token);
|
|
|
|
assert_equals(response.headers.get('Unique-Id'), response2.headers.get('Unique-Id'));
|
|
|
|
while(true) {
|
|
const revalidation_check = await fetch(`resources/stale-echo-client-hints.py?query&token=` + request_token);
|
|
if (revalidation_check.headers.get('Count') == '2') {
|
|
client_hint_headers.forEach(header => {
|
|
assert_equals(revalidation_check.headers.get(header+"-recieved"), revalidation_check.headers.get(header+"-previous"));
|
|
});
|
|
break;
|
|
}
|
|
await wait25ms(test);
|
|
}
|
|
}, 'Same headers sent for revalidation request');
|
|
</script> |