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

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

Issue 625433002: Pages controlled by ServiceWorkers should not participate in AppCaching (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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_request_handler.cc
diff --git a/content/browser/service_worker/service_worker_request_handler.cc b/content/browser/service_worker/service_worker_request_handler.cc
index 6a54f6af64e41b847fe05d8ec705f3f275a46666..abdf0be82eeb6522d9733c66a65b5f2b1bbdd311 100644
--- a/content/browser/service_worker/service_worker_request_handler.cc
+++ b/content/browser/service_worker/service_worker_request_handler.cc
@@ -47,7 +47,7 @@ class ServiceWorkerRequestInterceptor
// This is work around to avoid hijacking CORS preflight.
// TODO(horo): Remove this check when we implement "HTTP fetch" correctly.
// http://fetch.spec.whatwg.org/#concept-http-fetch
-bool IsMethodSupportedForServiceWroker(const std::string& method) {
+bool IsMethodSupportedForServiceWorker(const std::string& method) {
return method != "OPTIONS";
}
@@ -67,7 +67,7 @@ void ServiceWorkerRequestHandler::InitializeHandler(
RequestContextFrameType frame_type,
scoped_refptr<ResourceRequestBody> body) {
if (!request->url().SchemeIsHTTPOrHTTPS() ||
- !IsMethodSupportedForServiceWroker(request->method())) {
+ !IsMethodSupportedForServiceWorker(request->method())) {
return;
}
@@ -115,6 +115,15 @@ ServiceWorkerRequestHandler::CreateInterceptor() {
new ServiceWorkerRequestInterceptor);
}
+bool ServiceWorkerRequestHandler::IsControlledByServiceWorker(
+ net::URLRequest* request) {
+ ServiceWorkerRequestHandler* handler = GetHandler(request);
+ if (!handler || !handler->provider_host_)
+ return false;
+ return handler->provider_host_->associated_registration() ||
+ handler->provider_host_->running_hosted_version();
+}
+
ServiceWorkerRequestHandler::~ServiceWorkerRequestHandler() {
}

Powered by Google App Engine
This is Rietveld 408576698