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

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

Issue 574643003: [ServiceWorker] Treat a response whose status is 0 as an error. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 | no next file » | 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 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 // Change the response type and restart the request to fallback to 358 // Change the response type and restart the request to fallback to
359 // the network. 359 // the network.
360 response_type_ = FALLBACK_TO_NETWORK; 360 response_type_ = FALLBACK_TO_NETWORK;
361 NotifyRestartRequired(); 361 NotifyRestartRequired();
362 return; 362 return;
363 } 363 }
364 364
365 // We should have a response now. 365 // We should have a response now.
366 DCHECK_EQ(SERVICE_WORKER_FETCH_EVENT_RESULT_RESPONSE, fetch_result); 366 DCHECK_EQ(SERVICE_WORKER_FETCH_EVENT_RESULT_RESPONSE, fetch_result);
367 367
368 // Treat a response whose status is always 0 as an error.
yhirano 2014/09/17 01:35:29 Do you need "always" in the comment? I'm not sure
horo 2014/09/17 01:41:09 Done.
369 if (response.status_code == 0) {
370 DeliverErrorResponse();
371 return;
372 }
373
368 // Set up a request for reading the blob. 374 // Set up a request for reading the blob.
369 if (!response.blob_uuid.empty() && blob_storage_context_) { 375 if (!response.blob_uuid.empty() && blob_storage_context_) {
370 scoped_ptr<storage::BlobDataHandle> blob_data_handle = 376 scoped_ptr<storage::BlobDataHandle> blob_data_handle =
371 blob_storage_context_->GetBlobDataFromUUID(response.blob_uuid); 377 blob_storage_context_->GetBlobDataFromUUID(response.blob_uuid);
372 if (!blob_data_handle) { 378 if (!blob_data_handle) {
373 // The renderer gave us a bad blob UUID. 379 // The renderer gave us a bad blob UUID.
374 DeliverErrorResponse(); 380 DeliverErrorResponse();
375 return; 381 return;
376 } 382 }
377 blob_request_ = storage::BlobProtocolHandler::CreateBlobRequest( 383 blob_request_ = storage::BlobProtocolHandler::CreateBlobRequest(
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 void ServiceWorkerURLRequestJob::DeliverErrorResponse() { 423 void ServiceWorkerURLRequestJob::DeliverErrorResponse() {
418 // TODO(falken): Print an error to the console of the ServiceWorker and of 424 // TODO(falken): Print an error to the console of the ServiceWorker and of
419 // the requesting page. 425 // the requesting page.
420 CreateResponseHeader(500, 426 CreateResponseHeader(500,
421 "Service Worker Response Error", 427 "Service Worker Response Error",
422 std::map<std::string, std::string>()); 428 std::map<std::string, std::string>());
423 CommitResponseHeader(); 429 CommitResponseHeader();
424 } 430 }
425 431
426 } // namespace content 432 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698