Title: [270010] trunk/LayoutTests
Revision
270010
Author
[email protected]
Date
2020-11-18 19:40:20 -0800 (Wed, 18 Nov 2020)

Log Message

Resync web-platform-tests/FileAPI tests from upstream
https://bugs.webkit.org/show_bug.cgi?id=219125

Reviewed by Sam Weinig.

Resync web-platform-tests/FileAPI tests from upstream dd35c2b21b76772123f7.

* web-platform-tests/FileAPI/file/File-constructor-expected.txt:
* web-platform-tests/FileAPI/file/File-constructor.html:
* web-platform-tests/FileAPI/file/resources/echo-content-escaped.py: Added.
(escape_byte):
(main):
* web-platform-tests/FileAPI/file/resources/w3c-import.log: Added.
* web-platform-tests/FileAPI/file/send-file-form-controls.tentative-expected.txt: Added.
* web-platform-tests/FileAPI/file/send-file-form-controls.tentative.html: Added.
* web-platform-tests/FileAPI/file/send-file-form-punctuation.tentative-expected.txt: Added.
* web-platform-tests/FileAPI/file/send-file-form-punctuation.tentative.html: Added.
* web-platform-tests/FileAPI/file/send-file-form-utf-8.html:
* web-platform-tests/FileAPI/file/send-file-form-windows-1252.tentative.html:
* web-platform-tests/FileAPI/file/send-file-form-x-user-defined.tentative.html:
* web-platform-tests/FileAPI/file/send-file-formdata-controls.tentative-expected.txt: Added.
* web-platform-tests/FileAPI/file/send-file-formdata-controls.tentative.html: Added.
* web-platform-tests/FileAPI/file/send-file-formdata-expected.txt: Added.
* web-platform-tests/FileAPI/file/send-file-formdata-punctuation.tentative-expected.txt: Added.
* web-platform-tests/FileAPI/file/send-file-formdata-punctuation.tentative.html: Added.
* web-platform-tests/FileAPI/file/send-file-formdata-utf-8-expected.txt: Added.
* web-platform-tests/FileAPI/file/send-file-formdata-utf-8.html: Added.
* web-platform-tests/FileAPI/file/send-file-formdata.html: Added.
* web-platform-tests/FileAPI/file/w3c-import.log:
* web-platform-tests/FileAPI/fileReader-expected.txt:
* web-platform-tests/FileAPI/fileReader.html:
* web-platform-tests/FileAPI/support/send-file-form-helper.js:
(escapeString):
(const.formPostFileUploadTest):
* web-platform-tests/FileAPI/support/send-file-formdata-helper.js: Added.
(const.formDataPostFileUploadTest):
* web-platform-tests/FileAPI/support/w3c-import.log:
* web-platform-tests/FileAPI/url/url-charset.window-expected.txt: Added.
* web-platform-tests/FileAPI/url/url-charset.window.html: Added.
* web-platform-tests/FileAPI/url/url-charset.window.js: Added.
(async_test.t.t.add_cleanup):
(async_test.t.win.onload.t.step_func_done):
* web-platform-tests/FileAPI/url/w3c-import.log:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/TestExpectations (270009 => 270010)


--- trunk/LayoutTests/TestExpectations	2020-11-19 03:38:21 UTC (rev 270009)
+++ trunk/LayoutTests/TestExpectations	2020-11-19 03:40:20 UTC (rev 270010)
@@ -2686,6 +2686,8 @@
 # FileAPI
 webkit.org/b/172099 imported/w3c/web-platform-tests/FileAPI/url/url_xmlhttprequest_img.html [ ImageOnlyFailure ]
 imported/w3c/web-platform-tests/FileAPI/url/sandboxed-iframe.html [ Failure ]
+# Test output contains WebKitFormBoundary lines with randomly generated text.
+imported/w3c/web-platform-tests/FileAPI/file/send-file-formdata-controls.tentative.html [ Failure ]
 
 # Secure Contexts tests that timeout
 imported/w3c/web-platform-tests/secure-contexts/basic-dedicated-worker.html [ Skip ]

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (270009 => 270010)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2020-11-19 03:38:21 UTC (rev 270009)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2020-11-19 03:40:20 UTC (rev 270010)
@@ -1,5 +1,51 @@
 2020-11-18  Chris Dumez  <[email protected]>
 
+        Resync web-platform-tests/FileAPI tests from upstream
+        https://bugs.webkit.org/show_bug.cgi?id=219125
+
+        Reviewed by Sam Weinig.
+
+        Resync web-platform-tests/FileAPI tests from upstream dd35c2b21b76772123f7.
+
+        * web-platform-tests/FileAPI/file/File-constructor-expected.txt:
+        * web-platform-tests/FileAPI/file/File-constructor.html:
+        * web-platform-tests/FileAPI/file/resources/echo-content-escaped.py: Added.
+        (escape_byte):
+        (main):
+        * web-platform-tests/FileAPI/file/resources/w3c-import.log: Added.
+        * web-platform-tests/FileAPI/file/send-file-form-controls.tentative-expected.txt: Added.
+        * web-platform-tests/FileAPI/file/send-file-form-controls.tentative.html: Added.
+        * web-platform-tests/FileAPI/file/send-file-form-punctuation.tentative-expected.txt: Added.
+        * web-platform-tests/FileAPI/file/send-file-form-punctuation.tentative.html: Added.
+        * web-platform-tests/FileAPI/file/send-file-form-utf-8.html:
+        * web-platform-tests/FileAPI/file/send-file-form-windows-1252.tentative.html:
+        * web-platform-tests/FileAPI/file/send-file-form-x-user-defined.tentative.html:
+        * web-platform-tests/FileAPI/file/send-file-formdata-controls.tentative-expected.txt: Added.
+        * web-platform-tests/FileAPI/file/send-file-formdata-controls.tentative.html: Added.
+        * web-platform-tests/FileAPI/file/send-file-formdata-expected.txt: Added.
+        * web-platform-tests/FileAPI/file/send-file-formdata-punctuation.tentative-expected.txt: Added.
+        * web-platform-tests/FileAPI/file/send-file-formdata-punctuation.tentative.html: Added.
+        * web-platform-tests/FileAPI/file/send-file-formdata-utf-8-expected.txt: Added.
+        * web-platform-tests/FileAPI/file/send-file-formdata-utf-8.html: Added.
+        * web-platform-tests/FileAPI/file/send-file-formdata.html: Added.
+        * web-platform-tests/FileAPI/file/w3c-import.log:
+        * web-platform-tests/FileAPI/fileReader-expected.txt:
+        * web-platform-tests/FileAPI/fileReader.html:
+        * web-platform-tests/FileAPI/support/send-file-form-helper.js:
+        (escapeString):
+        (const.formPostFileUploadTest):
+        * web-platform-tests/FileAPI/support/send-file-formdata-helper.js: Added.
+        (const.formDataPostFileUploadTest):
+        * web-platform-tests/FileAPI/support/w3c-import.log:
+        * web-platform-tests/FileAPI/url/url-charset.window-expected.txt: Added.
+        * web-platform-tests/FileAPI/url/url-charset.window.html: Added.
+        * web-platform-tests/FileAPI/url/url-charset.window.js: Added.
+        (async_test.t.t.add_cleanup):
+        (async_test.t.win.onload.t.step_func_done):
+        * web-platform-tests/FileAPI/url/w3c-import.log:
+
+2020-11-18  Chris Dumez  <[email protected]>
+
         Import web-platform-tests/compat tests from usptream
         https://bugs.webkit.org/show_bug.cgi?id=219126
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/File-constructor-expected.txt (270009 => 270010)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/File-constructor-expected.txt	2020-11-19 03:38:21 UTC (rev 270009)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/File-constructor-expected.txt	2020-11-19 03:40:20 UTC (rev 270010)
@@ -23,7 +23,7 @@
 PASS Invalid bits argument: null
 PASS Bits argument: object that throws
 PASS Using fileName
