Index: Source/core/loader/FrameLoader.cpp |
diff --git a/Source/core/loader/FrameLoader.cpp b/Source/core/loader/FrameLoader.cpp |
index 6dac27da809150d82b073765dd61bfaf258ded19..81dccfc934bbef72ffa70c5ee442d43c4bb35a20 100644 |
--- a/Source/core/loader/FrameLoader.cpp |
+++ b/Source/core/loader/FrameLoader.cpp |
@@ -179,9 +179,6 @@ |
{ |
visitor->trace(m_frame); |
visitor->trace(m_progressTracker); |
- visitor->trace(m_documentLoader); |
- visitor->trace(m_provisionalDocumentLoader); |
- visitor->trace(m_policyDocumentLoader); |
visitor->trace(m_currentItem); |
visitor->trace(m_provisionalItem); |
visitor->trace(m_deferredHistoryLoad); |
@@ -318,7 +315,7 @@ |
// DocumentLoader::replaceDocumentWhileExecutingJavaScriptURL can cause the DocumentLoader to get deref'ed and possible destroyed, |
// so protect it with a RefPtr. |
- RefPtrWillBeRawPtr<DocumentLoader> documentLoader(m_frame->document()->loader()); |
+ RefPtr<DocumentLoader> documentLoader(m_frame->document()->loader()); |
UseCounter::count(*m_frame->document(), UseCounter::ReplaceDocumentViaJavaScriptURL); |
@@ -647,15 +644,6 @@ |
client()->didStopLoading(); |
} |
-void FrameLoader::detachDocumentLoader(RefPtrWillBeMember<DocumentLoader>& loader) |
-{ |
- if (!loader) |
- return; |
- |
- loader->detachFromFrame(); |
- loader = nullptr; |
-} |
- |
void FrameLoader::loadInSameDocument(const KURL& url, PassRefPtr<SerializedScriptValue> stateObject, FrameLoadType type, ClientRedirectPolicy clientRedirect) |
{ |
// If we have a state object, we cannot also be a new navigation. |
@@ -664,7 +652,9 @@ |
// If we have a provisional request for a different document, a fragment scroll should cancel it. |
if (m_provisionalDocumentLoader) { |
m_provisionalDocumentLoader->stopLoading(); |
- detachDocumentLoader(m_provisionalDocumentLoader); |
+ if (m_provisionalDocumentLoader) |
+ m_provisionalDocumentLoader->detachFromFrame(); |
+ m_provisionalDocumentLoader = nullptr; |
if (!m_frame->host()) |
return; |
} |
@@ -977,8 +967,9 @@ |
if (m_documentLoader) |
m_documentLoader->stopLoading(); |
- detachDocumentLoader(m_provisionalDocumentLoader); |
- detachDocumentLoader(m_policyDocumentLoader); |
+ if (m_provisionalDocumentLoader) |
+ m_provisionalDocumentLoader->detachFromFrame(); |
+ m_provisionalDocumentLoader = nullptr; |
m_checkTimer.stop(); |
m_frame->navigationScheduler().cancel(); |
@@ -1018,7 +1009,7 @@ |
bool FrameLoader::prepareForCommit() |
{ |
PluginScriptForbiddenScope forbidPluginDestructorScripting; |
- RefPtrWillBeRawPtr<DocumentLoader> pdl = m_provisionalDocumentLoader; |
+ RefPtr<DocumentLoader> pdl = m_provisionalDocumentLoader; |
if (m_documentLoader) { |
client()->dispatchWillClose(); |
@@ -1033,7 +1024,7 @@ |
return false; |
if (m_documentLoader) { |
FrameNavigationDisabler navigationDisabler(m_frame); |
- detachDocumentLoader(m_documentLoader); |
+ m_documentLoader->detachFromFrame(); |
} |
// detachFromFrame() will abort XHRs that haven't completed, which can |
// trigger event listeners for 'abort'. These event listeners might detach |
@@ -1152,9 +1143,9 @@ |
// The caller must protect a reference to m_frame. |
ASSERT(m_frame->refCount() > 1); |
#endif |
- detachDocumentLoader(m_documentLoader); |
- detachDocumentLoader(m_provisionalDocumentLoader); |
- detachDocumentLoader(m_policyDocumentLoader); |
+ if (m_documentLoader) |
+ m_documentLoader->detachFromFrame(); |
+ m_documentLoader = nullptr; |
Frame* parent = m_frame->tree().parent(); |
if (parent && parent->isLocalFrame()) |
@@ -1186,7 +1177,8 @@ |
client()->dispatchDidFailProvisionalLoad(error, historyCommitType); |
if (loader != m_provisionalDocumentLoader) |
return; |
- detachDocumentLoader(m_provisionalDocumentLoader); |
+ m_provisionalDocumentLoader->detachFromFrame(); |
+ m_provisionalDocumentLoader = nullptr; |
m_progressTracker->progressCompleted(); |
} else { |
ASSERT(loader == m_documentLoader); |
@@ -1291,7 +1283,8 @@ |
// stopAllLoaders can detach the LocalFrame, so protect it. |
RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); |
if ((!m_policyDocumentLoader->shouldContinueForNavigationPolicy(request, frameLoadRequest.shouldCheckMainWorldContentSecurityPolicy(), navigationPolicy) || !shouldClose()) && m_policyDocumentLoader) { |
- detachDocumentLoader(m_policyDocumentLoader); |
+ m_policyDocumentLoader->detachFromFrame(); |
+ m_policyDocumentLoader = nullptr; |
return; |
} |
@@ -1305,7 +1298,9 @@ |
if (m_provisionalDocumentLoader) { |
m_provisionalDocumentLoader->stopLoading(); |
- detachDocumentLoader(m_provisionalDocumentLoader); |
+ if (m_provisionalDocumentLoader) |
+ m_provisionalDocumentLoader->detachFromFrame(); |
+ m_provisionalDocumentLoader = nullptr; |
} |
m_checkTimer.stop(); |