Title: [99310] trunk
Revision
99310
Author
[email protected]
Date
2011-11-04 12:53:21 -0700 (Fri, 04 Nov 2011)

Log Message

Send the submissions character encoding in hidden _charset_ field.
https://bugs.webkit.org/show_bug.cgi?id=19079

Patch by Vineet Chaudhary <[email protected]> on 2011-11-04
Reviewed by Darin Adler.

Source/WebCore:

Spec reference http://dev.w3.org/html5/spec/Overview.html#attr-fe-name-charset
If _charset_ used as the name of a hidden control it should send character encoding
as value while submissions.

Tests: http/tests/misc/char-encoding-in-hidden-charset-field-default.html
       http/tests/misc/char-encoding-in-hidden-charset-field-with-Big5.html
       http/tests/misc/char-encoding-in-hidden-charset-field-with-EUC-JP.html
       http/tests/misc/char-encoding-in-hidden-charset-field-with-ISO-2022-JP.html
       http/tests/misc/char-encoding-in-hidden-charset-field-with-Shift_JIS.html
       http/tests/misc/char-encoding-in-hidden-charset-field-with-accept-charset.html
       http/tests/misc/char-encoding-in-hidden-charset-field-with-get-method.html
       http/tests/misc/char-encoding-in-hidden-charset-field-with-one-field.html
       http/tests/misc/char-encoding-in-text-charset-field-with-value.html
       http/tests/misc/char-encoding-without-charset-field.html

* html/HiddenInputType.cpp:
(WebCore::HiddenInputType::isHiddenType):
(WebCore::HiddenInputType::appendFormData): For _charset_ send value as respective encodingType.
* html/HiddenInputType.h: Override appendFormData for hidden control types.

LayoutTests:

Spec reference http://dev.w3.org/html5/spec/Overview.html#attr-fe-name-charset
If _charset_ used as the name of a hidden control it should send character encoding
as value while submissions.
Added test cases to check this behavior.

* http/tests/misc/char-encoding-in-hidden-charset-field-default-expected.txt: Added.
* http/tests/misc/char-encoding-in-hidden-charset-field-default.html: Added. For Default Encoding.
* http/tests/misc/char-encoding-in-hidden-charset-field-with-Big5-expected.txt: Added.
* http/tests/misc/char-encoding-in-hidden-charset-field-with-Big5.html: Added. For Big5 Encoding.
* http/tests/misc/char-encoding-in-hidden-charset-field-with-EUC-JP-expected.txt: Added.
* http/tests/misc/char-encoding-in-hidden-charset-field-with-EUC-JP.html: Added. For EUC-JP Encoding.
* http/tests/misc/char-encoding-in-hidden-charset-field-with-ISO-2022-JP-expected.txt: Added.
* http/tests/misc/char-encoding-in-hidden-charset-field-with-ISO-2022-JP.html: Added. For ISO-2022-JP Encoding.
* http/tests/misc/char-encoding-in-hidden-charset-field-with-Shift_JIS-expected.txt: Added.
* http/tests/misc/char-encoding-in-hidden-charset-field-with-Shift_JIS.html: Added. For Shift_JIS Encoding.
* http/tests/misc/char-encoding-in-hidden-charset-field-with-accept-charset-expected.txt: Added.
* http/tests/misc/char-encoding-in-hidden-charset-field-with-accept-charset.html: Added. For two input fields.
* http/tests/misc/char-encoding-in-hidden-charset-field-with-get-method-expected.txt: Added.
* http/tests/misc/char-encoding-in-hidden-charset-field-with-get-method.html: Added. For GET method.
* http/tests/misc/char-encoding-in-hidden-charset-field-with-one-field-expected.txt: Added.
* http/tests/misc/char-encoding-in-hidden-charset-field-with-one-field.html: Added. For one input fields.
* http/tests/misc/char-encoding-in-text-charset-field-with-value-expected.txt: Added.
* http/tests/misc/char-encoding-in-text-charset-field-with-value.html: Added. If input type is text.
* http/tests/misc/char-encoding-without-charset-field-expected.txt: Added.
* http/tests/misc/char-encoding-without-charset-field.html: Added. If no hidden input field.
* http/tests/misc/resources/char-encoding-in-hidden-charset-field.php: Added. Server side script for test.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (99309 => 99310)