-FAIL Using special character in fileName assert_equals: expected "dummy:foo" but got "dummy/foo"
+PASS No replacement when using special character in fileName
 PASS Using null fileName
 PASS Using number fileName
 PASS Using empty string fileName

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/File-constructor.html (270009 => 270010)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/File-constructor.html	2020-11-19 03:38:21 UTC (rev 270009)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/File-constructor.html	2020-11-19 03:40:20 UTC (rev 270010)
@@ -84,7 +84,8 @@
 }
 
 test_second_argument("dummy", "dummy", "Using fileName");
-test_second_argument("dummy/foo", "dummy:foo", "Using special character in 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");

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/resources/echo-content-escaped.py (0 => 270010)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/resources/echo-content-escaped.py	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/resources/echo-content-escaped.py	2020-11-19 03:40:20 UTC (rev 270010)
@@ -0,0 +1,24 @@
+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):
+    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

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/resources/w3c-import.log (0 => 270010)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/resources/w3c-import.log	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/resources/w3c-import.log	2020-11-19 03:40:20 UTC (rev 270010)
@@ -0,0 +1,17 @@
+The tests in this directory were imported from the W3C repository.
+Do NOT modify these tests directly in WebKit.
+Instead, create a pull request on the WPT github:
+	https://github.com/web-platform-tests/wpt
+
+Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport
+
+Do NOT modify or remove this file.
+
+------------------------------------------------------------------------
+Properties requiring vendor prefixes:
+None
+Property values requiring vendor prefixes:
+None
+------------------------------------------------------------------------
+List of files:
+/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/resources/echo-content-escaped.py

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-form-controls.tentative-expected.txt (0 => 270010)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-form-controls.tentative-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-form-controls.tentative-expected.txt	2020-11-19 03:40:20 UTC (rev 270010)
@@ -0,0 +1,17 @@
+
+PASS Upload file-for-upload-in-form-NUL-[\0].txt (ASCII) in UTF-8 form
+PASS Upload file-for-upload-in-form-BS-[].txt (ASCII) in UTF-8 form
+PASS Upload file-for-upload-in-form-VT-[].txt (ASCII) in UTF-8 form
+PASS Upload file-for-upload-in-form-LF-[
+].txt (ASCII) in UTF-8 form
+PASS Upload file-for-upload-in-form-LF-CR-[
+\r].txt (ASCII) in UTF-8 form
+PASS Upload file-for-upload-in-form-CR-[\r].txt (ASCII) in UTF-8 form
+PASS Upload file-for-upload-in-form-CR-LF-[\r
+].txt (ASCII) in UTF-8 form
+PASS Upload file-for-upload-in-form-HT-[	].txt (ASCII) in UTF-8 form
+PASS Upload file-for-upload-in-form-FF-[].txt (ASCII) in UTF-8 form
+PASS Upload file-for-upload-in-form-DEL-[].txt (ASCII) in UTF-8 form
+PASS Upload file-for-upload-in-form-ESC-[].txt (ASCII) in UTF-8 form
+PASS Upload file-for-upload-in-form-SPACE-[ ].txt (ASCII) in UTF-8 form
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-form-controls.tentative.html (0 => 270010)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-form-controls.tentative.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-form-controls.tentative.html	2020-11-19 03:40:20 UTC (rev 270010)
@@ -0,0 +1,117 @@
+<!DOCTYPE html>
+<meta charset="utf-8" />
+<title>Upload files named using controls (tentative)</title>
+<!--
+    NOTE: This test is tentative because encoding for filename
+    control characters is not yet standardized.
+  -->
+<link
+  rel="help"
+  href=""
+/>
+<link
+  rel="help"
+  href=""
+/>
+<link rel="help" href="" />
+<link
+  rel="author"
+  title="Benjamin C. Wiley Sittler"
+  href=""
+/>
+<script src=""
+<script src=""
+<script src=""
+<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>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-form-punctuation.tentative-expected.txt (0 => 270010)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-form-punctuation.tentative-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-form-punctuation.tentative-expected.txt	2020-11-19 03:40:20 UTC (rev 270010)
@@ -0,0 +1,29 @@
+
+PASS Upload file-for-upload-in-form-QUOTATION-MARK-["].txt (ASCII) in UTF-8 form
+PASS Upload "file-for-upload-in-form-double-quoted.txt" (ASCII) in UTF-8 form
+PASS Upload file-for-upload-in-form-REVERSE-SOLIDUS-[\].txt (ASCII) in UTF-8 form
+PASS Upload file-for-upload-in-form-EXCLAMATION-MARK-[!].txt (ASCII) in UTF-8 form
+PASS Upload file-for-upload-in-form-DOLLAR-SIGN-[$].txt (ASCII) in UTF-8 form
+PASS Upload file-for-upload-in-form-PERCENT-SIGN-[%].txt (ASCII) in UTF-8 form
+PASS Upload file-for-upload-in-form-AMPERSAND-[&].txt (ASCII) in UTF-8 form
+PASS Upload file-for-upload-in-form-APOSTROPHE-['].txt (ASCII) in UTF-8 form
+PASS Upload file-for-upload-in-form-LEFT-PARENTHESIS-[(].txt (ASCII) in UTF-8 form
+PASS Upload file-for-upload-in-form-RIGHT-PARENTHESIS-[)].txt (ASCII) in UTF-8 form
+PASS Upload file-for-upload-in-form-ASTERISK-[*].txt (ASCII) in UTF-8 form
+PASS Upload file-for-upload-in-form-PLUS-SIGN-[+].txt (ASCII) in UTF-8 form
+PASS Upload file-for-upload-in-form-COMMA-[,].txt (ASCII) in UTF-8 form
+PASS Upload file-for-upload-in-form-FULL-STOP-[.].txt (ASCII) in UTF-8 form
+PASS Upload file-for-upload-in-form-SOLIDUS-[/].txt (ASCII) in UTF-8 form
+PASS Upload file-for-upload-in-form-COLON-[:].txt (ASCII) in UTF-8 form
+PASS Upload file-for-upload-in-form-SEMICOLON-[;].txt (ASCII) in UTF-8 form
+PASS Upload file-for-upload-in-form-EQUALS-SIGN-[=].txt (ASCII) in UTF-8 form
+PASS Upload file-for-upload-in-form-QUESTION-MARK-[?].txt (ASCII) in UTF-8 form
+PASS Upload file-for-upload-in-form-CIRCUMFLEX-ACCENT-[^].txt (ASCII) in UTF-8 form
+PASS Upload file-for-upload-in-form-LEFT-SQUARE-BRACKET-[[].txt (ASCII) in UTF-8 form
+PASS Upload file-for-upload-in-form-RIGHT-SQUARE-BRACKET-[]].txt (ASCII) in UTF-8 form
+PASS Upload file-for-upload-in-form-LEFT-CURLY-BRACKET-[{].txt (ASCII) in UTF-8 form
+PASS Upload file-for-upload-in-form-VERTICAL-LINE-[|].txt (ASCII) in UTF-8 form
+PASS Upload file-for-upload-in-form-RIGHT-CURLY-BRACKET-[}].txt (ASCII) in UTF-8 form
+PASS Upload file-for-upload-in-form-TILDE-[~].txt (ASCII) in UTF-8 form
+PASS Upload 'file-for-upload-in-form-single-quoted.txt' (ASCII) in UTF-8 form
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-form-punctuation.tentative.html (0 => 270010)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-form-punctuation.tentative.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-form-punctuation.tentative.html	2020-11-19 03:40:20 UTC (rev 270010)
@@ -0,0 +1,230 @@
+<!DOCTYPE html>
+<meta charset="utf-8" />
+<title>Upload files named using punctuation (tentative)</title>
+<!--
+    NOTE: This test is tentative because encoding for filename
+    punctuation characters is not yet standardized.
+  -->
+<link
+  rel="help"
+  href=""
+/>
+<link
+  rel="help"
+  href=""
+/>
+<link rel="help" href="" />
+<link
+  rel="author"
+  title="Benjamin C. Wiley Sittler"
+  href=""
+/>
+<script src=""
+<script src=""
+<script src=""
+<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>

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-form-utf-8.html (270009 => 270010)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-form-utf-8.html	2020-11-19 03:38:21 UTC (rev 270009)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-form-utf-8.html	2020-11-19 03:40:20 UTC (rev 270010)
@@ -27,7 +27,7 @@
   fileBaseName: 'file-for-upload-in-form-\uF7F0\uF793\uF783\uF7A0.txt',
   formEncoding: 'UTF-8',
   expectedEncodedBaseName: (
-      'file-for-upload-in-form-\uF7F0\uF793\uF783\uF7A0.txt'),
+      'file-for-upload-in-form-\xEF\x9F\xB0\xEF\x9E\x93\xEF\x9E\x83\xEF\x9E\xA0.txt'),
 });
 
 formPostFileUploadTest({
@@ -34,7 +34,8 @@
   fileNameSource: 'windows-1252',
   fileBaseName: 'file-for-upload-in-form-☺😂.txt',
   formEncoding: 'UTF-8',
-  expectedEncodedBaseName: 'file-for-upload-in-form-☺😂.txt',
+  expectedEncodedBaseName: (
+      'file-for-upload-in-form-\xC3\xA2\xCB\x9C\xC2\xBA\xC3\xB0\xC5\xB8\xCB\x9C\xE2\x80\x9A.txt'),
 });
 
 formPostFileUploadTest({
@@ -41,7 +42,7 @@
   fileNameSource: 'JIS X 0201 and JIS X 0208',
   fileBaseName: 'file-for-upload-in-form-★星★.txt',
   formEncoding: 'UTF-8',
-  expectedEncodedBaseName: 'file-for-upload-in-form-★星★.txt',
+  expectedEncodedBaseName: 'file-for-upload-in-form-\xE2\x98\x85\xE6\x98\x9F\xE2\x98\x85.txt',
 });
 
 formPostFileUploadTest({
@@ -48,7 +49,7 @@
   fileNameSource: 'Unicode',
   fileBaseName: 'file-for-upload-in-form-☺😂.txt',
   formEncoding: 'UTF-8',
-  expectedEncodedBaseName: 'file-for-upload-in-form-☺😂.txt',
+  expectedEncodedBaseName: 'file-for-upload-in-form-\xE2\x98\xBA\xF0\x9F\x98\x82.txt',
 });
 
 formPostFileUploadTest({
@@ -55,7 +56,7 @@
   fileNameSource: 'Unicode',
   fileBaseName: `file-for-upload-in-form-${kTestChars}.txt`,
   formEncoding: 'UTF-8',
-  expectedEncodedBaseName: `file-for-upload-in-form-${kTestChars}.txt`,
+  expectedEncodedBaseName: `file-for-upload-in-form-${kTestFallbackUtf8}.txt`,
 });
 
 </script>

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-form-windows-1252.tentative.html (270009 => 270010)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-form-windows-1252.tentative.html	2020-11-19 03:38:21 UTC (rev 270009)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-form-windows-1252.tentative.html	2020-11-19 03:40:20 UTC (rev 270010)
@@ -33,8 +33,7 @@
   fileNameSource: 'x-user-defined',
   fileBaseName: 'file-for-upload-in-form-\uF7F0\uF793\uF783\uF7A0.txt',
   formEncoding: 'windows-1252',
