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

Side by Side Diff: content/browser/service_worker/service_worker_url_request_job.cc

Issue 1173943002: Service Worker: Detach the controller when falling back to network on failure (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | content/browser/service_worker/service_worker_url_request_job_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_url_request_job.h" 5 #include "content/browser/service_worker/service_worker_url_request_job.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 scoped_refptr<ServiceWorkerVersion> version) { 483 scoped_refptr<ServiceWorkerVersion> version) {
484 fetch_dispatcher_.reset(); 484 fetch_dispatcher_.reset();
485 485
486 // Check if we're not orphaned. 486 // Check if we're not orphaned.
487 if (!request()) 487 if (!request())
488 return; 488 return;
489 489
490 if (status != SERVICE_WORKER_OK) { 490 if (status != SERVICE_WORKER_OK) {
491 // TODO(falken): Add UMA and the report error to the version. 491 // TODO(falken): Add UMA and the report error to the version.
492 if (is_main_resource_load_) { 492 if (is_main_resource_load_) {
493 // Using the service worker failed, so fallback to network. Detach the
494 // controller so subresource requests also skip the worker.
495 provider_host_->NotifyControllerLost();
493 response_type_ = FALLBACK_TO_NETWORK; 496 response_type_ = FALLBACK_TO_NETWORK;
494 NotifyRestartRequired(); 497 NotifyRestartRequired();
495 } else { 498 } else {
496 DeliverErrorResponse(); 499 DeliverErrorResponse();
497 } 500 }
498 return; 501 return;
499 } 502 }
500 503
501 if (fetch_result == SERVICE_WORKER_FETCH_EVENT_RESULT_FALLBACK) { 504 if (fetch_result == SERVICE_WORKER_FETCH_EVENT_RESULT_FALLBACK) {
502 // When the request_mode is |CORS| or |CORS-with-forced-preflight| we can't 505 // When the request_mode is |CORS| or |CORS-with-forced-preflight| we can't
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
646 } 649 }
647 if (!waiting_stream_url_.is_empty()) { 650 if (!waiting_stream_url_.is_empty()) {
648 StreamRegistry* stream_registry = 651 StreamRegistry* stream_registry =
649 GetStreamContextForResourceContext(resource_context_)->registry(); 652 GetStreamContextForResourceContext(resource_context_)->registry();
650 stream_registry->RemoveRegisterObserver(waiting_stream_url_); 653 stream_registry->RemoveRegisterObserver(waiting_stream_url_);
651 stream_registry->AbortPendingStream(waiting_stream_url_); 654 stream_registry->AbortPendingStream(waiting_stream_url_);
652 } 655 }
653 } 656 }
654 657
655 } // namespace content 658 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/service_worker/service_worker_url_request_job_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698