--- trunk/LayoutTests/ChangeLog	2011-11-04 19:29:09 UTC (rev 99309)
+++ trunk/LayoutTests/ChangeLog	2011-11-04 19:53:21 UTC (rev 99310)
@@ -1,3 +1,37 @@
+2011-11-04  Vineet Chaudhary  <[email protected]>
+
+        Send the submissions character encoding in hidden _charset_ field.
+        https://bugs.webkit.org/show_bug.cgi?id=19079
+
+        Reviewed by Darin Adler.
+
+        Spec reference http://dev.w3.org/html5/spec/Overview.html#attr-fe-name-charset
+        If _charset_ used as the name of a hidden control it should send character encoding
+        as value while submissions.
+        Added test cases to check this behavior.
+
+        * http/tests/misc/char-encoding-in-hidden-charset-field-default-expected.txt: Added.
+        * http/tests/misc/char-encoding-in-hidden-charset-field-default.html: Added. For Default Encoding.
+        * http/tests/misc/char-encoding-in-hidden-charset-field-with-Big5-expected.txt: Added.
+        * http/tests/misc/char-encoding-in-hidden-charset-field-with-Big5.html: Added. For Big5 Encoding.
+        * http/tests/misc/char-encoding-in-hidden-charset-field-with-EUC-JP-expected.txt: Added.
+        * http/tests/misc/char-encoding-in-hidden-charset-field-with-EUC-JP.html: Added. For EUC-JP Encoding.
+        * http/tests/misc/char-encoding-in-hidden-charset-field-with-ISO-2022-JP-expected.txt: Added.
+        * http/tests/misc/char-encoding-in-hidden-charset-field-with-ISO-2022-JP.html: Added. For ISO-2022-JP Encoding.
+        * http/tests/misc/char-encoding-in-hidden-charset-field-with-Shift_JIS-expected.txt: Added.
+        * http/tests/misc/char-encoding-in-hidden-charset-field-with-Shift_JIS.html: Added. For Shift_JIS Encoding.
+        * http/tests/misc/char-encoding-in-hidden-charset-field-with-accept-charset-expected.txt: Added.
+        * http/tests/misc/char-encoding-in-hidden-charset-field-with-accept-charset.html: Added. For two input fields.
+        * http/tests/misc/char-encoding-in-hidden-charset-field-with-get-method-expected.txt: Added.
+        * http/tests/misc/char-encoding-in-hidden-charset-field-with-get-method.html: Added. For GET method.
+        * http/tests/misc/char-encoding-in-hidden-charset-field-with-one-field-expected.txt: Added.
+        * http/tests/misc/char-encoding-in-hidden-charset-field-with-one-field.html: Added. For one input fields.
+        * http/tests/misc/char-encoding-in-text-charset-field-with-value-expected.txt: Added.
+        * http/tests/misc/char-encoding-in-text-charset-field-with-value.html: Added. If input type is text.
+        * http/tests/misc/char-encoding-without-charset-field-expected.txt: Added.
+        * http/tests/misc/char-encoding-without-charset-field.html: Added. If no hidden input field.
+        * http/tests/misc/resources/char-encoding-in-hidden-charset-field.php: Added. Server side script for test.
+
 2011-11-04  Pavel Feldman  <[email protected]>
 
         Not reviewed: marked inspector/debugger/script-formatter.html

Added: trunk/LayoutTests/http/tests/misc/char-encoding-in-hidden-charset-field-default-expected.txt (0 => 99310)


--- trunk/LayoutTests/http/tests/misc/char-encoding-in-hidden-charset-field-default-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/misc/char-encoding-in-hidden-charset-field-default-expected.txt	2011-11-04 19:53:21 UTC (rev 99310)
@@ -0,0 +1,3 @@
+This is a test for https://bugs.webkit.org/show_bug.cgi?id=19079, it send the submissions character encoding in hidden _charset_ field.
+
+PASSED: _charset_=ISO-8859-1

Added: trunk/LayoutTests/http/tests/misc/char-encoding-in-hidden-charset-field-default.html (0 => 99310)


