Title: [115990] trunk
Revision
115990
Author
[email protected]
Date
2012-05-03 10:54:40 -0700 (Thu, 03 May 2012)

Log Message

Crash in HTMLFormControlElement::m_fieldSetAncestor
https://bugs.webkit.org/show_bug.cgi?id=85453

Reviewed by Kent Tamura.

Source/WebCore:

Modified tests: fast/forms/datalist/datalist-child-validation.html
                fast/forms/form-control-element-crash.html

* html/HTMLFormControlElement.cpp:
(WebCore::HTMLFormControlElement::removedFrom): Only set the invalid ancestor flag.
The element will be detached from the document so there is no need to update the style.
And the validation message will be hidden by the blur event.
(WebCore::HTMLFormControlElement::willValidate): Because of the change to removedFrom,
m_ancestorsValid may be false.

LayoutTests:

* fast/forms/datalist/datalist-child-validation-expected.txt:
* fast/forms/datalist/datalist-child-validation.html: Added tests that check the validation status of removed node.
* fast/forms/form-control-element-crash-expected.txt:
* fast/forms/form-control-element-crash.html: Replaced with a better, easier to understand test case from the cluster-fuzz.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (115989 => 115990)


--- trunk/LayoutTests/ChangeLog	2012-05-03 17:50:03 UTC (rev 115989)
+++ trunk/LayoutTests/ChangeLog	2012-05-03 17:54:40 UTC (rev 115990)
@@ -1,3 +1,15 @@
+2012-05-03  Keishi Hattori  <[email protected]>
+
+        Crash in HTMLFormControlElement::m_fieldSetAncestor
+        https://bugs.webkit.org/show_bug.cgi?id=85453
+
+        Reviewed by Kent Tamura.
+
+        * fast/forms/datalist/datalist-child-validation-expected.txt:
+        * fast/forms/datalist/datalist-child-validation.html: Added tests that check the validation status of removed node.
+        * fast/forms/form-control-element-crash-expected.txt:
+        * fast/forms/form-control-element-crash.html: Replaced with a better, easier to understand test case from the cluster-fuzz.
+
 2012-05-03  Simon Fraser  <[email protected]>
 
         Keep overlap testing for compositing on pages with 3d transforms when possible

Modified: trunk/LayoutTests/fast/forms/datalist/datalist-child-validation-expected.txt (115989 => 115990)


--- trunk/LayoutTests/fast/forms/datalist/datalist-child-validation-expected.txt	2012-05-03 17:50:03 UTC (rev 115989)
+++ trunk/LayoutTests/fast/forms/datalist/datalist-child-validation-expected.txt	2012-05-03 17:54:40 UTC (rev 115990)
@@ -5,6 +5,9 @@
 
 PASS e.willValidate is false
 PASS e.willValidate is true
+PASS w.querySelector(":invalid") is e
+PASS e.willValidate is true
+PASS e.willValidate is true
 PASS document.querySelector(":invalid") is e
 PASS successfullyParsed is true
 

Modified: trunk/LayoutTests/fast/forms/datalist/datalist-child-validation.html (115989 => 115990)


--- trunk/LayoutTests/fast/forms/datalist/datalist-child-validation.html	2012-05-03 17:50:03 UTC (rev 115989)
+++ trunk/LayoutTests/fast/forms/datalist/datalist-child-validation.html	2012-05-03 17:54:40 UTC (rev 115990)
@@ -8,7 +8,9 @@
 <div id="console"></div>
 
 <datalist id="list">
-  <input type=text id=e required>
+  <div id=w>
+    <input type=text id=e required>
+  </div>
 </datalist>
 
 <script>
@@ -16,6 +18,12 @@
 
 var e = document.getElementById('e');
 shouldBeFalse('e.willValidate');
+var w = document.getElementById('w');
+w.parentNode.removeChild(w);
+shouldBeTrue('e.willValidate');
+shouldBe('w.querySelector(":invalid")', 'e');
+e.parentNode.removeChild(e);
+shouldBeTrue('e.willValidate');
 document.body.appendChild(e);
 shouldBeTrue('e.willValidate');
 shouldBe('document.querySelector(":invalid")', 'e');

Modified: trunk/LayoutTests/fast/forms/form-control-element-crash-expected.txt (115989 => 115990)


