Title: [213834] releases/WebKitGTK/webkit-2.16
Revision
213834
Author
[email protected]
Date
2017-03-13 05:06:06 -0700 (Mon, 13 Mar 2017)

Log Message

Merge r213606 - Parameter to input.setCustomValidity() should not be nullable
https://bugs.webkit.org/show_bug.cgi?id=169332

Reviewed by Sam Weinig.

Source/WebCore:

Parameter to input.setCustomValidity() should not be nullable:
- https://html.spec.whatwg.org/#htmlinputelement

Firefox and Chrome agree with the specification so the change
should be safe.

Test: fast/forms/setCustomValidity-null-parameter.html

* html/HTMLButtonElement.idl:
* html/HTMLFieldSetElement.idl:
* html/HTMLInputElement.idl:
* html/HTMLKeygenElement.idl:
* html/HTMLObjectElement.idl:
* html/HTMLOutputElement.idl:
* html/HTMLSelectElement.idl:
* html/HTMLTextAreaElement.idl:

LayoutTests:

* fast/forms/ValidityState-customError-expected.txt:
* fast/forms/ValidityState-customError.html:
Rebaseline now that behavior has changed when passing null or undefined
to setCustomValidity().

* fast/forms/setCustomValidity-null-parameter-expected.txt: Added.
* fast/forms/setCustomValidity-null-parameter.html: Added.
Add layout test coverage.

Modified Paths

Added Paths

Diff

Modified: releases/WebKitGTK/webkit-2.16/LayoutTests/ChangeLog (213833 => 213834)


--- releases/WebKitGTK/webkit-2.16/LayoutTests/ChangeLog	2017-03-13 12:01:02 UTC (rev 213833)
+++ releases/WebKitGTK/webkit-2.16/LayoutTests/ChangeLog	2017-03-13 12:06:06 UTC (rev 213834)
@@ -1,3 +1,19 @@
+2017-03-08  Chris Dumez  <[email protected]>
+
+        Parameter to input.setCustomValidity() should not be nullable
+        https://bugs.webkit.org/show_bug.cgi?id=169332
+
+        Reviewed by Sam Weinig.
+
+        * fast/forms/ValidityState-customError-expected.txt:
+        * fast/forms/ValidityState-customError.html:
+        Rebaseline now that behavior has changed when passing null or undefined
+        to setCustomValidity().
+
+        * fast/forms/setCustomValidity-null-parameter-expected.txt: Added.
+        * fast/forms/setCustomValidity-null-parameter.html: Added.
+        Add layout test coverage.
+
 2017-03-08  Dave Hyatt  <[email protected]>
 
         CSS Multicolumn should not clip columns horizontally

Modified: releases/WebKitGTK/webkit-2.16/LayoutTests/fast/forms/ValidityState-customError-expected.txt (213833 => 213834)


--- releases/WebKitGTK/webkit-2.16/LayoutTests/fast/forms/ValidityState-customError-expected.txt	2017-03-13 12:01:02 UTC (rev 213833)
+++ releases/WebKitGTK/webkit-2.16/LayoutTests/fast/forms/ValidityState-customError-expected.txt	2017-03-13 12:06:06 UTC (rev 213834)
@@ -44,13 +44,13 @@
 PASS setCustomValidity() threw Not enough arguments
 PASS setCustomValidity() threw Not enough arguments
 PASS customErrorFor("fieldset-many-changes") is false
-PASS customErrorFor("button-many-changes") is false
+PASS customErrorFor("button-many-changes") is true
 PASS customErrorFor("button-button-many-changes") is false
 PASS customErrorFor("button-reset-many-changes") is false
-PASS customErrorFor("select-many-changes") is false
-PASS customErrorFor("textarea-many-changes") is false
-PASS customErrorFor("input-many-changes") is false
-PASS customErrorFor("input-submit-many-changes") is false
+PASS customErrorFor("select-many-changes") is true
+PASS customErrorFor("textarea-many-changes") is true
+PASS customErrorFor("input-many-changes") is true
+PASS customErrorFor("input-submit-many-changes") is true
 Set with three arguments.
 PASS customErrorFor("fieldset-many-changes") is false
 PASS customErrorFor("button-many-changes") is true
@@ -62,22 +62,22 @@
 PASS customErrorFor("input-submit-many-changes") is true
 Set null.
 PASS customErrorFor("fieldset-many-changes") is false
-PASS customErrorFor("button-many-changes") is false
+PASS customErrorFor("button-many-changes") is true
 PASS customErrorFor("button-button-many-changes") is false
 PASS customErrorFor("button-reset-many-changes") is false
