Commit 8b267dc3 authored by jianli@chromium.org's avatar jianli@chromium.org

WebCore: Add DOMFormData.idl to expose FormData interface.

https://bugs.webkit.org/show_bug.cgi?id=36024

Reviewed by Sam Weinig.

The implementation is based on XMLHttpRequest 2 spec:
http://dev.w3.org/2006/webapi/XMLHttpRequest-2/#formdata

Test: http/tests/local/send-form-data.html

* Android.derived.jscbindings.mk:
* Android.derived.v8bindings.mk:
* Android.jscbindings.mk:
* DerivedSources.cpp:
* DerivedSources.make:
* GNUmakefile.am:
* WebCore.pri:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSDOMFormDataCustom.cpp: Added.
* bindings/js/JSXMLHttpRequestCustom.cpp:
(WebCore::JSXMLHttpRequest::send):
* bindings/scripts/CodeGeneratorJS.pm:
* html/DOMFormData.idl: Added.
* page/DOMWindow.idl:

LayoutTests: Add DOMFormData.idl to expose FormData interface
https://bugs.webkit.org/show_bug.cgi?id=36024

Reviewed by Sam Weinig.

Add a layout test to test sending FormData via XMLHttpRequest. Also
changed all test results that are affected by exposing FormData.

* fast/dom/Window/window-properties-expected.txt:
* fast/dom/Window/window-property-descriptors-expected.txt:
* fast/dom/constructed-objects-prototypes-expected.txt:
* fast/dom/prototype-inheritance-2-expected.txt:
* fast/dom/prototype-inheritance-expected.txt:
* fast/js/global-constructors-expected.txt:
* http/tests/local/resources/send-form-data.js: Added.
* http/tests/local/send-form-data-expected.txt: Added.
* http/tests/local/send-form-data.html: Added.
* http/tests/xmlhttprequest/resources/multipart-post-echo.php: Added.
* platform/gtk/Skipped:
* platform/gtk/fast/dom/Window/window-properties-expected.txt:
* platform/qt/Skipped:
* platform/qt/fast/dom/Window/window-properties-expected.txt:
* platform/qt/fast/dom/Window/window-property-descriptors-expected.txt:
* platform/qt/fast/dom/prototype-inheritance-expected.txt:
* platform/qt/fast/js/global-constructors-expected.txt:
* platform/win/Skipped:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@56003 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 48a974ac
2010-03-15 Jian Li <jianli@chromium.org>
Reviewed by Sam Weinig.
Add DOMFormData.idl to expose FormData interface
https://bugs.webkit.org/show_bug.cgi?id=36024
Add a layout test to test sending FormData via XMLHttpRequest. Also
changed all test results that are affected by exposing FormData.
* fast/dom/Window/window-properties-expected.txt:
* fast/dom/Window/window-property-descriptors-expected.txt:
* fast/dom/constructed-objects-prototypes-expected.txt:
* fast/dom/prototype-inheritance-2-expected.txt:
* fast/dom/prototype-inheritance-expected.txt:
* fast/js/global-constructors-expected.txt:
* http/tests/local/resources/send-form-data.js: Added.
* http/tests/local/send-form-data-expected.txt: Added.
* http/tests/local/send-form-data.html: Added.
* http/tests/xmlhttprequest/resources/multipart-post-echo.php: Added.
* platform/gtk/Skipped:
* platform/gtk/fast/dom/Window/window-properties-expected.txt:
* platform/qt/Skipped:
* platform/qt/fast/dom/Window/window-properties-expected.txt:
* platform/qt/fast/dom/Window/window-property-descriptors-expected.txt:
* platform/qt/fast/dom/prototype-inheritance-expected.txt:
* platform/qt/fast/js/global-constructors-expected.txt:
* platform/win/Skipped:
2010-03-15 Patrik Persson <patrik.j.persson@ericsson.com>
Reviewed by Darin Adler.
......
......@@ -901,6 +901,9 @@ window.File.prototype [printed above as window.Blob.prototype]
window.FileList [object FileListConstructor]
window.FileList.prototype [object FileListPrototype]
window.FileList.prototype.item [function]
window.FormData [object FormDataConstructor]
window.FormData.prototype [object FormDataPrototype]
window.FormData.prototype.append [function]
window.HTMLAllCollection [object HTMLAllCollectionConstructor]
window.HTMLAllCollection.prototype [object HTMLAllCollectionPrototype]
window.HTMLAllCollection.prototype.item [function]
......
......@@ -49,6 +49,7 @@ PASS typeof Object.getOwnPropertyDescriptor(window, 'EventException') is 'object
PASS typeof Object.getOwnPropertyDescriptor(window, 'EventSource') is 'object'
PASS typeof Object.getOwnPropertyDescriptor(window, 'File') is 'object'
PASS typeof Object.getOwnPropertyDescriptor(window, 'FileList') is 'object'
PASS typeof Object.getOwnPropertyDescriptor(window, 'FormData') is 'object'
PASS typeof Object.getOwnPropertyDescriptor(window, 'Function') is 'object'
PASS typeof Object.getOwnPropertyDescriptor(window, 'HTMLAllCollection') is 'object'
PASS typeof Object.getOwnPropertyDescriptor(window, 'HTMLAnchorElement') is 'object'
......
......@@ -7,6 +7,8 @@ PASS (new inner.Audio()).isInner is true
PASS (new inner.Audio()).constructor.isInner is true
PASS (new inner.DOMParser()).isInner is true
PASS (new inner.DOMParser()).constructor.isInner is true
PASS (new inner.FormData()).isInner is true
PASS (new inner.FormData()).constructor.isInner is true
PASS (new inner.Image()).isInner is true
PASS (new inner.Image()).constructor.isInner is true
PASS (new inner.MessageChannel()).isInner is true
......
......@@ -221,6 +221,7 @@ Never found Entity
Never found EntityReference
Never found File
Never found FileList
Never found FormData
Never found HTMLAllCollection
Never found HTMLBaseElement
Never found HTMLBaseFontElement
......
......@@ -87,6 +87,8 @@ PASS inner.File.isInner is true
PASS inner.File.constructor.isInner is true
PASS inner.FileList.isInner is true
PASS inner.FileList.constructor.isInner is true
PASS inner.FormData.isInner is true
PASS inner.FormData.constructor.isInner is true
PASS inner.HTMLAllCollection.isInner is true
PASS inner.HTMLAllCollection.constructor.isInner is true
PASS inner.HTMLAnchorElement.isInner is true
......
......@@ -43,6 +43,7 @@ PASS Event.toString() is '[object EventConstructor]'
PASS EventException.toString() is '[object EventExceptionConstructor]'
PASS File.toString() is '[object FileConstructor]'
PASS FileList.toString() is '[object FileListConstructor]'
PASS FormData.toString() is '[object FormDataConstructor]'
PASS HTMLAllCollection.toString() is '[object HTMLAllCollectionConstructor]'
PASS HTMLAnchorElement.toString() is '[object HTMLAnchorElementConstructor]'
PASS HTMLAppletElement.toString() is '[object HTMLAppletElementConstructor]'
......
description("Test for sending FormData via XMLHttpRequest.");
var fileInput = document.createElement("input");
fileInput.type = 'file';
fileInput.style.width = "100%"; // So that any manual testing will show full file names
// Important that we put this at the top of the doc so that logging does not cause it to go out of view (where it can't be dragged to)
document.body.insertBefore(fileInput, document.body.firstChild);
function moveMouseToCenterOfElement(element)
{
var centerX = element.offsetLeft + element.offsetWidth / 2;
var centerY = element.offsetTop + element.offsetHeight / 2;
eventSender.mouseMoveTo(centerX, centerY);
}
function getFileName(filePath)
{
var index = filePath.lastIndexOf('/');
if (index == -1)
return filePath;
return filePath.substr(index + 1);
}
function sendFormData(formDataList)
{
var formData = new FormData();
for (var i = 0; i < formDataList.length; i++)
formData.append(formDataList[i]['name'], formDataList[i]['value']);
var xhr = new XMLHttpRequest();
xhr.open("POST", "http://127.0.0.1:8000/xmlhttprequest/resources/multipart-post-echo.php", false);
xhr.send(formData);
debug(xhr.responseText);
}
function testSendingFormData(dataList)
{
var filesToDrag = [];
for (var i = 0; i < dataList.length; i++) {
if (dataList[i]['type'] == 'file')
filesToDrag.push(dataList[i]['value']);
}
if (filesToDrag) {
eventSender.beginDragWithFiles(filesToDrag);
moveMouseToCenterOfElement(fileInput);
eventSender.mouseUp();
}
var files = fileInput.files;
var formDataList = [];
for (var i = 0; i < dataList.length; i++) {
if (dataList[i]['type'] == 'file') {
var fileName = getFileName(dataList[i]['value']);
for (var j = 0; j < files.length; j++) {
if (fileName == files[j].name) {
formDataList.push({'name': dataList[i]['name'], 'value': files[j]});
break;
}
}
} else {
formDataList.push({'name': dataList[i]['name'], 'value': dataList[i]['value']});
}
}
sendFormData(formDataList);
}
function runTest()
{
debug("Sending FormData containing one string with empty name:");
testSendingFormData([
{ 'type': 'string', 'name': '', 'value': 'foo' }
]);
debug("Sending FormData containing one file with empty name:");
testSendingFormData([
{ 'type': 'file', 'name': '', 'value': 'resources/file-for-drag-to-send.txt' }
]);
debug("Sending FormData containing one string:");
testSendingFormData([
{ 'type': 'string', 'name': 'string', 'value': 'foo' }
]);
debug("Sending FormData containing one file:");
testSendingFormData([
{ 'type': 'file', 'name': 'file', 'value': 'resources/file-for-drag-to-send.txt' }
]);
debug("Sending FormData containing one string and one file:");
testSendingFormData([
{ 'type': 'string', 'name': 'string1', 'value': 'foo' },
{ 'type': 'file', 'name': 'file1', 'value': 'resources/file-for-drag-to-send.txt' }
]);
debug("Sending FormData containing two strings and two files:");
testSendingFormData([
{ 'type': 'string', 'name': 'string1', 'value': 'foo' },
{ 'type': 'file', 'name': 'file1', 'value': 'resources/file-for-drag-to-send.txt' },
{ 'type': 'string', 'name': 'string2', 'value': 'bar' },
{ 'type': 'file', 'name': 'file2', 'value': 'resources/file-for-drag-to-send.txt' }
]);
}
if (window.eventSender) {
runTest();
// Clean up after ourselves
fileInput.parentNode.removeChild(fileInput);
} else {
testFailed("This test is not interactive, please run using DumpRenderTree");
}
var successfullyParsed = true;
Test for sending FormData via XMLHttpRequest.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Sending FormData containing one string with empty name:
Sending FormData containing one file with empty name:
Sending FormData containing one string:
string=foo
Sending FormData containing one file:
file=file-for-drag-to-send.txt:1234567890
Sending FormData containing one string and one file:
string1=foo&file1=file-for-drag-to-send.txt:1234567890
Sending FormData containing two strings and two files:
string1=foo&string2=bar&file1=file-for-drag-to-send.txt:1234567890&file2=file-for-drag-to-send.txt:1234567890
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<link rel="stylesheet" href="../../../fast/js/resources/js-test-style.css">
<script src="../../../fast/js/resources/js-test-pre.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<script src="resources/send-form-data.js"></script>
<script src="../../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
<?php
if (strpos($_SERVER['CONTENT_TYPE'], 'multipart/form-data; boundary=') != 0) {
echo 'Invalid Content-Types.';
return;
}
$values = array();
foreach ($_POST as $key => $value) {
$values[] = "$key=$value";
}
foreach ($_FILES as $key => $value) {
$file = $_FILES[$key];
if ($file['error']) {
echo 'Upload file error: ' . $file['error'];
return;
} else {
$fp = fopen($file['tmp_name'], 'r');
if ($fp) {
$content = fread($fp, $file['size']);
fclose($fp);
}
$values[] = $key . '=' . $file['name'] . ':' . $content;
}
}
echo join('&', $values);
?>
......@@ -3422,6 +3422,7 @@ http/tests/loading/slow-parsing-subframe.html
http/tests/loading/text-content-type-with-binary-extension.html
http/tests/local/send-dragged-file.html
http/tests/local/send-sliced-dragged-file.html
http/tests/local/send-form-data.html
http/tests/media/video-play-stall-seek.html
http/tests/media/video-play-stall.html
http/tests/media/video-seekable-stall.html
......
......@@ -872,6 +872,9 @@ window.File.prototype [object FilePrototype]
window.FileList [object FileListConstructor]
window.FileList.prototype [object FileListPrototype]
window.FileList.prototype.item [function]
window.FormData [object FormDataConstructor]
window.FormData.prototype [object FormDataPrototype]
window.FormData.prototype.append [function]
window.HTMLAnchorElement [object HTMLAnchorElementConstructor]
window.HTMLAnchorElement.prototype [printed above as window.Element.prototype]
window.HTMLAppletElement [object HTMLAppletElementConstructor]
......
......@@ -54,6 +54,7 @@ plugins/set-status.html
http/tests/local/drag-over-remote-content.html
http/tests/local/send-dragged-file.html
http/tests/local/send-sliced-dragged-file.html
http/tests/local/send-form-data.html
# Failing navigation tests
http/tests/navigation/anchor-frames.html
......
......@@ -901,6 +901,9 @@ window.File.prototype [printed above as window.Blob.prototype]
window.FileList [object FileListConstructor]
window.FileList.prototype [object FileListPrototype]
window.FileList.prototype.item [function]
window.FormData [object FormDataConstructor]
window.FormData.prototype [object FormDataPrototype]
window.FormData.prototype.append [function]
window.HTMLAllCollection [object HTMLAllCollectionConstructor]
window.HTMLAllCollection.prototype [object HTMLAllCollectionPrototype]
window.HTMLAllCollection.prototype.item [function]
......
......@@ -49,6 +49,7 @@ PASS typeof Object.getOwnPropertyDescriptor(window, 'EventException') is 'object
PASS typeof Object.getOwnPropertyDescriptor(window, 'EventSource') is 'object'
PASS typeof Object.getOwnPropertyDescriptor(window, 'File') is 'object'
PASS typeof Object.getOwnPropertyDescriptor(window, 'FileList') is 'object'
PASS typeof Object.getOwnPropertyDescriptor(window, 'FormData') is 'object'
PASS typeof Object.getOwnPropertyDescriptor(window, 'Function') is 'object'
PASS typeof Object.getOwnPropertyDescriptor(window, 'HTMLAllCollection') is 'object'
PASS typeof Object.getOwnPropertyDescriptor(window, 'HTMLAnchorElement') is 'object'
......
......@@ -87,6 +87,8 @@ PASS inner.File.isInner is true
PASS inner.File.constructor.isInner is true
PASS inner.FileList.isInner is true
PASS inner.FileList.constructor.isInner is true
PASS inner.FormData.isInner is true
PASS inner.FormData.constructor.isInner is true
PASS inner.HTMLAllCollection.isInner is true
PASS inner.HTMLAllCollection.constructor.isInner is true
PASS inner.HTMLAnchorElement.isInner is true
......
......@@ -43,6 +43,7 @@ PASS Event.toString() is '[object EventConstructor]'
PASS EventException.toString() is '[object EventExceptionConstructor]'
PASS File.toString() is '[object FileConstructor]'
PASS FileList.toString() is '[object FileListConstructor]'
PASS FormData.toString() is '[object FormDataConstructor]'
PASS HTMLAllCollection.toString() is '[object HTMLAllCollectionConstructor]'
PASS HTMLAnchorElement.toString() is '[object HTMLAnchorElementConstructor]'
PASS HTMLAppletElement.toString() is '[object HTMLAppletElementConstructor]'
......
......@@ -665,6 +665,7 @@ fast/forms/input-selectedoption.html
# <https://bugs.webkit.org/show_bug.cgi?id=29287>
http/tests/local/send-dragged-file.html
http/tests/local/send-sliced-dragged-file.html
http/tests/local/send-form-data.html
# <https://bugs.webkit.org/show_bug.cgi?id=29289>
plugins/destroy-during-npp-new.html
......
......@@ -153,6 +153,7 @@ $(patsubst %.h,%.cpp,$(GEN)): $(intermediates)/dom/%.cpp : $(intermediates)/dom/
# HTML
GEN := \
$(intermediates)/html/JSBlob.h \
$(intermediates)/html/JSDOMFormData.h \
$(intermediates)/html/JSDataGridColumn.h \
$(intermediates)/html/JSDataGridColumnList.h \
$(intermediates)/html/JSFile.h \
......
......@@ -513,6 +513,7 @@ $(patsubst %.h,%.cpp,$(GEN)): $(intermediates)/bindings/%.cpp : $(intermediates)
# XML
GEN := \
$(intermediates)/bindings/V8DOMFormData.h \
$(intermediates)/bindings/V8DOMParser.h \
$(intermediates)/bindings/V8XMLHttpRequest.h \
$(intermediates)/bindings/V8XMLHttpRequestException.h \
......
......@@ -84,6 +84,7 @@ LOCAL_SRC_FILES += \
bindings/js/JSDesktopNotificationsCustom.cpp \
bindings/js/JSDOMApplicationCacheCustom.cpp \
bindings/js/JSDOMBinding.cpp \
bindings/js/JSDOMFormDataCustom.cpp \
bindings/js/JSDOMGlobalObject.cpp \
bindings/js/JSDOMWindowBase.cpp \
bindings/js/JSDOMWindowCustom.cpp \
......
2010-03-15 Jian Li <jianli@chromium.org>
Reviewed by Sam Weinig.
Add DOMFormData.idl to expose FormData interface.
https://bugs.webkit.org/show_bug.cgi?id=36024
The implementation is based on XMLHttpRequest 2 spec:
http://dev.w3.org/2006/webapi/XMLHttpRequest-2/#formdata
Test: http/tests/local/send-form-data.html
* Android.derived.jscbindings.mk:
* Android.derived.v8bindings.mk:
* Android.jscbindings.mk:
* DerivedSources.cpp:
* DerivedSources.make:
* GNUmakefile.am:
* WebCore.pri:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSDOMFormDataCustom.cpp: Added.
* bindings/js/JSXMLHttpRequestCustom.cpp:
(WebCore::JSXMLHttpRequest::send):
* bindings/scripts/CodeGeneratorJS.pm:
* html/DOMFormData.idl: Added.
* page/DOMWindow.idl:
2010-03-15 Patrik Persson <patrik.j.persson@ericsson.com>
Reviewed by Darin Adler.
......
......@@ -71,6 +71,7 @@
#include "JSDocumentType.cpp"
#include "JSDOMApplicationCache.cpp"
#include "JSDOMCoreException.cpp"
#include "JSDOMFormData.cpp"
#include "JSDOMImplementation.cpp"
#include "JSDOMParser.cpp"
#include "JSDOMSelection.cpp"
......
......@@ -108,6 +108,7 @@ DOM_CLASSES = \
DedicatedWorkerContext \
DOMApplicationCache \
DOMCoreException \
DOMFormData \
DOMImplementation \
DOMParser \
DOMSelection \
......
......@@ -182,6 +182,7 @@ IDL_BINDINGS += \
WebCore/html/canvas/WebGLUnsignedShortArray.idl \
WebCore/html/DataGridColumn.idl \
WebCore/html/DataGridColumnList.idl \
WebCore/html/DOMFormData.idl \
WebCore/html/File.idl \
WebCore/html/FileList.idl \
WebCore/html/HTMLAllCollection.idl \
......@@ -380,6 +381,7 @@ webcore_sources += \
WebCore/bindings/js/JSCustomXPathNSResolver.h \
WebCore/bindings/js/JSDOMBinding.cpp \
WebCore/bindings/js/JSDOMBinding.h \
WebCore/bindings/js/JSDOMFormDataCustom.cpp \
WebCore/bindings/js/JSDOMGlobalObject.cpp \
WebCore/bindings/js/JSDOMGlobalObject.h \
WebCore/bindings/js/JSDOMWindowBase.cpp \
......
......@@ -312,6 +312,7 @@ IDL_BINDINGS += \
html/canvas/WebGLUnsignedShortArray.idl \
html/DataGridColumn.idl \
html/DataGridColumnList.idl \
html/DOMFormData.idl \
html/File.idl \
html/FileList.idl \
html/HTMLAllCollection.idl \
......
......@@ -289,6 +289,7 @@ SOURCES += \
bindings/js/JSDebugWrapperSet.cpp \
bindings/js/JSDocumentCustom.cpp \
bindings/js/JSDocumentFragmentCustom.cpp \
bindings/js/JSDOMFormDataCustom.cpp \
bindings/js/JSDOMGlobalObject.cpp \
bindings/js/JSDOMWindowBase.cpp \
bindings/js/JSDOMWindowCustom.cpp \
......
......@@ -2904,6 +2904,14 @@
RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSDOMCoreException.h"
>
</File>
<File
RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSDOMFormData.cpp"
>
</File>
<File
RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSDOMFormData.h"
>
</File>
<File
RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSDOMImplementation.cpp"
>
......@@ -35971,6 +35979,10 @@
RelativePath="..\bindings\js\JSDOMBinding.h"
>
</File>
<File
RelativePath="..\bindings\js\JSDOMFormDataCustom.cpp"
>
</File>
<File
RelativePath="..\bindings\js\JSDOMGlobalObject.cpp"
>
......
......@@ -594,6 +594,10 @@
29A8124B0FBB9CA900510293 /* AXObjectCacheMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 29A812470FBB9CA900510293 /* AXObjectCacheMac.mm */; };
2D9066060BE141D400956998 /* LayoutState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D9066040BE141D400956998 /* LayoutState.cpp */; };
2D9066070BE141D400956998 /* LayoutState.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D9066050BE141D400956998 /* LayoutState.h */; settings = {ATTRIBUTES = (Private, ); }; };
2E0888C4114883A900AF4265 /* DOMFormData.idl in Resources */ = {isa = PBXBuildFile; fileRef = 2E0888C3114883A900AF4265 /* DOMFormData.idl */; };
2E0888D41148848A00AF4265 /* JSDOMFormData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2E0888D21148848A00AF4265 /* JSDOMFormData.cpp */; };
2E0888D51148848A00AF4265 /* JSDOMFormData.h in Headers */ = {isa = PBXBuildFile; fileRef = 2E0888D31148848A00AF4265 /* JSDOMFormData.h */; };
2E0888E6114884E200AF4265 /* JSDOMFormDataCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2E0888E5114884E200AF4265 /* JSDOMFormDataCustom.cpp */; };
2E2D99CD10E2BBDA00496337 /* JSBlob.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2E2D99CB10E2BBDA00496337 /* JSBlob.cpp */; };
2E2D99CE10E2BBDA00496337 /* JSBlob.h in Headers */ = {isa = PBXBuildFile; fileRef = 2E2D99CC10E2BBDA00496337 /* JSBlob.h */; };
2E2D99E710E2BC1C00496337 /* DOMBlob.h in Headers */ = {isa = PBXBuildFile; fileRef = 2E2D99E510E2BC1C00496337 /* DOMBlob.h */; };
......@@ -5964,6 +5968,10 @@
2D9066050BE141D400956998 /* LayoutState.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = LayoutState.h; sourceTree = "<group>"; };
2D90660B0665D937006B6F1A /* ClipboardMac.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = ClipboardMac.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
2D90660C0665D937006B6F1A /* ClipboardMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ClipboardMac.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
2E0888C3114883A900AF4265 /* DOMFormData.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DOMFormData.idl; sourceTree = "<group>"; };
2E0888D21148848A00AF4265 /* JSDOMFormData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMFormData.cpp; sourceTree = "<group>"; };
2E0888D31148848A00AF4265 /* JSDOMFormData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDOMFormData.h; sourceTree = "<group>"; };
2E0888E5114884E200AF4265 /* JSDOMFormDataCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMFormDataCustom.cpp; sourceTree = "<group>"; };
2E2D99CB10E2BBDA00496337 /* JSBlob.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSBlob.cpp; sourceTree = "<group>"; };
2E2D99CC10E2BBDA00496337 /* JSBlob.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSBlob.h; sourceTree = "<group>"; };
2E2D99E510E2BC1C00496337 /* DOMBlob.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMBlob.h; sourceTree = "<group>"; };
......@@ -12895,6 +12903,7 @@
BC7DAAED0FF9615D00CE0138 /* DOMDataGridDataSource.h */,
2ED609BA1145B07100C8684E /* DOMFormData.cpp */,
2ED609BB1145B07100C8684E /* DOMFormData.h */,
2E0888C3114883A900AF4265 /* DOMFormData.idl */,
BCDBB8CC0E08958400C60FF6 /* File.cpp */,
BCDBB8CB0E08958400C60FF6 /* File.h */,
BC1881D90E08C4ED00048C13 /* File.idl */,
......@@ -13212,6 +13221,8 @@
BC77D1660FF19F550070887B /* JSDataGridColumn.h */,
BC77D1670FF19F550070887B /* JSDataGridColumnList.cpp */,
BC77D1680FF19F550070887B /* JSDataGridColumnList.h */,
2E0888D21148848A00AF4265 /* JSDOMFormData.cpp */,
2E0888D31148848A00AF4265 /* JSDOMFormData.h */,
BC00F0100E0A189500FD04E3 /* JSFile.cpp */,
BC00F0110E0A189500FD04E3 /* JSFile.h */,
BC00F0120E0A189500FD04E3 /* JSFileList.cpp */,
......@@ -14861,6 +14872,7 @@
49C7BA8C1042F5B10009D447 /* JSDocumentCustom.cpp */,
BCCE58AE1061E90C008FB35A /* JSDocumentFragmentCustom.cpp */,
1AC226160DB69F740089B669 /* JSDOMApplicationCacheCustom.cpp */,
2E0888E5114884E200AF4265 /* JSDOMFormDataCustom.cpp */,
BCD9C25E0C17AA67005C90A2 /* JSDOMWindowCustom.cpp */,
652FBBBB0DE27CB60001D386 /* JSDOMWindowCustom.h */,
BC2ED5540C6B9BD300920BFF /* JSElementCustom.cpp */,
......@@ -17496,6 +17508,7 @@
1AC2260D0DB69F190089B669 /* JSDOMApplicationCache.h in Headers */,
93B70D6409EB0C7C009D8468 /* JSDOMBinding.h in Headers */,
BC60D7C10D29A46300B9918F /* JSDOMCoreException.h in Headers */,
2E0888D51148848A00AF4265 /* JSDOMFormData.h in Headers */,
E1C36C030EB076D6007410BC /* JSDOMGlobalObject.h in Headers */,
65DF31F809D1CC60000BE325 /* JSDOMImplementation.h in Headers */,
1ACE53E00A8D18810022947D /* JSDOMParser.h in Headers */,
......@@ -18771,6 +18784,7 @@
85136CA80AED665900F90A3D /* westResizeCursor.png in Resources */,
1AB1AE7A0C051FDE00139F4F /* zoomInCursor.png in Resources */,
1AB1AE7B0C051FDE00139F4F /* zoomOutCursor.png in Resources */,
2E0888C4114883A900AF4265 /* DOMFormData.idl in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -19730,6 +19744,8 @@
1AC226170DB69F740089B669 /* JSDOMApplicationCacheCustom.cpp in Sources */,
93B70D6309EB0C7C009D8468 /* JSDOMBinding.cpp in Sources */,
BC60D7C00D29A46300B9918F /* JSDOMCoreException.cpp in Sources */,
2E0888D41148848A00AF4265 /* JSDOMFormData.cpp in Sources */,
2E0888E6114884E200AF4265 /* JSDOMFormDataCustom.cpp in Sources */,
E1C36CBD0EB08062007410BC /* JSDOMGlobalObject.cpp in Sources */,
65DF31F709D1CC60000BE325 /* JSDOMImplementation.cpp in Sources */,
1ACE53DF0A8D18810022947D /* JSDOMParser.cpp in Sources */,
/*
* Copyright (C) 2010 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * 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.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "JSDOMFormData.h"
#include "DOMFormData.h"
#include "JSBlob.h"
#include <runtime/Error.h>
using namespace JSC;
namespace WebCore {
JSValue JSDOMFormData::append(ExecState* exec, const ArgList& args)
{
if (args.size() >= 2) {
String name = args.at(0).toString(exec);
JSValue value = args.at(1);
if (value.inherits(&JSBlob::s_info))
impl()->append(name, toBlob(value));
else
impl()->append(name, value.toString(exec));
}
return jsUndefined();
}
} // namespace WebCore
......@@ -30,6 +30,7 @@
#include "JSXMLHttpRequest.h"
#include "Blob.h"
#include "DOMFormData.h"
#include "DOMWindow.h"
#include "Document.h"
#include "Event.h"
......@@ -37,6 +38,7 @@
#include "FrameLoader.h"
#include "HTMLDocument.h"
#include "JSBlob.h"
#include "JSDOMFormData.h"
#include "JSDOMWindowCustom.h"
#include "JSDocument.h"
#include "JSEvent.h"
......@@ -113,6 +115,8 @@ JSValue JSXMLHttpRequest::send(ExecState* exec, const ArgList& args)
<