Changeset 140101 in webkit


Ignore:
Timestamp:
Jan 17, 2013 9:07:08 PM (11 years ago)
Author:
rafaelw@chromium.org
Message:

Ensure the parser adopts foster-parented children into the document of their parent.
https://bugs.webkit.org/show_bug.cgi?id=107023

Reviewed by Adam Barth.

Source/WebCore:

Tests: fast/parser/foster-parent-adopted.html

fast/parser/foster-parent-adopted2.html

  • html/parser/HTMLConstructionSite.cpp:

(WebCore::HTMLConstructionSite::insertTextNode):
(WebCore::HTMLConstructionSite::fosterParent):

LayoutTests:

This patch adopts the child into the parent's document after foster parenting to prevent a child from ending up in the tree with the wrong document.

  • fast/parser/foster-parent-adopted-expected.txt: Added.
  • fast/parser/foster-parent-adopted.html: Added.
  • fast/parser/foster-parent-adopted2-expected.txt: Added.
  • fast/parser/foster-parent-adopted2.html: Added.
Location:
trunk
Files:
4 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r140097 r140101  
     12013-01-17  Rafael Weinstein  <rafaelw@chromium.org>
     2
     3        Ensure the parser adopts foster-parented children into the document of their parent.
     4        https://bugs.webkit.org/show_bug.cgi?id=107023
     5
     6        Reviewed by Adam Barth.
     7
     8        This patch adopts the child into the parent's document after foster parenting to prevent a child from ending up in the tree with the wrong document.
     9
     10        * fast/parser/foster-parent-adopted-expected.txt: Added.
     11        * fast/parser/foster-parent-adopted.html: Added.
     12        * fast/parser/foster-parent-adopted2-expected.txt: Added.
     13        * fast/parser/foster-parent-adopted2.html: Added.
     14
    1152013-01-17  Shinya Kawanaka  <shinyak@chromium.org>
    216
  • trunk/Source/WebCore/ChangeLog

    r140099 r140101  
     12013-01-17  Rafael Weinstein  <rafaelw@chromium.org>
     2
     3        Ensure the parser adopts foster-parented children into the document of their parent.
     4        https://bugs.webkit.org/show_bug.cgi?id=107023
     5
     6        Reviewed by Adam Barth.
     7
     8        Tests: fast/parser/foster-parent-adopted.html
     9               fast/parser/foster-parent-adopted2.html
     10
     11        * html/parser/HTMLConstructionSite.cpp:
     12        (WebCore::HTMLConstructionSite::insertTextNode):
     13        (WebCore::HTMLConstructionSite::fosterParent):
     14
    1152013-01-17  Martin Robinson  <mrobinson@igalia.com>
    216
  • trunk/Source/WebCore/html/parser/HTMLConstructionSite.cpp

    r139217 r140101  
    504504        ASSERT(currentPosition <= characters.length());
    505505        task.child = textNode.release();
     506
     507        if (task.parent->document() != task.child->document())
     508            task.parent->document()->adoptNode(task.child, ASSERT_NO_EXCEPTION);
     509
    506510        executeTask(task);
    507511    }
     
    640644    task.child = node;
    641645    ASSERT(task.parent);
     646
     647    if (task.parent->document() != task.child->document())
     648        task.parent->document()->adoptNode(task.child, ASSERT_NO_EXCEPTION);
     649
    642650    m_attachmentQueue.append(task);
    643651}
Note: See TracChangeset for help on using the changeset viewer.