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

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
« no previous file with comments | « Source/core/loader/FrameLoader.h ('k') | Source/core/page/Page.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/loader/FrameLoader.cpp
diff --git a/Source/core/loader/FrameLoader.cpp b/Source/core/loader/FrameLoader.cpp
index 95e6a1f13e495bad5e53f3d61d64e055a17dcf4f..edc0995435aa4d3be0d35ced09faadd46447fcdb 100644
--- a/Source/core/loader/FrameLoader.cpp
+++ b/Source/core/loader/FrameLoader.cpp
@@ -1000,18 +1000,10 @@ void FrameLoader::notifyIfInitialDocumentAccessed()
}
}
-void FrameLoader::commitProvisionalLoad()
+bool FrameLoader::prepareForCommit()
{
- ASSERT(client()->hasWebView());
PluginScriptForbiddenScope forbidPluginDestructorScripting;
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();
@@ -1023,7 +1015,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) {
FrameNavigationDisabler navigationDisabler(m_frame);
m_documentLoader->detachFromFrame();
@@ -1034,12 +1026,29 @@ 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();
+ return true;
+}
+
+void FrameLoader::commitProvisionalLoad()
+{
+ ASSERT(client()->hasWebView());
+ 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(m_provisionalDocumentLoader->request().url());
+ m_provisionalDocumentLoader->timing().setHasSameOriginAsPreviousDocument(securityOrigin->canRequest(m_frame->document()->url()));
+ }
+
+ if (!prepareForCommit())
+ return;
+
if (isLoadingMainFrame())
m_frame->page()->chromeClient().needTouchEvents(false);
« no previous file with comments | « Source/core/loader/FrameLoader.h ('k') | Source/core/page/Page.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698