OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> | 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> |
3 * 1999 Lars Knoll <knoll@kde.org> | 3 * 1999 Lars Knoll <knoll@kde.org> |
4 * 1999 Antti Koivisto <koivisto@kde.org> | 4 * 1999 Antti Koivisto <koivisto@kde.org> |
5 * 2000 Simon Hausmann <hausmann@kde.org> | 5 * 2000 Simon Hausmann <hausmann@kde.org> |
6 * 2000 Stefan Schimanski <1Stein@gmx.de> | 6 * 2000 Stefan Schimanski <1Stein@gmx.de> |
7 * 2001 George Staikos <staikos@kde.org> | 7 * 2001 George Staikos <staikos@kde.org> |
8 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ights reserved. | 8 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ights reserved. |
9 * Copyright (C) 2005 Alexey Proskuryakov <ap@nypop.com> | 9 * Copyright (C) 2005 Alexey Proskuryakov <ap@nypop.com> |
10 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 10 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 HashSet<FrameDestructionObserver*>::iterator stop = m_destructionObservers.e
nd(); | 123 HashSet<FrameDestructionObserver*>::iterator stop = m_destructionObservers.e
nd(); |
124 for (HashSet<FrameDestructionObserver*>::iterator it = m_destructionObserver
s.begin(); it != stop; ++it) | 124 for (HashSet<FrameDestructionObserver*>::iterator it = m_destructionObserver
s.begin(); it != stop; ++it) |
125 (*it)->frameDestroyed(); | 125 (*it)->frameDestroyed(); |
126 } | 126 } |
127 | 127 |
128 void LocalFrame::detach() | 128 void LocalFrame::detach() |
129 { | 129 { |
130 // A lot of the following steps can result in the current frame being | 130 // A lot of the following steps can result in the current frame being |
131 // detached, so protect a reference to it. | 131 // detached, so protect a reference to it. |
132 RefPtr<LocalFrame> protect(this); | 132 RefPtr<LocalFrame> protect(this); |
133 m_loader.stopAllLoaders(); | |
134 m_loader.closeURL(); | |
135 detachChildren(); | 133 detachChildren(); |
136 // stopAllLoaders() needs to be called after detachChildren(), because detac
hChildren() | 134 // stopAllLoaders() needs to be called after detachChildren(), because detac
hChildren() |
137 // will trigger the unload event handlers of any child frames, and those eve
nt | 135 // will trigger the unload event handlers of any child frames, and those eve
nt |
138 // handlers might start a new subresource load in this frame. | 136 // handlers might start a new subresource load in this frame. |
| 137 m_loader.closeURL(); |
139 m_loader.stopAllLoaders(); | 138 m_loader.stopAllLoaders(); |
140 m_loader.detachFromParent(); | 139 if (!client()) |
| 140 return; |
| 141 m_loader.detach(); |
| 142 setView(nullptr); |
| 143 willDetachFrameHost(); |
| 144 // Notify ScriptController that the frame is closing, since its cleanup ends
up calling |
| 145 // back to FrameLoaderClient via WindowProxy. |
| 146 script().clearForClose(); |
| 147 InspectorInstrumentation::frameDetachedFromParent(this); |
| 148 Frame::detach(); |
141 } | 149 } |
142 | 150 |
143 bool LocalFrame::inScope(TreeScope* scope) const | 151 bool LocalFrame::inScope(TreeScope* scope) const |
144 { | 152 { |
145 ASSERT(scope); | 153 ASSERT(scope); |
146 Document* doc = document(); | 154 Document* doc = document(); |
147 if (!doc) | 155 if (!doc) |
148 return false; | 156 return false; |
149 // FIXME: This check is broken in for OOPI. | 157 // FIXME: This check is broken in for OOPI. |
150 HTMLFrameOwnerElement* owner = doc->ownerElement(); | 158 HTMLFrameOwnerElement* owner = doc->ownerElement(); |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 m_destructionObservers.add(observer); | 271 m_destructionObservers.add(observer); |
264 } | 272 } |
265 | 273 |
266 void LocalFrame::removeDestructionObserver(FrameDestructionObserver* observer) | 274 void LocalFrame::removeDestructionObserver(FrameDestructionObserver* observer) |
267 { | 275 { |
268 m_destructionObservers.remove(observer); | 276 m_destructionObservers.remove(observer); |
269 } | 277 } |
270 | 278 |
271 void LocalFrame::willDetachFrameHost() | 279 void LocalFrame::willDetachFrameHost() |
272 { | 280 { |
273 // We should never be detatching the page during a Layout. | |
274 RELEASE_ASSERT(!m_view || !m_view->isInPerformLayout()); | |
275 | |
276 Frame* parent = tree().parent(); | |
277 if (parent && parent->isLocalFrame()) | |
278 toLocalFrame(parent)->loader().checkLoadComplete(); | |
279 | |
280 HashSet<FrameDestructionObserver*>::iterator stop = m_destructionObservers.e
nd(); | 281 HashSet<FrameDestructionObserver*>::iterator stop = m_destructionObservers.e
nd(); |
281 for (HashSet<FrameDestructionObserver*>::iterator it = m_destructionObserver
s.begin(); it != stop; ++it) | 282 for (HashSet<FrameDestructionObserver*>::iterator it = m_destructionObserver
s.begin(); it != stop; ++it) |
282 (*it)->willDetachFrameHost(); | 283 (*it)->willDetachFrameHost(); |
283 | 284 |
284 // FIXME: Page should take care of updating focus/scrolling instead of Frame
. | 285 // FIXME: Page should take care of updating focus/scrolling instead of Frame
. |
285 // FIXME: It's unclear as to why this is called more than once, but it is, | 286 // FIXME: It's unclear as to why this is called more than once, but it is, |
286 // so page() could be null. | 287 // so page() could be null. |
287 if (page() && page()->focusController().focusedFrame() == this) | 288 if (page() && page()->focusController().focusedFrame() == this) |
288 page()->focusController().setFocusedFrame(nullptr); | 289 page()->focusController().setFocusedFrame(nullptr); |
289 script().clearScriptObjects(); | 290 script().clearScriptObjects(); |
290 | 291 |
291 if (page() && page()->scrollingCoordinator() && m_view) | 292 if (page() && page()->scrollingCoordinator() && m_view) |
292 page()->scrollingCoordinator()->willDestroyScrollableArea(m_view.get()); | 293 page()->scrollingCoordinator()->willDestroyScrollableArea(m_view.get()); |
293 } | 294 } |
294 | 295 |
295 void LocalFrame::detachFromFrameHost() | |
296 { | |
297 // We should never be detatching the page during a Layout. | |
298 RELEASE_ASSERT(!m_view || !m_view->isInPerformLayout()); | |
299 m_host = 0; | |
300 } | |
301 | |
302 String LocalFrame::documentTypeString() const | 296 String LocalFrame::documentTypeString() const |
303 { | 297 { |
304 if (DocumentType* doctype = document()->doctype()) | 298 if (DocumentType* doctype = document()->doctype()) |
305 return createMarkup(doctype); | 299 return createMarkup(doctype); |
306 | 300 |
307 return String(); | 301 return String(); |
308 } | 302 } |
309 | 303 |
310 String LocalFrame::selectedText() const | 304 String LocalFrame::selectedText() const |
311 { | 305 { |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 for (RefPtr<Frame> child = tree().firstChild(); child; child = child->tree()
.nextSibling()) { | 522 for (RefPtr<Frame> child = tree().firstChild(); child; child = child->tree()
.nextSibling()) { |
529 if (child->isLocalFrame()) | 523 if (child->isLocalFrame()) |
530 toLocalFrame(child.get())->deviceOrPageScaleFactorChanged(); | 524 toLocalFrame(child.get())->deviceOrPageScaleFactorChanged(); |
531 } | 525 } |
532 } | 526 } |
533 | 527 |
534 bool LocalFrame::isURLAllowed(const KURL& url) const | 528 bool LocalFrame::isURLAllowed(const KURL& url) const |
535 { | 529 { |
536 // We allow one level of self-reference because some sites depend on that, | 530 // We allow one level of self-reference because some sites depend on that, |
537 // but we don't allow more than one. | 531 // but we don't allow more than one. |
538 if (page()->subframeCount() >= Page::maxNumberOfFrames) | 532 if (host()->frameCount() >= FrameHost::maxNumberOfFrames) |
539 return false; | 533 return false; |
540 bool foundSelfReference = false; | 534 bool foundSelfReference = false; |
541 for (const Frame* frame = this; frame; frame = frame->tree().parent()) { | 535 for (const Frame* frame = this; frame; frame = frame->tree().parent()) { |
542 if (!frame->isLocalFrame()) | 536 if (!frame->isLocalFrame()) |
543 continue; | 537 continue; |
544 if (equalIgnoringFragmentIdentifier(toLocalFrame(frame)->document()->url
(), url)) { | 538 if (equalIgnoringFragmentIdentifier(toLocalFrame(frame)->document()->url
(), url)) { |
545 if (foundSelfReference) | 539 if (foundSelfReference) |
546 return false; | 540 return false; |
547 foundSelfReference = true; | 541 foundSelfReference = true; |
548 } | 542 } |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
679 | 673 |
680 return curFrame; | 674 return curFrame; |
681 } | 675 } |
682 | 676 |
683 void LocalFrame::setPagePopupOwner(Element& owner) | 677 void LocalFrame::setPagePopupOwner(Element& owner) |
684 { | 678 { |
685 m_pagePopupOwner = &owner; | 679 m_pagePopupOwner = &owner; |
686 } | 680 } |
687 | 681 |
688 } // namespace blink | 682 } // namespace blink |
OLD | NEW |