Changeset 238465 in webkit


Ignore:
Timestamp:
Nov 23, 2018 6:17:30 PM (5 years ago)
Author:
rniwa@webkit.org
Message:

REGRESSION (r236785): Nullptr crash in StyledMarkupAccumulator::traverseNodesForSerialization
https://bugs.webkit.org/show_bug.cgi?id=191921

Reviewed by Dean Jackson.

Source/WebCore:

The bug was caused by traverseNodesForSerialization not being able to traverse past the end of shadow root
when skipping children of a node for which enterNode returns false because it was using NodeTraversal's
nextSkippingChildren instead of a member function which supports traversing the composed tree.

Fixed the crash by using variant of nextSkippingChildren which knows how to traverse past the last node
in a shadow tree. Also added more assertions to help debug issues like this in the future.

Test: editing/pasteboard/copy-paste-across-shadow-boundaries-5.html

  • editing/markup.cpp:

(WebCore::StyledMarkupAccumulator::traverseNodesForSerialization):

LayoutTests:

Added a regression test.

  • editing/pasteboard/copy-paste-across-shadow-boundaries-5-expected.txt: Added.
  • editing/pasteboard/copy-paste-across-shadow-boundaries-5.html: Added.
  • platform/ios/editing/pasteboard/copy-paste-across-shadow-boundaries-5-expected.txt: Added.
Location:
trunk
Files:
3 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r238464 r238465  
     12018-11-23  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        REGRESSION (r236785): Nullptr crash in StyledMarkupAccumulator::traverseNodesForSerialization
     4        https://bugs.webkit.org/show_bug.cgi?id=191921
     5
     6        Reviewed by Dean Jackson.
     7
     8        Added a regression test.
     9
     10        * editing/pasteboard/copy-paste-across-shadow-boundaries-5-expected.txt: Added.
     11        * editing/pasteboard/copy-paste-across-shadow-boundaries-5.html: Added.
     12        * platform/ios/editing/pasteboard/copy-paste-across-shadow-boundaries-5-expected.txt: Added.
     13
    1142018-11-22  Ryosuke Niwa  <rniwa@webkit.org>
    215
  • trunk/Source/WebCore/ChangeLog

    r238464 r238465  
     12018-11-23  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        REGRESSION (r236785): Nullptr crash in StyledMarkupAccumulator::traverseNodesForSerialization
     4        https://bugs.webkit.org/show_bug.cgi?id=191921
     5
     6        Reviewed by Dean Jackson.
     7
     8        The bug was caused by traverseNodesForSerialization not being able to traverse past the end of shadow root
     9        when skipping children of a node for which enterNode returns false because  it was using NodeTraversal's
     10        nextSkippingChildren instead of a member function which supports traversing the composed tree.
     11
     12        Fixed the crash by using variant of nextSkippingChildren which knows how to traverse past the last node
     13        in a shadow tree. Also added more assertions to help debug issues like this in the future.
     14
     15        Test: editing/pasteboard/copy-paste-across-shadow-boundaries-5.html
     16
     17        * editing/markup.cpp:
     18        (WebCore::StyledMarkupAccumulator::traverseNodesForSerialization):
     19
    1202018-11-22  Ryosuke Niwa  <rniwa@webkit.org>
    221
  • trunk/Source/WebCore/editing/markup.cpp

    r237157 r238465  
    646646            }
    647647        }
     648        ASSERT(next || !pastEnd);
    648649
    649650        if (isBlock(n) && canHaveChildrenForEditing(*n) && next == pastEnd) {
     
    653654
    654655        if (!enterNode(*n)) {
    655             next = NodeTraversal::nextSkippingChildren(*n);
     656            next = nextSkippingChildren(*n);
    656657            // Don't skip over pastEnd.
    657658            if (pastEnd && isDescendantOf(*pastEnd, *n))
    658659                next = pastEnd;
     660            ASSERT(next || !pastEnd);
    659661        } else {
    660662            if (!hasChildNodes(*n))
Note: See TracChangeset for help on using the changeset viewer.