Truly independent web browser
Tests/LibWeb: Import WPT tests for fetch, XHR, WebSocket and referrers
Andreas Kling07ef2ab6fe76
diff --git a/Tests/LibWeb/TestConfig.ini b/Tests/LibWeb/TestConfig.iniindex a87fea663e3..e0e44a1ae2f 100644--- a/Tests/LibWeb/TestConfig.ini+++ b/Tests/LibWeb/TestConfig.ini@@ -1013,6 +1013,59 @@ Text/input/wpt-import/html/canvas/element/wide-gamut-canvas/2d.color.space.p3.stText/input/wpt-import/html/canvas/offscreen/wide-gamut-canvas/2d.color.space.getImageData.convert.worker.htmlText/input/wpt-import/html/canvas/element/manual/imagebitmap/createImageBitmap-colorSpaceConversion.html+; Fetch from the WPT server, use its Python handlers, or check the headers and referrers of requests.+Text/input/wpt-import/fetch/api/basic/integrity.sub.any.html+Text/input/wpt-import/fetch/api/basic/integrity.sub.any.sharedworker.html+Text/input/wpt-import/fetch/api/basic/integrity.sub.any.worker.html+Text/input/wpt-import/fetch/api/basic/request-headers-case.any.html+Text/input/wpt-import/fetch/api/basic/request-headers-case.any.sharedworker.html+Text/input/wpt-import/fetch/api/basic/request-headers-case.any.worker.html+Text/input/wpt-import/fetch/api/headers/header-values.any.html+Text/input/wpt-import/fetch/api/request/request-disturbed.any.html+Text/input/wpt-import/fetch/api/request/request-disturbed.any.sharedworker.html+Text/input/wpt-import/fetch/api/request/request-disturbed.any.worker.html+Text/input/wpt-import/fetch/api/request/request-init-contenttype.any.html+Text/input/wpt-import/fetch/api/request/request-init-contenttype.any.worker.html+Text/input/wpt-import/fetch/api/response/response-init-contenttype.any.html+Text/input/wpt-import/fetch/api/response/response-init-contenttype.any.worker.html+Text/input/wpt-import/fetch/content-encoding/br/big-br-body.https.any.html+Text/input/wpt-import/fetch/content-encoding/br/big-br-body.https.any.sharedworker.html+Text/input/wpt-import/fetch/content-encoding/br/big-br-body.https.any.worker.html+Text/input/wpt-import/fetch/content-encoding/gzip/big-gzip-body.https.any.html+Text/input/wpt-import/fetch/content-encoding/gzip/big-gzip-body.https.any.sharedworker.html+Text/input/wpt-import/fetch/content-encoding/gzip/big-gzip-body.https.any.worker.html+Text/input/wpt-import/fetch/content-encoding/zstd/big-zstd-body.https.any.html+Text/input/wpt-import/fetch/content-encoding/zstd/big-zstd-body.https.any.sharedworker.html+Text/input/wpt-import/fetch/content-encoding/zstd/big-zstd-body.https.any.worker.html+Text/input/wpt-import/fetch/http-cache/freshness.any.html+Text/input/wpt-import/fetch/http-cache/freshness.any.sharedworker.html+Text/input/wpt-import/fetch/http-cache/freshness.any.worker.html+Text/input/wpt-import/referrer-policy/css-integration/child-css/external-import-stylesheet.html+Text/input/wpt-import/referrer-policy/css-integration/child-css/internal-import-stylesheet.html+Text/input/wpt-import/referrer-policy/css-integration/font-face/external-import-stylesheet.html+Text/input/wpt-import/referrer-policy/css-integration/font-face/external-stylesheet.html+Text/input/wpt-import/referrer-policy/css-integration/font-face/internal-import-stylesheet.html+Text/input/wpt-import/referrer-policy/generic/multiple-headers-and-values.html+Text/input/wpt-import/referrer-policy/generic/multiple-headers-one-unknown-token.html+Text/input/wpt-import/referrer-policy/generic/subresource-test/area-navigate.html+Text/input/wpt-import/referrer-policy/generic/subresource-test/fetch-messaging.html+Text/input/wpt-import/referrer-policy/generic/subresource-test/iframe-messaging.html+Text/input/wpt-import/referrer-policy/generic/subresource-test/image-decoding.html+Text/input/wpt-import/referrer-policy/generic/subresource-test/link-navigate.html+Text/input/wpt-import/referrer-policy/generic/subresource-test/script-messaging.html+Text/input/wpt-import/referrer-policy/generic/subresource-test/worker-messaging.html+Text/input/wpt-import/referrer-policy/generic/subresource-test/xhr-messaging.html+Text/input/wpt-import/websockets/idlharness.any.html+Text/input/wpt-import/websockets/idlharness.any.worker.html+Text/input/wpt-import/xhr/request-content-length.any.html+Text/input/wpt-import/xhr/request-content-length.any.worker.html+Text/input/wpt-import/xhr/responsedocument-decoding.htm+Text/input/wpt-import/xhr/responsetext-decoding.htm+Text/input/wpt-import/xhr/send-usp.any.worker.html+Text/input/wpt-import/xhr/setrequestheader-content-type.htm+Text/input/wpt-import/xhr/split-byte-order-mark.any.html+Text/input/wpt-import/xhr/split-byte-order-mark.any.worker.html+[Skipped]; Needs vertical-rl inline geometry fidelity beyond the binary transposeRef/input/wpt-import/css/css-position/position-absolute-in-inline-006.html@@ -1267,3 +1320,8 @@ Text/input/wpt-import/scroll-to-text-fragment/iframes.sub.html; The test hardcodes www.not-wpt.live, which the LibWeb test server cannot route locally.Text/input/wpt-import/scroll-to-text-fragment/scroll-to-text-fragment-security.sub.html++; These tests hardcode external wpt.live origins that the local test server cannot route.+Text/input/wpt-import/fetch/api/basic/integrity.sub.any.html+Text/input/wpt-import/fetch/api/basic/integrity.sub.any.sharedworker.html+Text/input/wpt-import/fetch/api/basic/integrity.sub.any.worker.htmldiff --git a/Tests/LibWeb/Text/expected/wpt-import/fetch/api/basic/integrity.sub.any.sharedworker.txt b/Tests/LibWeb/Text/expected/wpt-import/fetch/api/basic/integrity.sub.any.sharedworker.txtnew file mode 100644index 00000000000..fbcf02f5f5e--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/fetch/api/basic/integrity.sub.any.sharedworker.txt@@ -0,0 +1,24 @@+Harness status: OK++Found 18 tests++13 Pass+5 Fail+Pass Empty string integrity+Pass SHA-256 integrity+Pass SHA-384 integrity+Pass SHA-512 integrity+Fail SHA-512 integrity with missing padding+Fail SHA-512 integrity base64url encoded+Fail SHA-512 integrity base64url encoded with missing padding+Pass Invalid integrity+Pass Multiple integrities: valid stronger than invalid+Pass Multiple integrities: invalid stronger than valid+Pass Multiple integrities: invalid as strong as valid+Pass Multiple integrities: both are valid+Pass Multiple integrities: both are invalid+Fail CORS empty integrity+Fail CORS SHA-512 integrity+Pass CORS invalid integrity+Pass Empty string integrity for opaque response+Pass SHA-* integrity for opaque response\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/fetch/api/basic/integrity.sub.any.txt b/Tests/LibWeb/Text/expected/wpt-import/fetch/api/basic/integrity.sub.any.txtnew file mode 100644index 00000000000..fbcf02f5f5e--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/fetch/api/basic/integrity.sub.any.txt@@ -0,0 +1,24 @@+Harness status: OK++Found 18 tests++13 Pass+5 Fail+Pass Empty string integrity+Pass SHA-256 integrity+Pass SHA-384 integrity+Pass SHA-512 integrity+Fail SHA-512 integrity with missing padding+Fail SHA-512 integrity base64url encoded+Fail SHA-512 integrity base64url encoded with missing padding+Pass Invalid integrity+Pass Multiple integrities: valid stronger than invalid+Pass Multiple integrities: invalid stronger than valid+Pass Multiple integrities: invalid as strong as valid+Pass Multiple integrities: both are valid+Pass Multiple integrities: both are invalid+Fail CORS empty integrity+Fail CORS SHA-512 integrity+Pass CORS invalid integrity+Pass Empty string integrity for opaque response+Pass SHA-* integrity for opaque response\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/fetch/api/basic/integrity.sub.any.worker.txt b/Tests/LibWeb/Text/expected/wpt-import/fetch/api/basic/integrity.sub.any.worker.txtnew file mode 100644index 00000000000..fbcf02f5f5e--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/fetch/api/basic/integrity.sub.any.worker.txt@@ -0,0 +1,24 @@+Harness status: OK++Found 18 tests++13 Pass+5 Fail+Pass Empty string integrity+Pass SHA-256 integrity+Pass SHA-384 integrity+Pass SHA-512 integrity+Fail SHA-512 integrity with missing padding+Fail SHA-512 integrity base64url encoded+Fail SHA-512 integrity base64url encoded with missing padding+Pass Invalid integrity+Pass Multiple integrities: valid stronger than invalid+Pass Multiple integrities: invalid stronger than valid+Pass Multiple integrities: invalid as strong as valid+Pass Multiple integrities: both are valid+Pass Multiple integrities: both are invalid+Fail CORS empty integrity+Fail CORS SHA-512 integrity+Pass CORS invalid integrity+Pass Empty string integrity for opaque response+Pass SHA-* integrity for opaque response\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/fetch/api/basic/request-headers-case.any.sharedworker.txt b/Tests/LibWeb/Text/expected/wpt-import/fetch/api/basic/request-headers-case.any.sharedworker.txtnew file mode 100644index 00000000000..dbd671becae--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/fetch/api/basic/request-headers-case.any.sharedworker.txt@@ -0,0 +1,7 @@+Harness status: OK++Found 2 tests++2 Fail+Fail Multiple headers with the same name, different case (THIS-is-A-test first)+Fail Multiple headers with the same name, different case (THIS-IS-A-TEST first)\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/fetch/api/basic/request-headers-case.any.txt b/Tests/LibWeb/Text/expected/wpt-import/fetch/api/basic/request-headers-case.any.txtnew file mode 100644index 00000000000..dbd671becae--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/fetch/api/basic/request-headers-case.any.txt@@ -0,0 +1,7 @@+Harness status: OK++Found 2 tests++2 Fail+Fail Multiple headers with the same name, different case (THIS-is-A-test first)+Fail Multiple headers with the same name, different case (THIS-IS-A-TEST first)\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/fetch/api/basic/request-headers-case.any.worker.txt b/Tests/LibWeb/Text/expected/wpt-import/fetch/api/basic/request-headers-case.any.worker.txtnew file mode 100644index 00000000000..dbd671becae--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/fetch/api/basic/request-headers-case.any.worker.txt@@ -0,0 +1,7 @@+Harness status: OK++Found 2 tests++2 Fail+Fail Multiple headers with the same name, different case (THIS-is-A-test first)+Fail Multiple headers with the same name, different case (THIS-IS-A-TEST first)\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/fetch/api/headers/header-values.any.txt b/Tests/LibWeb/Text/expected/wpt-import/fetch/api/headers/header-values.any.txtnew file mode 100644index 00000000000..27fee54ec48--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/fetch/api/headers/header-values.any.txt@@ -0,0 +1,14 @@+Harness status: OK++Found 8 tests++7 Pass+1 Fail+Pass XMLHttpRequest with value x%00x needs to throw+Pass fetch() with value x%00x needs to throw+Pass XMLHttpRequest with value x%0Ax needs to throw+Pass fetch() with value x%0Ax needs to throw+Pass XMLHttpRequest with value x%0Dx needs to throw+Pass fetch() with value x%0Dx needs to throw+Fail XMLHttpRequest with all valid values+Pass fetch() with all valid values\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/fetch/api/request/request-disturbed.any.sharedworker.txt b/Tests/LibWeb/Text/expected/wpt-import/fetch/api/request/request-disturbed.any.sharedworker.txtnew file mode 100644index 00000000000..0ceb6b39d56--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/fetch/api/request/request-disturbed.any.sharedworker.txt@@ -0,0 +1,15 @@+Harness status: OK++Found 9 tests++7 Pass+2 Fail+Pass Request's body: initial state+Pass Request without body cannot be disturbed+Pass Check cloning a disturbed request+Pass Check creating a new request from a disturbed request+Pass Check creating a new request with a new body from a disturbed request+Fail Input request used for creating new request became disturbed+Pass Input request used for creating new request with a new body is not disturbed+Pass Check consuming a disturbed request+Fail Request construction failure should not set "bodyUsed"\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/fetch/api/request/request-disturbed.any.txt b/Tests/LibWeb/Text/expected/wpt-import/fetch/api/request/request-disturbed.any.txtindex 4d70c617516..0ceb6b39d56 100644--- a/Tests/LibWeb/Text/expected/wpt-import/fetch/api/request/request-disturbed.any.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/fetch/api/request/request-disturbed.any.txt@@ -2,14 +2,14 @@ Harness status: OKFound 9 tests-6 Pass-3 Fail+7 Pass+2 FailPass Request's body: initial statePass Request without body cannot be disturbedPass Check cloning a disturbed requestPass Check creating a new request from a disturbed requestPass Check creating a new request with a new body from a disturbed requestFail Input request used for creating new request became disturbed-Fail Input request used for creating new request became disturbed even if body is not used+Pass Input request used for creating new request with a new body is not disturbedPass Check consuming a disturbed requestFail Request construction failure should not set "bodyUsed"\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/fetch/api/request/request-disturbed.any.worker.txt b/Tests/LibWeb/Text/expected/wpt-import/fetch/api/request/request-disturbed.any.worker.txtnew file mode 100644index 00000000000..0ceb6b39d56--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/fetch/api/request/request-disturbed.any.worker.txt@@ -0,0 +1,15 @@+Harness status: OK++Found 9 tests++7 Pass+2 Fail+Pass Request's body: initial state+Pass Request without body cannot be disturbed+Pass Check cloning a disturbed request+Pass Check creating a new request from a disturbed request+Pass Check creating a new request with a new body from a disturbed request+Fail Input request used for creating new request became disturbed+Pass Input request used for creating new request with a new body is not disturbed+Pass Check consuming a disturbed request+Fail Request construction failure should not set "bodyUsed"\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/fetch/api/request/request-init-contenttype.any.txt b/Tests/LibWeb/Text/expected/wpt-import/fetch/api/request/request-init-contenttype.any.txtnew file mode 100644index 00000000000..02888881bd9--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/fetch/api/request/request-init-contenttype.any.txt@@ -0,0 +1,24 @@+Harness status: OK++Found 18 tests++17 Pass+1 Fail+Pass Default Content-Type for Request with empty body+Pass Default Content-Type for Request with Blob body (no type set)+Pass Default Content-Type for Request with Blob body (empty type)+Fail Default Content-Type for Request with Blob body (set type)+Pass Default Content-Type for Request with buffer source body+Pass Default Content-Type for Request with FormData body+Pass Default Content-Type for Request with URLSearchParams body+Pass Default Content-Type for Request with string body+Pass Default Content-Type for Request with ReadableStream body+Pass Can override Content-Type for Request with empty body+Pass Can override Content-Type for Request with Blob body (no type set)+Pass Can override Content-Type for Request with Blob body (empty type)+Pass Can override Content-Type for Request with Blob body (set type)+Pass Can override Content-Type for Request with buffer source body+Pass Can override Content-Type for Request with FormData body+Pass Can override Content-Type for Request with URLSearchParams body+Pass Can override Content-Type for Request with string body+Pass Can override Content-Type for Request with ReadableStream body\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/fetch/api/request/request-init-contenttype.any.worker.txt b/Tests/LibWeb/Text/expected/wpt-import/fetch/api/request/request-init-contenttype.any.worker.txtnew file mode 100644index 00000000000..02888881bd9--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/fetch/api/request/request-init-contenttype.any.worker.txt@@ -0,0 +1,24 @@+Harness status: OK++Found 18 tests++17 Pass+1 Fail+Pass Default Content-Type for Request with empty body+Pass Default Content-Type for Request with Blob body (no type set)+Pass Default Content-Type for Request with Blob body (empty type)+Fail Default Content-Type for Request with Blob body (set type)+Pass Default Content-Type for Request with buffer source body+Pass Default Content-Type for Request with FormData body+Pass Default Content-Type for Request with URLSearchParams body+Pass Default Content-Type for Request with string body+Pass Default Content-Type for Request with ReadableStream body+Pass Can override Content-Type for Request with empty body+Pass Can override Content-Type for Request with Blob body (no type set)+Pass Can override Content-Type for Request with Blob body (empty type)+Pass Can override Content-Type for Request with Blob body (set type)+Pass Can override Content-Type for Request with buffer source body+Pass Can override Content-Type for Request with FormData body+Pass Can override Content-Type for Request with URLSearchParams body+Pass Can override Content-Type for Request with string body+Pass Can override Content-Type for Request with ReadableStream body\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/fetch/api/response/response-init-contenttype.any.txt b/Tests/LibWeb/Text/expected/wpt-import/fetch/api/response/response-init-contenttype.any.txtnew file mode 100644index 00000000000..bb21657aa8c--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/fetch/api/response/response-init-contenttype.any.txt@@ -0,0 +1,24 @@+Harness status: OK++Found 18 tests++17 Pass+1 Fail+Pass Default Content-Type for Response with empty body+Pass Default Content-Type for Response with Blob body (no type set)+Pass Default Content-Type for Response with Blob body (empty type)+Fail Default Content-Type for Response with Blob body (set type)+Pass Default Content-Type for Response with buffer source body+Pass Default Content-Type for Response with FormData body+Pass Default Content-Type for Response with URLSearchParams body+Pass Default Content-Type for Response with string body+Pass Default Content-Type for Response with ReadableStream body+Pass Can override Content-Type for Response with empty body+Pass Can override Content-Type for Response with Blob body (no type set)+Pass Can override Content-Type for Response with Blob body (empty type)+Pass Can override Content-Type for Response with Blob body (set type)+Pass Can override Content-Type for Response with buffer source body+Pass Can override Content-Type for Response with FormData body+Pass Can override Content-Type for Response with URLSearchParams body+Pass Can override Content-Type for Response with string body+Pass Can override Content-Type for Response with ReadableStream body\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/fetch/api/response/response-init-contenttype.any.worker.txt b/Tests/LibWeb/Text/expected/wpt-import/fetch/api/response/response-init-contenttype.any.worker.txtnew file mode 100644index 00000000000..bb21657aa8c--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/fetch/api/response/response-init-contenttype.any.worker.txt@@ -0,0 +1,24 @@+Harness status: OK++Found 18 tests++17 Pass+1 Fail+Pass Default Content-Type for Response with empty body+Pass Default Content-Type for Response with Blob body (no type set)+Pass Default Content-Type for Response with Blob body (empty type)+Fail Default Content-Type for Response with Blob body (set type)+Pass Default Content-Type for Response with buffer source body+Pass Default Content-Type for Response with FormData body+Pass Default Content-Type for Response with URLSearchParams body+Pass Default Content-Type for Response with string body+Pass Default Content-Type for Response with ReadableStream body+Pass Can override Content-Type for Response with empty body+Pass Can override Content-Type for Response with Blob body (no type set)+Pass Can override Content-Type for Response with Blob body (empty type)+Pass Can override Content-Type for Response with Blob body (set type)+Pass Can override Content-Type for Response with buffer source body+Pass Can override Content-Type for Response with FormData body+Pass Can override Content-Type for Response with URLSearchParams body+Pass Can override Content-Type for Response with string body+Pass Can override Content-Type for Response with ReadableStream body\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/fetch/content-encoding/br/big-br-body.https.any.sharedworker.txt b/Tests/LibWeb/Text/expected/wpt-import/fetch/content-encoding/br/big-br-body.https.any.sharedworker.txtnew file mode 100644index 00000000000..0e9f7ba08a1--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/fetch/content-encoding/br/big-br-body.https.any.sharedworker.txt@@ -0,0 +1,8 @@+Harness status: OK++Found 2 tests++1 Pass+1 Fail+Pass large br data should be decompressed successfully+Fail large br data should be decompressed successfully with byte stream\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/fetch/content-encoding/br/big-br-body.https.any.txt b/Tests/LibWeb/Text/expected/wpt-import/fetch/content-encoding/br/big-br-body.https.any.txtnew file mode 100644index 00000000000..0e9f7ba08a1--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/fetch/content-encoding/br/big-br-body.https.any.txt@@ -0,0 +1,8 @@+Harness status: OK++Found 2 tests++1 Pass+1 Fail+Pass large br data should be decompressed successfully+Fail large br data should be decompressed successfully with byte stream\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/fetch/content-encoding/br/big-br-body.https.any.worker.txt b/Tests/LibWeb/Text/expected/wpt-import/fetch/content-encoding/br/big-br-body.https.any.worker.txtnew file mode 100644index 00000000000..0e9f7ba08a1--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/fetch/content-encoding/br/big-br-body.https.any.worker.txt@@ -0,0 +1,8 @@+Harness status: OK++Found 2 tests++1 Pass+1 Fail+Pass large br data should be decompressed successfully+Fail large br data should be decompressed successfully with byte stream\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/fetch/content-encoding/gzip/big-gzip-body.https.any.sharedworker.txt b/Tests/LibWeb/Text/expected/wpt-import/fetch/content-encoding/gzip/big-gzip-body.https.any.sharedworker.txtnew file mode 100644index 00000000000..c20ed3553fd--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/fetch/content-encoding/gzip/big-gzip-body.https.any.sharedworker.txt@@ -0,0 +1,8 @@+Harness status: OK++Found 2 tests++1 Pass+1 Fail+Pass large gzip data should be decompressed successfully+Fail large gzip data should be decompressed successfully with byte stream\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/fetch/content-encoding/gzip/big-gzip-body.https.any.txt b/Tests/LibWeb/Text/expected/wpt-import/fetch/content-encoding/gzip/big-gzip-body.https.any.txtnew file mode 100644index 00000000000..c20ed3553fd--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/fetch/content-encoding/gzip/big-gzip-body.https.any.txt@@ -0,0 +1,8 @@+Harness status: OK++Found 2 tests++1 Pass+1 Fail+Pass large gzip data should be decompressed successfully+Fail large gzip data should be decompressed successfully with byte stream\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/fetch/content-encoding/gzip/big-gzip-body.https.any.worker.txt b/Tests/LibWeb/Text/expected/wpt-import/fetch/content-encoding/gzip/big-gzip-body.https.any.worker.txtnew file mode 100644index 00000000000..c20ed3553fd--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/fetch/content-encoding/gzip/big-gzip-body.https.any.worker.txt@@ -0,0 +1,8 @@+Harness status: OK++Found 2 tests++1 Pass+1 Fail+Pass large gzip data should be decompressed successfully+Fail large gzip data should be decompressed successfully with byte stream\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/fetch/content-encoding/zstd/big-zstd-body.https.any.sharedworker.txt b/Tests/LibWeb/Text/expected/wpt-import/fetch/content-encoding/zstd/big-zstd-body.https.any.sharedworker.txtnew file mode 100644index 00000000000..025e830e6b0--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/fetch/content-encoding/zstd/big-zstd-body.https.any.sharedworker.txt@@ -0,0 +1,8 @@+Harness status: OK++Found 2 tests++1 Pass+1 Fail+Pass large zstd data should be decompressed successfully+Fail large zstd data should be decompressed successfully with byte stream\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/fetch/content-encoding/zstd/big-zstd-body.https.any.txt b/Tests/LibWeb/Text/expected/wpt-import/fetch/content-encoding/zstd/big-zstd-body.https.any.txtnew file mode 100644index 00000000000..025e830e6b0--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/fetch/content-encoding/zstd/big-zstd-body.https.any.txt@@ -0,0 +1,8 @@+Harness status: OK++Found 2 tests++1 Pass+1 Fail+Pass large zstd data should be decompressed successfully+Fail large zstd data should be decompressed successfully with byte stream\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/fetch/content-encoding/zstd/big-zstd-body.https.any.worker.txt b/Tests/LibWeb/Text/expected/wpt-import/fetch/content-encoding/zstd/big-zstd-body.https.any.worker.txtnew file mode 100644index 00000000000..025e830e6b0--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/fetch/content-encoding/zstd/big-zstd-body.https.any.worker.txt@@ -0,0 +1,8 @@+Harness status: OK++Found 2 tests++1 Pass+1 Fail+Pass large zstd data should be decompressed successfully+Fail large zstd data should be decompressed successfully with byte stream\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/fetch/http-cache/freshness.any.sharedworker.txt b/Tests/LibWeb/Text/expected/wpt-import/fetch/http-cache/freshness.any.sharedworker.txtnew file mode 100644index 00000000000..340488ee522--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/fetch/http-cache/freshness.any.sharedworker.txt@@ -0,0 +1,23 @@+Harness status: OK++Found 17 tests++14 Pass+3 Fail+Pass HTTP cache reuses a response with a future Expires+Pass HTTP cache does not reuse a response with a past Expires+Pass HTTP cache does not reuse a response with a present Expires+Pass HTTP cache does not reuse a response with an invalid Expires+Pass HTTP cache does not reuse a response with an invalid Expires with Last-Modified now+Fail HTTP cache does not reuse a response with an invalid Expires with past Last-Modified+Pass HTTP cache reuses a response with positive Cache-Control: max-age+Pass HTTP cache does not reuse a response with Cache-Control: max-age=0+Pass HTTP cache reuses a response with positive Cache-Control: max-age and a past Expires+Pass HTTP cache reuses a response with positive Cache-Control: max-age and an invalid Expires+Pass HTTP cache does not reuse a response with Cache-Control: max-age=0 and a future Expires+Pass HTTP cache does not prefer Cache-Control: s-maxage over Cache-Control: max-age+Pass HTTP cache does not reuse a response when the Age header is greater than its freshness lifetime+Pass HTTP cache does not store a response with Cache-Control: no-store+Pass HTTP cache does not store a response with Cache-Control: no-store, even with max-age and Expires+Fail HTTP cache stores a response with Cache-Control: no-cache, but revalidates upon use+Fail HTTP cache stores a response with Cache-Control: no-cache, but revalidates upon use, even with max-age and Expires\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/fetch/http-cache/freshness.any.txt b/Tests/LibWeb/Text/expected/wpt-import/fetch/http-cache/freshness.any.txtnew file mode 100644index 00000000000..340488ee522--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/fetch/http-cache/freshness.any.txt@@ -0,0 +1,23 @@+Harness status: OK++Found 17 tests++14 Pass+3 Fail+Pass HTTP cache reuses a response with a future Expires+Pass HTTP cache does not reuse a response with a past Expires+Pass HTTP cache does not reuse a response with a present Expires+Pass HTTP cache does not reuse a response with an invalid Expires+Pass HTTP cache does not reuse a response with an invalid Expires with Last-Modified now+Fail HTTP cache does not reuse a response with an invalid Expires with past Last-Modified+Pass HTTP cache reuses a response with positive Cache-Control: max-age+Pass HTTP cache does not reuse a response with Cache-Control: max-age=0+Pass HTTP cache reuses a response with positive Cache-Control: max-age and a past Expires+Pass HTTP cache reuses a response with positive Cache-Control: max-age and an invalid Expires+Pass HTTP cache does not reuse a response with Cache-Control: max-age=0 and a future Expires+Pass HTTP cache does not prefer Cache-Control: s-maxage over Cache-Control: max-age+Pass HTTP cache does not reuse a response when the Age header is greater than its freshness lifetime+Pass HTTP cache does not store a response with Cache-Control: no-store+Pass HTTP cache does not store a response with Cache-Control: no-store, even with max-age and Expires+Fail HTTP cache stores a response with Cache-Control: no-cache, but revalidates upon use+Fail HTTP cache stores a response with Cache-Control: no-cache, but revalidates upon use, even with max-age and Expires\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/fetch/http-cache/freshness.any.worker.txt b/Tests/LibWeb/Text/expected/wpt-import/fetch/http-cache/freshness.any.worker.txtnew file mode 100644index 00000000000..340488ee522--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/fetch/http-cache/freshness.any.worker.txt@@ -0,0 +1,23 @@+Harness status: OK++Found 17 tests++14 Pass+3 Fail+Pass HTTP cache reuses a response with a future Expires+Pass HTTP cache does not reuse a response with a past Expires+Pass HTTP cache does not reuse a response with a present Expires+Pass HTTP cache does not reuse a response with an invalid Expires+Pass HTTP cache does not reuse a response with an invalid Expires with Last-Modified now+Fail HTTP cache does not reuse a response with an invalid Expires with past Last-Modified+Pass HTTP cache reuses a response with positive Cache-Control: max-age+Pass HTTP cache does not reuse a response with Cache-Control: max-age=0+Pass HTTP cache reuses a response with positive Cache-Control: max-age and a past Expires+Pass HTTP cache reuses a response with positive Cache-Control: max-age and an invalid Expires+Pass HTTP cache does not reuse a response with Cache-Control: max-age=0 and a future Expires+Pass HTTP cache does not prefer Cache-Control: s-maxage over Cache-Control: max-age+Pass HTTP cache does not reuse a response when the Age header is greater than its freshness lifetime+Pass HTTP cache does not store a response with Cache-Control: no-store+Pass HTTP cache does not store a response with Cache-Control: no-store, even with max-age and Expires+Fail HTTP cache stores a response with Cache-Control: no-cache, but revalidates upon use+Fail HTTP cache stores a response with Cache-Control: no-cache, but revalidates upon use, even with max-age and Expires\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/referrer-policy/css-integration/child-css/external-import-stylesheet.txt b/Tests/LibWeb/Text/expected/wpt-import/referrer-policy/css-integration/child-css/external-import-stylesheet.txtnew file mode 100644index 00000000000..3d618230761--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/referrer-policy/css-integration/child-css/external-import-stylesheet.txt@@ -0,0 +1,6 @@+Harness status: OK++Found 1 tests++1 Fail+Fail Child css from external stylesheet.\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/referrer-policy/css-integration/child-css/internal-import-stylesheet.txt b/Tests/LibWeb/Text/expected/wpt-import/referrer-policy/css-integration/child-css/internal-import-stylesheet.txtnew file mode 100644index 00000000000..173a334896d--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/referrer-policy/css-integration/child-css/internal-import-stylesheet.txt@@ -0,0 +1,6 @@+Harness status: OK++Found 1 tests++1 Fail+Fail Child css from internal stylesheet.\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/referrer-policy/css-integration/font-face/external-import-stylesheet.txt b/Tests/LibWeb/Text/expected/wpt-import/referrer-policy/css-integration/font-face/external-import-stylesheet.txtnew file mode 100644index 00000000000..a8668a710df--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/referrer-policy/css-integration/font-face/external-import-stylesheet.txt@@ -0,0 +1,6 @@+Harness status: OK++Found 1 tests++1 Fail+Fail Font from imported stylesheet (external).\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/referrer-policy/css-integration/font-face/external-stylesheet.txt b/Tests/LibWeb/Text/expected/wpt-import/referrer-policy/css-integration/font-face/external-stylesheet.txtnew file mode 100644index 00000000000..b72eb4b3aa6--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/referrer-policy/css-integration/font-face/external-stylesheet.txt@@ -0,0 +1,6 @@+Harness status: OK++Found 1 tests++1 Fail+Fail Font from external stylesheet.\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/referrer-policy/css-integration/font-face/internal-import-stylesheet.txt b/Tests/LibWeb/Text/expected/wpt-import/referrer-policy/css-integration/font-face/internal-import-stylesheet.txtnew file mode 100644index 00000000000..556b4eb80dc--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/referrer-policy/css-integration/font-face/internal-import-stylesheet.txt@@ -0,0 +1,6 @@+Harness status: OK++Found 1 tests++1 Fail+Fail Font from imported stylesheet (internal).\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/referrer-policy/generic/multiple-headers-and-values.txt b/Tests/LibWeb/Text/expected/wpt-import/referrer-policy/generic/multiple-headers-and-values.txtnew file mode 100644index 00000000000..3843655fee3--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/referrer-policy/generic/multiple-headers-and-values.txt@@ -0,0 +1,6 @@+Harness status: OK++Found 1 tests++1 Fail+Fail Image uses the last recognized Referrer-Policy header value\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/referrer-policy/generic/multiple-headers-one-unknown-token.txt b/Tests/LibWeb/Text/expected/wpt-import/referrer-policy/generic/multiple-headers-one-unknown-token.txtnew file mode 100644index 00000000000..28d496467a0--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/referrer-policy/generic/multiple-headers-one-unknown-token.txt@@ -0,0 +1,6 @@+Harness status: OK++Found 1 tests++1 Fail+Fail Image uses last recognized referrer policy token from Referrer-Policy headers\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/referrer-policy/generic/subresource-test/area-navigate.txt b/Tests/LibWeb/Text/expected/wpt-import/referrer-policy/generic/subresource-test/area-navigate.txtnew file mode 100644index 00000000000..43fa442af89--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/referrer-policy/generic/subresource-test/area-navigate.txt@@ -0,0 +1,6 @@+Harness status: OK++Found 1 tests++1 Fail+Fail Area is responding with HTTP headers\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/referrer-policy/generic/subresource-test/fetch-messaging.txt b/Tests/LibWeb/Text/expected/wpt-import/referrer-policy/generic/subresource-test/fetch-messaging.txtnew file mode 100644index 00000000000..2b06800b113--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/referrer-policy/generic/subresource-test/fetch-messaging.txt@@ -0,0 +1,8 @@+Harness status: OK++Found 2 tests++1 Pass+1 Fail+Pass Fetch is supported by the browser.+Fail Fetch is responding with HTTP headers\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/referrer-policy/generic/subresource-test/iframe-messaging.txt b/Tests/LibWeb/Text/expected/wpt-import/referrer-policy/generic/subresource-test/iframe-messaging.txtnew file mode 100644index 00000000000..aaa874443c7--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/referrer-policy/generic/subresource-test/iframe-messaging.txt@@ -0,0 +1,6 @@+Harness status: OK++Found 1 tests++1 Fail+Fail Iframe is responding with HTTP headers\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/referrer-policy/generic/subresource-test/image-decoding.txt b/Tests/LibWeb/Text/expected/wpt-import/referrer-policy/generic/subresource-test/image-decoding.txtnew file mode 100644index 00000000000..c4a9d4f5ad7--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/referrer-policy/generic/subresource-test/image-decoding.txt@@ -0,0 +1,6 @@+Harness status: OK++Found 1 tests++1 Fail+Fail Image is encoding headers as JSON.\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/referrer-policy/generic/subresource-test/link-navigate.txt b/Tests/LibWeb/Text/expected/wpt-import/referrer-policy/generic/subresource-test/link-navigate.txtnew file mode 100644index 00000000000..774d8adf0b6--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/referrer-policy/generic/subresource-test/link-navigate.txt@@ -0,0 +1,6 @@+Harness status: OK++Found 1 tests++1 Fail+Fail Link is responding with HTTP headers\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/referrer-policy/generic/subresource-test/script-messaging.txt b/Tests/LibWeb/Text/expected/wpt-import/referrer-policy/generic/subresource-test/script-messaging.txtnew file mode 100644index 00000000000..37c32d3b3c2--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/referrer-policy/generic/subresource-test/script-messaging.txt@@ -0,0 +1,6 @@+Harness status: OK++Found 1 tests++1 Fail+Fail Script is responding with HTTP headers\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/referrer-policy/generic/subresource-test/worker-messaging.txt b/Tests/LibWeb/Text/expected/wpt-import/referrer-policy/generic/subresource-test/worker-messaging.txtnew file mode 100644index 00000000000..0c87c85ffa6--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/referrer-policy/generic/subresource-test/worker-messaging.txt@@ -0,0 +1,6 @@+Harness status: OK++Found 1 tests++1 Fail+Fail Worker is responding with HTTP headers\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/referrer-policy/generic/subresource-test/xhr-messaging.txt b/Tests/LibWeb/Text/expected/wpt-import/referrer-policy/generic/subresource-test/xhr-messaging.txtnew file mode 100644index 00000000000..2617145d5ff--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/referrer-policy/generic/subresource-test/xhr-messaging.txt@@ -0,0 +1,6 @@+Harness status: OK++Found 1 tests++1 Fail+Fail XHR is responding with HTTP headers\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/websockets/idlharness.any.txt b/Tests/LibWeb/Text/expected/wpt-import/websockets/idlharness.any.txtnew file mode 100644index 00000000000..0a263f8c609--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/websockets/idlharness.any.txt@@ -0,0 +1,68 @@+Harness status: OK++Found 62 tests++60 Pass+2 Fail+Pass idl_test setup+Pass idl_test validation+Pass WebSocket interface: existence and properties of interface object+Pass WebSocket interface object length+Pass WebSocket interface object name+Pass WebSocket interface: existence and properties of interface prototype object+Pass WebSocket interface: existence and properties of interface prototype object's "constructor" property+Pass WebSocket interface: existence and properties of interface prototype object's @@unscopables property+Pass WebSocket interface: attribute url+Pass WebSocket interface: constant CONNECTING on interface object+Pass WebSocket interface: constant CONNECTING on interface prototype object+Pass WebSocket interface: constant OPEN on interface object+Pass WebSocket interface: constant OPEN on interface prototype object+Pass WebSocket interface: constant CLOSING on interface object+Pass WebSocket interface: constant CLOSING on interface prototype object+Pass WebSocket interface: constant CLOSED on interface object+Pass WebSocket interface: constant CLOSED on interface prototype object+Pass WebSocket interface: attribute readyState+Fail WebSocket interface: attribute bufferedAmount+Pass WebSocket interface: attribute onopen+Pass WebSocket interface: attribute onerror+Pass WebSocket interface: attribute onclose+Pass WebSocket interface: attribute extensions+Pass WebSocket interface: attribute protocol+Pass WebSocket interface: operation close(optional unsigned short, optional USVString)+Pass WebSocket interface: attribute onmessage+Pass WebSocket interface: attribute binaryType+Pass WebSocket interface: operation send((BufferSource or Blob or USVString))+Pass WebSocket must be primary interface of new WebSocket("ws://invalid")+Pass Stringification of new WebSocket("ws://invalid")+Pass WebSocket interface: new WebSocket("ws://invalid") must inherit property "url" with the proper type+Pass WebSocket interface: new WebSocket("ws://invalid") must inherit property "CONNECTING" with the proper type+Pass WebSocket interface: new WebSocket("ws://invalid") must inherit property "OPEN" with the proper type+Pass WebSocket interface: new WebSocket("ws://invalid") must inherit property "CLOSING" with the proper type+Pass WebSocket interface: new WebSocket("ws://invalid") must inherit property "CLOSED" with the proper type+Pass WebSocket interface: new WebSocket("ws://invalid") must inherit property "readyState" with the proper type+Fail WebSocket interface: new WebSocket("ws://invalid") must inherit property "bufferedAmount" with the proper type+Pass WebSocket interface: new WebSocket("ws://invalid") must inherit property "onopen" with the proper type+Pass WebSocket interface: new WebSocket("ws://invalid") must inherit property "onerror" with the proper type+Pass WebSocket interface: new WebSocket("ws://invalid") must inherit property "onclose" with the proper type+Pass WebSocket interface: new WebSocket("ws://invalid") must inherit property "extensions" with the proper type+Pass WebSocket interface: new WebSocket("ws://invalid") must inherit property "protocol" with the proper type+Pass WebSocket interface: new WebSocket("ws://invalid") must inherit property "close(optional unsigned short, optional USVString)" with the proper type+Pass WebSocket interface: calling close(optional unsigned short, optional USVString) on new WebSocket("ws://invalid") with too few arguments must throw TypeError+Pass WebSocket interface: new WebSocket("ws://invalid") must inherit property "onmessage" with the proper type+Pass WebSocket interface: new WebSocket("ws://invalid") must inherit property "binaryType" with the proper type+Pass WebSocket interface: new WebSocket("ws://invalid") must inherit property "send((BufferSource or Blob or USVString))" with the proper type+Pass WebSocket interface: calling send((BufferSource or Blob or USVString)) on new WebSocket("ws://invalid") with too few arguments must throw TypeError+Pass CloseEvent interface: existence and properties of interface object+Pass CloseEvent interface object length+Pass CloseEvent interface object name+Pass CloseEvent interface: existence and properties of interface prototype object+Pass CloseEvent interface: existence and properties of interface prototype object's "constructor" property+Pass CloseEvent interface: existence and properties of interface prototype object's @@unscopables property+Pass CloseEvent interface: attribute wasClean+Pass CloseEvent interface: attribute code+Pass CloseEvent interface: attribute reason+Pass CloseEvent must be primary interface of new CloseEvent("close")+Pass Stringification of new CloseEvent("close")+Pass CloseEvent interface: new CloseEvent("close") must inherit property "wasClean" with the proper type+Pass CloseEvent interface: new CloseEvent("close") must inherit property "code" with the proper type+Pass CloseEvent interface: new CloseEvent("close") must inherit property "reason" with the proper type\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/websockets/idlharness.any.worker.txt b/Tests/LibWeb/Text/expected/wpt-import/websockets/idlharness.any.worker.txtnew file mode 100644index 00000000000..0a263f8c609--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/websockets/idlharness.any.worker.txt@@ -0,0 +1,68 @@+Harness status: OK++Found 62 tests++60 Pass+2 Fail+Pass idl_test setup+Pass idl_test validation+Pass WebSocket interface: existence and properties of interface object+Pass WebSocket interface object length+Pass WebSocket interface object name+Pass WebSocket interface: existence and properties of interface prototype object+Pass WebSocket interface: existence and properties of interface prototype object's "constructor" property+Pass WebSocket interface: existence and properties of interface prototype object's @@unscopables property+Pass WebSocket interface: attribute url+Pass WebSocket interface: constant CONNECTING on interface object+Pass WebSocket interface: constant CONNECTING on interface prototype object+Pass WebSocket interface: constant OPEN on interface object+Pass WebSocket interface: constant OPEN on interface prototype object+Pass WebSocket interface: constant CLOSING on interface object+Pass WebSocket interface: constant CLOSING on interface prototype object+Pass WebSocket interface: constant CLOSED on interface object+Pass WebSocket interface: constant CLOSED on interface prototype object+Pass WebSocket interface: attribute readyState+Fail WebSocket interface: attribute bufferedAmount+Pass WebSocket interface: attribute onopen+Pass WebSocket interface: attribute onerror+Pass WebSocket interface: attribute onclose+Pass WebSocket interface: attribute extensions+Pass WebSocket interface: attribute protocol+Pass WebSocket interface: operation close(optional unsigned short, optional USVString)+Pass WebSocket interface: attribute onmessage+Pass WebSocket interface: attribute binaryType+Pass WebSocket interface: operation send((BufferSource or Blob or USVString))+Pass WebSocket must be primary interface of new WebSocket("ws://invalid")+Pass Stringification of new WebSocket("ws://invalid")+Pass WebSocket interface: new WebSocket("ws://invalid") must inherit property "url" with the proper type+Pass WebSocket interface: new WebSocket("ws://invalid") must inherit property "CONNECTING" with the proper type+Pass WebSocket interface: new WebSocket("ws://invalid") must inherit property "OPEN" with the proper type+Pass WebSocket interface: new WebSocket("ws://invalid") must inherit property "CLOSING" with the proper type+Pass WebSocket interface: new WebSocket("ws://invalid") must inherit property "CLOSED" with the proper type+Pass WebSocket interface: new WebSocket("ws://invalid") must inherit property "readyState" with the proper type+Fail WebSocket interface: new WebSocket("ws://invalid") must inherit property "bufferedAmount" with the proper type+Pass WebSocket interface: new WebSocket("ws://invalid") must inherit property "onopen" with the proper type+Pass WebSocket interface: new WebSocket("ws://invalid") must inherit property "onerror" with the proper type+Pass WebSocket interface: new WebSocket("ws://invalid") must inherit property "onclose" with the proper type+Pass WebSocket interface: new WebSocket("ws://invalid") must inherit property "extensions" with the proper type+Pass WebSocket interface: new WebSocket("ws://invalid") must inherit property "protocol" with the proper type+Pass WebSocket interface: new WebSocket("ws://invalid") must inherit property "close(optional unsigned short, optional USVString)" with the proper type+Pass WebSocket interface: calling close(optional unsigned short, optional USVString) on new WebSocket("ws://invalid") with too few arguments must throw TypeError+Pass WebSocket interface: new WebSocket("ws://invalid") must inherit property "onmessage" with the proper type+Pass WebSocket interface: new WebSocket("ws://invalid") must inherit property "binaryType" with the proper type+Pass WebSocket interface: new WebSocket("ws://invalid") must inherit property "send((BufferSource or Blob or USVString))" with the proper type+Pass WebSocket interface: calling send((BufferSource or Blob or USVString)) on new WebSocket("ws://invalid") with too few arguments must throw TypeError+Pass CloseEvent interface: existence and properties of interface object+Pass CloseEvent interface object length+Pass CloseEvent interface object name+Pass CloseEvent interface: existence and properties of interface prototype object+Pass CloseEvent interface: existence and properties of interface prototype object's "constructor" property+Pass CloseEvent interface: existence and properties of interface prototype object's @@unscopables property+Pass CloseEvent interface: attribute wasClean+Pass CloseEvent interface: attribute code+Pass CloseEvent interface: attribute reason+Pass CloseEvent must be primary interface of new CloseEvent("close")+Pass Stringification of new CloseEvent("close")+Pass CloseEvent interface: new CloseEvent("close") must inherit property "wasClean" with the proper type+Pass CloseEvent interface: new CloseEvent("close") must inherit property "code" with the proper type+Pass CloseEvent interface: new CloseEvent("close") must inherit property "reason" with the proper type\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/xhr/request-content-length.any.txt b/Tests/LibWeb/Text/expected/wpt-import/xhr/request-content-length.any.txtnew file mode 100644index 00000000000..982655a7396--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/xhr/request-content-length.any.txt@@ -0,0 +1,7 @@+Harness status: OK++Found 2 tests++2 Pass+Pass Uploads need to set the Content-Length header+Pass Fetched blob: URLs set the Content-Length header\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/xhr/request-content-length.any.worker.txt b/Tests/LibWeb/Text/expected/wpt-import/xhr/request-content-length.any.worker.txtnew file mode 100644index 00000000000..982655a7396--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/xhr/request-content-length.any.worker.txt@@ -0,0 +1,7 @@+Harness status: OK++Found 2 tests++2 Pass+Pass Uploads need to set the Content-Length header+Pass Fetched blob: URLs set the Content-Length header\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/xhr/responsedocument-decoding.txt b/Tests/LibWeb/Text/expected/wpt-import/xhr/responsedocument-decoding.txtnew file mode 100644index 00000000000..9717c106ff0--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/xhr/responsedocument-decoding.txt@@ -0,0 +1,12 @@+Harness status: OK++Found 6 tests++4 Pass+2 Fail+Fail XMLHttpRequest: response document decoding (application/xml %3C%3Fxml%20version%3D'1.0'%20encoding%3D'windows-1252'%3F%3E%3Cx%3E%e6%a9%9f%3C%2Fx%3E)+Pass XMLHttpRequest: response document decoding (application/xml;charset=utf-8 %3C%3Fxml%20version%3D'1.0'%20encoding%3D'windows-1252'%3F%3E%3Cx%3E%e6%a9%9f%3C%2Fx%3E)+Fail XMLHttpRequest: response document decoding (application/xml;charset=windows-1252 %3C%3Fxml%20version%3D'1.0'%20encoding%3D'windows-1252'%3F%3E%3Cx%3E%e6%a9%9f%3C%2Fx%3E)+Pass XMLHttpRequest: response document decoding (text/html %3C!doctype%20html%3E%3Cmeta%20charset%3Dwindows-1252%3E%3Cx%3E%e6%a9%9f%3C%2Fx%3E)+Pass XMLHttpRequest: response document decoding (text/html;charset=utf-8 %3C!doctype%20html%3E%3Cmeta%20charset%3Dwindows-1252%3E%3Cx%3E%e6%a9%9f%3C%2Fx%3E)+Pass XMLHttpRequest: response document decoding (text/html;charset=windows-1252 %3C!doctype%20html%3E%3Cmeta%20charset%3Dwindows-1252%3E%3Cx%3E%e6%a9%9f%3C%2Fx%3E)\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/xhr/responsetext-decoding.txt b/Tests/LibWeb/Text/expected/wpt-import/xhr/responsetext-decoding.txtnew file mode 100644index 00000000000..dac6c8ac104--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/xhr/responsetext-decoding.txt@@ -0,0 +1,43 @@+Harness status: OK++Found 37 tests++36 Pass+1 Fail+Fail XMLHttpRequest: responseText decoding (application/xml %3C%3Fxml%20version%3D'1.0'%20encoding%3D'windows-1252'%3F%3E%3Cx%3E%e6%a9%9f%3C%2Fx%3E empty)+Pass XMLHttpRequest: responseText decoding (text/html %3C!doctype%20html%3E%3Cmeta%20charset%3Dwindows-1252%3E%3Cx%3E%e6%a9%9f%3C%2Fx%3E empty)+Pass XMLHttpRequest: responseText decoding (application/xml;charset=utf-8 %3C%3Fxml%20version%3D'1.0'%20encoding%3D'windows-1252'%3F%3E%3Cx%3E%e6%a9%9f%3C%2Fx%3E empty)+Pass XMLHttpRequest: responseText decoding (application/xml;charset=windows-1252 %3C%3Fxml%20version%3D'1.0'%20encoding%3D'windows-1252'%3F%3E%3Cx%3E%e6%a9%9f%3C%2Fx%3E empty)+Pass XMLHttpRequest: responseText decoding (text/html;charset=utf-8 %3C!doctype%20html%3E%3Cmeta%20charset%3Dwindows-1252%3E%3Cx%3E%e6%a9%9f%3C%2Fx%3E empty)+Pass XMLHttpRequest: responseText decoding (text/html;charset=windows-1252 %3C!doctype%20html%3E%3Cmeta%20charset%3Dwindows-1252%3E%3Cx%3E%e6%a9%9f%3C%2Fx%3E empty)+Pass XMLHttpRequest: responseText decoding (text/plain;charset=windows-1252 %FF empty)+Pass XMLHttpRequest: responseText decoding (text/plain %FF empty)+Pass XMLHttpRequest: responseText decoding (text/plain %FE%FF empty)+Pass XMLHttpRequest: responseText decoding (text/plain %FE%FF%FE%FF empty)+Pass XMLHttpRequest: responseText decoding (text/plain %EF%BB%BF empty)+Pass XMLHttpRequest: responseText decoding (text/plain %EF%BB%BF%EF%BB%BF empty)+Pass XMLHttpRequest: responseText decoding (text/plain %C2 empty)+Pass XMLHttpRequest: responseText decoding (text/xml %FE%FF empty)+Pass XMLHttpRequest: responseText decoding (text/xml %FE%FF%FE%FF empty)+Pass XMLHttpRequest: responseText decoding (text/xml %EF%BB%BF empty)+Pass XMLHttpRequest: responseText decoding (text/xml %EF%BB%BF%EF%BB%BF empty)+Pass XMLHttpRequest: responseText decoding (text/plain %E3%81%B2 empty)+Pass XMLHttpRequest: responseText decoding (application/xml %3C%3Fxml%20version%3D'1.0'%20encoding%3D'windows-1252'%3F%3E%3Cx%3E%e6%a9%9f%3C%2Fx%3E text)+Pass XMLHttpRequest: responseText decoding (text/html %3C!doctype%20html%3E%3Cmeta%20charset%3Dwindows-1252%3E%3Cx%3E%e6%a9%9f%3C%2Fx%3E text)+Pass XMLHttpRequest: responseText decoding (application/xml;charset=utf-8 %3C%3Fxml%20version%3D'1.0'%20encoding%3D'windows-1252'%3F%3E%3Cx%3E%e6%a9%9f%3C%2Fx%3E text)+Pass XMLHttpRequest: responseText decoding (application/xml;charset=windows-1252 %3C%3Fxml%20version%3D'1.0'%20encoding%3D'windows-1252'%3F%3E%3Cx%3E%e6%a9%9f%3C%2Fx%3E text)+Pass XMLHttpRequest: responseText decoding (text/html;charset=utf-8 %3C!doctype%20html%3E%3Cmeta%20charset%3Dwindows-1252%3E%3Cx%3E%e6%a9%9f%3C%2Fx%3E text)+Pass XMLHttpRequest: responseText decoding (text/html;charset=windows-1252 %3C!doctype%20html%3E%3Cmeta%20charset%3Dwindows-1252%3E%3Cx%3E%e6%a9%9f%3C%2Fx%3E text)+Pass XMLHttpRequest: responseText decoding (text/plain;charset=windows-1252 %FF text)+Pass XMLHttpRequest: responseText decoding (text/plain %FF text)+Pass XMLHttpRequest: responseText decoding (text/plain %FE%FF text)+Pass XMLHttpRequest: responseText decoding (text/plain %FE%FF%FE%FF text)+Pass XMLHttpRequest: responseText decoding (text/plain %EF%BB%BF text)+Pass XMLHttpRequest: responseText decoding (text/plain %EF%BB%BF%EF%BB%BF text)+Pass XMLHttpRequest: responseText decoding (text/plain %C2 text)+Pass XMLHttpRequest: responseText decoding (text/plain;charset=bogus %C2 text)+Pass XMLHttpRequest: responseText decoding (text/xml %FE%FF text)+Pass XMLHttpRequest: responseText decoding (text/xml %FE%FF%FE%FF text)+Pass XMLHttpRequest: responseText decoding (text/xml %EF%BB%BF text)+Pass XMLHttpRequest: responseText decoding (text/xml %EF%BB%BF%EF%BB%BF text)+Pass XMLHttpRequest: responseText decoding (text/plain %E3%81%B2 text)\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/xhr/send-usp.any.worker.txt b/Tests/LibWeb/Text/expected/wpt-import/xhr/send-usp.any.worker.txtnew file mode 100644index 00000000000..a57ca515377--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/xhr/send-usp.any.worker.txt@@ -0,0 +1,140 @@+Harness status: OK++Found 135 tests++135 Pass+Pass Overall fetch with URLSearchParams+Pass XMLHttpRequest.send(URLSearchParams) (0)+Pass XMLHttpRequest.send(URLSearchParams) (1)+Pass XMLHttpRequest.send(URLSearchParams) (2)+Pass XMLHttpRequest.send(URLSearchParams) (3)+Pass XMLHttpRequest.send(URLSearchParams) (4)+Pass XMLHttpRequest.send(URLSearchParams) (5)+Pass XMLHttpRequest.send(URLSearchParams) (6)+Pass XMLHttpRequest.send(URLSearchParams) (7)+Pass XMLHttpRequest.send(URLSearchParams) (8)+Pass XMLHttpRequest.send(URLSearchParams) (9)+Pass XMLHttpRequest.send(URLSearchParams) (10)+Pass XMLHttpRequest.send(URLSearchParams) (11)+Pass XMLHttpRequest.send(URLSearchParams) (12)+Pass XMLHttpRequest.send(URLSearchParams) (13)+Pass XMLHttpRequest.send(URLSearchParams) (14)+Pass XMLHttpRequest.send(URLSearchParams) (15)+Pass XMLHttpRequest.send(URLSearchParams) (16)+Pass XMLHttpRequest.send(URLSearchParams) (17)+Pass XMLHttpRequest.send(URLSearchParams) (18)+Pass XMLHttpRequest.send(URLSearchParams) (19)+Pass XMLHttpRequest.send(URLSearchParams) (20)+Pass XMLHttpRequest.send(URLSearchParams) (21)+Pass XMLHttpRequest.send(URLSearchParams) (22)+Pass XMLHttpRequest.send(URLSearchParams) (23)+Pass XMLHttpRequest.send(URLSearchParams) (24)+Pass XMLHttpRequest.send(URLSearchParams) (25)+Pass XMLHttpRequest.send(URLSearchParams) (26)+Pass XMLHttpRequest.send(URLSearchParams) (27)+Pass XMLHttpRequest.send(URLSearchParams) (28)+Pass XMLHttpRequest.send(URLSearchParams) (29)+Pass XMLHttpRequest.send(URLSearchParams) (30)+Pass XMLHttpRequest.send(URLSearchParams) (31)+Pass XMLHttpRequest.send(URLSearchParams) (32)+Pass XMLHttpRequest.send(URLSearchParams) (33)+Pass XMLHttpRequest.send(URLSearchParams) (34)+Pass XMLHttpRequest.send(URLSearchParams) (35)+Pass XMLHttpRequest.send(URLSearchParams) (36)+Pass XMLHttpRequest.send(URLSearchParams) (37)+Pass XMLHttpRequest.send(URLSearchParams) (38)+Pass XMLHttpRequest.send(URLSearchParams) (39)+Pass XMLHttpRequest.send(URLSearchParams) (40)+Pass XMLHttpRequest.send(URLSearchParams) (41)+Pass XMLHttpRequest.send(URLSearchParams) (42)+Pass XMLHttpRequest.send(URLSearchParams) (43)+Pass XMLHttpRequest.send(URLSearchParams) (44)+Pass XMLHttpRequest.send(URLSearchParams) (45)+Pass XMLHttpRequest.send(URLSearchParams) (46)+Pass XMLHttpRequest.send(URLSearchParams) (47)+Pass XMLHttpRequest.send(URLSearchParams) (48)+Pass XMLHttpRequest.send(URLSearchParams) (49)+Pass XMLHttpRequest.send(URLSearchParams) (50)+Pass XMLHttpRequest.send(URLSearchParams) (51)+Pass XMLHttpRequest.send(URLSearchParams) (52)+Pass XMLHttpRequest.send(URLSearchParams) (53)+Pass XMLHttpRequest.send(URLSearchParams) (54)+Pass XMLHttpRequest.send(URLSearchParams) (55)+Pass XMLHttpRequest.send(URLSearchParams) (56)+Pass XMLHttpRequest.send(URLSearchParams) (57)+Pass XMLHttpRequest.send(URLSearchParams) (58)+Pass XMLHttpRequest.send(URLSearchParams) (59)+Pass XMLHttpRequest.send(URLSearchParams) (60)+Pass XMLHttpRequest.send(URLSearchParams) (61)+Pass XMLHttpRequest.send(URLSearchParams) (62)+Pass XMLHttpRequest.send(URLSearchParams) (63)+Pass XMLHttpRequest.send(URLSearchParams) (64)+Pass XMLHttpRequest.send(URLSearchParams) (65)+Pass XMLHttpRequest.send(URLSearchParams) (66)+Pass XMLHttpRequest.send(URLSearchParams) (67)+Pass XMLHttpRequest.send(URLSearchParams) (68)+Pass XMLHttpRequest.send(URLSearchParams) (69)+Pass XMLHttpRequest.send(URLSearchParams) (70)+Pass XMLHttpRequest.send(URLSearchParams) (71)+Pass XMLHttpRequest.send(URLSearchParams) (72)+Pass XMLHttpRequest.send(URLSearchParams) (73)+Pass XMLHttpRequest.send(URLSearchParams) (74)+Pass XMLHttpRequest.send(URLSearchParams) (75)+Pass XMLHttpRequest.send(URLSearchParams) (76)+Pass XMLHttpRequest.send(URLSearchParams) (77)+Pass XMLHttpRequest.send(URLSearchParams) (78)+Pass XMLHttpRequest.send(URLSearchParams) (79)+Pass XMLHttpRequest.send(URLSearchParams) (80)+Pass XMLHttpRequest.send(URLSearchParams) (81)+Pass XMLHttpRequest.send(URLSearchParams) (82)+Pass XMLHttpRequest.send(URLSearchParams) (83)+Pass XMLHttpRequest.send(URLSearchParams) (84)+Pass XMLHttpRequest.send(URLSearchParams) (85)+Pass XMLHttpRequest.send(URLSearchParams) (86)+Pass XMLHttpRequest.send(URLSearchParams) (87)+Pass XMLHttpRequest.send(URLSearchParams) (88)+Pass XMLHttpRequest.send(URLSearchParams) (89)+Pass XMLHttpRequest.send(URLSearchParams) (90)+Pass XMLHttpRequest.send(URLSearchParams) (91)+Pass XMLHttpRequest.send(URLSearchParams) (92)+Pass XMLHttpRequest.send(URLSearchParams) (93)+Pass XMLHttpRequest.send(URLSearchParams) (94)+Pass XMLHttpRequest.send(URLSearchParams) (95)+Pass XMLHttpRequest.send(URLSearchParams) (96)+Pass XMLHttpRequest.send(URLSearchParams) (97)+Pass XMLHttpRequest.send(URLSearchParams) (98)+Pass XMLHttpRequest.send(URLSearchParams) (99)+Pass XMLHttpRequest.send(URLSearchParams) (100)+Pass XMLHttpRequest.send(URLSearchParams) (101)+Pass XMLHttpRequest.send(URLSearchParams) (102)+Pass XMLHttpRequest.send(URLSearchParams) (103)+Pass XMLHttpRequest.send(URLSearchParams) (104)+Pass XMLHttpRequest.send(URLSearchParams) (105)+Pass XMLHttpRequest.send(URLSearchParams) (106)+Pass XMLHttpRequest.send(URLSearchParams) (107)+Pass XMLHttpRequest.send(URLSearchParams) (108)+Pass XMLHttpRequest.send(URLSearchParams) (109)+Pass XMLHttpRequest.send(URLSearchParams) (110)+Pass XMLHttpRequest.send(URLSearchParams) (111)+Pass XMLHttpRequest.send(URLSearchParams) (112)+Pass XMLHttpRequest.send(URLSearchParams) (113)+Pass XMLHttpRequest.send(URLSearchParams) (114)+Pass XMLHttpRequest.send(URLSearchParams) (115)+Pass XMLHttpRequest.send(URLSearchParams) (116)+Pass XMLHttpRequest.send(URLSearchParams) (117)+Pass XMLHttpRequest.send(URLSearchParams) (118)+Pass XMLHttpRequest.send(URLSearchParams) (119)+Pass XMLHttpRequest.send(URLSearchParams) (120)+Pass XMLHttpRequest.send(URLSearchParams) (121)+Pass XMLHttpRequest.send(URLSearchParams) (122)+Pass XMLHttpRequest.send(URLSearchParams) (123)+Pass XMLHttpRequest.send(URLSearchParams) (124)+Pass XMLHttpRequest.send(URLSearchParams) (125)+Pass XMLHttpRequest.send(URLSearchParams) (126)+Pass XMLHttpRequest.send(URLSearchParams) (127)+Pass XMLHttpRequest.send(URLSearchParams): POST uses the URLSearchParams MIME type when no Content-Type was set+Pass XMLHttpRequest.send(URLSearchParams): POST keeps an author-set Content-Type+Pass XMLHttpRequest.send(URLSearchParams): POST replaces the charset parameter of an author-set Content-Type+Pass XMLHttpRequest.send(URLSearchParams): GET sends neither a body nor a Content-Type+Pass XMLHttpRequest.send(URLSearchParams): HEAD sends neither a body nor a Content-Type+Pass XMLHttpRequest.send(URLSearchParams): GET keeps an author-set Content-Type\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/xhr/setrequestheader-content-type.txt b/Tests/LibWeb/Text/expected/wpt-import/xhr/setrequestheader-content-type.txtnew file mode 100644index 00000000000..8a203d716a9--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/xhr/setrequestheader-content-type.txt@@ -0,0 +1,40 @@+Harness status: OK++Found 34 tests++33 Pass+1 Fail+Pass setRequestHeader("") sends a blank string+Pass setRequestHeader(" ") sends the string " "+Pass setRequestHeader(null) sends the string "null"+Pass setRequestHeader(undefined) sends the string "undefined"+Pass String request has correct default Content-Type of "text/plain;charset=UTF-8"+Pass String request keeps setRequestHeader() Content-Type, with charset adjusted to UTF-8+Pass String request keeps setRequestHeader() Content-Type without charset+Pass XML Document request respects setRequestHeader("")+Pass XML Document request has correct default Content-Type of "application/xml;charset=UTF-8"+Pass XML Document request keeps setRequestHeader() Content-Type, with charset adjusted to UTF-8+Pass XML Document request keeps setRequestHeader() Content-Type without charset+Pass HTML Document request respects setRequestHeader("")+Pass HTML Document request has correct default Content-Type of "text/html;charset=UTF-8"+Pass HTML Document request keeps setRequestHeader() Content-Type, with charset adjusted to UTF-8+Pass HTML Document request keeps setRequestHeader() Content-Type without charset+Pass Blob request respects setRequestHeader("") to be specified+Pass Blob request with unset type sends no Content-Type without setRequestHeader() call+Pass Blob request with unset type keeps setRequestHeader() Content-Type and charset+Pass Blob request with set type respects setRequestHeader("") to be specified+Fail Blob request with set type uses that it for Content-Type unless setRequestHeader()+Pass Blob request with set type keeps setRequestHeader() Content-Type and charset+Pass ArrayBuffer request respects setRequestHeader("")+Pass ArrayBuffer request sends no Content-Type without setRequestHeader() call+Pass ArrayBuffer request keeps setRequestHeader() Content-Type and charset+Pass ArrayBufferView request respects setRequestHeader("")+Pass ArrayBufferView request sends no Content-Type without setRequestHeader() call+Pass ArrayBufferView request keeps setRequestHeader() Content-Type and charset+Pass FormData request respects setRequestHeader("")+Pass FormData request has correct default Content-Type of "multipart/form-data; boundary=_"+Pass FormData request keeps setRequestHeader() Content-Type and charset+Pass URLSearchParams respects setRequestHeader("")+Pass URLSearchParams request has correct default Content-Type of "application/x-www-form-urlencoded;charset=UTF-8"+Pass URLSearchParams request keeps setRequestHeader() Content-Type, with charset adjusted to UTF-8+Pass URLSearchParams request keeps setRequestHeader() Content-Type without charset\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/xhr/split-byte-order-mark.any.txt b/Tests/LibWeb/Text/expected/wpt-import/xhr/split-byte-order-mark.any.txtnew file mode 100644index 00000000000..5e6912474f5--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/xhr/split-byte-order-mark.any.txt@@ -0,0 +1,9 @@+Harness status: OK++Found 4 tests++4 Pass+Pass responseText strips a UTF-8 byte order mark split across chunks+Pass responseText uses a UTF-16LE byte order mark split across chunks+Pass responseText does not strip a UTF-8 byte order mark in a later chunk+Pass JSON response strips a UTF-8 byte order mark split across chunks\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/xhr/split-byte-order-mark.any.worker.txt b/Tests/LibWeb/Text/expected/wpt-import/xhr/split-byte-order-mark.any.worker.txtnew file mode 100644index 00000000000..5e6912474f5--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/xhr/split-byte-order-mark.any.worker.txt@@ -0,0 +1,9 @@+Harness status: OK++Found 4 tests++4 Pass+Pass responseText strips a UTF-8 byte order mark split across chunks+Pass responseText uses a UTF-16LE byte order mark split across chunks+Pass responseText does not strip a UTF-8 byte order mark in a later chunk+Pass JSON response strips a UTF-8 byte order mark split across chunks\ No newline at end of filediff --git a/Tests/LibWeb/Text/input/wpt-import/fetch/api/basic/integrity.sub.any.html b/Tests/LibWeb/Text/input/wpt-import/fetch/api/basic/integrity.sub.any.htmlnew file mode 100644index 00000000000..2626c66a776--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/fetch/api/basic/integrity.sub.any.html@@ -0,0 +1,15 @@+<!doctype html>+<meta charset=utf-8>++<script>+self.GLOBAL = {+ isWindow: function() { return true; },+ isWorker: function() { return false; },+ isShadowRealm: function() { return false; },+};+</script>+<script src="../../../resources/testharness.js"></script>+<script src="../../../resources/testharnessreport.js"></script>+<script src="../resources/utils.js"></script>+<div id=log></div>+<script src="../../../fetch/api/basic/integrity.sub.any.js"></script>diff --git a/Tests/LibWeb/Text/input/wpt-import/fetch/api/basic/integrity.sub.any.js b/Tests/LibWeb/Text/input/wpt-import/fetch/api/basic/integrity.sub.any.jsnew file mode 100644index 00000000000..0339a5c5f14--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/fetch/api/basic/integrity.sub.any.js@@ -0,0 +1,87 @@+// META: global=window,dedicatedworker,sharedworker+// META: script=../resources/utils.js++function integrity(desc, url, integrity, initRequestMode, shouldPass) {+ var fetchRequestInit = {'integrity': integrity}+ if (!!initRequestMode && initRequestMode !== "") {+ fetchRequestInit.mode = initRequestMode;+ }++ if (shouldPass) {+ promise_test(function(test) {+ return fetch(url, fetchRequestInit).then(function(resp) {+ if (initRequestMode !== "no-cors") {+ assert_equals(resp.status, 200, "Response's status is 200");+ } else {+ assert_equals(resp.status, 0, "Opaque response's status is 0");+ assert_equals(resp.type, "opaque");+ }+ });+ }, desc);+ } else {+ promise_test(function(test) {+ return promise_rejects_js(test, TypeError, fetch(url, fetchRequestInit));+ }, desc);+ }+}++const topSha256 = "sha256-KHIDZcXnR2oBHk9DrAA+5fFiR6JjudYjqoXtMR1zvzk=";+const topSha384 = "sha384-MgZYnnAzPM/MjhqfOIMfQK5qcFvGZsGLzx4Phd7/A8fHTqqLqXqKo8cNzY3xEPTL";+const topSha512 = "sha512-D6yns0qxG0E7+TwkevZ4Jt5t7Iy3ugmAajG/dlf6Pado1JqTyneKXICDiqFIkLMRExgtvg8PlxbKTkYfRejSOg==";+const topSha512wrongpadding = "sha512-D6yns0qxG0E7+TwkevZ4Jt5t7Iy3ugmAajG/dlf6Pado1JqTyneKXICDiqFIkLMRExgtvg8PlxbKTkYfRejSOg";+const topSha512base64url = "sha512-D6yns0qxG0E7-TwkevZ4Jt5t7Iy3ugmAajG_dlf6Pado1JqTyneKXICDiqFIkLMRExgtvg8PlxbKTkYfRejSOg==";+const topSha512base64url_nopadding = "sha512-D6yns0qxG0E7-TwkevZ4Jt5t7Iy3ugmAajG_dlf6Pado1JqTyneKXICDiqFIkLMRExgtvg8PlxbKTkYfRejSOg";+const invalidSha256 = "sha256-dKUcPOn/AlUjWIwcHeHNqYXPlvyGiq+2dWOdFcE+24I=";+const invalidSha512 = "sha512-oUceBRNxPxnY60g/VtPCj2syT4wo4EZh2CgYdWy9veW8+OsReTXoh7dizMGZafvx9+QhMS39L/gIkxnPIn41Zg==";++const path = dirname(location.pathname) + RESOURCES_DIR + "top.txt";+const url = path;+const corsUrl =+ `http://wpt.live:8000${path}?pipe=header(Access-Control-Allow-Origin,*)`;+const corsUrl2 = `https://wpt.live:443${path}`++integrity("Empty string integrity", url, "", /* initRequestMode */ undefined,+ /* shouldPass */ true);+integrity("SHA-256 integrity", url, topSha256, /* initRequestMode */ undefined,+ /* shouldPass */ true);+integrity("SHA-384 integrity", url, topSha384, /* initRequestMode */ undefined,+ /* shouldPass */ true);+integrity("SHA-512 integrity", url, topSha512, /* initRequestMode */ undefined,+ /* shouldPass */ true);+integrity("SHA-512 integrity with missing padding", url, topSha512wrongpadding,+ /* initRequestMode */ undefined, /* shouldPass */ true);+integrity("SHA-512 integrity base64url encoded", url, topSha512base64url,+ /* initRequestMode */ undefined, /* shouldPass */ true);+integrity("SHA-512 integrity base64url encoded with missing padding", url,+ topSha512base64url_nopadding, /* initRequestMode */ undefined,+ /* shouldPass */ true);+integrity("Invalid integrity", url, invalidSha256,+ /* initRequestMode */ undefined, /* shouldPass */ false);+integrity("Multiple integrities: valid stronger than invalid", url,+ invalidSha256 + " " + topSha384, /* initRequestMode */ undefined,+ /* shouldPass */ true);+integrity("Multiple integrities: invalid stronger than valid",+ url, invalidSha512 + " " + topSha384, /* initRequestMode */ undefined,+ /* shouldPass */ false);+integrity("Multiple integrities: invalid as strong as valid", url,+ invalidSha512 + " " + topSha512, /* initRequestMode */ undefined,+ /* shouldPass */ true);+integrity("Multiple integrities: both are valid", url,+ topSha384 + " " + topSha512, /* initRequestMode */ undefined,+ /* shouldPass */ true);+integrity("Multiple integrities: both are invalid", url,+ invalidSha256 + " " + invalidSha512, /* initRequestMode */ undefined,+ /* shouldPass */ false);+integrity("CORS empty integrity", corsUrl, "", /* initRequestMode */ undefined,+ /* shouldPass */ true);+integrity("CORS SHA-512 integrity", corsUrl, topSha512,+ /* initRequestMode */ undefined, /* shouldPass */ true);+integrity("CORS invalid integrity", corsUrl, invalidSha512,+ /* initRequestMode */ undefined, /* shouldPass */ false);++integrity("Empty string integrity for opaque response", corsUrl2, "",+ /* initRequestMode */ "no-cors", /* shouldPass */ true);+integrity("SHA-* integrity for opaque response", corsUrl2, topSha512,+ /* initRequestMode */ "no-cors", /* shouldPass */ false);++done();diff --git a/Tests/LibWeb/Text/input/wpt-import/fetch/api/basic/integrity.sub.any.sharedworker.html b/Tests/LibWeb/Text/input/wpt-import/fetch/api/basic/integrity.sub.any.sharedworker.htmlnew file mode 100644index 00000000000..a4d3a89eb6f--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/fetch/api/basic/integrity.sub.any.sharedworker.html@@ -0,0 +1,9 @@+<!doctype html>+<meta charset=utf-8>++<script src="../../../resources/testharness.js"></script>+<script src="../../../resources/testharnessreport.js"></script>+<div id=log></div>+<script>+fetch_tests_from_worker(new SharedWorker("../../../fetch/api/basic/integrity.sub.any.worker.js"));+</script>diff --git a/Tests/LibWeb/Text/input/wpt-import/fetch/api/basic/integrity.sub.any.worker.html b/Tests/LibWeb/Text/input/wpt-import/fetch/api/basic/integrity.sub.any.worker.htmlnew file mode 100644index 00000000000..8dc3a93ce7e--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/fetch/api/basic/integrity.sub.any.worker.html@@ -0,0 +1,9 @@+<!doctype html>+<meta charset=utf-8>++<script src="../../../resources/testharness.js"></script>+<script src="../../../resources/testharnessreport.js"></script>+<div id=log></div>+<script>+fetch_tests_from_worker(new Worker("../../../fetch/api/basic/integrity.sub.any.worker.js"));+</script>diff --git a/Tests/LibWeb/Text/input/wpt-import/fetch/api/basic/integrity.sub.any.worker.js b/Tests/LibWeb/Text/input/wpt-import/fetch/api/basic/integrity.sub.any.worker.jsnew file mode 100644index 00000000000..0bb76b14910--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/fetch/api/basic/integrity.sub.any.worker.js@@ -0,0 +1,10 @@++self.GLOBAL = {+ isWindow: function() { return false; },+ isWorker: function() { return true; },+ isShadowRealm: function() { return false; },+};+importScripts("/resources/testharness.js");+importScripts("../resources/utils.js")+importScripts("/fetch/api/basic/integrity.sub.any.js");+done();diff --git a/Tests/LibWeb/Text/input/wpt-import/fetch/api/basic/request-headers-case.any.html b/Tests/LibWeb/Text/input/wpt-import/fetch/api/basic/request-headers-case.any.htmlnew file mode 100644index 00000000000..45a34fcf201--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/fetch/api/basic/request-headers-case.any.html@@ -0,0 +1,15 @@+<!doctype html>+<meta charset=utf-8>++<script>+self.GLOBAL = {+ isWindow: function() { return true; },+ isWorker: function() { return false; },+ isShadowRealm: function() { return false; },+};+</script>+<script src="../../../resources/testharness.js"></script>+<script src="../../../resources/testharnessreport.js"></script>++<div id=log></div>+<script src="../../../fetch/api/basic/request-headers-case.any.js"></script>diff --git a/Tests/LibWeb/Text/input/wpt-import/fetch/api/basic/request-headers-case.any.js b/Tests/LibWeb/Text/input/wpt-import/fetch/api/basic/request-headers-case.any.jsnew file mode 100644index 00000000000..4c10e717f8c--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/fetch/api/basic/request-headers-case.any.js@@ -0,0 +1,13 @@+// META: global=window,worker++promise_test(() => {+ return fetch("/xhr/resources/echo-headers.py", {headers: [["THIS-is-A-test", 1], ["THIS-IS-A-TEST", 2]] }).then(res => res.text()).then(body => {+ assert_regexp_match(body, /THIS-is-A-test: 1, 2/)+ })+}, "Multiple headers with the same name, different case (THIS-is-A-test first)")++promise_test(() => {+ return fetch("/xhr/resources/echo-headers.py", {headers: [["THIS-IS-A-TEST", 1], ["THIS-is-A-test", 2]] }).then(res => res.text()).then(body => {+ assert_regexp_match(body, /THIS-IS-A-TEST: 1, 2/)+ })+}, "Multiple headers with the same name, different case (THIS-IS-A-TEST first)")diff --git a/Tests/LibWeb/Text/input/wpt-import/fetch/api/basic/request-headers-case.any.sharedworker.html b/Tests/LibWeb/Text/input/wpt-import/fetch/api/basic/request-headers-case.any.sharedworker.htmlnew file mode 100644index 00000000000..a81dafd99bf--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/fetch/api/basic/request-headers-case.any.sharedworker.html@@ -0,0 +1,9 @@+<!doctype html>+<meta charset=utf-8>++<script src="../../../resources/testharness.js"></script>+<script src="../../../resources/testharnessreport.js"></script>+<div id=log></div>+<script>+fetch_tests_from_worker(new SharedWorker("../../../fetch/api/basic/request-headers-case.any.worker.js"));+</script>diff --git a/Tests/LibWeb/Text/input/wpt-import/fetch/api/basic/request-headers-case.any.worker.html b/Tests/LibWeb/Text/input/wpt-import/fetch/api/basic/request-headers-case.any.worker.htmlnew file mode 100644index 00000000000..bca3c1f7b1b--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/fetch/api/basic/request-headers-case.any.worker.html@@ -0,0 +1,9 @@+<!doctype html>+<meta charset=utf-8>++<script src="../../../resources/testharness.js"></script>+<script src="../../../resources/testharnessreport.js"></script>+<div id=log></div>+<script>+fetch_tests_from_worker(new Worker("../../../fetch/api/basic/request-headers-case.any.worker.js"));+</script>diff --git a/Tests/LibWeb/Text/input/wpt-import/fetch/api/basic/request-headers-case.any.worker.js b/Tests/LibWeb/Text/input/wpt-import/fetch/api/basic/request-headers-case.any.worker.jsnew file mode 100644index 00000000000..25226730c98--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/fetch/api/basic/request-headers-case.any.worker.js@@ -0,0 +1,10 @@++self.GLOBAL = {+ isWindow: function() { return false; },+ isWorker: function() { return true; },+ isShadowRealm: function() { return false; },+};+importScripts("/resources/testharness.js");++importScripts("/fetch/api/basic/request-headers-case.any.js");+done();diff --git a/Tests/LibWeb/Text/input/wpt-import/fetch/api/headers/header-values.any.html b/Tests/LibWeb/Text/input/wpt-import/fetch/api/headers/header-values.any.htmlnew file mode 100644index 00000000000..a63ef691404--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/fetch/api/headers/header-values.any.html@@ -0,0 +1,16 @@+<!doctype html>+<meta charset=utf-8>+<title>Header value test</title>+<meta name="timeout" content="long">+<script>+self.GLOBAL = {+ isWindow: function() { return true; },+ isWorker: function() { return false; },+ isShadowRealm: function() { return false; },+};+</script>+<script src="../../../resources/testharness.js"></script>+<script src="../../../resources/testharnessreport.js"></script>++<div id=log></div>+<script src="../../../fetch/api/headers/header-values.any.js"></script>diff --git a/Tests/LibWeb/Text/input/wpt-import/fetch/api/headers/header-values.any.js b/Tests/LibWeb/Text/input/wpt-import/fetch/api/headers/header-values.any.jsnew file mode 100644index 00000000000..78db34f103d--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/fetch/api/headers/header-values.any.js@@ -0,0 +1,64 @@+// META: title=Header value test+// META: global=window,worker+// META: timeout=long++"use strict";++// Invalid values+[0, 0x0A, 0x0D].forEach(val => {+ val = "x" + String.fromCharCode(val) + "x"++ // XMLHttpRequest is not available in service workers+ if (!self.GLOBAL.isWorker()) {+ test(() => {+ let xhr = new XMLHttpRequest()+ xhr.open("POST", "/")+ assert_throws_dom("SyntaxError", () => xhr.setRequestHeader("value-test", val))+ }, "XMLHttpRequest with value " + encodeURI(val) + " needs to throw")+ }++ promise_test(t => promise_rejects_js(t, TypeError, fetch("/", { headers: {"value-test": val} })), "fetch() with value " + encodeURI(val) + " needs to throw")+})++// Valid values+let headerValues =[]+for(let i = 0; i < 0x100; i++) {+ if(i === 0 || i === 0x0A || i === 0x0D) {+ continue+ }+ headerValues.push("x" + String.fromCharCode(i) + "x")+}+var url = "../resources/inspect-headers.py?headers="+headerValues.forEach((_, i) => {+ url += "val" + i + "|"+})++// XMLHttpRequest is not available in service workers+if (!self.GLOBAL.isWorker()) {+ async_test((t) => {+ let xhr = new XMLHttpRequest()+ xhr.open("POST", url)+ headerValues.forEach((val, i) => {+ xhr.setRequestHeader("val" + i, val)+ })+ xhr.onload = t.step_func_done(() => {+ headerValues.forEach((val, i) => {+ assert_equals(xhr.getResponseHeader("x-request-val" + i), val)+ })+ })+ xhr.onerror = t.unreached_func("XHR should not fail")+ xhr.send()+ }, "XMLHttpRequest with all valid values")+}++promise_test((t) => {+ const headers = new Headers+ headerValues.forEach((val, i) => {+ headers.append("val" + i, val)+ })+ return fetch(url, { headers }).then((res) => {+ headerValues.forEach((val, i) => {+ assert_equals(res.headers.get("x-request-val" + i), val)+ })+ })+}, "fetch() with all valid values")diff --git a/Tests/LibWeb/Text/input/wpt-import/fetch/api/request/request-disturbed.any.js b/Tests/LibWeb/Text/input/wpt-import/fetch/api/request/request-disturbed.any.jsindex 8a11de78ff6..5baccb577f6 100644--- a/Tests/LibWeb/Text/input/wpt-import/fetch/api/request/request-disturbed.any.js+++ b/Tests/LibWeb/Text/input/wpt-import/fetch/api/request/request-disturbed.any.js@@ -70,7 +70,7 @@ promise_test(() => {const originalBody = bodyRequest.body;assert_false(bodyRequest.bodyUsed , "bodyUsed is false when request is not disturbed");const requestFromRequest = new Request(bodyRequest, { body : "init body" });- assert_true(bodyRequest.bodyUsed , "bodyUsed is true when request is disturbed");+ assert_false(bodyRequest.bodyUsed , "bodyUsed is false when init supplies a new body");assert_equals(bodyRequest.body, originalBody, "body should not change");assert_not_equals(originalBody, undefined, "body should not be undefined");assert_not_equals(originalBody, null, "body should not be null");@@ -79,7 +79,7 @@ promise_test(() => {return requestFromRequest.text().then(text => {assert_equals(text, "init body");});-}, "Input request used for creating new request became disturbed even if body is not used");+}, "Input request used for creating new request with a new body is not disturbed");promise_test(function(test) {assert_true(bodyConsumed.bodyUsed , "bodyUsed is true when request is disturbed");diff --git a/Tests/LibWeb/Text/input/wpt-import/fetch/api/request/request-disturbed.any.sharedworker.html b/Tests/LibWeb/Text/input/wpt-import/fetch/api/request/request-disturbed.any.sharedworker.htmlnew file mode 100644index 00000000000..c69c6e065eb--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/fetch/api/request/request-disturbed.any.sharedworker.html@@ -0,0 +1,9 @@+<!doctype html>+<meta charset=utf-8>+<title>Request disturbed</title>+<script src="../../../resources/testharness.js"></script>+<script src="../../../resources/testharnessreport.js"></script>+<div id=log></div>+<script>+fetch_tests_from_worker(new SharedWorker("../../../fetch/api/request/request-disturbed.any.worker.js"));+</script>diff --git a/Tests/LibWeb/Text/input/wpt-import/fetch/api/request/request-disturbed.any.worker.html b/Tests/LibWeb/Text/input/wpt-import/fetch/api/request/request-disturbed.any.worker.htmlnew file mode 100644index 00000000000..c1037d143ba--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/fetch/api/request/request-disturbed.any.worker.html@@ -0,0 +1,9 @@+<!doctype html>+<meta charset=utf-8>+<title>Request disturbed</title>+<script src="../../../resources/testharness.js"></script>+<script src="../../../resources/testharnessreport.js"></script>+<div id=log></div>+<script>+fetch_tests_from_worker(new Worker("../../../fetch/api/request/request-disturbed.any.worker.js"));+</script>diff --git a/Tests/LibWeb/Text/input/wpt-import/fetch/api/request/request-disturbed.any.worker.js b/Tests/LibWeb/Text/input/wpt-import/fetch/api/request/request-disturbed.any.worker.jsnew file mode 100644index 00000000000..bf80f588382--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/fetch/api/request/request-disturbed.any.worker.js@@ -0,0 +1,11 @@++self.GLOBAL = {+ isWindow: function() { return false; },+ isWorker: function() { return true; },+ isShadowRealm: function() { return false; },+};+importScripts("/resources/testharness.js");+self.META_TITLE = "Request disturbed";+importScripts("../resources/utils.js")+importScripts("/fetch/api/request/request-disturbed.any.js");+done();diff --git a/Tests/LibWeb/Text/input/wpt-import/fetch/api/request/request-init-contenttype.any.html b/Tests/LibWeb/Text/input/wpt-import/fetch/api/request/request-init-contenttype.any.htmlnew file mode 100644index 00000000000..0ccee87ac86--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/fetch/api/request/request-init-contenttype.any.html@@ -0,0 +1,15 @@+<!doctype html>+<meta charset=utf-8>++<script>+self.GLOBAL = {+ isWindow: function() { return true; },+ isWorker: function() { return false; },+ isShadowRealm: function() { return false; },+};+</script>+<script src="../../../resources/testharness.js"></script>+<script src="../../../resources/testharnessreport.js"></script>++<div id=log></div>+<script src="../../../fetch/api/request/request-init-contenttype.any.js"></script>diff --git a/Tests/LibWeb/Text/input/wpt-import/fetch/api/request/request-init-contenttype.any.js b/Tests/LibWeb/Text/input/wpt-import/fetch/api/request/request-init-contenttype.any.jsnew file mode 100644index 00000000000..18a6969d4f8--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/fetch/api/request/request-init-contenttype.any.js@@ -0,0 +1,141 @@+function requestFromBody(body) {+ return new Request(+ "https://example.com",+ {+ method: "POST",+ body,+ duplex: "half",+ },+ );+}++test(() => {+ const request = requestFromBody(undefined);+ assert_equals(request.headers.get("Content-Type"), null);+}, "Default Content-Type for Request with empty body");++test(() => {+ const blob = new Blob([]);+ const request = requestFromBody(blob);+ assert_equals(request.headers.get("Content-Type"), null);+}, "Default Content-Type for Request with Blob body (no type set)");++test(() => {+ const blob = new Blob([], { type: "" });+ const request = requestFromBody(blob);+ assert_equals(request.headers.get("Content-Type"), null);+}, "Default Content-Type for Request with Blob body (empty type)");++test(() => {+ const blob = new Blob([], { type: "a/b; c=d" });+ const request = requestFromBody(blob);+ assert_equals(request.headers.get("Content-Type"), "a/b; c=d");+}, "Default Content-Type for Request with Blob body (set type)");++test(() => {+ const buffer = new Uint8Array();+ const request = requestFromBody(buffer);+ assert_equals(request.headers.get("Content-Type"), null);+}, "Default Content-Type for Request with buffer source body");++promise_test(async () => {+ const formData = new FormData();+ formData.append("a", "b");+ const request = requestFromBody(formData);+ const boundary = (await request.text()).split("\r\n")[0].slice(2);+ assert_equals(+ request.headers.get("Content-Type"),+ `multipart/form-data; boundary=${boundary}`,+ );+}, "Default Content-Type for Request with FormData body");++test(() => {+ const usp = new URLSearchParams();+ const request = requestFromBody(usp);+ assert_equals(+ request.headers.get("Content-Type"),+ "application/x-www-form-urlencoded;charset=UTF-8",+ );+}, "Default Content-Type for Request with URLSearchParams body");++test(() => {+ const request = requestFromBody("");+ assert_equals(+ request.headers.get("Content-Type"),+ "text/plain;charset=UTF-8",+ );+}, "Default Content-Type for Request with string body");++test(() => {+ const stream = new ReadableStream();+ const request = requestFromBody(stream);+ assert_equals(request.headers.get("Content-Type"), null);+}, "Default Content-Type for Request with ReadableStream body");++// -----------------------------------------------------------------------------++const OVERRIDE_MIME = "test/only; mime=type";++function requestFromBodyWithOverrideMime(body) {+ return new Request(+ "https://example.com",+ {+ method: "POST",+ body,+ headers: { "Content-Type": OVERRIDE_MIME },+ duplex: "half",+ },+ );+}++test(() => {+ const request = requestFromBodyWithOverrideMime(undefined);+ assert_equals(request.headers.get("Content-Type"), OVERRIDE_MIME);+}, "Can override Content-Type for Request with empty body");++test(() => {+ const blob = new Blob([]);+ const request = requestFromBodyWithOverrideMime(blob);+ assert_equals(request.headers.get("Content-Type"), OVERRIDE_MIME);+}, "Can override Content-Type for Request with Blob body (no type set)");++test(() => {+ const blob = new Blob([], { type: "" });+ const request = requestFromBodyWithOverrideMime(blob);+ assert_equals(request.headers.get("Content-Type"), OVERRIDE_MIME);+}, "Can override Content-Type for Request with Blob body (empty type)");++test(() => {+ const blob = new Blob([], { type: "a/b; c=d" });+ const request = requestFromBodyWithOverrideMime(blob);+ assert_equals(request.headers.get("Content-Type"), OVERRIDE_MIME);+}, "Can override Content-Type for Request with Blob body (set type)");++test(() => {+ const buffer = new Uint8Array();+ const request = requestFromBodyWithOverrideMime(buffer);+ assert_equals(request.headers.get("Content-Type"), OVERRIDE_MIME);+}, "Can override Content-Type for Request with buffer source body");++test(() => {+ const formData = new FormData();+ const request = requestFromBodyWithOverrideMime(formData);+ assert_equals(request.headers.get("Content-Type"), OVERRIDE_MIME);+}, "Can override Content-Type for Request with FormData body");++test(() => {+ const usp = new URLSearchParams();+ const request = requestFromBodyWithOverrideMime(usp);+ assert_equals(request.headers.get("Content-Type"), OVERRIDE_MIME);+}, "Can override Content-Type for Request with URLSearchParams body");++test(() => {+ const request = requestFromBodyWithOverrideMime("");+ assert_equals(request.headers.get("Content-Type"), OVERRIDE_MIME);+}, "Can override Content-Type for Request with string body");++test(() => {+ const stream = new ReadableStream();+ const request = requestFromBodyWithOverrideMime(stream);+ assert_equals(request.headers.get("Content-Type"), OVERRIDE_MIME);+}, "Can override Content-Type for Request with ReadableStream body");diff --git a/Tests/LibWeb/Text/input/wpt-import/fetch/api/request/request-init-contenttype.any.worker.html b/Tests/LibWeb/Text/input/wpt-import/fetch/api/request/request-init-contenttype.any.worker.htmlnew file mode 100644index 00000000000..57a349c4720--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/fetch/api/request/request-init-contenttype.any.worker.html@@ -0,0 +1,9 @@+<!doctype html>+<meta charset=utf-8>++<script src="../../../resources/testharness.js"></script>+<script src="../../../resources/testharnessreport.js"></script>+<div id=log></div>+<script>+fetch_tests_from_worker(new Worker("../../../fetch/api/request/request-init-contenttype.any.worker.js"));+</script>diff --git a/Tests/LibWeb/Text/input/wpt-import/fetch/api/request/request-init-contenttype.any.worker.js b/Tests/LibWeb/Text/input/wpt-import/fetch/api/request/request-init-contenttype.any.worker.jsnew file mode 100644index 00000000000..61810a46e72--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/fetch/api/request/request-init-contenttype.any.worker.js@@ -0,0 +1,10 @@++self.GLOBAL = {+ isWindow: function() { return false; },+ isWorker: function() { return true; },+ isShadowRealm: function() { return false; },+};+importScripts("/resources/testharness.js");++importScripts("/fetch/api/request/request-init-contenttype.any.js");+done();diff --git a/Tests/LibWeb/Text/input/wpt-import/fetch/api/resources/inspect-headers.py b/Tests/LibWeb/Text/input/wpt-import/fetch/api/resources/inspect-headers.pynew file mode 100644index 00000000000..9ed566e607b--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/fetch/api/resources/inspect-headers.py@@ -0,0 +1,24 @@+def main(request, response):+ headers = []+ if b"headers" in request.GET:+ checked_headers = request.GET.first(b"headers").split(b"|")+ for header in checked_headers:+ if header in request.headers:+ headers.append((b"x-request-" + header, request.headers.get(header, b"")))++ if b"cors" in request.GET:+ if b"Origin" in request.headers:+ headers.append((b"Access-Control-Allow-Origin", request.headers.get(b"Origin", b"")))+ else:+ headers.append((b"Access-Control-Allow-Origin", b"*"))+ headers.append((b"Access-Control-Allow-Credentials", b"true"))+ headers.append((b"Access-Control-Allow-Methods", b"GET, POST, HEAD"))+ exposed_headers = [b"x-request-" + header for header in checked_headers]+ headers.append((b"Access-Control-Expose-Headers", b", ".join(exposed_headers)))+ if b"allow_headers" in request.GET:+ headers.append((b"Access-Control-Allow-Headers", request.GET[b'allow_headers']))+ else:+ headers.append((b"Access-Control-Allow-Headers", b", ".join(request.headers)))++ headers.append((b"content-type", b"text/plain"))+ return headers, b""diff --git a/Tests/LibWeb/Text/input/wpt-import/fetch/api/response/response-init-contenttype.any.html b/Tests/LibWeb/Text/input/wpt-import/fetch/api/response/response-init-contenttype.any.htmlnew file mode 100644index 00000000000..f39e5137e5f--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/fetch/api/response/response-init-contenttype.any.html@@ -0,0 +1,15 @@+<!doctype html>+<meta charset=utf-8>++<script>+self.GLOBAL = {+ isWindow: function() { return true; },+ isWorker: function() { return false; },+ isShadowRealm: function() { return false; },+};+</script>+<script src="../../../resources/testharness.js"></script>+<script src="../../../resources/testharnessreport.js"></script>++<div id=log></div>+<script src="../../../fetch/api/response/response-init-contenttype.any.js"></script>diff --git a/Tests/LibWeb/Text/input/wpt-import/fetch/api/response/response-init-contenttype.any.js b/Tests/LibWeb/Text/input/wpt-import/fetch/api/response/response-init-contenttype.any.jsnew file mode 100644index 00000000000..3a7744c2878--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/fetch/api/response/response-init-contenttype.any.js@@ -0,0 +1,125 @@+test(() => {+ const response = new Response();+ assert_equals(response.headers.get("Content-Type"), null);+}, "Default Content-Type for Response with empty body");++test(() => {+ const blob = new Blob([]);+ const response = new Response(blob);+ assert_equals(response.headers.get("Content-Type"), null);+}, "Default Content-Type for Response with Blob body (no type set)");++test(() => {+ const blob = new Blob([], { type: "" });+ const response = new Response(blob);+ assert_equals(response.headers.get("Content-Type"), null);+}, "Default Content-Type for Response with Blob body (empty type)");++test(() => {+ const blob = new Blob([], { type: "a/b; c=d" });+ const response = new Response(blob);+ assert_equals(response.headers.get("Content-Type"), "a/b; c=d");+}, "Default Content-Type for Response with Blob body (set type)");++test(() => {+ const buffer = new Uint8Array();+ const response = new Response(buffer);+ assert_equals(response.headers.get("Content-Type"), null);+}, "Default Content-Type for Response with buffer source body");++promise_test(async () => {+ const formData = new FormData();+ formData.append("a", "b");+ const response = new Response(formData);+ const boundary = (await response.text()).split("\r\n")[0].slice(2);+ assert_equals(+ response.headers.get("Content-Type"),+ `multipart/form-data; boundary=${boundary}`,+ );+}, "Default Content-Type for Response with FormData body");++test(() => {+ const usp = new URLSearchParams();+ const response = new Response(usp);+ assert_equals(+ response.headers.get("Content-Type"),+ "application/x-www-form-urlencoded;charset=UTF-8",+ );+}, "Default Content-Type for Response with URLSearchParams body");++test(() => {+ const response = new Response("");+ assert_equals(+ response.headers.get("Content-Type"),+ "text/plain;charset=UTF-8",+ );+}, "Default Content-Type for Response with string body");++test(() => {+ const stream = new ReadableStream();+ const response = new Response(stream);+ assert_equals(response.headers.get("Content-Type"), null);+}, "Default Content-Type for Response with ReadableStream body");++// -----------------------------------------------------------------------------++const OVERRIDE_MIME = "test/only; mime=type";++function responseWithOverrideMime(body) {+ return new Response(+ body,+ { headers: { "Content-Type": OVERRIDE_MIME } },+ );+}++test(() => {+ const response = responseWithOverrideMime(undefined);+ assert_equals(response.headers.get("Content-Type"), OVERRIDE_MIME);+}, "Can override Content-Type for Response with empty body");++test(() => {+ const blob = new Blob([]);+ const response = responseWithOverrideMime(blob);+ assert_equals(response.headers.get("Content-Type"), OVERRIDE_MIME);+}, "Can override Content-Type for Response with Blob body (no type set)");++test(() => {+ const blob = new Blob([], { type: "" });+ const response = responseWithOverrideMime(blob);+ assert_equals(response.headers.get("Content-Type"), OVERRIDE_MIME);+}, "Can override Content-Type for Response with Blob body (empty type)");++test(() => {+ const blob = new Blob([], { type: "a/b; c=d" });+ const response = responseWithOverrideMime(blob);+ assert_equals(response.headers.get("Content-Type"), OVERRIDE_MIME);+}, "Can override Content-Type for Response with Blob body (set type)");++test(() => {+ const buffer = new Uint8Array();+ const response = responseWithOverrideMime(buffer);+ assert_equals(response.headers.get("Content-Type"), OVERRIDE_MIME);+}, "Can override Content-Type for Response with buffer source body");++test(() => {+ const formData = new FormData();+ const response = responseWithOverrideMime(formData);+ assert_equals(response.headers.get("Content-Type"), OVERRIDE_MIME);+}, "Can override Content-Type for Response with FormData body");++test(() => {+ const usp = new URLSearchParams();+ const response = responseWithOverrideMime(usp);+ assert_equals(response.headers.get("Content-Type"), OVERRIDE_MIME);+}, "Can override Content-Type for Response with URLSearchParams body");++test(() => {+ const response = responseWithOverrideMime("");+ assert_equals(response.headers.get("Content-Type"), OVERRIDE_MIME);+}, "Can override Content-Type for Response with string body");++test(() => {+ const stream = new ReadableStream();+ const response = responseWithOverrideMime(stream);+ assert_equals(response.headers.get("Content-Type"), OVERRIDE_MIME);+}, "Can override Content-Type for Response with ReadableStream body");diff --git a/Tests/LibWeb/Text/input/wpt-import/fetch/api/response/response-init-contenttype.any.worker.html b/Tests/LibWeb/Text/input/wpt-import/fetch/api/response/response-init-contenttype.any.worker.htmlnew file mode 100644index 00000000000..2ace8a1e87d--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/fetch/api/response/response-init-contenttype.any.worker.html@@ -0,0 +1,9 @@+<!doctype html>+<meta charset=utf-8>++<script src="../../../resources/testharness.js"></script>+<script src="../../../resources/testharnessreport.js"></script>+<div id=log></div>+<script>+fetch_tests_from_worker(new Worker("../../../fetch/api/response/response-init-contenttype.any.worker.js"));+</script>diff --git a/Tests/LibWeb/Text/input/wpt-import/fetch/api/response/response-init-contenttype.any.worker.js b/Tests/LibWeb/Text/input/wpt-import/fetch/api/response/response-init-contenttype.any.worker.jsnew file mode 100644index 00000000000..c074e82900d--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/fetch/api/response/response-init-contenttype.any.worker.js@@ -0,0 +1,10 @@++self.GLOBAL = {+ isWindow: function() { return false; },+ isWorker: function() { return true; },+ isShadowRealm: function() { return false; },+};+importScripts("/resources/testharness.js");++importScripts("/fetch/api/response/response-init-contenttype.any.js");+done();diff --git a/Tests/LibWeb/Text/input/wpt-import/fetch/content-encoding/br/big-br-body.https.any.html b/Tests/LibWeb/Text/input/wpt-import/fetch/content-encoding/br/big-br-body.https.any.htmlnew file mode 100644index 00000000000..56bc97f9b6d--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/fetch/content-encoding/br/big-br-body.https.any.html@@ -0,0 +1,15 @@+<!doctype html>+<meta charset=utf-8>++<script>+self.GLOBAL = {+ isWindow: function() { return true; },+ isWorker: function() { return false; },+ isShadowRealm: function() { return false; },+};+</script>+<script src="../../../resources/testharness.js"></script>+<script src="../../../resources/testharnessreport.js"></script>++<div id=log></div>+<script src="../../../fetch/content-encoding/br/big-br-body.https.any.js"></script>diff --git a/Tests/LibWeb/Text/input/wpt-import/fetch/content-encoding/br/big-br-body.https.any.js b/Tests/LibWeb/Text/input/wpt-import/fetch/content-encoding/br/big-br-body.https.any.jsnew file mode 100644index 00000000000..1427dd73026--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/fetch/content-encoding/br/big-br-body.https.any.js@@ -0,0 +1,55 @@+// META: global=window,worker++const EXPECTED_SIZE = 27000000;+const EXPECTED_SHA256 = [+ 74, 100, 37, 243, 147, 61, 116, 60, 241, 221, 126,+ 18, 24, 71, 204, 28, 50, 62, 201, 130, 152, 225,+ 217, 183, 10, 201, 143, 214, 102, 155, 212, 248,+ ];++promise_test(async () => {+ const response = await fetch('resources/big.text.br');+ assert_true(response.ok);+ const arrayBuffer = await response.arrayBuffer();+ assert_equals(arrayBuffer.byteLength, EXPECTED_SIZE,+ 'uncompressed size should match');+ const sha256 = await crypto.subtle.digest('SHA-256', arrayBuffer);+ assert_array_equals(new Uint8Array(sha256), EXPECTED_SHA256,+ 'digest should match');+}, 'large br data should be decompressed successfully');++promise_test(async () => {+ const response = await fetch('resources/big.text.br');+ assert_true(response.ok);+ const reader = response.body.getReader({mode: 'byob'});+ let offset = 0;+ // Pre-allocate space for the output. The response body will be read+ // chunk-by-chunk into this array.+ let ab = new ArrayBuffer(EXPECTED_SIZE);+ while (offset < EXPECTED_SIZE) {+ // To stress the data pipe, we want to use a different size read each+ // time. Unfortunately, JavaScript doesn't have a seeded random number+ // generator, so this creates the possibility of making this test flaky if+ // it doesn't work for some edge cases.+ let size = Math.floor(Math.random() * 65535 + 1);+ if (size + offset > EXPECTED_SIZE) {+ size = EXPECTED_SIZE - offset;+ }+ const u8 = new Uint8Array(ab, offset, size);+ const { value, done } = await reader.read(u8);+ ab = value.buffer;+ // Check that we got our original array back.+ assert_equals(ab.byteLength, EXPECTED_SIZE,+ 'backing array should be the same size');+ assert_equals(offset, value.byteOffset, 'offset should match');+ assert_less_than_equal(value.byteLength, size,+ 'we should not have got more than we asked for');+ offset = value.byteOffset + value.byteLength;+ if (done) break;+ }+ assert_equals(offset, EXPECTED_SIZE,+ 'we should have read the whole thing');+ const sha256 = await crypto.subtle.digest('SHA-256', new Uint8Array(ab));+ assert_array_equals(new Uint8Array(sha256), EXPECTED_SHA256,+ 'digest should match');+}, 'large br data should be decompressed successfully with byte stream');diff --git a/Tests/LibWeb/Text/input/wpt-import/fetch/content-encoding/br/big-br-body.https.any.sharedworker.html b/Tests/LibWeb/Text/input/wpt-import/fetch/content-encoding/br/big-br-body.https.any.sharedworker.htmlnew file mode 100644index 00000000000..9b7b863ab2e--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/fetch/content-encoding/br/big-br-body.https.any.sharedworker.html@@ -0,0 +1,9 @@+<!doctype html>+<meta charset=utf-8>++<script src="../../../resources/testharness.js"></script>+<script src="../../../resources/testharnessreport.js"></script>+<div id=log></div>+<script>+fetch_tests_from_worker(new SharedWorker("../../../fetch/content-encoding/br/big-br-body.https.any.worker.js"));+</script>diff --git a/Tests/LibWeb/Text/input/wpt-import/fetch/content-encoding/br/big-br-body.https.any.worker.html b/Tests/LibWeb/Text/input/wpt-import/fetch/content-encoding/br/big-br-body.https.any.worker.htmlnew file mode 100644index 00000000000..c61359ad47c--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/fetch/content-encoding/br/big-br-body.https.any.worker.html@@ -0,0 +1,9 @@+<!doctype html>+<meta charset=utf-8>++<script src="../../../resources/testharness.js"></script>+<script src="../../../resources/testharnessreport.js"></script>+<div id=log></div>+<script>+fetch_tests_from_worker(new Worker("../../../fetch/content-encoding/br/big-br-body.https.any.worker.js"));+</script>diff --git a/Tests/LibWeb/Text/input/wpt-import/fetch/content-encoding/br/big-br-body.https.any.worker.js b/Tests/LibWeb/Text/input/wpt-import/fetch/content-encoding/br/big-br-body.https.any.worker.jsnew file mode 100644index 00000000000..32ae5f9d7ec--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/fetch/content-encoding/br/big-br-body.https.any.worker.js@@ -0,0 +1,10 @@++self.GLOBAL = {+ isWindow: function() { return false; },+ isWorker: function() { return true; },+ isShadowRealm: function() { return false; },+};+importScripts("/resources/testharness.js");++importScripts("/fetch/content-encoding/br/big-br-body.https.any.js");+done();diff --git a/Tests/LibWeb/Text/input/wpt-import/fetch/content-encoding/br/resources/big.text.br b/Tests/LibWeb/Text/input/wpt-import/fetch/content-encoding/br/resources/big.text.brnew file mode 100644index 00000000000..b3a530d757dBinary files /dev/null and b/Tests/LibWeb/Text/input/wpt-import/fetch/content-encoding/br/resources/big.text.br differdiff --git a/Tests/LibWeb/Text/input/wpt-import/fetch/content-encoding/br/resources/big.text.br.headers b/Tests/LibWeb/Text/input/wpt-import/fetch/content-encoding/br/resources/big.text.br.headersnew file mode 100644index 00000000000..aba00bd5d4a--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/fetch/content-encoding/br/resources/big.text.br.headers@@ -0,0 +1,3 @@+Content-type: text/plain+Content-Encoding: br+Cache-Control: no-storediff --git a/Tests/LibWeb/Text/input/wpt-import/fetch/content-encoding/gzip/big-gzip-body.https.any.html b/Tests/LibWeb/Text/input/wpt-import/fetch/content-encoding/gzip/big-gzip-body.https.any.htmlnew file mode 100644index 00000000000..4ec55dc39ce--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/fetch/content-encoding/gzip/big-gzip-body.https.any.html@@ -0,0 +1,15 @@+<!doctype html>+<meta charset=utf-8>++<script>+self.GLOBAL = {+ isWindow: function() { return true; },+ isWorker: function() { return false; },+ isShadowRealm: function() { return false; },+};+</script>+<script src="../../../resources/testharness.js"></script>+<script src="../../../resources/testharnessreport.js"></script>++<div id=log></div>+<script src="../../../fetch/content-encoding/gzip/big-gzip-body.https.any.js"></script>diff --git a/Tests/LibWeb/Text/input/wpt-import/fetch/content-encoding/gzip/big-gzip-body.https.any.js b/Tests/LibWeb/Text/input/wpt-import/fetch/content-encoding/gzip/big-gzip-body.https.any.jsnew file mode 100644index 00000000000..b5d62c98045--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/fetch/content-encoding/gzip/big-gzip-body.https.any.js@@ -0,0 +1,55 @@+// META: global=window,worker++const EXPECTED_SIZE = 27000000;+const EXPECTED_SHA256 = [+ 74, 100, 37, 243, 147, 61, 116, 60, 241, 221, 126,+ 18, 24, 71, 204, 28, 50, 62, 201, 130, 152, 225,+ 217, 183, 10, 201, 143, 214, 102, 155, 212, 248,+ ];++promise_test(async () => {+ const response = await fetch('resources/big.text.gz');+ assert_true(response.ok);+ const arrayBuffer = await response.arrayBuffer();+ assert_equals(arrayBuffer.byteLength, EXPECTED_SIZE,+ 'uncompressed size should match');+ const sha256 = await crypto.subtle.digest('SHA-256', arrayBuffer);+ assert_array_equals(new Uint8Array(sha256), EXPECTED_SHA256,+ 'digest should match');+}, 'large gzip data should be decompressed successfully');++promise_test(async () => {+ const response = await fetch('resources/big.text.gz');+ assert_true(response.ok);+ const reader = response.body.getReader({mode: 'byob'});+ let offset = 0;+ // Pre-allocate space for the output. The response body will be read+ // chunk-by-chunk into this array.+ let ab = new ArrayBuffer(EXPECTED_SIZE);+ while (offset < EXPECTED_SIZE) {+ // To stress the data pipe, we want to use a different size read each+ // time. Unfortunately, JavaScript doesn't have a seeded random number+ // generator, so this creates the possibility of making this test flaky if+ // it doesn't work for some edge cases.+ let size = Math.floor(Math.random() * 65535 + 1);+ if (size + offset > EXPECTED_SIZE) {+ size = EXPECTED_SIZE - offset;+ }+ const u8 = new Uint8Array(ab, offset, size);+ const { value, done } = await reader.read(u8);+ ab = value.buffer;+ // Check that we got our original array back.+ assert_equals(ab.byteLength, EXPECTED_SIZE,+ 'backing array should be the same size');+ assert_equals(offset, value.byteOffset, 'offset should match');+ assert_less_than_equal(value.byteLength, size,+ 'we should not have got more than we asked for');+ offset = value.byteOffset + value.byteLength;+ if (done) break;+ }+ assert_equals(offset, EXPECTED_SIZE,+ 'we should have read the whole thing');+ const sha256 = await crypto.subtle.digest('SHA-256', new Uint8Array(ab));+ assert_array_equals(new Uint8Array(sha256), EXPECTED_SHA256,+ 'digest should match');+}, 'large gzip data should be decompressed successfully with byte stream');diff --git a/Tests/LibWeb/Text/input/wpt-import/fetch/content-encoding/gzip/big-gzip-body.https.any.sharedworker.html b/Tests/LibWeb/Text/input/wpt-import/fetch/content-encoding/gzip/big-gzip-body.https.any.sharedworker.htmlnew file mode 100644index 00000000000..c4a4a15fb96--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/fetch/content-encoding/gzip/big-gzip-body.https.any.sharedworker.html@@ -0,0 +1,9 @@+<!doctype html>+<meta charset=utf-8>++<script src="../../../resources/testharness.js"></script>+<script src="../../../resources/testharnessreport.js"></script>+<div id=log></div>+<script>+fetch_tests_from_worker(new SharedWorker("../../../fetch/content-encoding/gzip/big-gzip-body.https.any.worker.js"));+</script>diff --git a/Tests/LibWeb/Text/input/wpt-import/fetch/content-encoding/gzip/big-gzip-body.https.any.worker.html b/Tests/LibWeb/Text/input/wpt-import/fetch/content-encoding/gzip/big-gzip-body.https.any.worker.htmlnew file mode 100644index 00000000000..4a718c5eb6f--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/fetch/content-encoding/gzip/big-gzip-body.https.any.worker.html@@ -0,0 +1,9 @@+<!doctype html>+<meta charset=utf-8>++<script src="../../../resources/testharness.js"></script>+<script src="../../../resources/testharnessreport.js"></script>+<div id=log></div>+<script>+fetch_tests_from_worker(new Worker("../../../fetch/content-encoding/gzip/big-gzip-body.https.any.worker.js"));+</script>diff --git a/Tests/LibWeb/Text/input/wpt-import/fetch/content-encoding/gzip/big-gzip-body.https.any.worker.js b/Tests/LibWeb/Text/input/wpt-import/fetch/content-encoding/gzip/big-gzip-body.https.any.worker.jsnew file mode 100644index 00000000000..a37be41d57f--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/fetch/content-encoding/gzip/big-gzip-body.https.any.worker.js@@ -0,0 +1,10 @@++self.GLOBAL = {+ isWindow: function() { return false; },+ isWorker: function() { return true; },+ isShadowRealm: function() { return false; },+};+importScripts("/resources/testharness.js");++importScripts("/fetch/content-encoding/gzip/big-gzip-body.https.any.js");+done();diff --git a/Tests/LibWeb/Text/input/wpt-import/fetch/content-encoding/gzip/resources/big.text.gz b/Tests/LibWeb/Text/input/wpt-import/fetch/content-encoding/gzip/resources/big.text.gznew file mode 100644index 00000000000..13441bc3998Binary files /dev/null and b/Tests/LibWeb/Text/input/wpt-import/fetch/content-encoding/gzip/resources/big.text.gz differdiff --git a/Tests/LibWeb/Text/input/wpt-import/fetch/content-encoding/gzip/resources/big.text.gz.headers b/Tests/LibWeb/Text/input/wpt-import/fetch/content-encoding/gzip/resources/big.text.gz.headersnew file mode 100644index 00000000000..55d2345c239--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/fetch/content-encoding/gzip/resources/big.text.gz.headers@@ -0,0 +1,3 @@+Content-type: text/plain+Content-Encoding: gzip+Cache-Control: no-storediff --git a/Tests/LibWeb/Text/input/wpt-import/fetch/content-encoding/zstd/big-zstd-body.https.any.html b/Tests/LibWeb/Text/input/wpt-import/fetch/content-encoding/zstd/big-zstd-body.https.any.htmlnew file mode 100644index 00000000000..d370ec734ad--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/fetch/content-encoding/zstd/big-zstd-body.https.any.html@@ -0,0 +1,15 @@+<!doctype html>+<meta charset=utf-8>++<script>+self.GLOBAL = {+ isWindow: function() { return true; },+ isWorker: function() { return false; },+ isShadowRealm: function() { return false; },+};+</script>+<script src="../../../resources/testharness.js"></script>+<script src="../../../resources/testharnessreport.js"></script>++<div id=log></div>+<script src="../../../fetch/content-encoding/zstd/big-zstd-body.https.any.js"></script>diff --git a/Tests/LibWeb/Text/input/wpt-import/fetch/content-encoding/zstd/big-zstd-body.https.any.js b/Tests/LibWeb/Text/input/wpt-import/fetch/content-encoding/zstd/big-zstd-body.https.any.jsnew file mode 100644index 00000000000..6835f6e4255--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/fetch/content-encoding/zstd/big-zstd-body.https.any.js@@ -0,0 +1,55 @@+// META: global=window,worker++const EXPECTED_SIZE = 27000000;+const EXPECTED_SHA256 = [+ 74, 100, 37, 243, 147, 61, 116, 60, 241, 221, 126,+ 18, 24, 71, 204, 28, 50, 62, 201, 130, 152, 225,+ 217, 183, 10, 201, 143, 214, 102, 155, 212, 248,+ ];++promise_test(async () => {+ const response = await fetch('resources/big.text.zst');+ assert_true(response.ok);+ const arrayBuffer = await response.arrayBuffer();+ assert_equals(arrayBuffer.byteLength, EXPECTED_SIZE,+ 'uncompressed size should match');+ const sha256 = await crypto.subtle.digest('SHA-256', arrayBuffer);+ assert_array_equals(new Uint8Array(sha256), EXPECTED_SHA256,+ 'digest should match');+}, 'large zstd data should be decompressed successfully');++promise_test(async () => {+ const response = await fetch('resources/big.text.zst');+ assert_true(response.ok);+ const reader = response.body.getReader({mode: 'byob'});+ let offset = 0;+ // Pre-allocate space for the output. The response body will be read+ // chunk-by-chunk into this array.+ let ab = new ArrayBuffer(EXPECTED_SIZE);+ while (offset < EXPECTED_SIZE) {+ // To stress the data pipe, we want to use a different size read each+ // time. Unfortunately, JavaScript doesn't have a seeded random number+ // generator, so this creates the possibility of making this test flaky if+ // it doesn't work for some edge cases.+ let size = Math.floor(Math.random() * 65535 + 1);+ if (size + offset > EXPECTED_SIZE) {+ size = EXPECTED_SIZE - offset;+ }+ const u8 = new Uint8Array(ab, offset, size);+ const { value, done } = await reader.read(u8);+ ab = value.buffer;+ // Check that we got our original array back.+ assert_equals(ab.byteLength, EXPECTED_SIZE,+ 'backing array should be the same size');+ assert_equals(offset, value.byteOffset, 'offset should match');+ assert_less_than_equal(value.byteLength, size,+ 'we should not have got more than we asked for');+ offset = value.byteOffset + value.byteLength;+ if (done) break;+ }+ assert_equals(offset, EXPECTED_SIZE,+ 'we should have read the whole thing');+ const sha256 = await crypto.subtle.digest('SHA-256', new Uint8Array(ab));+ assert_array_equals(new Uint8Array(sha256), EXPECTED_SHA256,+ 'digest should match');+}, 'large zstd data should be decompressed successfully with byte stream');diff --git a/Tests/LibWeb/Text/input/wpt-import/fetch/content-encoding/zstd/big-zstd-body.https.any.sharedworker.html b/Tests/LibWeb/Text/input/wpt-import/fetch/content-encoding/zstd/big-zstd-body.https.any.sharedworker.htmlnew file mode 100644index 00000000000..853c64176f1--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/fetch/content-encoding/zstd/big-zstd-body.https.any.sharedworker.html@@ -0,0 +1,9 @@+<!doctype html>+<meta charset=utf-8>++<script src="../../../resources/testharness.js"></script>+<script src="../../../resources/testharnessreport.js"></script>+<div id=log></div>+<script>+fetch_tests_from_worker(new SharedWorker("../../../fetch/content-encoding/zstd/big-zstd-body.https.any.worker.js"));+</script>diff --git a/Tests/LibWeb/Text/input/wpt-import/fetch/content-encoding/zstd/big-zstd-body.https.any.worker.html b/Tests/LibWeb/Text/input/wpt-import/fetch/content-encoding/zstd/big-zstd-body.https.any.worker.htmlnew file mode 100644index 00000000000..40b835c722b--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/fetch/content-encoding/zstd/big-zstd-body.https.any.worker.html@@ -0,0 +1,9 @@+<!doctype html>+<meta charset=utf-8>++<script src="../../../resources/testharness.js"></script>+<script src="../../../resources/testharnessreport.js"></script>+<div id=log></div>+<script>+fetch_tests_from_worker(new Worker("../../../fetch/content-encoding/zstd/big-zstd-body.https.any.worker.js"));+</script>diff --git a/Tests/LibWeb/Text/input/wpt-import/fetch/content-encoding/zstd/big-zstd-body.https.any.worker.js b/Tests/LibWeb/Text/input/wpt-import/fetch/content-encoding/zstd/big-zstd-body.https.any.worker.jsnew file mode 100644index 00000000000..f2aa7746174--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/fetch/content-encoding/zstd/big-zstd-body.https.any.worker.js@@ -0,0 +1,10 @@++self.GLOBAL = {+ isWindow: function() { return false; },+ isWorker: function() { return true; },+ isShadowRealm: function() { return false; },+};+importScripts("/resources/testharness.js");++importScripts("/fetch/content-encoding/zstd/big-zstd-body.https.any.js");+done();diff --git a/Tests/LibWeb/Text/input/wpt-import/fetch/content-encoding/zstd/resources/big.text.zst b/Tests/LibWeb/Text/input/wpt-import/fetch/content-encoding/zstd/resources/big.text.zstnew file mode 100644index 00000000000..30eda2443f3Binary files /dev/null and b/Tests/LibWeb/Text/input/wpt-import/fetch/content-encoding/zstd/resources/big.text.zst differdiff --git a/Tests/LibWeb/Text/input/wpt-import/fetch/content-encoding/zstd/resources/big.text.zst.headers b/Tests/LibWeb/Text/input/wpt-import/fetch/content-encoding/zstd/resources/big.text.zst.headersnew file mode 100644index 00000000000..ea5b05cf2c2--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/fetch/content-encoding/zstd/resources/big.text.zst.headers@@ -0,0 +1,3 @@+Content-type: text/plain+Content-Encoding: zstd+Cache-Control: no-storediff --git a/Tests/LibWeb/Text/input/wpt-import/fetch/http-cache/freshness.any.html b/Tests/LibWeb/Text/input/wpt-import/fetch/http-cache/freshness.any.htmlnew file mode 100644index 00000000000..0a0b8f73081--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/fetch/http-cache/freshness.any.html@@ -0,0 +1,18 @@+<!doctype html>+<meta charset=utf-8>+<title>HTTP Cache - Freshness</title>+<meta name="timeout" content="long">+<script>+self.GLOBAL = {+ isWindow: function() { return true; },+ isWorker: function() { return false; },+ isShadowRealm: function() { return false; },+};+</script>+<script src="../../resources/testharness.js"></script>+<script src="../../resources/testharnessreport.js"></script>+<script src="../../common/utils.js"></script>+<script src="../../common/get-host-info.sub.js"></script>+<script src="http-cache.js"></script>+<div id=log></div>+<script src="../../fetch/http-cache/freshness.any.js"></script>diff --git a/Tests/LibWeb/Text/input/wpt-import/fetch/http-cache/freshness.any.js b/Tests/LibWeb/Text/input/wpt-import/fetch/http-cache/freshness.any.jsnew file mode 100644index 00000000000..86c2620aa66--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/fetch/http-cache/freshness.any.js@@ -0,0 +1,243 @@+// META: global=window,worker+// META: title=HTTP Cache - Freshness+// META: timeout=long+// META: script=/common/utils.js+// META: script=/common/get-host-info.sub.js+// META: script=http-cache.js++var tests = [+ // response directives+ {+ name: "HTTP cache reuses a response with a future Expires",+ requests: [+ {+ response_headers: [+ ["Expires", (30 * 24 * 60 * 60)]+ ]+ },+ {+ expected_type: "cached"+ }+ ]+ },+ {+ name: "HTTP cache does not reuse a response with a past Expires",+ requests: [+ {+ response_headers: [+ ["Expires", (-30 * 24 * 60 * 60)]+ ]+ },+ {+ expected_type: "not_cached"+ }+ ]+ },+ {+ name: "HTTP cache does not reuse a response with a present Expires",+ requests: [+ {+ response_headers: [+ ["Expires", 0]+ ]+ },+ {+ expected_type: "not_cached"+ }+ ]+ },+ {+ name: "HTTP cache does not reuse a response with an invalid Expires",+ requests: [+ {+ response_headers: [+ ["Expires", "0"]+ ]+ },+ {+ expected_type: "not_cached"+ }+ ]+ },+ {+ name: "HTTP cache does not reuse a response with an invalid Expires with Last-Modified now",+ requests: [+ {+ response_headers: [+ ["Expires", "0"],+ ['Last-Modified', 0]+ ]+ },+ {+ expected_type: "not_cached"+ }+ ]+ },+ {+ name: "HTTP cache does not reuse a response with an invalid Expires with past Last-Modified",+ requests: [+ {+ response_headers: [+ ["Expires", "0"],+ ['Last-Modified', -100000]+ ]+ },+ {+ expected_type: "not_cached"+ }+ ]+ },+ {+ name: "HTTP cache reuses a response with positive Cache-Control: max-age",+ requests: [+ {+ response_headers: [+ ["Cache-Control", "max-age=3600"]+ ]+ },+ {+ expected_type: "cached"+ }+ ]+ },+ {+ name: "HTTP cache does not reuse a response with Cache-Control: max-age=0",+ requests: [+ {+ response_headers: [+ ["Cache-Control", "max-age=0"]+ ]+ },+ {+ expected_type: "not_cached"+ }+ ]+ },+ {+ name: "HTTP cache reuses a response with positive Cache-Control: max-age and a past Expires",+ requests: [+ {+ response_headers: [+ ["Cache-Control", "max-age=3600"],+ ["Expires", -10000]+ ]+ },+ {+ expected_type: "cached"+ }+ ]+ },+ {+ name: "HTTP cache reuses a response with positive Cache-Control: max-age and an invalid Expires",+ requests: [+ {+ response_headers: [+ ["Cache-Control", "max-age=3600"],+ ["Expires", "0"]+ ]+ },+ {+ expected_type: "cached"+ }+ ]+ },+ {+ name: "HTTP cache does not reuse a response with Cache-Control: max-age=0 and a future Expires",+ requests: [+ {+ response_headers: [+ ["Cache-Control", "max-age=0"],+ ["Expires", 10000]+ ]+ },+ {+ expected_type: "not_cached"+ }+ ]+ },+ {+ name: "HTTP cache does not prefer Cache-Control: s-maxage over Cache-Control: max-age",+ requests: [+ {+ response_headers: [+ ["Cache-Control", "max-age=1, s-maxage=3600"]+ ],+ pause_after: true,+ },+ {+ expected_type: "not_cached"+ }+ ]+ },+ {+ name: "HTTP cache does not reuse a response when the Age header is greater than its freshness lifetime",+ requests: [+ {+ response_headers: [+ ["Cache-Control", "max-age=3600"],+ ["Age", "12000"]+ ],+ },+ {+ expected_type: "not_cached"+ }+ ]+ },+ {+ name: "HTTP cache does not store a response with Cache-Control: no-store",+ requests: [+ {+ response_headers: [+ ["Cache-Control", "no-store"]+ ]+ },+ {+ expected_type: "not_cached"+ }+ ]+ },+ {+ name: "HTTP cache does not store a response with Cache-Control: no-store, even with max-age and Expires",+ requests: [+ {+ response_headers: [+ ["Cache-Control", "max-age=10000, no-store"],+ ["Expires", 10000]+ ]+ },+ {+ expected_type: "not_cached"+ }+ ]+ },+ {+ name: "HTTP cache stores a response with Cache-Control: no-cache, but revalidates upon use",+ requests: [+ {+ response_headers: [+ ["Cache-Control", "no-cache"],+ ["ETag", "abcd"]+ ]+ },+ {+ expected_type: "etag_validated"+ }+ ]+ },+ {+ name: "HTTP cache stores a response with Cache-Control: no-cache, but revalidates upon use, even with max-age and Expires",+ requests: [+ {+ response_headers: [+ ["Cache-Control", "max-age=10000, no-cache"],+ ["Expires", 10000],+ ["ETag", "abcd"]+ ]+ },+ {+ expected_type: "etag_validated"+ }+ ]+ },+];+run_tests(tests);diff --git a/Tests/LibWeb/Text/input/wpt-import/fetch/http-cache/freshness.any.sharedworker.html b/Tests/LibWeb/Text/input/wpt-import/fetch/http-cache/freshness.any.sharedworker.htmlnew file mode 100644index 00000000000..282f1e6c58e--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/fetch/http-cache/freshness.any.sharedworker.html@@ -0,0 +1,10 @@+<!doctype html>+<meta charset=utf-8>+<title>HTTP Cache - Freshness</title>+<meta name="timeout" content="long">+<script src="../../resources/testharness.js"></script>+<script src="../../resources/testharnessreport.js"></script>+<div id=log></div>+<script>+fetch_tests_from_worker(new SharedWorker("../../fetch/http-cache/freshness.any.worker.js"));+</script>diff --git a/Tests/LibWeb/Text/input/wpt-import/fetch/http-cache/freshness.any.worker.html b/Tests/LibWeb/Text/input/wpt-import/fetch/http-cache/freshness.any.worker.htmlnew file mode 100644index 00000000000..2028c920270--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/fetch/http-cache/freshness.any.worker.html@@ -0,0 +1,10 @@+<!doctype html>+<meta charset=utf-8>+<title>HTTP Cache - Freshness</title>+<meta name="timeout" content="long">+<script src="../../resources/testharness.js"></script>+<script src="../../resources/testharnessreport.js"></script>+<div id=log></div>+<script>+fetch_tests_from_worker(new Worker("../../fetch/http-cache/freshness.any.worker.js"));+</script>diff --git a/Tests/LibWeb/Text/input/wpt-import/fetch/http-cache/freshness.any.worker.js b/Tests/LibWeb/Text/input/wpt-import/fetch/http-cache/freshness.any.worker.jsnew file mode 100644index 00000000000..a6fe0cf1cda--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/fetch/http-cache/freshness.any.worker.js@@ -0,0 +1,13 @@++self.GLOBAL = {+ isWindow: function() { return false; },+ isWorker: function() { return true; },+ isShadowRealm: function() { return false; },+};+importScripts("/resources/testharness.js");+self.META_TITLE = "HTTP Cache - Freshness";+importScripts("/common/utils.js")+importScripts("/common/get-host-info.sub.js")+importScripts("http-cache.js")+importScripts("/fetch/http-cache/freshness.any.js");+done();diff --git a/Tests/LibWeb/Text/input/wpt-import/fetch/http-cache/http-cache.js b/Tests/LibWeb/Text/input/wpt-import/fetch/http-cache/http-cache.jsnew file mode 100644index 00000000000..e2234736910--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/fetch/http-cache/http-cache.js@@ -0,0 +1,288 @@+/* global btoa fetch token promise_test step_timeout */+/* global assert_equals assert_true assert_own_property assert_throws_js assert_less_than */++const templates = {+ 'fresh': {+ 'response_headers': [+ ['Expires', 100000],+ ['Last-Modified', 0]+ ]+ },+ 'stale': {+ 'response_headers': [+ ['Expires', -5000],+ ['Last-Modified', -100000]+ ]+ },+ 'lcl_response': {+ 'response_headers': [+ ['Location', 'location_target'],+ ['Content-Location', 'content_location_target']+ ]+ },+ 'location': {+ 'query_arg': 'location_target',+ 'response_headers': [+ ['Expires', 100000],+ ['Last-Modified', 0]+ ]+ },+ 'content_location': {+ 'query_arg': 'content_location_target',+ 'response_headers': [+ ['Expires', 100000],+ ['Last-Modified', 0]+ ]+ }+}++const noBodyStatus = new Set([204, 304])++function makeTest (test) {+ return function () {+ var uuid = token()+ var requests = expandTemplates(test)+ var fetchFunctions = makeFetchFunctions(requests, uuid)+ return runTest(fetchFunctions, test, requests, uuid)+ }+}++function makeFetchFunctions(requests, uuid) {+ var fetchFunctions = []+ for (let i = 0; i < requests.length; ++i) {+ var config = requests[i];+ if (config.skip) {+ // Skip request are ones that we expect the browser to make in+ // response to a redirect. We don't fetch them again, but+ // the server needs them in the config to be able to respond to+ // them.+ continue;+ }+ fetchFunctions.push({+ code: function (idx) {+ var config = requests[idx]+ var url = makeTestUrl(uuid, config);+ var init = fetchInit(requests, config)+ return fetch(url, init)+ .then(makeCheckResponse(idx, config))+ .then(makeCheckResponseBody(config, uuid), function (reason) {+ if ('expected_type' in config && config.expected_type === 'error') {+ assert_throws_js(TypeError, function () { throw reason })+ } else {+ throw reason+ }+ })+ },+ pauseAfter: 'pause_after' in requests[i]+ })+ }+ return fetchFunctions+}++function runTest(fetchFunctions, test, requests, uuid) {+ var idx = 0+ function runNextStep () {+ if (fetchFunctions.length) {+ var nextFetchFunction = fetchFunctions.shift()+ if (nextFetchFunction.pauseAfter === true) {+ return nextFetchFunction.code(idx++)+ .then(pause)+ .then(runNextStep)+ } else {+ return nextFetchFunction.code(idx++)+ .then(runNextStep)+ }+ } else {+ return Promise.resolve()+ }+ }++ return runNextStep()+ .then(function () {+ return getServerState(uuid)+ }).then(function (testState) {+ checkRequests(test, requests, testState)+ return Promise.resolve()+ })+}++function expandTemplates (test) {+ var rawRequests = test.requests+ var requests = []+ for (let i = 0; i < rawRequests.length; i++) {+ var request = rawRequests[i]+ request.name = test.name+ if ('template' in request) {+ var template = templates[request['template']]+ for (let member in template) {+ if (!request.hasOwnProperty(member)) {+ request[member] = template[member]+ }+ }+ }+ requests.push(request)+ }+ return requests+}++function fetchInit (requests, config) {+ var init = {+ 'headers': []+ }+ if ('request_method' in config) init.method = config['request_method']+ // Note: init.headers must be a copy of config['request_headers'] array,+ // because new elements are added later.+ if ('request_headers' in config) init.headers = [...config['request_headers']];+ if ('name' in config) init.headers.push(['Test-Name', config.name])+ if ('request_body' in config) init.body = config['request_body']+ if ('mode' in config) init.mode = config['mode']+ if ('credentials' in config) init.credentials = config['credentials']+ if ('cache' in config) init.cache = config['cache']+ init.headers.push(['Test-Requests', btoa(JSON.stringify(requests))])+ return init+}++function makeCheckResponse (idx, config) {+ return function checkResponse (response) {+ var reqNum = idx + 1+ var resNum = parseInt(response.headers.get('Server-Request-Count'))+ if ('expected_type' in config) {+ if (config.expected_type === 'error') {+ assert_true(false, `Request ${reqNum} doesn't throw an error`)+ return response.text()+ }+ if (config.expected_type === 'cached') {+ assert_less_than(resNum, reqNum, `Response ${reqNum} does not come from cache`)+ }+ if (config.expected_type === 'not_cached') {+ assert_equals(resNum, reqNum, `Response ${reqNum} comes from cache`)+ }+ }+ if ('expected_status' in config) {+ assert_equals(response.status, config.expected_status,+ `Response ${reqNum} status is ${response.status}, not ${config.expected_status}`)+ } else if ('response_status' in config && config.response_status[0] != 301) {+ assert_equals(response.status, config.response_status[0],+ `Response ${reqNum} status is ${response.status}, not ${config.response_status[0]}`)+ } else {+ assert_equals(response.status, 200, `Response ${reqNum} status is ${response.status}, not 200`)+ }+ if ('response_headers' in config) {+ config.response_headers.forEach(function (header) {+ if (header.len < 3 || header[2] === true) {+ assert_equals(response.headers.get(header[0]), header[1],+ `Response ${reqNum} header ${header[0]} is "${response.headers.get(header[0])}", not "${header[1]}"`)+ }+ })+ }+ if ('expected_response_headers' in config) {+ config.expected_response_headers.forEach(function (header) {+ assert_equals(response.headers.get(header[0]), header[1],+ `Response ${reqNum} header ${header[0]} is "${response.headers.get(header[0])}", not "${header[1]}"`)+ })+ }+ return response.text()+ }+}++function makeCheckResponseBody (config, uuid) {+ return function checkResponseBody (resBody) {+ var statusCode = 200+ if ('response_status' in config) {+ statusCode = config.response_status[0]+ }+ if ('expected_response_text' in config) {+ if (config.expected_response_text !== null) {+ assert_equals(resBody, config.expected_response_text,+ `Response body is "${resBody}", not expected "${config.expected_response_text}"`)+ }+ } else if ('response_body' in config && config.response_body !== null) {+ assert_equals(resBody, config.response_body,+ `Response body is "${resBody}", not sent "${config.response_body}"`)+ } else if (!noBodyStatus.has(statusCode)) {+ assert_equals(resBody, uuid, `Response body is "${resBody}", not default "${uuid}"`)+ }+ }+}++function checkRequests (test, requests, testState) {+ var testIdx = 0+ for (let i = 0; i < requests.length; ++i) {+ var expectedValidatingHeaders = []+ var config = requests[i]+ var serverRequest = testState[testIdx]+ var reqNum = i + 1+ if ('expected_type' in config) {+ if (config.expected_type === 'cached') continue // the server will not see the request+ if (config.expected_type === 'etag_validated') {+ expectedValidatingHeaders.push('if-none-match')+ }+ if (config.expected_type === 'lm_validated') {+ expectedValidatingHeaders.push('if-modified-since')+ }+ }+ testIdx+++ expectedValidatingHeaders.forEach(vhdr => {+ assert_own_property(serverRequest.request_headers, vhdr,+ `request ${reqNum} doesn't have ${vhdr} header`)+ })+ if ('expected_request_headers' in config) {+ config.expected_request_headers.forEach(expectedHdr => {+ assert_equals(serverRequest.request_headers[expectedHdr[0].toLowerCase()], expectedHdr[1],+ `request ${reqNum} header ${expectedHdr[0]} value is "${serverRequest.request_headers[expectedHdr[0].toLowerCase()]}", not "${expectedHdr[1]}"`)+ })+ }+ }+ if (test?.check_count && testState) {+ assert_equals(requests.length, testState.length);+ }+}++function pause () {+ return new Promise(function (resolve, reject) {+ step_timeout(function () {+ return resolve()+ }, 3000)+ })+}++function makeTestUrl (uuid, config) {+ var arg = ''+ var base_url = ''+ if ('base_url' in config) {+ base_url = config.base_url+ }+ if ('query_arg' in config) {+ arg = `&target=${config.query_arg}`+ }+ if ('url_params' in config) {+ arg = `${arg}&${config.url_params}`+ }+ return `${base_url}resources/http-cache.py?dispatch=test&uuid=${uuid}${arg}`+}++function getServerState (uuid) {+ return fetch(`resources/http-cache.py?dispatch=state&uuid=${uuid}`)+ .then(function (response) {+ return response.text()+ }).then(function (text) {+ return JSON.parse(text) || []+ })+}++function run_tests (tests) {+ tests.forEach(function (test) {+ promise_test(makeTest(test), test.name)+ })+}++var contentStore = {}+function http_content (csKey) {+ if (csKey in contentStore) {+ return contentStore[csKey]+ } else {+ var content = btoa(Math.random() * Date.now())+ contentStore[csKey] = content+ return content+ }+}diff --git a/Tests/LibWeb/Text/input/wpt-import/fetch/http-cache/resources/http-cache.py b/Tests/LibWeb/Text/input/wpt-import/fetch/http-cache/resources/http-cache.pynew file mode 100644index 00000000000..3ab610dd142--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/fetch/http-cache/resources/http-cache.py@@ -0,0 +1,124 @@+import datetime+import json+import time+from base64 import b64decode++from wptserve.utils import isomorphic_decode, isomorphic_encode++NOTEHDRS = set([u'content-type', u'access-control-allow-origin', u'last-modified', u'etag'])+NOBODYSTATUS = set([204, 304])+LOCATIONHDRS = set([u'location', u'content-location'])+DATEHDRS = set([u'date', u'expires', u'last-modified'])++def main(request, response):+ dispatch = request.GET.first(b"dispatch", None)+ uuid = request.GET.first(b"uuid", None)+ response.headers.set(b"Access-Control-Allow-Credentials", b"true")++ if request.method == u"OPTIONS":+ return handle_preflight(uuid, request, response)+ if not uuid:+ response.status = (404, b"Not Found")+ response.headers.set(b"Content-Type", b"text/plain")+ return b"UUID not found"+ if dispatch == b'test':+ return handle_test(uuid, request, response)+ elif dispatch == b'state':+ return handle_state(uuid, request, response)+ response.status = (404, b"Not Found")+ response.headers.set(b"Content-Type", b"text/plain")+ return b"Fallthrough"++def handle_preflight(uuid, request, response):+ response.status = (200, b"OK")+ response.headers.set(b"Access-Control-Allow-Origin", request.headers.get(b"origin") or '*')+ response.headers.set(b"Access-Control-Allow-Methods", b"GET")+ response.headers.set(b"Access-Control-Allow-Headers", request.headers.get(b"Access-Control-Request-Headers") or "*")+ response.headers.set(b"Access-Control-Max-Age", b"86400")+ return b"Preflight request"++def handle_state(uuid, request, response):+ response.headers.set(b"Content-Type", b"text/plain")+ return json.dumps(request.server.stash.take(uuid))++def handle_test(uuid, request, response):+ server_state = request.server.stash.take(uuid) or []+ try:+ requests = json.loads(b64decode(request.headers.get(b'Test-Requests', b"")))+ except:+ response.status = (400, b"Bad Request")+ response.headers.set(b"Content-Type", b"text/plain")+ return b"No or bad Test-Requests request header"+ config = requests[len(server_state)]+ if not config:+ response.status = (404, b"Not Found")+ response.headers.set(b"Content-Type", b"text/plain")+ return b"Config not found"+ noted_headers = {}+ now = time.time()+ for header in config.get(u'response_headers', []):+ if header[0].lower() in LOCATIONHDRS: # magic locations+ if (len(header[1]) > 0):+ header[1] = u"%s&target=%s" % (request.url, header[1])+ else:+ header[1] = request.url+ if header[0].lower() in DATEHDRS and isinstance(header[1], int): # magic dates+ header[1] = http_date(now, header[1])+ response.headers.set(isomorphic_encode(header[0]), isomorphic_encode(header[1]))+ if header[0].lower() in NOTEHDRS:+ noted_headers[header[0].lower()] = header[1]+ state = {+ u'now': now,+ u'request_method': request.method,+ u'request_headers': dict([[isomorphic_decode(h.lower()), isomorphic_decode(request.headers[h])] for h in request.headers]),+ u'response_headers': noted_headers+ }+ server_state.append(state)+ request.server.stash.put(uuid, server_state)++ if u"access-control-allow-origin" not in noted_headers:+ response.headers.set(b"Access-Control-Allow-Origin", b"*")+ if u"content-type" not in noted_headers:+ response.headers.set(b"Content-Type", b"text/plain")+ response.headers.set(b"Server-Request-Count", len(server_state))++ code, phrase = config.get(u"response_status", [200, b"OK"])+ if config.get(u"expected_type", u"").endswith(u'validated'):+ ref_hdrs = server_state[0][u'response_headers']+ previous_lm = ref_hdrs.get(u'last-modified', False)+ if previous_lm and request.headers.get(b"If-Modified-Since", False) == isomorphic_encode(previous_lm):+ code, phrase = [304, b"Not Modified"]+ previous_etag = ref_hdrs.get(u'etag', False)+ if previous_etag and request.headers.get(b"If-None-Match", False) == isomorphic_encode(previous_etag):+ code, phrase = [304, b"Not Modified"]+ if code != 304:+ code, phrase = [999, b'304 Not Generated']+ response.status = (code, phrase)++ content = config.get(u"response_body", uuid)+ if code in NOBODYSTATUS:+ return b""+ return content+++def get_header(headers, header_name):+ result = None+ for header in headers:+ if header[0].lower() == header_name.lower():+ result = header[1]+ return result++WEEKDAYS = [u'Mon', u'Tue', u'Wed', u'Thu', u'Fri', u'Sat', u'Sun']+MONTHS = [None, u'Jan', u'Feb', u'Mar', u'Apr', u'May', u'Jun', u'Jul',+ u'Aug', u'Sep', u'Oct', u'Nov', u'Dec']++def http_date(now, delta_secs=0):+ date = datetime.datetime.utcfromtimestamp(now + delta_secs)+ return u"%s, %.2d %s %.4d %.2d:%.2d:%.2d GMT" % (+ WEEKDAYS[date.weekday()],+ date.day,+ MONTHS[date.month],+ date.year,+ date.hour,+ date.minute,+ date.second)diff --git a/Tests/LibWeb/Text/input/wpt-import/interfaces/websockets.idl b/Tests/LibWeb/Text/input/wpt-import/interfaces/websockets.idlnew file mode 100644index 00000000000..6ff16790b03--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/interfaces/websockets.idl@@ -0,0 +1,48 @@+// GENERATED CONTENT - DO NOT EDIT+// Content was automatically extracted by Reffy into webref+// (https://github.com/w3c/webref)+// Source: WebSockets Standard (https://websockets.spec.whatwg.org/)++enum BinaryType { "blob", "arraybuffer" };++[Exposed=(Window,Worker)]+interface WebSocket : EventTarget {+ constructor(USVString url, optional (DOMString or sequence<DOMString>) protocols = []);+ readonly attribute USVString url;++ // ready state+ const unsigned short CONNECTING = 0;+ const unsigned short OPEN = 1;+ const unsigned short CLOSING = 2;+ const unsigned short CLOSED = 3;+ readonly attribute unsigned short readyState;+ readonly attribute unsigned long long bufferedAmount;++ // networking+ attribute EventHandler onopen;+ attribute EventHandler onerror;+ attribute EventHandler onclose;+ readonly attribute DOMString extensions;+ readonly attribute DOMString protocol;+ undefined close(optional [Clamp] unsigned short code, optional USVString reason);++ // messaging+ attribute EventHandler onmessage;+ attribute BinaryType binaryType;+ undefined send((BufferSource or Blob or USVString) data);+};++[Exposed=(Window,Worker)]+interface CloseEvent : Event {+ constructor(DOMString type, optional CloseEventInit eventInitDict = {});++ readonly attribute boolean wasClean;+ readonly attribute unsigned short code;+ readonly attribute USVString reason;+};++dictionary CloseEventInit : EventInit {+ boolean wasClean = false;+ unsigned short code = 0;+ USVString reason = "";+};diff --git a/Tests/LibWeb/Text/input/wpt-import/referrer-policy/css-integration/child-css/external-import-stylesheet.html b/Tests/LibWeb/Text/input/wpt-import/referrer-policy/css-integration/child-css/external-import-stylesheet.htmlnew file mode 100644index 00000000000..61ae2ac63d6--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/referrer-policy/css-integration/child-css/external-import-stylesheet.html@@ -0,0 +1,46 @@+<!DOCTYPE html>+<html>+ <head>+ <title>CSS integration - Child css from external stylesheet</title>+ <script src="../../../resources/testharness.js"></script>+ <script src="../../../resources/testharnessreport.js"></script>+ <script src="../../../common/utils.js"></script>+ <!-- Common global functions for referrer-policy tests. -->+ <script src="../../../common/security-features/resources/common.sub.js"></script>+ <meta name="referrer" content="origin">+ </head>+ <body>+ <p>Check that child css are loaded with the referrer and referrer policy+ from the external stylesheet.</p>++ <div class="styled"></div>++ <script>+ promise_test(function(css_test) {+ let id = token();+ let url_prefix = location.protocol + "//www1." + location.hostname + ":" + location.port;+ let css_url = url_prefix ++ "/common/security-features/subresource/stylesheet.py?id=" + id ++ "&import-rule" + "&referrer-policy=no-referrer";+ let check_url = url_prefix + "/common/security-features/subresource/stylesheet.py" ++ "?id=" + id + "&report-headers";++ return new Promise(resolve => {+ let link = document.createElement("link");+ link.href = css_url;+ link.rel = "stylesheet";+ link.onload = resolve;+ document.head.appendChild(link);+ })+ .then(() => timeoutPromise(css_test, 1000))+ .then(() => requestViaXhr(check_url))+ .then(function(message) {+ assert_own_property(message, "headers");+ assert_equals(message.referrer, undefined);+ });+ }, "Child css from external stylesheet.");+ </script>++ <div id="log"></div>+ </body>+</html>diff --git a/Tests/LibWeb/Text/input/wpt-import/referrer-policy/css-integration/child-css/internal-import-stylesheet.html b/Tests/LibWeb/Text/input/wpt-import/referrer-policy/css-integration/child-css/internal-import-stylesheet.htmlnew file mode 100644index 00000000000..493ffc56b0b--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/referrer-policy/css-integration/child-css/internal-import-stylesheet.html@@ -0,0 +1,42 @@+<!DOCTYPE html>+<html>+ <head>+ <title>CSS integration - Child css from internal stylesheet</title>+ <script src="../../../resources/testharness.js"></script>+ <script src="../../../resources/testharnessreport.js"></script>+ <script src="../../../common/utils.js"></script>+ <!-- Common global functions for referrer-policy tests. -->+ <script src="../../../common/security-features/resources/common.sub.js"></script>+ <meta name="referrer" content="never">+ </head>+ <body>+ <p>Check that child css are loaded with the referrer and referrer policy+ from the internal stylesheet.</p>++ <div class="styled"></div>++ <script>+ promise_test(function(css_test) {+ let id = token();+ let url_prefix = location.protocol + "//www1." + location.hostname + ":" + location.port;+ let css_url = url_prefix + "/common/security-features/subresource/stylesheet.py?id=" + id + "&import-rule";+ let check_url = url_prefix + "/common/security-features/subresource/stylesheet.py" ++ "?id=" + id + "&report-headers";++ let style = document.createElement("style");+ style.type = 'text/css';+ style.appendChild(document.createTextNode("@import url('" + css_url + "');"));+ document.head.appendChild(style);+ return timeoutPromise(css_test, 1000)+ .then(() => requestViaXhr(check_url))+ .then(function(message) {+ assert_own_property(message, "headers");+ assert_own_property(message, "referrer");+ assert_equals(message.referrer, css_url);+ });+ }, "Child css from internal stylesheet.");+ </script>++ <div id="log"></div>+ </body>+</html>diff --git a/Tests/LibWeb/Text/input/wpt-import/referrer-policy/css-integration/font-face/external-import-stylesheet.html b/Tests/LibWeb/Text/input/wpt-import/referrer-policy/css-integration/font-face/external-import-stylesheet.htmlnew file mode 100644index 00000000000..205a4fec58b--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/referrer-policy/css-integration/font-face/external-import-stylesheet.html@@ -0,0 +1,51 @@+<!DOCTYPE html>+<html>+ <head>+ <title>CSS integration - Font from imported stylesheet (external)</title>+ <script src="../../../resources/testharness.js"></script>+ <script src="../../../resources/testharnessreport.js"></script>+ <script src="../../../common/utils.js"></script>+ <!-- Common global functions for referrer-policy tests. -->+ <script src="../../../common/security-features/resources/common.sub.js"></script>+ <meta name="referrer" content="never">+ </head>+ <body>+ <p>Check that resources from imported stylesheets (loaded from external+ stylesheets) are loaded with the referrer and referrer policy from the+ external stylesheet.</p>++ <div class="styled"></div>++ <script>+ promise_test(function(css_test) {+ let id = token();+ let css_url = location.protocol + "//www1." + location.hostname + ":" ++ location.port ++ "/common/security-features/subresource/stylesheet.py?id=" + id ++ "&import-rule" + "&type=font";+ let url_prefix = location.protocol + "//" + location.hostname + ":" + location.port;+ let css_referrer = url_prefix ++ "/common/security-features/subresource/stylesheet.py?id=" + id + "&type=font";+ let font_url = url_prefix + "/common/security-features/subresource/font.py" ++ "?id=" + id + "&report-headers" + "&type=font";++ return new Promise(resolve => {+ let link = document.createElement("link");+ link.href = css_url;+ link.rel = "stylesheet";+ link.onload = resolve;+ document.head.appendChild(link);+ })+ .then(() => timeoutPromise(css_test, 1000))+ .then(() => requestViaXhr(font_url))+ .then(function(message) {+ assert_own_property(message, "headers");+ assert_own_property(message, "referrer");+ assert_equals(message.referrer, css_referrer);+ });+ }, "Font from imported stylesheet (external).");+ </script>++ <div id="log"></div>+ </body>+</html>diff --git a/Tests/LibWeb/Text/input/wpt-import/referrer-policy/css-integration/font-face/external-stylesheet.html b/Tests/LibWeb/Text/input/wpt-import/referrer-policy/css-integration/font-face/external-stylesheet.htmlnew file mode 100644index 00000000000..6ef3c65c3fa--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/referrer-policy/css-integration/font-face/external-stylesheet.html@@ -0,0 +1,45 @@+<!DOCTYPE html>+<html>+ <head>+ <title>CSS integration - Font from external stylesheet</title>+ <script src="../../../resources/testharness.js"></script>+ <script src="../../../resources/testharnessreport.js"></script>+ <script src="../../../common/utils.js"></script>+ <!-- Common global functions for referrer-policy tests. -->+ <script src="../../../common/security-features/resources/common.sub.js"></script>+ <meta name="referrer" content="never">+ </head>+ <body>+ <p>Check that resources from external stylesheets are loaded with+ the referrer and referrer policy from the external stylesheet.</p>++ <div class="styled"></div>++ <script>+ promise_test(function(css_test) {+ let id = token();+ let url_prefix = location.protocol + "//www1." + location.hostname + ":" + location.port;+ let css_url = url_prefix + "/common/security-features/subresource/stylesheet.py?id=" + id + "&type=font";+ let font_url = url_prefix + "/common/security-features/subresource/font.py" ++ "?id=" + id + "&report-headers";++ return new Promise(resolve => {+ let link = document.createElement("link");+ link.href = css_url;+ link.rel = "stylesheet";+ link.onload = resolve;+ document.head.appendChild(link);+ })+ .then(() => timeoutPromise(css_test, 1000))+ .then(() => requestViaXhr(font_url))+ .then(function(message) {+ assert_own_property(message, "headers");+ assert_own_property(message, "referrer");+ assert_equals(message.referrer, css_url);+ });+ }, "Font from external stylesheet.");+ </script>++ <div id="log"></div>+ </body>+</html>diff --git a/Tests/LibWeb/Text/input/wpt-import/referrer-policy/css-integration/font-face/internal-import-stylesheet.html b/Tests/LibWeb/Text/input/wpt-import/referrer-policy/css-integration/font-face/internal-import-stylesheet.htmlnew file mode 100644index 00000000000..8feff40b64b--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/referrer-policy/css-integration/font-face/internal-import-stylesheet.html@@ -0,0 +1,42 @@+<!DOCTYPE html>+<html>+ <head>+ <title>CSS integration - Font from imported stylesheet (internal)</title>+ <script src="../../../resources/testharness.js"></script>+ <script src="../../../resources/testharnessreport.js"></script>+ <script src="../../../common/utils.js"></script>+ <!-- Common global functions for referrer-policy tests. -->+ <script src="../../../common/security-features/resources/common.sub.js"></script>+ <meta name="referrer" content="origin">+ </head>+ <body>+ <p>Check that resources from stylesheets (imported from internal+ stylesheets) are loaded with the referrer and referrer policy from from the+ imported style sheet.</p>++ <div class="styled"></div>++ <script>+ promise_test(function(css_test) {+ let id = token();+ let url_prefix = location.protocol + "//www1." + location.hostname + ":" ++ location.port + "/common/security-features/subresource/";+ let css_url = url_prefix + "stylesheet.py?id=" + id + "&type=font";+ let font_url = url_prefix + "font.py?report-headers&id=" + id;++ let style = document.createElement("style");+ style.textContent = "@import url('" + css_url + "');";+ document.head.appendChild(style);+ return timeoutPromise(css_test, 1000)+ .then(() => requestViaXhr(font_url))+ .then(function(message) {+ assert_own_property(message, "headers");+ assert_own_property(message, "referrer");+ assert_equals(message.referrer, css_url);+ });+ }, "Font from imported stylesheet (internal).");+ </script>++ <div id="log"></div>+ </body>+</html>diff --git a/Tests/LibWeb/Text/input/wpt-import/referrer-policy/generic/multiple-headers-and-values.html b/Tests/LibWeb/Text/input/wpt-import/referrer-policy/generic/multiple-headers-and-values.htmlnew file mode 100644index 00000000000..6b4728641ca--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/referrer-policy/generic/multiple-headers-and-values.html@@ -0,0 +1,30 @@+<!DOCTYPE html>+<html>+ <head>+ <title>Referrer Policy: multiple Referrer-Policy header and header values are allowed</title>+ <script src="../../resources/testharness.js"></script>+ <script src="../../resources/testharnessreport.js"></script>++ <script src="../../common/security-features/resources/common.sub.js"></script>+ </head>+ <body>+ <h1>Referrer Policy: multiple Referrer-Policy header and header values are allowed</h1>+ <p></p>++ <pre id="received_message">Running...</pre>++ <script>+ promise_test(() => {+ var urlPath = '/common/security-features/subresource/image.py?cache_destroyer=' + (new Date()).getTime();+ var url = location.protocol + "//www1." + location.hostname + ":" + location.port ++ urlPath;+ return requestViaImage(url, null, 'no-referrer')+ .then(function(message) {+ assert_equals(message.referrer, document.location.origin + "/");+ });+ }, "Image uses the last recognized Referrer-Policy header value");+ </script>++ <div id="log"></div>+ </body>+</html>diff --git a/Tests/LibWeb/Text/input/wpt-import/referrer-policy/generic/multiple-headers-and-values.html.headers b/Tests/LibWeb/Text/input/wpt-import/referrer-policy/generic/multiple-headers-and-values.html.headersnew file mode 100644index 00000000000..d1acc2f1d3c--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/referrer-policy/generic/multiple-headers-and-values.html.headers@@ -0,0 +1,2 @@+Referrer-Policy: no-referrer+Referrer-Policy: no-referrer,origindiff --git a/Tests/LibWeb/Text/input/wpt-import/referrer-policy/generic/multiple-headers-one-unknown-token.html b/Tests/LibWeb/Text/input/wpt-import/referrer-policy/generic/multiple-headers-one-unknown-token.htmlnew file mode 100644index 00000000000..8acf92c8bb0--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/referrer-policy/generic/multiple-headers-one-unknown-token.html@@ -0,0 +1,30 @@+<!DOCTYPE html>+<html>+ <head>+ <title>Referrer Policy: multiple Referrer-Policy headers with one invalid</title>+ <script src="../../resources/testharness.js"></script>+ <script src="../../resources/testharnessreport.js"></script>++ <script src="../../common/security-features/resources/common.sub.js"></script>+ </head>+ <body>+ <h1>Referrer Policy: multiple Referrer-Policy headers with one invalid</h1>+ <p></p>++ <pre id="received_message">Running...</pre>++ <script>+ promise_test(() => {+ var urlPath = '/common/security-features/subresource/image.py?cache_destroyer=' + (new Date()).getTime();+ var url = location.protocol + "//www1." + location.hostname + ":" + location.port ++ urlPath;+ return requestViaImage(url, null, 'no-referrer')+ .then(function(message) {+ assert_equals(message.referrer, document.location.origin + "/");+ });+ }, "Image uses last recognized referrer policy token from Referrer-Policy headers");+ </script>++ <div id="log"></div>+ </body>+</html>diff --git a/Tests/LibWeb/Text/input/wpt-import/referrer-policy/generic/multiple-headers-one-unknown-token.html.headers b/Tests/LibWeb/Text/input/wpt-import/referrer-policy/generic/multiple-headers-one-unknown-token.html.headersnew file mode 100644index 00000000000..46feffd705f--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/referrer-policy/generic/multiple-headers-one-unknown-token.html.headers@@ -0,0 +1,2 @@+Referrer-Policy: no-referrer+Referrer-Policy: origin,not-a-valid-tokendiff --git a/Tests/LibWeb/Text/input/wpt-import/referrer-policy/generic/subresource-test/area-navigate.html b/Tests/LibWeb/Text/input/wpt-import/referrer-policy/generic/subresource-test/area-navigate.htmlnew file mode 100644index 00000000000..f8102de1321--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/referrer-policy/generic/subresource-test/area-navigate.html@@ -0,0 +1,39 @@+<!DOCTYPE html>+<!-- TODO(kristijanburnik): Remove subres. duplication. Reuse a template. -->+<html>+ <head>+ <title>Area Link messaging - cross-origin Area Link navigation</title>+ <script src="../../../resources/testharness.js"></script>+ <script src="../../../resources/testharnessreport.js"></script>+ <!-- Common global functions for referrer-policy tests. -->+ <script src="../../../common/security-features/resources/common.sub.js"></script>+ </head>+ <body>+ <h1>Area Link messaging - cross-origin Area Link navigation</h1>+ <p>If you can read JSON encoded HTTP request headers of the Area link below,+ the messaging works as expected.</p>++ <pre id="received_message">Running...</pre>++ <script>+ promise_test(function() {+ var urlPath = '/common/security-features/subresource/document.py';+ var url = location.protocol + "//www1." + location.hostname + ":" + location.port ++ urlPath;+ return requestViaArea(url)+ .then(function(message) {+ var pre = document.getElementById('received_message')+ var headers = message.headers;+ pre.innerHTML = "";+ pre.innerHTML += url + ":\n\n";+ pre.innerHTML += JSON.stringify(headers, null, 2) + "\n\n"+ assert_own_property(headers, "host")+ assert_own_property(headers, "connection")+ });+ },+ "Area is responding with HTTP headers");+ </script>++ <div id="log"></div>+ </body>+</html>diff --git a/Tests/LibWeb/Text/input/wpt-import/referrer-policy/generic/subresource-test/fetch-messaging.html b/Tests/LibWeb/Text/input/wpt-import/referrer-policy/generic/subresource-test/fetch-messaging.htmlnew file mode 100644index 00000000000..93be5ef0685--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/referrer-policy/generic/subresource-test/fetch-messaging.html@@ -0,0 +1,42 @@+<!DOCTYPE html>+<!-- TODO(kristijanburnik): Remove subres. duplication. Reuse a template. -->+<html>+ <head>+ <title>Fetch messaging - same-origin Fetch request</title>+ <script src="../../../resources/testharness.js"></script>+ <script src="../../../resources/testharnessreport.js"></script>+ <!-- Common global functions for referrer-policy tests. -->+ <script src="../../../common/security-features/resources/common.sub.js"></script>+ </head>+ <body>+ <h1>Fetch messaging - same-origin Fetch request</h1>+ <p>If you can read JSON encoded HTTP request headers of the Fetch below,+ the messaging works as expected.</p>++ <pre id="received_message">Running...</pre>++ <script>+ test(function() {+ assert_true(!!window.fetch, "Fetch is not supported by this browser.");+ }, "Fetch is supported by the browser.");++ promise_test(function() {+ var urlPath = '/common/security-features/subresource/xhr.py';+ var url = location.protocol + "//" + location.hostname + ":" ++ location.port + urlPath;+ return requestViaFetch(url)+ .then(function(message) {+ var pre = document.getElementById('received_message')+ var headers = message.headers;+ pre.innerHTML = "";+ pre.innerHTML += url + ":\n\n";+ pre.innerHTML += JSON.stringify(headers, null, 2) + "\n\n";+ assert_own_property(headers, "host")+ assert_own_property(headers, "connection")+ });+ }, "Fetch is responding with HTTP headers");+ </script>++ <div id="log"></div>+ </body>+</html>diff --git a/Tests/LibWeb/Text/input/wpt-import/referrer-policy/generic/subresource-test/iframe-messaging.html b/Tests/LibWeb/Text/input/wpt-import/referrer-policy/generic/subresource-test/iframe-messaging.htmlnew file mode 100644index 00000000000..db2626deba0--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/referrer-policy/generic/subresource-test/iframe-messaging.html@@ -0,0 +1,38 @@+<!DOCTYPE html>+<!-- TODO(kristijanburnik): Remove subres. duplication. Reuse a template. -->+<html>+ <head>+ <title>Iframe messaging - cross-origin iframe request</title>+ <script src="../../../resources/testharness.js"></script>+ <script src="../../../resources/testharnessreport.js"></script>+ <!-- Common global functions for referrer-policy tests. -->+ <script src="../../../common/security-features/resources/common.sub.js"></script>+ </head>+ <body>+ <h1>Iframe messaging - cross-origin iframe request</h1>+ <p>If you can read JSON encoded HTTP request headers of the iframe below,+ the messaging works as expected.</p>++ <pre id="received_message">Running...</pre>++ <script>+ promise_test(function() {+ var urlPath = '/common/security-features/subresource/document.py';+ var url = location.protocol + "//www1." + location.hostname + ":" + location.port ++ urlPath;+ return requestViaIframe(url)+ .then(function(message) {+ var pre = document.getElementById('received_message')+ var headers = message.headers;+ pre.innerHTML = "";+ pre.innerHTML += url + ":\n\n";+ pre.innerHTML += JSON.stringify(headers, null, 2) + "\n\n"+ assert_own_property(headers, "host")+ assert_own_property(headers, "connection")+ });+ }, "Iframe is responding with HTTP headers");+ </script>++ <div id="log"></div>+ </body>+</html>diff --git a/Tests/LibWeb/Text/input/wpt-import/referrer-policy/generic/subresource-test/image-decoding.html b/Tests/LibWeb/Text/input/wpt-import/referrer-policy/generic/subresource-test/image-decoding.htmlnew file mode 100644index 00000000000..89629e4ef70--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/referrer-policy/generic/subresource-test/image-decoding.html@@ -0,0 +1,38 @@+<!DOCTYPE html>+<!-- TODO(kristijanburnik): Remove subres. duplication. Reuse a template. -->+<html>+ <head>+ <title>Image decoding - cross-origin image request</title>+ <script src="../../../resources/testharness.js"></script>+ <script src="../../../resources/testharnessreport.js"></script>+ <!-- Common global functions for referrer-policy tests. -->+ <script src="../../../common/security-features/resources/common.sub.js"></script>+ </head>+ <body>+ <h1>Image decoding - cross-origin image request</h1>+ <p>If you can read JSON encoded HTTP headers of the image below,+ the decoding works as expected.</p>++ <pre id="received_message">Running...</pre>++ <script>+ promise_test(function() {+ var urlPath = '/common/security-features/subresource/image.py';+ var url = location.protocol + "//www1." + location.hostname + ":" + location.port ++ urlPath + "?cache_destroyer=" + (new Date()).getTime();+ return requestViaImage(url, undefined, "always")+ .then(function(message) {+ var pre = document.getElementById('received_message')+ var headers = message.headers;+ pre.innerHTML = "";+ pre.innerHTML += url + ":\n\n";+ pre.innerHTML += JSON.stringify(headers, null, 2) + "\n\n"+ assert_own_property(headers, "host")+ assert_own_property(headers, "connection")+ });+ }, "Image is encoding headers as JSON.");+ </script>++ <div id="log"></div>+ </body>+</html>diff --git a/Tests/LibWeb/Text/input/wpt-import/referrer-policy/generic/subresource-test/link-navigate.html b/Tests/LibWeb/Text/input/wpt-import/referrer-policy/generic/subresource-test/link-navigate.htmlnew file mode 100644index 00000000000..109bae0d98a--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/referrer-policy/generic/subresource-test/link-navigate.html@@ -0,0 +1,38 @@+<!DOCTYPE html>+<!-- TODO(kristijanburnik): Remove subres. duplication. Reuse a template. -->+<html>+ <head>+ <title>Link messaging - cross-origin Link navigation</title>+ <script src="../../../resources/testharness.js"></script>+ <script src="../../../resources/testharnessreport.js"></script>+ <!-- Common global functions for referrer-policy tests. -->+ <script src="../../../common/security-features/resources/common.sub.js"></script>+ </head>+ <body>+ <h1>Link messaging - cross-origin Link navigation</h1>+ <p>If you can read JSON encoded HTTP request headers of the Link below,+ the messaging works as expected.</p>++ <pre id="received_message">Running...</pre>++ <script>+ promise_test(function() {+ var urlPath = '/common/security-features/subresource/document.py';+ var url = location.protocol + "//www1." + location.hostname + ":" + location.port ++ urlPath;+ return requestViaAnchor(url)+ .then(function(message) {+ var pre = document.getElementById('received_message')+ var headers = message.headers;+ pre.innerHTML = "";+ pre.innerHTML += url + ":\n\n";+ pre.innerHTML += JSON.stringify(headers, null, 2) + "\n\n"+ assert_own_property(headers, "host")+ assert_own_property(headers, "connection")+ });+ }, "Link is responding with HTTP headers");+ </script>++ <div id="log"></div>+ </body>+</html>diff --git a/Tests/LibWeb/Text/input/wpt-import/referrer-policy/generic/subresource-test/script-messaging.html b/Tests/LibWeb/Text/input/wpt-import/referrer-policy/generic/subresource-test/script-messaging.htmlnew file mode 100644index 00000000000..462d106f3ee--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/referrer-policy/generic/subresource-test/script-messaging.html@@ -0,0 +1,38 @@+<!DOCTYPE html>+<!-- TODO(kristijanburnik): Remove subres. duplication. Reuse a template. -->+<html>+ <head>+ <title>Script messaging - cross-origin Script request</title>+ <script src="../../../resources/testharness.js"></script>+ <script src="../../../resources/testharnessreport.js"></script>+ <!-- Common global functions for referrer-policy tests. -->+ <script src="../../../common/security-features/resources/common.sub.js"></script>+ </head>+ <body>+ <h1>Script messaging - cross-origin Script request</h1>+ <p>If you can read JSON encoded HTTP request headers of the Script below,+ the messaging works as expected.</p>++ <pre id="received_message">Running...</pre>++ <script>+ promise_test(function() {+ var urlPath = '/common/security-features/subresource/script.py';+ var url = location.protocol + "//www1." + location.hostname + ":" + location.port ++ urlPath;+ return requestViaScript(url)+ .then(function(message) {+ var pre = document.getElementById('received_message')+ var headers = message.headers;+ pre.innerHTML = "";+ pre.innerHTML += url + ":\n\n";+ pre.innerHTML += JSON.stringify(headers, null, 2) + "\n\n"+ assert_own_property(headers, "host")+ assert_own_property(headers, "connection")+ });+ }, "Script is responding with HTTP headers");+ </script>++ <div id="log"></div>+ </body>+</html>diff --git a/Tests/LibWeb/Text/input/wpt-import/referrer-policy/generic/subresource-test/worker-messaging.html b/Tests/LibWeb/Text/input/wpt-import/referrer-policy/generic/subresource-test/worker-messaging.htmlnew file mode 100644index 00000000000..cff8de3872a--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/referrer-policy/generic/subresource-test/worker-messaging.html@@ -0,0 +1,38 @@+<!DOCTYPE html>+<!-- TODO(kristijanburnik): Remove subres. duplication. Reuse a template. -->+<html>+ <head>+ <title>Worker messaging - same-origin Worker request</title>+ <script src="../../../resources/testharness.js"></script>+ <script src="../../../resources/testharnessreport.js"></script>+ <!-- Common global functions for referrer-policy tests. -->+ <script src="../../../common/security-features/resources/common.sub.js"></script>+ </head>+ <body>+ <h1>Worker messaging - same-origin Worker request</h1>+ <p>If you can read JSON encoded HTTP request headers of the Worker below,+ the messaging works as expected.</p>++ <pre id="received_message">Running...</pre>++ <script>+ promise_test(function() {+ var urlPath = '/common/security-features/subresource/worker.py';+ var url = location.protocol + "//" + location.hostname + ":" ++ location.port + urlPath;+ return requestViaDedicatedWorker(url, {})+ .then(function(message) {+ var pre = document.getElementById('received_message')+ var headers = message.headers;+ pre.innerHTML = "";+ pre.innerHTML += url + ":\n\n";+ pre.innerHTML += JSON.stringify(headers, null, 2) + "\n\n"+ assert_own_property(headers, "host")+ assert_own_property(headers, "connection")+ });+ }, "Worker is responding with HTTP headers");+ </script>++ <div id="log"></div>+ </body>+</html>diff --git a/Tests/LibWeb/Text/input/wpt-import/referrer-policy/generic/subresource-test/xhr-messaging.html b/Tests/LibWeb/Text/input/wpt-import/referrer-policy/generic/subresource-test/xhr-messaging.htmlnew file mode 100644index 00000000000..0110df0a7d1--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/referrer-policy/generic/subresource-test/xhr-messaging.html@@ -0,0 +1,38 @@+<!DOCTYPE html>+<!-- TODO(kristijanburnik): Remove subres. duplication. Reuse a template. -->+<html>+ <head>+ <title>XHR messaging - cross-origin XHR request</title>+ <script src="../../../resources/testharness.js"></script>+ <script src="../../../resources/testharnessreport.js"></script>+ <!-- Common global functions for referrer-policy tests. -->+ <script src="../../../common/security-features/resources/common.sub.js"></script>+ </head>+ <body>+ <h1>XHR messaging - cross-origin XHR request</h1>+ <p>If you can read JSON encoded HTTP request headers of the XHR below,+ the messaging works as expected.</p>++ <pre id="received_message">Running...</pre>++ <script>+ promise_test(function() {+ var urlPath = '/common/security-features/subresource/xhr.py';+ var url = location.protocol + "//www1." + location.hostname + ":" + location.port ++ urlPath;+ return requestViaXhr(url)+ .then(function(message) {+ var pre = document.getElementById('received_message')+ var headers = message.headers;+ pre.innerHTML = "";+ pre.innerHTML += url + ":\n\n";+ pre.innerHTML += JSON.stringify(headers, null, 2) + "\n\n"+ assert_own_property(headers, "host")+ assert_own_property(headers, "connection")+ });+ }, "XHR is responding with HTTP headers");+ </script>++ <div id="log"></div>+ </body>+</html>diff --git a/Tests/LibWeb/Text/input/wpt-import/websockets/idlharness.any.html b/Tests/LibWeb/Text/input/wpt-import/websockets/idlharness.any.htmlnew file mode 100644index 00000000000..ea357cb18da--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/websockets/idlharness.any.html@@ -0,0 +1,16 @@+<!doctype html>+<meta charset=utf-8>++<script>+self.GLOBAL = {+ isWindow: function() { return true; },+ isWorker: function() { return false; },+ isShadowRealm: function() { return false; },+};+</script>+<script src="../resources/testharness.js"></script>+<script src="../resources/testharnessreport.js"></script>+<script src="../resources/WebIDLParser.js"></script>+<script src="../resources/idlharness.js"></script>+<div id=log></div>+<script src="../websockets/idlharness.any.js"></script>diff --git a/Tests/LibWeb/Text/input/wpt-import/websockets/idlharness.any.js b/Tests/LibWeb/Text/input/wpt-import/websockets/idlharness.any.jsnew file mode 100644index 00000000000..653cc36d21d--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/websockets/idlharness.any.js@@ -0,0 +1,17 @@+// META: script=/resources/WebIDLParser.js+// META: script=/resources/idlharness.js++// https://websockets.spec.whatwg.org/++"use strict";++idl_test(+ ['websockets'],+ ['html', 'dom'],+ idl_array => {+ idl_array.add_objects({+ WebSocket: ['new WebSocket("ws://invalid")'],+ CloseEvent: ['new CloseEvent("close")'],+ });+ }+);diff --git a/Tests/LibWeb/Text/input/wpt-import/websockets/idlharness.any.worker.html b/Tests/LibWeb/Text/input/wpt-import/websockets/idlharness.any.worker.htmlnew file mode 100644index 00000000000..6c7d79dbbc9--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/websockets/idlharness.any.worker.html@@ -0,0 +1,9 @@+<!doctype html>+<meta charset=utf-8>++<script src="../resources/testharness.js"></script>+<script src="../resources/testharnessreport.js"></script>+<div id=log></div>+<script>+fetch_tests_from_worker(new Worker("../websockets/idlharness.any.worker.js"));+</script>diff --git a/Tests/LibWeb/Text/input/wpt-import/websockets/idlharness.any.worker.js b/Tests/LibWeb/Text/input/wpt-import/websockets/idlharness.any.worker.jsnew file mode 100644index 00000000000..026f06f9e57--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/websockets/idlharness.any.worker.js@@ -0,0 +1,11 @@++self.GLOBAL = {+ isWindow: function() { return false; },+ isWorker: function() { return true; },+ isShadowRealm: function() { return false; },+};+importScripts("/resources/testharness.js");+importScripts("/resources/WebIDLParser.js")+importScripts("/resources/idlharness.js")+importScripts("/websockets/idlharness.any.js");+done();diff --git a/Tests/LibWeb/Text/input/wpt-import/xhr/request-content-length.any.html b/Tests/LibWeb/Text/input/wpt-import/xhr/request-content-length.any.htmlnew file mode 100644index 00000000000..48e442cf74b--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/xhr/request-content-length.any.html@@ -0,0 +1,15 @@+<!doctype html>+<meta charset=utf-8>++<script>+self.GLOBAL = {+ isWindow: function() { return true; },+ isWorker: function() { return false; },+ isShadowRealm: function() { return false; },+};+</script>+<script src="../resources/testharness.js"></script>+<script src="../resources/testharnessreport.js"></script>++<div id=log></div>+<script src="../xhr/request-content-length.any.js"></script>diff --git a/Tests/LibWeb/Text/input/wpt-import/xhr/request-content-length.any.js b/Tests/LibWeb/Text/input/wpt-import/xhr/request-content-length.any.jsnew file mode 100644index 00000000000..69a1e168365--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/xhr/request-content-length.any.js@@ -0,0 +1,32 @@+async_test(test => {+ const client = new XMLHttpRequest();+ const data = "This is 22 bytes long.";+ let happened = false;+ client.upload.onprogress = test.step_func(e => {+ assert_true(e.lengthComputable);+ assert_equals(e.total, data.length);+ happened = true;+ });+ client.onload = test.step_func_done(() => {+ assert_true(happened);+ assert_true(client.responseText.includes(`Content-Length: ${data.length}`));+ });+ client.onerror = test.unreached_func();+ client.open("POST", "resources/echo-headers.py");+ client.send(data);+}, "Uploads need to set the Content-Length header");++async_test(test => {+ const client = new XMLHttpRequest();+ const data = "blah";+ const url = URL.createObjectURL(new Blob([data]));+ client.open("GET", url);+ client.send();+ client.onload = test.step_func_done(e => {+ assert_true(e.lengthComputable);+ assert_equals(e.total, data.length);+ assert_equals(e.loaded, data.length);+ assert_equals(client.responseText, data);+ assert_equals(client.getResponseHeader("Content-Length"), String(data.length));+ });+}, "Fetched blob: URLs set the Content-Length header");diff --git a/Tests/LibWeb/Text/input/wpt-import/xhr/request-content-length.any.worker.html b/Tests/LibWeb/Text/input/wpt-import/xhr/request-content-length.any.worker.htmlnew file mode 100644index 00000000000..166110a4b24--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/xhr/request-content-length.any.worker.html@@ -0,0 +1,9 @@+<!doctype html>+<meta charset=utf-8>++<script src="../resources/testharness.js"></script>+<script src="../resources/testharnessreport.js"></script>+<div id=log></div>+<script>+fetch_tests_from_worker(new Worker("../xhr/request-content-length.any.worker.js"));+</script>diff --git a/Tests/LibWeb/Text/input/wpt-import/xhr/request-content-length.any.worker.js b/Tests/LibWeb/Text/input/wpt-import/xhr/request-content-length.any.worker.jsnew file mode 100644index 00000000000..c55efc0dc69--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/xhr/request-content-length.any.worker.js@@ -0,0 +1,10 @@++self.GLOBAL = {+ isWindow: function() { return false; },+ isWorker: function() { return true; },+ isShadowRealm: function() { return false; },+};+importScripts("/resources/testharness.js");++importScripts("/xhr/request-content-length.any.js");+done();diff --git a/Tests/LibWeb/Text/input/wpt-import/xhr/resources/echo-headers.py b/Tests/LibWeb/Text/input/wpt-import/xhr/resources/echo-headers.pynew file mode 100644index 00000000000..63943082b63--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/xhr/resources/echo-headers.py@@ -0,0 +1,9 @@+def main(request, response):+ content = str(request.raw_headers)+ response.writer.write_status(200)+ response.writer.write_header(b"Content-Type", b"text/plain")+ response.writer.write_header(b"Content-Length", str(len(content)))+ response.writer.write_header(b"Connection", b"close")+ response.writer.end_headers()+ response.writer.write(content)+ response.close_connection = Truediff --git a/Tests/LibWeb/Text/input/wpt-import/xhr/resources/inspect-headers.py b/Tests/LibWeb/Text/input/wpt-import/xhr/resources/inspect-headers.pynew file mode 100644index 00000000000..123d637134d--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/xhr/resources/inspect-headers.py@@ -0,0 +1,36 @@+from wptserve.utils import isomorphic_encode++def get_response(raw_headers, filter_value, filter_name):+ result = b""+ # raw_headers.raw_items() returns the (name, value) header pairs as+ # tuples of strings. Convert them to bytes before comparing.+ # TODO: Get access to the raw headers, so that whitespace between+ # name, ":" and value can also be checked:+ # https://github.com/web-platform-tests/wpt/issues/28756+ for field in raw_headers.raw_items():+ name = isomorphic_encode(field[0])+ value = isomorphic_encode(field[1])+ if filter_value:+ if value == filter_value:+ result += name + b","+ elif name.lower() == filter_name:+ result += name + b": " + value + b"\n"+ return result++def main(request, response):+ headers = []+ if b"cors" in request.GET:+ headers.append((b"Access-Control-Allow-Origin", b"*"))+ headers.append((b"Access-Control-Allow-Credentials", b"true"))+ headers.append((b"Access-Control-Allow-Methods", b"GET, POST, PUT, FOO"))+ headers.append((b"Access-Control-Allow-Headers", b"x-test, x-foo"))+ headers.append((+ b"Access-Control-Expose-Headers",+ b"x-request-method, x-request-content-type, x-request-query, x-request-content-length"))+ headers.append((b"content-type", b"text/plain"))++ filter_value = request.GET.first(b"filter_value", b"")+ filter_name = request.GET.first(b"filter_name", b"").lower()+ result = get_response(request.raw_headers, filter_value, filter_name)++ return headers, resultdiff --git a/Tests/LibWeb/Text/input/wpt-import/xhr/resources/status.py b/Tests/LibWeb/Text/input/wpt-import/xhr/resources/status.pynew file mode 100644index 00000000000..05a59d5a637--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/xhr/resources/status.py@@ -0,0 +1,11 @@+from wptserve.utils import isomorphic_encode++def main(request, response):+ code = int(request.GET.first(b"code", 200))+ text = request.GET.first(b"text", b"OMG")+ content = request.GET.first(b"content", b"")+ type = request.GET.first(b"type", b"")+ status = (code, text)+ headers = [(b"Content-Type", type),+ (b"X-Request-Method", isomorphic_encode(request.method))]+ return status, headers, contentdiff --git a/Tests/LibWeb/Text/input/wpt-import/xhr/responsedocument-decoding.htm b/Tests/LibWeb/Text/input/wpt-import/xhr/responsedocument-decoding.htmnew file mode 100644index 00000000000..98fa206c772--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/xhr/responsedocument-decoding.htm@@ -0,0 +1,39 @@+<!doctype html>+<html>+ <head>+ <meta charset="utf-8">+ <title>XMLHttpRequest: response document decoding</title>+ <script src="../resources/testharness.js"></script>+ <script src="../resources/testharnessreport.js"></script>+ </head>+ <body>+ <script>+ function request(type, input, expected) {+ async_test((test) => {+ const client = new XMLHttpRequest();+ client.responseType = 'document';+ client.open("GET", "resources/status.py?content=" + input + "&type=" + encodeURIComponent(type), true);+ client.onload = test.step_func_done(() => {+ assert_equals(client.responseXML.querySelector("x").textContent, expected);+ })+ client.send(null);+ }, document.title + " (" + type + " " + input + ")");+ }++ const encoded_content = "%e6%a9%9f";+ const encoded_xml =+ encodeURIComponent("<?xml version='1.0' encoding='windows-1252'?><x>") + encoded_content + encodeURIComponent("<\/x>");+ const encoded_html =+ encodeURIComponent("<!doctype html><meta charset=windows-1252><x>") + encoded_content + encodeURIComponent("<\/x>");+ const decoded_as_windows_1252 = "\u00e6\u00a9\u0178";+ const decoded_as_utf_8 = "\u6a5f";++ request("application/xml", encoded_xml, decoded_as_windows_1252);+ request("application/xml;charset=utf-8", encoded_xml, decoded_as_utf_8);+ request("application/xml;charset=windows-1252", encoded_xml, decoded_as_windows_1252);+ request("text/html", encoded_html, decoded_as_windows_1252);+ request("text/html;charset=utf-8", encoded_html, decoded_as_utf_8);+ request("text/html;charset=windows-1252", encoded_html, decoded_as_windows_1252);+ </script>+ </body>+</html>diff --git a/Tests/LibWeb/Text/input/wpt-import/xhr/responsetext-decoding.htm b/Tests/LibWeb/Text/input/wpt-import/xhr/responsetext-decoding.htmnew file mode 100644index 00000000000..8ec92a25870--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/xhr/responsetext-decoding.htm@@ -0,0 +1,93 @@+<!doctype html>+<html>+ <head>+ <meta charset="utf-8">+ <title>XMLHttpRequest: responseText decoding</title>+ <script src="../resources/testharness.js"></script>+ <script src="../resources/testharnessreport.js"></script>+ </head>+ <body>+ <script>+ function create_html(content) {+ return "<!doctype html><meta charset=windows-1252><x>" + content + "</x>";+ }+ function create_encoded_html(encoded_content) {+ return encodeURIComponent("<!doctype html><meta charset=windows-1252><x>") + encoded_content + encodeURIComponent("<\/x>");+ }+ function create_xml(content) {+ return "<?xml version='1.0' encoding='windows-1252'?><x>" + content + "</x>";+ }+ function create_encoded_xml(encoded_content) {+ return encodeURIComponent("<?xml version='1.0' encoding='windows-1252'?><x>") + encoded_content + encodeURIComponent("<\/x>");+ }+ function request(type, input, output, responseType) {+ async_test((test) => {+ const client = new XMLHttpRequest();+ if (responseType !== undefined) {+ client.responseType = responseType;+ }+ client.open("GET", "resources/status.py?content=" + input + "&type=" + encodeURIComponent(type), true);+ client.onload = test.step_func_done(() => {+ assert_equals(client.responseText, output);+ })+ client.send(null);+ }, document.title + " (" + type + " " + input + " " + (responseType ? " " + responseType : "empty") + ")");+ }++ const encoded_content = "%e6%a9%9f";+ const decoded_as_windows_1252 = "\u00e6\u00a9\u0178";+ const decoded_as_utf_8 = "\u6a5f";+ const encoded_xml = create_encoded_xml(encoded_content);+ const encoded_html = create_encoded_html(encoded_content);+ const xml_decoded_as_windows_1252 = create_xml(decoded_as_windows_1252);+ const xml_decoded_as_utf_8 = create_xml(decoded_as_utf_8);+ const html_decoded_as_windows_1252 = create_html(decoded_as_windows_1252);+ const html_decoded_as_utf_8 = create_html(decoded_as_utf_8);++ // "default" response type+ // An XML-ish response is sniffed.+ request("application/xml", encoded_xml, xml_decoded_as_windows_1252);+ // An HTML-ish response isn't sniffed.+ request("text/html", encoded_html, html_decoded_as_utf_8);+ request("application/xml;charset=utf-8", encoded_xml, xml_decoded_as_utf_8);+ request("application/xml;charset=windows-1252", encoded_xml, xml_decoded_as_windows_1252);+ request("text/html;charset=utf-8", encoded_html, html_decoded_as_utf_8);+ request("text/html;charset=windows-1252", encoded_html, html_decoded_as_windows_1252);+ request("text/plain;charset=windows-1252", "%FF", "\u00FF");+ request("text/plain", "%FF", "\uFFFD");+ request("text/plain", "%FE%FF", "");+ request("text/plain", "%FE%FF%FE%FF", "\uFEFF");+ request("text/plain", "%EF%BB%BF", "");+ request("text/plain", "%EF%BB%BF%EF%BB%BF", "\uFEFF");+ request("text/plain", "%C2", "\uFFFD");+ request("text/xml", "%FE%FF", "");+ request("text/xml", "%FE%FF%FE%FF", "\uFEFF");+ request("text/xml", "%EF%BB%BF", "");+ request("text/xml", "%EF%BB%BF%EF%BB%BF", "\uFEFF");+ request("text/plain", "%E3%81%B2", "\u3072");++ // "text" response type+ // An XML-ish response isn't sniffed.+ request("application/xml", encoded_xml, xml_decoded_as_utf_8, "text");+ // An HTML-ish response isn't sniffed.+ request("text/html", encoded_html, html_decoded_as_utf_8, "text");+ request("application/xml;charset=utf-8", encoded_xml, xml_decoded_as_utf_8, "text");+ request("application/xml;charset=windows-1252", encoded_xml, xml_decoded_as_windows_1252, "text");+ request("text/html;charset=utf-8", encoded_html, html_decoded_as_utf_8, "text");+ request("text/html;charset=windows-1252", encoded_html, html_decoded_as_windows_1252, "text");+ request("text/plain;charset=windows-1252", "%FF", "\u00FF", "text");+ request("text/plain", "%FF", "\uFFFD", "text");+ request("text/plain", "%FE%FF", "", "text");+ request("text/plain", "%FE%FF%FE%FF", "\uFEFF", "text");+ request("text/plain", "%EF%BB%BF", "", "text");+ request("text/plain", "%EF%BB%BF%EF%BB%BF", "\uFEFF", "text");+ request("text/plain", "%C2", "\uFFFD", "text");+ request("text/plain;charset=bogus", "%C2", "\uFFFD", "text");+ request("text/xml", "%FE%FF", "", "text");+ request("text/xml", "%FE%FF%FE%FF", "\uFEFF", "text");+ request("text/xml", "%EF%BB%BF", "", "text");+ request("text/xml", "%EF%BB%BF%EF%BB%BF", "\uFEFF", "text");+ request("text/plain", "%E3%81%B2", "\u3072", "text");+ </script>+ </body>+</html>diff --git a/Tests/LibWeb/Text/input/wpt-import/xhr/send-usp.any.worker.html b/Tests/LibWeb/Text/input/wpt-import/xhr/send-usp.any.worker.htmlnew file mode 100644index 00000000000..76d3c555d71--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/xhr/send-usp.any.worker.html@@ -0,0 +1,9 @@+<!doctype html>+<meta charset=utf-8>++<script src="../resources/testharness.js"></script>+<script src="../resources/testharnessreport.js"></script>+<div id=log></div>+<script>+fetch_tests_from_worker(new Worker("../xhr/send-usp.any.worker.js"));+</script>diff --git a/Tests/LibWeb/Text/input/wpt-import/xhr/send-usp.any.worker.js b/Tests/LibWeb/Text/input/wpt-import/xhr/send-usp.any.worker.jsnew file mode 100644index 00000000000..b0861c5d4fd--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/xhr/send-usp.any.worker.js@@ -0,0 +1,10 @@++self.GLOBAL = {+ isWindow: function() { return false; },+ isWorker: function() { return true; },+ isShadowRealm: function() { return false; },+};+importScripts("/resources/testharness.js");++importScripts("/xhr/send-usp.any.js");+done();diff --git a/Tests/LibWeb/Text/input/wpt-import/xhr/setrequestheader-content-type.htm b/Tests/LibWeb/Text/input/wpt-import/xhr/setrequestheader-content-type.htmnew file mode 100644index 00000000000..47fb86124cf--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/xhr/setrequestheader-content-type.htm@@ -0,0 +1,241 @@+<!DOCTYPE html>+<html>+ <head>+ <title>XMLHttpRequest: setRequestHeader() - Content-Type header</title>+ <meta name="timeout" content="long">+ <script src="../resources/testharness.js"></script>+ <script src="../resources/testharnessreport.js"></script>+ <link rel="help" href="https://xhr.spec.whatwg.org/#the-setrequestheader()-method">+ </head>+ <body>+ <div id="log"></div>+ <script>+ function request(inputGenerator, headersToSend, expectedType, title) {+ test(function() {+ const toSend = inputGenerator(),+ client = new XMLHttpRequest()+ client.open("POST", "resources/inspect-headers.py?filter_name=Content-Type", false)+ for(header in headersToSend) {+ if (headersToSend.hasOwnProperty(header)) {+ client.setRequestHeader(header, headersToSend[header]);+ }+ }+ client.send(toSend)++ const actual = client.responseText+ if (expectedType === undefined || expectedType === null) {+ assert_equals(actual, "");+ } else if (expectedType instanceof RegExp) {+ assert_regexp_match(actual, expectedType);+ } else {+ assert_equals(actual, "Content-Type: " + expectedType + "\n");+ }+ }, title)+ }+ request(+ function _String() { return ""; },+ {"Content-Type": ""},+ "",+ 'setRequestHeader("") sends a blank string'+ )+ request(+ function _String() { return ""; },+ {"Content-Type": " "},+ "",+ 'setRequestHeader(" ") sends the string " "'+ )+ request(+ function _String() { return ""; },+ {"Content-Type": null},+ "null",+ 'setRequestHeader(null) sends the string "null"'+ )+ request(+ function _String() { return ""; },+ {"Content-Type": undefined},+ "undefined",+ 'setRequestHeader(undefined) sends the string "undefined"'+ )+ request(+ function _String() { return "test"; },+ {},+ "text/plain;charset=UTF-8",+ 'String request has correct default Content-Type of "text/plain;charset=UTF-8"'+ )+ request(+ function _String() { return "test()"; },+ {"Content-Type": "text/javascript;charset=ASCII"},+ "text/javascript;charset=UTF-8",+ "String request keeps setRequestHeader() Content-Type, with charset adjusted to UTF-8"+ )+ request(+ function _String() { return "test"; },+ {"Content-Type": "application/xml"},+ "application/xml",+ "String request keeps setRequestHeader() Content-Type without charset"+ )+ request(+ function _XMLDocument() { return new DOMParser().parseFromString("<xml/>", "application/xml"); },+ {"Content-Type": ""},+ "",+ 'XML Document request respects setRequestHeader("")'+ )+ request(+ function _XMLDocument() { return new DOMParser().parseFromString("<xml/>", "application/xml"); },+ {},+ "application/xml;charset=UTF-8",+ 'XML Document request has correct default Content-Type of "application/xml;charset=UTF-8"'+ )+ request(+ function _XMLDocument() { return new DOMParser().parseFromString("<xml/>", "application/xml"); },+ {"Content-Type": "application/xhtml+xml;charset=ASCII"},+ "application/xhtml+xml;charset=UTF-8",+ "XML Document request keeps setRequestHeader() Content-Type, with charset adjusted to UTF-8"+ )+ request(+ function _XMLDocument() { return new DOMParser().parseFromString("<xml/>", "application/xml"); },+ {"Content-Type": "application/xhtml+xml"},+ "application/xhtml+xml",+ "XML Document request keeps setRequestHeader() Content-Type without charset"+ )+ request(+ function _HTMLDocument() { return new DOMParser().parseFromString("<html></html>", "text/html"); },+ {"Content-Type": ""},+ "",+ 'HTML Document request respects setRequestHeader("")'+ )+ request(+ function _HTMLDocument() { return new DOMParser().parseFromString("<html></html>", "text/html"); },+ {},+ "text/html;charset=UTF-8",+ 'HTML Document request has correct default Content-Type of "text/html;charset=UTF-8"'+ )+ request(+ function _HTMLDocument() { return new DOMParser().parseFromString("<html></html>", "text/html"); },+ {"Content-Type": "text/html+junk;charset=ASCII"},+ "text/html+junk;charset=UTF-8",+ "HTML Document request keeps setRequestHeader() Content-Type, with charset adjusted to UTF-8"+ )+ request(+ function _HTMLDocument() { return new DOMParser().parseFromString("<html></html>", "text/html"); },+ {"Content-Type": "text/html+junk"},+ "text/html+junk",+ "HTML Document request keeps setRequestHeader() Content-Type without charset"+ )+ request(+ function _Blob() { return new Blob(["test"]); },+ {"Content-Type": ""},+ "",+ 'Blob request respects setRequestHeader("") to be specified'+ )+ request(+ function _Blob() { return new Blob(["test"]); },+ {},+ undefined,+ "Blob request with unset type sends no Content-Type without setRequestHeader() call"+ )+ request(+ function _Blob() { return new Blob(["test"]); },+ {"Content-Type": "application/xml;charset=ASCII"},+ "application/xml;charset=ASCII",+ "Blob request with unset type keeps setRequestHeader() Content-Type and charset"+ )+ request(+ function _Blob() { return new Blob(["<xml/>"], {type : "application/xml;charset=ASCII"}); },+ {"Content-Type": ""},+ "",+ 'Blob request with set type respects setRequestHeader("") to be specified'+ )+ request(+ function _Blob() { return new Blob(["<xml/>"], {type : "application/xml;charset=ASCII"}); },+ {},+ "application/xml;charset=ascii", // new Blob lowercases the type argument+ "Blob request with set type uses that it for Content-Type unless setRequestHeader()"+ )+ request(+ function _Blob() { return new Blob(["<xml/>"], {type : "application/xml;charset=UTF8"}); },+ {"Content-Type": "application/xml+junk;charset=ASCII"},+ "application/xml+junk;charset=ASCII",+ "Blob request with set type keeps setRequestHeader() Content-Type and charset"+ )+ request(+ function _ArrayBuffer() { return new ArrayBuffer(10); },+ {"Content-Type": ""},+ "",+ 'ArrayBuffer request respects setRequestHeader("")'+ )+ request(+ function _ArrayBuffer() { return new ArrayBuffer(10); },+ {},+ undefined,+ "ArrayBuffer request sends no Content-Type without setRequestHeader() call"+ )+ request(+ function _ArrayBuffer() { return new ArrayBuffer(10); },+ {"Content-Type": "application/xml;charset=ASCII"},+ "application/xml;charset=ASCII",+ "ArrayBuffer request keeps setRequestHeader() Content-Type and charset"+ )+ request(+ function _Uint8Array() { return new Uint8Array(new ArrayBuffer(10)); },+ {"Content-Type": ""},+ "",+ 'ArrayBufferView request respects setRequestHeader("")'+ )+ request(+ function _Uint8Array() { return new Uint8Array(new ArrayBuffer(10)); },+ {},+ undefined,+ "ArrayBufferView request sends no Content-Type without setRequestHeader() call"+ )+ request(+ function _Uint8Array() { return new Uint8Array(new ArrayBuffer(10)); },+ {"Content-Type": "application/xml;charset=ASCII"},+ "application/xml;charset=ASCII",+ "ArrayBufferView request keeps setRequestHeader() Content-Type and charset"+ )+ request(+ function _FormData() { return new FormData(); },+ {"Content-Type": ""},+ "",+ 'FormData request respects setRequestHeader("")'+ )+ request(+ function _FormData() { return new FormData(); },+ {},+ /multipart\/form-data; boundary=(.*)/,+ 'FormData request has correct default Content-Type of "multipart\/form-data; boundary=_"'+ )+ request(+ function _FormData() { return new FormData(); },+ {"Content-Type": "application/xml;charset=ASCII"},+ "application/xml;charset=ASCII",+ "FormData request keeps setRequestHeader() Content-Type and charset"+ )+ request(+ function _URLSearchParams() { return new URLSearchParams("q=testQ&topic=testTopic") },+ {"Content-Type": ""},+ "",+ 'URLSearchParams respects setRequestHeader("")'+ )+ request(+ function _URLSearchParams() { return new URLSearchParams("q=testQ&topic=testTopic") },+ {},+ "application/x-www-form-urlencoded;charset=UTF-8",+ 'URLSearchParams request has correct default Content-Type of "application/x-www-form-urlencoded;charset=UTF-8"'+ )+ request(+ function _URLSearchParams() { return new URLSearchParams("q=testQ&topic=testTopic") },+ {"Content-Type": "application/xml;charset=ASCII"},+ "application/xml;charset=UTF-8",+ "URLSearchParams request keeps setRequestHeader() Content-Type, with charset adjusted to UTF-8"+ )+ request(+ function _URLSearchParams() { return new URLSearchParams("q=testQ&topic=testTopic") },+ {"Content-Type": "application/xml"},+ "application/xml",+ "URLSearchParams request keeps setRequestHeader() Content-Type without charset"+ )+ </script>+ </body>+</html>diff --git a/Tests/LibWeb/Text/input/wpt-import/xhr/split-byte-order-mark.any.html b/Tests/LibWeb/Text/input/wpt-import/xhr/split-byte-order-mark.any.htmlnew file mode 100644index 00000000000..c5dd6d8b084--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/xhr/split-byte-order-mark.any.html@@ -0,0 +1,15 @@+<!doctype html>+<meta charset=utf-8>+<title>XMLHttpRequest: byte order marks split across chunks</title>+<script>+self.GLOBAL = {+ isWindow: function() { return true; },+ isWorker: function() { return false; },+ isShadowRealm: function() { return false; },+};+</script>+<script src="../resources/testharness.js"></script>+<script src="../resources/testharnessreport.js"></script>++<div id=log></div>+<script src="../xhr/split-byte-order-mark.any.js"></script>diff --git a/Tests/LibWeb/Text/input/wpt-import/xhr/split-byte-order-mark.any.js b/Tests/LibWeb/Text/input/wpt-import/xhr/split-byte-order-mark.any.jsnew file mode 100644index 00000000000..01b6c391f5c--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/xhr/split-byte-order-mark.any.js@@ -0,0 +1,34 @@+// META: title=XMLHttpRequest: byte order marks split across chunks++// content-in-chunks.py sends each hex-encoded chunk on its own, so these check+// that decoding carries over from one chunk to the next.+function load(t, responseType, chunks) {+ return new Promise(resolve => {+ const client = new XMLHttpRequest();+ client.responseType = responseType;+ client.open("GET", "resources/content-in-chunks.py?type=text/plain" ++ chunks.map(chunk => "&chunk=" + chunk).join(""));+ client.onload = t.step_func(() => resolve(client));+ client.send();+ });+}++promise_test(async t => {+ const client = await load(t, "", ["ef", "bbbf50"]);+ assert_equals(client.responseText, "P");+}, "responseText strips a UTF-8 byte order mark split across chunks");++promise_test(async t => {+ const client = await load(t, "", ["ff", "fe5000"]);+ assert_equals(client.responseText, "P");+}, "responseText uses a UTF-16LE byte order mark split across chunks");++promise_test(async t => {+ const client = await load(t, "", ["50", "efbbbf"]);+ assert_equals(client.responseText, "P\ufeff");+}, "responseText does not strip a UTF-8 byte order mark in a later chunk");++promise_test(async t => {+ const client = await load(t, "json", ["ef", "bbbf31"]);+ assert_equals(client.response, 1);+}, "JSON response strips a UTF-8 byte order mark split across chunks");diff --git a/Tests/LibWeb/Text/input/wpt-import/xhr/split-byte-order-mark.any.worker.html b/Tests/LibWeb/Text/input/wpt-import/xhr/split-byte-order-mark.any.worker.htmlnew file mode 100644index 00000000000..9de07721bf6--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/xhr/split-byte-order-mark.any.worker.html@@ -0,0 +1,9 @@+<!doctype html>+<meta charset=utf-8>+<title>XMLHttpRequest: byte order marks split across chunks</title>+<script src="../resources/testharness.js"></script>+<script src="../resources/testharnessreport.js"></script>+<div id=log></div>+<script>+fetch_tests_from_worker(new Worker("../xhr/split-byte-order-mark.any.worker.js"));+</script>diff --git a/Tests/LibWeb/Text/input/wpt-import/xhr/split-byte-order-mark.any.worker.js b/Tests/LibWeb/Text/input/wpt-import/xhr/split-byte-order-mark.any.worker.jsnew file mode 100644index 00000000000..1a3eed1fcf1--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/xhr/split-byte-order-mark.any.worker.js@@ -0,0 +1,10 @@++self.GLOBAL = {+ isWindow: function() { return false; },+ isWorker: function() { return true; },+ isShadowRealm: function() { return false; },+};+importScripts("/resources/testharness.js");+self.META_TITLE = "XMLHttpRequest: byte order marks split across chunks";+importScripts("/xhr/split-byte-order-mark.any.js");+done();