From 26a029d407be480d791972afb5975cf62c9360a6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 02:47:55 +0200 Subject: Adding upstream version 124.0.1. Signed-off-by: Daniel Baumann --- .../tests/fetch/orb/resources/data.json | 3 + .../tests/fetch/orb/resources/data_non_ascii.json | 1 + .../tests/fetch/orb/resources/empty.json | 1 + .../tests/fetch/orb/resources/font.ttf | Bin 0 -> 2528 bytes .../tests/fetch/orb/resources/image.png | Bin 0 -> 1010 bytes .../resources/js-unlabeled-utf16-without-bom.json | Bin 0 -> 70 bytes .../tests/fetch/orb/resources/js-unlabeled.js | 1 + .../fetch/orb/resources/png-mislabeled-as-html.png | Bin 0 -> 1010 bytes .../resources/png-mislabeled-as-html.png.headers | 1 + .../tests/fetch/orb/resources/png-unlabeled.png | Bin 0 -> 1010 bytes .../fetch/orb/resources/script-asm-js-invalid.js | 4 + .../fetch/orb/resources/script-asm-js-valid.js | 4 + .../tests/fetch/orb/resources/script-iso-8559-1.js | 4 + .../tests/fetch/orb/resources/script-utf16-bom.js | Bin 0 -> 92 bytes .../orb/resources/script-utf16-without-bom.js | Bin 0 -> 90 bytes .../tests/fetch/orb/resources/script.js | 4 + .../tests/fetch/orb/resources/sound.mp3 | Bin 0 -> 539 bytes .../tests/fetch/orb/resources/text.txt | 1 + .../tests/fetch/orb/resources/utils.js | 101 +++++++++++++++++ .../tentative/compressed-image-sniffing.sub.html | 20 ++++ .../fetch/orb/tentative/content-range.sub.any.js | 20 ++++ .../img-mime-types-coverage.tentative.sub.html | 126 +++++++++++++++++++++ .../img-png-mislabeled-as-html.sub-ref.html | 5 + .../tentative/img-png-mislabeled-as-html.sub.html | 7 ++ .../orb/tentative/img-png-unlabeled.sub-ref.html | 5 + .../fetch/orb/tentative/img-png-unlabeled.sub.html | 7 ++ .../fetch/orb/tentative/known-mime-type.sub.any.js | 99 ++++++++++++++++ .../tests/fetch/orb/tentative/nosniff.sub.any.js | 32 ++++++ .../tentative/script-js-unlabeled-gziped.sub.html | 24 ++++ .../fetch/orb/tentative/script-unlabeled.sub.html | 24 ++++ .../script-utf16-without-bom-hint-charset.sub.html | 22 ++++ .../tests/fetch/orb/tentative/status.sub.any.js | 16 +++ .../tests/fetch/orb/tentative/status.sub.html | 17 +++ .../orb/tentative/unknown-mime-type.sub.any.js | 40 +++++++ 34 files changed, 589 insertions(+) create mode 100644 testing/web-platform/tests/fetch/orb/resources/data.json create mode 100644 testing/web-platform/tests/fetch/orb/resources/data_non_ascii.json create mode 100644 testing/web-platform/tests/fetch/orb/resources/empty.json create mode 100644 testing/web-platform/tests/fetch/orb/resources/font.ttf create mode 100644 testing/web-platform/tests/fetch/orb/resources/image.png create mode 100644 testing/web-platform/tests/fetch/orb/resources/js-unlabeled-utf16-without-bom.json create mode 100644 testing/web-platform/tests/fetch/orb/resources/js-unlabeled.js create mode 100644 testing/web-platform/tests/fetch/orb/resources/png-mislabeled-as-html.png create mode 100644 testing/web-platform/tests/fetch/orb/resources/png-mislabeled-as-html.png.headers create mode 100644 testing/web-platform/tests/fetch/orb/resources/png-unlabeled.png create mode 100644 testing/web-platform/tests/fetch/orb/resources/script-asm-js-invalid.js create mode 100644 testing/web-platform/tests/fetch/orb/resources/script-asm-js-valid.js create mode 100644 testing/web-platform/tests/fetch/orb/resources/script-iso-8559-1.js create mode 100644 testing/web-platform/tests/fetch/orb/resources/script-utf16-bom.js create mode 100644 testing/web-platform/tests/fetch/orb/resources/script-utf16-without-bom.js create mode 100644 testing/web-platform/tests/fetch/orb/resources/script.js create mode 100644 testing/web-platform/tests/fetch/orb/resources/sound.mp3 create mode 100644 testing/web-platform/tests/fetch/orb/resources/text.txt create mode 100644 testing/web-platform/tests/fetch/orb/resources/utils.js create mode 100644 testing/web-platform/tests/fetch/orb/tentative/compressed-image-sniffing.sub.html create mode 100644 testing/web-platform/tests/fetch/orb/tentative/content-range.sub.any.js create mode 100644 testing/web-platform/tests/fetch/orb/tentative/img-mime-types-coverage.tentative.sub.html create mode 100644 testing/web-platform/tests/fetch/orb/tentative/img-png-mislabeled-as-html.sub-ref.html create mode 100644 testing/web-platform/tests/fetch/orb/tentative/img-png-mislabeled-as-html.sub.html create mode 100644 testing/web-platform/tests/fetch/orb/tentative/img-png-unlabeled.sub-ref.html create mode 100644 testing/web-platform/tests/fetch/orb/tentative/img-png-unlabeled.sub.html create mode 100644 testing/web-platform/tests/fetch/orb/tentative/known-mime-type.sub.any.js create mode 100644 testing/web-platform/tests/fetch/orb/tentative/nosniff.sub.any.js create mode 100644 testing/web-platform/tests/fetch/orb/tentative/script-js-unlabeled-gziped.sub.html create mode 100644 testing/web-platform/tests/fetch/orb/tentative/script-unlabeled.sub.html create mode 100644 testing/web-platform/tests/fetch/orb/tentative/script-utf16-without-bom-hint-charset.sub.html create mode 100644 testing/web-platform/tests/fetch/orb/tentative/status.sub.any.js create mode 100644 testing/web-platform/tests/fetch/orb/tentative/status.sub.html create mode 100644 testing/web-platform/tests/fetch/orb/tentative/unknown-mime-type.sub.any.js (limited to 'testing/web-platform/tests/fetch/orb') diff --git a/testing/web-platform/tests/fetch/orb/resources/data.json b/testing/web-platform/tests/fetch/orb/resources/data.json new file mode 100644 index 0000000000..f2a886f39d --- /dev/null +++ b/testing/web-platform/tests/fetch/orb/resources/data.json @@ -0,0 +1,3 @@ +{ + "hello": "world" +} diff --git a/testing/web-platform/tests/fetch/orb/resources/data_non_ascii.json b/testing/web-platform/tests/fetch/orb/resources/data_non_ascii.json new file mode 100644 index 0000000000..64566c50c1 --- /dev/null +++ b/testing/web-platform/tests/fetch/orb/resources/data_non_ascii.json @@ -0,0 +1 @@ +["你好"] diff --git a/testing/web-platform/tests/fetch/orb/resources/empty.json b/testing/web-platform/tests/fetch/orb/resources/empty.json new file mode 100644 index 0000000000..0967ef424b --- /dev/null +++ b/testing/web-platform/tests/fetch/orb/resources/empty.json @@ -0,0 +1 @@ +{} diff --git a/testing/web-platform/tests/fetch/orb/resources/font.ttf b/testing/web-platform/tests/fetch/orb/resources/font.ttf new file mode 100644 index 0000000000..9023592ef5 Binary files /dev/null and b/testing/web-platform/tests/fetch/orb/resources/font.ttf differ diff --git a/testing/web-platform/tests/fetch/orb/resources/image.png b/testing/web-platform/tests/fetch/orb/resources/image.png new file mode 100644 index 0000000000..820f8cace2 Binary files /dev/null and b/testing/web-platform/tests/fetch/orb/resources/image.png differ diff --git a/testing/web-platform/tests/fetch/orb/resources/js-unlabeled-utf16-without-bom.json b/testing/web-platform/tests/fetch/orb/resources/js-unlabeled-utf16-without-bom.json new file mode 100644 index 0000000000..157a8f5430 Binary files /dev/null and b/testing/web-platform/tests/fetch/orb/resources/js-unlabeled-utf16-without-bom.json differ diff --git a/testing/web-platform/tests/fetch/orb/resources/js-unlabeled.js b/testing/web-platform/tests/fetch/orb/resources/js-unlabeled.js new file mode 100644 index 0000000000..a880a5bc72 --- /dev/null +++ b/testing/web-platform/tests/fetch/orb/resources/js-unlabeled.js @@ -0,0 +1 @@ +window.has_executed_script = true; diff --git a/testing/web-platform/tests/fetch/orb/resources/png-mislabeled-as-html.png b/testing/web-platform/tests/fetch/orb/resources/png-mislabeled-as-html.png new file mode 100644 index 0000000000..820f8cace2 Binary files /dev/null and b/testing/web-platform/tests/fetch/orb/resources/png-mislabeled-as-html.png differ diff --git a/testing/web-platform/tests/fetch/orb/resources/png-mislabeled-as-html.png.headers b/testing/web-platform/tests/fetch/orb/resources/png-mislabeled-as-html.png.headers new file mode 100644 index 0000000000..156209f9c8 --- /dev/null +++ b/testing/web-platform/tests/fetch/orb/resources/png-mislabeled-as-html.png.headers @@ -0,0 +1 @@ +Content-Type: text/html diff --git a/testing/web-platform/tests/fetch/orb/resources/png-unlabeled.png b/testing/web-platform/tests/fetch/orb/resources/png-unlabeled.png new file mode 100644 index 0000000000..820f8cace2 Binary files /dev/null and b/testing/web-platform/tests/fetch/orb/resources/png-unlabeled.png differ diff --git a/testing/web-platform/tests/fetch/orb/resources/script-asm-js-invalid.js b/testing/web-platform/tests/fetch/orb/resources/script-asm-js-invalid.js new file mode 100644 index 0000000000..8d1bbd6abc --- /dev/null +++ b/testing/web-platform/tests/fetch/orb/resources/script-asm-js-invalid.js @@ -0,0 +1,4 @@ +function f() { + "use asm"; + return; +} diff --git a/testing/web-platform/tests/fetch/orb/resources/script-asm-js-valid.js b/testing/web-platform/tests/fetch/orb/resources/script-asm-js-valid.js new file mode 100644 index 0000000000..79b375fe05 --- /dev/null +++ b/testing/web-platform/tests/fetch/orb/resources/script-asm-js-valid.js @@ -0,0 +1,4 @@ +function f() { + "use asm"; + return {}; +} diff --git a/testing/web-platform/tests/fetch/orb/resources/script-iso-8559-1.js b/testing/web-platform/tests/fetch/orb/resources/script-iso-8559-1.js new file mode 100644 index 0000000000..3bccb6af93 --- /dev/null +++ b/testing/web-platform/tests/fetch/orb/resources/script-iso-8559-1.js @@ -0,0 +1,4 @@ +"use strict"; +function fn() { + return "§A¦n"; +} diff --git a/testing/web-platform/tests/fetch/orb/resources/script-utf16-bom.js b/testing/web-platform/tests/fetch/orb/resources/script-utf16-bom.js new file mode 100644 index 0000000000..16b76e9d5e Binary files /dev/null and b/testing/web-platform/tests/fetch/orb/resources/script-utf16-bom.js differ diff --git a/testing/web-platform/tests/fetch/orb/resources/script-utf16-without-bom.js b/testing/web-platform/tests/fetch/orb/resources/script-utf16-without-bom.js new file mode 100644 index 0000000000..d983086b03 Binary files /dev/null and b/testing/web-platform/tests/fetch/orb/resources/script-utf16-without-bom.js differ diff --git a/testing/web-platform/tests/fetch/orb/resources/script.js b/testing/web-platform/tests/fetch/orb/resources/script.js new file mode 100644 index 0000000000..19675d25d8 --- /dev/null +++ b/testing/web-platform/tests/fetch/orb/resources/script.js @@ -0,0 +1,4 @@ +"use strict"; +function fn() { + return 42; +} diff --git a/testing/web-platform/tests/fetch/orb/resources/sound.mp3 b/testing/web-platform/tests/fetch/orb/resources/sound.mp3 new file mode 100644 index 0000000000..a15d1de328 Binary files /dev/null and b/testing/web-platform/tests/fetch/orb/resources/sound.mp3 differ diff --git a/testing/web-platform/tests/fetch/orb/resources/text.txt b/testing/web-platform/tests/fetch/orb/resources/text.txt new file mode 100644 index 0000000000..270c611ee7 --- /dev/null +++ b/testing/web-platform/tests/fetch/orb/resources/text.txt @@ -0,0 +1 @@ +hello, world! diff --git a/testing/web-platform/tests/fetch/orb/resources/utils.js b/testing/web-platform/tests/fetch/orb/resources/utils.js new file mode 100644 index 0000000000..45fbc4cb38 --- /dev/null +++ b/testing/web-platform/tests/fetch/orb/resources/utils.js @@ -0,0 +1,101 @@ +function header(name, value) { + return `header(${name},${value})`; +} + +function contentType(type) { + return header("Content-Type", type); +} + +function contentTypeOptions(type) { + return header("X-Content-Type-Options", type); +} + +function testFetchNoCors(_t, path, { headers }) { + return fetch(path, { + ...(headers ? { headers } : {}), + mode: "no-cors", + }); +} + +function testElementInitiator(t, path, name) { + let element = document.createElement(name); + element.src = path; + t.add_cleanup(() => element.remove()); + return new Promise((resolve, reject) => { + element.onerror = e => reject(new TypeError()); + element.onload = resolve; + + document.body.appendChild(element); + }); +} + +function testImageInitiator(t, path) { + return testElementInitiator(t, path, "img"); +} + +function testAudioInitiator(t, path) { + return testElementInitiator(t, path, "audio"); +} + +function testVideoInitiator(t, path) { + return testElementInitiator(t, path, "video"); +} + +function testScriptInitiator(t, path) { + return testElementInitiator(t, path, "script"); +} + +function runTest(t, test, file, options, ...pipe) { + const path = `${file}${pipe.length ? `?pipe=${pipe.join("|")}` : ""}`; + return test(t, path, options) +} + +function testRunAll(file, testCallback, adapter, options) { + let testcase = function (test, message, skip) { + return {test, message, skip}; + }; + + const name = "..."; + [ testcase(testFetchNoCors, `fetch(${name}, {mode: "no-cors"})`, false || options.skip.includes("fetch")), + testcase(testImageInitiator, ``, options.onlyFetch || options.skip.includes("image")), + testcase(testAudioInitiator, `