-  expectedEncodedBaseName: (
-      'file-for-upload-in-form-&#63472;&#63379;&#63363;&#63392;.txt'),
+  expectedEncodedBaseName: 'file-for-upload-in-form-&#63472;&#63379;&#63363;&#63392;.txt',
 });
 
 formPostFileUploadTest({
@@ -41,7 +40,7 @@
   fileNameSource: 'windows-1252',
   fileBaseName: 'file-for-upload-in-form-☺😂.txt',
   formEncoding: 'windows-1252',
-  expectedEncodedBaseName: 'file-for-upload-in-form-☺😂.txt',
+  expectedEncodedBaseName: 'file-for-upload-in-form-\xE2\x98\xBA\xF0\x9F\x98\x82.txt',
 });
 
 formPostFileUploadTest({

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-form-x-user-defined.tentative.html (270009 => 270010)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-form-x-user-defined.tentative.html	2020-11-19 03:38:21 UTC (rev 270009)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-form-x-user-defined.tentative.html	2020-11-19 03:40:20 UTC (rev 270010)
@@ -33,7 +33,7 @@
   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-𓃠.txt',
+  expectedEncodedBaseName: 'file-for-upload-in-form-\xF0\x93\x83\xA0.txt',
 });
 
 formPostFileUploadTest({

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-formdata-controls.tentative-expected.txt (0 => 270010)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-formdata-controls.tentative-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-formdata-controls.tentative-expected.txt	2020-11-19 03:40:20 UTC (rev 270010)
@@ -0,0 +1,113 @@
+
+PASS Upload file-for-upload-in-form-NUL-[\0].txt (ASCII) in fetch with FormData
+PASS Upload file-for-upload-in-form-BS-[].txt (ASCII) in fetch with FormData
+PASS Upload file-for-upload-in-form-VT-[].txt (ASCII) in fetch with FormData
+FAIL Upload file-for-upload-in-form-LF-[
+].txt (ASCII) in fetch with FormData assert_true: Unexpected multipart-shaped form data received:
+------WebKitFormBoundaryaENOOGISYDFoQQnB\r
+Content-Disposition: form-data; name="filename"\r
+\r
+file-for-upload-in-form-LF-[\r
+].txt\r
+------WebKitFormBoundaryaENOOGISYDFoQQnB\r
+Content-Disposition: form-data; name="file-for-upload-in-form-LF-[%0D%0A].txt"\r
+\r
+filename\r
+------WebKitFormBoundaryaENOOGISYDFoQQnB\r
+Content-Disposition: form-data; name="file"; filename="file-for-upload-in-form-LF-[%0A].txt"\r
+Content-Type: text/plain\r
+\r
+ABC~‾¥≈¤・・•∙·☼★星🌟星★☼·∙•・・¤≈¥‾~XYZ\r
+------WebKitFormBoundaryaENOOGISYDFoQQnB--\r
+
+Expected:
+------WebKitFormBoundaryaENOOGISYDFoQQnB\r
+Content-Disposition: form-data; name="filename"\r
+\r
+file-for-upload-in-form-LF-[
+].txt\r
+------WebKitFormBoundaryaENOOGISYDFoQQnB\r
+Content-Disposition: form-data; name="file-for-upload-in-form-LF-[%0A].txt"\r
+\r
+filename\r
+------WebKitFormBoundaryaENOOGISYDFoQQnB\r
+Content-Disposition: form-data; name="file"; filename="file-for-upload-in-form-LF-[%0A].txt"\r
+Content-Type: text/plain\r
+\r
+ABC~‾¥≈¤・・•∙·☼★星🌟星★☼·∙•・・¤≈¥‾~XYZ\r
+------WebKitFormBoundaryaENOOGISYDFoQQnB-- expected true got false
+FAIL Upload file-for-upload-in-form-LF-CR-[
+\r].txt (ASCII) in fetch with FormData assert_true: Unexpected multipart-shaped form data received:
+------WebKitFormBoundarySBj6CVNc0V8O02He\r
+Content-Disposition: form-data; name="filename"\r
+\r
+file-for-upload-in-form-LF-CR-[\r
+\r
+].txt\r
+------WebKitFormBoundarySBj6CVNc0V8O02He\r
+Content-Disposition: form-data; name="file-for-upload-in-form-LF-CR-[%0D%0A%0D%0A].txt"\r
+\r
+filename\r
+------WebKitFormBoundarySBj6CVNc0V8O02He\r
+Content-Disposition: form-data; name="file"; filename="file-for-upload-in-form-LF-CR-[%0A%0D].txt"\r
+Content-Type: text/plain\r
+\r
+ABC~‾¥≈¤・・•∙·☼★星🌟星★☼·∙•・・¤≈¥‾~XYZ\r
+------WebKitFormBoundarySBj6CVNc0V8O02He--\r
+
+Expected:
+------WebKitFormBoundarySBj6CVNc0V8O02He\r
+Content-Disposition: form-data; name="filename"\r
+\r
+file-for-upload-in-form-LF-CR-[
+\r].txt\r
+------WebKitFormBoundarySBj6CVNc0V8O02He\r
+Content-Disposition: form-data; name="file-for-upload-in-form-LF-CR-[%0A%0D].txt"\r
+\r
+filename\r
+------WebKitFormBoundarySBj6CVNc0V8O02He\r
+Content-Disposition: form-data; name="file"; filename="file-for-upload-in-form-LF-CR-[%0A%0D].txt"\r
+Content-Type: text/plain\r
+\r
+ABC~‾¥≈¤・・•∙·☼★星🌟星★☼·∙•・・¤≈¥‾~XYZ\r
+------WebKitFormBoundarySBj6CVNc0V8O02He-- expected true got false
+FAIL Upload file-for-upload-in-form-CR-[\r].txt (ASCII) in fetch with FormData assert_true: Unexpected multipart-shaped form data received:
+------WebKitFormBoundary4RtU1kIZIKOZW4LA\r
+Content-Disposition: form-data; name="filename"\r
+\r
+file-for-upload-in-form-CR-[\r
+].txt\r
+------WebKitFormBoundary4RtU1kIZIKOZW4LA\r
+Content-Disposition: form-data; name="file-for-upload-in-form-CR-[%0D%0A].txt"\r
+\r
+filename\r
+------WebKitFormBoundary4RtU1kIZIKOZW4LA\r
+Content-Disposition: form-data; name="file"; filename="file-for-upload-in-form-CR-[%0D].txt"\r
+Content-Type: text/plain\r
+\r
+ABC~‾¥≈¤・・•∙·☼★星🌟星★☼·∙•・・¤≈¥‾~XYZ\r
+------WebKitFormBoundary4RtU1kIZIKOZW4LA--\r
+
+Expected:
+------WebKitFormBoundary4RtU1kIZIKOZW4LA\r
+Content-Disposition: form-data; name="filename"\r
+\r
+file-for-upload-in-form-CR-[\r].txt\r
+------WebKitFormBoundary4RtU1kIZIKOZW4LA\r
+Content-Disposition: form-data; name="file-for-upload-in-form-CR-[%0D].txt"\r
+\r
+filename\r
+------WebKitFormBoundary4RtU1kIZIKOZW4LA\r
+Content-Disposition: form-data; name="file"; filename="file-for-upload-in-form-CR-[%0D].txt"\r
+Content-Type: text/plain\r
+\r
+ABC~‾¥≈¤・・•∙·☼★星🌟星★☼·∙•・・¤≈¥‾~XYZ\r
+------WebKitFormBoundary4RtU1kIZIKOZW4LA-- expected true got false
+PASS Upload file-for-upload-in-form-CR-LF-[\r
+].txt (ASCII) in fetch with FormData
+PASS Upload file-for-upload-in-form-HT-[	].txt (ASCII) in fetch with FormData
+PASS Upload file-for-upload-in-form-FF-[].txt (ASCII) in fetch with FormData
+PASS Upload file-for-upload-in-form-DEL-[].txt (ASCII) in fetch with FormData
+PASS Upload file-for-upload-in-form-ESC-[].txt (ASCII) in fetch with FormData
+PASS Upload file-for-upload-in-form-SPACE-[ ].txt (ASCII) in fetch with FormData
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-formdata-controls.tentative.html (0 => 270010)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-formdata-controls.tentative.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-formdata-controls.tentative.html	2020-11-19 03:40:20 UTC (rev 270010)
@@ -0,0 +1,93 @@
+<!DOCTYPE html>
+<meta charset="utf-8" />
+<title>FormData: Upload files named using controls (tentative)</title>
+<!--
+    NOTE: This test is tentative because encoding for filename
+    control characters is not yet standardized.
+  -->
+<link
+  rel="help"
+  href=""
+/>
+<link
+  rel="help"
+  href=""
+/>
+<link rel="help" href="" />
+<link
+  rel="author"
+  title="Benjamin C. Wiley Sittler"
+  href=""
+/>
+<script src=""
+<script src=""
+<script src=""
+<script>
+  "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",
+  });
+</script>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-formdata-expected.txt (0 => 270010)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-formdata-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-formdata-expected.txt	2020-11-19 03:40:20 UTC (rev 270010)
@@ -0,0 +1,3 @@
+
+PASS Upload file-for-upload-in-form.txt (ASCII) in fetch with FormData
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-formdata-punctuation.tentative-expected.txt (0 => 270010)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-formdata-punctuation.tentative-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-formdata-punctuation.tentative-expected.txt	2020-11-19 03:40:20 UTC (rev 270010)
@@ -0,0 +1,29 @@
+
+PASS Upload file-for-upload-in-form-QUOTATION-MARK-["].txt (ASCII) in fetch with FormData
+PASS Upload "file-for-upload-in-form-double-quoted.txt" (ASCII) in fetch with FormData
+PASS Upload file-for-upload-in-form-REVERSE-SOLIDUS-[\].txt (ASCII) in fetch with FormData
+PASS Upload file-for-upload-in-form-EXCLAMATION-MARK-[!].txt (ASCII) in fetch with FormData
+PASS Upload file-for-upload-in-form-DOLLAR-SIGN-[$].txt (ASCII) in fetch with FormData
+PASS Upload file-for-upload-in-form-PERCENT-SIGN-[%].txt (ASCII) in fetch with FormData
+PASS Upload file-for-upload-in-form-AMPERSAND-[&].txt (ASCII) in fetch with FormData
+PASS Upload file-for-upload-in-form-APOSTROPHE-['].txt (ASCII) in fetch with FormData
+PASS Upload file-for-upload-in-form-LEFT-PARENTHESIS-[(].txt (ASCII) in fetch with FormData
+PASS Upload file-for-upload-in-form-RIGHT-PARENTHESIS-[)].txt (ASCII) in fetch with FormData
+PASS Upload file-for-upload-in-form-ASTERISK-[*].txt (ASCII) in fetch with FormData
+PASS Upload file-for-upload-in-form-PLUS-SIGN-[+].txt (ASCII) in fetch with FormData
+PASS Upload file-for-upload-in-form-COMMA-[,].txt (ASCII) in fetch with FormData
+PASS Upload file-for-upload-in-form-FULL-STOP-[.].txt (ASCII) in fetch with FormData
+PASS Upload file-for-upload-in-form-SOLIDUS-[/].txt (ASCII) in fetch with FormData
+PASS Upload file-for-upload-in-form-COLON-[:].txt (ASCII) in fetch with FormData
+PASS Upload file-for-upload-in-form-SEMICOLON-[;].txt (ASCII) in fetch with FormData
+PASS Upload file-for-upload-in-form-EQUALS-SIGN-[=].txt (ASCII) in fetch with FormData
+PASS Upload file-for-upload-in-form-QUESTION-MARK-[?].txt (ASCII) in fetch with FormData
+PASS Upload file-for-upload-in-form-CIRCUMFLEX-ACCENT-[^].txt (ASCII) in fetch with FormData
+PASS Upload file-for-upload-in-form-LEFT-SQUARE-BRACKET-[[].txt (ASCII) in fetch with FormData
+PASS Upload file-for-upload-in-form-RIGHT-SQUARE-BRACKET-[]].txt (ASCII) in fetch with FormData
+PASS Upload file-for-upload-in-form-LEFT-CURLY-BRACKET-[{].txt (ASCII) in fetch with FormData
+PASS Upload file-for-upload-in-form-VERTICAL-LINE-[|].txt (ASCII) in fetch with FormData
+PASS Upload file-for-upload-in-form-RIGHT-CURLY-BRACKET-[}].txt (ASCII) in fetch with FormData
+PASS Upload file-for-upload-in-form-TILDE-[~].txt (ASCII) in fetch with FormData
+PASS Upload 'file-for-upload-in-form-single-quoted.txt' (ASCII) in fetch with FormData
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-formdata-punctuation.tentative.html (0 => 270010)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-formdata-punctuation.tentative.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-formdata-punctuation.tentative.html	2020-11-19 03:40:20 UTC (rev 270010)
@@ -0,0 +1,168 @@
+<!DOCTYPE html>
+<meta charset="utf-8" />
+<title>FormData: Upload files named using punctuation (tentative)</title>
+<!--
+    NOTE: This test is tentative because encoding for filename
+    punctuation characters is not yet standardized.
+  -->
+<link
+  rel="help"
+  href=""
+/>
+<link
+  rel="help"
+  href=""
+/>
+<link rel="help" href="" />
+<link
+  rel="author"
+  title="Benjamin C. Wiley Sittler"
+  href=""
+/>
+<script src=""
+<script src=""
+<script src=""
+<script>
+  "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'",
+  });
+</script>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-formdata-utf-8-expected.txt (0 => 270010)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-formdata-utf-8-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-formdata-utf-8-expected.txt	2020-11-19 03:40:20 UTC (rev 270010)
@@ -0,0 +1,8 @@
+
+PASS Upload file-for-upload-in-form.txt (ASCII) in fetch with FormData
+PASS Upload file-for-upload-in-form-.txt (x-user-defined) in fetch with FormData
+PASS Upload file-for-upload-in-form-☺😂.txt (windows-1252) in fetch with FormData
+PASS Upload file-for-upload-in-form-★星★.txt (JIS X 0201 and JIS X 0208) in fetch with FormData
+PASS Upload file-for-upload-in-form-☺😂.txt (Unicode) in fetch with FormData
+PASS Upload file-for-upload-in-form-ABC~‾¥≈¤・・•∙·☼★星🌟星★☼·∙•・・¤≈¥‾~XYZ.txt (Unicode) in fetch with FormData
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-formdata-utf-8.html (0 => 270010)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-formdata-utf-8.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-formdata-utf-8.html	2020-11-19 03:40:20 UTC (rev 270010)
@@ -0,0 +1,53 @@
+<!DOCTYPE html>
+<meta charset="utf-8" />
+<title>FormData: Upload files in UTF-8 fetch()</title>
+<link
+  rel="help"
+  href=""
+/>
+<link
+  rel="help"
+  href=""
+/>
+<link rel="help" href="" />
+<link
+  rel="author"
+  title="Benjamin C. Wiley Sittler"
+  href=""
+/>
+<script src=""
+<script src=""
+<script src=""
+<script>
+  "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`,
+  });
+</script>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-formdata.html (0 => 270010)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-formdata.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-formdata.html	2020-11-19 03:40:20 UTC (rev 270010)
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<meta charset="utf-8" />
+<title>FormData: Upload ASCII-named file in UTF-8 form</title>
+<link
+  rel="help"
+  href=""
+/>
+<link
+  rel="help"
+  href=""
+/>
+<link rel="help" href="" />
+<link
+  rel="author"
+  title="Benjamin C. Wiley Sittler"
+  href=""
+/>
+<script src=""
+<script src=""
+<script src=""
+<script>
+  "use strict";
+
+  formDataPostFileUploadTest({
+    fileNameSource: "ASCII",
+    fileBaseName: "file-for-upload-in-form.txt",
+  });
+</script>

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/w3c-import.log (270009 => 270010)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/w3c-import.log	2020-11-19 03:38:21 UTC (rev 270009)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/w3c-import.log	2020-11-19 03:40:20 UTC (rev 270010)
@@ -17,8 +17,14 @@
 /LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/File-constructor-endings.html
 /LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/File-constructor.html
 /LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/Worker-read-file-constructor.worker.js
