formMethod to have empty string as default value and 'get' as invalid.
authorrgf748@motorola.com <rgf748@motorola.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 31 Jan 2013 13:01:58 +0000 (13:01 +0000)
committerrgf748@motorola.com <rgf748@motorola.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 31 Jan 2013 13:01:58 +0000 (13:01 +0000)
https://bugs.webkit.org/show_bug.cgi?id=108263

Reviewed by Kent Tamura.

The spec says formmethod should only have an invalid value default, not a missing value default.
Spec: http://www.whatwg.org/specs/web-apps/current-work/#form-submission-0
      http://www.w3.org/html/wg/drafts/html/master/forms.html#attr-fs-formmethod

Source/WebCore:

Test: fast/forms/formmethod-attribute-test.html

* html/HTMLFormControlElement.cpp: For the missing formMethod attr return empty string.
(WebCore::HTMLFormControlElement::formMethod):

LayoutTests:

* fast/forms/formmethod-attribute-test-expected.txt: Added.
* fast/forms/formmethod-attribute-test.html: Added.
* fast/forms/submit-form-attributes-expected.txt:
* fast/forms/submit-form-attributes.html: Modified test to behave as expected.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@141405 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/forms/formmethod-attribute-test-expected.txt [new file with mode: 0644]
LayoutTests/fast/forms/formmethod-attribute-test.html [new file with mode: 0644]
LayoutTests/fast/forms/submit-form-attributes-expected.txt
LayoutTests/fast/forms/submit-form-attributes.html
Source/WebCore/ChangeLog
Source/WebCore/html/HTMLFormControlElement.cpp

index 2e774228cbbe0965b6e9c1d455cde90c48ccc8ad..ebda1c6240dd167e2df85e9ebd661d7701fdca93 100644 (file)
@@ -1,3 +1,19 @@
+2013-01-31   Vineet Chaudhary  <rgf748@motorola.com>
+
+        formMethod to have empty string as default value and 'get' as invalid.
+        https://bugs.webkit.org/show_bug.cgi?id=108263
+
+        Reviewed by Kent Tamura.
+
+        The spec says formmethod should only have an invalid value default, not a missing value default.
+        Spec: http://www.whatwg.org/specs/web-apps/current-work/#form-submission-0
+              http://www.w3.org/html/wg/drafts/html/master/forms.html#attr-fs-formmethod
+
+        * fast/forms/formmethod-attribute-test-expected.txt: Added.
+        * fast/forms/formmethod-attribute-test.html: Added.
+        * fast/forms/submit-form-attributes-expected.txt:
+        * fast/forms/submit-form-attributes.html: Modified test to behave as expected.
+
 2013-01-31  Andrey Adaikin  <aandrey@chromium.org>
 
         Web Inspector: [Canvas] remove invalid canvas profile trace logs upon frame navigation
