From 43a97878ce14b72f0981164f87f2e35e14151312 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 11:22:09 +0200 Subject: Adding upstream version 110.0.1. Signed-off-by: Daniel Baumann --- .../fetch/content-encoding/bad-gzip-body.any.js | 22 +++++++++++++++++++++ .../tests/fetch/content-encoding/gzip-body.any.js | 16 +++++++++++++++ .../content-encoding/resources/bad-gzip-body.py | 3 +++ .../content-encoding/resources/foo.octetstream.gz | Bin 0 -> 64 bytes .../resources/foo.octetstream.gz.headers | 2 ++ .../fetch/content-encoding/resources/foo.text.gz | Bin 0 -> 57 bytes .../content-encoding/resources/foo.text.gz.headers | 2 ++ 7 files changed, 45 insertions(+) create mode 100644 testing/web-platform/tests/fetch/content-encoding/bad-gzip-body.any.js create mode 100644 testing/web-platform/tests/fetch/content-encoding/gzip-body.any.js create mode 100644 testing/web-platform/tests/fetch/content-encoding/resources/bad-gzip-body.py create mode 100644 testing/web-platform/tests/fetch/content-encoding/resources/foo.octetstream.gz create mode 100644 testing/web-platform/tests/fetch/content-encoding/resources/foo.octetstream.gz.headers create mode 100644 testing/web-platform/tests/fetch/content-encoding/resources/foo.text.gz create mode 100644 testing/web-platform/tests/fetch/content-encoding/resources/foo.text.gz.headers (limited to 'testing/web-platform/tests/fetch/content-encoding') diff --git a/testing/web-platform/tests/fetch/content-encoding/bad-gzip-body.any.js b/testing/web-platform/tests/fetch/content-encoding/bad-gzip-body.any.js new file mode 100644 index 0000000000..17bc1261a3 --- /dev/null +++ b/testing/web-platform/tests/fetch/content-encoding/bad-gzip-body.any.js @@ -0,0 +1,22 @@ +// META: global=window,worker + +promise_test((test) => { + return fetch("resources/bad-gzip-body.py").then(res => { + assert_equals(res.status, 200); + }); +}, "Fetching a resource with bad gzip content should still resolve"); + +[ + "arrayBuffer", + "blob", + "formData", + "json", + "text" +].forEach(method => { + promise_test(t => { + return fetch("resources/bad-gzip-body.py").then(res => { + assert_equals(res.status, 200); + return promise_rejects_js(t, TypeError, res[method]()); + }); + }, "Consuming the body of a resource with bad gzip content with " + method + "() should reject"); +}); diff --git a/testing/web-platform/tests/fetch/content-encoding/gzip-body.any.js b/testing/web-platform/tests/fetch/content-encoding/gzip-body.any.js new file mode 100644 index 0000000000..37758b7d91 --- /dev/null +++ b/testing/web-platform/tests/fetch/content-encoding/gzip-body.any.js @@ -0,0 +1,16 @@ +// META: global=window,worker + +const expectedDecompressedSize = 10500; +[ + "text", + "octetstream" +].forEach(contentType => { + promise_test(async t => { + let response = await fetch(`resources/foo.${contentType}.gz`); + assert_true(response.ok); + let arrayBuffer = await response.arrayBuffer() + let u8 = new Uint8Array(arrayBuffer); + assert_equals(u8.length, expectedDecompressedSize); + }, `fetched gzip data with content type ${contentType} should be decompressed.`); +}); + diff --git a/testing/web-platform/tests/fetch/content-encoding/resources/bad-gzip-body.py b/testing/web-platform/tests/fetch/content-encoding/resources/bad-gzip-body.py new file mode 100644 index 0000000000..a79b94ed04 --- /dev/null +++ b/testing/web-platform/tests/fetch/content-encoding/resources/bad-gzip-body.py @@ -0,0 +1,3 @@ +def main(request, response): + headers = [(b"Content-Encoding", b"gzip")] + return headers, b"not actually gzip" diff --git a/testing/web-platform/tests/fetch/content-encoding/resources/foo.octetstream.gz b/testing/web-platform/tests/fetch/content-encoding/resources/foo.octetstream.gz new file mode 100644 index 0000000000..f3df4cb89b Binary files /dev/null and b/testing/web-platform/tests/fetch/content-encoding/resources/foo.octetstream.gz differ diff --git a/testing/web-platform/tests/fetch/content-encoding/resources/foo.octetstream.gz.headers b/testing/web-platform/tests/fetch/content-encoding/resources/foo.octetstream.gz.headers new file mode 100644 index 0000000000..27d4f401f1 --- /dev/null +++ b/testing/web-platform/tests/fetch/content-encoding/resources/foo.octetstream.gz.headers @@ -0,0 +1,2 @@ +Content-type: application/octet-stream +Content-Encoding: gzip diff --git a/testing/web-platform/tests/fetch/content-encoding/resources/foo.text.gz b/testing/web-platform/tests/fetch/content-encoding/resources/foo.text.gz new file mode 100644 index 0000000000..05a5cce07b Binary files /dev/null and b/testing/web-platform/tests/fetch/content-encoding/resources/foo.text.gz differ diff --git a/testing/web-platform/tests/fetch/content-encoding/resources/foo.text.gz.headers b/testing/web-platform/tests/fetch/content-encoding/resources/foo.text.gz.headers new file mode 100644 index 0000000000..7def3ddc14 --- /dev/null +++ b/testing/web-platform/tests/fetch/content-encoding/resources/foo.text.gz.headers @@ -0,0 +1,2 @@ +Content-type: text/plain +Content-Encoding: gzip -- cgit v1.2.3