diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /testing/web-platform/tests/FileAPI/file | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/FileAPI/file')
15 files changed, 1170 insertions, 0 deletions
diff --git a/testing/web-platform/tests/FileAPI/file/File-constructor-endings.html b/testing/web-platform/tests/FileAPI/file/File-constructor-endings.html new file mode 100644 index 0000000000..1282b6c5ac --- /dev/null +++ b/testing/web-platform/tests/FileAPI/file/File-constructor-endings.html @@ -0,0 +1,104 @@ +<!DOCTYPE html> +<meta charset=utf-8> +<title>File constructor: endings option</title> +<link rel=help href="https://w3c.github.io/FileAPI/#file-constructor"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script> + +// Windows platforms use CRLF as the native line ending. All others use LF. +const crlf = navigator.platform.startsWith('Win'); +const native_ending = crlf ? '\r\n' : '\n'; + +function readBlobAsPromise(blob) { + return new Promise((resolve, reject) => { + const reader = new FileReader(); + reader.readAsText(blob); + reader.onload = e => resolve(reader.result); + reader.onerror = e => reject(reader.error); + }); +} + +[ + 'transparent', + 'native' +].forEach(value => test(t => { + assert_class_string(new File([], "name", {endings: value}), 'File', + `Constructor should allow "${value}" endings`); +}, `Valid "endings" value: ${JSON.stringify(value)}`)); + +[ + null, + '', + 'invalidEnumValue', + 'Transparent', + 'NATIVE', + 0, + {} +].forEach(value => test(t => { + assert_throws_js(TypeError, () => new File([], "name", {endings: value}), + 'File constructor should throw'); +}, `Invalid "endings" value: ${JSON.stringify(value)}`)); + +test(t => { + const test_error = {name: 'test'}; + assert_throws_exactly( + test_error, + () => new File([], "name", { get endings() { throw test_error; }}), + 'File constructor should propagate exceptions from "endings" property'); +}, 'Exception propagation from options'); + +test(t => { + let got = false; + new File([], "name", { get endings() { got = true; } }); + assert_true(got, 'The "endings" property was accessed during construction.'); +}, 'The "endings" options property is used'); + +[ + {name: 'LF', input: '\n', native: native_ending}, + {name: 'CR', input: '\r', native: native_ending}, + + {name: 'CRLF', input: '\r\n', native: native_ending}, + {name: 'CRCR', input: '\r\r', native: native_ending.repeat(2)}, + {name: 'LFCR', input: '\n\r', native: native_ending.repeat(2)}, + {name: 'LFLF', input: '\n\n', native: native_ending.repeat(2)}, + + {name: 'CRCRLF', input: '\r\r\n', native: native_ending.repeat(2)}, + {name: 'CRLFLF', input: '\r\n\n', native: native_ending.repeat(2)}, + {name: 'CRLFCR', input: '\r\n\r\n', native: native_ending.repeat(2)}, + + {name: 'CRLFCRLF', input: '\r\n\r\n', native: native_ending.repeat(2)}, + {name: 'LFCRLFCR', input: '\n\r\n\r', native: native_ending.repeat(3)}, + +].forEach(testCase => { + promise_test(async t => { + const file = new File([testCase.input], "name"); + assert_equals( + await readBlobAsPromise(file), testCase.input, + 'Newlines should not change with endings unspecified'); + }, `Input ${testCase.name} with endings unspecified`); + + promise_test(async t => { + const file = new File([testCase.input], "name", {endings: 'transparent'}); + assert_equals( + await readBlobAsPromise(file), testCase.input, + 'Newlines should not change with endings "transparent"'); + }, `Input ${testCase.name} with endings 'transparent'`); + + promise_test(async t => { + const file = new File([testCase.input], "name", {endings: 'native'}); + assert_equals( + await readBlobAsPromise(file), testCase.native, + 'Newlines should match the platform with endings "native"'); + }, `Input ${testCase.name} with endings 'native'`); +}); + +promise_test(async t => { + const file = new File(['\r', '\n'], "name", {endings: 'native'}); + const expected = native_ending.repeat(2); + assert_equals( + await readBlobAsPromise(file), expected, + 'CR/LF in adjacent strings should be converted to two platform newlines'); +}, `CR/LF in adjacent input strings`); + +</script> diff --git a/testing/web-platform/tests/FileAPI/file/File-constructor.any.js b/testing/web-platform/tests/FileAPI/file/File-constructor.any.js new file mode 100644 index 0000000000..0b0185c40b --- /dev/null +++ b/testing/web-platform/tests/FileAPI/file/File-constructor.any.js @@ -0,0 +1,155 @@ +// META: title=File constructor + +const to_string_obj = { toString: () => 'a string' }; +const to_string_throws = { toString: () => { throw new Error('expected'); } }; + +test(function() { + assert_true("File" in globalThis, "globalThis should have a File property."); +}, "File interface object exists"); + +test(t => { + assert_throws_js(TypeError, () => new File(), + 'Bits argument is required'); + assert_throws_js(TypeError, () => new File([]), + 'Name argument is required'); +}, 'Required arguments'); + +function test_first_argument(arg1, expectedSize, testName) { + test(function() { + var file = new File(arg1, "dummy"); + assert_true(file instanceof File); + assert_equals(file.name, "dummy"); + assert_equals(file.size, expectedSize); + assert_equals(file.type, ""); + // assert_false(file.isClosed); XXX: File.isClosed doesn't seem to be implemented + assert_not_equals(file.lastModified, ""); + }, testName); +} + +test_first_argument([], 0, "empty fileBits"); +test_first_argument(["bits"], 4, "DOMString fileBits"); +test_first_argument(["๐ฝ๐ฎ๐๐ฝ"], 16, "Unicode DOMString fileBits"); +test_first_argument([new String('string object')], 13, "String object fileBits"); +test_first_argument([new Blob()], 0, "Empty Blob fileBits"); +test_first_argument([new Blob(["bits"])], 4, "Blob fileBits"); +test_first_argument([new File([], 'world.txt')], 0, "Empty File fileBits"); +test_first_argument([new File(["bits"], 'world.txt')], 4, "File fileBits"); +test_first_argument([new ArrayBuffer(8)], 8, "ArrayBuffer fileBits"); +test_first_argument([new Uint8Array([0x50, 0x41, 0x53, 0x53])], 4, "Typed array fileBits"); +test_first_argument(["bits", new Blob(["bits"]), new Blob(), new Uint8Array([0x50, 0x41]), + new Uint16Array([0x5353]), new Uint32Array([0x53534150])], 16, "Various fileBits"); +test_first_argument([12], 2, "Number in fileBits"); +test_first_argument([[1,2,3]], 5, "Array in fileBits"); +test_first_argument([{}], 15, "Object in fileBits"); // "[object Object]" +if (globalThis.document !== undefined) { + test_first_argument([document.body], 24, "HTMLBodyElement in fileBits"); // "[object HTMLBodyElement]" +} +test_first_argument([to_string_obj], 8, "Object with toString in fileBits"); +test_first_argument({[Symbol.iterator]() { + let i = 0; + return {next: () => [ + {done:false, value:'ab'}, + {done:false, value:'cde'}, + {done:true} + ][i++]}; +}}, 5, 'Custom @@iterator'); + +[ + 'hello', + 0, + null +].forEach(arg => { + test(t => { + assert_throws_js(TypeError, () => new File(arg, 'world.html'), + 'Constructor should throw for invalid bits argument'); + }, `Invalid bits argument: ${JSON.stringify(arg)}`); +}); + +test(t => { + assert_throws_js(Error, () => new File([to_string_throws], 'name.txt'), + 'Constructor should propagate exceptions'); +}, 'Bits argument: object that throws'); + + +function test_second_argument(arg2, expectedFileName, testName) { + test(function() { + var file = new File(["bits"], arg2); + assert_true(file instanceof File); + assert_equals(file.name, expectedFileName); + }, testName); +} + +test_second_argument("dummy", "dummy", "Using fileName"); +test_second_argument("dummy/foo", "dummy/foo", + "No replacement when using special character in fileName"); +test_second_argument(null, "null", "Using null fileName"); +test_second_argument(1, "1", "Using number fileName"); +test_second_argument('', '', "Using empty string fileName"); +if (globalThis.document !== undefined) { + test_second_argument(document.body, '[object HTMLBodyElement]', "Using object fileName"); +} + +// testing the third argument +[ + {type: 'text/plain', expected: 'text/plain'}, + {type: 'text/plain;charset=UTF-8', expected: 'text/plain;charset=utf-8'}, + {type: 'TEXT/PLAIN', expected: 'text/plain'}, + {type: '๐ฝ๐ฎ๐๐ฝ/๐ญ๐ฉ๐๐ฆ๐ซ', expected: ''}, + {type: 'ascii/nonprintable\u001F', expected: ''}, + {type: 'ascii/nonprintable\u007F', expected: ''}, + {type: 'nonascii\u00EE', expected: ''}, + {type: 'nonascii\u1234', expected: ''}, + {type: 'nonparsable', expected: 'nonparsable'} +].forEach(testCase => { + test(t => { + var file = new File(["bits"], "dummy", { type: testCase.type}); + assert_true(file instanceof File); + assert_equals(file.type, testCase.expected); + }, `Using type in File constructor: ${testCase.type}`); +}); +test(function() { + var file = new File(["bits"], "dummy", { lastModified: 42 }); + assert_true(file instanceof File); + assert_equals(file.lastModified, 42); +}, "Using lastModified"); +test(function() { + var file = new File(["bits"], "dummy", { name: "foo" }); + assert_true(file instanceof File); + assert_equals(file.name, "dummy"); +}, "Misusing name"); +test(function() { + var file = new File(["bits"], "dummy", { unknownKey: "value" }); + assert_true(file instanceof File); + assert_equals(file.name, "dummy"); +}, "Unknown properties are ignored"); + +[ + 123, + 123.4, + true, + 'abc' +].forEach(arg => { + test(t => { + assert_throws_js(TypeError, () => new File(['bits'], 'name.txt', arg), + 'Constructor should throw for invalid property bag type'); + }, `Invalid property bag: ${JSON.stringify(arg)}`); +}); + +[ + null, + undefined, + [1,2,3], + /regex/, + function() {} +].forEach(arg => { + test(t => { + assert_equals(new File(['bits'], 'name.txt', arg).size, 4, + 'Constructor should accept object-ish property bag type'); + }, `Unusual but valid property bag: ${arg}`); +}); + +test(t => { + assert_throws_js(Error, + () => new File(['bits'], 'name.txt', {type: to_string_throws}), + 'Constructor should propagate exceptions'); +}, 'Property bag propagates exceptions'); diff --git a/testing/web-platform/tests/FileAPI/file/Worker-read-file-constructor.worker.js b/testing/web-platform/tests/FileAPI/file/Worker-read-file-constructor.worker.js new file mode 100644 index 0000000000..4e003b3c95 --- /dev/null +++ b/testing/web-platform/tests/FileAPI/file/Worker-read-file-constructor.worker.js @@ -0,0 +1,15 @@ +importScripts("/resources/testharness.js"); + +async_test(function() { + var file = new File(["bits"], "dummy", { 'type': 'text/plain', lastModified: 42 }); + var reader = new FileReader(); + reader.onload = this.step_func_done(function() { + assert_equals(file.name, "dummy", "file name"); + assert_equals(reader.result, "bits", "file content"); + assert_equals(file.lastModified, 42, "file lastModified"); + }); + reader.onerror = this.unreached_func("Unexpected error event"); + reader.readAsText(file); +}, "FileReader in Worker"); + +done(); diff --git a/testing/web-platform/tests/FileAPI/file/resources/echo-content-escaped.py b/testing/web-platform/tests/FileAPI/file/resources/echo-content-escaped.py new file mode 100644 index 0000000000..5370e1e46a --- /dev/null +++ b/testing/web-platform/tests/FileAPI/file/resources/echo-content-escaped.py @@ -0,0 +1,26 @@ +from wptserve.utils import isomorphic_encode + +# Outputs the request body, with controls and non-ASCII bytes escaped +# (b"\n" becomes b"\\x0a"), and with backslashes doubled. +# As a convenience, CRLF newlines are left as is. + +def escape_byte(byte): + # Convert int byte into a single-char binary string. + byte = bytes([byte]) + if b"\0" <= byte <= b"\x1F" or byte >= b"\x7F": + return b"\\x%02x" % ord(byte) + if byte == b"\\": + return b"\\\\" + return byte + +def main(request, response): + + headers = [(b"X-Request-Method", isomorphic_encode(request.method)), + (b"X-Request-Content-Length", request.headers.get(b"Content-Length", b"NO")), + (b"X-Request-Content-Type", request.headers.get(b"Content-Type", b"NO")), + # Avoid any kind of content sniffing on the response. + (b"Content-Type", b"text/plain; charset=UTF-8")] + + content = b"".join(map(escape_byte, request.body)).replace(b"\\x0d\\x0a", b"\r\n") + + return headers, content diff --git a/testing/web-platform/tests/FileAPI/file/send-file-form-controls.html b/testing/web-platform/tests/FileAPI/file/send-file-form-controls.html new file mode 100644 index 0000000000..6347065bca --- /dev/null +++ b/testing/web-platform/tests/FileAPI/file/send-file-form-controls.html @@ -0,0 +1,113 @@ +<!DOCTYPE html> +<meta charset="utf-8" /> +<title>Upload files named using controls</title> +<link + rel="help" + href="https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#multipart-form-data" +/> +<link + rel="help" + href="https://html.spec.whatwg.org/multipage/dnd.html#datatransferitemlist" +/> +<link rel="help" href="https://w3c.github.io/FileAPI/#file-constructor" /> +<link + rel="author" + title="Benjamin C. Wiley Sittler" + href="mailto:bsittler@chromium.org" +/> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="../support/send-file-form-helper.js"></script> +<script> + "use strict"; + + formPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-NUL-[\0].txt", + formEncoding: "UTF-8", + expectedEncodedBaseName: "file-for-upload-in-form-NUL-[\0].txt", + }); + + formPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-BS-[\b].txt", + formEncoding: "UTF-8", + expectedEncodedBaseName: "file-for-upload-in-form-BS-[\b].txt", + }); + + formPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-VT-[\v].txt", + formEncoding: "UTF-8", + expectedEncodedBaseName: "file-for-upload-in-form-VT-[\v].txt", + }); + + // These have characters that undergo processing in name=, + // filename=, and/or value; formPostFileUploadTest postprocesses + // expectedEncodedBaseName for these internally. + + formPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-LF-[\n].txt", + formEncoding: "UTF-8", + expectedEncodedBaseName: "file-for-upload-in-form-LF-[\n].txt", + }); + + formPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-LF-CR-[\n\r].txt", + formEncoding: "UTF-8", + expectedEncodedBaseName: "file-for-upload-in-form-LF-CR-[\n\r].txt", + }); + + formPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-CR-[\r].txt", + formEncoding: "UTF-8", + expectedEncodedBaseName: "file-for-upload-in-form-CR-[\r].txt", + }); + + formPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-CR-LF-[\r\n].txt", + formEncoding: "UTF-8", + expectedEncodedBaseName: "file-for-upload-in-form-CR-LF-[\r\n].txt", + }); + + formPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-HT-[\t].txt", + formEncoding: "UTF-8", + expectedEncodedBaseName: "file-for-upload-in-form-HT-[\t].txt", + }); + + formPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-FF-[\f].txt", + formEncoding: "UTF-8", + expectedEncodedBaseName: "file-for-upload-in-form-FF-[\f].txt", + }); + + formPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-DEL-[\x7F].txt", + formEncoding: "UTF-8", + expectedEncodedBaseName: "file-for-upload-in-form-DEL-[\x7F].txt", + }); + + // The rest should be passed through unmodified: + + formPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-ESC-[\x1B].txt", + formEncoding: "UTF-8", + expectedEncodedBaseName: "file-for-upload-in-form-ESC-[\x1B].txt", + }); + + formPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-SPACE-[ ].txt", + formEncoding: "UTF-8", + expectedEncodedBaseName: "file-for-upload-in-form-SPACE-[ ].txt", + }); +</script> diff --git a/testing/web-platform/tests/FileAPI/file/send-file-form-iso-2022-jp.html b/testing/web-platform/tests/FileAPI/file/send-file-form-iso-2022-jp.html new file mode 100644 index 0000000000..c931c9be3a --- /dev/null +++ b/testing/web-platform/tests/FileAPI/file/send-file-form-iso-2022-jp.html @@ -0,0 +1,65 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<meta name=timeout content=long> +<title>Upload files in ISO-2022-JP form</title> +<link rel="help" + href="https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#multipart-form-data"> +<link rel="help" + href="https://html.spec.whatwg.org/multipage/dnd.html#datatransferitemlist"> +<link rel="help" + href="https://w3c.github.io/FileAPI/#file-constructor"> +<link rel="author" title="Benjamin C. Wiley Sittler" + href="mailto:bsittler@chromium.org"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="../support/send-file-form-helper.js"></script> +<script> +'use strict'; + +formPostFileUploadTest({ + fileNameSource: 'ASCII', + fileBaseName: 'file-for-upload-in-form.txt', + formEncoding: 'ISO-2022-JP', + expectedEncodedBaseName: 'file-for-upload-in-form.txt', +}); + +formPostFileUploadTest({ + fileNameSource: 'x-user-defined', + fileBaseName: 'file-for-upload-in-form-\uF7F0\uF793\uF783\uF7A0.txt', + formEncoding: 'ISO-2022-JP', + expectedEncodedBaseName: ( + 'file-for-upload-in-form-.txt'), +}); + +formPostFileUploadTest({ + fileNameSource: 'windows-1252', + fileBaseName: 'file-for-upload-in-form-รขหยบรฐลธหโ.txt', + formEncoding: 'ISO-2022-JP', + expectedEncodedBaseName: ( + 'file-for-upload-in-form-☺😂.txt'), +}); + +formPostFileUploadTest({ + fileNameSource: 'JIS X 0201 and JIS X 0208', + fileBaseName: 'file-for-upload-in-form-โ
ๆโ
.txt', + formEncoding: 'ISO-2022-JP', + expectedEncodedBaseName: 'file-for-upload-in-form-\x1B$B!z@1!z\x1B(B.txt', +}); + +formPostFileUploadTest({ + fileNameSource: 'Unicode', + fileBaseName: 'file-for-upload-in-form-โบ๐.txt', + formEncoding: 'ISO-2022-JP', + expectedEncodedBaseName: 'file-for-upload-in-form-☺😂.txt', +}); + +formPostFileUploadTest({ + fileNameSource: 'Unicode', + fileBaseName: `file-for-upload-in-form-${kTestChars}.txt`, + formEncoding: 'ISO-2022-JP', + expectedEncodedBaseName: `file-for-upload-in-form-${ + kTestFallbackIso2022jp + }.txt`, +}); + +</script> diff --git a/testing/web-platform/tests/FileAPI/file/send-file-form-punctuation.html b/testing/web-platform/tests/FileAPI/file/send-file-form-punctuation.html new file mode 100644 index 0000000000..a6568e2e56 --- /dev/null +++ b/testing/web-platform/tests/FileAPI/file/send-file-form-punctuation.html @@ -0,0 +1,226 @@ +<!DOCTYPE html> +<meta charset="utf-8" /> +<title>Upload files named using punctuation</title> +<link + rel="help" + href="https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#multipart-form-data" +/> +<link + rel="help" + href="https://html.spec.whatwg.org/multipage/dnd.html#datatransferitemlist" +/> +<link rel="help" href="https://w3c.github.io/FileAPI/#file-constructor" /> +<link + rel="author" + title="Benjamin C. Wiley Sittler" + href="mailto:bsittler@chromium.org" +/> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="../support/send-file-form-helper.js"></script> +<script> + "use strict"; + + // These have characters that undergo processing in name=, + // filename=, and/or value; formPostFileUploadTest postprocesses + // expectedEncodedBaseName for these internally. + + formPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-QUOTATION-MARK-[\x22].txt", + formEncoding: "UTF-8", + expectedEncodedBaseName: + "file-for-upload-in-form-QUOTATION-MARK-[\x22].txt", + }); + + formPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: '"file-for-upload-in-form-double-quoted.txt"', + formEncoding: "UTF-8", + expectedEncodedBaseName: '"file-for-upload-in-form-double-quoted.txt"', + }); + + formPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-REVERSE-SOLIDUS-[\\].txt", + formEncoding: "UTF-8", + expectedEncodedBaseName: + "file-for-upload-in-form-REVERSE-SOLIDUS-[\\].txt", + }); + + // The rest should be passed through unmodified: + + formPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-EXCLAMATION-MARK-[!].txt", + formEncoding: "UTF-8", + expectedEncodedBaseName: "file-for-upload-in-form-EXCLAMATION-MARK-[!].txt", + }); + + formPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-DOLLAR-SIGN-[$].txt", + formEncoding: "UTF-8", + expectedEncodedBaseName: "file-for-upload-in-form-DOLLAR-SIGN-[$].txt", + }); + + formPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-PERCENT-SIGN-[%].txt", + formEncoding: "UTF-8", + expectedEncodedBaseName: "file-for-upload-in-form-PERCENT-SIGN-[%].txt", + }); + + formPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-AMPERSAND-[&].txt", + formEncoding: "UTF-8", + expectedEncodedBaseName: "file-for-upload-in-form-AMPERSAND-[&].txt", + }); + + formPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-APOSTROPHE-['].txt", + formEncoding: "UTF-8", + expectedEncodedBaseName: "file-for-upload-in-form-APOSTROPHE-['].txt", + }); + + formPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-LEFT-PARENTHESIS-[(].txt", + formEncoding: "UTF-8", + expectedEncodedBaseName: "file-for-upload-in-form-LEFT-PARENTHESIS-[(].txt", + }); + + formPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-RIGHT-PARENTHESIS-[)].txt", + formEncoding: "UTF-8", + expectedEncodedBaseName: + "file-for-upload-in-form-RIGHT-PARENTHESIS-[)].txt", + }); + + formPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-ASTERISK-[*].txt", + formEncoding: "UTF-8", + expectedEncodedBaseName: "file-for-upload-in-form-ASTERISK-[*].txt", + }); + + formPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-PLUS-SIGN-[+].txt", + formEncoding: "UTF-8", + expectedEncodedBaseName: "file-for-upload-in-form-PLUS-SIGN-[+].txt", + }); + + formPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-COMMA-[,].txt", + formEncoding: "UTF-8", + expectedEncodedBaseName: "file-for-upload-in-form-COMMA-[,].txt", + }); + + formPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-FULL-STOP-[.].txt", + formEncoding: "UTF-8", + expectedEncodedBaseName: "file-for-upload-in-form-FULL-STOP-[.].txt", + }); + + formPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-SOLIDUS-[/].txt", + formEncoding: "UTF-8", + expectedEncodedBaseName: "file-for-upload-in-form-SOLIDUS-[/].txt", + }); + + formPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-COLON-[:].txt", + formEncoding: "UTF-8", + expectedEncodedBaseName: "file-for-upload-in-form-COLON-[:].txt", + }); + + formPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-SEMICOLON-[;].txt", + formEncoding: "UTF-8", + expectedEncodedBaseName: "file-for-upload-in-form-SEMICOLON-[;].txt", + }); + + formPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-EQUALS-SIGN-[=].txt", + formEncoding: "UTF-8", + expectedEncodedBaseName: "file-for-upload-in-form-EQUALS-SIGN-[=].txt", + }); + + formPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-QUESTION-MARK-[?].txt", + formEncoding: "UTF-8", + expectedEncodedBaseName: "file-for-upload-in-form-QUESTION-MARK-[?].txt", + }); + + formPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-CIRCUMFLEX-ACCENT-[^].txt", + formEncoding: "UTF-8", + expectedEncodedBaseName: + "file-for-upload-in-form-CIRCUMFLEX-ACCENT-[^].txt", + }); + + formPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-LEFT-SQUARE-BRACKET-[[].txt", + formEncoding: "UTF-8", + expectedEncodedBaseName: + "file-for-upload-in-form-LEFT-SQUARE-BRACKET-[[].txt", + }); + + formPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-RIGHT-SQUARE-BRACKET-[]].txt", + formEncoding: "UTF-8", + expectedEncodedBaseName: + "file-for-upload-in-form-RIGHT-SQUARE-BRACKET-[]].txt", + }); + + formPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-LEFT-CURLY-BRACKET-[{].txt", + formEncoding: "UTF-8", + expectedEncodedBaseName: + "file-for-upload-in-form-LEFT-CURLY-BRACKET-[{].txt", + }); + + formPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-VERTICAL-LINE-[|].txt", + formEncoding: "UTF-8", + expectedEncodedBaseName: "file-for-upload-in-form-VERTICAL-LINE-[|].txt", + }); + + formPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-RIGHT-CURLY-BRACKET-[}].txt", + formEncoding: "UTF-8", + expectedEncodedBaseName: + "file-for-upload-in-form-RIGHT-CURLY-BRACKET-[}].txt", + }); + + formPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-TILDE-[~].txt", + formEncoding: "UTF-8", + expectedEncodedBaseName: "file-for-upload-in-form-TILDE-[~].txt", + }); + + formPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "'file-for-upload-in-form-single-quoted.txt'", + formEncoding: "UTF-8", + expectedEncodedBaseName: "'file-for-upload-in-form-single-quoted.txt'", + }); +</script> diff --git a/testing/web-platform/tests/FileAPI/file/send-file-form-utf-8.html b/testing/web-platform/tests/FileAPI/file/send-file-form-utf-8.html new file mode 100644 index 0000000000..1be44f4f4d --- /dev/null +++ b/testing/web-platform/tests/FileAPI/file/send-file-form-utf-8.html @@ -0,0 +1,62 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>Upload files in UTF-8 form</title> +<link rel="help" + href="https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#multipart-form-data"> +<link rel="help" + href="https://html.spec.whatwg.org/multipage/dnd.html#datatransferitemlist"> +<link rel="help" + href="https://w3c.github.io/FileAPI/#file-constructor"> +<link rel="author" title="Benjamin C. Wiley Sittler" + href="mailto:bsittler@chromium.org"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="../support/send-file-form-helper.js"></script> +<script> +'use strict'; + +formPostFileUploadTest({ + fileNameSource: 'ASCII', + fileBaseName: 'file-for-upload-in-form.txt', + formEncoding: 'UTF-8', + expectedEncodedBaseName: 'file-for-upload-in-form.txt', +}); + +formPostFileUploadTest({ + fileNameSource: 'x-user-defined', + fileBaseName: 'file-for-upload-in-form-\uF7F0\uF793\uF783\uF7A0.txt', + formEncoding: 'UTF-8', + expectedEncodedBaseName: ( + 'file-for-upload-in-form-\xEF\x9F\xB0\xEF\x9E\x93\xEF\x9E\x83\xEF\x9E\xA0.txt'), +}); + +formPostFileUploadTest({ + fileNameSource: 'windows-1252', + fileBaseName: 'file-for-upload-in-form-รขหยบรฐลธหโ.txt', + formEncoding: 'UTF-8', + expectedEncodedBaseName: ( + 'file-for-upload-in-form-\xC3\xA2\xCB\x9C\xC2\xBA\xC3\xB0\xC5\xB8\xCB\x9C\xE2\x80\x9A.txt'), +}); + +formPostFileUploadTest({ + fileNameSource: 'JIS X 0201 and JIS X 0208', + fileBaseName: 'file-for-upload-in-form-โ
ๆโ
.txt', + formEncoding: 'UTF-8', + expectedEncodedBaseName: 'file-for-upload-in-form-\xE2\x98\x85\xE6\x98\x9F\xE2\x98\x85.txt', +}); + +formPostFileUploadTest({ + fileNameSource: 'Unicode', + fileBaseName: 'file-for-upload-in-form-โบ๐.txt', + formEncoding: 'UTF-8', + expectedEncodedBaseName: 'file-for-upload-in-form-\xE2\x98\xBA\xF0\x9F\x98\x82.txt', +}); + +formPostFileUploadTest({ + fileNameSource: 'Unicode', + fileBaseName: `file-for-upload-in-form-${kTestChars}.txt`, + formEncoding: 'UTF-8', + expectedEncodedBaseName: `file-for-upload-in-form-${kTestFallbackUtf8}.txt`, +}); + +</script> diff --git a/testing/web-platform/tests/FileAPI/file/send-file-form-windows-1252.html b/testing/web-platform/tests/FileAPI/file/send-file-form-windows-1252.html new file mode 100644 index 0000000000..21b219ffd2 --- /dev/null +++ b/testing/web-platform/tests/FileAPI/file/send-file-form-windows-1252.html @@ -0,0 +1,62 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>Upload files in Windows-1252 form</title> +<link rel="help" + href="https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#multipart-form-data"> +<link rel="help" + href="https://html.spec.whatwg.org/multipage/dnd.html#datatransferitemlist"> +<link rel="help" + href="https://w3c.github.io/FileAPI/#file-constructor"> +<link rel="author" title="Benjamin C. Wiley Sittler" + href="mailto:bsittler@chromium.org"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="../support/send-file-form-helper.js"></script> +<script> +'use strict'; + +formPostFileUploadTest({ + fileNameSource: 'ASCII', + fileBaseName: 'file-for-upload-in-form.txt', + formEncoding: 'windows-1252', + expectedEncodedBaseName: 'file-for-upload-in-form.txt', +}); + +formPostFileUploadTest({ + fileNameSource: 'x-user-defined', + fileBaseName: 'file-for-upload-in-form-\uF7F0\uF793\uF783\uF7A0.txt', + formEncoding: 'windows-1252', + expectedEncodedBaseName: 'file-for-upload-in-form-.txt', +}); + +formPostFileUploadTest({ + fileNameSource: 'windows-1252', + fileBaseName: 'file-for-upload-in-form-รขหยบรฐลธหโ.txt', + formEncoding: 'windows-1252', + expectedEncodedBaseName: 'file-for-upload-in-form-\xE2\x98\xBA\xF0\x9F\x98\x82.txt', +}); + +formPostFileUploadTest({ + fileNameSource: 'JIS X 0201 and JIS X 0208', + fileBaseName: 'file-for-upload-in-form-โ
ๆโ
.txt', + formEncoding: 'windows-1252', + expectedEncodedBaseName: 'file-for-upload-in-form-★星★.txt', +}); + +formPostFileUploadTest({ + fileNameSource: 'Unicode', + fileBaseName: 'file-for-upload-in-form-โบ๐.txt', + formEncoding: 'windows-1252', + expectedEncodedBaseName: 'file-for-upload-in-form-☺😂.txt', +}); + +formPostFileUploadTest({ + fileNameSource: 'Unicode', + fileBaseName: `file-for-upload-in-form-${kTestChars}.txt`, + formEncoding: 'windows-1252', + expectedEncodedBaseName: `file-for-upload-in-form-${ + kTestFallbackWindows1252 + }.txt`, +}); + +</script> diff --git a/testing/web-platform/tests/FileAPI/file/send-file-form-x-user-defined.html b/testing/web-platform/tests/FileAPI/file/send-file-form-x-user-defined.html new file mode 100644 index 0000000000..8d6605d86d --- /dev/null +++ b/testing/web-platform/tests/FileAPI/file/send-file-form-x-user-defined.html @@ -0,0 +1,63 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>Upload files in x-user-defined form</title> +<link rel="help" + href="https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#multipart-form-data"> +<link rel="help" + href="https://html.spec.whatwg.org/multipage/dnd.html#datatransferitemlist"> +<link rel="help" + href="https://w3c.github.io/FileAPI/#file-constructor"> +<link rel="author" title="Benjamin C. Wiley Sittler" + href="mailto:bsittler@chromium.org"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="../support/send-file-form-helper.js"></script> +<script> +'use strict'; + +formPostFileUploadTest({ + fileNameSource: 'ASCII', + fileBaseName: 'file-for-upload-in-form.txt', + formEncoding: 'x-user-defined', + expectedEncodedBaseName: 'file-for-upload-in-form.txt', +}); + +formPostFileUploadTest({ + fileNameSource: 'x-user-defined', + fileBaseName: 'file-for-upload-in-form-\uF7F0\uF793\uF783\uF7A0.txt', + formEncoding: 'x-user-defined', + expectedEncodedBaseName: 'file-for-upload-in-form-\xF0\x93\x83\xA0.txt', +}); + +formPostFileUploadTest({ + fileNameSource: 'windows-1252', + fileBaseName: 'file-for-upload-in-form-รขหยบรฐลธหโ.txt', + formEncoding: 'x-user-defined', + expectedEncodedBaseName: ('file-for-upload-in-form-' + + '☺😂.txt'), +}); + +formPostFileUploadTest({ + fileNameSource: 'JIS X 0201 and JIS X 0208', + fileBaseName: 'file-for-upload-in-form-โ
ๆโ
.txt', + formEncoding: 'x-user-defined', + expectedEncodedBaseName: 'file-for-upload-in-form-★星★.txt', +}); + +formPostFileUploadTest({ + fileNameSource: 'Unicode', + fileBaseName: 'file-for-upload-in-form-โบ๐.txt', + formEncoding: 'x-user-defined', + expectedEncodedBaseName: 'file-for-upload-in-form-☺😂.txt', +}); + +formPostFileUploadTest({ + fileNameSource: 'Unicode', + fileBaseName: `file-for-upload-in-form-${kTestChars}.txt`, + formEncoding: 'x-user-defined', + expectedEncodedBaseName: `file-for-upload-in-form-${ + kTestFallbackXUserDefined + }.txt`, +}); + +</script> diff --git a/testing/web-platform/tests/FileAPI/file/send-file-form.html b/testing/web-platform/tests/FileAPI/file/send-file-form.html new file mode 100644 index 0000000000..baa8d4286c --- /dev/null +++ b/testing/web-platform/tests/FileAPI/file/send-file-form.html @@ -0,0 +1,25 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>Upload ASCII-named file in UTF-8 form</title> +<link rel="help" + href="https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#multipart-form-data"> +<link rel="help" + href="https://html.spec.whatwg.org/multipage/dnd.html#datatransferitemlist"> +<link rel="help" + href="https://w3c.github.io/FileAPI/#file-constructor"> +<link rel="author" title="Benjamin C. Wiley Sittler" + href="mailto:bsittler@chromium.org"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="../support/send-file-form-helper.js"></script> +<script> +'use strict'; + +formPostFileUploadTest({ + fileNameSource: 'ASCII', + fileBaseName: 'file-for-upload-in-form.txt', + formEncoding: 'UTF-8', + expectedEncodedBaseName: 'file-for-upload-in-form.txt', +}); + +</script> diff --git a/testing/web-platform/tests/FileAPI/file/send-file-formdata-controls.any.js b/testing/web-platform/tests/FileAPI/file/send-file-formdata-controls.any.js new file mode 100644 index 0000000000..e95d3aada4 --- /dev/null +++ b/testing/web-platform/tests/FileAPI/file/send-file-formdata-controls.any.js @@ -0,0 +1,69 @@ +// META: title=FormData: FormData: Upload files named using controls +// META: script=../support/send-file-formdata-helper.js + "use strict"; + + formDataPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-NUL-[\0].txt", + }); + + formDataPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-BS-[\b].txt", + }); + + formDataPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-VT-[\v].txt", + }); + + // These have characters that undergo processing in name=, + // filename=, and/or value; formDataPostFileUploadTest postprocesses + // expectedEncodedBaseName for these internally. + + formDataPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-LF-[\n].txt", + }); + + formDataPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-LF-CR-[\n\r].txt", + }); + + formDataPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-CR-[\r].txt", + }); + + formDataPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-CR-LF-[\r\n].txt", + }); + + formDataPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-HT-[\t].txt", + }); + + formDataPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-FF-[\f].txt", + }); + + formDataPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-DEL-[\x7F].txt", + }); + + // The rest should be passed through unmodified: + + formDataPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-ESC-[\x1B].txt", + }); + + formDataPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-SPACE-[ ].txt", + }); diff --git a/testing/web-platform/tests/FileAPI/file/send-file-formdata-punctuation.any.js b/testing/web-platform/tests/FileAPI/file/send-file-formdata-punctuation.any.js new file mode 100644 index 0000000000..987dba39af --- /dev/null +++ b/testing/web-platform/tests/FileAPI/file/send-file-formdata-punctuation.any.js @@ -0,0 +1,144 @@ +// META: title=FormData: FormData: Upload files named using punctuation +// META: script=../support/send-file-formdata-helper.js + "use strict"; + + // These have characters that undergo processing in name=, + // filename=, and/or value; formDataPostFileUploadTest postprocesses + // expectedEncodedBaseName for these internally. + + formDataPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-QUOTATION-MARK-[\x22].txt", + }); + + formDataPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: '"file-for-upload-in-form-double-quoted.txt"', + }); + + formDataPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-REVERSE-SOLIDUS-[\\].txt", + }); + + // The rest should be passed through unmodified: + + formDataPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-EXCLAMATION-MARK-[!].txt", + }); + + formDataPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-DOLLAR-SIGN-[$].txt", + }); + + formDataPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-PERCENT-SIGN-[%].txt", + }); + + formDataPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-AMPERSAND-[&].txt", + }); + + formDataPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-APOSTROPHE-['].txt", + }); + + formDataPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-LEFT-PARENTHESIS-[(].txt", + }); + + formDataPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-RIGHT-PARENTHESIS-[)].txt", + }); + + formDataPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-ASTERISK-[*].txt", + }); + + formDataPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-PLUS-SIGN-[+].txt", + }); + + formDataPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-COMMA-[,].txt", + }); + + formDataPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-FULL-STOP-[.].txt", + }); + + formDataPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-SOLIDUS-[/].txt", + }); + + formDataPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-COLON-[:].txt", + }); + + formDataPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-SEMICOLON-[;].txt", + }); + + formDataPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-EQUALS-SIGN-[=].txt", + }); + + formDataPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-QUESTION-MARK-[?].txt", + }); + + formDataPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-CIRCUMFLEX-ACCENT-[^].txt", + }); + + formDataPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-LEFT-SQUARE-BRACKET-[[].txt", + }); + + formDataPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-RIGHT-SQUARE-BRACKET-[]].txt", + }); + + formDataPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-LEFT-CURLY-BRACKET-[{].txt", + }); + + formDataPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-VERTICAL-LINE-[|].txt", + }); + + formDataPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-RIGHT-CURLY-BRACKET-[}].txt", + }); + + formDataPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form-TILDE-[~].txt", + }); + + formDataPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "'file-for-upload-in-form-single-quoted.txt'", + }); diff --git a/testing/web-platform/tests/FileAPI/file/send-file-formdata-utf-8.any.js b/testing/web-platform/tests/FileAPI/file/send-file-formdata-utf-8.any.js new file mode 100644 index 0000000000..b8bd74c717 --- /dev/null +++ b/testing/web-platform/tests/FileAPI/file/send-file-formdata-utf-8.any.js @@ -0,0 +1,33 @@ +// META: title=FormData: FormData: Upload files in UTF-8 fetch() +// META: script=../support/send-file-formdata-helper.js + "use strict"; + + formDataPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form.txt", + }); + + formDataPostFileUploadTest({ + fileNameSource: "x-user-defined", + fileBaseName: "file-for-upload-in-form-\uF7F0\uF793\uF783\uF7A0.txt", + }); + + formDataPostFileUploadTest({ + fileNameSource: "windows-1252", + fileBaseName: "file-for-upload-in-form-รขหยบรฐลธหโ.txt", + }); + + formDataPostFileUploadTest({ + fileNameSource: "JIS X 0201 and JIS X 0208", + fileBaseName: "file-for-upload-in-form-โ
ๆโ
.txt", + }); + + formDataPostFileUploadTest({ + fileNameSource: "Unicode", + fileBaseName: "file-for-upload-in-form-โบ๐.txt", + }); + + formDataPostFileUploadTest({ + fileNameSource: "Unicode", + fileBaseName: `file-for-upload-in-form-${kTestChars}.txt`, + }); diff --git a/testing/web-platform/tests/FileAPI/file/send-file-formdata.any.js b/testing/web-platform/tests/FileAPI/file/send-file-formdata.any.js new file mode 100644 index 0000000000..e13a34828a --- /dev/null +++ b/testing/web-platform/tests/FileAPI/file/send-file-formdata.any.js @@ -0,0 +1,8 @@ +// META: title=FormData: Upload ASCII-named file in UTF-8 form +// META: script=../support/send-file-formdata-helper.js + "use strict"; + + formDataPostFileUploadTest({ + fileNameSource: "ASCII", + fileBaseName: "file-for-upload-in-form.txt", + }); |