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

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

Issue 2269653002: PlzNavigate: Prevent tests to end too early. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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: 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;

Powered by Google App Engine
This is Rietveld 408576698