-PASS customErrorFor("select-many-changes") is false
-PASS customErrorFor("textarea-many-changes") is false
-PASS customErrorFor("input-many-changes") is false
-PASS customErrorFor("input-submit-many-changes") is false
+PASS customErrorFor("select-many-changes") is true
+PASS customErrorFor("textarea-many-changes") is true
+PASS customErrorFor("input-many-changes") is true
+PASS customErrorFor("input-submit-many-changes") is true
 Set some value, and set undefined.
 PASS customErrorFor("fieldset-many-changes") is false
-PASS customErrorFor("button-many-changes") is false
+PASS customErrorFor("button-many-changes") is true
 PASS customErrorFor("button-button-many-changes") is false
 PASS customErrorFor("button-reset-many-changes") is false
-PASS customErrorFor("select-many-changes") is false
-PASS customErrorFor("textarea-many-changes") is false
-PASS customErrorFor("input-many-changes") is false
-PASS customErrorFor("input-submit-many-changes") is false
+PASS customErrorFor("select-many-changes") is true
+PASS customErrorFor("textarea-many-changes") is true
+PASS customErrorFor("input-many-changes") is true
+PASS customErrorFor("input-submit-many-changes") is true
 
 PASS successfullyParsed is true
 

Modified: releases/WebKitGTK/webkit-2.16/LayoutTests/fast/forms/ValidityState-customError.html (213833 => 213834)


--- releases/WebKitGTK/webkit-2.16/LayoutTests/fast/forms/ValidityState-customError.html	2017-03-13 12:01:02 UTC (rev 213833)
+++ releases/WebKitGTK/webkit-2.16/LayoutTests/fast/forms/ValidityState-customError.html	2017-03-13 12:06:06 UTC (rev 213834)
@@ -105,13 +105,13 @@
     v[i].setCustomValidity(undefined);
 }
 shouldBeFalse('customErrorFor("fieldset-many-changes")');
-shouldBeFalse('customErrorFor("button-many-changes")');
+shouldBeTrue('customErrorFor("button-many-changes")');
 shouldBeFalse('customErrorFor("button-button-many-changes")');
 shouldBeFalse('customErrorFor("button-reset-many-changes")');
-shouldBeFalse('customErrorFor("select-many-changes")');
-shouldBeFalse('customErrorFor("textarea-many-changes")');
-shouldBeFalse('customErrorFor("input-many-changes")');
-shouldBeFalse('customErrorFor("input-submit-many-changes")');
+shouldBeTrue('customErrorFor("select-many-changes")');
+shouldBeTrue('customErrorFor("textarea-many-changes")');
+shouldBeTrue('customErrorFor("input-many-changes")');
+shouldBeTrue('customErrorFor("input-submit-many-changes")');
 
 debug('Set with three arguments.');
 for (i = 0; i < v.length; i++)
@@ -129,13 +129,13 @@
 for (i = 0; i < v.length; i++)
     v[i].setCustomValidity(null);
 shouldBeFalse('customErrorFor("fieldset-many-changes")');
-shouldBeFalse('customErrorFor("button-many-changes")');
+shouldBeTrue('customErrorFor("button-many-changes")');
 shouldBeFalse('customErrorFor("button-button-many-changes")');
 shouldBeFalse('customErrorFor("button-reset-many-changes")');
-shouldBeFalse('customErrorFor("select-many-changes")');
-shouldBeFalse('customErrorFor("textarea-many-changes")');
-shouldBeFalse('customErrorFor("input-many-changes")');
-shouldBeFalse('customErrorFor("input-submit-many-changes")');
+shouldBeTrue('customErrorFor("select-many-changes")');
+shouldBeTrue('customErrorFor("textarea-many-changes")');
+shouldBeTrue('customErrorFor("input-many-changes")');
+shouldBeTrue('customErrorFor("input-submit-many-changes")');
 
 debug('Set some value, and set undefined.');
 for (i = 0; i < v.length; i++) {
@@ -143,13 +143,13 @@
     v[i].setCustomValidity(undefined);
 }
 shouldBeFalse('customErrorFor("fieldset-many-changes")');
-shouldBeFalse('customErrorFor("button-many-changes")');
+shouldBeTrue('customErrorFor("button-many-changes")');
 shouldBeFalse('customErrorFor("button-button-many-changes")');
 shouldBeFalse('customErrorFor("button-reset-many-changes")');
