Title: [203394] trunk
Revision
203394
Author
[email protected]
Date
2016-07-18 21:45:53 -0700 (Mon, 18 Jul 2016)

Log Message

input.formEnctype / formMethod and button.formEnctype / formMethod / type should treat null as "null"
https://bugs.webkit.org/show_bug.cgi?id=159908

Reviewed by Alex Christensen.

LayoutTests/imported/w3c:

Rebaseline now that more checks are passing.

* web-platform-tests/html/dom/reflection-forms-expected.txt:

Source/WebCore:

input.formEnctype / formMethod and button.formEnctype / formMethod / type
should treat null as "null" String:
- https://html.spec.whatwg.org/multipage/forms.html#htmlinputelement
- https://html.spec.whatwg.org/multipage/forms.html#htmlbuttonelement

In WebKit, we would treat null as a null String which would end up
removing the corresponding attribute. This does not match the
specification. Firefox and Chrome match the specification here.

Tests:
- fast/dom/HTMLButtonElement/null-handling.html
- fast/dom/HTMLInputElement/null-handling.html

* html/HTMLButtonElement.idl:
* html/HTMLInputElement.idl:

LayoutTests:

Add layout test coverage.

* fast/dom/HTMLButtonElement/change-type-expected.txt:
* fast/dom/HTMLButtonElement/change-type.html:
* fast/dom/HTMLButtonElement/null-handling-expected.txt: Added.
* fast/dom/HTMLButtonElement/null-handling.html: Added.
* fast/dom/HTMLInputElement/null-handling-expected.txt: Added.
* fast/dom/HTMLInputElement/null-handling.html: Added.
* fast/forms/submit-form-attributes-expected.txt:
* fast/forms/submit-form-attributes.html:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (203393 => 203394)


--- trunk/LayoutTests/ChangeLog	2016-07-19 02:45:35 UTC (rev 203393)
+++ trunk/LayoutTests/ChangeLog	2016-07-19 04:45:53 UTC (rev 203394)
@@ -1,3 +1,21 @@
+2016-07-18  Chris Dumez  <[email protected]>
+
+        input.formEnctype / formMethod and button.formEnctype / formMethod / type should treat null as "null"
+        https://bugs.webkit.org/show_bug.cgi?id=159908
+
+        Reviewed by Alex Christensen.
+
+        Add layout test coverage.
+
+        * fast/dom/HTMLButtonElement/change-type-expected.txt:
+        * fast/dom/HTMLButtonElement/change-type.html:
+        * fast/dom/HTMLButtonElement/null-handling-expected.txt: Added.
+        * fast/dom/HTMLButtonElement/null-handling.html: Added.
+        * fast/dom/HTMLInputElement/null-handling-expected.txt: Added.
+        * fast/dom/HTMLInputElement/null-handling.html: Added.
+        * fast/forms/submit-form-attributes-expected.txt:
+        * fast/forms/submit-form-attributes.html:
+
 2016-07-18  Joseph Pecoraro  <[email protected]>
 
         Make builtin TypeErrors consistent

Modified: trunk/LayoutTests/fast/dom/HTMLButtonElement/change-type-expected.txt (203393 => 203394)


--- trunk/LayoutTests/fast/dom/HTMLButtonElement/change-type-expected.txt	2016-07-19 02:45:35 UTC (rev 203393)
+++ trunk/LayoutTests/fast/dom/HTMLButtonElement/change-type-expected.txt	2016-07-19 04:45:53 UTC (rev 203394)
@@ -30,7 +30,7 @@
 PASS btn.type = ' b u t t o n '; btn.type is 'submit'
 PASS btn.getAttribute('type') is ' b u t t o n '
 PASS btn.type = null; btn.type is 'submit'
-PASS btn.getAttribute('type') is null
+PASS btn.getAttribute('type') is "null"
 PASS btn.type = undefined; btn.type is 'submit'
 PASS btn.getAttribute('type') is 'undefined'
 PASS btn.type = 'reset'; txt.value = 'hello'; btn.click(); txt.value is ''

Modified: trunk/LayoutTests/fast/dom/HTMLButtonElement/change-type.html (203393 => 203394)


--- trunk/LayoutTests/fast/dom/HTMLButtonElement/change-type.html	2016-07-19 02:45:35 UTC (rev 203393)
+++ trunk/LayoutTests/fast/dom/HTMLButtonElement/change-type.html	2016-07-19 04:45:53 UTC (rev 203394)
@@ -58,7 +58,7 @@
     shouldBe("btn.getAttribute('type')", "' b u t t o n '");
     
     shouldBe("btn.type = null; btn.type", "'submit'");