--- trunk/LayoutTests/http/tests/misc/char-encoding-in-hidden-charset-field-default.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/misc/char-encoding-in-hidden-charset-field-default.html	2011-11-04 19:53:21 UTC (rev 99310)
@@ -0,0 +1,27 @@
+<html>
+<head>
+<title>Test for bug 19079</title>
+</head>
+<body>
+<p>This is a test for https://bugs.webkit.org/show_bug.cgi?id=19079, it send the submissions
+character encoding in hidden _charset_ field.
+</p>
+<p>
+This should submit _charset_=iso8559-1.  Note that this _charset_ input has a value before it submits, which is overwritten. IE6 submits windows1252, because all pages are evidently Unicode in IE6.  The point is that it submits the charset we're using, not what exactly it submits.</p>
+
+<form name="testForm" action="" method="post">
+<input type=hidden name="_charset_" value="This value should change">
+<input type=submit>
+</form>
+
+<script>
+if (window.layoutTestController) {
+    layoutTestController.dumpAsText();
+    layoutTestController.waitUntilDone();
+}
+
+document.testForm.submit();
+</script>
+
+</body>
+</html> 

Added: trunk/LayoutTests/http/tests/misc/char-encoding-in-hidden-charset-field-with-Big5-expected.txt (0 => 99310)


--- trunk/LayoutTests/http/tests/misc/char-encoding-in-hidden-charset-field-with-Big5-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/misc/char-encoding-in-hidden-charset-field-with-Big5-expected.txt	2011-11-04 19:53:21 UTC (rev 99310)
@@ -0,0 +1,3 @@
+This is a test for https://bugs.webkit.org/show_bug.cgi?id=19079, it send the submissions character encoding in hidden _charset_ field.
+
+PASSED: _charset_=Big5

Added: trunk/LayoutTests/http/tests/misc/char-encoding-in-hidden-charset-field-with-Big5.html (0 => 99310)


--- trunk/LayoutTests/http/tests/misc/char-encoding-in-hidden-charset-field-with-Big5.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/misc/char-encoding-in-hidden-charset-field-with-Big5.html	2011-11-04 19:53:21 UTC (rev 99310)
@@ -0,0 +1,27 @@
+<html>
+<head>
+<title>Test for bug 19079</title>
+</head>
+<body>
+<p>This is a test for https://bugs.webkit.org/show_bug.cgi?id=19079, it send the submissions
+character encoding in hidden _charset_ field.
+</p>
+<p>This should submit one _charset_=Big5</p>
+
+<form id="testForm" action="" method="post" accept-charset="Big5">
+<input type=hidden name="_charset_">
+<input type=submit>
+</form>
+
+<script>
+if (window.layoutTestController) {
+    layoutTestController.dumpAsText();
+    layoutTestController.waitUntilDone();
+}
+
+var form = document.getElementById("testForm");
+form.submit();
+</script>
+
+</body>
+</html>

Added: trunk/LayoutTests/http/tests/misc/char-encoding-in-hidden-charset-field-with-EUC-JP-expected.txt (0 => 99310)


--- trunk/LayoutTests/http/tests/misc/char-encoding-in-hidden-charset-field-with-EUC-JP-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/misc/char-encoding-in-hidden-charset-field-with-EUC-JP-expected.txt	2011-11-04 19:53:21 UTC (rev 99310)
@@ -0,0 +1,3 @@
+This is a test for https://bugs.webkit.org/show_bug.cgi?id=19079, it send the submissions character encoding in hidden _charset_ field.
+
+PASSED: _charset_=EUC-JP

Added: trunk/LayoutTests/http/tests/misc/char-encoding-in-hidden-charset-field-with-EUC-JP.html (0 => 99310)


--- trunk/LayoutTests/http/tests/misc/char-encoding-in-hidden-charset-field-with-EUC-JP.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/misc/char-encoding-in-hidden-charset-field-with-EUC-JP.html	2011-11-04 19:53:21 UTC (rev 99310)
@@ -0,0 +1,27 @@
+<html>
+<head>
+<title>Test for bug 19079</title>
+</head>
+<body>
+<p>This is a test for https://bugs.webkit.org/show_bug.cgi?id=19079, it send the submissions
+character encoding in hidden _charset_ field.
+</p>
+<p>This should submit one _charset_=EUC-JP</p>
+
+<form id="testForm" action="" method="post" accept-charset="EUC-JP">
+<input type=hidden name="_charset_">
+<input type=submit>
+</form>
+
+<script>
+if (window.layoutTestController) {
+    layoutTestController.dumpAsText();
+    layoutTestController.waitUntilDone();
+}
+
+var form = document.getElementById("testForm");
+form.submit();
+</script>
+
+</body>
+</html>

Added: trunk/LayoutTests/http/tests/misc/char-encoding-in-hidden-charset-field-with-ISO-2022-JP-expected.txt (0 => 99310)