-shouldBeFalse('customErrorFor("select-many-changes")');
-shouldBeFalse('customErrorFor("textarea-many-changes")');
-shouldBeFalse('customErrorFor("input-many-changes")');
-shouldBeFalse('customErrorFor("input-submit-many-changes")');
+shouldBeTrue('customErrorFor("select-many-changes")');
+shouldBeTrue('customErrorFor("textarea-many-changes")');
+shouldBeTrue('customErrorFor("input-many-changes")');
+shouldBeTrue('customErrorFor("input-submit-many-changes")');
 
 debug('');
 </script>

Added: releases/WebKitGTK/webkit-2.16/LayoutTests/fast/forms/setCustomValidity-null-parameter-expected.txt (0 => 213834)


--- releases/WebKitGTK/webkit-2.16/LayoutTests/fast/forms/setCustomValidity-null-parameter-expected.txt	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.16/LayoutTests/fast/forms/setCustomValidity-null-parameter-expected.txt	2017-03-13 12:06:06 UTC (rev 213834)
@@ -0,0 +1,12 @@
+Test that the parameter to setCustomValidity() is not nullable
+
+
+PASS button Element 
+PASS input Element 
+PASS select Element 
+PASS textarea Element 
+PASS fieldset Element 
+PASS keygen Element 
+PASS object Element 
+PASS output Element 
+

Added: releases/WebKitGTK/webkit-2.16/LayoutTests/fast/forms/setCustomValidity-null-parameter.html (0 => 213834)


--- releases/WebKitGTK/webkit-2.16/LayoutTests/fast/forms/setCustomValidity-null-parameter.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.16/LayoutTests/fast/forms/setCustomValidity-null-parameter.html	2017-03-13 12:06:06 UTC (rev 213834)
@@ -0,0 +1,77 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src=""
+<script src=""
+<p>Test that the parameter to setCustomValidity() is not nullable</p>
+<script>
+function testFormControl(control, name)
+{
+    test(() => {
+        assert_true(control.checkValidity(), "Initial checkValidity()");
+        assert_true(control.validity.valid, "Initial ValidityState.valid");
+        assert_false(control.validity.customError, "Initial ValidityState.customError");
+        assert_equals(control.validationMessage, "", "Initial validationMessage");
+
+        control.setCustomValidity("error");
+        assert_false(control.checkValidity(), "checkValidity() after setting custom validity message to 'error'");
+        assert_false(control.validity.valid, "ValidityState.valid after setting custom validity message to 'error'");
+        assert_true(control.validity.customError, "ValidityState.customError after setting custom validity message to 'error'");
+        assert_equals(control.validationMessage, "error", "validationMessage after setting custom validity message to 'error'");
+
+        control.setCustomValidity(null);
+        assert_false(control.checkValidity(), "checkValidity() after setting custom validity message to null");
+        assert_false(control.validity.valid, "ValidityState.valid after setting custom validity message to null");
+        assert_true(control.validity.customError, "ValidityState.customError after setting custom validity message to null");
+        assert_equals(control.validationMessage, "null", "validationMessage after setting custom validity message to null");
+
+        control.setCustomValidity(undefined);
+        assert_false(control.checkValidity(), "checkValidity() after setting custom validity message to undefined");
+        assert_false(control.validity.valid, "ValidityState.valid after setting custom validity message to undefined");
+        assert_true(control.validity.customError, "ValidityState.customError after setting custom validity message to undefined");
+        assert_equals(control.validationMessage, "undefined", "validationMessage after setting custom validity message to undefined");
+
+        control.setCustomValidity("");
+        assert_true(control.checkValidity(), "checkValidity() after setting custom validity message to empty string");
+        assert_true(control.validity.valid, "ValidityState.valid after setting custom validity message to empty string");
+        assert_false(control.validity.customError, "ValidityState.customError after setting custom validity message to empty string");
+        assert_equals(control.validationMessage, "", "validationMessage after setting custom validity message to empty string");
+    }, name);
+}
+
+function testFormControlBarredFromValidation(control, name)
+{
+    test(() => {
+        assert_true(control.checkValidity(), "Initial checkValidity()");
+        assert_true(control.validity.valid, "Initial ValidityState.valid");
+        assert_false(control.validity.customError, "Initial ValidityState.customError");
+        assert_equals(control.validationMessage, "", "Initial validationMessage");
+
+        control.setCustomValidity("error");
+        assert_true(control.checkValidity(), "checkValidity() after setting custom validity message to 'error'");
+        assert_true(control.validity.valid, "ValidityState.valid after setting custom validity message to 'error'");
+        assert_false(control.validity.customError, "ValidityState.customError after setting custom validity message to 'error'");
+        assert_equals(control.validationMessage, "", "validationMessage after setting custom validity message to 'error'");
+
+        control.setCustomValidity("");
+        assert_true(control.checkValidity(), "checkValidity() after setting custom validity message to empty string");
+        assert_true(control.validity.valid, "ValidityState.valid after setting custom validity message to empty string");
+        assert_false(control.validity.customError, "ValidityState.customError after setting custom validity message to empty string");
+        assert_equals(control.validationMessage, "", "validationMessage after setting custom validity message to empty string");
+    }, name);
+}
+
+testFormControl(document.createElement("button"), "button Element");
+testFormControl(document.createElement("input"), "input Element");
+testFormControl(document.createElement("select"), "select Element");
+testFormControl(document.createElement("textarea"), "textarea Element");
+
+// The following controls are not validated in WebKit (only object seems to be barred from validation in the specification).
+testFormControlBarredFromValidation(document.createElement("fieldset"), "fieldset Element");
+testFormControlBarredFromValidation(document.createElement("keygen"), "keygen Element");
+testFormControlBarredFromValidation(document.createElement("object"), "object Element");
+testFormControlBarredFromValidation(document.createElement("output"), "output Element");
+
+</script>
+</body>
+</html>

