tor-browser

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

ServiceWorkerOpArgs.ipdlh (5612B)


      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/. */
      4 
      5 include ClientIPCTypes;
      6 include DOMTypes;
      7 include FetchTypes;
      8 include NeckoChannelParams;
      9 
     10 include "mozilla/dom/ServiceWorkerIPCUtils.h";
     11 
     12 using mozilla::dom::ServiceWorkerState from "mozilla/dom/ServiceWorkerBinding.h";
     13 using mozilla::TimeStamp from "mozilla/TimeStamp.h";
     14 
     15 namespace mozilla {
     16 namespace dom {
     17 
     18 /**
     19  * ServiceWorkerOpArgs
     20  */
     21 struct ServiceWorkerCheckScriptEvaluationOpArgs {};
     22 
     23 struct ServiceWorkerUpdateStateOpArgs {
     24   ServiceWorkerState state;
     25 };
     26 
     27 struct ServiceWorkerTerminateWorkerOpArgs {
     28   uint32_t shutdownStateId;
     29 };
     30 
     31 struct ServiceWorkerLifeCycleEventOpArgs {
     32   nsString eventName;
     33 };
     34 
     35 struct ServiceWorkerCookieChangeEventOpArgs {
     36   CookieStruct cookie;
     37   bool deleted;
     38 };
     39 
     40 // Possibly need to differentiate an empty array from the absence of an array.
     41 union OptionalPushData {
     42   void_t;
     43   uint8_t[];
     44 };
     45 
     46 struct ServiceWorkerPushEventOpArgs {
     47   nsString messageId;
     48   OptionalPushData data;
     49 };
     50 
     51 struct PushSubscriptionData {
     52   nsString endpoint;
     53   uint8_t[] rawP256dhKey;
     54   uint8_t[] authSecret;
     55   uint8_t[] appServerKey;
     56 };
     57 
     58 struct ServiceWorkerPushSubscriptionChangeEventOpArgs {
     59   PushSubscriptionData? oldSubscription;
     60 };
     61 
     62 struct ServiceWorkerNotificationClickEventOpArgs {
     63   IPCNotification notification;
     64   nsString action;
     65 };
     66 
     67 struct ServiceWorkerNotificationCloseEventOpArgs {
     68   IPCNotification notification;
     69 };
     70 
     71 union ServiceWorkerNotificationEventOpArgs {
     72   ServiceWorkerNotificationClickEventOpArgs;
     73   ServiceWorkerNotificationCloseEventOpArgs;
     74 };
     75 
     76 struct ServiceWorkerExtensionAPIEventOpArgs {
     77   // WebExtensions API namespace and event names, for a list of the API namespaces
     78   // and related API event names refer to the API JSONSchema files in-tree:
     79   //
     80   // https://searchfox.org/mozilla-central/search?q=&path=extensions%2Fschemas%2F*.json
     81   nsString apiNamespace;
     82   nsString apiEventName;
     83 };
     84 
     85 struct ServiceWorkerMessageEventOpArgs {
     86   PostMessageSource source;
     87   ClonedOrErrorMessageData clonedData;
     88 };
     89 
     90 struct ServiceWorkerFetchEventOpArgsCommon {
     91   nsCString workerScriptSpec;
     92   IPCInternalRequest internalRequest;
     93   nsString clientId;
     94   nsString resultingClientId;
     95   bool isNonSubresourceRequest;
     96   // Is navigation preload enabled for this fetch? If true, if some
     97   // preloadResponse was not already provided in this structure, then it's
     98   // expected that a PreloadResponse message will eventually be sent.
     99   bool preloadNavigation;
    100   // Failure injection helper; non-NS_OK values indicate that the event, instead
    101   // of dispatching should instead return a `CancelInterceptionArgs` response
    102   // with this nsresult.  This value originates from
    103   // `nsIServiceWorkerInfo::testingInjectCancellation`.
    104   nsresult testingInjectCancellation;
    105 };
    106 
    107 struct ParentToParentServiceWorkerFetchEventOpArgs {
    108   ServiceWorkerFetchEventOpArgsCommon common;
    109   ParentToParentInternalResponse? preloadResponse;
    110   ResponseTiming? preloadResponseTiming;
    111   ResponseEndArgs? preloadResponseEndArgs;
    112 };
    113 
    114 struct ParentToChildServiceWorkerFetchEventOpArgs {
    115   ServiceWorkerFetchEventOpArgsCommon common;
    116   ParentToChildInternalResponse? preloadResponse;
    117   ResponseTiming? preloadResponseTiming;
    118   ResponseEndArgs? preloadResponseEndArgs;
    119 };
    120 
    121 struct ServiceWorkerUpdateIsOnContentBlockingAllowListOpArgs {
    122   bool onContentBlockingAllowList;
    123 };
    124 
    125 union ServiceWorkerOpArgs {
    126   ServiceWorkerCheckScriptEvaluationOpArgs;
    127   ServiceWorkerUpdateStateOpArgs;
    128   ServiceWorkerTerminateWorkerOpArgs;
    129   ServiceWorkerLifeCycleEventOpArgs;
    130   ServiceWorkerCookieChangeEventOpArgs;
    131   ServiceWorkerPushEventOpArgs;
    132   ServiceWorkerPushSubscriptionChangeEventOpArgs;
    133   ServiceWorkerNotificationEventOpArgs;
    134   ServiceWorkerMessageEventOpArgs;
    135   ServiceWorkerExtensionAPIEventOpArgs;
    136   ParentToChildServiceWorkerFetchEventOpArgs;
    137   ServiceWorkerUpdateIsOnContentBlockingAllowListOpArgs;
    138 };
    139 
    140 /**
    141  * IPCFetchEventRespondWithResult
    142  */
    143 struct FetchEventRespondWithClosure {
    144   nsCString respondWithScriptSpec;
    145   uint32_t respondWithLineNumber;
    146   uint32_t respondWithColumnNumber;
    147 };
    148 
    149 struct FetchEventTimeStamps {
    150   TimeStamp fetchHandlerStart;
    151   TimeStamp fetchHandlerFinish;
    152 };
    153 
    154 struct ChildToParentSynthesizeResponseArgs {
    155   ChildToParentInternalResponse internalResponse;
    156   FetchEventRespondWithClosure closure;
    157   FetchEventTimeStamps timeStamps;
    158 };
    159 
    160 struct ParentToParentSynthesizeResponseArgs {
    161   ParentToParentInternalResponse internalResponse;
    162   FetchEventRespondWithClosure closure;
    163   FetchEventTimeStamps timeStamps;
    164 };
    165 
    166 struct ResetInterceptionArgs {
    167   FetchEventTimeStamps timeStamps;
    168 };
    169 
    170 struct CancelInterceptionArgs {
    171   nsresult status;
    172   FetchEventTimeStamps timeStamps;
    173 };
    174 
    175 union ChildToParentFetchEventRespondWithResult {
    176   ChildToParentSynthesizeResponseArgs;
    177   ResetInterceptionArgs;
    178   CancelInterceptionArgs;
    179 };
    180 
    181 union ParentToParentFetchEventRespondWithResult {
    182   ParentToParentSynthesizeResponseArgs;
    183   ResetInterceptionArgs;
    184   CancelInterceptionArgs;
    185 };
    186 
    187 /**
    188  * ServiceWorkerOpResult
    189  */
    190 struct ServiceWorkerCheckScriptEvaluationOpResult {
    191   bool workerScriptExecutedSuccessfully;
    192   bool fetchHandlerWasAdded;
    193 };
    194 
    195 struct ServiceWorkerFetchEventOpResult {
    196   nsresult rv;
    197 };
    198 
    199 struct ServiceWorkerExtensionAPIEventOpResult {
    200   bool extensionAPIEventListenerWasAdded;
    201 };
    202 
    203 union ServiceWorkerOpResult {
    204   nsresult;
    205   ServiceWorkerCheckScriptEvaluationOpResult;
    206   ServiceWorkerFetchEventOpResult;
    207   ServiceWorkerExtensionAPIEventOpResult;
    208 };
    209 
    210 }  // namespace dom
    211 }  // namespace mozilla