Title: [286321] trunk
Revision
286321
Author
[email protected]
Date
2021-11-30 13:28:18 -0800 (Tue, 30 Nov 2021)

Log Message

html/semantics/forms/constraints/form-validation-validity-customError.html WPT test is failing
https://bugs.webkit.org/show_bug.cgi?id=233599

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Rebaseline WPT test that is now passing.

* web-platform-tests/html/semantics/forms/constraints/form-validation-validity-customError-expected.txt:

Source/WebCore:

No new tests, rebaselined existing test.

* html/FormAssociatedElement.cpp:
(WebCore::FormAssociatedElement::customError const):
Per https://html.spec.whatwg.org/#dom-validitystate-customerror, customError() should return true
if the control is suffering from a custom error. Per https://html.spec.whatwg.org/#custom-validity-error-message,
when setCustomValidity() is called with a non-empty message, the element suffers from a custom error, no
matter if the element is a candidate for constraint validation or not.

(WebCore::FormAssociatedElement::validationMessage const):
Per https://html.spec.whatwg.org/#dom-cva-validationmessage, the validationMessage getter
should return the empty string if "the element is not a candidate for constraint validation".

Modified Paths

Diff

Modified: trunk/LayoutTests/fast/forms/ValidityState-customError-expected.txt (286320 => 286321)


--- trunk/LayoutTests/fast/forms/ValidityState-customError-expected.txt	2021-11-30 21:14:03 UTC (rev 286320)
+++ trunk/LayoutTests/fast/forms/ValidityState-customError-expected.txt	2021-11-30 21:28:18 UTC (rev 286321)
@@ -4,10 +4,10 @@
 
 
 Set some value for customError.
-PASS customErrorFor("fieldset-set") is false
+PASS customErrorFor("fieldset-set") is true
 PASS customErrorFor("button-set") is true
-PASS customErrorFor("button-button-set") is false
-PASS customErrorFor("button-reset-set") is false
+PASS customErrorFor("button-button-set") is true
+PASS customErrorFor("button-reset-set") is true
 PASS customErrorFor("select-set") is true
 PASS customErrorFor("textarea-set") is true
 PASS customErrorFor("input-set") is true
@@ -43,37 +43,37 @@
 PASS setCustomValidity() threw Not enough arguments
 PASS setCustomValidity() threw Not enough arguments
 PASS setCustomValidity() threw Not enough arguments
-PASS customErrorFor("fieldset-many-changes") is false
+PASS customErrorFor("fieldset-many-changes") is true
 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("button-button-many-changes") is true
+PASS customErrorFor("button-reset-many-changes") is true
 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("fieldset-many-changes") is true
 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("button-button-many-changes") is true
+PASS customErrorFor("button-reset-many-changes") is true
 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 null.
-PASS customErrorFor("fieldset-many-changes") is false
+PASS customErrorFor("fieldset-many-changes") is true
 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("button-button-many-changes") is true
+PASS customErrorFor("button-reset-many-changes") is true
 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("fieldset-many-changes") is true
 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("button-button-many-changes") is true
+PASS customErrorFor("button-reset-many-changes") is true
 PASS customErrorFor("select-many-changes") is true
 PASS customErrorFor("textarea-many-changes") is true
 PASS customErrorFor("input-many-changes") is true

Modified: trunk/LayoutTests/fast/forms/ValidityState-customError.html (286320 => 286321)


--- trunk/LayoutTests/fast/forms/ValidityState-customError.html	2021-11-30 21:14:03 UTC (rev 286320)
+++ trunk/LayoutTests/fast/forms/ValidityState-customError.html	2021-11-30 21:28:18 UTC (rev 286321)
@@ -54,10 +54,10 @@
 v = document.getElementsByName("set");
 for (i = 0; i < v.length; i++)
     v[i].setCustomValidity("Custom validation message");
-shouldBeFalse('customErrorFor("fieldset-set")');
+shouldBeTrue('customErrorFor("fieldset-set")');
 shouldBeTrue('customErrorFor("button-set")');
-shouldBeFalse('customErrorFor("button-button-set")');
-shouldBeFalse('customErrorFor("button-reset-set")');
+shouldBeTrue('customErrorFor("button-button-set")');
+shouldBeTrue('customErrorFor("button-reset-set")');
 shouldBeTrue('customErrorFor("select-set")');
 shouldBeTrue('customErrorFor("textarea-set")');
 shouldBeTrue('customErrorFor("input-set")');
@@ -104,10 +104,10 @@
     }
     v[i].setCustomValidity(undefined);
 }
-shouldBeFalse('customErrorFor("fieldset-many-changes")');
+shouldBeTrue('customErrorFor("fieldset-many-changes")');
 shouldBeTrue('customErrorFor("button-many-changes")');
