diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:43:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:43:14 +0000 |
commit | 8dd16259287f58f9273002717ec4d27e97127719 (patch) | |
tree | 3863e62a53829a84037444beab3abd4ed9dfc7d0 /testing/web-platform/tests/fetch/api | |
parent | Releasing progress-linux version 126.0.1-1~progress7.99u1. (diff) | |
download | firefox-8dd16259287f58f9273002717ec4d27e97127719.tar.xz firefox-8dd16259287f58f9273002717ec4d27e97127719.zip |
Merging upstream version 127.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/fetch/api')
6 files changed, 45 insertions, 1 deletions
diff --git a/testing/web-platform/tests/fetch/api/basic/request-headers.any.js b/testing/web-platform/tests/fetch/api/basic/request-headers.any.js index ac54256e4c..8d2ad31e70 100644 --- a/testing/web-platform/tests/fetch/api/basic/request-headers.any.js +++ b/testing/web-platform/tests/fetch/api/basic/request-headers.any.js @@ -54,6 +54,7 @@ requestHeaders("Fetch with POST with Blob body", url, "POST", new Blob(["Test"]) requestHeaders("Fetch with POST with ArrayBuffer body", url, "POST", new ArrayBuffer(4), location.origin, "4"); requestHeaders("Fetch with POST with Uint8Array body", url, "POST", new Uint8Array(4), location.origin, "4"); requestHeaders("Fetch with POST with Int8Array body", url, "POST", new Int8Array(4), location.origin, "4"); +requestHeaders("Fetch with POST with Float16Array body", url, "POST", new Float16Array(1), location.origin, "2"); requestHeaders("Fetch with POST with Float32Array body", url, "POST", new Float32Array(1), location.origin, "4"); requestHeaders("Fetch with POST with Float64Array body", url, "POST", new Float64Array(1), location.origin, "8"); requestHeaders("Fetch with POST with DataView body", url, "POST", new DataView(new ArrayBuffer(8), 0, 4), location.origin, "4"); diff --git a/testing/web-platform/tests/fetch/api/basic/request-upload.any.js b/testing/web-platform/tests/fetch/api/basic/request-upload.any.js index 9168aa1154..0c4813bb53 100644 --- a/testing/web-platform/tests/fetch/api/basic/request-upload.any.js +++ b/testing/web-platform/tests/fetch/api/basic/request-upload.any.js @@ -60,6 +60,10 @@ testUpload("Fetch with POST with Int8Array body", url, "POST", () => new Int8Array(4), "\0\0\0\0"); +testUpload("Fetch with POST with Float16Array body", url, + "POST", + () => new Float16Array(2), + "\0\0\0\0"); testUpload("Fetch with POST with Float32Array body", url, "POST", () => new Float32Array(1), diff --git a/testing/web-platform/tests/fetch/api/crashtests/huge-fetch.any.js b/testing/web-platform/tests/fetch/api/crashtests/huge-fetch.any.js new file mode 100644 index 0000000000..1b09925d85 --- /dev/null +++ b/testing/web-platform/tests/fetch/api/crashtests/huge-fetch.any.js @@ -0,0 +1,16 @@ +// META: global=window,worker + +'use strict'; + +promise_test(async t => { + const response = await fetch('../resources/huge-response.py'); + const reader = response.body.getReader(); + // Read one chunk just to show willing. + const { value, done } = await reader.read(); + assert_false(done, 'there should be some data'); + assert_greater_than(value.byteLength, 0, 'the chunk should be non-empty'); + // Wait 2 seconds to give it a chance to crash. + await new Promise(resolve => t.step_timeout(resolve, 2000)); + // If we get here without crashing we passed the test. + reader.cancel(); +}, 'fetching a huge cacheable file but not reading it should not crash'); diff --git a/testing/web-platform/tests/fetch/api/request/request-bad-port.any.js b/testing/web-platform/tests/fetch/api/request/request-bad-port.any.js index 5c29823eaa..915063bab5 100644 --- a/testing/web-platform/tests/fetch/api/request/request-bad-port.any.js +++ b/testing/web-platform/tests/fetch/api/request/request-bad-port.any.js @@ -89,6 +89,6 @@ var BLOCKED_PORTS_LIST = [ BLOCKED_PORTS_LIST.map(function(a){ promise_test(function(t){ - return promise_rejects_js(t, TypeError, fetch("http://example.com:" + a)) + return promise_rejects_js(t, TypeError, fetch(`${location.origin}:${a}`)) }, 'Request on bad port ' + a + ' should throw TypeError.'); }); diff --git a/testing/web-platform/tests/fetch/api/resources/huge-response.py b/testing/web-platform/tests/fetch/api/resources/huge-response.py new file mode 100644 index 0000000000..16a60078e5 --- /dev/null +++ b/testing/web-platform/tests/fetch/api/resources/huge-response.py @@ -0,0 +1,22 @@ +# A Python script that generates a huge response. Implemented as a script to +# avoid needing to add a huge file to the repository. + +TOTAL_SIZE = 8 * 1024 * 1024 * 1024 # 8 GB +CHUNK_SIZE = 1024 * 1024 # 1 MB + +assert TOTAL_SIZE % CHUNK_SIZE == 0 + + +def main(request, response): + response.headers.set(b"Content-type", b"text/plain") + response.headers.set(b"Content-Length", str(TOTAL_SIZE).encode()) + response.headers.set(b"Cache-Control", b"max-age=86400") + response.write_status_headers() + + chunk = bytes(CHUNK_SIZE) + total_sent = 0 + + while total_sent < TOTAL_SIZE: + if not response.writer.write(chunk): + break + total_sent += CHUNK_SIZE diff --git a/testing/web-platform/tests/fetch/api/response/response-clone.any.js b/testing/web-platform/tests/fetch/api/response/response-clone.any.js index f5cda75149..c0c844948d 100644 --- a/testing/web-platform/tests/fetch/api/response/response-clone.any.js +++ b/testing/web-platform/tests/fetch/api/response/response-clone.any.js @@ -135,6 +135,7 @@ testReadableStreamClone(new Uint16Array(arrayBuffer, 2), "Uint16Array"); testReadableStreamClone(new Uint32Array(arrayBuffer), "Uint32Array"); testReadableStreamClone(typeof BigInt64Array === "function" ? new BigInt64Array(arrayBuffer) : undefined, "BigInt64Array"); testReadableStreamClone(typeof BigUint64Array === "function" ? new BigUint64Array(arrayBuffer) : undefined, "BigUint64Array"); +testReadableStreamClone(typeof Float16Array === "function" ? new Float16Array(arrayBuffer) : undefined, "Float16Array"); testReadableStreamClone(new Float32Array(arrayBuffer), "Float32Array"); testReadableStreamClone(new Float64Array(arrayBuffer), "Float64Array"); testReadableStreamClone(new DataView(arrayBuffer, 2, 8), "DataView"); |