--- trunk/LayoutTests/fast/forms/form-control-element-crash-expected.txt	2012-05-03 17:50:03 UTC (rev 115989)
+++ trunk/LayoutTests/fast/forms/form-control-element-crash-expected.txt	2012-05-03 17:54:40 UTC (rev 115990)
@@ -1 +1,2 @@
- 
+Generated by cluster-fuzz. This test passes if it doesn't crash.
+a

Modified: trunk/LayoutTests/fast/forms/form-control-element-crash.html (115989 => 115990)


--- trunk/LayoutTests/fast/forms/form-control-element-crash.html	2012-05-03 17:50:03 UTC (rev 115989)
+++ trunk/LayoutTests/fast/forms/form-control-element-crash.html	2012-05-03 17:54:40 UTC (rev 115990)
@@ -1,23 +1,21 @@
-<html>
-<head>
 <script>
-if (window.layoutTestController)
+if (window.layoutTestController) {
     layoutTestController.dumpAsText();
-
-window._onload_=function(){
-    document.execCommand("SelectAll", false, false);
-    window.getSelection().deleteFromDocument();
-};
+    layoutTestController.waitUntilDone();
+}
+if (window.eventSender) {
+    // Repeat to increase chance of crash.
+    for (i = 0; i < 1000; i++) {
+        setTimeout(function() {
+            eventSender.mouseMoveTo(75,75);
+        }, 0);
+    }
+    setTimeout(function() { if (window.layoutTestController) { layoutTestController.notifyDone(); } }, 0);
+}
 </script>
-</head>
-<body>
-Bug 85149. This test passes if it doesn't crash.  Note: You will need to reload
-this test many times (or run the test under valgrind / ASAN) to see a crash.
-<form>
-<fieldset>
-<select></select>
-</fieldset>
-</form>
-<style> *{ animation-play-state:paused,running; } </style>
-</body>
-</html>
+Generated by cluster-fuzz. This test passes if it doesn't crash.
+<div id="result"><fieldset><input id="test" type="button"></fieldset></div>
+<script>
+    eventSender.mouseMoveTo(test.offsetLeft, test.offsetTop, ["metaKey"]);
+    document.getElementById("result").innerHTML = "a";
+</script>

Modified: trunk/Source/WebCore/ChangeLog (115989 => 115990)


--- trunk/Source/WebCore/ChangeLog	2012-05-03 17:50:03 UTC (rev 115989)
+++ trunk/Source/WebCore/ChangeLog	2012-05-03 17:54:40 UTC (rev 115990)
@@ -1,3 +1,20 @@
+2012-05-03  Keishi Hattori  <[email protected]>
+
+        Crash in HTMLFormControlElement::m_fieldSetAncestor
+        https://bugs.webkit.org/show_bug.cgi?id=85453
+
+        Reviewed by Kent Tamura.
+
+        Modified tests: fast/forms/datalist/datalist-child-validation.html
+                        fast/forms/form-control-element-crash.html
+
+        * html/HTMLFormControlElement.cpp:
+        (WebCore::HTMLFormControlElement::removedFrom): Only set the invalid ancestor flag.
+        The element will be detached from the document so there is no need to update the style.
+        And the validation message will be hidden by the blur event.
+        (WebCore::HTMLFormControlElement::willValidate): Because of the change to removedFrom,
+        m_ancestorsValid may be false.
+
 2012-05-03  Simon Fraser  <[email protected]>
 
         Keep overlap testing for compositing on pages with 3d transforms when possible

Modified: trunk/Source/WebCore/html/HTMLFormControlElement.cpp (115989 => 115990)


--- trunk/Source/WebCore/html/HTMLFormControlElement.cpp	2012-05-03 17:50:03 UTC (rev 115989)
+++ trunk/Source/WebCore/html/HTMLFormControlElement.cpp	2012-05-03 17:54:40 UTC (rev 115990)
@@ -239,7 +239,6 @@
     HTMLElement::removedFrom(insertionPoint);
     FormAssociatedElement::removedFrom(insertionPoint);
     m_ancestorsValid = false;
-    setNeedsWillValidateCheck();
 }
 
 const AtomicString& HTMLFormControlElement::formControlName() const
@@ -365,7 +364,10 @@
 
 bool HTMLFormControlElement::willValidate() const
 {
-    if (!m_willValidateInitialized) {
+    if (!m_willValidateInitialized || !m_ancestorsValid) {
+        if (!m_ancestorsValid)
+            updateAncestors();
+
         m_willValidateInitialized = true;
         m_willValidate = recalcWillValidate();
     } else {
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to