⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 276558 in webkit


Ignore:
Timestamp:
Apr 24, 2021, 3:31:57 PM (5 years ago)
Author:
commit-queue@webkit.org
Message:

Crash in BreakBlockquoteCommand::doApply()
https://bugs.webkit.org/show_bug.cgi?id=224941

Patch by Julian Gonzalez <julian_a_gonzalez@apple.com> on 2021-04-24
Reviewed by Ryosuke Niwa.

Source/WebCore:

Despite assertions to the contrary, it is possible for there not to be any node
to move into the new blockquote in BreakBlockquoteCommand::doApply() as a result
of layout updates, so remove the assertions and handle this case.

Test: editing/pasteboard/paste-as-quotation-then-paste-crash.html

  • editing/BreakBlockquoteCommand.cpp:

(WebCore::BreakBlockquoteCommand::doApply):

LayoutTests:

Add test for this crash, running only on Release for now.
Thanks to Tuomas Karkkainen for its basic structure.

  • TestExpectations:
  • editing/pasteboard/paste-as-quotation-then-paste-crash-expected.txt: Added.
  • editing/pasteboard/paste-as-quotation-then-paste-crash.html: Added.
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r276549 r276558  
     12021-04-24  Julian Gonzalez  <julian_a_gonzalez@apple.com>
     2
     3        Crash in BreakBlockquoteCommand::doApply()
     4        https://bugs.webkit.org/show_bug.cgi?id=224941
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        Add test for this crash, running only on Release for now.
     9        Thanks to Tuomas Karkkainen for its basic structure.
     10
     11        * TestExpectations:
     12        * editing/pasteboard/paste-as-quotation-then-paste-crash-expected.txt: Added.
     13        * editing/pasteboard/paste-as-quotation-then-paste-crash.html: Added.
     14
    1152021-04-24  Zalan Bujtas  <zalan@apple.com>
    216
  • trunk/LayoutTests/TestExpectations

    r276520 r276558  
    17451745webkit.org/b/139634 [ Debug ] fast/selectors/nth-child-of-register-requirement.html [ Slow ]
    17461746webkit.org/b/139634 [ Debug ] fast/selectors/not-backtracking.html [ Slow ]
     1747
     1748webkit.org/b/224941 [ Debug ] editing/pasteboard/paste-as-quotation-then-paste-crash.html [ WontFix ]
    17471749
    17481750webkit.org/b/61932 [ Debug ] jquery/manipulation.html [ Slow ]
  • trunk/Source/WebCore/ChangeLog

    r276554 r276558  
     12021-04-24  Julian Gonzalez  <julian_a_gonzalez@apple.com>
     2
     3        Crash in BreakBlockquoteCommand::doApply()
     4        https://bugs.webkit.org/show_bug.cgi?id=224941
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        Despite assertions to the contrary, it is possible for there not to be any node
     9        to move into the new blockquote in BreakBlockquoteCommand::doApply() as a result
     10        of layout updates, so remove the assertions and handle this case.
     11
     12        Test: editing/pasteboard/paste-as-quotation-then-paste-crash.html
     13
     14        * editing/BreakBlockquoteCommand.cpp:
     15        (WebCore::BreakBlockquoteCommand::doApply):
     16
    1172021-04-24  Antoine Quint  <graouts@webkit.org>
    218
  • trunk/Source/WebCore/editing/BreakBlockquoteCommand.cpp

    r266557 r276558  
    110110        Text& textNode = downcast<Text>(*startNode);
    111111        if ((unsigned)pos.deprecatedEditingOffset() >= textNode.length()) {
    112             startNode = NodeTraversal::next(*startNode);
    113             ASSERT(startNode);
     112            if (auto* nextNode = NodeTraversal::next(*startNode))
     113                startNode = nextNode;
    114114        } else if (pos.deprecatedEditingOffset() > 0)
    115115            splitTextNode(textNode, pos.deprecatedEditingOffset());
    116116    } else if (pos.deprecatedEditingOffset() > 0) {
    117         Node* childAtOffset = startNode->traverseToChildAt(pos.deprecatedEditingOffset());
    118         startNode = childAtOffset ? childAtOffset : NodeTraversal::next(*startNode);
    119         ASSERT(startNode);
     117        if (auto* child = startNode->traverseToChildAt(pos.deprecatedEditingOffset()))
     118            startNode = child;
     119        else if (auto* next = NodeTraversal::next(*startNode))
     120            startNode = next;
    120121    }
    121122   
Note: See TracChangeset for help on using the changeset viewer.