--- trunk/LayoutTests/http/tests/misc/char-encoding-in-hidden-charset-field-with-ISO-2022-JP-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/misc/char-encoding-in-hidden-charset-field-with-ISO-2022-JP-expected.txt	2011-11-04 19:53:21 UTC (rev 99310)
@@ -0,0 +1,3 @@
+This is a test for https://bugs.webkit.org/show_bug.cgi?id=19079, it send the submissions character encoding in hidden _charset_ field.
+
+PASSED: _charset_=ISO-2022-JP

Added: trunk/LayoutTests/http/tests/misc/char-encoding-in-hidden-charset-field-with-ISO-2022-JP.html (0 => 99310)


--- trunk/LayoutTests/http/tests/misc/char-encoding-in-hidden-charset-field-with-ISO-2022-JP.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/misc/char-encoding-in-hidden-charset-field-with-ISO-2022-JP.html	2011-11-04 19:53:21 UTC (rev 99310)
@@ -0,0 +1,27 @@
+<html>
+<head>
+<title>Test for bug 19079</title>
+</head>
+<body>
+<p>This is a test for https://bugs.webkit.org/show_bug.cgi?id=19079, it send the submissions
+character encoding in hidden _charset_ field.
+</p>
+<p>This should submit one _charset_=ISO-2022-JP</p>
+
+<form id="testForm" action="" method="post" accept-charset="ISO-2022-JP">
+<input type=hidden name="_charset_">
+<input type=submit>
+</form>
+
+<script>
+if (window.layoutTestController) {
+    layoutTestController.dumpAsText();
+    layoutTestController.waitUntilDone();
+}
+
+var form = document.getElementById("testForm");
+form.submit();
+</script>
+
+</body>
+</html>

Added: trunk/LayoutTests/http/tests/misc/char-encoding-in-hidden-charset-field-with-Shift_JIS-expected.txt (0 => 99310)


--- trunk/LayoutTests/http/tests/misc/char-encoding-in-hidden-charset-field-with-Shift_JIS-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/misc/char-encoding-in-hidden-charset-field-with-Shift_JIS-expected.txt	2011-11-04 19:53:21 UTC (rev 99310)
@@ -0,0 +1,3 @@
+This is a test for https://bugs.webkit.org/show_bug.cgi?id=19079, it send the submissions character encoding in hidden _charset_ field.
+
+PASSED: _charset_=Shift_JIS

Added: trunk/LayoutTests/http/tests/misc/char-encoding-in-hidden-charset-field-with-Shift_JIS.html (0 => 99310)


--- trunk/LayoutTests/http/tests/misc/char-encoding-in-hidden-charset-field-with-Shift_JIS.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/misc/char-encoding-in-hidden-charset-field-with-Shift_JIS.html	2011-11-04 19:53:21 UTC (rev 99310)
@@ -0,0 +1,27 @@
+<html>
+<head>
+<title>Test for bug 19079</title>
+</head>
+<body>
+<p>This is a test for https://bugs.webkit.org/show_bug.cgi?id=19079, it send the submissions
+character encoding in hidden _charset_ field.
+</p>
+<p>This should submit one _charset_=Shift_JIS</p>
+
+<form id="testForm" action="" method="post" accept-charset="Shift_JIS">
+<input type=hidden name="_charset_">
+<input type=submit>
+</form>
+
+<script>
+if (window.layoutTestController) {
+    layoutTestController.dumpAsText();
+    layoutTestController.waitUntilDone();
+}
+
+var form = document.getElementById("testForm");
+form.submit();
+</script>
+
+</body>
+</html>

Added: trunk/LayoutTests/http/tests/misc/char-encoding-in-hidden-charset-field-with-accept-charset-expected.txt (0 => 99310)


--- trunk/LayoutTests/http/tests/misc/char-encoding-in-hidden-charset-field-with-accept-charset-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/misc/char-encoding-in-hidden-charset-field-with-accept-charset-expected.txt	2011-11-04 19:53:21 UTC (rev 99310)
@@ -0,0 +1,3 @@
+This is a test for https://bugs.webkit.org/show_bug.cgi?id=19079, it send the submissions character encoding in hidden _charset_ field.
+
+PASSED: _charset_=UTF-8&_charset_=UTF-8

Added: trunk/LayoutTests/http/tests/misc/char-encoding-in-hidden-charset-field-with-accept-charset.html (0 => 99310)