-    shouldBe("btn.getAttribute('type')", "null");
+    shouldBeEqualToString("btn.getAttribute('type')", "null");
     
     shouldBe("btn.type = undefined; btn.type", "'submit'");
     shouldBe("btn.getAttribute('type')", "'undefined'");

Added: trunk/LayoutTests/fast/dom/HTMLButtonElement/null-handling-expected.txt (0 => 203394)


--- trunk/LayoutTests/fast/dom/HTMLButtonElement/null-handling-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/HTMLButtonElement/null-handling-expected.txt	2016-07-19 04:45:53 UTC (rev 203394)
@@ -0,0 +1,18 @@
+Tests null handling of several HTMLButtonElement attributes
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS button.getAttribute('formMethod') is null
+PASS button.getAttribute('formEnctype') is null
+PASS button.getAttribute('type') is null
+button.formMethod = null
+PASS button.getAttribute('formMethod') is "null"
+button.formEnctype = null
+PASS button.getAttribute('formEnctype') is "null"
+button.type = null
+PASS button.getAttribute('type') is "null"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/dom/HTMLButtonElement/null-handling.html (0 => 203394)


--- trunk/LayoutTests/fast/dom/HTMLButtonElement/null-handling.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/HTMLButtonElement/null-handling.html	2016-07-19 04:45:53 UTC (rev 203394)
@@ -0,0 +1,21 @@
+<DOCTYPE html>
+<html>
+<body>
+<script src=""
+<script>
+description("Tests null handling of several HTMLButtonElement attributes");
+
+var button = document.createElement("button");
+shouldBeNull("button.getAttribute('formMethod')", "");
+shouldBeNull("button.getAttribute('formEnctype')", "");
+shouldBeNull("button.getAttribute('type')", "");
+evalAndLog("button.formMethod = null");
+shouldBeEqualToString("button.getAttribute('formMethod')", "null");
+evalAndLog("button.formEnctype = null");
+shouldBeEqualToString("button.getAttribute('formEnctype')", "null");
+evalAndLog("button.type = null");
+shouldBeEqualToString("button.getAttribute('type')", "null");
+</script>
+<script src=""
+</body>
+</html>

Added: trunk/LayoutTests/fast/dom/HTMLInputElement/null-handling-expected.txt (0 => 203394)


--- trunk/LayoutTests/fast/dom/HTMLInputElement/null-handling-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/HTMLInputElement/null-handling-expected.txt	2016-07-19 04:45:53 UTC (rev 203394)
@@ -0,0 +1,15 @@
+Tests null handling of several HTMLInputElement attributes
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS input.getAttribute('formMethod') is null
+PASS input.getAttribute('formEnctype') is null
+input.formMethod = null
+PASS input.getAttribute('formMethod') is "null"
+input.formEnctype = null
+PASS input.getAttribute('formEnctype') is "null"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/dom/HTMLInputElement/null-handling.html (0 => 203394)


--- trunk/LayoutTests/fast/dom/HTMLInputElement/null-handling.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/HTMLInputElement/null-handling.html	2016-07-19 04:45:53 UTC (rev 203394)
@@ -0,0 +1,18 @@
+<DOCTYPE html>
+<html>
+<body>
+<script src=""
+<script>
+description("Tests null handling of several HTMLInputElement attributes");
+
+var input = document.createElement("input");
+shouldBeNull("input.getAttribute('formMethod')", "");
+shouldBeNull("input.getAttribute('formEnctype')", "");
+evalAndLog("input.formMethod = null");
+shouldBeEqualToString("input.getAttribute('formMethod')", "null");
+evalAndLog("input.formEnctype = null");
+shouldBeEqualToString("input.getAttribute('formEnctype')", "null");
+</script>
+<script src=""
+</body>
+</html>

Modified: trunk/LayoutTests/fast/forms/submit-form-attributes-expected.txt (203393 => 203394)


--- trunk/LayoutTests/fast/forms/submit-form-attributes-expected.txt	2016-07-19 02:45:35 UTC (rev 203393)
+++ trunk/LayoutTests/fast/forms/submit-form-attributes-expected.txt	2016-07-19 04:45:53 UTC (rev 203394)
@@ -26,12 +26,12 @@
 PASS input.formTarget is "nta"
 
 Setting null for input:
-PASS input.formEnctype is ""
-PASS input.getAttribute("formEnctype") is null
 PASS input.formEnctype is "application/x-www-form-urlencoded"
-PASS input.formMethod is ""
-PASS input.getAttribute("formMethod") is null
+PASS input.getAttribute("formEnctype") is "null"
+PASS input.formEnctype is "application/x-www-form-urlencoded"
 PASS input.formMethod is "get"
