Commit 8faf9472 authored by horo's avatar horo Committed by Commit bot

[ServiceWorker] Treat the rejected result of onFetch event as a Network Error.

In current code the rejected result of onFetch event is treated as 500 respose.
But it should be treated as a Network Error.

Step1: [ServiceWorker] Remove the test for the rejected result of FetchEvent from fetch-event.html
  https://codereview.chromium.org/588993002/
Step2: this patch
  [ServiceWorker] Treat the rejected result of onFetch as a Network Error.
  https://codereview.chromium.org/590043002/
Step3: [ServiceWorker] Add test for the rejected result of FetchEvent using XHR.
  https://codereview.chromium.org/588093003/

BUG=411173

Review URL: https://codereview.chromium.org/590043002

Cr-Commit-Position: refs/heads/master@{#296080}
parent 91621ea4
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include "content/common/service_worker/service_worker_types.h" #include "content/common/service_worker/service_worker_types.h"
#include "content/public/browser/blob_handle.h" #include "content/public/browser/blob_handle.h"
#include "content/public/browser/resource_request_info.h" #include "content/public/browser/resource_request_info.h"
#include "net/base/net_errors.h"
#include "net/http/http_request_headers.h" #include "net/http/http_request_headers.h"
#include "net/http/http_response_headers.h" #include "net/http/http_response_headers.h"
#include "net/http/http_response_info.h" #include "net/http/http_response_info.h"
...@@ -380,9 +381,10 @@ void ServiceWorkerURLRequestJob::DidDispatchFetchEvent( ...@@ -380,9 +381,10 @@ void ServiceWorkerURLRequestJob::DidDispatchFetchEvent(
// We should have a response now. // We should have a response now.
DCHECK_EQ(SERVICE_WORKER_FETCH_EVENT_RESULT_RESPONSE, fetch_result); DCHECK_EQ(SERVICE_WORKER_FETCH_EVENT_RESULT_RESPONSE, fetch_result);
// Treat a response whose status is 0 as an error. // Treat a response whose status is 0 as a Network Error.
if (response.status_code == 0) { if (response.status_code == 0) {
DeliverErrorResponse(); NotifyDone(
net::URLRequestStatus(net::URLRequestStatus::FAILED, net::ERR_FAILED));
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment