Commit 0ef56662 authored by Peter Beverloo's avatar Peter Beverloo Committed by Commit Bot

Reject BackgroundFetchManager.fetch() with TypeErrors

Change-Id: If91c0fe7a5aec868cca22a132c32e1b2344e5440
Reviewed-on: https://chromium-review.googlesource.com/1152921Reviewed-by: default avatarMugdha Lakhani <nator@chromium.org>
Commit-Queue: Peter Beverloo <peter@chromium.org>
Cr-Commit-Position: refs/heads/master@{#578622}
parent e7b3bd5b
...@@ -294,19 +294,19 @@ void BackgroundFetchManager::DidFetch( ...@@ -294,19 +294,19 @@ void BackgroundFetchManager::DidFetch(
return; return;
case mojom::blink::BackgroundFetchError::DUPLICATED_DEVELOPER_ID: case mojom::blink::BackgroundFetchError::DUPLICATED_DEVELOPER_ID:
DCHECK(!registration); DCHECK(!registration);
resolver->Reject(DOMException::Create( resolver->Reject(V8ThrowException::CreateTypeError(
DOMExceptionCode::kInvalidStateError, resolver->GetScriptState()->GetIsolate(),
"There already is a registration for the given id.")); "There already is a registration for the given id."));
return; return;
case mojom::blink::BackgroundFetchError::STORAGE_ERROR: case mojom::blink::BackgroundFetchError::STORAGE_ERROR:
DCHECK(!registration); DCHECK(!registration);
resolver->Reject(DOMException::Create( resolver->Reject(V8ThrowException::CreateTypeError(
DOMExceptionCode::kAbortError, resolver->GetScriptState()->GetIsolate(),
"Failed to store registration due to I/O error.")); "Failed to store registration due to I/O error."));
return; return;
case mojom::blink::BackgroundFetchError::SERVICE_WORKER_UNAVAILABLE: case mojom::blink::BackgroundFetchError::SERVICE_WORKER_UNAVAILABLE:
resolver->Reject(DOMException::Create( resolver->Reject(V8ThrowException::CreateTypeError(
DOMExceptionCode::kInvalidStateError, resolver->GetScriptState()->GetIsolate(),
"There is no service worker available to service the fetch.")); "There is no service worker available to service the fetch."));
return; return;
case mojom::blink::BackgroundFetchError::INVALID_ARGUMENT: case mojom::blink::BackgroundFetchError::INVALID_ARGUMENT:
......
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