Modified: releases/WebKitGTK/webkit-2.16/Source/WebCore/ChangeLog (213833 => 213834)


--- releases/WebKitGTK/webkit-2.16/Source/WebCore/ChangeLog	2017-03-13 12:01:02 UTC (rev 213833)
+++ releases/WebKitGTK/webkit-2.16/Source/WebCore/ChangeLog	2017-03-13 12:06:06 UTC (rev 213834)
@@ -1,3 +1,27 @@
+2017-03-08  Chris Dumez  <[email protected]>
+
+        Parameter to input.setCustomValidity() should not be nullable
+        https://bugs.webkit.org/show_bug.cgi?id=169332
+
+        Reviewed by Sam Weinig.
+
+        Parameter to input.setCustomValidity() should not be nullable:
+        - https://html.spec.whatwg.org/#htmlinputelement
+
+        Firefox and Chrome agree with the specification so the change
+        should be safe.
+
+        Test: fast/forms/setCustomValidity-null-parameter.html
+
+        * html/HTMLButtonElement.idl:
+        * html/HTMLFieldSetElement.idl:
+        * html/HTMLInputElement.idl:
+        * html/HTMLKeygenElement.idl:
+        * html/HTMLObjectElement.idl:
+        * html/HTMLOutputElement.idl:
+        * html/HTMLSelectElement.idl:
+        * html/HTMLTextAreaElement.idl:
+
 2017-03-08  Dave Hyatt  <[email protected]>
 
         CSS Multicolumn should not clip columns horizontally

Modified: releases/WebKitGTK/webkit-2.16/Source/WebCore/html/HTMLButtonElement.idl (213833 => 213834)


--- releases/WebKitGTK/webkit-2.16/Source/WebCore/html/HTMLButtonElement.idl	2017-03-13 12:01:02 UTC (rev 213833)
+++ releases/WebKitGTK/webkit-2.16/Source/WebCore/html/HTMLButtonElement.idl	2017-03-13 12:06:06 UTC (rev 213834)
@@ -38,7 +38,7 @@
     readonly attribute DOMString validationMessage;
     boolean checkValidity();
     [EnabledAtRuntime=InteractiveFormValidation] boolean reportValidity();
-    void setCustomValidity(DOMString? error);
+    void setCustomValidity(DOMString error);
 
     readonly attribute NodeList labels;
 };

Modified: releases/WebKitGTK/webkit-2.16/Source/WebCore/html/HTMLFieldSetElement.idl (213833 => 213834)


--- releases/WebKitGTK/webkit-2.16/Source/WebCore/html/HTMLFieldSetElement.idl	2017-03-13 12:01:02 UTC (rev 213833)
+++ releases/WebKitGTK/webkit-2.16/Source/WebCore/html/HTMLFieldSetElement.idl	2017-03-13 12:06:06 UTC (rev 213834)
@@ -31,5 +31,5 @@
     readonly attribute DOMString       validationMessage;
     boolean  checkValidity();
     [EnabledAtRuntime=InteractiveFormValidation] boolean reportValidity();
-    void     setCustomValidity(DOMString? error);
+    void setCustomValidity(DOMString error);
 };

Modified: releases/WebKitGTK/webkit-2.16/Source/WebCore/html/HTMLInputElement.idl (213833 => 213834)


--- releases/WebKitGTK/webkit-2.16/Source/WebCore/html/HTMLInputElement.idl	2017-03-13 12:01:02 UTC (rev 213833)
+++ releases/WebKitGTK/webkit-2.16/Source/WebCore/html/HTMLInputElement.idl	2017-03-13 12:06:06 UTC (rev 213834)
@@ -72,7 +72,7 @@
     readonly attribute DOMString validationMessage;
     boolean checkValidity();
     [EnabledAtRuntime=InteractiveFormValidation] boolean reportValidity();
