Commit a7175634 authored by Kenichi Ishibashi's avatar Kenichi Ishibashi Committed by Commit Bot

S13nServiceWorker: Populate NavigationData when NetworkService is disabled

When S13nServiceWorker is enabled but NetworkService is disabled,
NavigationURLLoaderImpl actually uses URLRequest when a navigation
is not intercepted. In that case we have a NavigationData and we can
populate it to NavigationHandle. Since some features like Previews
use NavigationData to store their data, it would be better to
populate it if possible.

This fixes following browser_tests:
- PreviewsNoScriptBrowserTest.NoScriptPreviewsEnabled
- PreviewsNoScriptBrowserTest.NoScriptPreviewsEnabledHttpRedirectToHttps

Bug: 866367
Change-Id: Idc85d272772be81dddde9e9e0bdf76f4fadfef8a
Reviewed-on: https://chromium-review.googlesource.com/1148094Reviewed-by: default avatarYutaka Hirano <yhirano@chromium.org>
Reviewed-by: default avatarMatt Falkenhagen <falken@chromium.org>
Reviewed-by: default avatarMakoto Shimazu <shimazu@chromium.org>
Commit-Queue: Kenichi Ishibashi <bashi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#578963}
parent 8200df57
......@@ -927,6 +927,7 @@ class NavigationURLLoaderImpl::URLLoaderRequestController
// Previews off.
PreviewsState previews_state = PREVIEWS_OFF;
std::unique_ptr<NavigationData> cloned_navigation_data;
if (IsLoaderInterceptionEnabled()) {
bool must_download = download_utils::MustDownload(
url_, head.headers.get(), head.mime_type);
......@@ -944,7 +945,21 @@ class NavigationURLLoaderImpl::URLLoaderRequestController
is_download =
!response_intercepted && (must_download || !known_mime_type);
is_stream = false;
} else {
// If NetworkService is on, or an interceptor handled the request, the
// request doesn't use ResourceDispatcherHost so
// CallOnReceivedResponse and return here.
if (base::FeatureList::IsEnabled(network::features::kNetworkService) ||
!default_loader_used_) {
CallOnReceivedResponse(head, std::move(url_loader_client_endpoints),
std::move(cloned_navigation_data), is_download,
is_stream, previews_state);
return;
}
}
// NetworkService is off and an interceptor didn't handle the request,
// so it went to ResourceDispatcherHost.
ResourceDispatcherHostImpl* rdh = ResourceDispatcherHostImpl::Get();
net::URLRequest* url_request = rdh->GetURLRequest(global_request_id_);
......@@ -975,6 +990,7 @@ class NavigationURLLoaderImpl::URLLoaderRequestController
ServiceWorkerProviderHost* sw_provider_host =
ServiceWorkerRequestHandler::GetProviderHost(url_request);
if (sw_provider_host && sw_provider_host->controller()) {
DCHECK(!blink::ServiceWorkerUtils::IsServicificationEnabled());
subresource_loader_params_ = SubresourceLoaderParams();
subresource_loader_params_->controller_service_worker_info =
mojom::ControllerServiceWorkerInfo::New();
......@@ -993,7 +1009,6 @@ class NavigationURLLoaderImpl::URLLoaderRequestController
} else {
is_download = is_stream = false;
}
}
CallOnReceivedResponse(head, std::move(url_loader_client_endpoints),
std::move(cloned_navigation_data), is_download,
......
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