+/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-form-controls.tentative.html
 /LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-form-iso-2022-jp.tentative.html
+/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-form-punctuation.tentative.html
 /LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-form-utf-8.html
 /LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-form-windows-1252.tentative.html
 /LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-form-x-user-defined.tentative.html
 /LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-form.html
+/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-formdata-controls.tentative.html
+/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-formdata-punctuation.tentative.html
+/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-formdata-utf-8.html
+/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-formdata.html

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/fileReader-expected.txt (270009 => 270010)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/fileReader-expected.txt	2020-11-19 03:38:21 UTC (rev 270009)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/fileReader-expected.txt	2020-11-19 03:40:20 UTC (rev 270010)
@@ -3,5 +3,4 @@
 PASS no-argument FileReader constructor
 PASS FileReader States -- abort
 PASS FileReader States -- events
-PASS FileReader States -- abort during progress
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/fileReader.html (270009 => 270010)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/fileReader.html	2020-11-19 03:38:21 UTC (rev 270009)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/fileReader.html	2020-11-19 03:40:20 UTC (rev 270010)
@@ -35,7 +35,6 @@
                 assert_equals(fileReader.readyState, FileReader.DONE);
                 t_abort.done();
             });
-            fileReader._onerror_ = this.unreached_func("onerror should not be called when abort is called");
             fileReader.abort();
             fileReader._onabort_ = this.unreached_func("abort event should fire sync")
         });
