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_fetcheventopchild_h__
8 #define mozilla_dom_fetcheventopchild_h__
12 #include "mozilla/MozPromise.h"
13 #include "mozilla/RefPtr.h"
14 #include "mozilla/dom/PFetchEventOpChild.h"
15 #include "mozilla/dom/ServiceWorkerOpArgs.h"
17 class nsIInterceptedChannel
;
23 class PRemoteWorkerControllerChild
;
24 class ServiceWorkerRegistrationInfo
;
27 * FetchEventOpChild represents an in-flight FetchEvent operation.
29 class FetchEventOpChild final
: public PFetchEventOpChild
{
30 friend class PFetchEventOpChild
;
33 static RefPtr
<GenericPromise
> SendFetchEvent(
34 PRemoteWorkerControllerChild
* aManager
,
35 ServiceWorkerFetchEventOpArgs
&& aArgs
,
36 nsCOMPtr
<nsIInterceptedChannel
> aInterceptedChannel
,
37 RefPtr
<ServiceWorkerRegistrationInfo
> aRegistrationInfo
,
38 RefPtr
<KeepAliveToken
>&& aKeepAliveToken
);
43 FetchEventOpChild(ServiceWorkerFetchEventOpArgs
&& aArgs
,
44 nsCOMPtr
<nsIInterceptedChannel
>&& aInterceptedChannel
,
45 RefPtr
<ServiceWorkerRegistrationInfo
>&& aRegistrationInfo
,
46 RefPtr
<KeepAliveToken
>&& aKeepAliveToken
);
48 mozilla::ipc::IPCResult
RecvAsyncLog(const nsCString
& aScriptSpec
,
49 const uint32_t& aLineNumber
,
50 const uint32_t& aColumnNumber
,
51 const nsCString
& aMessageName
,
52 nsTArray
<nsString
>&& aParams
);
54 mozilla::ipc::IPCResult
RecvRespondWith(
55 IPCFetchEventRespondWithResult
&& aResult
);
57 mozilla::ipc::IPCResult
Recv__delete__(
58 const ServiceWorkerFetchEventOpResult
& aResult
);
60 void ActorDestroy(ActorDestroyReason
) override
;
62 nsresult
StartSynthesizedResponse(IPCSynthesizeResponseArgs
&& aArgs
);
64 void SynthesizeResponse(IPCSynthesizeResponseArgs
&& aArgs
);
66 void ResetInterception();
68 void CancelInterception(nsresult aStatus
);
70 void MaybeScheduleRegistrationUpdate() const;
72 const ServiceWorkerFetchEventOpArgs mArgs
;
73 nsCOMPtr
<nsIInterceptedChannel
> mInterceptedChannel
;
74 RefPtr
<ServiceWorkerRegistrationInfo
> mRegistration
;
75 RefPtr
<KeepAliveToken
> mKeepAliveToken
;
76 bool mInterceptedChannelHandled
= false;
77 MozPromiseHolder
<GenericPromise
> mPromiseHolder
;
81 } // namespace mozilla
83 #endif // mozilla_dom_fetcheventopchild_h__