Bug 1945643 - Update to mozilla-nimbus-schemas 2025.1.1 r=chumphreys
[gecko.git] / dom / serviceworkers / ServiceWorkerOpArgs.ipdlh
blobaeadb033389caa6a807a170558166c2ad5354379
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2  * License, v. 2.0. If a copy of the MPL was not distributed with this
3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 include ClientIPCTypes;
6 include DOMTypes;
7 include FetchTypes;
9 include "mozilla/dom/ServiceWorkerIPCUtils.h";
11 using mozilla::dom::ServiceWorkerState from "mozilla/dom/ServiceWorkerBinding.h";
12 using mozilla::TimeStamp from "mozilla/TimeStamp.h";
14 namespace mozilla {
15 namespace dom {
17 /**
18  * ServiceWorkerOpArgs
19  */
20 struct ServiceWorkerCheckScriptEvaluationOpArgs {};
22 struct ServiceWorkerUpdateStateOpArgs {
23   ServiceWorkerState state;
26 struct ServiceWorkerTerminateWorkerOpArgs {
27   uint32_t shutdownStateId;
30 struct ServiceWorkerLifeCycleEventOpArgs {
31   nsString eventName;
34 // Possibly need to differentiate an empty array from the absence of an array.
35 union OptionalPushData {
36   void_t;
37   uint8_t[];
40 struct ServiceWorkerPushEventOpArgs {
41   nsString messageId;
42   OptionalPushData data;
45 struct ServiceWorkerPushSubscriptionChangeEventOpArgs {};
47 struct ServiceWorkerNotificationEventOpArgs {
48   nsString eventName;
49   nsString id;
50   nsString title;
51   nsString dir;
52   nsString lang;
53   nsString body;
54   nsString tag;
55   nsString icon;
56   nsString data;
57   nsString scope;
58   uint32_t disableOpenClickDelay;
61 struct ServiceWorkerExtensionAPIEventOpArgs {
62   // WebExtensions API namespace and event names, for a list of the API namespaces
63   // and related API event names refer to the API JSONSchema files in-tree:
64   //
65   // https://searchfox.org/mozilla-central/search?q=&path=extensions%2Fschemas%2F*.json
66   nsString apiNamespace;
67   nsString apiEventName;
70 struct ServiceWorkerMessageEventOpArgs {
71   PostMessageSource source;
72   ClonedOrErrorMessageData clonedData;
75 struct ServiceWorkerFetchEventOpArgsCommon {
76   nsCString workerScriptSpec;
77   IPCInternalRequest internalRequest;
78   nsString clientId;
79   nsString resultingClientId;
80   bool isNonSubresourceRequest;
81   // Is navigation preload enabled for this fetch? If true, if some
82   // preloadResponse was not already provided in this structure, then it's
83   // expected that a PreloadResponse message will eventually be sent.
84   bool preloadNavigation;
85   // Failure injection helper; non-NS_OK values indicate that the event, instead
86   // of dispatching should instead return a `CancelInterceptionArgs` response
87   // with this nsresult.  This value originates from
88   // `nsIServiceWorkerInfo::testingInjectCancellation`.
89   nsresult testingInjectCancellation;
92 struct ParentToParentServiceWorkerFetchEventOpArgs {
93   ServiceWorkerFetchEventOpArgsCommon common;
94   ParentToParentInternalResponse? preloadResponse;
95   ResponseTiming? preloadResponseTiming;
96   ResponseEndArgs? preloadResponseEndArgs;
99 struct ParentToChildServiceWorkerFetchEventOpArgs {
100   ServiceWorkerFetchEventOpArgsCommon common;
101   ParentToChildInternalResponse? preloadResponse;
102   ResponseTiming? preloadResponseTiming;
103   ResponseEndArgs? preloadResponseEndArgs;
106 struct ServiceWorkerUpdateIsOnContentBlockingAllowListOpArgs {
107   bool onContentBlockingAllowList;
110 union ServiceWorkerOpArgs {
111   ServiceWorkerCheckScriptEvaluationOpArgs;
112   ServiceWorkerUpdateStateOpArgs;
113   ServiceWorkerTerminateWorkerOpArgs;
114   ServiceWorkerLifeCycleEventOpArgs;
115   ServiceWorkerPushEventOpArgs;
116   ServiceWorkerPushSubscriptionChangeEventOpArgs;
117   ServiceWorkerNotificationEventOpArgs;
118   ServiceWorkerMessageEventOpArgs;
119   ServiceWorkerExtensionAPIEventOpArgs;
120   ParentToChildServiceWorkerFetchEventOpArgs;
121   ServiceWorkerUpdateIsOnContentBlockingAllowListOpArgs;
125  * IPCFetchEventRespondWithResult
126  */
127 struct FetchEventRespondWithClosure {
128   nsCString respondWithScriptSpec;
129   uint32_t respondWithLineNumber;
130   uint32_t respondWithColumnNumber;
133 struct FetchEventTimeStamps {
134   TimeStamp fetchHandlerStart;
135   TimeStamp fetchHandlerFinish;
138 struct ChildToParentSynthesizeResponseArgs {
139   ChildToParentInternalResponse internalResponse;
140   FetchEventRespondWithClosure closure;
141   FetchEventTimeStamps timeStamps;
144 struct ParentToParentSynthesizeResponseArgs {
145   ParentToParentInternalResponse internalResponse;
146   FetchEventRespondWithClosure closure;
147   FetchEventTimeStamps timeStamps;
150 struct ResetInterceptionArgs {
151   FetchEventTimeStamps timeStamps;
154 struct CancelInterceptionArgs {
155   nsresult status;
156   FetchEventTimeStamps timeStamps;
159 union ChildToParentFetchEventRespondWithResult {
160   ChildToParentSynthesizeResponseArgs;
161   ResetInterceptionArgs;
162   CancelInterceptionArgs;
165 union ParentToParentFetchEventRespondWithResult {
166   ParentToParentSynthesizeResponseArgs;
167   ResetInterceptionArgs;
168   CancelInterceptionArgs;
172  * ServiceWorkerOpResult
173  */
174 struct ServiceWorkerCheckScriptEvaluationOpResult {
175   bool workerScriptExecutedSuccessfully;
176   bool fetchHandlerWasAdded;
179 struct ServiceWorkerFetchEventOpResult {
180   nsresult rv;
183 struct ServiceWorkerExtensionAPIEventOpResult {
184   bool extensionAPIEventListenerWasAdded;
187 union ServiceWorkerOpResult {
188   nsresult;
189   ServiceWorkerCheckScriptEvaluationOpResult;
190   ServiceWorkerFetchEventOpResult;
191   ServiceWorkerExtensionAPIEventOpResult;
194 }  // namespace dom
195 }  // namespace mozilla