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

Side by Side Diff: content/browser/service_worker/service_worker_controllee_request_handler.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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/service_worker/service_worker_controllee_request_handl er.h" 5 #include "content/browser/service_worker/service_worker_controllee_request_handl er.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <set>
8 #include <string> 9 #include <string>
9 10
10 #include "base/trace_event/trace_event.h" 11 #include "base/trace_event/trace_event.h"
11 #include "content/browser/service_worker/service_worker_context_core.h" 12 #include "content/browser/service_worker/service_worker_context_core.h"
12 #include "content/browser/service_worker/service_worker_metrics.h" 13 #include "content/browser/service_worker/service_worker_metrics.h"
13 #include "content/browser/service_worker/service_worker_provider_host.h" 14 #include "content/browser/service_worker/service_worker_provider_host.h"
14 #include "content/browser/service_worker/service_worker_registration.h" 15 #include "content/browser/service_worker/service_worker_registration.h"
15 #include "content/browser/service_worker/service_worker_response_info.h" 16 #include "content/browser/service_worker/service_worker_response_info.h"
16 #include "content/browser/service_worker/service_worker_url_request_job.h" 17 #include "content/browser/service_worker/service_worker_url_request_job.h"
17 #include "content/common/resource_request_body.h" 18 #include "content/common/resource_request_body.h"
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 job_->FallbackToNetwork(); 207 job_->FallbackToNetwork();
207 TRACE_EVENT_ASYNC_END2( 208 TRACE_EVENT_ASYNC_END2(
208 "ServiceWorker", 209 "ServiceWorker",
209 "ServiceWorkerControlleeRequestHandler::PrepareForMainResource", 210 "ServiceWorkerControlleeRequestHandler::PrepareForMainResource",
210 job_.get(), 211 job_.get(),
211 "Status", status, 212 "Status", status,
212 "Info", "ServiceWorker is blocked"); 213 "Info", "ServiceWorker is blocked");
213 return; 214 return;
214 } 215 }
215 216
217 if (!provider_host_->IsContextSecureForServiceWorker()) {
218 // TODO(falken): Figure out a way to surface in the page's DevTools
219 // console that the service worker was blocked for security.
220 job_->FallbackToNetwork();
221 TRACE_EVENT_ASYNC_END1(
222 "ServiceWorker",
223 "ServiceWorkerControlleeRequestHandler::PrepareForMainResource",
224 job_.get(), "Info", "Insecure context");
225 return;
226 }
227
216 if (need_to_update) { 228 if (need_to_update) {
217 force_update_started_ = true; 229 force_update_started_ = true;
218 context_->UpdateServiceWorker( 230 context_->UpdateServiceWorker(
219 registration.get(), true /* force_bypass_cache */, 231 registration.get(), true /* force_bypass_cache */,
220 true /* skip_script_comparison */, provider_host_.get(), 232 true /* skip_script_comparison */, provider_host_.get(),
221 base::Bind(&self::DidUpdateRegistration, weak_factory_.GetWeakPtr(), 233 base::Bind(&self::DidUpdateRegistration, weak_factory_.GetWeakPtr(),
222 registration)); 234 registration));
223 return; 235 return;
224 } 236 }
225 237
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 DCHECK(provider_host_); 423 DCHECK(provider_host_);
412 // Detach the controller so subresource requests also skip the worker. 424 // Detach the controller so subresource requests also skip the worker.
413 provider_host_->NotifyControllerLost(); 425 provider_host_->NotifyControllerLost();
414 } 426 }
415 427
416 void ServiceWorkerControlleeRequestHandler::ClearJob() { 428 void ServiceWorkerControlleeRequestHandler::ClearJob() {
417 job_.reset(); 429 job_.reset();
418 } 430 }
419 431
420 } // namespace content 432 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698