diff --git a/LayoutTests/fast/forms/formmethod-attribute-test-expected.txt b/LayoutTests/fast/forms/formmethod-attribute-test-expected.txt
new file mode 100644 (file)
index 0000000..e4be7fe
--- /dev/null
@@ -0,0 +1,27 @@
+Test formmethod attribute
+
+    
+Missing value
+PASS ip1.formMethod is ""
+PASS ip1.getAttribute('formmethod') is null
+
+Empty value
+PASS ip2.formMethod is "get"
+PASS ip2.getAttribute('formmethod') is ""
+
+Post value
+PASS ip3.formMethod is "post"
+PASS ip3.getAttribute('formmethod') is "post"
+
+Get value
+PASS ip4.formMethod is "get"
+PASS ip4.getAttribute('formmethod') is "get"
+
+Invalid value
+PASS ip5.formMethod is "get"
+PASS ip5.getAttribute('formmethod') is "foo"
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/forms/formmethod-attribute-test.html b/LayoutTests/fast/forms/formmethod-attribute-test.html
new file mode 100644 (file)
index 0000000..b41e0cb
--- /dev/null
@@ -0,0 +1,52 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src="../js/resources/js-test-pre.js"></script>
+
+<p>Test formmethod attribute</p>
+
+<form id=f1 method="post">
+<input type="submit" value="Submit" id="ip1">
+<input type="submit" formmethod="" value="Submit" id="ip2">
+<input type="submit" formmethod="post" value="Submit" id="ip3">
+<input type="submit" formmethod="get" value="Submit" id="ip4">
+<input type="submit" formmethod="foo" value="Submit" id="ip5">
+</form>
+<div id=console></div>
+<script>
+var form1 = document.getElementById('f1');
+
+debug('Missing value');
+var ip1 = document.getElementById('ip1');
+shouldBeEqualToString("ip1.formMethod","");
+shouldBeNull("ip1.getAttribute('formmethod')");
+debug('');
+
+debug('Empty value');
+var ip2 = document.getElementById('ip2');
+shouldBeEqualToString("ip2.formMethod", "get");
+shouldBeEqualToString("ip2.getAttribute('formmethod')", "");
+debug('');
+
+debug('Post value');
+var ip3 = document.getElementById('ip3');
+shouldBeEqualToString("ip3.formMethod", "post");
+shouldBeEqualToString("ip3.getAttribute('formmethod')", "post");
+debug('');
+
+debug('Get value');
+var ip4 = document.getElementById('ip4');
+shouldBeEqualToString("ip4.formMethod", "get");
+shouldBeEqualToString("ip4.getAttribute('formmethod')", "get");
+debug('');
+
+debug('Invalid value');
+var ip5 = document.getElementById('ip5');
+shouldBeEqualToString("ip5.formMethod", "get");
+shouldBeEqualToString("ip5.getAttribute('formmethod')", "foo");
+debug('');
+</script>
+<script src="../js/resources/js-test-post.js"></script>
+</body>
+</html>
+
index 25a90008fc979ad6e335b917b08e9be3e776190d..4c454ad6bd76a47019c2382555ff977d4a8e7b2c 100644 (file)
@@ -6,7 +6,7 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
 Ordinary values for input:
 PASS input.formAction is ""
 PASS input.formEnctype is "application/x-www-form-urlencoded"
-PASS input.formMethod is "get"
+PASS input.formMethod is ""
 PASS input.formTarget is ""
 PASS input.formAction is "http://localhost/"
 PASS input.formAction is "http://localhost/"
@@ -29,7 +29,7 @@ Setting null for input:
 PASS input.formEnctype is "application/x-www-form-urlencoded"
 PASS input.getAttribute("formEnctype") is null
 PASS input.formEnctype is "application/x-www-form-urlencoded"
-PASS input.formMethod is "get"
+PASS input.formMethod is ""
 PASS input.getAttribute("formMethod") is null
 PASS input.formMethod is "get"
 PASS input.formTarget is ""
@@ -61,7 +61,7 @@ PASS input.formTarget is "256"
 Ordinary values for button:
 PASS button.formAction is ""
 PASS button.formEnctype is "application/x-www-form-urlencoded"
-PASS button.formMethod is "get"
+PASS button.formMethod is ""
 PASS button.formTarget is ""
 PASS button.formAction is "http://localhost/"
 PASS button.formAction is "http://localhost/"
@@ -84,7 +84,7 @@ Setting null for button:
 PASS button.formEnctype is "application/x-www-form-urlencoded"
 PASS button.getAttribute("formEnctype") is null
 PASS button.formEnctype is "application/x-www-form-urlencoded"
-PASS button.formMethod is "get"
+PASS button.formMethod is ""
 PASS button.getAttribute("formMethod") is null
 PASS button.formMethod is "get"
 PASS button.formTarget is ""