--- trunk/LayoutTests/http/tests/misc/char-encoding-in-hidden-charset-field-with-accept-charset.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/misc/char-encoding-in-hidden-charset-field-with-accept-charset.html	2011-11-04 19:53:21 UTC (rev 99310)
@@ -0,0 +1,28 @@
+<html>
+<head>
+<title>Test for bug 19079</title>
+</head>
+<body>
+<p>This is a test for https://bugs.webkit.org/show_bug.cgi?id=19079, it send the submissions
+character encoding in hidden _charset_ field.
+</p>
+<p>This should submit two _charset_=UTF-8.  IE6 submits windows1252.</p>
+
+<form id="testForm" action="" method="post" accept-charset="UTF-8">
+<input type=hidden name="_charset_">
+<input type=hidden name="_charset_">
+<input type=submit>
+</form>
+
+<script>
+if (window.layoutTestController) {
+    layoutTestController.dumpAsText();
+    layoutTestController.waitUntilDone();
+}
+
+var form = document.getElementById("testForm");
+form.submit();
+</script>
+
+</body>
+</html>

Added: trunk/LayoutTests/http/tests/misc/char-encoding-in-hidden-charset-field-with-get-method-expected.txt (0 => 99310)


--- trunk/LayoutTests/http/tests/misc/char-encoding-in-hidden-charset-field-with-get-method-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/misc/char-encoding-in-hidden-charset-field-with-get-method-expected.txt	2011-11-04 19:53:21 UTC (rev 99310)
@@ -0,0 +1,3 @@
+This is a test for https://bugs.webkit.org/show_bug.cgi?id=19079, it send the submissions character encoding in hidden _charset_ field.
+
+PASSED: UTF-8

Added: trunk/LayoutTests/http/tests/misc/char-encoding-in-hidden-charset-field-with-get-method.html (0 => 99310)


--- trunk/LayoutTests/http/tests/misc/char-encoding-in-hidden-charset-field-with-get-method.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/misc/char-encoding-in-hidden-charset-field-with-get-method.html	2011-11-04 19:53:21 UTC (rev 99310)
@@ -0,0 +1,27 @@
+<html>
+<head>
+<title>Test for bug 19079</title>
+</head>
+<body>
+<p>This is a test for https://bugs.webkit.org/show_bug.cgi?id=19079, it send the submissions
+character encoding in hidden _charset_ field.
+</p>
+<p>This should submit one _charset_=UTF-8</p>
+
+<form id="testForm" action="" accept-charset="UTF-8">
+<input type=hidden name="_charset_">
+<input type=submit>
+</form>
+
+<script>
+if (window.layoutTestController) {
+    layoutTestController.dumpAsText();
+    layoutTestController.waitUntilDone();
+}
+
+var form = document.getElementById("testForm");
+form.submit();
+</script>
+
+</body>
+</html>

Added: trunk/LayoutTests/http/tests/misc/char-encoding-in-hidden-charset-field-with-one-field-expected.txt (0 => 99310)


--- trunk/LayoutTests/http/tests/misc/char-encoding-in-hidden-charset-field-with-one-field-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/misc/char-encoding-in-hidden-charset-field-with-one-field-expected.txt	2011-11-04 19:53:21 UTC (rev 99310)
@@ -0,0 +1,3 @@
+This is a test for https://bugs.webkit.org/show_bug.cgi?id=19079, it send the submissions character encoding in hidden _charset_ field.
+
+PASSED: _charset_=UTF-8

Added: trunk/LayoutTests/http/tests/misc/char-encoding-in-hidden-charset-field-with-one-field.html (0 => 99310)


--- trunk/LayoutTests/http/tests/misc/char-encoding-in-hidden-charset-field-with-one-field.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/misc/char-encoding-in-hidden-charset-field-with-one-field.html	2011-11-04 19:53:21 UTC (rev 99310)
@@ -0,0 +1,27 @@
+<html>
+<head>
+<title>Test for bug 19079</title>
+</head>
+<body>
+<p>This is a test for https://bugs.webkit.org/show_bug.cgi?id=19079, it send the submissions
+character encoding in hidden _charset_ field.
+</p>
+<p>This should submit one _charset_=UTF-8, for post method and enctype text/plain</p>
+
+<form id="testForm" action="" method="post" enctype="text/plain" accept-charset="UTF-8">
+<input type=hidden name="_charset_">
+<input type=submit>
+</form>
+
+<script>
+if (window.layoutTestController) {
+    layoutTestController.dumpAsText();
+    layoutTestController.waitUntilDone();
+}
+
+var form = document.getElementById("testForm");
+form.submit();
+</script>
+
+</body>
+</html>

Added: trunk/LayoutTests/http/tests/misc/char-encoding-in-text-charset-field-with-value-expected.txt (0 => 99310)


--- trunk/LayoutTests/http/tests/misc/char-encoding-in-text-charset-field-with-value-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/misc/char-encoding-in-text-charset-field-with-value-expected.txt	2011-11-04 19:53:21 UTC (rev 99310)
@@ -0,0 +1,3 @@
+This is a test for https://bugs.webkit.org/show_bug.cgi?id=19079, it send the submissions character encoding in hidden _charset_ field.
+
+PASSED: _charset_=I%27m+a+little+input%2C+short+and+stout

Added: trunk/LayoutTests/http/tests/misc/char-encoding-in-text-charset-field-with-value.html (0 => 99310)


--- trunk/LayoutTests/http/tests/misc/char-encoding-in-text-charset-field-with-value.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/misc/char-encoding-in-text-charset-field-with-value.html	2011-11-04 19:53:21 UTC (rev 99310)
@@ -0,0 +1,27 @@
+<html>
+<head>
+<title>Test for bug 19079</title>
+</head>
+<body>
+<p>This is a test for https://bugs.webkit.org/show_bug.cgi?id=19079, it send the submissions
+character encoding in hidden _charset_ field.
+</p>
+<p>This should submit _charset_=I\'m a little input, short and stout</p>
+
+<form id="testForm" action="" method="post">
+<input type=text name="_charset_" value="I'm a little input, short and stout">
+<input type=submit>
+</form>
+
+<script>
+if (window.layoutTestController) {
+    layoutTestController.dumpAsText();
+    layoutTestController.waitUntilDone();
+}
+
+var form = document.getElementById("testForm");
+form.submit();
+
+</script>
+</body>
+</html>

Added: trunk/LayoutTests/http/tests/misc/char-encoding-without-charset-field-expected.txt (0 => 99310)


--- trunk/LayoutTests/http/tests/misc/char-encoding-without-charset-field-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/misc/char-encoding-without-charset-field-expected.txt	2011-11-04 19:53:21 UTC (rev 99310)
@@ -0,0 +1,3 @@
+This is a test for https://bugs.webkit.org/show_bug.cgi?id=19079, it send the submissions character encoding in hidden _charset_ field.
+
+PASSED: No _charset_ field

Added: trunk/LayoutTests/http/tests/misc/char-encoding-without-charset-field.html (0 => 99310)


--- trunk/LayoutTests/http/tests/misc/char-encoding-without-charset-field.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/misc/char-encoding-without-charset-field.html	2011-11-04 19:53:21 UTC (rev 99310)
@@ -0,0 +1,25 @@
+<html>
+<head>
+<title>Test for bug 19079</title>
+</head>
+<body>
+<p>This is a test for https://bugs.webkit.org/show_bug.cgi?id=19079, it send the submissions
+character encoding in hidden _charset_ field.
+</p>
+<p>This should submit nothing except the header</p>
+
+<form id="testForm" action="" method="post" accept-charset="UTF-8">
+<input type=submit>
+</form>
+
+<script>
+if (window.layoutTestController) {
+    layoutTestController.dumpAsText();
+    layoutTestController.waitUntilDone();
+}
+var form = document.getElementById("testForm");
+form.submit();
+</script>
+
+</body>
+</html>

Added: trunk/LayoutTests/http/tests/misc/resources/char-encoding-in-hidden-charset-field.php (0 => 99310)


--- trunk/LayoutTests/http/tests/misc/resources/char-encoding-in-hidden-charset-field.php	                        (rev 0)
+++ trunk/LayoutTests/http/tests/misc/resources/char-encoding-in-hidden-charset-field.php	2011-11-04 19:53:21 UTC (rev 99310)
@@ -0,0 +1,34 @@
+<?php
+header("Content-type: text/html; charset=UTF-8");
+?>
+<html>
+<head>
+<title>Test for bug 19079</title>
+</head>
+<body>
+<p>
+This is a test for https://bugs.webkit.org/show_bug.cgi?id=19079, it send the submissions
+character encoding in hidden _charset_ field.
+</p>
+
+<?php
+if ($_SERVER['REQUEST_METHOD'] == 'POST') {
+$data = ""
+if ($data != "")
+echo "<p>PASSED: $data </p>";
+else
+echo "<p>PASSED: No _charset_ field </p>";
+}
+if ($_SERVER['REQUEST_METHOD'] == 'GET') {
+$data = ""
+echo "<p>PASSED: $data </p>";
+}
+?>
+
+<script>
+if(window.layoutTestController)
+    layoutTestController.notifyDone();
+</script>
+
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (99309 => 99310)


