Changeset 74101 in webkit


Ignore:
Timestamp:
Dec 15, 2010 1:47:12 AM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2010-12-15 Emil Eklund <eae@chromium.org>

Reviewed by Adam Barth.

Added test for infinite loop in ContainerNode::willRemoveChildren.
https://bugs.webkit.org/show_bug.cgi?id=51079

  • fast/dom/containerNode-expected.txt: Added.
  • fast/dom/containerNode.html: Added.

2010-12-15 Emil Eklund <eae@chromium.org>

Reviewed by Adam Barth.

Change ContainerNode::willRemoveChildren to not fire mutation events for children
added as a result of a mutation event, thereby avoiding an infinite loop.
https://bugs.webkit.org/show_bug.cgi?id=51079

Test: fast/dom/containerNode.html

  • dom/ContainerNode.cpp: (WebCore::willRemoveChildren): Don't fire mutation events for children added during a mutation event.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r74100 r74101  
     12010-12-15  Emil Eklund  <eae@chromium.org>
     2
     3        Reviewed by Adam Barth.
     4
     5        Added test for infinite loop in ContainerNode::willRemoveChildren.
     6        https://bugs.webkit.org/show_bug.cgi?id=51079
     7
     8        * fast/dom/containerNode-expected.txt: Added.
     9        * fast/dom/containerNode.html: Added.
     10
    1112010-12-15  Csaba Osztrogonác  <ossy@webkit.org>
    212
  • trunk/WebCore/ChangeLog

    r74099 r74101  
     12010-12-15  Emil Eklund  <eae@chromium.org>
     2
     3        Reviewed by Adam Barth.
     4
     5        Change ContainerNode::willRemoveChildren to not fire mutation events for children
     6        added as a result of a mutation event, thereby avoiding an infinite loop.
     7        https://bugs.webkit.org/show_bug.cgi?id=51079
     8
     9        Test: fast/dom/containerNode.html
     10
     11        * dom/ContainerNode.cpp:
     12        (WebCore::willRemoveChildren): Don't fire mutation events for children added during a mutation event.
     13
    1142010-12-14  Dan Bernstein  <mitz@apple.com>
    215
  • trunk/WebCore/dom/ContainerNode.cpp

    r73690 r74101  
    380380    container->document()->incDOMTreeVersion();
    381381
    382     // FIXME: Adding new children from event handlers can cause an infinite loop here.
    383     for (RefPtr<Node> child = container->firstChild(); child; child = child->nextSibling()) {
     382    NodeVector children;
     383    for (Node* n = container->firstChild(); n; n = n->nextSibling())
     384        children.append(n);
     385
     386    for (NodeVector::const_iterator it = children.begin(); it != children.end(); it++) {
     387        Node* child = it->get();
    384388        // fire removed from document mutation events.
    385         dispatchChildRemovalEvents(child.get());
     389        dispatchChildRemovalEvents(child);
    386390        child->willRemove();
    387391    }
Note: See TracChangeset for help on using the changeset viewer.