Diff
Modified: trunk/LayoutTests/ChangeLog (98895 => 98896)
--- trunk/LayoutTests/ChangeLog 2011-10-31 23:00:42 UTC (rev 98895)
+++ trunk/LayoutTests/ChangeLog 2011-10-31 23:02:48 UTC (rev 98896)
@@ -1,3 +1,30 @@
+2011-10-31 Vineet Chaudhary <vineet.chaudh...@motorola.com>
+
+ text/plain form encoding ignored and incorrectly specified in request header.
+ https://bugs.webkit.org/show_bug.cgi?id=20795
+
+ Reviewed by Darin Adler.
+
+ Added tests for GET and POST methods for text/plain enctype.
+ Forms submitted using GET with a content-type of text/plain actually,
+ send data in URL encoded in the URL.
+ Forms with POST method and content-type of text/plain actually send data in text/plain.
+ Modified expected results for mailto tests as per the new behavior.
+
+ * fast/forms/form-get-textplain-expected.txt: Added.
+ * fast/forms/form-get-textplain.html: Added.
+ * fast/forms/mailto/post-multiple-items-text-plain-expected.txt:
+ * fast/forms/mailto/post-text-plain-expected.txt:
+ * fast/forms/mailto/post-text-plain-with-accept-charset-expected.txt:
+ * http/tests/misc/form-post-textplain-expected.txt: Added.
+ * http/tests/misc/form-post-textplain.html: Added.
+ * http/tests/misc/resources/form-post-textplain.php: Added.
+ * platform/chromium/test_expectations.txt:
+ * platform/gtk/fast/forms/mailto/formenctype-attribute-button-html-expected.txt:
+ * platform/gtk/fast/forms/mailto/formenctype-attribute-input-html-expected.txt:
+ * platform/qt/test_expectations.txt:
+ * platform/win/test_expectations.txt:
+
2011-10-31 Arko Saha <a...@motorola.com>
Microdata: Support for itemid attribute.
Added: trunk/LayoutTests/fast/forms/form-get-textplain-expected.txt (0 => 98896)
--- trunk/LayoutTests/fast/forms/form-get-textplain-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/forms/form-get-textplain-expected.txt 2011-10-31 23:02:48 UTC (rev 98896)
@@ -0,0 +1,3 @@
+This is a negative test for https://bugs.webkit.org/show_bug.cgi?id=20795, it makes sure that forms submitted using GET with a content-type of text/plain actually send data in URL encoded in the URL
+
+Success
Added: trunk/LayoutTests/fast/forms/form-get-textplain.html (0 => 98896)
--- trunk/LayoutTests/fast/forms/form-get-textplain.html (rev 0)
+++ trunk/LayoutTests/fast/forms/form-get-textplain.html 2011-10-31 23:02:48 UTC (rev 98896)
@@ -0,0 +1,42 @@
+<html>
+<head>
+<title>Regression test for bug 20795</title>
+</head>
+<body>
+<p>This is a negative test for https://bugs.webkit.org/show_bug.cgi?id=20795, it makes sure that forms submitted using GET with a content-type of text/plain actually send data in URL encoded in the URL</p>
+<form enctype="text/plain" method="get" action="" name="f">
+ <input type="hidden" name="f1" value="This is field #1 &!@$%\n='<>">
+ <input type="hidden" name="f2" value='This is field #2 ""'>
+ <input type="submit" value="press me">
+</form>
+<script>
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+}
+
+if (document.URL.substring(0, 4) == "file") {
+
+ if (document.URL.indexOf('?') == -1) {
+
+ document.f.submit();
+
+ } else {
+
+ document.f.style.display="none";
+ if (document.URL.substring(document.URL.indexOf('?')+1, document.URL.length) == "f1=This+is+field+%231+%26%21%40%24%25%5Cn%3D%27%3C%3E&f2=This+is+field+%232+%22%22")
+ document.write("<p>Success</p>");
+ else
+ document.write("<p>Failure: (" + document.URL + ")</p>");
+
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+ }
+
+} else {
+
+ document.write("<p>This test doesn't work directly from bugzilla, please save it to a local file first.</p>");
+}
+</script>
+</body>
+</html>
Modified: trunk/LayoutTests/fast/forms/mailto/post-multiple-items-text-plain-expected.txt (98895 => 98896)
--- trunk/LayoutTests/fast/forms/mailto/post-multiple-items-text-plain-expected.txt 2011-10-31 23:00:42 UTC (rev 98895)
+++ trunk/LayoutTests/fast/forms/mailto/post-multiple-items-text-plain-expected.txt 2011-10-31 23:02:48 UTC (rev 98896)
@@ -1,2 +1,2 @@
-Policy delegate: attempt to load mailto:?body=to%3Done%40example.org%0D%0Abody%3DLine%201%0D%0ALine%202%0D%0A%40%26%3D%2C%3B%3F%22%2B%0D%0A with navigation type 'form submitted'
+Policy delegate: attempt to load mailto:?body=to%3Done%40example.org%0D%0Abody%3DLine%201%0D%0ALine%202%0D%0A%40%0D%0A%3D%2C%3B%3F%22%20%0D%0A with navigation type 'form submitted'
Field 1: Field 2:
Modified: trunk/LayoutTests/fast/forms/mailto/post-text-plain-expected.txt (98895 => 98896)
--- trunk/LayoutTests/fast/forms/mailto/post-text-plain-expected.txt 2011-10-31 23:00:42 UTC (rev 98895)
+++ trunk/LayoutTests/fast/forms/mailto/post-text-plain-expected.txt 2011-10-31 23:02:48 UTC (rev 98896)
@@ -1,2 +1,2 @@
-Policy delegate: attempt to load mailto:o...@example.org?cc=t...@example.org&subject=%C3%BC%D0%B0%D1%91&body=Stra%C3%9Fe%3D%C3%BC%D0%B0%D1%91%0D%0A with navigation type 'form submitted'
+Policy delegate: attempt to load mailto:o...@example.org?cc=t...@example.org&subject=%C3%BC%D0%B0%D1%91&body=Stra%C3%83%C5%B8e%3D%C3%83%C2%BC%C3%90%C2%B0%C3%91%E2%80%98%0D%0A with navigation type 'form submitted'
Modified: trunk/LayoutTests/fast/forms/mailto/post-text-plain-with-accept-charset-expected.txt (98895 => 98896)
--- trunk/LayoutTests/fast/forms/mailto/post-text-plain-with-accept-charset-expected.txt 2011-10-31 23:00:42 UTC (rev 98895)
+++ trunk/LayoutTests/fast/forms/mailto/post-text-plain-with-accept-charset-expected.txt 2011-10-31 23:02:48 UTC (rev 98896)
@@ -1,2 +1,2 @@
-Policy delegate: attempt to load mailto:o...@example.org?cc=t...@example.org&subject=%C3%BC%D0%B0%D1%91&body=Stra%C3%9Fe%3D%C3%BC%D0%B0%D1%91%0D%0A with navigation type 'form submitted'
+Policy delegate: attempt to load mailto:o...@example.org?cc=t...@example.org&subject=%C3%BC%D0%B0%D1%91&body=Stra%C3%83%C5%B8e%3D%C3%83%C2%BC%C3%90%C2%B0%C3%91%E2%80%98%0D%0A with navigation type 'form submitted'
Added: trunk/LayoutTests/http/tests/misc/form-post-textplain-expected.txt (0 => 98896)
--- trunk/LayoutTests/http/tests/misc/form-post-textplain-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/misc/form-post-textplain-expected.txt 2011-10-31 23:02:48 UTC (rev 98896)
@@ -0,0 +1,3 @@
+This is a test for 20795, it makes sure that forms POSTed with a content-type of text/plain actually send data in text/plain
+
+FAILURE: f1=This is field #1 &!@$%\n='<> f2=This is field #2 ""
Added: trunk/LayoutTests/http/tests/misc/form-post-textplain.html (0 => 98896)
--- trunk/LayoutTests/http/tests/misc/form-post-textplain.html (rev 0)
+++ trunk/LayoutTests/http/tests/misc/form-post-textplain.html 2011-10-31 23:02:48 UTC (rev 98896)
@@ -0,0 +1,25 @@
+<html>
+<head>
+<title>Regression test for bug 20795</title>
+</head>
+<body>
+<p>
+This is a test for https://bugs.webkit.org/show_bug.cgi?id=20795, it makes sure that
+forms POSTed with a content-type of text/plain actually send data in text/plain
+</p>
+
+<form enctype="text/plain" method="post" action="" name="f">
+ <input type="hidden" name="f1" value="This is field #1 &!@$%\n='<>">
+ <input type="hidden" name="f2" value='This is field #2 ""'>
+ <input type="submit" value="press me">
+</form>
+<script>
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+}
+
+document.f.submit();
+</script>
+</body>
+</html>
Added: trunk/LayoutTests/http/tests/misc/resources/form-post-textplain.php (0 => 98896)
--- trunk/LayoutTests/http/tests/misc/resources/form-post-textplain.php (rev 0)
+++ trunk/LayoutTests/http/tests/misc/resources/form-post-textplain.php 2011-10-31 23:02:48 UTC (rev 98896)
@@ -0,0 +1,26 @@
+<?php
+header("Content-type: text/html; charset=UTF-8");
+?>
+<html>
+<head>
+<title>Regression test for bug 20795</title>
+</head>
+<body>
+<p>
+This is a test for 20795, it makes sure that forms POSTed with a content-type of text/plain actually send data in text/plain
+</p>
+<?php
+$data = ""
+
+if($data == "f1=This is field #1 &!@$%\n='<>\r\nf2=This is field #2 \"\"") {
+ echo "<p>SUCCESS</p>";
+} else {
+ echo "<p>FAILURE: $data</p>";
+}
+?>
+<script>
+if(window.layoutTestController)
+ layoutTestController.notifyDone();
+</script>
+</body>
+</html>
Modified: trunk/LayoutTests/platform/chromium/test_expectations.txt (98895 => 98896)
--- trunk/LayoutTests/platform/chromium/test_expectations.txt 2011-10-31 23:00:42 UTC (rev 98895)
+++ trunk/LayoutTests/platform/chromium/test_expectations.txt 2011-10-31 23:02:48 UTC (rev 98896)
@@ -3880,6 +3880,10 @@
BUGWK70641 SNOWLEOPARD : fast/frames/sandboxed-iframe-scripting.html = PASS CRASH
+// Needs rebaseline
+BUGWK20795 : fast/forms/mailto/formenctype-attribute-input-html.html = TEXT
+BUGWK20795 : fast/forms/mailto/formenctype-attribute-button-html.html = TEXT
+
BUGWK70749 SNOWLEOPARD CPU GPU : fast/ruby/base-shorter-than-text.html = IMAGE+TEXT PASS
BUGWK70837 : compositing/video/video-poster.html = PASS TIMEOUT
Modified: trunk/LayoutTests/platform/gtk/fast/forms/mailto/formenctype-attribute-button-html-expected.txt (98895 => 98896)
--- trunk/LayoutTests/platform/gtk/fast/forms/mailto/formenctype-attribute-button-html-expected.txt 2011-10-31 23:00:42 UTC (rev 98895)
+++ trunk/LayoutTests/platform/gtk/fast/forms/mailto/formenctype-attribute-button-html-expected.txt 2011-10-31 23:02:48 UTC (rev 98896)
@@ -1,2 +1,2 @@
-Policy delegate: attempt to load mailto:?body=to%3Done%40example.org%0D%0Abody%3DLine%201%0D%0ALine%202%0D%0A%40%26%3D%2C%3B%3F%22%2B%0D%0A with navigation type 'form submitted'
+Policy delegate: attempt to load mailto:?body=to%3Done%40example.org%0D%0Abody%3DLine%201%0D%0ALine%202%0D%0A%40%0D%0A%3D%2C%3B%3F%22%20%0D%0A with navigation type 'form submitted'
Field 1: Field 2:
Modified: trunk/LayoutTests/platform/gtk/fast/forms/mailto/formenctype-attribute-input-html-expected.txt (98895 => 98896)
--- trunk/LayoutTests/platform/gtk/fast/forms/mailto/formenctype-attribute-input-html-expected.txt 2011-10-31 23:00:42 UTC (rev 98895)
+++ trunk/LayoutTests/platform/gtk/fast/forms/mailto/formenctype-attribute-input-html-expected.txt 2011-10-31 23:02:48 UTC (rev 98896)
@@ -1,2 +1,2 @@
-Policy delegate: attempt to load mailto:?body=to%3Done%40example.org%0D%0Abody%3DLine%201%0D%0ALine%202%0D%0A%40%26%3D%2C%3B%3F%22%2B%0D%0A with navigation type 'form submitted'
+Policy delegate: attempt to load mailto:?body=to%3Done%40example.org%0D%0Abody%3DLine%201%0D%0ALine%202%0D%0A%40%0D%0A%3D%2C%3B%3F%22%20%0D%0A with navigation type 'form submitted'
Field 1: Field 2:
Modified: trunk/LayoutTests/platform/qt/test_expectations.txt (98895 => 98896)
--- trunk/LayoutTests/platform/qt/test_expectations.txt 2011-10-31 23:00:42 UTC (rev 98895)
+++ trunk/LayoutTests/platform/qt/test_expectations.txt 2011-10-31 23:02:48 UTC (rev 98896)
@@ -19,6 +19,10 @@
BUG_QT_SLOW DEBUG: fast/js/array-sort-modifying-tostring.html = TIMEOUT PASS
BUG_QT_SLOW SLOW DEBUG: fast/overflow/lots-of-sibling-inline-boxes.html = PASS
+// Needs rebaseline
+BUGWK20795 : fast/forms/mailto/formenctype-attribute-input-html.html = TEXT
+BUGWK20795 : fast/forms/mailto/formenctype-attribute-button-html.html = TEXT
+
BUGWK67007 DEBUG : fast/ruby/after-block-doesnt-crash.html = CRASH
BUGWK67007 DEBUG : fast/ruby/after-table-doesnt-crash.html = CRASH
BUGWK67007 DEBUG : fast/ruby/generated-after-counter-doesnt-crash.html = CRASH
Modified: trunk/LayoutTests/platform/win/test_expectations.txt (98895 => 98896)
--- trunk/LayoutTests/platform/win/test_expectations.txt 2011-10-31 23:00:42 UTC (rev 98895)
+++ trunk/LayoutTests/platform/win/test_expectations.txt 2011-10-31 23:02:48 UTC (rev 98896)
@@ -7,5 +7,9 @@
BUGWK67007 DEBUG : fast/ruby/generated-after-counter-doesnt-crash.html = CRASH
BUGWK67007 DEBUG : fast/ruby/generated-before-and-after-counter-doesnt-crash.html = CRASH
+// Needs rebaseline
+BUGWK20795 : fast/forms/mailto/formenctype-attribute-input-html.html = TEXT
+BUGWK20795 : fast/forms/mailto/formenctype-attribute-button-html.html = TEXT
+
// Need rebaseline
BUGWK65361 : fast/forms/input-disabled-color.html = IMAGE+TEXT
Modified: trunk/Source/WebCore/ChangeLog (98895 => 98896)
--- trunk/Source/WebCore/ChangeLog 2011-10-31 23:00:42 UTC (rev 98895)
+++ trunk/Source/WebCore/ChangeLog 2011-10-31 23:02:48 UTC (rev 98896)
@@ -1,3 +1,27 @@
+2011-10-31 Vineet Chaudhary <vineet.chaudh...@motorola.com>
+
+ text/plain form encoding ignored and incorrectly specified in request header.
+ https://bugs.webkit.org/show_bug.cgi?id=20795
+
+ Reviewed by Darin Adler.
+
+ This patch fixes the behaviour of forms where enctype is set to
+ text/plain, encoding is also text/plain.
+
+ Tests: fast/forms/form-get-textplain.html
+ http/tests/misc/form-post-textplain.html
+
+ * loader/FormSubmission.cpp:
+ (WebCore::FormSubmission::create):
+ * platform/network/FormData.cpp:
+ (WebCore::FormData::create):
+ (WebCore::FormData::appendKeyValuePairItems):
+ * platform/network/FormData.h:
+ (WebCore::FormData::parseEncodingType):
+ * platform/network/FormDataBuilder.cpp:
+ (WebCore::FormDataBuilder::addKeyValuePairAsFormData): Modified encoding scheme for text/plain.
+ * platform/network/FormDataBuilder.h:
+
2011-10-31 John Gregg <john...@google.com>
RenderImage.cpp calls SVGImage even if it's not defined
Modified: trunk/Source/WebCore/loader/FormSubmission.cpp (98895 => 98896)
--- trunk/Source/WebCore/loader/FormSubmission.cpp 2011-10-31 23:00:42 UTC (rev 98895)
+++ trunk/Source/WebCore/loader/FormSubmission.cpp 2011-10-31 23:02:48 UTC (rev 98896)
@@ -199,7 +199,7 @@
formData = FormData::createMultiPart(*(static_cast<FormDataList*>(domFormData.get())), domFormData->encoding(), document);
boundary = formData->boundary().data();
} else {
- formData = FormData::create(*(static_cast<FormDataList*>(domFormData.get())), domFormData->encoding());
+ formData = FormData::create(*(static_cast<FormDataList*>(domFormData.get())), domFormData->encoding(), attributes.method() == GetMethod ? FormData::FormURLEncoded : FormData::parseEncodingType(encodingType));
if (copiedAttributes.method() == PostMethod && isMailtoForm) {
// Convert the form data into a string that we put into the URL.
appendMailtoPostFormDataToURL(actionURL, *formData, encodingType);
Modified: trunk/Source/WebCore/platform/network/FormData.cpp (98895 => 98896)
--- trunk/Source/WebCore/platform/network/FormData.cpp 2011-10-31 23:00:42 UTC (rev 98895)
+++ trunk/Source/WebCore/platform/network/FormData.cpp 2011-10-31 23:02:48 UTC (rev 98896)
@@ -99,10 +99,10 @@
return result.release();
}
-PassRefPtr<FormData> FormData::create(const FormDataList& list, const TextEncoding& encoding)
+PassRefPtr<FormData> FormData::create(const FormDataList& list, const TextEncoding& encoding, EncodingType encodingType)
{
RefPtr<FormData> result = create();
- result->appendKeyValuePairItems(list, encoding, false, 0);
+ result->appendKeyValuePairItems(list, encoding, false, 0, encodingType);
return result.release();
}
@@ -180,7 +180,7 @@
}
#endif
-void FormData::appendKeyValuePairItems(const FormDataList& list, const TextEncoding& encoding, bool isMultiPartForm, Document* document)
+void FormData::appendKeyValuePairItems(const FormDataList& list, const TextEncoding& encoding, bool isMultiPartForm, Document* document, EncodingType encodingType)
{
if (isMultiPartForm)
m_boundary = FormDataBuilder::generateUniqueBoundaryString();
@@ -263,7 +263,7 @@
if (encodedData.isEmpty() && key.data() == "isindex")
FormDataBuilder::encodeStringAsFormData(encodedData, value.data());
else
- FormDataBuilder::addKeyValuePairAsFormData(encodedData, key.data(), value.data());
+ FormDataBuilder::addKeyValuePairAsFormData(encodedData, key.data(), value.data(), encodingType);
}
}
Modified: trunk/Source/WebCore/platform/network/FormData.h (98895 => 98896)
--- trunk/Source/WebCore/platform/network/FormData.h 2011-10-31 23:00:42 UTC (rev 98895)
+++ trunk/Source/WebCore/platform/network/FormData.h 2011-10-31 23:02:48 UTC (rev 98896)
@@ -91,11 +91,17 @@
class FormData : public RefCounted<FormData> {
public:
+ enum EncodingType {
+ FormURLEncoded, // for application/x-www-form-urlencoded
+ TextPlain, // for text/plain
+ MultipartFormData // for multipart/form-data
+ };
+
static PassRefPtr<FormData> create();
static PassRefPtr<FormData> create(const void*, size_t);
static PassRefPtr<FormData> create(const CString&);
static PassRefPtr<FormData> create(const Vector<char>&);
- static PassRefPtr<FormData> create(const FormDataList&, const TextEncoding&);
+ static PassRefPtr<FormData> create(const FormDataList&, const TextEncoding&, EncodingType = FormURLEncoded);
static PassRefPtr<FormData> createMultiPart(const FormDataList&, const TextEncoding&, Document*);
PassRefPtr<FormData> copy() const;
PassRefPtr<FormData> deepCopy() const;
@@ -129,11 +135,20 @@
void setIdentifier(int64_t identifier) { m_identifier = identifier; }
int64_t identifier() const { return m_identifier; }
+ static EncodingType parseEncodingType(const String& type)
+ {
+ if (equalIgnoringCase(type, "text/plain"))
+ return TextPlain;
+ if (equalIgnoringCase(type, "multipart/form-data"))
+ return MultipartFormData;
+ return FormURLEncoded;
+ }
+
private:
FormData();
FormData(const FormData&);
- void appendKeyValuePairItems(const FormDataList&, const TextEncoding&, bool isMultiPartForm, Document*);
+ void appendKeyValuePairItems(const FormDataList&, const TextEncoding&, bool isMultiPartForm, Document*, EncodingType = FormURLEncoded);
Vector<FormDataElement> m_elements;
Modified: trunk/Source/WebCore/platform/network/FormDataBuilder.cpp (98895 => 98896)
--- trunk/Source/WebCore/platform/network/FormDataBuilder.cpp 2011-10-31 23:00:42 UTC (rev 98895)
+++ trunk/Source/WebCore/platform/network/FormDataBuilder.cpp 2011-10-31 23:02:48 UTC (rev 98896)
@@ -181,14 +181,21 @@
append(buffer, "\r\n\r\n");
}
-void FormDataBuilder::addKeyValuePairAsFormData(Vector<char>& buffer, const CString& key, const CString& value)
+void FormDataBuilder::addKeyValuePairAsFormData(Vector<char>& buffer, const CString& key, const CString& value, FormData::EncodingType encodingType)
{
- if (!buffer.isEmpty())
- append(buffer, '&');
-
- encodeStringAsFormData(buffer, key);
- append(buffer, '=');
- encodeStringAsFormData(buffer, value);
+ if (encodingType == FormData::TextPlain) {
+ if (!buffer.isEmpty())
+ append(buffer, "\r\n");
+ append(buffer, key);
+ append(buffer, '=');
+ append(buffer, value);
+ } else {
+ if (!buffer.isEmpty())
+ append(buffer, '&');
+ encodeStringAsFormData(buffer, key);
+ append(buffer, '=');
+ encodeStringAsFormData(buffer, value);
+ }
}
void FormDataBuilder::encodeStringAsFormData(Vector<char>& buffer, const CString& string)
Modified: trunk/Source/WebCore/platform/network/FormDataBuilder.h (98895 => 98896)
--- trunk/Source/WebCore/platform/network/FormDataBuilder.h 2011-10-31 23:00:42 UTC (rev 98895)
+++ trunk/Source/WebCore/platform/network/FormDataBuilder.h 2011-10-31 23:02:48 UTC (rev 98896)
@@ -21,6 +21,7 @@
#ifndef FormDataBuilder_h
#define FormDataBuilder_h
+#include "FormData.h"
#include "PlatformString.h"
#include <wtf/Forward.h>
@@ -43,7 +44,7 @@
static void finishMultiPartHeader(Vector<char>&);
// Helper functions used by HTMLFormElement for non multi-part form data
- static void addKeyValuePairAsFormData(Vector<char>&, const CString& key, const CString& value);
+ static void addKeyValuePairAsFormData(Vector<char>&, const CString& key, const CString& value, FormData::EncodingType = FormData::FormURLEncoded);
static void encodeStringAsFormData(Vector<char>&, const CString&);
private: