Commit 720bc090 authored by sigbjornf@opera.com's avatar sigbjornf@opera.com

Accurately update Document node counts on disposing shadow roots.

When cleaning out a ShadowRoot's child Nodes as part of its disposal,
the child Nodes will in some cases not have other references than the
shadow root. If so, the Node will be summarily deleted without being
notified of it being removed from its DOM tree first. By calling its
removedFrom().

As a Document need to maintain an accurate attached node count, arrange
for the otherwise-unreferenced Node's document to be decremented.

R=
BUG=521520

Review URL: https://codereview.chromium.org/1309083002

git-svn-id: svn://svn.chromium.org/blink/trunk@201044 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 39f38319
...@@ -513,6 +513,9 @@ void ContainerNode::addChildNodesToDeletionQueue(Node*& head, Node*& tail, Conta ...@@ -513,6 +513,9 @@ void ContainerNode::addChildNodesToDeletionQueue(Node*& head, Node*& tail, Conta
next->setPreviousSibling(nullptr); next->setPreviousSibling(nullptr);
if (!n->refCount()) { if (!n->refCount()) {
if (n->inDocument())
container.document().decrementNodeCount();
#if ENABLE(SECURITY_ASSERT) #if ENABLE(SECURITY_ASSERT)
n->m_deletionHasBegun = true; n->m_deletionHasBegun = true;
#endif #endif
......
...@@ -596,7 +596,6 @@ void Document::dispose() ...@@ -596,7 +596,6 @@ void Document::dispose()
DocumentLifecycleNotifier::notifyDocumentWasDisposed(); DocumentLifecycleNotifier::notifyDocumentWasDisposed();
m_canvasFontCache.clear(); m_canvasFontCache.clear();
m_nodeCount = 0;
} }
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment