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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 // A lot of the following steps can result in the current frame being | 167 // A lot of the following steps can result in the current frame being |
168 // detached, so protect a reference to it. | 168 // detached, so protect a reference to it. |
169 RefPtrWillBeRawPtr<LocalFrame> protect(this); | 169 RefPtrWillBeRawPtr<LocalFrame> protect(this); |
170 m_loader.stopAllLoaders(); | 170 m_loader.stopAllLoaders(); |
171 m_loader.closeURL(); | 171 m_loader.closeURL(); |
172 detachChildren(); | 172 detachChildren(); |
173 // stopAllLoaders() needs to be called after detachChildren(), because detac
hChildren() | 173 // stopAllLoaders() needs to be called after detachChildren(), because detac
hChildren() |
174 // will trigger the unload event handlers of any child frames, and those eve
nt | 174 // will trigger the unload event handlers of any child frames, and those eve
nt |
175 // handlers might start a new subresource load in this frame. | 175 // handlers might start a new subresource load in this frame. |
176 m_loader.stopAllLoaders(); | 176 m_loader.stopAllLoaders(); |
177 if (!client()) | 177 m_loader.detachFromParent(); |
178 return; | |
179 m_loader.detach(); | |
180 setView(nullptr); | |
181 willDetachFrameHost(); | |
182 // Notify ScriptController that the frame is closing, since its cleanup ends
up calling | |
183 // back to FrameLoaderClient via WindowProxy. | |
184 script().clearForClose(); | |
185 InspectorInstrumentation::frameDetachedFromParent(this); | |
186 Frame::detach(); | |
187 } | 178 } |
188 | 179 |
189 bool LocalFrame::inScope(TreeScope* scope) const | 180 bool LocalFrame::inScope(TreeScope* scope) const |
190 { | 181 { |
191 ASSERT(scope); | 182 ASSERT(scope); |
192 Document* doc = document(); | 183 Document* doc = document(); |
193 if (!doc) | 184 if (!doc) |
194 return false; | 185 return false; |
195 // FIXME: This check is broken in for OOPI. | 186 // FIXME: This check is broken in for OOPI. |
196 HTMLFrameOwnerElement* owner = doc->ownerElement(); | 187 HTMLFrameOwnerElement* owner = doc->ownerElement(); |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 m_destructionObservers.add(observer); | 308 m_destructionObservers.add(observer); |
318 } | 309 } |
319 | 310 |
320 void LocalFrame::removeDestructionObserver(FrameDestructionObserver* observer) | 311 void LocalFrame::removeDestructionObserver(FrameDestructionObserver* observer) |
321 { | 312 { |
322 m_destructionObservers.remove(observer); | 313 m_destructionObservers.remove(observer); |
323 } | 314 } |
324 | 315 |
325 void LocalFrame::willDetachFrameHost() | 316 void LocalFrame::willDetachFrameHost() |
326 { | 317 { |
| 318 // We should never be detatching the page during a Layout. |
| 319 RELEASE_ASSERT(!m_view || !m_view->isInPerformLayout()); |
| 320 |
| 321 Frame* parent = tree().parent(); |
| 322 if (parent && parent->isLocalFrame()) |
| 323 toLocalFrame(parent)->loader().checkLoadComplete(); |
327 | 324 |
328 WillBeHeapHashSet<RawPtrWillBeWeakMember<FrameDestructionObserver> >::iterat
or stop = m_destructionObservers.end(); | 325 WillBeHeapHashSet<RawPtrWillBeWeakMember<FrameDestructionObserver> >::iterat
or stop = m_destructionObservers.end(); |
329 for (WillBeHeapHashSet<RawPtrWillBeWeakMember<FrameDestructionObserver> >::i
terator it = m_destructionObservers.begin(); it != stop; ++it) | 326 for (WillBeHeapHashSet<RawPtrWillBeWeakMember<FrameDestructionObserver> >::i
terator it = m_destructionObservers.begin(); it != stop; ++it) |
330 (*it)->willDetachFrameHost(); | 327 (*it)->willDetachFrameHost(); |
331 | 328 |
332 // FIXME: Page should take care of updating focus/scrolling instead of Frame
. | 329 // FIXME: Page should take care of updating focus/scrolling instead of Frame
. |
333 // FIXME: It's unclear as to why this is called more than once, but it is, | 330 // FIXME: It's unclear as to why this is called more than once, but it is, |
334 // so page() could be null. | 331 // so page() could be null. |
335 if (page() && page()->focusController().focusedFrame() == this) | 332 if (page() && page()->focusController().focusedFrame() == this) |
336 page()->focusController().setFocusedFrame(nullptr); | 333 page()->focusController().setFocusedFrame(nullptr); |
337 script().clearScriptObjects(); | 334 script().clearScriptObjects(); |
338 | 335 |
339 if (page() && page()->scrollingCoordinator() && m_view) | 336 if (page() && page()->scrollingCoordinator() && m_view) |
340 page()->scrollingCoordinator()->willDestroyScrollableArea(m_view.get()); | 337 page()->scrollingCoordinator()->willDestroyScrollableArea(m_view.get()); |
341 } | 338 } |
342 | 339 |
| 340 void LocalFrame::detachFromFrameHost() |
| 341 { |
| 342 // We should never be detaching the page during a Layout. |
| 343 RELEASE_ASSERT(!m_view || !m_view->isInPerformLayout()); |
| 344 m_host = nullptr; |
| 345 } |
| 346 |
343 String LocalFrame::documentTypeString() const | 347 String LocalFrame::documentTypeString() const |
344 { | 348 { |
345 if (DocumentType* doctype = document()->doctype()) | 349 if (DocumentType* doctype = document()->doctype()) |
346 return createMarkup(doctype); | 350 return createMarkup(doctype); |
347 | 351 |
348 return String(); | 352 return String(); |
349 } | 353 } |
350 | 354 |
351 String LocalFrame::selectedText() const | 355 String LocalFrame::selectedText() const |
352 { | 356 { |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 for (RefPtrWillBeRawPtr<Frame> child = tree().firstChild(); child; child = c
hild->tree().nextSibling()) { | 573 for (RefPtrWillBeRawPtr<Frame> child = tree().firstChild(); child; child = c
hild->tree().nextSibling()) { |
570 if (child->isLocalFrame()) | 574 if (child->isLocalFrame()) |
571 toLocalFrame(child.get())->deviceOrPageScaleFactorChanged(); | 575 toLocalFrame(child.get())->deviceOrPageScaleFactorChanged(); |
572 } | 576 } |
573 } | 577 } |
574 | 578 |
575 bool LocalFrame::isURLAllowed(const KURL& url) const | 579 bool LocalFrame::isURLAllowed(const KURL& url) const |
576 { | 580 { |
577 // We allow one level of self-reference because some sites depend on that, | 581 // We allow one level of self-reference because some sites depend on that, |
578 // but we don't allow more than one. | 582 // but we don't allow more than one. |
579 if (host()->frameCount() >= FrameHost::maxNumberOfFrames) | 583 if (page()->subframeCount() >= Page::maxNumberOfFrames) |
580 return false; | 584 return false; |
581 bool foundSelfReference = false; | 585 bool foundSelfReference = false; |
582 for (const Frame* frame = this; frame; frame = frame->tree().parent()) { | 586 for (const Frame* frame = this; frame; frame = frame->tree().parent()) { |
583 if (!frame->isLocalFrame()) | 587 if (!frame->isLocalFrame()) |
584 continue; | 588 continue; |
585 if (equalIgnoringFragmentIdentifier(toLocalFrame(frame)->document()->url
(), url)) { | 589 if (equalIgnoringFragmentIdentifier(toLocalFrame(frame)->document()->url
(), url)) { |
586 if (foundSelfReference) | 590 if (foundSelfReference) |
587 return false; | 591 return false; |
588 foundSelfReference = true; | 592 foundSelfReference = true; |
589 } | 593 } |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
727 | 731 |
728 return curFrame; | 732 return curFrame; |
729 } | 733 } |
730 | 734 |
731 void LocalFrame::setPagePopupOwner(Element& owner) | 735 void LocalFrame::setPagePopupOwner(Element& owner) |
732 { | 736 { |
733 m_pagePopupOwner = &owner; | 737 m_pagePopupOwner = &owner; |
734 } | 738 } |
735 | 739 |
736 } // namespace blink | 740 } // namespace blink |
OLD | NEW |