Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 Loading... | |
| 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 |
| OLD | NEW |