Changeset 154320 in webkit


Ignore:
Timestamp:
Aug 20, 2013 3:13:00 AM (11 years ago)
Author:
Antti Koivisto
Message:

<https://webkit.org/b/119969> REGRESSION (r154232): Crash on the japantimes.co.jp

Source/WebCore:

Reviewed by Andreas Kling.

PseudoElement no longer has parent and calling Element::insertedInto for them crashes as it tries to access it.

Normally there are no pseudo elements when Element::insertedInto() is invoked as they get detached and attached
along with rendering. However in this case the page inserts a <style> that uses ::before along with an element
that it applies to. Stylesheet insertion triggers synchronous style recalc that attaches rendering to all newly
insered elements. Later Element::insertedInto gets called for the element that has pseudo element and we crash.

Test: fast/css-generated-content/insert-stylesheet-and-pseudo-crash.html

  • dom/Element.cpp:

(WebCore::Element::insertedInto):
(WebCore::Element::removedFrom):

Remove calls to insertedInto/removedFrom for pseudo elements. They are not considered to be in document.
When they are added normally during render tree attach these calls don't happen either.

LayoutTests:

Reviewed by Andreas Kling.

  • fast/css-generated-content/insert-stylesheet-and-pseudo-crash-expected.txt: Added.
  • fast/css-generated-content/insert-stylesheet-and-pseudo-crash.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r154319 r154320  
     12013-08-20  Antti Koivisto  <antti@apple.com>
     2
     3        <https://webkit.org/b/119969> REGRESSION (r154232): Crash on the japantimes.co.jp
     4
     5        Reviewed by Andreas Kling.
     6
     7        * fast/css-generated-content/insert-stylesheet-and-pseudo-crash-expected.txt: Added.
     8        * fast/css-generated-content/insert-stylesheet-and-pseudo-crash.html: Added.
     9
    1102013-08-20  Simon Pena  <simon.pena@samsung.com>
    211
  • trunk/Source/WebCore/ChangeLog

    r154317 r154320  
     12013-08-20  Antti Koivisto  <antti@apple.com>
     2
     3        <https://webkit.org/b/119969> REGRESSION (r154232): Crash on the japantimes.co.jp
     4
     5        Reviewed by Andreas Kling.
     6       
     7        PseudoElement no longer has parent and calling Element::insertedInto for them crashes as it tries to access it.
     8
     9        Normally there are no pseudo elements when Element::insertedInto() is invoked as they get detached and attached
     10        along with rendering. However in this case the page inserts a <style> that uses ::before along with an element
     11        that it applies to. Stylesheet insertion triggers synchronous style recalc that attaches rendering to all newly
     12        insered elements. Later Element::insertedInto gets called for the element that has pseudo element and we crash.
     13
     14        Test: fast/css-generated-content/insert-stylesheet-and-pseudo-crash.html
     15
     16        * dom/Element.cpp:
     17        (WebCore::Element::insertedInto):
     18        (WebCore::Element::removedFrom):
     19       
     20            Remove calls to insertedInto/removedFrom for pseudo elements. They are not considered to be in document.
     21            When they are added normally during render tree attach these calls don't happen either.
     22
    1232013-08-20  Ryosuke Niwa  <rniwa@webkit.org>
    224
  • trunk/Source/WebCore/dom/Element.cpp

    r154286 r154320  
    12851285#endif
    12861286
    1287     if (Element* before = pseudoElement(BEFORE))
    1288         before->insertedInto(insertionPoint);
    1289 
    1290     if (Element* after = pseudoElement(AFTER))
    1291         after->insertedInto(insertionPoint);
    1292 
    12931287    if (!insertionPoint->isInTreeScope())
    12941288        return InsertionDone;
     
    13311325    bool wasInDocument = insertionPoint->document();
    13321326#endif
    1333 
    1334     if (Element* before = pseudoElement(BEFORE))
    1335         before->removedFrom(insertionPoint);
    1336 
    1337     if (Element* after = pseudoElement(AFTER))
    1338         after->removedFrom(insertionPoint);
    13391327
    13401328#if ENABLE(DIALOG_ELEMENT)
Note: See TracChangeset for help on using the changeset viewer.