Changeset 285861 in webkit
- Timestamp:
- Nov 16, 2021 7:24:18 AM (8 months ago)
- Location:
- trunk
- Files:
-
- 4 edited
-
LayoutTests/imported/w3c/ChangeLog (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/form-submission-0/form-data-set-empty-file.window-expected.txt (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/html/FileInputType.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/imported/w3c/ChangeLog
r285857 r285861 1 2021-11-16 Andreu Botella <andreu@andreubotella.com> 2 3 Empty <input type=file> is represented incorrectly in FormData 4 https://bugs.webkit.org/show_bug.cgi?id=185416 5 6 Reviewed by Chris Dumez. 7 8 * web-platform-tests/html/semantics/forms/form-submission-0/form-data-set-empty-file.window-expected.txt: 9 1 10 2021-11-16 Commit Queue <commit-queue@webkit.org> 2 11 -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/form-submission-0/form-data-set-empty-file.window-expected.txt
r285808 r285861 1 1 2 FAIL Empty <input type=file> is still added to the form's entry list assert_equals: type expected "application/octet-stream" but got "" 2 PASS Empty <input type=file> is still added to the form's entry list 3 3 PASS Empty <input type=file> shows up in the urlencoded serialization 4 4 PASS Empty <input type=file> shows up in the multipart/form-data serialization -
trunk/Source/WebCore/ChangeLog
r285860 r285861 1 2021-11-16 Andreu Botella <andreu@andreubotella.com> 2 3 Empty <input type=file> is represented incorrectly in FormData 4 https://bugs.webkit.org/show_bug.cgi?id=185416 5 6 Reviewed by Chris Dumez. 7 8 When a FormData object is constructed from a form, an empty <input type="file"> control will 9 be represented as an empty file with an empty filename. According to the HTML spec, this 10 file must have "application/octet-stream" as its content type. WebKit has the empty string 11 instead. This change brings WebKit into alignment with the standard and with Firefox and 12 Chrome in this area. 13 14 Tests: imported/w3c/web-platform-tests/html/semantics/forms/form-submission-0/form-data-set-empty-file.window.html 15 16 * html/FileInputType.cpp: 17 (WebCore::FileInputType::appendFormData const): 18 1 19 2021-11-16 Alan Bujtas <zalan@apple.com> 2 20 -
trunk/Source/WebCore/html/FileInputType.cpp
r285808 r285861 179 179 } 180 180 181 // If no filename at all is entered, return successful but empty. 182 // Null would be more logical, but Netscape posts an empty file. Argh. 181 // If no filename at all is entered, return successful but empty, with 182 // application/octet-stream content type. Null would be more logical, but 183 // Netscape posts an empty file. Argh. 183 184 if (fileList->isEmpty()) { 184 185 auto* document = element() ? &element()->document() : nullptr; 185 formData.append(name, File::create(document, emptyString())); 186 auto file = File::create( 187 document, 188 Blob::create(document, { }, "application/octet-stream"), 189 emptyString()); 190 formData.append(name, file); 186 191 return true; 187 192 }
Note: See TracChangeset
for help on using the changeset viewer.