1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_dom_serviceworkeroppromise_h__
8 #define mozilla_dom_serviceworkeroppromise_h__
12 #include "mozilla/MozPromise.h"
14 #include "mozilla/dom/SafeRefPtr.h"
15 #include "mozilla/dom/ServiceWorkerOpArgs.h"
17 namespace mozilla::dom
{
19 class InternalResponse
;
21 using SynthesizeResponseArgs
=
22 std::tuple
<SafeRefPtr
<InternalResponse
>, FetchEventRespondWithClosure
,
23 FetchEventTimeStamps
>;
25 using FetchEventRespondWithResult
=
26 Variant
<SynthesizeResponseArgs
, ResetInterceptionArgs
,
27 CancelInterceptionArgs
>;
29 using FetchEventRespondWithPromise
=
30 MozPromise
<FetchEventRespondWithResult
, CancelInterceptionArgs
, true>;
32 // The reject type int is arbitrary, since this promise will never get rejected.
33 // Unfortunately void is not supported as a reject type.
34 using FetchEventPreloadResponseAvailablePromise
=
35 MozPromise
<SafeRefPtr
<InternalResponse
>, int, true>;
37 using FetchEventPreloadResponseTimingPromise
=
38 MozPromise
<ResponseTiming
, int, true>;
40 using FetchEventPreloadResponseEndPromise
=
41 MozPromise
<ResponseEndArgs
, int, true>;
43 using ServiceWorkerOpPromise
=
44 MozPromise
<ServiceWorkerOpResult
, nsresult
, true>;
46 using ServiceWorkerFetchEventOpPromise
=
47 MozPromise
<ServiceWorkerFetchEventOpResult
, nsresult
, true>;
49 } // namespace mozilla::dom
51 #endif // mozilla_dom_serviceworkeroppromise_h__