Changeset 259027 in webkit


Ignore:
Timestamp:
Mar 25, 2020 6:51:14 PM (4 years ago)
Author:
Jack Lee
Message:

Nullptr crash in WebCore::Node::isDescendantOf when inserting list
https://bugs.webkit.org/show_bug.cgi?id=209529
<rdar://problem/60693542>

Reviewed by Darin Adler.

Source/WebCore:

The visible positions may be null if the DOM tree is altered before an edit command is applied.
Add null check for visible positions at the beginning of InsertListCommand::doApply.

Test: editing/inserting/insert-list-during-node-removal-crash.html

  • editing/InsertListCommand.cpp:

(WebCore::InsertListCommand::doApply):

LayoutTests:

Added a regression test for the crash.

  • editing/inserting/insert-list-during-node-removal-crash-expected.txt: Added.
  • editing/inserting/insert-list-during-node-removal-crash.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r259026 r259027  
     12020-03-25  Jack Lee  <shihchieh_lee@apple.com>
     2
     3        Nullptr crash in WebCore::Node::isDescendantOf when inserting list
     4        https://bugs.webkit.org/show_bug.cgi?id=209529
     5        <rdar://problem/60693542>
     6
     7        Reviewed by Darin Adler.
     8
     9        Added a regression test for the crash.
     10
     11        * editing/inserting/insert-list-during-node-removal-crash-expected.txt: Added.
     12        * editing/inserting/insert-list-during-node-removal-crash.html: Added.
     13
    1142020-03-25  Alexey Shvayka  <shvaikalesh@gmail.com>
    215
  • trunk/Source/WebCore/ChangeLog

    r259026 r259027  
     12020-03-25  Jack Lee  <shihchieh_lee@apple.com>
     2
     3        Nullptr crash in WebCore::Node::isDescendantOf when inserting list
     4        https://bugs.webkit.org/show_bug.cgi?id=209529
     5        <rdar://problem/60693542>
     6
     7        Reviewed by Darin Adler.
     8
     9        The visible positions may be null if the DOM tree is altered before an edit command is applied.
     10        Add null check for visible positions at the beginning of InsertListCommand::doApply.
     11
     12        Test: editing/inserting/insert-list-during-node-removal-crash.html
     13
     14        * editing/InsertListCommand.cpp:
     15        (WebCore::InsertListCommand::doApply):
     16
    1172020-03-25  Alexey Shvayka  <shvaikalesh@gmail.com>
    218
  • trunk/Source/WebCore/editing/InsertListCommand.cpp

    r257536 r259027  
    113113void InsertListCommand::doApply()
    114114{
    115     if (endingSelection().isNoneOrOrphaned() || !endingSelection().isContentRichlyEditable())
    116         return;
    117 
    118115    VisiblePosition visibleEnd = endingSelection().visibleEnd();
    119116    VisiblePosition visibleStart = endingSelection().visibleStart();
    120     // When a selection ends at the start of a paragraph, we rarely paint
     117
     118    if (visibleEnd.isNull() || visibleStart.isNull() || !endingSelection().isContentRichlyEditable())
     119        return;
     120
     121    // When a selection ends at the start of a paragraph, we rarely paint
    121122    // the selection gap before that paragraph, because there often is no gap. 
    122123    // In a case like this, it's not obvious to the user that the selection
Note: See TracChangeset for help on using the changeset viewer.