@@ -63,31 +62,6 @@
                 t_event.done();
             });
         });
-
-        var t_abort_during_progress = async_test("FileReader States -- abort during progress");
-        t_abort_during_progress.step(function() {
-            var fileReader = new FileReader();
-
-            var blob = new Blob([1]);
-            fileReader.readAsArrayBuffer(blob);
-
-            var _onprogressCalled_ = false;
-            fileReader._onprogress_ = this.step_func(function(e) {
-                _onprogressCalled_ = true;
-                fileReader.abort();
-            });
-
-            fileReader._onabort_ = this.step_func(function(e) {
-                assert_unreached("onabort should not be called if abort is called during final onprogress");
-            });
-
-            fileReader._onloadend_ = this.step_func(function(e) {
-                assert_true(onprogressCalled, "onprogress should be called before onloadend");
-                setTimeout(function() {
-                    t_abort_during_progress.done();
-                }, 0);
-            });
-        });
     </script>
   </body>
 </html>

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/support/send-file-form-helper.js (270009 => 270010)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/support/send-file-form-helper.js	2020-11-19 03:38:21 UTC (rev 270009)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/support/send-file-form-helper.js	2020-11-19 03:40:20 UTC (rev 270010)
@@ -1,5 +1,17 @@
 'use strict';
 