index 61c4c9bcc7f4b8c8907ca8c7daae118eba52a5a2..2fb82017999a92f02c77b366e32875f66afde9bf 100644 (file)
@@ -15,7 +15,7 @@ debug('Ordinary values for input:');
 input.type = "submit";
 shouldBe('input.formAction', '""');
 shouldBe('input.formEnctype', '"application/x-www-form-urlencoded"');
-shouldBe('input.formMethod', '"get"');
+shouldBeEqualToString("input.formMethod", "");
 shouldBe('input.formTarget', '""');
 
 input.setAttribute('formAction', 'http://localhost');
@@ -60,7 +60,7 @@ shouldBe('input.getAttribute("formEnctype")', 'null');
 input.setAttribute('formEnctype', null);
 shouldBe('input.formEnctype', '"application/x-www-form-urlencoded"');
 input.formMethod = null;
-shouldBe('input.formMethod', '"get"');
+shouldBeEqualToString("input.formMethod", "");
 shouldBe('input.getAttribute("formMethod")', 'null');
 input.setAttribute('formMethod', null);
 shouldBe('input.formMethod', '"get"');
@@ -112,7 +112,7 @@ debug('Ordinary values for button:');
 button.type = "submit";
 shouldBe('button.formAction', '""');
 shouldBe('button.formEnctype', '"application/x-www-form-urlencoded"');
-shouldBe('button.formMethod', '"get"');
+shouldBeEqualToString("button.formMethod", "");
 shouldBe('button.formTarget', '""');
 
 button.setAttribute('formAction', 'http://localhost');
@@ -157,7 +157,7 @@ shouldBe('button.getAttribute("formEnctype")', 'null');
 button.setAttribute('formEnctype', null);
 shouldBe('button.formEnctype', '"application/x-www-form-urlencoded"');
 button.formMethod = null;
-shouldBe('button.formMethod', '"get"');
+shouldBeEqualToString("button.formMethod", "");
 shouldBe('button.getAttribute("formMethod")', 'null');
 button.setAttribute('formMethod', null);
 shouldBe('button.formMethod', '"get"');
index 306ada5a2f92597cfb265cdfb732802b9c290c36..b3ad34643538aa76aa14a639286fbdb09831b66e 100644 (file)
@@ -1,3 +1,19 @@
+2013-01-31   Vineet Chaudhary  <rgf748@motorola.com>
+
+        formMethod to have empty string as default value and 'get' as invalid.
+        https://bugs.webkit.org/show_bug.cgi?id=108263
+
+        Reviewed by Kent Tamura.
+
+        The spec says formmethod should only have an invalid value default, not a missing value default.
+        Spec: http://www.whatwg.org/specs/web-apps/current-work/#form-submission-0
+              http://www.w3.org/html/wg/drafts/html/master/forms.html#attr-fs-formmethod
+
+        Test: fast/forms/formmethod-attribute-test.html
+
+        * html/HTMLFormControlElement.cpp: For the missing formMethod attr return empty string.
+        (WebCore::HTMLFormControlElement::formMethod):
+
 2013-01-20 Kondapally Kalyan <kalyan.kondapally@intel.com>
 
         [Efl][WebGL] Add better support to track and free XResources.
index 77618da1ac3c2128752412bbbb3c4fac3aa2734a..1eb7ae343348bbcefc56bbbb5aed1c53bc2983c9 100644 (file)
@@ -82,7 +82,10 @@ void HTMLFormControlElement::setFormEnctype(const String& value)
 
 String HTMLFormControlElement::formMethod() const
 {
-    return FormSubmission::Attributes::methodString(FormSubmission::Attributes::parseMethodType(fastGetAttribute(formmethodAttr)));
+    const AtomicString& formMethodAttr = fastGetAttribute(formmethodAttr);
+    if (formMethodAttr.isNull())
+        return emptyString();
+    return FormSubmission::Attributes::methodString(FormSubmission::Attributes::parseMethodType(formMethodAttr));
 }
 
 void HTMLFormControlElement::setFormMethod(const String& value)