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

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

Issue 561813003: Prepare blink to unify definitions of load completion (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 3 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 eb5fe8016d1a199937124a0a3f56c5cfba52a134..173fb7066e92155a4189688008efc28c0b242f37 100644
--- a/Source/core/loader/FrameLoader.cpp
+++ b/Source/core/loader/FrameLoader.cpp
@@ -229,8 +229,10 @@ bool FrameLoader::closeURL()
void FrameLoader::didExplicitOpen()
{
// Calling document.open counts as committing the first real document load.
- if (!m_stateMachine.committedFirstRealDocumentLoad())
+ if (!m_stateMachine.committedFirstRealDocumentLoad()) {
m_stateMachine.advanceTo(FrameLoaderStateMachine::CommittedFirstRealLoad);
+ m_progressTracker->progressStarted();
Nate Chapin 2014/09/15 23:39:35 Similar to a javascript url, an explicit open() in
+ }
// Prevent window.open(url) -- eg window.open("about:blank") -- from blowing away results
// from a subsequent window.document.open / window.document.write call.
@@ -936,6 +938,7 @@ FrameLoadType FrameLoader::loadType() const
return m_loadType;
}
+#if defined(ENABLE_LOAD_COMPLETION_HACKS)
// This function is an incomprehensible mess and is only used in checkLoadCompleteForThisFrame.
// If you're thinking of using it elsewhere, stop right now and reconsider your life.
static bool isDocumentDoneLoading(Document* document)
@@ -944,18 +947,15 @@ static bool isDocumentDoneLoading(Document* document)
return true;
if (document->loader()->isLoadingMainResource())
return false;
- if (!document->loadEventFinished()) {
- if (document->loader()->isLoading() || document->isDelayingLoadEvent())
- return false;
- }
+ if (!document->loadEventFinished())
+ return false;
if (document->fetcher()->requestCount())
return false;
if (document->processingLoadEvent())
return false;
- if (document->hasActiveParser())
- return false;
return true;
}
+#endif
bool FrameLoader::checkLoadCompleteForThisFrame()
{
@@ -991,8 +991,16 @@ bool FrameLoader::checkLoadCompleteForThisFrame()
return true;
if (m_provisionalDocumentLoader || !m_documentLoader)
return false;
+
+#if defined(ENABLE_LOAD_COMPLETION_HACKS)
if (!isDocumentDoneLoading(m_frame->document()) && !m_inStopAllLoaders)
return false;
+#else
+ if (m_inStopAllLoaders)
+ m_frame->document()->suppressLoadEvent();
+ if (!m_frame->document()->loadEventFinished())
+ return false;
+#endif
m_state = FrameStateComplete;
@@ -1296,6 +1304,8 @@ void FrameLoader::loadWithNavigationAction(const NavigationAction& action, Frame
if ((!m_policyDocumentLoader->shouldContinueForNavigationPolicy(request, shouldCheckMainWorldContentSecurityPolicy, isTransitionNavigation) || !shouldClose()) && m_policyDocumentLoader) {
m_policyDocumentLoader->detachFromFrame();
m_policyDocumentLoader = nullptr;
+ if (!m_stateMachine.committedFirstRealDocumentLoad())
+ m_state = FrameStateComplete;
Nate Chapin 2014/09/15 23:39:35 This isn't necessary in the real world at the mome
checkCompleted();
return;
}

Powered by Google App Engine
This is Rietveld 408576698