Changeset 121162 in webkit


Ignore:
Timestamp:
Jun 25, 2012 9:59:25 AM (12 years ago)
Author:
shinyak@chromium.org
Message:

[Shadow] Executing Italic and InsertUnorderedList in Shadow DOM causes a crash
https://bugs.webkit.org/show_bug.cgi?id=88495

Reviewed by Ryosuke Niwa.

Source/WebCore:

InsertionPoint::removedFrom(insertionPoint) tries to find its owner ElementShadow from
parentNode or insertionPoint. If the parent node exsits but we cannot reach ElementShadow from
the parent node, InsertionPoint::removedFrom does not try to find ElementShadow anymore.

It's OK if the ElementShadow is being destructed, but there is a case ElementShadow is not being
destructed in editing. In this case, we should try to find ElementShadow from insertionPoint.
Otherwise it will bring inconsistency to Shadow DOM, and causes a crash.

Actually checking the existence of parentNode() does not make any sense. We should get
shadowRoot() directly.

Test: editing/shadow/insertorderedlist-crash.html

  • html/shadow/InsertionPoint.cpp:

(WebCore::InsertionPoint::removedFrom):

LayoutTests:

  • editing/shadow/insertorderedlist-crash-expected.txt: Added.
  • editing/shadow/insertorderedlist-crash.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r121157 r121162  
     12012-06-25  Shinya Kawanaka  <shinyak@chromium.org>
     2
     3        [Shadow] Executing Italic and InsertUnorderedList in Shadow DOM causes a crash
     4        https://bugs.webkit.org/show_bug.cgi?id=88495
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        * editing/shadow/insertorderedlist-crash-expected.txt: Added.
     9        * editing/shadow/insertorderedlist-crash.html: Added.
     10
    1112012-06-25  Allan Sandfeld Jensen  <allan.jensen@nokia.com>
    212
  • trunk/Source/WebCore/ChangeLog

    r121161 r121162  
     12012-06-25  Shinya Kawanaka  <shinyak@chromium.org>
     2
     3        [Shadow] Executing Italic and InsertUnorderedList in Shadow DOM causes a crash
     4        https://bugs.webkit.org/show_bug.cgi?id=88495
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        InsertionPoint::removedFrom(insertionPoint) tries to find its owner ElementShadow from
     9        parentNode or insertionPoint. If the parent node exsits but we cannot reach ElementShadow from
     10        the parent node, InsertionPoint::removedFrom does not try to find ElementShadow anymore.
     11
     12        It's OK if the ElementShadow is being destructed, but there is a case ElementShadow is not being
     13        destructed in editing. In this case, we should try to find ElementShadow from insertionPoint.
     14        Otherwise it will bring inconsistency to Shadow DOM, and causes a crash.
     15
     16        Actually checking the existence of parentNode() does not make any sense. We should get
     17        shadowRoot() directly.
     18
     19        Test: editing/shadow/insertorderedlist-crash.html
     20
     21        * html/shadow/InsertionPoint.cpp:
     22        (WebCore::InsertionPoint::removedFrom):
     23
    1242012-06-25  Kinuko Yasuda  <kinuko@chromium.org>
    225
  • trunk/Source/WebCore/html/shadow/InsertionPoint.cpp

    r119790 r121162  
    129129{
    130130    if (insertionPoint->inDocument()) {
    131         Node* parent = parentNode();
    132         if (!parent)
    133             parent = insertionPoint;
    134         if (ShadowRoot* root = parent->shadowRoot()) {
    135             // host can be null when removedFrom() is called from ElementShadow destructor.
    136             if (root->host())
    137                 root->owner()->invalidateDistribution();
    138         }
     131        ShadowRoot* root = shadowRoot();
     132        if (!root)
     133            root = insertionPoint->shadowRoot();
     134
     135        // host can be null when removedFrom() is called from ElementShadow destructor.
     136        if (root && root->host())
     137            root->owner()->invalidateDistribution();
    139138
    140139        // Since this insertion point is no longer visible from the shadow subtree, it need to clean itself up.
Note: See TracChangeset for help on using the changeset viewer.