-    void setCustomValidity(DOMString? error);
+    void setCustomValidity(DOMString error);
 
     readonly attribute NodeList labels;
 

Modified: releases/WebKitGTK/webkit-2.16/Source/WebCore/html/HTMLKeygenElement.idl (213833 => 213834)


--- releases/WebKitGTK/webkit-2.16/Source/WebCore/html/HTMLKeygenElement.idl	2017-03-13 12:01:02 UTC (rev 213833)
+++ releases/WebKitGTK/webkit-2.16/Source/WebCore/html/HTMLKeygenElement.idl	2017-03-13 12:06:06 UTC (rev 213834)
@@ -43,7 +43,7 @@
     readonly attribute DOMString validationMessage;
     boolean checkValidity();
     [EnabledAtRuntime=InteractiveFormValidation] boolean reportValidity();
-    void setCustomValidity(DOMString? error);
+    void setCustomValidity(DOMString error);
 
     readonly attribute NodeList labels;
 };

Modified: releases/WebKitGTK/webkit-2.16/Source/WebCore/html/HTMLObjectElement.idl (213833 => 213834)


--- releases/WebKitGTK/webkit-2.16/Source/WebCore/html/HTMLObjectElement.idl	2017-03-13 12:01:02 UTC (rev 213833)
+++ releases/WebKitGTK/webkit-2.16/Source/WebCore/html/HTMLObjectElement.idl	2017-03-13 12:06:06 UTC (rev 213834)
@@ -45,7 +45,7 @@
     readonly attribute DOMString validationMessage;
     boolean checkValidity();
     [EnabledAtRuntime=InteractiveFormValidation] boolean reportValidity();
-    void setCustomValidity(DOMString? error);
+    void setCustomValidity(DOMString error);
 
     [CheckSecurityForNode] readonly attribute Document contentDocument;
 

Modified: releases/WebKitGTK/webkit-2.16/Source/WebCore/html/HTMLOutputElement.idl (213833 => 213834)


--- releases/WebKitGTK/webkit-2.16/Source/WebCore/html/HTMLOutputElement.idl	2017-03-13 12:01:02 UTC (rev 213833)
+++ releases/WebKitGTK/webkit-2.16/Source/WebCore/html/HTMLOutputElement.idl	2017-03-13 12:06:06 UTC (rev 213834)
@@ -37,7 +37,7 @@
     readonly attribute DOMString validationMessage;
     boolean checkValidity();
     [EnabledAtRuntime=InteractiveFormValidation] boolean reportValidity();
-    void setCustomValidity(DOMString? error);
+    void setCustomValidity(DOMString error);
 
     readonly attribute NodeList labels;
 };

Modified: releases/WebKitGTK/webkit-2.16/Source/WebCore/html/HTMLSelectElement.idl (213833 => 213834)


--- releases/WebKitGTK/webkit-2.16/Source/WebCore/html/HTMLSelectElement.idl	2017-03-13 12:01:02 UTC (rev 213833)
+++ releases/WebKitGTK/webkit-2.16/Source/WebCore/html/HTMLSelectElement.idl	2017-03-13 12:06:06 UTC (rev 213834)
@@ -56,7 +56,7 @@
     readonly attribute DOMString validationMessage;
     boolean checkValidity();
     [EnabledAtRuntime=InteractiveFormValidation] boolean reportValidity();
-    void setCustomValidity(DOMString? error); // FIXME: Argument should not be nullable.
+    void setCustomValidity(DOMString error);
 
     readonly attribute NodeList labels;
 

Modified: releases/WebKitGTK/webkit-2.16/Source/WebCore/html/HTMLTextAreaElement.idl (213833 => 213834)


--- releases/WebKitGTK/webkit-2.16/Source/WebCore/html/HTMLTextAreaElement.idl	2017-03-13 12:01:02 UTC (rev 213833)
+++ releases/WebKitGTK/webkit-2.16/Source/WebCore/html/HTMLTextAreaElement.idl	2017-03-13 12:06:06 UTC (rev 213834)
@@ -44,7 +44,7 @@
     readonly attribute DOMString validationMessage;
     boolean checkValidity();
     [EnabledAtRuntime=InteractiveFormValidation] boolean reportValidity();
-    void setCustomValidity(DOMString? error);
+    void setCustomValidity(DOMString error);
 
     readonly attribute NodeList labels;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to