+PASS input.getAttribute("formMethod") is "null"
+PASS input.formMethod is "get"
 PASS input.formTarget is "null"
 PASS input.getAttribute("formTarget") is "null"
 PASS input.formTarget is "null"
@@ -81,12 +81,12 @@
 PASS button.formTarget is "nota"
 
 Setting null for button:
-PASS button.formEnctype is ""
-PASS button.getAttribute("formEnctype") is null
 PASS button.formEnctype is "application/x-www-form-urlencoded"
-PASS button.formMethod is ""
-PASS button.getAttribute("formMethod") is null
+PASS button.getAttribute("formEnctype") is "null"
+PASS button.formEnctype is "application/x-www-form-urlencoded"
 PASS button.formMethod is "get"
+PASS button.getAttribute("formMethod") is "null"
+PASS button.formMethod is "get"
 PASS button.formTarget is "null"
 PASS button.getAttribute("formTarget") is "null"
 PASS button.formTarget is "null"

Modified: trunk/LayoutTests/fast/forms/submit-form-attributes.html (203393 => 203394)


--- trunk/LayoutTests/fast/forms/submit-form-attributes.html	2016-07-19 02:45:35 UTC (rev 203393)
+++ trunk/LayoutTests/fast/forms/submit-form-attributes.html	2016-07-19 04:45:53 UTC (rev 203394)
@@ -55,13 +55,13 @@
 debug('');
 debug('Setting null for input:');
 input.formEnctype = null;
-shouldBeEqualToString('input.formEnctype', '');
-shouldBe('input.getAttribute("formEnctype")', 'null');
+shouldBeEqualToString('input.formEnctype', 'application/x-www-form-urlencoded');
+shouldBeEqualToString('input.getAttribute("formEnctype")', 'null');
 input.setAttribute('formEnctype', null);
 shouldBeEqualToString('input.formEnctype', 'application/x-www-form-urlencoded');
 input.formMethod = null;
-shouldBeEqualToString('input.formMethod', '');
-shouldBe('input.getAttribute("formMethod")', 'null');
+shouldBeEqualToString('input.formMethod', 'get');
+shouldBeEqualToString('input.getAttribute("formMethod")', 'null');
 input.setAttribute('formMethod', null);
 shouldBeEqualToString('input.formMethod', 'get');
 input.formTarget = null;
@@ -152,13 +152,13 @@
 debug('');
 debug('Setting null for button:');
 button.formEnctype = null;
-shouldBeEqualToString('button.formEnctype', '');
-shouldBe('button.getAttribute("formEnctype")', 'null');
+shouldBeEqualToString('button.formEnctype', 'application/x-www-form-urlencoded');
+shouldBeEqualToString('button.getAttribute("formEnctype")', 'null');
 button.setAttribute('formEnctype', null);
 shouldBeEqualToString('button.formEnctype', 'application/x-www-form-urlencoded');
 button.formMethod = null;
-shouldBeEqualToString('button.formMethod', '');
-shouldBe('button.getAttribute("formMethod")', 'null');
+shouldBeEqualToString('button.formMethod', 'get');
+shouldBeEqualToString('button.getAttribute("formMethod")', 'null');
 button.setAttribute('formMethod', null);
 shouldBeEqualToString('button.formMethod', 'get');
 button.formTarget = null;

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (203393 => 203394)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2016-07-19 02:45:35 UTC (rev 203393)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2016-07-19 04:45:53 UTC (rev 203394)
@@ -1,5 +1,16 @@
 2016-07-18  Chris Dumez  <[email protected]>
 
+        input.formEnctype / formMethod and button.formEnctype / formMethod / type should treat null as "null"
+        https://bugs.webkit.org/show_bug.cgi?id=159908
+
+        Reviewed by Alex Christensen.
+
+        Rebaseline now that more checks are passing.
+
+        * web-platform-tests/html/dom/reflection-forms-expected.txt:
+
+2016-07-18  Chris Dumez  <[email protected]>
+
         DocType's publicId / systemId should not be nullable
         https://bugs.webkit.org/show_bug.cgi?id=159901
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/reflection-forms-expected.txt (203393 => 203394)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/reflection-forms-expected.txt	2016-07-19 02:45:35 UTC (rev 203393)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/reflection-forms-expected.txt	2016-07-19 04:45:53 UTC (rev 203394)
@@ -4724,7 +4724,7 @@
 PASS input.formEnctype: IDL set to "\0" followed by getAttribute() 
 PASS input.formEnctype: IDL set to "\0" followed by IDL get 
 PASS input.formEnctype: IDL set to null should not throw 
