Chromium Code Reviews| Index: content/browser/service_worker/link_header_support.cc |
| diff --git a/content/browser/service_worker/link_header_support.cc b/content/browser/service_worker/link_header_support.cc |
| index 0cb2f29d8a3ded4bf92279cd0a4a75ced503447d..0a92dc813a11699569a511ad1f6b2ac8169b1ee9 100644 |
| --- a/content/browser/service_worker/link_header_support.cc |
| +++ b/content/browser/service_worker/link_header_support.cc |
| @@ -65,11 +65,19 @@ void HandleServiceWorkerLink( |
| if (!service_worker_context) |
| return; |
| + ServiceWorkerProviderHost* provider_host = |
| + ServiceWorkerRequestHandler::GetProviderHost(request); |
| + |
| + // If fetched from a service worker, make sure fetching service worker is |
| + // controlling at least one client. |
|
falken
2016/11/21 04:13:42
nit: maybe it'd help the reader to add "To prevent
Marijn Kruisselbrink
2016/11/21 05:10:56
Done
|
| + if (provider_host && provider_host->IsHostToRunningServiceWorker()) { |
| + if (!provider_host->running_hosted_version()->HasControllee()) |
| + return; |
| + } |
| + |
| if (ServiceWorkerUtils::IsMainResourceType(request_info->GetResourceType())) { |
| // In case of navigations, make sure the navigation will actually result in |
| // a secure context. |
| - ServiceWorkerProviderHost* provider_host = |
| - ServiceWorkerRequestHandler::GetProviderHost(request); |
| if (!provider_host || !provider_host->IsContextSecureForServiceWorker()) |
| return; |
| } else { |