blob: fa906d70698ba43aa2e38697ece25b5cfdf7df5e [file] [log] [blame]
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
] interface BackgroundFetchRegistration : EventTarget {
readonly attribute DOMString id;
readonly attribute unsigned long long uploadTotal;
readonly attribute unsigned long long uploaded;
readonly attribute unsigned long long downloadTotal;
readonly attribute unsigned long long downloaded;
readonly attribute BackgroundFetchResult result;
readonly attribute BackgroundFetchFailureReason failureReason;
readonly attribute boolean recordsAvailable;
attribute EventHandler onprogress;
[CallWith=ScriptState, MeasureAs=BackgroundFetchRegistrationAbort] Promise<boolean> abort();
[CallWith=ScriptState, RaisesException, MeasureAs=BackgroundFetchRegistrationMatch] Promise<BackgroundFetchRecord> match(RequestInfo request, optional CacheQueryOptions options);
[CallWith=ScriptState, RaisesException, MeasureAs=BackgroundFetchRegistrationMatchAll] Promise<sequence<BackgroundFetchRecord>> matchAll(optional RequestInfo request, optional CacheQueryOptions options);
enum BackgroundFetchResult { "", "success", "failure" };
enum BackgroundFetchFailureReason {
// The background fetch has not completed yet, or was successful.
// The operation was aborted by the user, or abort() was called.
// A response had a not-ok-status.
// A fetch failed for other reasons, e.g. CORS, MIX, an invalid partial response,
// or a general network failure for a fetch that cannot be retried.
// Storage quota was reached during the operation.
// The provided downloadTotal was exceeded.