Chromium Code Reviews| Index: Source/core/frame/Frame.cpp |
| diff --git a/Source/core/frame/Frame.cpp b/Source/core/frame/Frame.cpp |
| index 3502201f9bd31c2f21081b6b8ed3daa46ea79968..d4c4c551470efc9ee5eadd28eb4b478e67ab5532 100644 |
| --- a/Source/core/frame/Frame.cpp |
| +++ b/Source/core/frame/Frame.cpp |
| @@ -79,10 +79,16 @@ Frame::Frame(FrameHost* host, HTMLFrameOwnerElement* ownerElement) |
| #ifndef NDEBUG |
| frameCounter.increment(); |
| #endif |
| + |
| + if (this->ownerElement()) { |
|
eseidel
2014/03/21 19:01:35
Why this-> Do we have an ownerElement local?
kenrb
2014/03/21 19:59:31
I asked the exact same question on dcheng's patch
|
| + page()->incrementSubframeCount(); |
| + this->ownerElement()->setContentFrame(*this); |
| + } |
| } |
| Frame::~Frame() |
| { |
| + disconnectOwnerElement(); |
| setDOMWindow(nullptr); |
| // FIXME: We should not be doing all this work inside the destructor |
| @@ -179,4 +185,18 @@ bool Frame::isMainFrame() const |
| return page && this == page->mainFrame(); |
| } |
| +void Frame::disconnectOwnerElement() |
| +{ |
| + // FIXME: The semantics here are specific to LocalFrame and will need to change |
| + // when RemoteFrames no longer have Documents. |
| + if (ownerElement()) { |
| + if (Document* doc = document()) |
| + doc->topDocument().clearAXObjectCache(); |
| + ownerElement()->clearContentFrame(); |
| + if (page()) |
| + page()->decrementSubframeCount(); |
| + } |
| + m_ownerElement = 0; |
| +} |
| + |
| } // namespace WebCore |