Commit 2b898321 authored by arthursonzogni's avatar arthursonzogni Committed by Commit bot

PlzNavigate: Prevent tests to end too early.

This patch prevents the FrameLoader to send 'complete' notification when
there is still a navigation handled by the client ongoing.

This bug caused several tests to end too early and fail.
In contrast, there were tests that passed previously, but actually fail.

R=japhet@chromium.org
BUG=576261

Review-Url: https://codereview.chromium.org/2269653002
Cr-Commit-Position: refs/heads/master@{#418746}
parent ee049696
...@@ -25,6 +25,12 @@ ...@@ -25,6 +25,12 @@
plugins/iframe-plugin-bgcolor.html [ Crash ] plugins/iframe-plugin-bgcolor.html [ Crash ]
plugins/plugin-document-back-forward.html [ Crash ] plugins/plugin-document-back-forward.html [ Crash ]
# Failing due to ctrl+click doesn't work on same site navigation.
editing/pasteboard/paste-when-over-link.html [ Failure ]
fast/events/isolated-worlds-override-keystate.html [ Failure ]
fast/events/main-world-does-not-override-keystate.html [ Failure ]
fast/events/simulated-click-on-anchor-with-target-blank.html [ Failure ]
# https://crbug.com/608375: PlzNavigate: Appcache support # https://crbug.com/608375: PlzNavigate: Appcache support
http/tests/appcache/fallback.html [ Timeout ] http/tests/appcache/fallback.html [ Timeout ]
http/tests/appcache/main-resource-hash.html [ Crash Timeout ] http/tests/appcache/main-resource-hash.html [ Crash Timeout ]
...@@ -92,7 +98,6 @@ ...@@ -92,7 +98,6 @@
http/tests/security/XFrameOptions/x-frame-options-parent-same-origin-allow.html [ Failure ] http/tests/security/XFrameOptions/x-frame-options-parent-same-origin-allow.html [ Failure ]
fast/loader/main-document-url-for-non-http-loads.html [ Failure ] fast/loader/main-document-url-for-non-http-loads.html [ Failure ]
http/tests/cache/iframe-304-crash.html [ Failure ] http/tests/cache/iframe-304-crash.html [ Failure ]
http/tests/security/frame-loading-via-document-write.html [ Failure ]
imported/wpt/shadow-dom/untriaged/html-elements-in-shadow-trees/html-forms/test-003.html [ Failure ] imported/wpt/shadow-dom/untriaged/html-elements-in-shadow-trees/html-forms/test-003.html [ Failure ]
mhtml/multi_frames_contentid.mht [ Timeout Failure ] mhtml/multi_frames_contentid.mht [ Timeout Failure ]
...@@ -178,7 +183,6 @@ ...@@ -178,7 +183,6 @@
fast/css/acid2.html [ Crash Timeout Failure ] fast/css/acid2.html [ Crash Timeout Failure ]
fast/css/preserve-user-specified-zoom-level-on-reload.html [ Failure ] fast/css/preserve-user-specified-zoom-level-on-reload.html [ Failure ]
fast/dom/frame-loading-via-document-write.html [ Failure ] fast/dom/frame-loading-via-document-write.html [ Failure ]
fast/events/drag-file-crash.html [ Failure ]
fast/layout/scroll-anchoring/history-restore-anchors.html [ Failure ] fast/layout/scroll-anchoring/history-restore-anchors.html [ Failure ]
fast/overflow/overflow-height-float-not-removed-crash.html [ Failure ] fast/overflow/overflow-height-float-not-removed-crash.html [ Failure ]
fast/overflow/overflow-height-float-not-removed-crash3.html [ Failure ] fast/overflow/overflow-height-float-not-removed-crash3.html [ Failure ]
...@@ -188,7 +192,6 @@ ...@@ -188,7 +192,6 @@
http/tests/misc/window-open-then-write.html [ Timeout ] http/tests/misc/window-open-then-write.html [ Timeout ]
imported/wpt/html/semantics/embedded-content/the-object-element/object-attributes.html [ Failure ] imported/wpt/html/semantics/embedded-content/the-object-element/object-attributes.html [ Failure ]
plugins/object-onfocus-mutation-crash.html [ Timeout ] plugins/object-onfocus-mutation-crash.html [ Timeout ]
svg/custom/anchor-on-use.svg [ Failure ]
virtual/pointerevent/fast/events/drag-file-crash.html [ Failure ] virtual/pointerevent/fast/events/drag-file-crash.html [ Failure ]
virtual/pointerevent/fast/events/iframe-object-onload.html [ Failure ] virtual/pointerevent/fast/events/iframe-object-onload.html [ Failure ]
virtual/spv2/fast/overflow/overflow-height-float-not-removed-crash.html [ Failure ] virtual/spv2/fast/overflow/overflow-height-float-not-removed-crash.html [ Failure ]
......
...@@ -181,6 +181,7 @@ FrameLoader::FrameLoader(LocalFrame* frame) ...@@ -181,6 +181,7 @@ FrameLoader::FrameLoader(LocalFrame* frame)
, m_forcedSandboxFlags(SandboxNone) , m_forcedSandboxFlags(SandboxNone)
, m_dispatchingDidClearWindowObjectInMainWorld(false) , m_dispatchingDidClearWindowObjectInMainWorld(false)
, m_protectProvisionalLoader(false) , m_protectProvisionalLoader(false)
, m_isNavigationHandledByClient(false)
{ {
TRACE_EVENT_OBJECT_CREATED_WITH_ID("loading", "FrameLoader", this); TRACE_EVENT_OBJECT_CREATED_WITH_ID("loading", "FrameLoader", this);
takeObjectSnapshot(); takeObjectSnapshot();
...@@ -616,14 +617,14 @@ static bool shouldSendFinishNotification(LocalFrame* frame) ...@@ -616,14 +617,14 @@ static bool shouldSendFinishNotification(LocalFrame* frame)
return true; 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. // FIXME: We might have already sent stop notifications and be re-completing.
if (!frame->isLoading()) if (!frame->isLoading())
return false; return false;
// Only send didStopLoading() if there are no navigations in progress at all, // Only send didStopLoading() if there are no navigations in progress at all,
// whether committed, provisional, or pending. // 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() void FrameLoader::checkCompleted()
...@@ -656,7 +657,7 @@ void FrameLoader::checkCompleted() ...@@ -656,7 +657,7 @@ void FrameLoader::checkCompleted()
return; return;
} }
if (shouldSendCompleteNotification(m_frame)) { if (shouldSendCompleteNotification(m_frame, m_isNavigationHandledByClient)) {
m_progressTracker->progressCompleted(); m_progressTracker->progressCompleted();
// Retry restoring scroll offset since finishing loading disables content // Retry restoring scroll offset since finishing loading disables content
// size clamping. // size clamping.
...@@ -1052,6 +1053,8 @@ void FrameLoader::stopAllLoaders() ...@@ -1052,6 +1053,8 @@ void FrameLoader::stopAllLoaders()
m_inStopAllLoaders = true; m_inStopAllLoaders = true;
m_isNavigationHandledByClient = false;
for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree().nextSibling()) { for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree().nextSibling()) {
if (child->isLocalFrame()) if (child->isLocalFrame())
toLocalFrame(child)->loader().stopAllLoaders(); toLocalFrame(child)->loader().stopAllLoaders();
...@@ -1377,6 +1380,8 @@ bool FrameLoader::shouldContinueForNavigationPolicy(const ResourceRequest& reque ...@@ -1377,6 +1380,8 @@ bool FrameLoader::shouldContinueForNavigationPolicy(const ResourceRequest& reque
DocumentLoader* loader, ContentSecurityPolicyDisposition shouldCheckMainWorldContentSecurityPolicy, DocumentLoader* loader, ContentSecurityPolicyDisposition shouldCheckMainWorldContentSecurityPolicy,
NavigationType type, NavigationPolicy policy, bool replacesCurrentHistoryItem, bool isClientRedirect) NavigationType type, NavigationPolicy policy, bool replacesCurrentHistoryItem, bool isClientRedirect)
{ {
m_isNavigationHandledByClient = false;
// Don't ask if we are loading an empty URL. // Don't ask if we are loading an empty URL.
if (request.url().isEmpty() || substituteData.isValid()) if (request.url().isEmpty() || substituteData.isValid())
return true; return true;
...@@ -1408,6 +1413,7 @@ bool FrameLoader::shouldContinueForNavigationPolicy(const ResourceRequest& reque ...@@ -1408,6 +1413,7 @@ bool FrameLoader::shouldContinueForNavigationPolicy(const ResourceRequest& reque
if (policy == NavigationPolicyIgnore) if (policy == NavigationPolicyIgnore)
return false; return false;
if (policy == NavigationPolicyHandledByClient) { if (policy == NavigationPolicyHandledByClient) {
m_isNavigationHandledByClient = true;
// Mark the frame as loading since the embedder is handling the navigation. // Mark the frame as loading since the embedder is handling the navigation.
m_progressTracker->progressStarted(); m_progressTracker->progressStarted();
return false; return false;
......
...@@ -284,6 +284,7 @@ private: ...@@ -284,6 +284,7 @@ private:
bool m_dispatchingDidClearWindowObjectInMainWorld; bool m_dispatchingDidClearWindowObjectInMainWorld;
bool m_protectProvisionalLoader; bool m_protectProvisionalLoader;
bool m_isNavigationHandledByClient;
}; };
} // namespace blink } // namespace blink
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment