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

Side by Side Diff: Source/core/html/HTMLFrameOwnerElement.cpp

Issue 655063003: Disconnect frame owners when detaching frames. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on top of frame detach streamlining and add a test Created 6 years, 2 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/frame/Frame.cpp ('k') | Source/web/tests/WebFrameTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 } 145 }
146 146
147 void HTMLFrameOwnerElement::disconnectContentFrame() 147 void HTMLFrameOwnerElement::disconnectContentFrame()
148 { 148 {
149 // FIXME: Currently we don't do this in removedFrom because this causes an 149 // FIXME: Currently we don't do this in removedFrom because this causes an
150 // unload event in the subframe which could execute script that could then 150 // unload event in the subframe which could execute script that could then
151 // reach up into this document and then attempt to look back down. We should 151 // reach up into this document and then attempt to look back down. We should
152 // see if this behavior is really needed as Gecko does not allow this. 152 // see if this behavior is really needed as Gecko does not allow this.
153 if (RefPtrWillBeRawPtr<Frame> frame = contentFrame()) { 153 if (RefPtrWillBeRawPtr<Frame> frame = contentFrame()) {
154 frame->detach(); 154 frame->detach();
155 frame->disconnectOwnerElement();
156 } 155 }
157 #if ENABLE(OILPAN) 156 #if ENABLE(OILPAN)
158 // Oilpan: a plugin container must be explicitly disposed before it 157 // Oilpan: a plugin container must be explicitly disposed before it
159 // is swept and finalized. This is because the underlying plugin needs 158 // is swept and finalized. This is because the underlying plugin needs
160 // to be able to access a fully-functioning frame (and all it refers 159 // to be able to access a fully-functioning frame (and all it refers
161 // to) while it destructs and cleans out its resources. 160 // to) while it destructs and cleans out its resources.
162 if (m_widget) { 161 if (m_widget) {
163 m_widget->dispose(); 162 m_widget->dispose();
164 m_widget = nullptr; 163 m_widget = nullptr;
165 } 164 }
166 #endif 165 #endif
167 } 166 }
168 167
169 HTMLFrameOwnerElement::~HTMLFrameOwnerElement() 168 HTMLFrameOwnerElement::~HTMLFrameOwnerElement()
170 { 169 {
171 #if ENABLE(OILPAN)
172 // An owner must by now have been informed of detachment 170 // An owner must by now have been informed of detachment
173 // when the frame was closed. 171 // when the frame was closed.
174 ASSERT(!m_contentFrame); 172 ASSERT(!m_contentFrame);
175 #else
176 if (m_contentFrame)
177 m_contentFrame->disconnectOwnerElement();
178 #endif
179 } 173 }
180 174
181 Document* HTMLFrameOwnerElement::contentDocument() const 175 Document* HTMLFrameOwnerElement::contentDocument() const
182 { 176 {
183 return (m_contentFrame && m_contentFrame->isLocalFrame()) ? toLocalFrame(m_c ontentFrame)->document() : 0; 177 return (m_contentFrame && m_contentFrame->isLocalFrame()) ? toLocalFrame(m_c ontentFrame)->document() : 0;
184 } 178 }
185 179
186 LocalDOMWindow* HTMLFrameOwnerElement::contentWindow() const 180 LocalDOMWindow* HTMLFrameOwnerElement::contentWindow() const
187 { 181 {
188 return m_contentFrame ? m_contentFrame->domWindow() : 0; 182 return m_contentFrame ? m_contentFrame->domWindow() : 0;
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 void HTMLFrameOwnerElement::trace(Visitor* visitor) 261 void HTMLFrameOwnerElement::trace(Visitor* visitor)
268 { 262 {
269 visitor->trace(m_contentFrame); 263 visitor->trace(m_contentFrame);
270 visitor->trace(m_widget); 264 visitor->trace(m_widget);
271 HTMLElement::trace(visitor); 265 HTMLElement::trace(visitor);
272 FrameOwner::trace(visitor); 266 FrameOwner::trace(visitor);
273 } 267 }
274 268
275 269
276 } // namespace blink 270 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/frame/Frame.cpp ('k') | Source/web/tests/WebFrameTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698