-FAIL input.formEnctype: IDL set to null followed by IDL get assert_equals: expected "application/x-www-form-urlencoded" but got ""
+PASS input.formEnctype: IDL set to null followed by IDL get 
 PASS input.formEnctype: IDL set to object "test-toString" should not throw 
 PASS input.formEnctype: IDL set to object "test-toString" followed by getAttribute() 
 PASS input.formEnctype: IDL set to object "test-toString" followed by IDL get 
@@ -4865,7 +4865,7 @@
 PASS input.formMethod: IDL set to "\0" followed by getAttribute() 
 PASS input.formMethod: IDL set to "\0" followed by IDL get 
 PASS input.formMethod: IDL set to null should not throw 
-FAIL input.formMethod: IDL set to null followed by IDL get assert_equals: expected "get" but got ""
+PASS input.formMethod: IDL set to null followed by IDL get 
 PASS input.formMethod: IDL set to object "test-toString" should not throw 
 PASS input.formMethod: IDL set to object "test-toString" followed by getAttribute() 
 PASS input.formMethod: IDL set to object "test-toString" followed by IDL get 
@@ -8169,7 +8169,7 @@
 PASS button.formEnctype: IDL set to "\0" followed by getAttribute() 
 PASS button.formEnctype: IDL set to "\0" followed by IDL get 
 PASS button.formEnctype: IDL set to null should not throw 
-FAIL button.formEnctype: IDL set to null followed by IDL get assert_equals: expected "application/x-www-form-urlencoded" but got ""
+PASS button.formEnctype: IDL set to null followed by IDL get 
 PASS button.formEnctype: IDL set to object "test-toString" should not throw 
 PASS button.formEnctype: IDL set to object "test-toString" followed by getAttribute() 
 PASS button.formEnctype: IDL set to object "test-toString" followed by IDL get 
@@ -8320,7 +8320,7 @@
 PASS button.formMethod: IDL set to "\0" followed by getAttribute() 
 PASS button.formMethod: IDL set to "\0" followed by IDL get 
 PASS button.formMethod: IDL set to null should not throw 
-FAIL button.formMethod: IDL set to null followed by IDL get assert_equals: expected "get" but got ""
+PASS button.formMethod: IDL set to null followed by IDL get 
 PASS button.formMethod: IDL set to object "test-toString" should not throw 
 PASS button.formMethod: IDL set to object "test-toString" followed by getAttribute() 
 PASS button.formMethod: IDL set to object "test-toString" followed by IDL get 

Modified: trunk/LayoutTests/platform/ios-simulator/imported/w3c/web-platform-tests/html/dom/reflection-forms-expected.txt (203393 => 203394)


--- trunk/LayoutTests/platform/ios-simulator/imported/w3c/web-platform-tests/html/dom/reflection-forms-expected.txt	2016-07-19 02:45:35 UTC (rev 203393)
+++ trunk/LayoutTests/platform/ios-simulator/imported/w3c/web-platform-tests/html/dom/reflection-forms-expected.txt	2016-07-19 04:45:53 UTC (rev 203394)
@@ -4724,7 +4724,7 @@
 PASS input.formEnctype: IDL set to "\0" followed by getAttribute() 
 PASS input.formEnctype: IDL set to "\0" followed by IDL get 
 PASS input.formEnctype: IDL set to null should not throw 
-FAIL input.formEnctype: IDL set to null followed by IDL get assert_equals: expected "application/x-www-form-urlencoded" but got ""
+PASS input.formEnctype: IDL set to null followed by IDL get 
 PASS input.formEnctype: IDL set to object "test-toString" should not throw 
 PASS input.formEnctype: IDL set to object "test-toString" followed by getAttribute() 
 PASS input.formEnctype: IDL set to object "test-toString" followed by IDL get 
@@ -4865,7 +4865,7 @@
 PASS input.formMethod: IDL set to "\0" followed by getAttribute() 
 PASS input.formMethod: IDL set to "\0" followed by IDL get 
 PASS input.formMethod: IDL set to null should not throw 
-FAIL input.formMethod: IDL set to null followed by IDL get assert_equals: expected "get" but got ""
+PASS input.formMethod: IDL set to null followed by IDL get 
 PASS input.formMethod: IDL set to object "test-toString" should not throw 
 PASS input.formMethod: IDL set to object "test-toString" followed by getAttribute() 
 PASS input.formMethod: IDL set to object "test-toString" followed by IDL get 
@@ -8169,7 +8169,7 @@
 PASS button.formEnctype: IDL set to "\0" followed by getAttribute() 
 PASS button.formEnctype: IDL set to "\0" followed by IDL get 
 PASS button.formEnctype: IDL set to null should not throw 
