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

Changeset 285764 in webkit


Ignore:
Timestamp:
Nov 12, 2021, 5:16:04 PM (5 years ago)
Author:
commit-queue@webkit.org
Message:

Null check m_spanElement
https://bugs.webkit.org/show_bug.cgi?id=230894

Patch by Rob Buis <rbuis@igalia.com> on 2021-11-12
Reviewed by Wenson Hsieh.

Source/WebCore:

Null check m_spanElement in ReplaceNodeWithSpanCommand::doUnapply, since
it may not be created by ReplaceNodeWithSpanCommand::doApply.

Test: editing/execCommand/default-paragraph-separator-crash.html

  • editing/ReplaceNodeWithSpanCommand.cpp:

(WebCore::ReplaceNodeWithSpanCommand::doUnapply):

  • editing/ReplaceSelectionCommand.cpp:

(WebCore::ReplaceSelectionCommand::makeInsertedContentRoundTrippableWithHTMLTreeBuilder):

LayoutTests:

  • editing/execCommand/default-paragraph-separator-crash-expected.txt: Added.
  • editing/execCommand/default-paragraph-separator-crash.html: Added.
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r285747 r285764  
     12021-11-12  Rob Buis  <rbuis@igalia.com>
     2
     3        Null check m_spanElement
     4        https://bugs.webkit.org/show_bug.cgi?id=230894
     5
     6        Reviewed by Wenson Hsieh.
     7
     8        * editing/execCommand/default-paragraph-separator-crash-expected.txt: Added.
     9        * editing/execCommand/default-paragraph-separator-crash.html: Added.
     10
    1112021-11-12  Chris Dumez  <cdumez@apple.com>
    212
  • trunk/Source/WebCore/ChangeLog

    r285747 r285764  
     12021-11-12  Rob Buis  <rbuis@igalia.com>
     2
     3        Null check m_spanElement
     4        https://bugs.webkit.org/show_bug.cgi?id=230894
     5
     6        Reviewed by Wenson Hsieh.
     7
     8        Null check m_spanElement in ReplaceNodeWithSpanCommand::doUnapply, since
     9        it may not be created by ReplaceNodeWithSpanCommand::doApply.
     10
     11        Test: editing/execCommand/default-paragraph-separator-crash.html
     12
     13        * editing/ReplaceNodeWithSpanCommand.cpp:
     14        (WebCore::ReplaceNodeWithSpanCommand::doUnapply):
     15        * editing/ReplaceSelectionCommand.cpp:
     16        (WebCore::ReplaceSelectionCommand::makeInsertedContentRoundTrippableWithHTMLTreeBuilder):
     17
    1182021-11-12  Chris Dumez  <cdumez@apple.com>
    219
  • trunk/Source/WebCore/editing/ReplaceNodeWithSpanCommand.cpp

    r277382 r285764  
    6969void ReplaceNodeWithSpanCommand::doUnapply()
    7070{
    71     if (!m_spanElement->isConnected())
     71    if (!m_spanElement || !m_spanElement->isConnected())
    7272        return;
    7373    swapInNodePreservingAttributesAndChildren(m_elementToReplace, *m_spanElement);
  • trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp

    r282860 r285764  
    796796            continue;
    797797
     798        if (!node->isConnected())
     799            continue;
     800
    798801        if (isProhibitedParagraphChild(downcast<HTMLElement>(*node).localName())) {
    799802            if (RefPtr paragraphElement = enclosingElementWithTag(positionInParentBeforeNode(node.get()), pTag)) {
    800803                RefPtr parent { paragraphElement->parentNode() };
    801                 if (parent && parent->hasEditableStyle())
     804                if (parent && parent->hasEditableStyle()) {
    802805                    moveNodeOutOfAncestor(*node, *paragraphElement, insertedNodes);
     806                    if (!node->isConnected())
     807                        continue;
     808                }
    803809            }
    804810        }
Note: See TracChangeset for help on using the changeset viewer.