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

Unified Diff: content/browser/service_worker/service_worker_dispatcher_host.cc

Issue 2071433003: Reland: service worker: Don't control a subframe of an insecure context (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: revised Created 4 years, 6 months 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: content/browser/service_worker/service_worker_dispatcher_host.cc
diff --git a/content/browser/service_worker/service_worker_dispatcher_host.cc b/content/browser/service_worker/service_worker_dispatcher_host.cc
index e352979e9bf543b9ebd5b689d47801fa14a1c8c3..034e0febdbc1749749c7e482a1a177c574161ce4 100644
--- a/content/browser/service_worker/service_worker_dispatcher_host.cc
+++ b/content/browser/service_worker/service_worker_dispatcher_host.cc
@@ -747,7 +747,8 @@ void ServiceWorkerDispatcherHost::DispatchExtendableMessageEvent(
void ServiceWorkerDispatcherHost::OnProviderCreated(
int provider_id,
int route_id,
- ServiceWorkerProviderType provider_type) {
+ ServiceWorkerProviderType provider_type,
+ bool is_parent_frame_secure) {
// TODO(pkasting): Remove ScopedTracker below once crbug.com/477117 is fixed.
tracked_objects::ScopedTracker tracking_profile(
FROM_HERE_WITH_EXPLICIT_FUNCTION(
@@ -769,8 +770,10 @@ void ServiceWorkerDispatcherHost::OnProviderCreated(
// Retrieve the provider host previously created for navigation requests.
ServiceWorkerNavigationHandleCore* navigation_handle_core =
GetContext()->GetNavigationHandleCore(provider_id);
- if (navigation_handle_core != nullptr)
+ if (navigation_handle_core != nullptr) {
provider_host = navigation_handle_core->RetrievePreCreatedHost();
+ provider_host->set_parent_frame_secure(is_parent_frame_secure);
+ }
// If no host is found, the navigation has been cancelled in the meantime.
// Just return as the navigation will be stopped in the renderer as well.
@@ -785,10 +788,14 @@ void ServiceWorkerDispatcherHost::OnProviderCreated(
this, bad_message::SWDH_PROVIDER_CREATED_NO_HOST);
return;
}
+ ServiceWorkerProviderHost::FrameSecurityLevel parent_frame_security_level =
+ is_parent_frame_secure
+ ? ServiceWorkerProviderHost::FrameSecurityLevel::SECURE
+ : ServiceWorkerProviderHost::FrameSecurityLevel::INSECURE;
provider_host = std::unique_ptr<ServiceWorkerProviderHost>(
- new ServiceWorkerProviderHost(render_process_id_, route_id, provider_id,
- provider_type, GetContext()->AsWeakPtr(),
- this));
+ new ServiceWorkerProviderHost(
+ render_process_id_, route_id, provider_id, provider_type,
+ parent_frame_security_level, GetContext()->AsWeakPtr(), this));
}
GetContext()->AddProviderHost(std::move(provider_host));
}

Powered by Google App Engine
This is Rietveld 408576698