Chromium Code Reviews| 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 4fbd76e78ea4ea37b4121547dcaed7dc927efe1b..ed26f8ead2b0a3cfa2ff8892cae7c399d376c42d 100644 |
| --- a/content/browser/service_worker/service_worker_request_handler.cc |
| +++ b/content/browser/service_worker/service_worker_request_handler.cc |
| @@ -38,6 +38,15 @@ class ServiceWorkerRequestInterceptor |
| DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRequestInterceptor); |
| }; |
| +bool IsMethodSupported(const std::string& method) { |
| + return (method == "GET") || (method == "HEAD"); |
| +} |
| + |
| +bool IsSchemeAndMethodSupported(const net::URLRequest* request) { |
|
kinuko
2014/05/15 16:55:00
nit: can we restore the TODO comment that we may e
michaeln
2014/05/15 23:54:30
I removed it after realizing that todo is in the w
|
| + return request->url().SchemeIsHTTPOrHTTPS() && |
| + IsMethodSupported(request->method()); |
| +} |
| + |
| } // namespace |
| void ServiceWorkerRequestHandler::InitializeHandler( |
| @@ -46,8 +55,10 @@ void ServiceWorkerRequestHandler::InitializeHandler( |
| int process_id, |
| int provider_id, |
| ResourceType::Type resource_type) { |
| - if (!ServiceWorkerUtils::IsFeatureEnabled()) |
| + if (!ServiceWorkerUtils::IsFeatureEnabled() || |
| + !IsSchemeAndMethodSupported(request)) { |
| return; |
| + } |
| if (!context_wrapper || !context_wrapper->context() || |
| provider_id == kInvalidServiceWorkerProviderId) { |