Commit 6069a723 authored by Dmitry Gozman's avatar Dmitry Gozman Committed by Commit Bot

FrameLoader: call CommitNavigation directly from StartNavigation...

in the case of kNavigationPolicyCurrentTab policy. That happens
in a number of cases: loading mhtml archive, about:srcdoc, about:blank,
empty url, renderer debug urls, urls with chrome-native:
or about: scheme.

It would be ideal to get rid of this behavior, but that requires
some investigation. For now, we'll just make it explicit by calling
CommitNavigation from RenderFrameImpl. As a first step, switching
to CommitNavigation in FrameLoader.

Bug: 855189
Change-Id: Id1c5b00c8294b1890a60703f966e5134c5720380
Reviewed-on: https://chromium-review.googlesource.com/1232202
Commit-Queue: Dmitry Gozman <dgozman@chromium.org>
Reviewed-by: default avatarCamille Lamy <clamy@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#593294}
parent d351dc78
...@@ -937,12 +937,22 @@ void FrameLoader::StartNavigation(const FrameLoadRequest& passed_request, ...@@ -937,12 +937,22 @@ void FrameLoader::StartNavigation(const FrameLoadRequest& passed_request,
if (request.Form()) if (request.Form())
Client()->DispatchWillSubmitForm(request.Form()); Client()->DispatchWillSubmitForm(request.Form());
DCHECK(policy == kNavigationPolicyCurrentTab || if (policy == kNavigationPolicyCurrentTab) {
policy == kNavigationPolicyHandledByClient); FrameLoadRequest new_request(
nullptr, resource_request, AtomicString(),
request.ShouldCheckMainWorldContentSecurityPolicy(),
request.GetDevToolsNavigationToken());
new_request.SetReplacesCurrentItem(request.ReplacesCurrentItem());
new_request.SetClientRedirect(request.ClientRedirect());
CommitNavigation(new_request, frame_load_type, nullptr, nullptr, nullptr);
return;
}
bool cancel_scheduled_navigations = policy != kNavigationPolicyCurrentTab; DCHECK(policy == kNavigationPolicyHandledByClient);
if (!CancelProvisionalLoaderForNewNavigation(cancel_scheduled_navigations)) if (!CancelProvisionalLoaderForNewNavigation(
true /* cancel_scheduled_navigations */)) {
return; return;
}
provisional_document_loader_ = CreateDocumentLoader( provisional_document_loader_ = CreateDocumentLoader(
resource_request, request, frame_load_type, navigation_type, resource_request, request, frame_load_type, navigation_type,
...@@ -959,20 +969,7 @@ void FrameLoader::StartNavigation(const FrameLoadRequest& passed_request, ...@@ -959,20 +969,7 @@ void FrameLoader::StartNavigation(const FrameLoadRequest& passed_request,
resource_request); resource_request);
DCHECK(provisional_document_loader_); DCHECK(provisional_document_loader_);
// TODO(dgozman): there is still a possibility of probe::frameScheduledClientNavigation(frame_);
// |kNavigationPolicyCurrentTab| when starting a navigation. Perhaps, we can
// just call CommitNavigation in this case instead, maybe from client side?
if (policy == kNavigationPolicyCurrentTab) {
provisional_document_loader_->StartLoading();
// This should happen after the request is sent, so that the state
// the inspector stored in the matching frameScheduledClientNavigation()
// is available while sending the request.
probe::frameClearedScheduledClientNavigation(frame_);
} else {
DCHECK(policy == kNavigationPolicyHandledByClient);
probe::frameScheduledClientNavigation(frame_);
}
TakeObjectSnapshot(); TakeObjectSnapshot();
} }
......
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