Index: Source/core/loader/FrameLoader.cpp |
diff --git a/Source/core/loader/FrameLoader.cpp b/Source/core/loader/FrameLoader.cpp |
index dc8c56e0ed192e4c9933178cf0656e5e4aed3a04..1df2634ae639196d71389ec41fed72212fd19a9f 100644 |
--- a/Source/core/loader/FrameLoader.cpp |
+++ b/Source/core/loader/FrameLoader.cpp |
@@ -934,7 +934,7 @@ void FrameLoader::commitProvisionalLoad() |
client()->dispatchWillClose(); |
closeURL(); |
} |
- detachChildren(); |
+ m_frame->detachChildren(); |
if (pdl != m_provisionalDocumentLoader) |
return; |
if (m_documentLoader) |
@@ -1104,20 +1104,6 @@ void FrameLoader::restoreScrollPositionAndViewState() |
} |
} |
-void FrameLoader::detachChildren() |
-{ |
- typedef Vector<RefPtr<LocalFrame> > FrameVector; |
- FrameVector childrenToDetach; |
- childrenToDetach.reserveCapacity(m_frame->tree().childCount()); |
- for (Frame* child = m_frame->tree().lastChild(); child; child = child->tree().previousSibling()) { |
- if (child->isLocalFrame()) |
- childrenToDetach.append(toLocalFrame(child)); |
- } |
- FrameVector::iterator end = childrenToDetach.end(); |
- for (FrameVector::iterator it = childrenToDetach.begin(); it != end; ++it) |
- (*it)->loader().detachFromParent(); |
-} |
- |
// Called every time a resource is completely loaded or an error is received. |
void FrameLoader::checkLoadComplete() |
{ |
@@ -1135,28 +1121,12 @@ String FrameLoader::userAgent(const KURL& url) const |
return userAgent; |
} |
-void FrameLoader::frameDetached() |
-{ |
- // stopAllLoaders can detach the LocalFrame, so protect it. |
- RefPtr<LocalFrame> protect(m_frame); |
- stopAllLoaders(); |
- detachFromParent(); |
-} |
- |
void FrameLoader::detachFromParent() |
{ |
// Temporary explosions. We should never re-enter this code when this condition is true. |
RELEASE_ASSERT(!m_willDetachClient); |
- |
- // stopAllLoaders can detach the LocalFrame, so protect it. |
- RefPtr<LocalFrame> protect(m_frame); |
- |
- closeURL(); |
- detachChildren(); |
- // stopAllLoaders() needs to be called after detachChildren(), because detachedChildren() |
- // will trigger the unload event handlers of any child frames, and those event |
- // handlers might start a new subresource load in this frame. |
- stopAllLoaders(); |
+ // The caller must protect a reference to m_frame. |
+ ASSERT(m_frame->refCount() > 1); |
InspectorInstrumentation::frameDetachedFromParent(m_frame); |