tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

ServiceWorkerOpPromise.h (1678B)


      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/. */
      6 
      7 #ifndef mozilla_dom_serviceworkeroppromise_h__
      8 #define mozilla_dom_serviceworkeroppromise_h__
      9 
     10 #include "mozilla/MozPromise.h"
     11 #include "mozilla/dom/SafeRefPtr.h"
     12 #include "mozilla/dom/ServiceWorkerOpArgs.h"
     13 
     14 namespace mozilla::dom {
     15 
     16 class InternalResponse;
     17 
     18 using SynthesizeResponseArgs =
     19    std::tuple<SafeRefPtr<InternalResponse>, FetchEventRespondWithClosure,
     20               FetchEventTimeStamps>;
     21 
     22 using FetchEventRespondWithResult =
     23    Variant<SynthesizeResponseArgs, ResetInterceptionArgs,
     24            CancelInterceptionArgs>;
     25 
     26 using FetchEventRespondWithPromise =
     27    MozPromise<FetchEventRespondWithResult, CancelInterceptionArgs, true>;
     28 
     29 // The reject type int is arbitrary, since this promise will never get rejected.
     30 // Unfortunately void is not supported as a reject type.
     31 using FetchEventPreloadResponseAvailablePromise =
     32    MozPromise<SafeRefPtr<InternalResponse>, int, true>;
     33 
     34 using FetchEventPreloadResponseTimingPromise =
     35    MozPromise<ResponseTiming, int, true>;
     36 
     37 using FetchEventPreloadResponseEndPromise =
     38    MozPromise<ResponseEndArgs, int, true>;
     39 
     40 using ServiceWorkerOpPromise =
     41    MozPromise<ServiceWorkerOpResult, nsresult, true>;
     42 
     43 using ServiceWorkerFetchEventOpPromise =
     44    MozPromise<ServiceWorkerFetchEventOpResult, nsresult, true>;
     45 
     46 }  // namespace mozilla::dom
     47 
     48 #endif  // mozilla_dom_serviceworkeroppromise_h__