Index: Source/WebCore/dom/ContainerNode.cpp |
=================================================================== |
--- Source/WebCore/dom/ContainerNode.cpp (revision 128789) |
+++ Source/WebCore/dom/ContainerNode.cpp (working copy) |
@@ -352,8 +352,9 @@ |
// fire removed from document mutation events. |
dispatchChildRemovalEvents(child); |
- ChildFrameDisconnector(child).disconnect(); |
} |
+ |
+ ChildFrameDisconnector(container, ChildFrameDisconnector::DoNotIncludeRoot).disconnect(); |
} |
void ContainerNode::disconnectDescendantFrames() |
@@ -384,14 +385,7 @@ |
} |
RefPtr<Node> child = oldChild; |
- willRemoveChild(child.get()); |
- // Mutation events might have moved this child into a different parent. |
- if (child->parentNode() != this) { |
- ec = NOT_FOUND_ERR; |
- return false; |
- } |
- |
document()->removeFocusedNodeOfSubtree(child.get()); |
#if ENABLE(FULLSCREEN_API) |
@@ -405,6 +399,14 @@ |
return false; |
} |
+ willRemoveChild(child.get()); |
+ |
+ // Mutation events might have moved this child into a different parent. |
+ if (child->parentNode() != this) { |
+ ec = NOT_FOUND_ERR; |
+ return false; |
+ } |
+ |
Node* prev = child->previousSibling(); |
Node* next = child->nextSibling(); |
removeBetween(prev, next, child.get()); |
@@ -470,10 +472,6 @@ |
// The container node can be removed from event handlers. |
RefPtr<ContainerNode> protect(this); |
- // Do any prep work needed before actually starting to detach |
- // and remove... e.g. stop loading frames, fire unload events. |
- willRemoveChildren(protect.get()); |
- |
// exclude this node when looking for removed focusedNode since only children will be removed |
document()->removeFocusedNodeOfSubtree(this, true); |
@@ -481,6 +479,10 @@ |
document()->removeFullScreenElementOfSubtree(this, true); |
#endif |
+ // Do any prep work needed before actually starting to detach |
+ // and remove... e.g. stop loading frames, fire unload events. |
+ willRemoveChildren(protect.get()); |
+ |
forbidEventDispatch(); |
Vector<RefPtr<Node>, 10> removedChildren; |
removedChildren.reserveInitialCapacity(childNodeCount()); |