-FAIL button.formEnctype: IDL set to null followed by IDL get assert_equals: expected "application/x-www-form-urlencoded" but got ""
+PASS button.formEnctype: IDL set to null followed by IDL get 
 PASS button.formEnctype: IDL set to object "test-toString" should not throw 
 PASS button.formEnctype: IDL set to object "test-toString" followed by getAttribute() 
 PASS button.formEnctype: IDL set to object "test-toString" followed by IDL get 
@@ -8320,7 +8320,7 @@
 PASS button.formMethod: IDL set to "\0" followed by getAttribute() 
 PASS button.formMethod: IDL set to "\0" followed by IDL get 
 PASS button.formMethod: IDL set to null should not throw 
-FAIL button.formMethod: IDL set to null followed by IDL get assert_equals: expected "get" but got ""
+PASS button.formMethod: IDL set to null followed by IDL get 
 PASS button.formMethod: IDL set to object "test-toString" should not throw 
 PASS button.formMethod: IDL set to object "test-toString" followed by getAttribute() 
 PASS button.formMethod: IDL set to object "test-toString" followed by IDL get 

Modified: trunk/Source/WebCore/ChangeLog (203393 => 203394)


--- trunk/Source/WebCore/ChangeLog	2016-07-19 02:45:35 UTC (rev 203393)
+++ trunk/Source/WebCore/ChangeLog	2016-07-19 04:45:53 UTC (rev 203394)
@@ -1,3 +1,26 @@
+2016-07-18  Chris Dumez  <[email protected]>
+
+        input.formEnctype / formMethod and button.formEnctype / formMethod / type should treat null as "null"
+        https://bugs.webkit.org/show_bug.cgi?id=159908
+
+        Reviewed by Alex Christensen.
+
+        input.formEnctype / formMethod and button.formEnctype / formMethod / type
+        should treat null as "null" String:
+        - https://html.spec.whatwg.org/multipage/forms.html#htmlinputelement
+        - https://html.spec.whatwg.org/multipage/forms.html#htmlbuttonelement
+
+        In WebKit, we would treat null as a null String which would end up
+        removing the corresponding attribute. This does not match the
+        specification. Firefox and Chrome match the specification here.
+
+        Tests:
+        - fast/dom/HTMLButtonElement/null-handling.html
+        - fast/dom/HTMLInputElement/null-handling.html
+
+        * html/HTMLButtonElement.idl:
+        * html/HTMLInputElement.idl:
+
 2016-07-18  Alex Christensen  <[email protected]>
 
         webbookmarksd needs to use the same AppCache directory as MobileSafari

Modified: trunk/Source/WebCore/html/HTMLButtonElement.idl (203393 => 203394)


--- trunk/Source/WebCore/html/HTMLButtonElement.idl	2016-07-19 02:45:35 UTC (rev 203393)
+++ trunk/Source/WebCore/html/HTMLButtonElement.idl	2016-07-19 04:45:53 UTC (rev 203394)
@@ -24,10 +24,9 @@
     readonly attribute HTMLFormElement form;
     attribute DOMString formAction;
 
-    // FIXME: These should not have [TreatNullAs=LegacyNullString].
-    [TreatNullAs=LegacyNullString] attribute DOMString formEnctype;
-    [TreatNullAs=LegacyNullString] attribute DOMString formMethod;
-    [TreatNullAs=LegacyNullString] attribute DOMString type;
+    attribute DOMString formEnctype;
+    attribute DOMString formMethod;
+    attribute DOMString type;
 
     [Reflect] attribute boolean formNoValidate;
     [Reflect] attribute DOMString formTarget;

Modified: trunk/Source/WebCore/html/HTMLInputElement.idl (203393 => 203394)


--- trunk/Source/WebCore/html/HTMLInputElement.idl	2016-07-19 02:45:35 UTC (rev 203393)
+++ trunk/Source/WebCore/html/HTMLInputElement.idl	2016-07-19 04:45:53 UTC (rev 203394)
@@ -35,9 +35,8 @@
     attribute FileList? files;
     attribute DOMString formAction;
 
-    // FIXME: These should not use [TreatNullAs=LegacyNullString].
-    [TreatNullAs=LegacyNullString] attribute DOMString formEnctype;
-    [TreatNullAs=LegacyNullString] attribute DOMString formMethod;
+    attribute DOMString formEnctype;
+    attribute DOMString formMethod;
 
     [Reflect] attribute boolean formNoValidate;
     [Reflect] attribute DOMString formTarget;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to