Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Unified Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 1207613004: Fix leaking AXNodeObjects when sub document detaches (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebased Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/accessibility/AXARIAGrid.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/dom/Document.cpp
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp
index fa6942c7490bd60df74c479be7a2c5e3461f56e0..c544728907199ece1367b6ba13a3ea1f8dc966eb 100644
--- a/third_party/WebKit/Source/core/dom/Document.cpp
+++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -2237,6 +2237,18 @@ void Document::detach(const AttachContext& context)
m_layoutView = nullptr;
ContainerNode::detach(context);
+ if (this != &axObjectCacheOwner()) {
+ if (AXObjectCache* cache = existingAXObjectCache()) {
+ // Documents that are not a root document use the AXObjectCache in
+ // their root document. Node::removedFrom is called after the
+ // document has been detached so it can't find the root document.
+ // We do the removals here instead.
+ for (Node& node : NodeTraversal::descendantsOf(*this)) {
+ cache->remove(&node);
+ }
+ }
+ }
+
styleEngine().didDetach();
frameHost()->eventHandlerRegistry().documentDetached(*this);
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/accessibility/AXARIAGrid.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698