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