+// See /FileAPI/file/resources/echo-content-escaped.py
+function escapeString(string) {
+  return string.replace(/\\/g, "\\\\").replace(
+    /[^\x20-\x7E]/g,
+    (x) => {
+      let hex = x.charCodeAt(0).toString(16);
+      if (hex.length < 2) hex = "0" + hex;
+      return `\\x${hex}`;
+    },
+  ).replace(/\\x0d\\x0a/g, "\r\n");
+}
+
 // Rationale for this particular test character sequence, which is
 // used in filenames and also in file contents:
 //
@@ -72,36 +84,46 @@
 // are also allowed in Windows Unicode filenames.
 const kTestChars = 'ABC~‾¥≈¤・・•∙·☼★星🌟星★☼·∙•・・¤≈¥‾~XYZ';
 
-// NOTE: The expected interpretation of ISO-2022-JP according to
-// https://encoding.spec.whatwg.org/#iso-2022-jp-encoder unifies
-// single-byte and double-byte katakana.
-const kTestFallbackIso2022jp =
-      ('ABC~\x1B(J~\\≈¤\x1B$B!&!&\x1B(B•∙·☼\x1B$B!z@1\x1B(B🌟' +
-       '\x1B$B@1!z\x1B(B☼·∙•\x1B$B!&!&\x1B(B¤≈\x1B(J\\~\x1B(B~XYZ').replace(
-             /[^\0-\x7F]/gu,
-           x => `&#${x.codePointAt(0)};`);
+// The kTestFallback* strings represent the expected byte sequence from
+// encoding kTestChars with the given encoding with "html" replacement
+// mode, isomorphic-decoded. That means, characters that can't be
+// encoded in that encoding get HTML-escaped, but no further
+// `escapeString`-like escapes are needed.
+const kTestFallbackUtf8 = (
+  "ABC~\xE2\x80\xBE\xC2\xA5\xE2\x89\x88\xC2\xA4\xEF\xBD\xA5\xE3\x83\xBB\xE2" +
+    "\x80\xA2\xE2\x88\x99\xC2\xB7\xE2\x98\xBC\xE2\x98\x85\xE6\x98\x9F\xF0\x9F" +
+    "\x8C\x9F\xE6\x98\x9F\xE2\x98\x85\xE2\x98\xBC\xC2\xB7\xE2\x88\x99\xE2\x80" +
+    "\xA2\xE3\x83\xBB\xEF\xBD\xA5\xC2\xA4\xE2\x89\x88\xC2\xA5\xE2\x80\xBE~XYZ"
+);
 
