Commit d9500de5 authored by Mugdha Lakhani's avatar Mugdha Lakhani Committed by Commit Bot

[Background Fetch] Reject match() and matchAll()

when:
1. recordsAvailable is false
2. the background fetch is incomplete.

Bug: 882478
Change-Id: Id849a73370f8f07597039c3ccee5efce828fa452
Reviewed-on: https://chromium-review.googlesource.com/1226913Reviewed-by: default avatarPeter Beverloo <peter@chromium.org>
Reviewed-by: default avatarRayan Kanso <rayankans@chromium.org>
Commit-Queue: Mugdha Lakhani <nator@chromium.org>
Cr-Commit-Position: refs/heads/master@{#592032}
parent fa3a008e
......@@ -178,6 +178,24 @@ ScriptPromise BackgroundFetchRegistration::MatchImpl(
ScriptPromiseResolver* resolver = ScriptPromiseResolver::Create(script_state);
ScriptPromise promise = resolver->Promise();
// TODO(crbug.com/875201): Update this check once we support access to active
// fetches.
if (result_ == mojom::BackgroundFetchResult::UNSET) {
resolver->Reject(DOMException::Create(
DOMExceptionCode::kInvalidStateError,
"Access to records for in-progress background fetches is not yet "
"implemented. Please see crbug.com/875201 for more details."));
return promise;
}
if (!records_available_) {
resolver->Reject(DOMException::Create(
DOMExceptionCode::kInvalidStateError,
"The records associated with this background fetch are no longer "
"available."));
return promise;
}
// Convert |request| to WebServiceWorkerRequest.
base::Optional<WebServiceWorkerRequest> request_to_match;
if (request.has_value()) {
......
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