Title: [272556] trunk
Revision
272556
Author
[email protected]
Date
2021-02-08 15:37:41 -0800 (Mon, 08 Feb 2021)

Log Message

Make getStartEndListChildren check renderers
https://bugs.webkit.org/show_bug.cgi?id=221388

Patch by Rob Buis <[email protected]> on 2021-02-08
Reviewed by Alex Christensen.

Source/WebCore:

Require the list to have non-null renderers for start
and end.

Test: editing/execCommand/insert-nested-lists-crash.html

* editing/ModifySelectionListLevel.cpp:
(WebCore::getStartEndListChildren):

LayoutTests:

Add test for this.

* editing/execCommand/insert-nested-lists-crash-expected.txt: Added.
* editing/execCommand/insert-nested-lists-crash.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (272555 => 272556)


--- trunk/LayoutTests/ChangeLog	2021-02-08 23:34:27 UTC (rev 272555)
+++ trunk/LayoutTests/ChangeLog	2021-02-08 23:37:41 UTC (rev 272556)
@@ -1,3 +1,15 @@
+2021-02-08  Rob Buis  <[email protected]>
+
+        Make getStartEndListChildren check renderers
+        https://bugs.webkit.org/show_bug.cgi?id=221388
+
+        Reviewed by Alex Christensen.
+
+        Add test for this.
+
+        * editing/execCommand/insert-nested-lists-crash-expected.txt: Added.
+        * editing/execCommand/insert-nested-lists-crash.html: Added.
+
 2021-02-08  Said Abou-Hallawa  <[email protected]>
 
         A Pattern with an SVG image is not rendered correctly

Added: trunk/LayoutTests/editing/execCommand/insert-nested-lists-crash-expected.txt (0 => 272556)


--- trunk/LayoutTests/editing/execCommand/insert-nested-lists-crash-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/editing/execCommand/insert-nested-lists-crash-expected.txt	2021-02-08 23:37:41 UTC (rev 272556)
@@ -0,0 +1 @@
+This test passes if it doesn't crash

Added: trunk/LayoutTests/editing/execCommand/insert-nested-lists-crash.html (0 => 272556)


--- trunk/LayoutTests/editing/execCommand/insert-nested-lists-crash.html	                        (rev 0)
+++ trunk/LayoutTests/editing/execCommand/insert-nested-lists-crash.html	2021-02-08 23:37:41 UTC (rev 272556)
@@ -0,0 +1,16 @@
+<style>
+  li {
+    display: contents;
+  }
+</style>
+<script>
+  _onload_ = () => {
+    if (window.testRunner)
+        testRunner.dumpAsText();
+    document.execCommand('SelectAll');
+    document.designMode = 'on';
+    document.execCommand('InsertOrderedList');
+    document.execCommand('InsertNestedOrderedList');
+    document.write("This test passes if it doesn't crash");
+  };
+</script>

Modified: trunk/Source/WebCore/ChangeLog (272555 => 272556)


--- trunk/Source/WebCore/ChangeLog	2021-02-08 23:34:27 UTC (rev 272555)
+++ trunk/Source/WebCore/ChangeLog	2021-02-08 23:37:41 UTC (rev 272556)
@@ -1,3 +1,18 @@
+2021-02-08  Rob Buis  <[email protected]>
+
+        Make getStartEndListChildren check renderers
+        https://bugs.webkit.org/show_bug.cgi?id=221388
+
+        Reviewed by Alex Christensen.
+
+        Require the list to have non-null renderers for start
+        and end.
+
+        Test: editing/execCommand/insert-nested-lists-crash.html
+
+        * editing/ModifySelectionListLevel.cpp:
+        (WebCore::getStartEndListChildren):
+
 2021-02-08  Brady Eidson  <[email protected]>
 
         Make the UserContentController for ServiceWorker pages be non-optional.

Modified: trunk/Source/WebCore/editing/ModifySelectionListLevel.cpp (272555 => 272556)


--- trunk/Source/WebCore/editing/ModifySelectionListLevel.cpp	2021-02-08 23:34:27 UTC (rev 272555)
+++ trunk/Source/WebCore/editing/ModifySelectionListLevel.cpp	2021-02-08 23:37:41 UTC (rev 272556)
@@ -54,12 +54,12 @@
 
     // start must be in a list child
     Node* startListChild = enclosingListChild(selection.start().anchorNode());
-    if (!startListChild)
+    if (!startListChild || !startListChild->renderer())
         return false;
 
     // end must be in a list child
     Node* endListChild = selection.isRange() ? enclosingListChild(selection.end().anchorNode()) : startListChild;
-    if (!endListChild)
+    if (!endListChild || !endListChild->renderer())
         return false;
     
     // For a range selection we want the following behavior:
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to