-// NOTE: \uFFFD is used here to replace Windows-1252 bytes to match
-// how we will see them in the reflected POST bytes in a frame using
-// UTF-8 byte interpretation. The bytes will actually be intact, but
-// this code cannot tell and does not really care.
-const kTestFallbackWindows1252 =
-      'ABC~‾\xA5≈\xA4・・\x95∙\xB7☼★星🌟星★☼\xB7∙\x95・・\xA4≈\xA5‾~XYZ'.replace(
-            /[^\0-\xFF]/gu,
-          x => `&#${x.codePointAt(0)};`).replace(/[\x80-\xFF]/g, '\uFFFD');
+const kTestFallbackIso2022jp = (
+  ("ABC~\x1B(J~\\≈¤\x1B$B!&!&\x1B(B•∙·☼\x1B$B!z@1\x1B(B🌟" +
+    "\x1B$B@1!z\x1B(B☼·∙•\x1B$B!&!&\x1B(B¤≈\x1B(J\\~\x1B(B~XYZ")
+    .replace(/[^\0-\x7F]/gu, (x) => `&#${x.codePointAt(0)};`)
+);
 
-const kTestFallbackXUserDefined =
-      kTestChars.replace(/[^\0-\x7F]/gu, x => `&#${x.codePointAt(0)};`);
+const kTestFallbackWindows1252 = (
+  "ABC~‾\xA5≈\xA4・・\x95∙\xB7☼★星🌟星★☼\xB7∙\x95・・\xA4≈\xA5‾~XYZ".replace(
+    /[^\0-\xFF]/gu,
+    (x) => `&#${x.codePointAt(0)};`,
+  )
+);
 
+const kTestFallbackXUserDefined = kTestChars.replace(
+  /[^\0-\x7F]/gu,
+  (x) => `&#${x.codePointAt(0)};`,
+);
+
 // formPostFileUploadTest - verifies multipart upload structure and
 // numeric character reference replacement for filenames, field names,
-// and field values.
+// and field values using form submission.
 //
-// Uses /fetch/api/resources/echo-content.py to echo the upload
-// POST with UTF-8 byte interpretation, leading to the "UTF-8 goggles"
-// behavior documented below for expectedEncodedBaseName when non-
-// UTF-8-compatible byte sequences appear in the formEncoding-encoded
-// uploaded data.
+// Uses /FileAPI/file/resources/echo-content-escaped.py to echo the
+// upload POST with controls and non-ASCII bytes escaped. This is done
+// because navigations whose response body contains [\0\b\v] may get
+// treated as a download, which is not what we want. Use the
+// `escapeString` function to replicate that kind of escape (note that
+// it takes an isomorphic-decoded string, not a byte sequence).
 //
 // Fields in the parameter object:
 //
@@ -114,10 +136,9 @@
 // - formEncoding: the acceptCharset of the form used to submit the
 //   test file. Used in the test name.
 // - expectedEncodedBaseName: the expected formEncoding-encoded
