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

Unified Diff: content/child/service_worker/service_worker_network_provider.cc

Issue 2055433002: Revert of service worker: Don't control a subframe of an insecure context (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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/child/service_worker/service_worker_network_provider.cc
diff --git a/content/child/service_worker/service_worker_network_provider.cc b/content/child/service_worker/service_worker_network_provider.cc
index ab7597cda148c2f0b60b8336ffcbd97e86981cb3..0632e81e09b3cbaa83e0fbb0e0e0267c160bd782 100644
--- a/content/child/service_worker/service_worker_network_provider.cc
+++ b/content/child/service_worker/service_worker_network_provider.cc
@@ -11,8 +11,6 @@
#include "content/common/service_worker/service_worker_messages.h"
#include "content/common/service_worker/service_worker_utils.h"
#include "content/public/common/browser_side_navigation_policy.h"
-#include "third_party/WebKit/public/web/WebLocalFrame.h"
-#include "third_party/WebKit/public/web/WebSandboxFlags.h"
namespace content {
@@ -45,7 +43,7 @@
ServiceWorkerNetworkProvider::CreateForNavigation(
int route_id,
const RequestNavigationParams& request_params,
- blink::WebLocalFrame* frame,
+ blink::WebSandboxFlags sandbox_flags,
bool content_initiated) {
bool browser_side_navigation = IsBrowserSideNavigationEnabled();
bool should_create_provider_for_window = false;
@@ -67,33 +65,24 @@
service_worker_provider_id == kInvalidServiceWorkerProviderId);
} else {
should_create_provider_for_window =
- ((frame->effectiveSandboxFlags() & blink::WebSandboxFlags::Origin) !=
- blink::WebSandboxFlags::Origin);
+ (sandbox_flags & blink::WebSandboxFlags::Origin) !=
+ blink::WebSandboxFlags::Origin;
}
// Now create the ServiceWorkerNetworkProvider (with invalid id if needed).
if (should_create_provider_for_window) {
- // Ideally Document::isSecureContext would be called here, but the document
- // is not created yet, and due to redirects the URL may change. So pass
- // is_parent_frame_secure to the browser process, so it can determine the
- // context security when deciding whether to allow a service worker to
- // control the document.
- bool is_parent_frame_secure =
- !frame->parent() || frame->parent()->canHaveSecureChild();
-
if (service_worker_provider_id == kInvalidServiceWorkerProviderId) {
network_provider = std::unique_ptr<ServiceWorkerNetworkProvider>(
new ServiceWorkerNetworkProvider(route_id,
- SERVICE_WORKER_PROVIDER_FOR_WINDOW,
- is_parent_frame_secure));
+ SERVICE_WORKER_PROVIDER_FOR_WINDOW));
} else {
CHECK(browser_side_navigation);
DCHECK(ServiceWorkerUtils::IsBrowserAssignedProviderId(
service_worker_provider_id));
network_provider = std::unique_ptr<ServiceWorkerNetworkProvider>(
- new ServiceWorkerNetworkProvider(
- route_id, SERVICE_WORKER_PROVIDER_FOR_WINDOW,
- service_worker_provider_id, is_parent_frame_secure));
+ new ServiceWorkerNetworkProvider(route_id,
+ SERVICE_WORKER_PROVIDER_FOR_WINDOW,
+ service_worker_provider_id));
}
} else {
network_provider = std::unique_ptr<ServiceWorkerNetworkProvider>(
@@ -105,8 +94,7 @@
ServiceWorkerNetworkProvider::ServiceWorkerNetworkProvider(
int route_id,
ServiceWorkerProviderType provider_type,
- int browser_provider_id,
- bool is_parent_frame_secure)
+ int browser_provider_id)
: provider_id_(browser_provider_id) {
if (provider_id_ == kInvalidServiceWorkerProviderId)
return;
@@ -116,17 +104,15 @@
provider_id_, provider_type,
ChildThreadImpl::current()->thread_safe_sender());
ChildThreadImpl::current()->Send(new ServiceWorkerHostMsg_ProviderCreated(
- provider_id_, route_id, provider_type, is_parent_frame_secure));
+ provider_id_, route_id, provider_type));
}
ServiceWorkerNetworkProvider::ServiceWorkerNetworkProvider(
int route_id,
- ServiceWorkerProviderType provider_type,
- bool is_parent_frame_secure)
+ ServiceWorkerProviderType provider_type)
: ServiceWorkerNetworkProvider(route_id,
provider_type,
- GetNextProviderId(),
- is_parent_frame_secure) {}
+ GetNextProviderId()) {}
ServiceWorkerNetworkProvider::ServiceWorkerNetworkProvider()
: provider_id_(kInvalidServiceWorkerProviderId) {}

Powered by Google App Engine
This is Rietveld 408576698