--- trunk/Source/WebCore/ChangeLog	2011-11-04 19:29:09 UTC (rev 99309)
+++ trunk/Source/WebCore/ChangeLog	2011-11-04 19:53:21 UTC (rev 99310)
@@ -1,3 +1,30 @@
+2011-11-04  Vineet Chaudhary  <[email protected]>
+
+        Send the submissions character encoding in hidden _charset_ field.
+        https://bugs.webkit.org/show_bug.cgi?id=19079
+
+        Reviewed by Darin Adler.
+
+        Spec reference http://dev.w3.org/html5/spec/Overview.html#attr-fe-name-charset
+        If _charset_ used as the name of a hidden control it should send character encoding
+        as value while submissions.
+
+        Tests: http/tests/misc/char-encoding-in-hidden-charset-field-default.html
+               http/tests/misc/char-encoding-in-hidden-charset-field-with-Big5.html
+               http/tests/misc/char-encoding-in-hidden-charset-field-with-EUC-JP.html
+               http/tests/misc/char-encoding-in-hidden-charset-field-with-ISO-2022-JP.html
+               http/tests/misc/char-encoding-in-hidden-charset-field-with-Shift_JIS.html
+               http/tests/misc/char-encoding-in-hidden-charset-field-with-accept-charset.html
+               http/tests/misc/char-encoding-in-hidden-charset-field-with-get-method.html
+               http/tests/misc/char-encoding-in-hidden-charset-field-with-one-field.html
+               http/tests/misc/char-encoding-in-text-charset-field-with-value.html
+               http/tests/misc/char-encoding-without-charset-field.html
+
+        * html/HiddenInputType.cpp:
+        (WebCore::HiddenInputType::isHiddenType):
+        (WebCore::HiddenInputType::appendFormData): For _charset_ send value as respective encodingType.
+        * html/HiddenInputType.h: Override appendFormData for hidden control types.
+
 2011-11-04  Robert Sesek  <[email protected]>
 
         [chromium] Use Chromium's copy of libWebKitSystemInterfaceLeopard.a

Modified: trunk/Source/WebCore/html/HiddenInputType.cpp (99309 => 99310)


--- trunk/Source/WebCore/html/HiddenInputType.cpp	2011-11-04 19:29:09 UTC (rev 99309)
+++ trunk/Source/WebCore/html/HiddenInputType.cpp	2011-11-04 19:53:21 UTC (rev 99310)
@@ -32,6 +32,7 @@
 #include "config.h"
 #include "HiddenInputType.h"
 
+#include "FormDataList.h"
 #include "HTMLInputElement.h"
 #include "HTMLNames.h"
 #include <wtf/PassOwnPtr.h>
@@ -84,6 +85,15 @@
     return true;
 }
 
+bool HiddenInputType::appendFormData(FormDataList& encoding, bool isMultipartForm) const
+{
+    if (equalIgnoringCase(element()->name(), "_charset_")) {
+        encoding.appendData(element()->name(), String(encoding.encoding().name()));
+        return true;
+    }
+    return InputType::appendFormData(encoding, isMultipartForm);
+}
+
 bool HiddenInputType::shouldRespectHeightAndWidthAttributes()
 {
     return true;

Modified: trunk/Source/WebCore/html/HiddenInputType.h (99309 => 99310)


--- trunk/Source/WebCore/html/HiddenInputType.h	2011-11-04 19:29:09 UTC (rev 99309)
+++ trunk/Source/WebCore/html/HiddenInputType.h	2011-11-04 19:53:21 UTC (rev 99310)
@@ -50,6 +50,7 @@
     virtual bool isHiddenType() const;
     virtual bool shouldRespectHeightAndWidthAttributes();
     virtual void setValue(const String&, bool, bool);
+    virtual bool appendFormData(FormDataList&, bool) const;
 };
 
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to