Diff
Modified: trunk/LayoutTests/ChangeLog (144676 => 144677)
--- trunk/LayoutTests/ChangeLog 2013-03-04 22:26:44 UTC (rev 144676)
+++ trunk/LayoutTests/ChangeLog 2013-03-04 22:28:11 UTC (rev 144677)
@@ -1,3 +1,19 @@
+2013-03-04 Victor Costan <[email protected]>
+
+ Filename passed to FormData.append() takes precedence over filename in
+ File.
+ https://bugs.webkit.org/show_bug.cgi?id=111255
+
+ Reviewed by Alexey Proskuryakov.
+
+ (runTest):
+ * http/tests/local/formdata/send-form-data-with-filename-expected.txt: Added.
+ * http/tests/local/formdata/send-form-data-with-filename.html: Added.
+ * http/tests/local/formdata/send-form-data-with-sliced-file-expected.txt: Updated
+ to reflect the behavior specified in the XMLHttpRequest W3C spec.
+ * platform/wk2/TestExpectations: newly added test doesn't work in
+ WebKit2 because beginDragWithFiles is not implemented
+
2013-03-04 Alexis Hetu <[email protected]>
Canvas and DOM go out of sync
Added: trunk/LayoutTests/http/tests/local/formdata/send-form-data-with-filename-expected.txt (0 => 144677)
--- trunk/LayoutTests/http/tests/local/formdata/send-form-data-with-filename-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/local/formdata/send-form-data-with-filename-expected.txt 2013-03-04 22:28:11 UTC (rev 144677)
@@ -0,0 +1,11 @@
+Test for sending FormData via XMLHttpRequest.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Sending FormData containing one file with custom filename:
+file1=custom-name.txt:text/plain:1234567890
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/http/tests/local/formdata/send-form-data-with-filename.html (0 => 144677)
--- trunk/LayoutTests/http/tests/local/formdata/send-form-data-with-filename.html (rev 0)
+++ trunk/LayoutTests/http/tests/local/formdata/send-form-data-with-filename.html 2013-03-04 22:28:11 UTC (rev 144677)
@@ -0,0 +1,33 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src=""
+<script>
+description("Test for sending FormData via XMLHttpRequest.");
+
+function runTest()
+{
+ debug("Sending FormData containing one file with custom filename:");
+ testSendingFormData([
+ { 'type': 'file', 'name': 'file1', 'value': '../resources/file-for-drag-to-send.txt', 'filename': 'custom-name.txt' }
+ ]);
+}
+
+if (window.eventSender) {
+ runTest();
+ formDataTestingCleanup();
+} else {
+ testFailed("This test is not interactive, please run using DumpRenderTree");
+}
+
+var successfullyParsed = true;
+</script>
+<script src=""
+</body>
+</html>
+
Modified: trunk/LayoutTests/http/tests/local/formdata/send-form-data-with-sliced-file-expected.txt (144676 => 144677)
--- trunk/LayoutTests/http/tests/local/formdata/send-form-data-with-sliced-file-expected.txt 2013-03-04 22:26:44 UTC (rev 144676)
+++ trunk/LayoutTests/http/tests/local/formdata/send-form-data-with-sliced-file-expected.txt 2013-03-04 22:28:11 UTC (rev 144677)
@@ -12,7 +12,7 @@
Sending FormData containing one sliced file with optional non-null filename:
file=filename:application/octet-stream:23456
Sending FormData containing one complete file with optional non-null filename:
-file=file-for-drag-to-send.txt:text/plain:1234567890
+file=filename:text/plain:1234567890
Sending FormData containing one string and one sliced file:
string1=foo&file1=blob:application/octet-stream:23456
Sending FormData containing two strings and two sliced files:
Modified: trunk/LayoutTests/platform/wk2/TestExpectations (144676 => 144677)
--- trunk/LayoutTests/platform/wk2/TestExpectations 2013-03-04 22:26:44 UTC (rev 144676)
+++ trunk/LayoutTests/platform/wk2/TestExpectations 2013-03-04 22:28:11 UTC (rev 144677)
@@ -6,13 +6,13 @@
# are met:
#
# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
+# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
+# documentation and/or other materials provided with the distribution.
# 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
# its contributors may be used to endorse or promote products derived
-# from this software without specific prior written permission.
+# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
@@ -58,7 +58,7 @@
# Some compositing tests flakey
# <https://bugs.webkit.org/show_bug.cgi?id=48354>
compositing/iframes/iframe-size-from-zero.html
-compositing/iframes/iframe-src-change.html
+compositing/iframes/iframe-src-change.html
# Flakey on Snow Leopard Intel WebKit2 Release Tests
# <https://bugs.webkit.org/show_bug.cgi?id=57638>
@@ -78,7 +78,7 @@
http/tests/inspector/extensions-network-redirect.html
# Inspector only supports evaluation in content script world with v8, see https://bugs.webkit.org/show_bug.cgi?id=85709
-inspector/extensions/extensions-eval-content-script.html
+inspector/extensions/extensions-eval-content-script.html
inspector/extensions/extensions-audits-content-script.html
# A bunch of inspector tests time out on Lion Intel Debug WebKit2 testers.
@@ -881,6 +881,7 @@
http/tests/local/fileapi/send-dragged-file.html
http/tests/local/formdata/form-data-with-unknown-file-extension.html
http/tests/local/formdata/send-form-data-constructed-from-form.html
+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/upload-events.html
Modified: trunk/Source/WebCore/ChangeLog (144676 => 144677)
--- trunk/Source/WebCore/ChangeLog 2013-03-04 22:26:44 UTC (rev 144676)
+++ trunk/Source/WebCore/ChangeLog 2013-03-04 22:28:11 UTC (rev 144677)
@@ -1,3 +1,17 @@
+2013-03-04 Victor Costan <[email protected]>
+
+ Filename passed to FormData.append() takes precedence over filename in
+ File.
+ https://bugs.webkit.org/show_bug.cgi?id=111255
+
+ Reviewed by Alexey Proskuryakov.
+
+ Test: http/tests/local/formdata/send-form-data-with-filename.html
+
+ * platform/network/FormData.cpp:
+ (WebCore::FormData::appendKeyValuePairItems): changed to implement the
+ behavior in the XMLHttpRequest W3C spec.
+
2013-03-04 Alexis Hetu <[email protected]>
Canvas and DOM go out of sync
Modified: trunk/Source/WebCore/platform/network/FormData.cpp (144676 => 144677)
--- trunk/Source/WebCore/platform/network/FormData.cpp 2013-03-04 22:26:44 UTC (rev 144676)
+++ trunk/Source/WebCore/platform/network/FormData.cpp 2013-03-04 22:28:11 UTC (rev 144677)
@@ -242,6 +242,10 @@
name = generatedFileName;
}
}
+
+ // If a filename is passed in FormData.append(), use it instead of the file blob's name.
+ if (!value.filename().isEmpty())
+ name = value.filename();
} else {
// For non-file blob, use the filename if it is passed in FormData.append().
if (!value.filename().isEmpty())