Diff
Modified: trunk/LayoutTests/ChangeLog (145141 => 145142)
--- trunk/LayoutTests/ChangeLog 2013-03-07 22:40:05 UTC (rev 145141)
+++ trunk/LayoutTests/ChangeLog 2013-03-07 22:52:59 UTC (rev 145142)
@@ -1,3 +1,18 @@
+2013-03-07 Alexey Proskuryakov <[email protected]>
+
+ FormData should allow setting filename to empty
+ https://bugs.webkit.org/show_bug.cgi?id=111687
+
+ Reviewed by Brady Eidson.
+
+ * http/tests/local/formdata/send-form-data-with-empty-blob-filename-expected.txt: Added.
+ * http/tests/local/formdata/send-form-data-with-empty-blob-filename.html: Added.
+ * http/tests/local/formdata/send-form-data-with-empty-file-filename-expected.txt: Added.
+ * http/tests/local/formdata/send-form-data-with-empty-file-filename.html: Added.
+ * http/tests/xmlhttprequest/resources/multipart-post-echo-filenames.php: Added.
+
+ * platform/wk2/TestExpectations: Skip one of the tests, as it uses beginDragWithFiles.
+
2013-03-07 Roger Fong <[email protected]>
Unreviewed gardening AppleWin port.
Added: trunk/LayoutTests/http/tests/local/formdata/send-form-data-with-empty-blob-filename-expected.txt (0 => 145142)
--- trunk/LayoutTests/http/tests/local/formdata/send-form-data-with-empty-blob-filename-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/local/formdata/send-form-data-with-empty-blob-filename-expected.txt 2013-03-07 22:52:59 UTC (rev 145142)
@@ -0,0 +1,11 @@
+Test that filename passed to FormData.append() takes precedence over default Blob filename 'blob', even if empty.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Sending FormData containing one blob with custom empty filename:
+PASS filename is ''
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Property changes on: trunk/LayoutTests/http/tests/local/formdata/send-form-data-with-empty-blob-filename-expected.txt
___________________________________________________________________
Added: svn:mime-type
Added: svn:eol-style
Added: trunk/LayoutTests/http/tests/local/formdata/send-form-data-with-empty-blob-filename.html (0 => 145142)
--- trunk/LayoutTests/http/tests/local/formdata/send-form-data-with-empty-blob-filename.html (rev 0)
+++ trunk/LayoutTests/http/tests/local/formdata/send-form-data-with-empty-blob-filename.html 2013-03-07 22:52:59 UTC (rev 145142)
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script>
+description("Test that filename passed to FormData.append() takes precedence over default Blob filename 'blob', even if empty.");
+
+self.jsTestIsAsync = true;
+
+function runTest()
+{
+ debug("Sending FormData containing one blob with custom empty filename:");
+
+ var formData = new FormData;
+ formData.append("blob", new Blob([""]), "");
+ var xhr = new XMLHttpRequest();
+ xhr.open("POST", "http://127.0.0.1:8000/xmlhttprequest/resources/multipart-post-echo-filenames.php", true);
+ xhr._onload_ = function() {
+ filename = xhr.responseText;
+ shouldBe("filename", "''");
+ finishJSTest();
+ }
+ xhr.send(formData);
+}
+
+runTest();
+
+var successfullyParsed = true;
+</script>
+<script src=""
+</body>
+</html>
+
Property changes on: trunk/LayoutTests/http/tests/local/formdata/send-form-data-with-empty-blob-filename.html
___________________________________________________________________
Added: svn:mime-type
Added: trunk/LayoutTests/http/tests/local/formdata/send-form-data-with-empty-file-filename-expected.txt (0 => 145142)
--- trunk/LayoutTests/http/tests/local/formdata/send-form-data-with-empty-file-filename-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/local/formdata/send-form-data-with-empty-file-filename-expected.txt 2013-03-07 22:52:59 UTC (rev 145142)
@@ -0,0 +1,11 @@
+Test that filename passed to FormData.append() takes precedence over filename in File, even if empty.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Sending FormData containing one file with custom empty filename:
+PASS filename is ''
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Property changes on: trunk/LayoutTests/http/tests/local/formdata/send-form-data-with-empty-file-filename-expected.txt
___________________________________________________________________
Added: svn:mime-type
Added: svn:eol-style
Added: trunk/LayoutTests/http/tests/local/formdata/send-form-data-with-empty-file-filename.html (0 => 145142)
--- trunk/LayoutTests/http/tests/local/formdata/send-form-data-with-empty-file-filename.html (rev 0)
+++ trunk/LayoutTests/http/tests/local/formdata/send-form-data-with-empty-file-filename.html 2013-03-07 22:52:59 UTC (rev 145142)
@@ -0,0 +1,52 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src=""
+<script>
+description("Test that filename passed to FormData.append() takes precedence over filename in File, even if empty.");
+
+self.jsTestIsAsync = true;
+
+function runTest()
+{
+ debug("Sending FormData containing one file with custom empty filename:");
+
+ var input = document.getElementsByTagName("input")[0];
+ if (window.eventSender) {
+ eventSender.beginDragWithFiles(['../resources/file-for-drag-to-send.txt']);
+ moveMouseToCenterOfElement(input);
+ eventSender.mouseUp();
+ }
+
+ var formData = new FormData;
+ formData.append("file", input.files[0], "");
+ var xhr = new XMLHttpRequest();
+ xhr.open("POST", "http://127.0.0.1:8000/xmlhttprequest/resources/multipart-post-echo-filenames.php", true);
+ xhr._onload_ = function() {
+ filename = xhr.responseText;
+ shouldBe("filename", "''");
+ formDataTestingCleanup();
+ finishJSTest();
+ }
+
+ xhr.send(formData);
+}
+
+if (window.eventSender) {
+ runTest();
+} else {
+ debug("To run this test manually, please drag a file onto file input above");
+ document.getElementsByTagName("input")[0]._onchange_ = runTest;
+}
+
+var successfullyParsed = true;
+</script>
+<script src=""
+</body>
+</html>
+
Property changes on: trunk/LayoutTests/http/tests/local/formdata/send-form-data-with-empty-file-filename.html
___________________________________________________________________
Added: svn:mime-type
Modified: trunk/LayoutTests/http/tests/misc/empty-file-formdata.html (145141 => 145142)
--- trunk/LayoutTests/http/tests/misc/empty-file-formdata.html 2013-03-07 22:40:05 UTC (rev 145141)
+++ trunk/LayoutTests/http/tests/misc/empty-file-formdata.html 2013-03-07 22:52:59 UTC (rev 145142)
@@ -15,7 +15,7 @@
</script>
</head>
<body>
-<form enctype="multipart/form-data" method="POST" action=""
+<form enctype="multipart/form-data" method="POST" action=""
<input name="data" type="file"></input>
</form>
</body>
Added: trunk/LayoutTests/http/tests/xmlhttprequest/resources/multipart-post-echo-filenames.php (0 => 145142)
--- trunk/LayoutTests/http/tests/xmlhttprequest/resources/multipart-post-echo-filenames.php (rev 0)
+++ trunk/LayoutTests/http/tests/xmlhttprequest/resources/multipart-post-echo-filenames.php 2013-03-07 22:52:59 UTC (rev 145142)
@@ -0,0 +1,9 @@
+<?php
+$first = True;
+foreach ($_FILES as $file) {
+ if (!$first)
+ echo ",";
+ echo $file['name'];
+ $first = False;
+}
+?>
Modified: trunk/LayoutTests/platform/wk2/TestExpectations (145141 => 145142)
--- trunk/LayoutTests/platform/wk2/TestExpectations 2013-03-07 22:40:05 UTC (rev 145141)
+++ trunk/LayoutTests/platform/wk2/TestExpectations 2013-03-07 22:52:59 UTC (rev 145142)
@@ -868,6 +868,7 @@
http/tests/local/formdata/send-form-data-with-filename.html
http/tests/local/formdata/send-form-data-with-sliced-file.html
http/tests/local/formdata/send-form-data.html
+http/tests/local/formdata/send-form-data-with-empty-file-filename.html
http/tests/local/formdata/upload-events.html
http/tests/security/clipboard/clipboard-file-access.html
media/video-src-blob.html
Modified: trunk/Source/WebCore/ChangeLog (145141 => 145142)
--- trunk/Source/WebCore/ChangeLog 2013-03-07 22:40:05 UTC (rev 145141)
+++ trunk/Source/WebCore/ChangeLog 2013-03-07 22:52:59 UTC (rev 145142)
@@ -1,3 +1,17 @@
+2013-03-07 Alexey Proskuryakov <[email protected]>
+
+ FormData should allow setting filename to empty
+ https://bugs.webkit.org/show_bug.cgi?id=111687
+
+ Reviewed by Brady Eidson.
+
+ Tests: http/tests/local/formdata/send-form-data-with-empty-blob-filename.html
+ http/tests/local/formdata/send-form-data-with-empty-file-filename.html
+
+ * platform/network/FormData.cpp: (WebCore::FormData::appendKeyValuePairItems):
+ Missing value is a null string. If the string is empty, we should treat is as
+ authoritative.
+
2013-03-07 David Hyatt <[email protected]>
REGRESSION: fast/border/border-fit-2.html needs updating
Modified: trunk/Source/WebCore/platform/network/FormData.cpp (145141 => 145142)
--- trunk/Source/WebCore/platform/network/FormData.cpp 2013-03-07 22:40:05 UTC (rev 145141)
+++ trunk/Source/WebCore/platform/network/FormData.cpp 2013-03-07 22:52:59 UTC (rev 145142)
@@ -244,11 +244,11 @@
}
// If a filename is passed in FormData.append(), use it instead of the file blob's name.
- if (!value.filename().isEmpty())
+ if (!value.filename().isNull())
name = value.filename();
} else {
// For non-file blob, use the filename if it is passed in FormData.append().
- if (!value.filename().isEmpty())
+ if (!value.filename().isNull())
name = value.filename();
else
name = "blob";