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/. */
6 include ClientIPCTypes;
10 include "mozilla/dom/ServiceWorkerIPCUtils.h";
12 using ServiceWorkerState from "mozilla/dom/ServiceWorkerBinding.h";
13 using class mozilla::TimeStamp from "mozilla/TimeStamp.h";
21 struct ServiceWorkerCheckScriptEvaluationOpArgs {};
23 struct ServiceWorkerUpdateStateOpArgs {
24 ServiceWorkerState state;
27 struct ServiceWorkerTerminateWorkerOpArgs {
28 uint32_t shutdownStateId;
31 struct ServiceWorkerLifeCycleEventOpArgs {
35 // Possibly need to differentiate an empty array from the absence of an array.
36 union OptionalPushData {
41 struct ServiceWorkerPushEventOpArgs {
43 OptionalPushData data;
46 struct ServiceWorkerPushSubscriptionChangeEventOpArgs {};
48 struct ServiceWorkerNotificationEventOpArgs {
60 uint32_t disableOpenClickDelay;
63 struct ServiceWorkerMessageEventOpArgs {
64 ClientInfoAndState clientInfoAndState;
65 ClonedOrErrorMessageData clonedData;
68 struct ServiceWorkerFetchEventOpArgs {
69 nsCString workerScriptSpec;
70 IPCInternalRequest internalRequest;
72 nsString resultingClientId;
73 bool isNonSubresourceRequest;
74 // Failure injection helper; non-NS_OK values indicate that the event, instead
75 // of dispatching should instead return a `CancelInterceptionArgs` response
76 // with this nsresult. This value originates from
77 // `nsIServiceWorkerInfo::testingInjectCancellation`.
78 nsresult testingInjectCancellation;
81 union ServiceWorkerOpArgs {
82 ServiceWorkerCheckScriptEvaluationOpArgs;
83 ServiceWorkerUpdateStateOpArgs;
84 ServiceWorkerTerminateWorkerOpArgs;
85 ServiceWorkerLifeCycleEventOpArgs;
86 ServiceWorkerPushEventOpArgs;
87 ServiceWorkerPushSubscriptionChangeEventOpArgs;
88 ServiceWorkerNotificationEventOpArgs;
89 ServiceWorkerMessageEventOpArgs;
90 ServiceWorkerFetchEventOpArgs;
94 * IPCFetchEventRespondWithResult
96 struct FetchEventRespondWithClosure {
97 nsCString respondWithScriptSpec;
98 uint32_t respondWithLineNumber;
99 uint32_t respondWithColumnNumber;
102 struct FetchEventTimeStamps {
103 TimeStamp fetchHandlerStart;
104 TimeStamp fetchHandlerFinish;
107 struct IPCSynthesizeResponseArgs {
108 IPCInternalResponse internalResponse;
109 FetchEventRespondWithClosure closure;
110 FetchEventTimeStamps timeStamps;
113 struct ResetInterceptionArgs {
114 FetchEventTimeStamps timeStamps;
117 struct CancelInterceptionArgs {
119 FetchEventTimeStamps timeStamps;
122 union IPCFetchEventRespondWithResult {
123 IPCSynthesizeResponseArgs;
124 ResetInterceptionArgs;
125 CancelInterceptionArgs;
129 * ServiceWorkerOpResult
131 struct ServiceWorkerCheckScriptEvaluationOpResult {
132 bool workerScriptExecutedSuccessfully;
133 bool fetchHandlerWasAdded;
136 struct ServiceWorkerFetchEventOpResult {
140 union ServiceWorkerOpResult {
142 ServiceWorkerCheckScriptEvaluationOpResult;
143 ServiceWorkerFetchEventOpResult;
147 } // namespace mozilla