Skip to content

Commit 8a0ccc0

Browse files
Guohui Dengmoz-wptsync-bot
Guohui Deng
authored andcommitted
Bug 1945614 [wpt PR 50456] - Revise filtering for Content-Encoding in ResourceTiming, a=testonly
Automatic update from web-platform-tests Revise filtering for Content-Encoding in ResourceTiming The value from the http header can be of multiple codings, or not properly formatted. Per discussion on w3c/resource-timing#381, multiple codings should be transformed to "multiple"; "identity" is not allowed in response header; and the coding value should be formatted if it's not in http header. Bug: 327941462 Change-Id: I9048423c5ad562d8001562324cb35f72ef8ac5da Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6215331 Reviewed-by: Noam Rosenthal <[email protected]> Reviewed-by: Yoav Weiss (@Shopify) <[email protected]> Commit-Queue: Guohui Deng <[email protected]> Cr-Commit-Position: refs/heads/main@{#1415037} -- wpt-commits: 1691f567df269bca146cb8d25c43d644b2b42c63 wpt-pr: 50456
1 parent bbf9030 commit 8a0ccc0

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

testing/web-platform/tests/resource-timing/content-encoding.https.html

+8-2
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,16 @@
3333
run_same_origin_test("/resource-timing/resources/foo.text.zst", "zstd");
3434
run_same_origin_test("/resource-timing/resources/compressed-js.py?content_encoding=deflate", "deflate");
3535
run_same_origin_test("/resource-timing/resources/compressed-js.py?content_encoding=gzip", "gzip");
36-
run_same_origin_test("/resource-timing/resources/compressed-js.py?content_encoding=identity", "identity");
3736
// Unrecognized content encoding value should be transformed to "unknown".
3837
run_same_origin_test("/resource-timing/resources/compressed-js.py?content_encoding=unrecognizedname", "unknown");
39-
38+
// "identity" is not allowed in response header and should be transformed to "unknown".
39+
run_same_origin_test("/resource-timing/resources/compressed-js.py?content_encoding=identity", "unknown");
40+
// Mult-encodinging and formatting tests.
41+
run_same_origin_test("/resource-timing/resources/content-encoding-headers.py?content_encoding=gzip, deflate,Apple", "multiple");
42+
run_same_origin_test("/resource-timing/resources/content-encoding-headers.py?content_encoding=gzip, ", "multiple");
43+
run_same_origin_test("/resource-timing/resources/content-encoding-headers.py?content_encoding=gZip ", "gzip");
44+
// Empty value test.
45+
run_same_origin_test("/resource-timing/resources/content-encoding-headers.py?content_encoding=", "");
4046

4147
const run_cross_origin_test = (path) => {
4248
const url = new URL(path, REMOTE_ORIGIN);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import os.path
2+
3+
# Return arbitory content-encoding header value.
4+
5+
def read(file):
6+
path = os.path.join(os.path.dirname(__file__), file)
7+
return open(path, u"rb").read()
8+
9+
def main(request, response):
10+
response.headers.set(b"Content-Type", b"text/javascript")
11+
response.content = read(u"./dummy.js")
12+
13+
if b'content_encoding' in request.GET:
14+
content_encoding = request.GET.first(b"content_encoding")
15+
response.headers.set(b"Content-Encoding", content_encoding)

0 commit comments

Comments
 (0)