[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373
jianli at chromium.org
jianli at chromium.org
Thu Apr 8 02:22:38 UTC 2010
The following commit has been merged in the webkit-1.2 branch:
commit 8b267dc392a6d07a1056d01191243373b8c52bae
Author: jianli at chromium.org <jianli at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon Mar 15 17:27:16 2010 +0000
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
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 4773af2..3e0eab7 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,32 @@
+2010-03-15 Jian Li <jianli at 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 at ericsson.com>
Reviewed by Darin Adler.
diff --git a/LayoutTests/fast/dom/Window/window-properties-expected.txt b/LayoutTests/fast/dom/Window/window-properties-expected.txt
index 836d367..ffae867 100644
--- a/LayoutTests/fast/dom/Window/window-properties-expected.txt
+++ b/LayoutTests/fast/dom/Window/window-properties-expected.txt
@@ -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]
diff --git a/LayoutTests/fast/dom/Window/window-property-descriptors-expected.txt b/LayoutTests/fast/dom/Window/window-property-descriptors-expected.txt
index e869549..54fc166 100644
--- a/LayoutTests/fast/dom/Window/window-property-descriptors-expected.txt
+++ b/LayoutTests/fast/dom/Window/window-property-descriptors-expected.txt
@@ -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'
diff --git a/LayoutTests/fast/dom/constructed-objects-prototypes-expected.txt b/LayoutTests/fast/dom/constructed-objects-prototypes-expected.txt
index 2639d3d..6509f37 100644
--- a/LayoutTests/fast/dom/constructed-objects-prototypes-expected.txt
+++ b/LayoutTests/fast/dom/constructed-objects-prototypes-expected.txt
@@ -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
diff --git a/LayoutTests/fast/dom/prototype-inheritance-2-expected.txt b/LayoutTests/fast/dom/prototype-inheritance-2-expected.txt
index 583d865..cccfd7a 100644
--- a/LayoutTests/fast/dom/prototype-inheritance-2-expected.txt
+++ b/LayoutTests/fast/dom/prototype-inheritance-2-expected.txt
@@ -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
diff --git a/LayoutTests/fast/dom/prototype-inheritance-expected.txt b/LayoutTests/fast/dom/prototype-inheritance-expected.txt
index 4faa715..534783f 100644
--- a/LayoutTests/fast/dom/prototype-inheritance-expected.txt
+++ b/LayoutTests/fast/dom/prototype-inheritance-expected.txt
@@ -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
diff --git a/LayoutTests/fast/js/global-constructors-expected.txt b/LayoutTests/fast/js/global-constructors-expected.txt
index 1d1c2dc..8fc8504 100644
--- a/LayoutTests/fast/js/global-constructors-expected.txt
+++ b/LayoutTests/fast/js/global-constructors-expected.txt
@@ -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]'
diff --git a/LayoutTests/http/tests/local/resources/send-form-data.js b/LayoutTests/http/tests/local/resources/send-form-data.js
new file mode 100644
index 0000000..def7c44
--- /dev/null
+++ b/LayoutTests/http/tests/local/resources/send-form-data.js
@@ -0,0 +1,115 @@
+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;
diff --git a/LayoutTests/http/tests/local/send-form-data-expected.txt b/LayoutTests/http/tests/local/send-form-data-expected.txt
new file mode 100644
index 0000000..6c789f6
--- /dev/null
+++ b/LayoutTests/http/tests/local/send-form-data-expected.txt
@@ -0,0 +1,21 @@
+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
+
diff --git a/LayoutTests/http/tests/local/send-form-data.html b/LayoutTests/http/tests/local/send-form-data.html
new file mode 100644
index 0000000..18c70b1
--- /dev/null
+++ b/LayoutTests/http/tests/local/send-form-data.html
@@ -0,0 +1,13 @@
+<!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>
diff --git a/LayoutTests/http/tests/xmlhttprequest/resources/multipart-post-echo.php b/LayoutTests/http/tests/xmlhttprequest/resources/multipart-post-echo.php
new file mode 100755
index 0000000..f43b588
--- /dev/null
+++ b/LayoutTests/http/tests/xmlhttprequest/resources/multipart-post-echo.php
@@ -0,0 +1,29 @@
+<?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);
+?>
diff --git a/LayoutTests/platform/gtk/Skipped b/LayoutTests/platform/gtk/Skipped
index bfac55e..acc9071 100644
--- a/LayoutTests/platform/gtk/Skipped
+++ b/LayoutTests/platform/gtk/Skipped
@@ -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
diff --git a/LayoutTests/platform/gtk/fast/dom/Window/window-properties-expected.txt b/LayoutTests/platform/gtk/fast/dom/Window/window-properties-expected.txt
index 236a915..cc2441b 100644
--- a/LayoutTests/platform/gtk/fast/dom/Window/window-properties-expected.txt
+++ b/LayoutTests/platform/gtk/fast/dom/Window/window-properties-expected.txt
@@ -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]
diff --git a/LayoutTests/platform/qt/Skipped b/LayoutTests/platform/qt/Skipped
index 4eac087..6567355 100644
--- a/LayoutTests/platform/qt/Skipped
+++ b/LayoutTests/platform/qt/Skipped
@@ -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
diff --git a/LayoutTests/platform/qt/fast/dom/Window/window-properties-expected.txt b/LayoutTests/platform/qt/fast/dom/Window/window-properties-expected.txt
index ad21870..c4b4278 100644
--- a/LayoutTests/platform/qt/fast/dom/Window/window-properties-expected.txt
+++ b/LayoutTests/platform/qt/fast/dom/Window/window-properties-expected.txt
@@ -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]
diff --git a/LayoutTests/platform/qt/fast/dom/Window/window-property-descriptors-expected.txt b/LayoutTests/platform/qt/fast/dom/Window/window-property-descriptors-expected.txt
index b19e2b7..f65c1c7 100644
--- a/LayoutTests/platform/qt/fast/dom/Window/window-property-descriptors-expected.txt
+++ b/LayoutTests/platform/qt/fast/dom/Window/window-property-descriptors-expected.txt
@@ -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'
diff --git a/LayoutTests/platform/qt/fast/dom/prototype-inheritance-expected.txt b/LayoutTests/platform/qt/fast/dom/prototype-inheritance-expected.txt
index 384c0a1..b1047e7 100644
--- a/LayoutTests/platform/qt/fast/dom/prototype-inheritance-expected.txt
+++ b/LayoutTests/platform/qt/fast/dom/prototype-inheritance-expected.txt
@@ -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
diff --git a/LayoutTests/platform/qt/fast/js/global-constructors-expected.txt b/LayoutTests/platform/qt/fast/js/global-constructors-expected.txt
index 3364928..150d50d 100644
--- a/LayoutTests/platform/qt/fast/js/global-constructors-expected.txt
+++ b/LayoutTests/platform/qt/fast/js/global-constructors-expected.txt
@@ -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]'
diff --git a/LayoutTests/platform/win/Skipped b/LayoutTests/platform/win/Skipped
index a6111e1..8c53b6d 100644
--- a/LayoutTests/platform/win/Skipped
+++ b/LayoutTests/platform/win/Skipped
@@ -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
diff --git a/WebCore/Android.derived.jscbindings.mk b/WebCore/Android.derived.jscbindings.mk
index 866a6ac..b3c531c 100644
--- a/WebCore/Android.derived.jscbindings.mk
+++ b/WebCore/Android.derived.jscbindings.mk
@@ -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 \
diff --git a/WebCore/Android.derived.v8bindings.mk b/WebCore/Android.derived.v8bindings.mk
index 19a5975..f6a5efd 100644
--- a/WebCore/Android.derived.v8bindings.mk
+++ b/WebCore/Android.derived.v8bindings.mk
@@ -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 \
diff --git a/WebCore/Android.jscbindings.mk b/WebCore/Android.jscbindings.mk
index f07ba68..e56410a 100644
--- a/WebCore/Android.jscbindings.mk
+++ b/WebCore/Android.jscbindings.mk
@@ -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 \
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index c1b3f60..9243212 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,31 @@
+2010-03-15 Jian Li <jianli at 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 at ericsson.com>
Reviewed by Darin Adler.
diff --git a/WebCore/DerivedSources.cpp b/WebCore/DerivedSources.cpp
index 0de0b9d..c26fe2c 100644
--- a/WebCore/DerivedSources.cpp
+++ b/WebCore/DerivedSources.cpp
@@ -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"
diff --git a/WebCore/DerivedSources.make b/WebCore/DerivedSources.make
index 06eeb8c..08ce80e 100644
--- a/WebCore/DerivedSources.make
+++ b/WebCore/DerivedSources.make
@@ -108,6 +108,7 @@ DOM_CLASSES = \
DedicatedWorkerContext \
DOMApplicationCache \
DOMCoreException \
+ DOMFormData \
DOMImplementation \
DOMParser \
DOMSelection \
diff --git a/WebCore/GNUmakefile.am b/WebCore/GNUmakefile.am
index 1766967..dae85dc 100644
--- a/WebCore/GNUmakefile.am
+++ b/WebCore/GNUmakefile.am
@@ -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 \
diff --git a/WebCore/WebCore.pri b/WebCore/WebCore.pri
index 01a8174..6aab3ec 100644
--- a/WebCore/WebCore.pri
+++ b/WebCore/WebCore.pri
@@ -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 \
diff --git a/WebCore/WebCore.pro b/WebCore/WebCore.pro
index 2a081ab..41ce4ce 100644
--- a/WebCore/WebCore.pro
+++ b/WebCore/WebCore.pro
@@ -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 \
diff --git a/WebCore/WebCore.vcproj/WebCore.vcproj b/WebCore/WebCore.vcproj/WebCore.vcproj
index 72b3d44..5968cbe 100644
--- a/WebCore/WebCore.vcproj/WebCore.vcproj
+++ b/WebCore/WebCore.vcproj/WebCore.vcproj
@@ -2905,6 +2905,14 @@
>
</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"
>
<FileConfiguration
@@ -35972,6 +35980,10 @@
>
</File>
<File
+ RelativePath="..\bindings\js\JSDOMFormDataCustom.cpp"
+ >
+ </File>
+ <File
RelativePath="..\bindings\js\JSDOMGlobalObject.cpp"
>
<FileConfiguration
diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj
index 2821067..97a9f7b 100644
--- a/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -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 */,
diff --git a/WebCore/bindings/js/JSDOMFormDataCustom.cpp b/WebCore/bindings/js/JSDOMFormDataCustom.cpp
new file mode 100644
index 0000000..222cbcc
--- /dev/null
+++ b/WebCore/bindings/js/JSDOMFormDataCustom.cpp
@@ -0,0 +1,56 @@
+/*
+ * 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
diff --git a/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp b/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp
index 684de91..ede5a25 100644
--- a/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp
+++ b/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp
@@ -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)
impl()->send(toDocument(val), ec);
else if (val.inherits(&JSBlob::s_info))
impl()->send(toBlob(val), ec);
+ else if (val.inherits(&JSDOMFormData::s_info))
+ impl()->send(toDOMFormData(val), ec);
else
impl()->send(val.toString(exec), ec);
}
diff --git a/WebCore/bindings/scripts/CodeGeneratorJS.pm b/WebCore/bindings/scripts/CodeGeneratorJS.pm
index 3fa0f6f..9e255fb 100644
--- a/WebCore/bindings/scripts/CodeGeneratorJS.pm
+++ b/WebCore/bindings/scripts/CodeGeneratorJS.pm
@@ -144,6 +144,7 @@ sub GetVisibleClassName
my $className = shift;
return "DOMException" if $className eq "DOMCoreException";
+ return "FormData" if $className eq "DOMFormData";
return $className;
}
diff --git a/WebCore/html/DOMFormData.idl b/WebCore/html/DOMFormData.idl
new file mode 100644
index 0000000..c339381
--- /dev/null
+++ b/WebCore/html/DOMFormData.idl
@@ -0,0 +1,42 @@
+/*
+ * 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.
+ */
+
+module html {
+
+ interface [
+ CanBeConstructed,
+ GenerateNativeConverter,
+ GenerateToJS
+ ] DOMFormData {
+ // void append(DOMString name, Blob value);
+ [Custom] void append(in DOMString name, in DOMString value);
+ };
+
+}
diff --git a/WebCore/page/DOMWindow.idl b/WebCore/page/DOMWindow.idl
index bb0a9aa..d457bdc 100644
--- a/WebCore/page/DOMWindow.idl
+++ b/WebCore/page/DOMWindow.idl
@@ -716,6 +716,8 @@ module window {
attribute TouchEventConstructor TouchEvent;
#endif
+ attribute DOMFormDataConstructor FormData;
+
#endif // defined(LANGUAGE_JAVASCRIPT)
#if defined(V8_BINDING) && V8_BINDING
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list