| 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);
|
|
|