Bug 170717 - Webkit 2.14.6 fails to build: no matching function for call to ‘WebCore::ContainerNode::ensurePreInsertionValidity
Summary: Webkit 2.14.6 fails to build: no matching function for call to ‘WebCore::Cont...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: PC Other
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-04-10 21:56 PDT by apyhalov
Modified: 2017-04-10 21:56 PDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description apyhalov 2017-04-10 21:56:15 PDT
In Webkit 2.14.6 the following code was added:

--- webkitgtk-2.14.5/Source/WebCore/dom/ContainerNode.cpp  2017-02-07 11:05:08.000000000 +0300
+++ webkitgtk-2.14.6/Source/WebCore/dom/ContainerNode.cpp        2017-04-06 13:52:51.000000000 +0300
@@ -127,21 +128,27 @@
             mutation.willRemoveChild(child);
     }
 
-    // FIXME: We need to do notifyMutationObserversNodeWillDetach() for each child,
-    // probably inside removeDetachedChildrenInContainer.
+    disconnectSubframesIfNeeded(*oldParent, DescendantsOnly);
+    {
+        NoEventDispatchAssertion assertNoEventDispatch;
 
-    oldParent->removeDetachedChildren();
+        oldParent->document().nodeChildrenWillBeRemoved(*oldParent);
 
-    for (auto& child : children) {
-        destroyRenderTreeIfNeeded(child);
+        WidgetHierarchyUpdatesSuspensionScope suspendWidgetHierarchyUpdates;
+        while (RefPtr<Node> child = oldParent->m_firstChild) {
+            oldParent->removeBetween(nullptr, child->nextSibling(), *child);
+            notifyChildNodeRemoved(*oldParent, *child);
+        }
+        ChildChange change = { AllChildrenRemoved, nullptr, nullptr, ChildChangeSourceParser };
+        childrenChanged(change);
+    }
 
-        // FIXME: We need a no mutation event version of adoptNode.
-        RefPtr<Node> adoptedChild = document().adoptNode(child, ASSERT_NO_EXCEPTION);
-        parserAppendChild(*adoptedChild);
-        // FIXME: Together with adoptNode above, the tree scope might get updated recursively twice
-        // (if the document changed or oldParent was in a shadow tree, AND *this is in a shadow tree).
-        // Can we do better?
-        treeScope().adoptIfNeeded(adoptedChild.get());
+    // FIXME: assert that we don't dispatch events here since this container node is still disconnected.
+    for (auto& child : children) {
+        RELEASE_ASSERT(!child->parentNode() && &child->treeScope() == &treeScope());
+        ASSERT(!ensurePreInsertionValidity(child, nullptr).hasException());
+        treeScope().adoptIfNeeded(child.ptr());
+        parserAppendChild(child);
     }
 }



But ContainerNode.cpp uses old style of ensurePreInsertionValidity function:

// https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity
bool ContainerNode::ensurePreInsertionValidity(Node& newChild, Node* refChild, ExceptionCode& ec)
{
    ec = checkAcceptChild(*this, newChild, refChild, Document::AcceptChildOperation::InsertOrAdd);
    return !ec;
}

so build fails with 

webkitgtk-2.14.6/Source/WebCore/dom/ContainerNode.cpp:149:58: error: no matching function for call to ‘WebCore::ContainerNode::ensurePreInsertionValidity(WTF::Ref<WebCore::Node>&, std::nullptr_t)’
         ASSERT(!ensurePreInsertionValidity(child, nullptr).hasException());
...