tor-browser

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

FetchEventOpChild.h (3406B)


      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_fetcheventopchild_h__
      8 #define mozilla_dom_fetcheventopchild_h__
      9 
     10 #include "mozilla/MozPromise.h"
     11 #include "mozilla/RefPtr.h"
     12 #include "mozilla/dom/FetchService.h"
     13 #include "mozilla/dom/PFetchEventOpChild.h"
     14 #include "mozilla/dom/ServiceWorkerOpArgs.h"
     15 #include "nsCOMPtr.h"
     16 
     17 class nsIInterceptedChannel;
     18 
     19 namespace mozilla::dom {
     20 
     21 class KeepAliveToken;
     22 class PRemoteWorkerControllerChild;
     23 class ServiceWorkerRegistrationInfo;
     24 
     25 /**
     26 * FetchEventOpChild represents an in-flight FetchEvent operation.
     27 */
     28 class FetchEventOpChild final : public PFetchEventOpChild {
     29  friend class PFetchEventOpChild;
     30 
     31 public:
     32  static RefPtr<GenericPromise> SendFetchEvent(
     33      PRemoteWorkerControllerChild* aManager,
     34      ParentToParentServiceWorkerFetchEventOpArgs&& aArgs,
     35      nsCOMPtr<nsIInterceptedChannel> aInterceptedChannel,
     36      RefPtr<ServiceWorkerRegistrationInfo> aRegistrationInfo,
     37      RefPtr<FetchServicePromises>&& aPreloadResponseReadyPromises,
     38      RefPtr<KeepAliveToken>&& aKeepAliveToken);
     39 
     40  ~FetchEventOpChild();
     41 
     42 private:
     43  FetchEventOpChild(
     44      ParentToParentServiceWorkerFetchEventOpArgs&& aArgs,
     45      nsCOMPtr<nsIInterceptedChannel>&& aInterceptedChannel,
     46      RefPtr<ServiceWorkerRegistrationInfo>&& aRegistrationInfo,
     47      RefPtr<FetchServicePromises>&& aPreloadResponseReadyPromises,
     48      RefPtr<KeepAliveToken>&& aKeepAliveToken);
     49 
     50  mozilla::ipc::IPCResult RecvAsyncLog(const nsCString& aScriptSpec,
     51                                       const uint32_t& aLineNumber,
     52                                       const uint32_t& aColumnNumber,
     53                                       const nsCString& aMessageName,
     54                                       nsTArray<nsString>&& aParams);
     55 
     56  mozilla::ipc::IPCResult RecvRespondWith(
     57      ParentToParentFetchEventRespondWithResult&& aResult);
     58 
     59  mozilla::ipc::IPCResult Recv__delete__(
     60      const ServiceWorkerFetchEventOpResult& aResult);
     61 
     62  void ActorDestroy(ActorDestroyReason) override;
     63 
     64  nsresult StartSynthesizedResponse(
     65      ParentToParentSynthesizeResponseArgs&& aArgs);
     66 
     67  void SynthesizeResponse(ParentToParentSynthesizeResponseArgs&& aArgs);
     68 
     69  void ResetInterception(bool aBypass);
     70 
     71  void CancelInterception(nsresult aStatus);
     72 
     73  void MaybeScheduleRegistrationUpdate() const;
     74 
     75  ParentToParentServiceWorkerFetchEventOpArgs mArgs;
     76  nsCOMPtr<nsIInterceptedChannel> mInterceptedChannel;
     77  RefPtr<ServiceWorkerRegistrationInfo> mRegistration;
     78  RefPtr<KeepAliveToken> mKeepAliveToken;
     79  bool mInterceptedChannelHandled = false;
     80  MozPromiseHolder<GenericPromise> mPromiseHolder;
     81  bool mWasSent = false;
     82  MozPromiseRequestHolder<FetchServiceResponseAvailablePromise>
     83      mPreloadResponseAvailablePromiseRequestHolder;
     84  MozPromiseRequestHolder<FetchServiceResponseTimingPromise>
     85      mPreloadResponseTimingPromiseRequestHolder;
     86  MozPromiseRequestHolder<FetchServiceResponseEndPromise>
     87      mPreloadResponseEndPromiseRequestHolder;
     88  RefPtr<FetchServicePromises> mPreloadResponseReadyPromises;
     89 };
     90 
     91 }  // namespace mozilla::dom
     92 
     93 #endif  // mozilla_dom_fetcheventopchild_h__