Skip to content

Commit cc9a9ea

Browse files
ArthurSonzognimoz-wptsync-bot
authored andcommitted
Bug 1723558 [wpt PR 29867] - WPT: Tentative test HTTP cache vs credentials., a=testonly
Automatic update from web-platform-tests WPT: Tentative test HTTP cache vs credentials. Add a test. Check whether the HTTP cache discriminate the credentialled requests from the anonymous ones. The expectations used are the ones from the specification. That's also Firefox's behavior. Chrome fails the test. Safari fail similarly + do not support SharedWorker. At some point, we would like to make Chrome to converge with the spec, or update with the specification. whatwg/fetch issue: whatwg/fetch#307 whatwg/fetch#1253 Design doc: https://docs.google.com/document/d/1lvbiy4n-GM5I56Ncw304sgvY5Td32R6KHitjRXvkZ6U/edit# Test results: https://github.com/web-platform-tests/wpt/pull/29867/checks?check_run_id=3279839968 ``` ┌────────────────────────────────────────────┬───────┬───────┬────────┐ │Test │ Chrome│ Safari│ Firefox│ ├────────────────────────────────────────────┼───────┼───────┼────────┤ │credentials.tentative.any.html │ 1/3 │ 1/3 │ 3/3 │ ├────────────────────────────────────────────┼───────┼───────┼────────┤ │credentials.tentative.any.serviceworker.html│ 1/3 │ 1/3 │ 3/3 │ ├────────────────────────────────────────────┼───────┼───────┼────────┤ │credentials.tentative.any.sharedworker.html │ 1/3 │ 0/3 │ 3/3 │ ├────────────────────────────────────────────┼───────┼───────┼────────┤ │credentials.tentative.any.worker.html │ 1/3 │ 1/3 │ 3/3 │ └────────────────────────────────────────────┴───────┴───────┴────────┘ ``` Bug: 1221529 Change-Id: I0537108f473f37f42eef7b4fa1079cd88d987b62 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3066251 Reviewed-by: Maksim Orlovich <[email protected]> Commit-Queue: Arthur Sonzogni <[email protected]> Cr-Commit-Position: refs/heads/master@{#909780} -- wpt-commits: 7d357243857d2ae0383120c22d43cd1b1b6fc371 wpt-pr: 29867
1 parent 1010ae5 commit cc9a9ea

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
// META: global=window,worker
2+
// META: title=HTTP Cache - Content
3+
// META: timeout=long
4+
// META: script=/common/utils.js
5+
// META: script=http-cache.js
6+
7+
// This is a tentative test.
8+
// Firefox behavior is used as expectations.
9+
//
10+
// whatwg/fetch issue:
11+
// https://github.com/whatwg/fetch/issues/1253
12+
//
13+
// Chrome design doc:
14+
// https://docs.google.com/document/d/1lvbiy4n-GM5I56Ncw304sgvY5Td32R6KHitjRXvkZ6U/edit#
15+
16+
const request_cacheable = {
17+
request_headers: [],
18+
response_headers: [
19+
['Cache-Control', 'max-age=3600'],
20+
],
21+
// TODO(arthursonzogni): The behavior is tested only for same-origin requests.
22+
// It must behave similarly for cross-site and cross-origin requests. The
23+
// problems is the http-cache.js infrastructure returns the
24+
// "Server-Request-Count" as HTTP response headers, which aren't readable for
25+
// CORS requests.
26+
base_url: location.href.replace(/\/[^\/]*$/, '/'),
27+
};
28+
29+
const request_credentialled = { ...request_cacheable, credentials: 'include', };
30+
const request_anonymous = { ...request_cacheable, credentials: 'omit', };
31+
32+
const responseIndex = count => {
33+
return {
34+
expected_response_headers: [
35+
['Server-Request-Count', count.toString()],
36+
],
37+
}
38+
};
39+
40+
var tests = [
41+
{
42+
name: 'same-origin: 2xAnonymous, 2xCredentialled, 1xAnonymous',
43+
requests: [
44+
{ ...request_anonymous , ...responseIndex(1)} ,
45+
{ ...request_anonymous , ...responseIndex(1)} ,
46+
{ ...request_credentialled , ...responseIndex(2)} ,
47+
{ ...request_credentialled , ...responseIndex(2)} ,
48+
{ ...request_anonymous , ...responseIndex(1)} ,
49+
]
50+
},
51+
{
52+
name: 'same-origin: 2xCredentialled, 2xAnonymous, 1xCredentialled',
53+
requests: [
54+
{ ...request_credentialled , ...responseIndex(1)} ,
55+
{ ...request_credentialled , ...responseIndex(1)} ,
56+
{ ...request_anonymous , ...responseIndex(2)} ,
57+
{ ...request_anonymous , ...responseIndex(2)} ,
58+
{ ...request_credentialled , ...responseIndex(1)} ,
59+
]
60+
},
61+
];
62+
run_tests(tests);

0 commit comments

Comments
 (0)