Title: [199607] trunk
Revision
199607
Author
[email protected]
Date
2016-04-15 12:59:20 -0700 (Fri, 15 Apr 2016)

Log Message

ASSERT when loading github.com
https://bugs.webkit.org/show_bug.cgi?id=156604
<rdar://problem/19890634>

Reviewed by Darin Adler.

Source/WebCore:

HTMLFormControlElement::m_isValid is a cache of the results of the valid() function.
When cloning the node, we were preserving each individual item, but not the state
of the cache. Therefore, the cache and the attributes didn't agree with each other.

Test: fast/forms/checkValidity-cloneNode-crash.html

* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::copyNonAttributePropertiesFromElement):

LayoutTests:

* fast/forms/checkValidity-cloneNode-crash-expected.txt: Added.
* fast/forms/checkValidity-cloneNode-crash.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (199606 => 199607)


--- trunk/LayoutTests/ChangeLog	2016-04-15 19:55:27 UTC (rev 199606)
+++ trunk/LayoutTests/ChangeLog	2016-04-15 19:59:20 UTC (rev 199607)
@@ -1,3 +1,14 @@
+2016-04-15  Myles C. Maxfield  <[email protected]>
+
+        ASSERT when loading github.com
+        https://bugs.webkit.org/show_bug.cgi?id=156604
+        <rdar://problem/19890634>
+
+        Reviewed by Darin Adler.
+
+        * fast/forms/checkValidity-cloneNode-crash-expected.txt: Added.
+        * fast/forms/checkValidity-cloneNode-crash.html: Added.
+
 2016-04-15  Brent Fulgham  <[email protected]>
 
         Remove support for X-Frame-Options in `<meta>`

Added: trunk/LayoutTests/fast/forms/checkValidity-cloneNode-crash-expected.txt (0 => 199607)


--- trunk/LayoutTests/fast/forms/checkValidity-cloneNode-crash-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/checkValidity-cloneNode-crash-expected.txt	2016-04-15 19:59:20 UTC (rev 199607)
@@ -0,0 +1,17 @@
+This test makes sure that calling checkValidity() on a cloned node does not crash a Debug build. The test passes if there is no crash (and if you don't see any 'FAIL's)
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS element.checkValidity() is true
+PASS element2.checkValidity() is true
+PASS element.checkValidity() is true
+PASS element2.checkValidity() is true
+PASS element.checkValidity() is true
+PASS element2.checkValidity() is false
+PASS element.checkValidity() is true
+PASS element2.checkValidity() is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Property changes on: trunk/LayoutTests/fast/forms/checkValidity-cloneNode-crash-expected.txt
___________________________________________________________________

Added: svn:keywords

Added: svn:eol-style

Added: trunk/LayoutTests/fast/forms/checkValidity-cloneNode-crash.html (0 => 199607)


--- trunk/LayoutTests/fast/forms/checkValidity-cloneNode-crash.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/checkValidity-cloneNode-crash.html	2016-04-15 19:59:20 UTC (rev 199607)
@@ -0,0 +1,60 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script>
+description("This test makes sure that calling checkValidity() on a cloned node does not crash a Debug build. The test passes if there is no crash (and if you don't see any 'FAIL's)");
+
+var element;
+var element2;
+
+function checkInputElement() {
+    element = document.createElement("input");
+    element.required = true;
+    element.value = "hi"
+    shouldBeTrue("element.checkValidity()");
+    element2 = element.cloneNode();
+    shouldBeTrue("element2.checkValidity()");
+}
+
+function checkDeepSelect() {
+    element = document.createElement("select")
+    element.innerHTML =   "<option>Volvo</option><option>Saab</option><option>Opel</option>";
+    element.required=true;
+    shouldBeTrue("element.checkValidity()");
+    element2 = element.cloneNode(true);
+    shouldBeTrue("element2.checkValidity()");
+}
+
+function checkShallowSelect() {
+    element = document.createElement("select")
+    element.innerHTML =   "<option>Volvo</option><option>Saab</option><option>Opel</option>";
+    element.required = true;
+    shouldBeTrue("element.checkValidity()");
+    element2 = element.cloneNode();
+    shouldBeFalse("element2.checkValidity()");
+}
+
+function checkTextArea() {
+    element = document.createElement("textarea")
+    element.required = true;
+    element.checkValidity();
+    element.value = "a";
+    shouldBeTrue("element.checkValidity()");
+    element2 = element.cloneNode();
+    // https://bugs.webkit.org/show_bug.cgi?id=156637 will fix this bug.
+    // shouldBeTrue("element2.checkValidity()");
+    element2.value = element.value;
+    shouldBeTrue("element2.checkValidity()");
+}
+
+checkInputElement();
+checkDeepSelect();
+checkShallowSelect();
+checkTextArea();
+</script>
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (199606 => 199607)


--- trunk/Source/WebCore/ChangeLog	2016-04-15 19:55:27 UTC (rev 199606)
+++ trunk/Source/WebCore/ChangeLog	2016-04-15 19:59:20 UTC (rev 199607)
@@ -1,3 +1,20 @@
+2016-04-15  Myles C. Maxfield  <[email protected]>
+
+        ASSERT when loading github.com
+        https://bugs.webkit.org/show_bug.cgi?id=156604
+        <rdar://problem/19890634>
+
+        Reviewed by Darin Adler.
+
+        HTMLFormControlElement::m_isValid is a cache of the results of the valid() function.
+        When cloning the node, we were preserving each individual item, but not the state
+        of the cache. Therefore, the cache and the attributes didn't agree with each other.
+
+        Test: fast/forms/checkValidity-cloneNode-crash.html
+
+        * html/HTMLInputElement.cpp:
+        (WebCore::HTMLInputElement::copyNonAttributePropertiesFromElement):
+
 2016-04-15  Brent Fulgham  <[email protected]>
 
         Remove support for X-Frame-Options in `<meta>`

Modified: trunk/Source/WebCore/html/HTMLInputElement.cpp (199606 => 199607)


--- trunk/Source/WebCore/html/HTMLInputElement.cpp	2016-04-15 19:55:27 UTC (rev 199606)
+++ trunk/Source/WebCore/html/HTMLInputElement.cpp	2016-04-15 19:59:20 UTC (rev 199607)
@@ -921,6 +921,7 @@
 
     HTMLTextFormControlElement::copyNonAttributePropertiesFromElement(source);
 
+    updateValidity();
     setFormControlValueMatchesRenderer(false);
     m_inputType->updateInnerTextValue();
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to