Title: [191596] trunk
Revision
191596
Author
commit-qu...@webkit.org
Date
2015-10-26 13:08:19 -0700 (Mon, 26 Oct 2015)

Log Message

Null dereference loading Blink layout test editing/execCommand/indent-no-visible-contents-crash.html
https://bugs.webkit.org/show_bug.cgi?id=149292
<rdar://problem/22746530>

Patch by Jiewen Tan <jiewen_...@apple.com> on 2015-10-26
Reviewed by Alex Christensen.

Source/WebCore:

This is a merge of Blink r176735:
https://codereview.chromium.org/349143002

Test: editing/execCommand/indent-no-visible-contents-crash.html

* editing/CompositeEditCommand.cpp:
(WebCore::CompositeEditCommand::moveParagraphWithClones):
Sometimes callers of this method will pass null startOfParagraphToMove || endOfParagraphToMove,
hence check them before proceeding.

LayoutTests:

* editing/execCommand/indent-no-visible-contents-crash-expected.txt: Added.
* editing/execCommand/indent-no-visible-contents-crash.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (191595 => 191596)


--- trunk/LayoutTests/ChangeLog	2015-10-26 20:01:51 UTC (rev 191595)
+++ trunk/LayoutTests/ChangeLog	2015-10-26 20:08:19 UTC (rev 191596)
@@ -1,3 +1,14 @@
+2015-10-26  Jiewen Tan  <jiewen_...@apple.com>
+
+        Null dereference loading Blink layout test editing/execCommand/indent-no-visible-contents-crash.html
+        https://bugs.webkit.org/show_bug.cgi?id=149292
+        <rdar://problem/22746530>
+
+        Reviewed by Alex Christensen.
+
+        * editing/execCommand/indent-no-visible-contents-crash-expected.txt: Added.
+        * editing/execCommand/indent-no-visible-contents-crash.html: Added.
+
 2015-10-26  Simon Fraser  <simon.fra...@apple.com>
 
         Implement 'round' and 'space' values for border-image

Added: trunk/LayoutTests/editing/execCommand/indent-no-visible-contents-crash-expected.txt (0 => 191596)


--- trunk/LayoutTests/editing/execCommand/indent-no-visible-contents-crash-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/editing/execCommand/indent-no-visible-contents-crash-expected.txt	2015-10-26 20:08:19 UTC (rev 191596)
@@ -0,0 +1 @@
+Pass if not crash.

Added: trunk/LayoutTests/editing/execCommand/indent-no-visible-contents-crash.html (0 => 191596)


--- trunk/LayoutTests/editing/execCommand/indent-no-visible-contents-crash.html	                        (rev 0)
+++ trunk/LayoutTests/editing/execCommand/indent-no-visible-contents-crash.html	2015-10-26 20:08:19 UTC (rev 191596)
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+<body>
+<div contenteditable="true" id="target"><span></span></div>
+</body>
+<script>
+if (window.testRunner)
+    testRunner.dumpAsText();
+getSelection().collapse(document.getElementById('target'), 0);
+document.execCommand('Indent');
+document.body.textContent = 'Pass if not crash.';
+</script>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (191595 => 191596)


--- trunk/Source/WebCore/ChangeLog	2015-10-26 20:01:51 UTC (rev 191595)
+++ trunk/Source/WebCore/ChangeLog	2015-10-26 20:08:19 UTC (rev 191596)
@@ -1,3 +1,21 @@
+2015-10-26  Jiewen Tan  <jiewen_...@apple.com>
+
+        Null dereference loading Blink layout test editing/execCommand/indent-no-visible-contents-crash.html
+        https://bugs.webkit.org/show_bug.cgi?id=149292
+        <rdar://problem/22746530>
+
+        Reviewed by Alex Christensen.
+
+        This is a merge of Blink r176735:
+        https://codereview.chromium.org/349143002
+
+        Test: editing/execCommand/indent-no-visible-contents-crash.html
+
+        * editing/CompositeEditCommand.cpp:
+        (WebCore::CompositeEditCommand::moveParagraphWithClones):
+        Sometimes callers of this method will pass null startOfParagraphToMove || endOfParagraphToMove,
+        hence check them before proceeding.
+
 2015-10-26  Anders Carlsson  <ander...@apple.com>
 
         Remove dead context menu code

Modified: trunk/Source/WebCore/editing/CompositeEditCommand.cpp (191595 => 191596)


--- trunk/Source/WebCore/editing/CompositeEditCommand.cpp	2015-10-26 20:01:51 UTC (rev 191595)
+++ trunk/Source/WebCore/editing/CompositeEditCommand.cpp	2015-10-26 20:08:19 UTC (rev 191596)
@@ -1159,6 +1159,9 @@
 
 void CompositeEditCommand::moveParagraphWithClones(const VisiblePosition& startOfParagraphToMove, const VisiblePosition& endOfParagraphToMove, Element* blockElement, Node* outerNode)
 {
+    if (startOfParagraphToMove.isNull() || endOfParagraphToMove.isNull())
+        return;
+    
     ASSERT(outerNode);
     ASSERT(blockElement);
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to