WebCore:
authorddkilzer <ddkilzer@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 25 Jun 2006 23:55:53 +0000 (23:55 +0000)
committerddkilzer <ddkilzer@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 25 Jun 2006 23:55:53 +0000 (23:55 +0000)
        Reviewed by Darin.

        - http://bugzilla.opendarwin.org/show_bug.cgi?id=9537
          REGRESSION: Reproducible crash in WebCore::RenderTextField::textWithHardLineBreaks()

        Test: fast/forms/textarea-hard-linewrap-empty.html

        * rendering/RenderTextField.cpp:
        (WebCore::RenderTextField::textWithHardLineBreaks): Added null check for
        m_div->firstChild()->renderer().

LayoutTests:

        Reviewed by Darin.

        - http://bugzilla.opendarwin.org/show_bug.cgi?id=9537
          REGRESSION: Reproducible crash in WebCore::RenderTextField::textWithHardLineBreaks()

        * fast/forms/textarea-hard-linewrap-empty-expected.txt: Added.
        * fast/forms/textarea-hard-linewrap-empty.html: Added.
        * fast/forms/textarea-hard-linewrap.html: Reduced timeout from 200ms to 0ms and
        renamed function from foo() to submitForm().

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@15040 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/forms/textarea-hard-linewrap-empty-expected.txt [new file with mode: 0644]
LayoutTests/fast/forms/textarea-hard-linewrap-empty.html [new file with mode: 0644]
LayoutTests/fast/forms/textarea-hard-linewrap.html
WebCore/ChangeLog
WebCore/rendering/RenderTextField.cpp

index f9e1036d7a526a745740f7a1026247952ef20cb7..015feebd9d443669e2995fd0de5f27d89ce721c1 100644 (file)
@@ -1,3 +1,15 @@
+2006-06-25  David Kilzer  <ddkilzer@kilzer.net>
+
+        Reviewed by Darin.
+
+        - http://bugzilla.opendarwin.org/show_bug.cgi?id=9537
+          REGRESSION: Reproducible crash in WebCore::RenderTextField::textWithHardLineBreaks()
+
+        * fast/forms/textarea-hard-linewrap-empty-expected.txt: Added.
+        * fast/forms/textarea-hard-linewrap-empty.html: Added.
+        * fast/forms/textarea-hard-linewrap.html: Reduced timeout from 200ms to 0ms and
+        renamed function from foo() to submitForm().
+
 2006-06-25  Mitz Pettel  <opendarwin.org@mitzpettel.com>
 
         Reviewed by Darin.
diff --git a/LayoutTests/fast/forms/textarea-hard-linewrap-empty-expected.txt b/LayoutTests/fast/forms/textarea-hard-linewrap-empty-expected.txt
new file mode 100644 (file)
index 0000000..156e8b7
--- /dev/null
@@ -0,0 +1,4 @@
+Test for Bug 9537 REGRESSION: Reproducible crash in WebCore::RenderTextField::textWithHardLineBreaks()
+http://bugzilla.opendarwin.org/show_bug.cgi?id=9537
+Success
diff --git a/LayoutTests/fast/forms/textarea-hard-linewrap-empty.html b/LayoutTests/fast/forms/textarea-hard-linewrap-empty.html
new file mode 100644 (file)
index 0000000..e2b0263
--- /dev/null
@@ -0,0 +1,36 @@
+<html>
+<head>
+</head>
+<body>
+<div>Test for <a href="http://bugzilla.opendarwin.org/show_bug.cgi?id=9537">
+Bug 9537 REGRESSION: Reproducible crash in WebCore::RenderTextField::textWithHardLineBreaks()</a></div>
+<div>http://bugzilla.opendarwin.org/show_bug.cgi?id=9537</div>
+<form name="f" method="get" action="textarea-hard-linewrap-empty.html">
+<textarea id="textarea" name="textarea" wrap="hard" cols="5"></textarea>
+<input type="submit">
+</form>
+<script>
+function submitForm() {
+    document.f.submit();
+}
+
+if (window.layoutTestController) {
+    window.layoutTestController.dumpAsText();
+    window.layoutTestController.waitUntilDone();
+}
+
+if (document.URL.indexOf('?') == -1) {
+    window.setTimeout(submitForm, 0);
+} else {
+    var formData = document.URL.substring(document.URL.indexOf('?') + 1, document.URL.length);
+    if (formData == "textarea=")
+        document.write("Success");
+    else
+        document.write("<div>Failure.</div><div>Expected: textarea=</div><div>Actual: " + formData + "</div>");
+
+    if (window.layoutTestController)
+        window.layoutTestController.notifyDone();
+}
+</script>
+</body>
+</html>
index 119a3fb349d651b963d156b962c63884a36de13f..a9ad4bc541970e622050648a96fb8c15fac27bf1 100644 (file)
@@ -12,7 +12,7 @@
 </form>
 <script>
 
-function foo() {
+function submitForm() {
     document.f.submit();
 }
 
@@ -23,7 +23,7 @@ if (document.URL.indexOf('?') == -1) {
         window.layoutTestController.waitUntilDone();
     }
     
-    window.setTimeout(foo, 200);
+    window.setTimeout(submitForm, 0);
         
 } else {
     var formData = document.URL.substring(document.URL.indexOf('?') + 1, document.URL.length);
@@ -38,4 +38,4 @@ if (document.URL.indexOf('?') == -1) {
 
 </script>
 </body>
-</html>
\ No newline at end of file
+</html>
index 61632a421272a9e538047c7c90aa68db50347ce8..85d4ace002d38c7cc4e074a0575023946024b686 100644 (file)
@@ -1,3 +1,16 @@
+2006-06-25  David Kilzer  <ddkilzer@kilzer.net>
+
+        Reviewed by Darin.
+
+        - http://bugzilla.opendarwin.org/show_bug.cgi?id=9537
+          REGRESSION: Reproducible crash in WebCore::RenderTextField::textWithHardLineBreaks()
+
+        Test: fast/forms/textarea-hard-linewrap-empty.html
+
+        * rendering/RenderTextField.cpp:
+        (WebCore::RenderTextField::textWithHardLineBreaks): Added null check for
+        m_div->firstChild()->renderer().
+
 2006-06-25  Mitz Pettel  <opendarwin.org@mitzpettel.com>
 
         Reviewed by Darin.
index 0d1131951b03dafb86cf0e39252fd87003d42121..38655dade21da5b33dc91e279cf8113e9c24736e 100644 (file)
@@ -274,10 +274,14 @@ String RenderTextField::textWithHardLineBreaks()
     document()->updateLayout();
 
     ASSERT(m_div->firstChild());
-    InlineBox* box = m_div->firstChild()->renderer()->inlineBox(0, DOWNSTREAM);
+    RenderObject* renderer = m_div->firstChild()->renderer();
+    if (!renderer)
+        return s;
+
+    InlineBox* box = renderer->inlineBox(0, DOWNSTREAM);
     if (!box)
         return s;
-    
+
     ExceptionCode ec = 0;
     RefPtr<Range> range = new Range(document());
     range->selectNodeContents(m_div.get(), ec);