Title: [94840] trunk
Revision
94840
Author
commit-qu...@webkit.org
Date
2011-09-09 02:02:36 -0700 (Fri, 09 Sep 2011)

Log Message

Crashes in WebCore::ApplyStyleCommand.doApply()
https://bugs.webkit.org/show_bug.cgi?id=67765

Patch by Shinya Kawanaka <shin...@google.com> on 2011-09-09
Reviewed by Ryosuke Niwa.

WebCore::enclosingBlock may return null, but ApplyStyleCommand::applyBlockStyle did not check it. This patch make it to be checked.

Source/WebCore:

Test: editing/style/remove-format-without-enclosing-block.html

* editing/ApplyStyleCommand.cpp:
(WebCore::ApplyStyleCommand::applyBlockStyle): Added null check.

LayoutTests:

* editing/style/remove-format-without-enclosing-block-expected.txt: Added.
* editing/style/remove-format-without-enclosing-block.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (94839 => 94840)


--- trunk/LayoutTests/ChangeLog	2011-09-09 08:16:03 UTC (rev 94839)
+++ trunk/LayoutTests/ChangeLog	2011-09-09 09:02:36 UTC (rev 94840)
@@ -1,3 +1,15 @@
+2011-09-09  Shinya Kawanaka  <shin...@google.com>
+
+        Crashes in WebCore::ApplyStyleCommand.doApply()
+        https://bugs.webkit.org/show_bug.cgi?id=67765
+
+        Reviewed by Ryosuke Niwa.
+
+        WebCore::enclosingBlock may return null, but ApplyStyleCommand::applyBlockStyle did not check it. This patch make it to be checked.
+
+        * editing/style/remove-format-without-enclosing-block-expected.txt: Added.
+        * editing/style/remove-format-without-enclosing-block.html: Added.
+
 2011-09-09  Ilya Tikhonovsky  <loi...@chromium.org>
 
         Unreviewed. Update test expectations for hyphenate-limit-lines.html.

Added: trunk/LayoutTests/editing/style/remove-format-without-enclosing-block-expected.txt (0 => 94840)


--- trunk/LayoutTests/editing/style/remove-format-without-enclosing-block-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/editing/style/remove-format-without-enclosing-block-expected.txt	2011-09-09 09:02:36 UTC (rev 94840)
@@ -0,0 +1,4 @@
+AexecCommand("RemoveFormat") was crashing when there is no enclosing block.
+The test has passed if it does not crash.
+
+PASS

Added: trunk/LayoutTests/editing/style/remove-format-without-enclosing-block.html (0 => 94840)


--- trunk/LayoutTests/editing/style/remove-format-without-enclosing-block.html	                        (rev 0)
+++ trunk/LayoutTests/editing/style/remove-format-without-enclosing-block.html	2011-09-09 09:02:36 UTC (rev 94840)
@@ -0,0 +1,12 @@
+<card id="edit" contentEditable="true">A<script>
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+
+edit.focus();
+document.execCommand("SelectAll");
+document.execCommand("RemoveFormat");
+
+document.writeln('execCommand("RemoveFormat") was crashing when there is no enclosing block.<br>');
+document.writeln('The test has passed if it does not crash.<br><br>')
+document.writeln('PASS');
+</script>

Modified: trunk/Source/WebCore/ChangeLog (94839 => 94840)


--- trunk/Source/WebCore/ChangeLog	2011-09-09 08:16:03 UTC (rev 94839)
+++ trunk/Source/WebCore/ChangeLog	2011-09-09 09:02:36 UTC (rev 94840)
@@ -1,3 +1,17 @@
+2011-09-09  Shinya Kawanaka  <shin...@google.com>
+
+        Crashes in WebCore::ApplyStyleCommand.doApply()
+        https://bugs.webkit.org/show_bug.cgi?id=67765
+
+        Reviewed by Ryosuke Niwa.
+
+        WebCore::enclosingBlock may return null, but ApplyStyleCommand::applyBlockStyle did not check it. This patch make it to be checked.
+
+        Test: editing/style/remove-format-without-enclosing-block.html
+
+        * editing/ApplyStyleCommand.cpp:
+        (WebCore::ApplyStyleCommand::applyBlockStyle): Added null check.
+
 2011-09-09  James Simonsen  <simon...@chromium.org>
 
         [Chromium] Fix leak of Skia stream with custom CSS fonts

Modified: trunk/Source/WebCore/editing/ApplyStyleCommand.cpp (94839 => 94840)


--- trunk/Source/WebCore/editing/ApplyStyleCommand.cpp	2011-09-09 08:16:03 UTC (rev 94839)
+++ trunk/Source/WebCore/editing/ApplyStyleCommand.cpp	2011-09-09 09:02:36 UTC (rev 94840)
@@ -281,8 +281,8 @@
                 if (newBlock)
                     block = newBlock;
             }
-            ASSERT(block->isHTMLElement());
-            if (block->isHTMLElement()) {
+            ASSERT(!block || block->isHTMLElement());
+            if (block && block->isHTMLElement()) {
                 removeCSSStyle(style, toHTMLElement(block.get()));
                 if (!m_removeOnly)
                     addBlockStyle(styleChange, toHTMLElement(block.get()));
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to