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

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

Issue 1446253002: PlzNavigate: inform the WebFrameClient that a form will be submitted (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 28d99d964d16b432e27c8878e60e5c31b3d20acc..5a52a10660f67db1275a8cc5da1c79a2b18ed3c5 100644
--- a/third_party/WebKit/Source/core/loader/FrameLoader.cpp
+++ b/third_party/WebKit/Source/core/loader/FrameLoader.cpp
@@ -270,7 +270,7 @@ void FrameLoader::didExplicitOpen()
if (Frame* parent = m_frame->tree().parent()) {
if ((parent->isLocalFrame() && toLocalFrame(parent)->document()->loadEventStillNeeded())
|| (parent->isRemoteFrame() && parent->isLoading())) {
- m_progressTracker->progressStarted();
+ m_progressTracker->progressStarted(true);
}
}
@@ -1305,7 +1305,7 @@ bool FrameLoader::shouldClose(bool isReload)
bool FrameLoader::shouldContinueForNavigationPolicy(const ResourceRequest& request, const SubstituteData& substituteData,
DocumentLoader* loader, ContentSecurityPolicyDisposition shouldCheckMainWorldContentSecurityPolicy,
- NavigationType type, NavigationPolicy policy, bool replacesCurrentHistoryItem)
+ NavigationType type, NavigationPolicy policy, bool replacesCurrentHistoryItem, HTMLFormElement* form)
{
// Don't ask if we are loading an empty URL.
if (request.url().isEmpty() || substituteData.isValid())
@@ -1333,8 +1333,17 @@ bool FrameLoader::shouldContinueForNavigationPolicy(const ResourceRequest& reque
if (policy == NavigationPolicyIgnore)
return false;
if (policy == NavigationPolicyHandledByClient) {
- // Mark the frame as loading since the embedder is handling the navigation.
- m_progressTracker->progressStarted();
+ // Mark the frame as loading since the embedder is handling the
+ // navigation. However there is no need to inform the embedder that the
+ // frame is loading, since we already requested it to load the main
+ // resource.
+ m_progressTracker->progressStarted(false);
Nate Chapin 2015/12/08 23:18:38 I don't particularly like the special case boolean
clamy 2015/12/11 14:50:06 I think this is due to how the loading state is im
+
+ // If this is a form submit, dispatch that a form is being submitted
+ // since the embedder is handling the navigation.
+ if (form)
+ client()->dispatchWillSubmitForm(form);
+
return false;
}
if (!LocalDOMWindow::allowPopUp(*m_frame) && !UserGestureIndicator::processingUserGesture())
@@ -1355,8 +1364,11 @@ void FrameLoader::startLoad(FrameLoadRequest& frameLoadRequest, FrameLoadType ty
frameLoadRequest.resourceRequest().setRequestContext(determineRequestContextFromNavigationType(navigationType));
frameLoadRequest.resourceRequest().setFrameType(m_frame->isMainFrame() ? WebURLRequest::FrameTypeTopLevel : WebURLRequest::FrameTypeNested);
ResourceRequest& request = frameLoadRequest.resourceRequest();
- if (!shouldContinueForNavigationPolicy(request, frameLoadRequest.substituteData(), nullptr, frameLoadRequest.shouldCheckMainWorldContentSecurityPolicy(), navigationType, navigationPolicy, type == FrameLoadTypeReplaceCurrentItem))
+ if (!shouldContinueForNavigationPolicy(request, frameLoadRequest.substituteData(), nullptr,
+ frameLoadRequest.shouldCheckMainWorldContentSecurityPolicy(), navigationType,
+ navigationPolicy, type == FrameLoadTypeReplaceCurrentItem, frameLoadRequest.form())) {
return;
+ }
if (!shouldClose(navigationType == NavigationTypeReload))
return;
@@ -1387,7 +1399,7 @@ void FrameLoader::startLoad(FrameLoadRequest& frameLoadRequest, FrameLoadType ty
if (frameLoadRequest.form())
client()->dispatchWillSubmitForm(frameLoadRequest.form());
- m_progressTracker->progressStarted();
+ m_progressTracker->progressStarted(true);
if (m_provisionalDocumentLoader->isClientRedirect())
m_provisionalDocumentLoader->appendRedirect(m_frame->document()->url());
m_provisionalDocumentLoader->appendRedirect(m_provisionalDocumentLoader->request().url());

Powered by Google App Engine
This is Rietveld 408576698