| 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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 // A lot of the following steps can result in the current frame being | 186 // A lot of the following steps can result in the current frame being |
| 187 // detached, so protect a reference to it. | 187 // detached, so protect a reference to it. |
| 188 RefPtrWillBeRawPtr<LocalFrame> protect(this); | 188 RefPtrWillBeRawPtr<LocalFrame> protect(this); |
| 189 m_loader.stopAllLoaders(); | 189 m_loader.stopAllLoaders(); |
| 190 m_loader.closeURL(); | 190 m_loader.closeURL(); |
| 191 detachChildren(); | 191 detachChildren(); |
| 192 // stopAllLoaders() needs to be called after detachChildren(), because detac
hChildren() | 192 // stopAllLoaders() needs to be called after detachChildren(), because detac
hChildren() |
| 193 // will trigger the unload event handlers of any child frames, and those eve
nt | 193 // will trigger the unload event handlers of any child frames, and those eve
nt |
| 194 // handlers might start a new subresource load in this frame. | 194 // handlers might start a new subresource load in this frame. |
| 195 m_loader.stopAllLoaders(); | 195 m_loader.stopAllLoaders(); |
| 196 m_loader.detachFromParent(); | 196 if (!client()) |
| 197 return; |
| 198 m_loader.detach(); |
| 199 setView(nullptr); |
| 200 willDetachFrameHost(); |
| 201 // Notify ScriptController that the frame is closing, since its cleanup ends
up calling |
| 202 // back to FrameLoaderClient via WindowProxy. |
| 203 script().clearForClose(); |
| 204 InspectorInstrumentation::frameDetachedFromParent(this); |
| 205 Frame::detach(); |
| 197 } | 206 } |
| 198 | 207 |
| 199 bool LocalFrame::inScope(TreeScope* scope) const | 208 bool LocalFrame::inScope(TreeScope* scope) const |
| 200 { | 209 { |
| 201 ASSERT(scope); | 210 ASSERT(scope); |
| 202 Document* doc = document(); | 211 Document* doc = document(); |
| 203 if (!doc) | 212 if (!doc) |
| 204 return false; | 213 return false; |
| 205 // FIXME: This check is broken in for OOPI. | 214 // FIXME: This check is broken in for OOPI. |
| 206 HTMLFrameOwnerElement* owner = doc->ownerElement(); | 215 HTMLFrameOwnerElement* owner = doc->ownerElement(); |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 m_destructionObservers.add(observer); | 346 m_destructionObservers.add(observer); |
| 338 } | 347 } |
| 339 | 348 |
| 340 void LocalFrame::removeDestructionObserver(FrameDestructionObserver* observer) | 349 void LocalFrame::removeDestructionObserver(FrameDestructionObserver* observer) |
| 341 { | 350 { |
| 342 m_destructionObservers.remove(observer); | 351 m_destructionObservers.remove(observer); |
| 343 } | 352 } |
| 344 | 353 |
| 345 void LocalFrame::willDetachFrameHost() | 354 void LocalFrame::willDetachFrameHost() |
| 346 { | 355 { |
| 347 // We should never be detatching the page during a Layout. | |
| 348 RELEASE_ASSERT(!m_view || !m_view->isInPerformLayout()); | |
| 349 | |
| 350 Frame* parent = tree().parent(); | |
| 351 if (parent && parent->isLocalFrame()) | |
| 352 toLocalFrame(parent)->loader().checkLoadComplete(); | |
| 353 | 356 |
| 354 WillBeHeapHashSet<RawPtrWillBeWeakMember<FrameDestructionObserver> >::iterat
or stop = m_destructionObservers.end(); | 357 WillBeHeapHashSet<RawPtrWillBeWeakMember<FrameDestructionObserver> >::iterat
or stop = m_destructionObservers.end(); |
| 355 for (WillBeHeapHashSet<RawPtrWillBeWeakMember<FrameDestructionObserver> >::i
terator it = m_destructionObservers.begin(); it != stop; ++it) | 358 for (WillBeHeapHashSet<RawPtrWillBeWeakMember<FrameDestructionObserver> >::i
terator it = m_destructionObservers.begin(); it != stop; ++it) |
| 356 (*it)->willDetachFrameHost(); | 359 (*it)->willDetachFrameHost(); |
| 357 | 360 |
| 358 // FIXME: Page should take care of updating focus/scrolling instead of Frame
. | 361 // FIXME: Page should take care of updating focus/scrolling instead of Frame
. |
| 359 // FIXME: It's unclear as to why this is called more than once, but it is, | 362 // FIXME: It's unclear as to why this is called more than once, but it is, |
| 360 // so page() could be null. | 363 // so page() could be null. |
| 361 if (page() && page()->focusController().focusedFrame() == this) | 364 if (page() && page()->focusController().focusedFrame() == this) |
| 362 page()->focusController().setFocusedFrame(nullptr); | 365 page()->focusController().setFocusedFrame(nullptr); |
| 363 script().clearScriptObjects(); | 366 script().clearScriptObjects(); |
| 364 | 367 |
| 365 if (page() && page()->scrollingCoordinator() && m_view) | 368 if (page() && page()->scrollingCoordinator() && m_view) |
| 366 page()->scrollingCoordinator()->willDestroyScrollableArea(m_view.get()); | 369 page()->scrollingCoordinator()->willDestroyScrollableArea(m_view.get()); |
| 367 } | 370 } |
| 368 | 371 |
| 369 void LocalFrame::detachFromFrameHost() | |
| 370 { | |
| 371 // We should never be detaching the page during a Layout. | |
| 372 RELEASE_ASSERT(!m_view || !m_view->isInPerformLayout()); | |
| 373 m_host = nullptr; | |
| 374 } | |
| 375 | |
| 376 String LocalFrame::documentTypeString() const | 372 String LocalFrame::documentTypeString() const |
| 377 { | 373 { |
| 378 if (DocumentType* doctype = document()->doctype()) | 374 if (DocumentType* doctype = document()->doctype()) |
| 379 return createMarkup(doctype); | 375 return createMarkup(doctype); |
| 380 | 376 |
| 381 return String(); | 377 return String(); |
| 382 } | 378 } |
| 383 | 379 |
| 384 String LocalFrame::selectedText() const | 380 String LocalFrame::selectedText() const |
| 385 { | 381 { |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 602 for (RefPtrWillBeRawPtr<Frame> child = tree().firstChild(); child; child = c
hild->tree().nextSibling()) { | 598 for (RefPtrWillBeRawPtr<Frame> child = tree().firstChild(); child; child = c
hild->tree().nextSibling()) { |
| 603 if (child->isLocalFrame()) | 599 if (child->isLocalFrame()) |
| 604 toLocalFrame(child.get())->deviceOrPageScaleFactorChanged(); | 600 toLocalFrame(child.get())->deviceOrPageScaleFactorChanged(); |
| 605 } | 601 } |
| 606 } | 602 } |
| 607 | 603 |
| 608 bool LocalFrame::isURLAllowed(const KURL& url) const | 604 bool LocalFrame::isURLAllowed(const KURL& url) const |
| 609 { | 605 { |
| 610 // We allow one level of self-reference because some sites depend on that, | 606 // We allow one level of self-reference because some sites depend on that, |
| 611 // but we don't allow more than one. | 607 // but we don't allow more than one. |
| 612 if (page()->subframeCount() >= Page::maxNumberOfFrames) | 608 if (host()->subframeCount() >= FrameHost::maxNumberOfFrames) |
| 613 return false; | 609 return false; |
| 614 bool foundSelfReference = false; | 610 bool foundSelfReference = false; |
| 615 for (const Frame* frame = this; frame; frame = frame->tree().parent()) { | 611 for (const Frame* frame = this; frame; frame = frame->tree().parent()) { |
| 616 if (!frame->isLocalFrame()) | 612 if (!frame->isLocalFrame()) |
| 617 continue; | 613 continue; |
| 618 if (equalIgnoringFragmentIdentifier(toLocalFrame(frame)->document()->url
(), url)) { | 614 if (equalIgnoringFragmentIdentifier(toLocalFrame(frame)->document()->url
(), url)) { |
| 619 if (foundSelfReference) | 615 if (foundSelfReference) |
| 620 return false; | 616 return false; |
| 621 foundSelfReference = true; | 617 foundSelfReference = true; |
| 622 } | 618 } |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 779 } | 775 } |
| 780 | 776 |
| 781 void LocalFrame::unregisterPluginElement(HTMLPlugInElement* plugin) | 777 void LocalFrame::unregisterPluginElement(HTMLPlugInElement* plugin) |
| 782 { | 778 { |
| 783 ASSERT(m_pluginElements.contains(plugin)); | 779 ASSERT(m_pluginElements.contains(plugin)); |
| 784 m_pluginElements.remove(plugin); | 780 m_pluginElements.remove(plugin); |
| 785 } | 781 } |
| 786 #endif | 782 #endif |
| 787 | 783 |
| 788 } // namespace blink | 784 } // namespace blink |
| OLD | NEW |