-//   version of fileBaseName with unencodable characters replaced by
-//   numeric character references and non-7-bit-ASCII bytes seen
-//   through UTF-8 goggles; subsequences not interpretable as UTF-8
-//   have each byte represented here by \uFFFD REPLACEMENT CHARACTER.
+//   version of fileBaseName, isomorphic-decoded. That means, characters
+//   that can't be encoded in that encoding get HTML-escaped, but no
+//   further `escapeString`-like escapes are needed.
 const formPostFileUploadTest = ({
   fileNameSource,
   fileBaseName,
@@ -140,7 +161,7 @@
 
     const form = Object.assign(document.createElement('form'), {
       acceptCharset: formEncoding,
-      action: '/fetch/api/resources/echo-content.py',
+      action: '/FileAPI/file/resources/echo-content-escaped.py',
       method: 'POST',
       enctype: 'multipart/form-data',
       target: formTargetFrame.name,
@@ -194,7 +215,7 @@
       // exposed through the newer .files[0].name API. This check
       // verifies that assumption.
       assert_equals(
-          fileInput.files[0].name,
+          baseNameOfFilePath(fileInput.files[0].name),
           baseNameOfFilePath(fileInput.value),
           `The basename of the field's value should match its files[0].name`);
       form.submit();
@@ -219,6 +240,15 @@
         `${fileBaseName}: multipart form data must end with ${boundary}--: ${
              JSON.stringify(formDataText)
            }`);
+
+    const asValue = expectedEncodedBaseName.replace(/\r\n?|\n/g, "\r\n");
+    const asName = asValue.replace(/[\r\n"]/g, encodeURIComponent);
+    const asFilename = expectedEncodedBaseName.replace(/[\r\n"]/g, encodeURIComponent);
+
+    // The response body from echo-content-escaped.py has controls and non-ASCII
+    // bytes escaped, so any caller-provided field that might contain such bytes
+    // must be passed to `escapeString`, after any other expected
+    // transformations.
     const expectedText = [
       boundary,
       'Content-Disposition: form-data; name="_charset_"',
@@ -227,19 +257,22 @@
       boundary,
       'Content-Disposition: form-data; name="filename"',
       '',
-      expectedEncodedBaseName,
+      // Unlike for names and filenames, multipart/form-data values don't escape
+      // \r\n linebreaks, and when they're read from an iframe they become \n.
+      escapeString(asValue).replace(/\r\n/g, "\n"),
       boundary,
-      `Content-Disposition: form-data; name="${expectedEncodedBaseName}"`,
+      `Content-Disposition: form-data; name="${escapeString(asName)}"`,
       '',
       'filename',
       boundary,
       `Content-Disposition: form-data; name="file"; ` +
-          `filename="${expectedEncodedBaseName}"`,
+          `filename="${escapeString(asFilename)}"`,
       'Content-Type: text/plain',
       '',
-      kTestChars,
+      escapeString(kTestFallbackUtf8),
       boundary + '--',
     ].join('\n');
+
     assert_true(
         formDataText.startsWith(expectedText),
         `Unexpected multipart-shaped form data received:\n${

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/support/send-file-formdata-helper.js (0 => 270010)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/support/send-file-formdata-helper.js	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/support/send-file-formdata-helper.js	2020-11-19 03:40:20 UTC (rev 270010)
@@ -0,0 +1,97 @@
+"use strict";
+
+const kTestChars = "ABC~‾¥≈¤・・•∙·☼★星🌟星★☼·∙•・・¤≈¥‾~XYZ";
+
+// formDataPostFileUploadTest - verifies multipart upload structure and
+// numeric character reference replacement for filenames, field names,
+// and field values using FormData and fetch().
+//
+// Uses /fetch/api/resources/echo-content.py to echo the upload
+// POST (unlike in send-file-form-helper.js, here we expect all
+// multipart/form-data request bodies to be UTF-8, so we don't need to
+// escape controls and non-ASCII bytes).
+//
+// Fields in the parameter object:
+//
+// - fileNameSource: purely explanatory and gives a clue about which
+//   character encoding is the source for the non-7-bit-ASCII parts of
+//   the fileBaseName, or Unicode if no smaller-than-Unicode source
+//   contains all the characters. Used in the test name.
+// - fileBaseName: the not-necessarily-just-7-bit-ASCII file basename
+//   used for the constructed test file. Used in the test name.
+const formDataPostFileUploadTest = ({
+  fileNameSource,
+  fileBaseName,
+}) => {
+  promise_test(async (testCase) => {
+    const formData = new FormData();
+    let file = new Blob([kTestChars], { type: "text/plain" });
+    try {
+      // Switch to File in browsers that allow this
+      file = new File([file], fileBaseName, { type: file.type });
+    } catch (ignoredException) {
+    }
+
+    // Used to verify that the browser agrees with the test about
+    // field value replacement and encoding independently of file system
+    // idiosyncracies.
+    formData.append("filename", fileBaseName);
+
+    // Same, but with name and value reversed to ensure field names
+    // get the same treatment.
+    formData.append(fileBaseName, "filename");
+
+    formData.append("file", file, fileBaseName);
+
+    const formDataText = await (await fetch(
+      `/fetch/api/resources/echo-content.py`,
+      {
+        method: "POST",
+        body: formData,
+      },
+    )).text();
+    const formDataLines = formDataText.split("\r\n");
+    if (formDataLines.length && !formDataLines[formDataLines.length - 1]) {
+      --formDataLines.length;
+    }
+    assert_greater_than(
+      formDataLines.length,
+      2,
+      `${fileBaseName}: multipart form data must have at least 3 lines: ${
+        JSON.stringify(formDataText)
+      }`,
+    );
+    const boundary = formDataLines[0];
+    assert_equals(
+      formDataLines[formDataLines.length - 1],
+      boundary + "--",
+      `${fileBaseName}: multipart form data must end with ${boundary}--: ${
+        JSON.stringify(formDataText)
+      }`,
+    );
+
+    const asName = fileBaseName.replace(/[\r\n"]/g, encodeURIComponent);
+    const expectedText = [
+      boundary,
+      'Content-Disposition: form-data; name="filename"',
+      "",
+      fileBaseName,
+      boundary,
+      `Content-Disposition: form-data; name="${asName}"`,
+      "",
+      "filename",
+      boundary,
+      `Content-Disposition: form-data; name="file"; ` +
+      `filename="${asName}"`,
+      "Content-Type: text/plain",
+      "",
+      kTestChars,
+      boundary + "--",
+    ].join("\r\n");
+
+    assert_true(
+      formDataText.startsWith(expectedText),
+      `Unexpected multipart-shaped form data received:\n${formDataText}\nExpected:\n${expectedText}`,
+    );
+  }, `Upload ${fileBaseName} (${fileNameSource}) in fetch with FormData`);
+};

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/support/w3c-import.log (270009 => 270010)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/support/w3c-import.log	2020-11-19 03:38:21 UTC (rev 270009)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/support/w3c-import.log	2020-11-19 03:40:20 UTC (rev 270010)
@@ -19,5 +19,6 @@
 /LayoutTests/imported/w3c/web-platform-tests/FileAPI/support/historical-serviceworker.js
 /LayoutTests/imported/w3c/web-platform-tests/FileAPI/support/incumbent.sub.html
 /LayoutTests/imported/w3c/web-platform-tests/FileAPI/support/send-file-form-helper.js
+/LayoutTests/imported/w3c/web-platform-tests/FileAPI/support/send-file-formdata-helper.js
 /LayoutTests/imported/w3c/web-platform-tests/FileAPI/support/upload.txt
 /LayoutTests/imported/w3c/web-platform-tests/FileAPI/support/url-origin.html

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/url/url-charset.window-expected.txt (0 => 270010)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/url/url-charset.window-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/url/url-charset.window-expected.txt	2020-11-19 03:40:20 UTC (rev 270010)
@@ -0,0 +1,4 @@
+
+FAIL Blob charset should override any auto-detected charset. assert_equals: expected "UTF-8" but got "windows-1252"
+FAIL Blob charset should override <meta charset>. assert_equals: expected "UTF-8" but got "windows-1252"
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/url/url-charset.window.html (0 => 270010)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/url/url-charset.window.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/url/url-charset.window.html	2020-11-19 03:40:20 UTC (rev 270010)
@@ -0,0 +1 @@
+<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/url/url-charset.window.js (0 => 270010)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/url/url-charset.window.js	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/url/url-charset.window.js	2020-11-19 03:40:20 UTC (rev 270010)
@@ -0,0 +1,34 @@
+async_test(t => {
+  // This could be detected as ISO-2022-JP, in which case there would be no
+  // <textarea>, and thus the script inside would be interpreted as actual
+  // script.
+  const blob = new Blob(
+      [
+        `aaa\u001B$@<textarea>\u001B(B<script>/* xss */<\/script></textarea>bbb`
+      ],
+      {type: 'text/html;charset=utf-8'});
+  const url = ""
+  const win = window.open(url);
+  t.add_cleanup(() => {
+    win.close();
+  });
+
+  win._onload_ = t.step_func_done(() => {
+    assert_equals(win.document.charset, 'UTF-8');
+  });
+}, 'Blob charset should override any auto-detected charset.');
+
+async_test(t => {
+  const blob = new Blob(
+      [`<!doctype html>\n<meta charset="ISO-8859-1">`],
+      {type: 'text/html;charset=utf-8'});
+  const url = ""
+  const win = window.open(url);
+  t.add_cleanup(() => {
+    win.close();
+  });
+
+  win._onload_ = t.step_func_done(() => {
+    assert_equals(win.document.charset, 'UTF-8');
+  });
+}, 'Blob charset should override <meta charset>.');

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/url/w3c-import.log (270009 => 270010)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/url/w3c-import.log	2020-11-19 03:38:21 UTC (rev 270009)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/url/w3c-import.log	2020-11-19 03:40:20 UTC (rev 270010)
@@ -18,6 +18,7 @@
 /LayoutTests/imported/w3c/web-platform-tests/FileAPI/url/multi-global-origin-serialization.sub.html
 /LayoutTests/imported/w3c/web-platform-tests/FileAPI/url/sandboxed-iframe.html
 /LayoutTests/imported/w3c/web-platform-tests/FileAPI/url/unicode-origin.sub.html
+/LayoutTests/imported/w3c/web-platform-tests/FileAPI/url/url-charset.window.js
 /LayoutTests/imported/w3c/web-platform-tests/FileAPI/url/url-format.any.js
 /LayoutTests/imported/w3c/web-platform-tests/FileAPI/url/url-in-tags-revoke.window.js
 /LayoutTests/imported/w3c/web-platform-tests/FileAPI/url/url-in-tags.window.js
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to