Index: third_party/WebKit/Source/core/loader/FrameLoader.cpp |
diff --git a/third_party/WebKit/Source/core/loader/FrameLoader.cpp b/third_party/WebKit/Source/core/loader/FrameLoader.cpp |
index 1d41d43eb03b3fb373b51a9bc2f5e8b2f265cf74..357fa9989d6add1c0b06c2acaee20b914dcb44f1 100644 |
--- a/third_party/WebKit/Source/core/loader/FrameLoader.cpp |
+++ b/third_party/WebKit/Source/core/loader/FrameLoader.cpp |
@@ -184,6 +184,7 @@ FrameLoader::FrameLoader(LocalFrame* frame) |
, m_forcedSandboxFlags(SandboxNone) |
, m_dispatchingDidClearWindowObjectInMainWorld(false) |
, m_protectProvisionalLoader(false) |
+ , m_isNavigationHandledByClient(false) |
{ |
TRACE_EVENT_OBJECT_CREATED_WITH_ID("loading", "FrameLoader", this); |
takeObjectSnapshot(); |
@@ -619,14 +620,14 @@ static bool shouldSendFinishNotification(LocalFrame* frame) |
return true; |
} |
-static bool shouldSendCompleteNotification(LocalFrame* frame) |
+static bool shouldSendCompleteNotification(LocalFrame* frame, bool isNavigationHandledByClient) |
{ |
// FIXME: We might have already sent stop notifications and be re-completing. |
if (!frame->isLoading()) |
return false; |
// Only send didStopLoading() if there are no navigations in progress at all, |
// whether committed, provisional, or pending. |
- return frame->loader().documentLoader()->sentDidFinishLoad() && !frame->loader().provisionalDocumentLoader(); |
+ return frame->loader().documentLoader()->sentDidFinishLoad() && !frame->loader().provisionalDocumentLoader() && !isNavigationHandledByClient; |
} |
void FrameLoader::checkCompleted() |
@@ -659,7 +660,7 @@ void FrameLoader::checkCompleted() |
return; |
} |
- if (shouldSendCompleteNotification(m_frame)) { |
+ if (shouldSendCompleteNotification(m_frame, m_isNavigationHandledByClient)) { |
m_progressTracker->progressCompleted(); |
// Retry restoring scroll offset since finishing loading disables content |
// size clamping. |
@@ -1049,6 +1050,8 @@ void FrameLoader::stopAllLoaders() |
m_inStopAllLoaders = true; |
+ m_isNavigationHandledByClient = false; |
+ |
for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree().nextSibling()) { |
if (child->isLocalFrame()) |
toLocalFrame(child)->loader().stopAllLoaders(); |
@@ -1376,6 +1379,8 @@ bool FrameLoader::shouldContinueForNavigationPolicy(const ResourceRequest& reque |
DocumentLoader* loader, ContentSecurityPolicyDisposition shouldCheckMainWorldContentSecurityPolicy, |
NavigationType type, NavigationPolicy policy, bool replacesCurrentHistoryItem, bool isClientRedirect) |
{ |
+ m_isNavigationHandledByClient = false; |
+ |
// Don't ask if we are loading an empty URL. |
if (request.url().isEmpty() || substituteData.isValid()) |
return true; |
@@ -1407,6 +1412,7 @@ bool FrameLoader::shouldContinueForNavigationPolicy(const ResourceRequest& reque |
if (policy == NavigationPolicyIgnore) |
return false; |
if (policy == NavigationPolicyHandledByClient) { |
+ m_isNavigationHandledByClient = true; |
// Mark the frame as loading since the embedder is handling the navigation. |
m_progressTracker->progressStarted(); |
return false; |