Title: [106820] branches/chromium/1025
Revision
106820
Author
[email protected]
Date
2012-02-06 11:01:11 -0800 (Mon, 06 Feb 2012)

Log Message

Merge 106380 - Source/WebCore: Crash in DeleteSelectionCommand::handleGeneralDelete when attempting to delete the start block
https://bugs.webkit.org/show_bug.cgi?id=77077

Reviewed by Enrica Casucci.

The crash was caused by a missing null check after removing the position out of the start block.
Fixed the bug by adding an early return.

Tests: editing/deleting/delete-start-block.html
       editing/selection/move-into-empty-root-inline-box.html

* editing/DeleteSelectionCommand.cpp:
(WebCore::DeleteSelectionCommand::handleGeneralDelete):

LayoutTests: Crash in previousLinePosition when moving into a root inline box without leaves
https://bugs.webkit.org/show_bug.cgi?id=76812

Reviewed by Enrica Casucci.

Add a regression test for the crash. Unfortunately, we can only test previousLinePosition.

* editing/selection/move-into-empty-root-inline-box-expected.txt: Added.
* editing/selection/move-into-empty-root-inline-box.html: Added.

http://crbug.com/99408/
Review URL: https://chromiumcodereview.appspot.com/9331006

Modified Paths

Added Paths

Diff

Copied: branches/chromium/1025/LayoutTests/editing/deleting/delete-start-block-expected.txt (from rev 106380, trunk/LayoutTests/editing/deleting/delete-start-block-expected.txt) (0 => 106820)


--- branches/chromium/1025/LayoutTests/editing/deleting/delete-start-block-expected.txt	                        (rev 0)
+++ branches/chromium/1025/LayoutTests/editing/deleting/delete-start-block-expected.txt	2012-02-06 19:01:11 UTC (rev 106820)
@@ -0,0 +1,5 @@
+This tests removing the start block. WebKit should not crash.
+| <div>
+|   <br>
+| <br>
+| <br>

Copied: branches/chromium/1025/LayoutTests/editing/deleting/delete-start-block.html (from rev 106380, trunk/LayoutTests/editing/deleting/delete-start-block.html) (0 => 106820)


--- branches/chromium/1025/LayoutTests/editing/deleting/delete-start-block.html	                        (rev 0)
+++ branches/chromium/1025/LayoutTests/editing/deleting/delete-start-block.html	2012-02-06 19:01:11 UTC (rev 106820)
@@ -0,0 +1,15 @@
+><progress><script src=""
+
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+
+document.designMode="on";
+document.execCommand("selectall");
+document.execCommand("justifycenter",false);
+document.body.removeChild(document.body.firstElementChild);
+document.execCommand("insertparagraph");
+
+Markup.description("This tests removing the start block. WebKit should not crash.");
+Markup.dump(document.body);
+
+</script>

Modified: branches/chromium/1025/Source/WebCore/editing/DeleteSelectionCommand.cpp (106819 => 106820)


--- branches/chromium/1025/Source/WebCore/editing/DeleteSelectionCommand.cpp	2012-02-06 18:35:54 UTC (rev 106819)
+++ branches/chromium/1025/Source/WebCore/editing/DeleteSelectionCommand.cpp	2012-02-06 19:01:11 UTC (rev 106820)
@@ -418,6 +418,8 @@
     if (startNode == m_startBlock && startOffset == 0 && canHaveChildrenForEditing(startNode) && !startNode->hasTagName(tableTag)) {
         startOffset = 0;
         startNode = startNode->traverseNextNode();
+        if (!startNode)
+            return;
     }
 
     if (startOffset >= caretMaxOffset(startNode) && startNode->isTextNode()) {
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to