-shouldBeFalse('customErrorFor("button-button-many-changes")');
-shouldBeFalse('customErrorFor("button-reset-many-changes")');
+shouldBeTrue('customErrorFor("button-button-many-changes")');
+shouldBeTrue('customErrorFor("button-reset-many-changes")');
 shouldBeTrue('customErrorFor("select-many-changes")');
 shouldBeTrue('customErrorFor("textarea-many-changes")');
 shouldBeTrue('customErrorFor("input-many-changes")');
@@ -116,10 +116,10 @@
 debug('Set with three arguments.');
 for (i = 0; i < v.length; i++)
     v[i].setCustomValidity("one", "two", "three");
-shouldBeFalse('customErrorFor("fieldset-many-changes")');
+shouldBeTrue('customErrorFor("fieldset-many-changes")');
 shouldBeTrue('customErrorFor("button-many-changes")');
-shouldBeFalse('customErrorFor("button-button-many-changes")');
-shouldBeFalse('customErrorFor("button-reset-many-changes")');
+shouldBeTrue('customErrorFor("button-button-many-changes")');
+shouldBeTrue('customErrorFor("button-reset-many-changes")');
 shouldBeTrue('customErrorFor("select-many-changes")');
 shouldBeTrue('customErrorFor("textarea-many-changes")');
 shouldBeTrue('customErrorFor("input-many-changes")');
@@ -128,10 +128,10 @@
 debug('Set null.');
 for (i = 0; i < v.length; i++)
     v[i].setCustomValidity(null);
-shouldBeFalse('customErrorFor("fieldset-many-changes")');
+shouldBeTrue('customErrorFor("fieldset-many-changes")');
 shouldBeTrue('customErrorFor("button-many-changes")');
-shouldBeFalse('customErrorFor("button-button-many-changes")');
-shouldBeFalse('customErrorFor("button-reset-many-changes")');
+shouldBeTrue('customErrorFor("button-button-many-changes")');
+shouldBeTrue('customErrorFor("button-reset-many-changes")');
 shouldBeTrue('customErrorFor("select-many-changes")');
 shouldBeTrue('customErrorFor("textarea-many-changes")');
 shouldBeTrue('customErrorFor("input-many-changes")');
@@ -142,10 +142,10 @@
     v[i].setCustomValidity("Custom string");
     v[i].setCustomValidity(undefined);
 }
-shouldBeFalse('customErrorFor("fieldset-many-changes")');
+shouldBeTrue('customErrorFor("fieldset-many-changes")');
 shouldBeTrue('customErrorFor("button-many-changes")');
-shouldBeFalse('customErrorFor("button-button-many-changes")');
-shouldBeFalse('customErrorFor("button-reset-many-changes")');
+shouldBeTrue('customErrorFor("button-button-many-changes")');
+shouldBeTrue('customErrorFor("button-reset-many-changes")');
 shouldBeTrue('customErrorFor("select-many-changes")');
 shouldBeTrue('customErrorFor("textarea-many-changes")');
 shouldBeTrue('customErrorFor("input-many-changes")');

Modified: trunk/LayoutTests/fast/forms/setCustomValidity-null-parameter.html (286320 => 286321)


--- trunk/LayoutTests/fast/forms/setCustomValidity-null-parameter.html	2021-11-30 21:14:03 UTC (rev 286320)
+++ trunk/LayoutTests/fast/forms/setCustomValidity-null-parameter.html	2021-11-30 21:28:18 UTC (rev 286321)
@@ -49,8 +49,14 @@
 
         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'");
+        // WebKit and Chrome 96 treat <object> differently here. Firefox 95 doesn't.
+        if (control.tagName == "OBJECT") {
+            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'");
+         } else {
+            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, "", "validationMessage after setting custom validity message to 'error'");
 
         control.setCustomValidity("");

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (286320 => 286321)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2021-11-30 21:14:03 UTC (rev 286320)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2021-11-30 21:28:18 UTC (rev 286321)
@@ -1,5 +1,16 @@
 2021-11-30  Chris Dumez  <[email protected]>
 
+        html/semantics/forms/constraints/form-validation-validity-customError.html WPT test is failing
+        https://bugs.webkit.org/show_bug.cgi?id=233599
+
+        Reviewed by Darin Adler.
+
+        Rebaseline WPT test that is now passing.
+
+        * web-platform-tests/html/semantics/forms/constraints/form-validation-validity-customError-expected.txt:
+
+2021-11-30  Chris Dumez  <[email protected]>
+
         Several WPT tests under html/semantics/forms/constraints are failing due to extraneous willValidate() checks
         https://bugs.webkit.org/show_bug.cgi?id=233604
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-customError-expected.txt (286320 => 286321)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-customError-expected.txt	2021-11-30 21:14:03 UTC (rev 286320)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-customError-expected.txt	2021-11-30 21:28:18 UTC (rev 286321)
@@ -1,10 +1,10 @@
 
-FAIL [input]  The validity.customError must be true if the custom validity error message is not empty assert_true: The validity.customError attribute should be true, when control is disabled. expected true got false
+PASS [input]  The validity.customError must be true if the custom validity error message is not empty
 PASS [input]  The validity.customError must be false if the custom validity error message is empty
