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

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

Issue 2009453002: service worker: Don't control a subframe of an insecure context (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: refactor errorMessage 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 12a1dfc1631b86b179d60343a2ce3ac777c94f78..de52af6b8ceccaaded76ea5ce0a97abf706b8901 100644
--- a/content/browser/service_worker/service_worker_dispatcher_host.cc
+++ b/content/browser/service_worker/service_worker_dispatcher_host.cc
@@ -746,7 +746,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(
@@ -768,8 +769,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.
@@ -784,10 +787,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