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 m_loader.detachFromParent(); | 177 if (!client()) |
| 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(); |
178 } | 187 } |
179 | 188 |
180 bool LocalFrame::inScope(TreeScope* scope) const | 189 bool LocalFrame::inScope(TreeScope* scope) const |
181 { | 190 { |
182 ASSERT(scope); | 191 ASSERT(scope); |
183 Document* doc = document(); | 192 Document* doc = document(); |
184 if (!doc) | 193 if (!doc) |
185 return false; | 194 return false; |
186 // FIXME: This check is broken in for OOPI. | 195 // FIXME: This check is broken in for OOPI. |
187 HTMLFrameOwnerElement* owner = doc->ownerElement(); | 196 HTMLFrameOwnerElement* owner = doc->ownerElement(); |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 m_destructionObservers.add(observer); | 317 m_destructionObservers.add(observer); |
309 } | 318 } |
310 | 319 |
311 void LocalFrame::removeDestructionObserver(FrameDestructionObserver* observer) | 320 void LocalFrame::removeDestructionObserver(FrameDestructionObserver* observer) |
312 { | 321 { |
313 m_destructionObservers.remove(observer); | 322 m_destructionObservers.remove(observer); |
314 } | 323 } |
315 | 324 |
316 void LocalFrame::willDetachFrameHost() | 325 void LocalFrame::willDetachFrameHost() |
317 { | 326 { |
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(); | |
324 | 327 |
325 WillBeHeapHashSet<RawPtrWillBeWeakMember<FrameDestructionObserver> >::iterat
or stop = m_destructionObservers.end(); | 328 WillBeHeapHashSet<RawPtrWillBeWeakMember<FrameDestructionObserver> >::iterat
or stop = m_destructionObservers.end(); |
326 for (WillBeHeapHashSet<RawPtrWillBeWeakMember<FrameDestructionObserver> >::i
terator it = m_destructionObservers.begin(); it != stop; ++it) | 329 for (WillBeHeapHashSet<RawPtrWillBeWeakMember<FrameDestructionObserver> >::i
terator it = m_destructionObservers.begin(); it != stop; ++it) |
327 (*it)->willDetachFrameHost(); | 330 (*it)->willDetachFrameHost(); |
328 | 331 |
329 // FIXME: Page should take care of updating focus/scrolling instead of Frame
. | 332 // FIXME: Page should take care of updating focus/scrolling instead of Frame
. |
330 // FIXME: It's unclear as to why this is called more than once, but it is, | 333 // FIXME: It's unclear as to why this is called more than once, but it is, |
331 // so page() could be null. | 334 // so page() could be null. |
332 if (page() && page()->focusController().focusedFrame() == this) | 335 if (page() && page()->focusController().focusedFrame() == this) |
333 page()->focusController().setFocusedFrame(nullptr); | 336 page()->focusController().setFocusedFrame(nullptr); |
334 script().clearScriptObjects(); | 337 script().clearScriptObjects(); |
335 | 338 |
336 if (page() && page()->scrollingCoordinator() && m_view) | 339 if (page() && page()->scrollingCoordinator() && m_view) |
337 page()->scrollingCoordinator()->willDestroyScrollableArea(m_view.get()); | 340 page()->scrollingCoordinator()->willDestroyScrollableArea(m_view.get()); |
338 } | 341 } |
339 | 342 |
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 | |
347 String LocalFrame::documentTypeString() const | 343 String LocalFrame::documentTypeString() const |
348 { | 344 { |
349 if (DocumentType* doctype = document()->doctype()) | 345 if (DocumentType* doctype = document()->doctype()) |
350 return createMarkup(doctype); | 346 return createMarkup(doctype); |
351 | 347 |
352 return String(); | 348 return String(); |
353 } | 349 } |
354 | 350 |
355 String LocalFrame::selectedText() const | 351 String LocalFrame::selectedText() const |
356 { | 352 { |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
573 for (RefPtrWillBeRawPtr<Frame> child = tree().firstChild(); child; child = c
hild->tree().nextSibling()) { | 569 for (RefPtrWillBeRawPtr<Frame> child = tree().firstChild(); child; child = c
hild->tree().nextSibling()) { |
574 if (child->isLocalFrame()) | 570 if (child->isLocalFrame()) |
575 toLocalFrame(child.get())->deviceOrPageScaleFactorChanged(); | 571 toLocalFrame(child.get())->deviceOrPageScaleFactorChanged(); |
576 } | 572 } |
577 } | 573 } |
578 | 574 |
579 bool LocalFrame::isURLAllowed(const KURL& url) const | 575 bool LocalFrame::isURLAllowed(const KURL& url) const |
580 { | 576 { |
581 // We allow one level of self-reference because some sites depend on that, | 577 // We allow one level of self-reference because some sites depend on that, |
582 // but we don't allow more than one. | 578 // but we don't allow more than one. |
583 if (page()->subframeCount() >= Page::maxNumberOfFrames) | 579 if (host()->frameCount() >= FrameHost::maxNumberOfFrames) |
584 return false; | 580 return false; |
585 bool foundSelfReference = false; | 581 bool foundSelfReference = false; |
586 for (const Frame* frame = this; frame; frame = frame->tree().parent()) { | 582 for (const Frame* frame = this; frame; frame = frame->tree().parent()) { |
587 if (!frame->isLocalFrame()) | 583 if (!frame->isLocalFrame()) |
588 continue; | 584 continue; |
589 if (equalIgnoringFragmentIdentifier(toLocalFrame(frame)->document()->url
(), url)) { | 585 if (equalIgnoringFragmentIdentifier(toLocalFrame(frame)->document()->url
(), url)) { |
590 if (foundSelfReference) | 586 if (foundSelfReference) |
591 return false; | 587 return false; |
592 foundSelfReference = true; | 588 foundSelfReference = true; |
593 } | 589 } |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
731 | 727 |
732 return curFrame; | 728 return curFrame; |
733 } | 729 } |
734 | 730 |
735 void LocalFrame::setPagePopupOwner(Element& owner) | 731 void LocalFrame::setPagePopupOwner(Element& owner) |
736 { | 732 { |
737 m_pagePopupOwner = &owner; | 733 m_pagePopupOwner = &owner; |
738 } | 734 } |
739 | 735 |
740 } // namespace blink | 736 } // namespace blink |
OLD | NEW |