-FAIL [button]  The validity.customError must be true if the custom validity error message is not empty assert_true: The validity.customError attribute should be true, when control is disabled. expected true got false
+PASS [button]  The validity.customError must be true if the custom validity error message is not empty
 PASS [button]  The validity.customError must be false if the custom validity error message is empty
-FAIL [select]  The validity.customError must be true if the custom validity error message is not empty assert_true: The validity.customError attribute should be true, when control is disabled. expected true got false
+PASS [select]  The validity.customError must be true if the custom validity error message is not empty
 PASS [select]  The validity.customError must be false if the custom validity error message is empty
-FAIL [textarea]  The validity.customError must be true if the custom validity error message is not empty assert_true: The validity.customError attribute should be true, when control is disabled. expected true got false
+PASS [textarea]  The validity.customError must be true if the custom validity error message is not empty
 PASS [textarea]  The validity.customError must be false if the custom validity error message is empty
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-fieldset-element/fieldset-setcustomvalidity-expected.txt (286320 => 286321)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-fieldset-element/fieldset-setcustomvalidity-expected.txt	2021-11-30 21:14:03 UTC (rev 286320)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-fieldset-element/fieldset-setcustomvalidity-expected.txt	2021-11-30 21:28:18 UTC (rev 286321)
@@ -1,4 +1,4 @@
 
 
-FAIL fieldset setCustomValidity is correct assert_true: expected true got false
+PASS fieldset setCustomValidity is correct
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-output-element/output-setcustomvalidity-expected.txt (286320 => 286321)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-output-element/output-setcustomvalidity-expected.txt	2021-11-30 21:14:03 UTC (rev 286320)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-output-element/output-setcustomvalidity-expected.txt	2021-11-30 21:28:18 UTC (rev 286321)
@@ -1,4 +1,4 @@
 
 
-FAIL output setCustomValidity is correct assert_true: expected true got false
+PASS output setCustomValidity is correct
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-output-element/output-validity-expected.txt (286320 => 286321)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-output-element/output-validity-expected.txt	2021-11-30 21:14:03 UTC (rev 286320)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-output-element/output-validity-expected.txt	2021-11-30 21:28:18 UTC (rev 286321)
@@ -1,4 +1,4 @@
 
 
-FAIL :valid and :invalid pseudo-class on output element assert_true: should have a custom error expected true got false
+PASS :valid and :invalid pseudo-class on output element
 

Modified: trunk/Source/WebCore/ChangeLog (286320 => 286321)


--- trunk/Source/WebCore/ChangeLog	2021-11-30 21:14:03 UTC (rev 286320)
+++ trunk/Source/WebCore/ChangeLog	2021-11-30 21:28:18 UTC (rev 286321)
@@ -1,3 +1,23 @@
+2021-11-30  Chris Dumez  <[email protected]>
+
+        html/semantics/forms/constraints/form-validation-validity-customError.html WPT test is failing
+        https://bugs.webkit.org/show_bug.cgi?id=233599
+
+        Reviewed by Darin Adler.
+
+        No new tests, rebaselined existing test.
+
+        * html/FormAssociatedElement.cpp:
+        (WebCore::FormAssociatedElement::customError const):
+        Per https://html.spec.whatwg.org/#dom-validitystate-customerror, customError() should return true
+        if the control is suffering from a custom error. Per https://html.spec.whatwg.org/#custom-validity-error-message,
+        when setCustomValidity() is called with a non-empty message, the element suffers from a custom error, no
+        matter if the element is a candidate for constraint validation or not.
+
+        (WebCore::FormAssociatedElement::validationMessage const):
+        Per https://html.spec.whatwg.org/#dom-cva-validationmessage, the validationMessage getter
+        should return the empty string if "the element is not a candidate for constraint validation".
+
 2021-11-30  Ada Chan  <[email protected]>
 
         [WebXR] Implement ChromeClient API to allow getting explicit consent from user on session features

Modified: trunk/Source/WebCore/html/FormAssociatedElement.cpp (286320 => 286321)


--- trunk/Source/WebCore/html/FormAssociatedElement.cpp	2021-11-30 21:14:03 UTC (rev 286320)
+++ trunk/Source/WebCore/html/FormAssociatedElement.cpp	2021-11-30 21:28:18 UTC (rev 286321)
@@ -210,7 +210,7 @@
 
 bool FormAssociatedElement::customError() const
 {
-    return willValidate() && !m_customValidationMessage.isEmpty();
+    return !m_customValidationMessage.isEmpty();
 }
 
 bool FormAssociatedElement::hasBadInput() const
@@ -272,7 +272,7 @@
 
 String FormAssociatedElement::validationMessage() const
 {
-    return customError() ? m_customValidationMessage : String();
+    return willValidate() ? m_customValidationMessage : String();
 }
 
 void FormAssociatedElement::setCustomValidity(const String& error)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to