Commit beae6e4c authored by Matt Falkenhagen's avatar Matt Falkenhagen Committed by Commit Bot

shared worker: Fix some code around default factory.

Shared worker's factory bundle's default factory can now be AppCache
rather than network, since support for shared worker + AppCache was
added in issue 715632.

Use CloneWithoutDefaultFactory() to make the service worker fallback
factory accordingly, as is done for frames in
RenderFrameImpl::BuildServiceWorkerNetworkProviderForNavigation and
dedicated workers in RenderFrameImpl::CreateWorkerFetchContext.

No test added since we don't have a feature that can be set as the
default factory and be used in conjunction with service worker. The
point of the change is to fix the comments and make it consistent with
the other callsites.

Bug: 715632
Change-Id: Ie1ee1cae5423fd81933dea599e6d724a12bf51f7
Reviewed-on: https://chromium-review.googlesource.com/c/1260883Reviewed-by: default avatarHiroki Nakagawa <nhiroki@chromium.org>
Commit-Queue: Matt Falkenhagen <falken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#596890}
parent fbca7f82
...@@ -280,15 +280,6 @@ EmbeddedSharedWorkerStub::EmbeddedSharedWorkerStub( ...@@ -280,15 +280,6 @@ EmbeddedSharedWorkerStub::EmbeddedSharedWorkerStub(
base::nullopt /* subresource_overrides */); base::nullopt /* subresource_overrides */);
} }
// It is important to understand the default factory of
// |subresource_loader_factories_|. |subresource_loader_factories_| was made
// from CreateDefaultURLLoaderFactoryBundle, which does not set a default
// factory, and |subresource_loader_factories| passed from the browser, whose
// default factory is the direct network factory (as SharedWorkerHost sets it
// that way). Therefore, the default factory either does not exist or is the
// direct network factory. So we don't need to call CloneWithoutDefault() to
// bypass features like AppCache, unlike the bundle created for a frame.
impl_->StartWorkerContext( impl_->StartWorkerContext(
url_, blink::WebString::FromUTF8(name_), url_, blink::WebString::FromUTF8(name_),
blink::WebString::FromUTF8(info->content_security_policy), blink::WebString::FromUTF8(info->content_security_policy),
...@@ -414,18 +405,10 @@ EmbeddedSharedWorkerStub::CreateWorkerFetchContext( ...@@ -414,18 +405,10 @@ EmbeddedSharedWorkerStub::CreateWorkerFetchContext(
if (blink::ServiceWorkerUtils::IsServicificationEnabled()) if (blink::ServiceWorkerUtils::IsServicificationEnabled())
container_host_ptr_info = context->CloneContainerHostPtrInfo(); container_host_ptr_info = context->CloneContainerHostPtrInfo();
// We know |subresource_loader_factories_|'s default factory is not a feature // Make the factory used for service worker network fallback. Omit the default
// like AppCache, so it's OK to call Clone() and not CloneWithoutDefault() to // factory in case it is for a non-network factory like AppCache.
// get the fallback factory. We don't want to call CloneWithoutDefault()
// because the default is a NetworkService-backed factory with auto-reconnect
// when NetworkService is enabled (it will support auto-reconnect once
// https://crbug.com/848256 is addressed). See comments in the constructor.
//
// TODO(nhiroki): We might need to set the default factory of
// |subresource_loader_factories_| to AppCache if requests from this shared
// worker are supposed to go through AppCache.
std::unique_ptr<network::SharedURLLoaderFactoryInfo> fallback_factory = std::unique_ptr<network::SharedURLLoaderFactoryInfo> fallback_factory =
subresource_loader_factories_->Clone(); subresource_loader_factories_->CloneWithoutDefaultFactory();
auto worker_fetch_context = std::make_unique<WebWorkerFetchContextImpl>( auto worker_fetch_context = std::make_unique<WebWorkerFetchContextImpl>(
std::move(renderer_preferences_), std::move(preference_watcher_request_), std::move(renderer_preferences_), std::move(preference_watcher_request_),
......
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