Chromium Code Reviews| Index: Source/core/loader/FrameLoader.cpp |
| diff --git a/Source/core/loader/FrameLoader.cpp b/Source/core/loader/FrameLoader.cpp |
| index a1583c411d1ef3f840e7714411e2f05d0f7891e9..da401266c7c66e885b66230f412d95b924f8b662 100644 |
| --- a/Source/core/loader/FrameLoader.cpp |
| +++ b/Source/core/loader/FrameLoader.cpp |
| @@ -240,8 +240,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(); |
| + } |
| // Prevent window.open(url) -- eg window.open("about:blank") -- from blowing away results |
| // from a subsequent window.document.open / window.document.write call. |
| @@ -958,6 +960,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) |
| @@ -966,18 +969,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() |
| { |
| @@ -1013,8 +1013,16 @@ bool FrameLoader::checkLoadCompleteForThisFrame() |
| return true; |
| if (m_provisionalDocumentLoader || !m_documentLoader) |
| return false; |
| + |
| +#if defined(ENABLE_LOAD_COMPLETION_HACKS) |
|
dcheng
2014/10/20 18:35:14
o.O
|
| 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; |
| @@ -1273,6 +1281,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; |
| checkCompleted(); |
| return; |
| } |