Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1453)

Unified Diff: Source/core/loader/FrameLoader.cpp

Issue 1041473002: Detach old frame on WebFrame::swap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/loader/FrameLoader.cpp
diff --git a/Source/core/loader/FrameLoader.cpp b/Source/core/loader/FrameLoader.cpp
index f37d7a4ab0bbf399a4e53e16cd53daaa59b91427..e432768919d7512cfd1ed329f0f23ae1fe8fe67f 100644
--- a/Source/core/loader/FrameLoader.cpp
+++ b/Source/core/loader/FrameLoader.cpp
@@ -956,17 +956,9 @@ void FrameLoader::notifyIfInitialDocumentAccessed()
}
}
-void FrameLoader::commitProvisionalLoad()
+bool FrameLoader::prepareForCommit()
{
- ASSERT(client()->hasWebView());
RefPtr<DocumentLoader> pdl = m_provisionalDocumentLoader;
- RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get());
-
- // Check if the destination page is allowed to access the previous page's timing information.
- if (m_frame->document()) {
- RefPtr<SecurityOrigin> securityOrigin = SecurityOrigin::create(pdl->request().url());
- pdl->timing().setHasSameOriginAsPreviousDocument(securityOrigin->canRequest(m_frame->document()->url()));
- }
if (m_documentLoader) {
client()->dispatchWillClose();
@@ -978,7 +970,7 @@ void FrameLoader::commitProvisionalLoad()
// script intiates a new load or causes the current frame to be detached,
// we need to abandon the current load.
if (pdl != m_provisionalDocumentLoader)
- return;
+ return false;
if (m_documentLoader)
m_documentLoader->detachFromFrame();
// detachFromFrame() will abort XHRs that haven't completed, which can
@@ -987,12 +979,30 @@ void FrameLoader::commitProvisionalLoad()
// TODO(dcheng): Investigate if this can be moved above the check that
// m_provisionalDocumentLoader hasn't changed.
if (!m_frame->client())
- return;
+ return false;
// No more events will be dispatched so detach the Document.
if (m_frame->document())
m_frame->document()->detach();
m_documentLoader = m_provisionalDocumentLoader.release();
dcheng 2015/06/08 19:34:42 Is it actually safe to assume that m_provisionalDo
lfg 2015/06/10 18:41:28 It doesn't matter, since the oldFrame is being det
+ return true;
+}
+
+void FrameLoader::commitProvisionalLoad()
+{
+ ASSERT(client()->hasWebView());
+ RefPtr<DocumentLoader> pdl = m_provisionalDocumentLoader;
+ RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get());
+
+ // Check if the destination page is allowed to access the previous page's timing information.
+ if (m_frame->document()) {
+ RefPtr<SecurityOrigin> securityOrigin = SecurityOrigin::create(pdl->request().url());
+ pdl->timing().setHasSameOriginAsPreviousDocument(securityOrigin->canRequest(m_frame->document()->url()));
+ }
+
+ if (!prepareForCommit())
+ return;
+
if (isLoadingMainFrame())
m_frame->page()->chromeClient().needTouchEvents(false);

Powered by Google App Engine
This is Rietveld 408576698