Bug 1873666 [wpt PR 43897] - Add VideoTrackGenerator IDL tests, a=testonly
[gecko.git] / netwerk / ipc / NeckoChannelParams.ipdlh
blobc6a14b78cd960ea4fbcb6361d1489fff6f52e3fb
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set sw=2 ts=8 et tw=80 ft=c: */
4 /* This Source Code Form is subject to the terms of the Mozilla Public
5  * License, v. 2.0. If a copy of the MPL was not distributed with this
6  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
8 include protocol PHttpChannel;
9 include ClientIPCTypes;
10 include URIParams;
11 include IPCServiceWorkerDescriptor;
12 include IPCStream;
13 include PBackgroundSharedTypes;
14 include DOMTypes;
15 include ProtocolTypes;
17 include "mozilla/dom/FetchIPCTypes.h";
18 include "mozilla/dom/PropertyBagUtils.h";
19 include "mozilla/dom/ReferrerInfoUtils.h";
20 include "mozilla/ipc/URIUtils.h";
21 include "mozilla/net/CacheInfoIPCTypes.h";
22 include "mozilla/AntiTrackingIPCUtils.h";
23 include "mozilla/net/ClassOfService.h";
25 using mozilla::OriginAttributes from "mozilla/ipc/BackgroundUtils.h";
26 using mozilla::net::RequestHeaderTuples from "mozilla/net/PHttpChannelParams.h";
27 using struct nsHttpAtom from "nsHttp.h";
28 using class mozilla::net::nsHttpResponseHead from "nsHttpResponseHead.h";
29 using class mozilla::TimeStamp from "mozilla/TimeStamp.h";
30 [RefCounted] using class nsIPropertyBag2 from "nsIPropertyBag2.h";
31 [RefCounted] using class nsDOMNavigationTiming from "nsDOMNavigationTiming.h";
32 [RefCounted] using class nsDocShellLoadState from "nsDocShellLoadState.h";
33 using nsContentPolicyType from "nsIContentPolicy.h";
34 using mozilla::net::PreferredAlternativeDataDeliveryTypeIPC from "nsICacheInfoChannel.h";
35 using nsILoadInfo::CrossOriginEmbedderPolicy from "nsILoadInfo.h";
36 using nsILoadInfo::StoragePermissionState from "nsILoadInfo.h";
37 using struct mozilla::dom::LoadingSessionHistoryInfo from "mozilla/dom/SessionHistoryEntry.h";
38 using mozilla::dom::RequestMode from "mozilla/dom/RequestBinding.h";
39 using mozilla::net::LinkHeader from "nsNetUtil.h";
41 namespace mozilla {
42 namespace net {
44 //-----------------------------------------------------------------------------
45 // CookieJarSettings IPDL structs
46 //-----------------------------------------------------------------------------
48 struct CookiePermissionData
50   PrincipalInfo principalInfo;
51   uint32_t cookiePermission;
54 struct CookieJarSettingsArgs
56   // Copy of the cookie jar settings for the top-level document.
57   uint32_t cookieBehavior;
58   bool isFirstPartyIsolated;
59   bool shouldResistFingerprinting;
60   bool isOnContentBlockingAllowList;
61   CookiePermissionData[] cookiePermissions;
62   bool isFixed;
63   nsString partitionKey;
64   bool hasFingerprintingRandomizationKey;
65   uint8_t[] fingerprintingRandomizationKey;
68 //-----------------------------------------------------------------------------
69 // Preferrer alternative data type
70 //-----------------------------------------------------------------------------
72 struct PreferredAlternativeDataTypeParams
74   nsCString type;
75   nsCString contentType;
76   PreferredAlternativeDataDeliveryTypeIPC deliverAltData;
79 //-----------------------------------------------------------------------------
80 // LoadInfo IPDL structs
81 //-----------------------------------------------------------------------------
83 struct RedirectHistoryEntryInfo
85   PrincipalInfo       principalInfo;
86   URIParams?          referrerUri;
87   nsCString           remoteAddress;
90 struct InterceptionInfoArg
92   PrincipalInfo?              triggeringPrincipalInfo;
93   nsContentPolicyType         contentPolicyType;
94   RedirectHistoryEntryInfo[]  redirectChain;
95   bool                        fromThirdParty;
98 struct LoadInfoArgs
100   PrincipalInfo?              requestingPrincipalInfo;
101   PrincipalInfo               triggeringPrincipalInfo;
102   PrincipalInfo?              principalToInheritInfo;
103   PrincipalInfo?              topLevelPrincipalInfo;
104   URIParams?                  resultPrincipalURI;
105   nsCString                   triggeringRemoteType;
106   nsID                        sandboxedNullPrincipalID;
107   uint32_t                    securityFlags;
108   uint32_t                    sandboxFlags;
109   uint32_t                    triggeringSandboxFlags;
110   uint64_t                    triggeringWindowId;
111   bool                        triggeringStorageAccess;
112   nsContentPolicyType         contentPolicyType;
113   uint32_t                    tainting;
114   bool                        blockAllMixedContent;
115   bool                        upgradeInsecureRequests;
116   bool                        browserUpgradeInsecureRequests;
117   bool                        browserDidUpgradeInsecureRequests;
118   bool                        browserWouldUpgradeInsecureRequests;
119   bool                        forceAllowDataURI;
120   bool                        allowInsecureRedirectToDataURI;
121   bool                        skipContentPolicyCheckForWebRequest;
122   bool                        originalFrameSrcLoad;
123   bool                        forceInheritPrincipalDropped;
124   uint64_t                    innerWindowID;
125   uint64_t                    browsingContextID;
126   uint64_t                    frameBrowsingContextID;
127   bool                        initialSecurityCheckDone;
128   bool                        isInThirdPartyContext;
129   bool?                       isThirdPartyContextToTopWindow;
130   bool                        isFormSubmission;
131   bool                        sendCSPViolationEvents;
132   OriginAttributes            originAttributes;
133   RedirectHistoryEntryInfo[]  redirectChainIncludingInternalRedirects;
134   RedirectHistoryEntryInfo[]  redirectChain;
135   bool                        hasInjectedCookieForCookieBannerHandling;
136   bool                        wasSchemelessInput;
138   /**
139    * ClientInfo structure representing the window or worker that triggered
140    * this network request.  May be Nothing if its a system internal request.
141    */
142   IPCClientInfo?              clientInfo;
144   /**
145    * Non-subresource requests will result in the creation of a window or
146    * worker client.  The reserved and initial ClientInfo values represent
147    * this resulting client.  An initial ClientInfo represents an initial
148    * about:blank window that will be re-used while a reserved ClientInfo
149    * represents a to-be-newly-created window/worker.
150    */
151   IPCClientInfo?              reservedClientInfo;
152   IPCClientInfo?              initialClientInfo;
154   /**
155    * Subresource loads may have a controller set based on their owning
156    * window/worker client.  We must send this across IPC to support
157    * performing interception in the parent.
158    */
159   IPCServiceWorkerDescriptor? controller;
161   nsCString[]                 corsUnsafeHeaders;
162   bool                        forcePreflight;
163   bool                        isPreflight;
164   bool                        loadTriggeredFromExternal;
165   bool                        serviceWorkerTaintingSynthesized;
166   bool                        documentHasUserInteracted;
167   bool allowListFutureDocumentsCreatedFromThisRedirectChain;
168   bool needForCheckingAntiTrackingHeuristic;
169   nsString                    cspNonce;
170   nsString                    integrityMetadata;
171   bool                        skipContentSniffing;
172   uint32_t                    httpsOnlyStatus;
173   bool                        hstsStatus;
174   bool                        hasValidUserGestureActivation;
175   bool                        allowDeprecatedSystemRequests;
176   bool                        isInDevToolsContext;
177   bool                        parserCreatedScript;
178   bool                        isFromProcessingFrameAttributes;
179   bool                        isMediaRequest;
180   bool                        isMediaInitialRequest;
181   bool                        isFromObjectOrEmbed;
182   CookieJarSettingsArgs       cookieJarSettings;
183   uint32_t                    requestBlockingReason;
184   CSPInfo?                    cspToInheritInfo;
185   StoragePermissionState      storagePermission;
186   uint64_t?                   overriddenFingerprintingSettings;
187   bool                        isMetaRefresh;
188   CrossOriginEmbedderPolicy   loadingEmbedderPolicy;
189   bool                        originTrialCoepCredentiallessEnabledForTopLevel;
190   nullable nsIURI             unstrippedURI;
191   InterceptionInfoArg?        interceptionInfo;
195  * This structure is used to carry selected properties of a LoadInfo
196  * object to child processes to merge LoadInfo changes from the parent
197  * process.  We don't want to use LoadInfoArgs for that since it's
198  * too huge and we only care about small subpart of properties anyway.
199  */
200 struct ParentLoadInfoForwarderArgs
202   // WebExtextensions' WebRequest API allows extensions to intercept and
203   // redirect a channel to a data URI. This modifications happens in
204   // the parent and needs to be mirrored to the child so that security
205   // checks can pass.
206   bool allowInsecureRedirectToDataURI;
208   // The ServiceWorker controller that may be set in the parent when
209   // interception occurs.
210   IPCServiceWorkerDescriptor? controller;
212   // The service worker may synthesize a Response with a particular
213   // tainting value.
214   uint32_t tainting;
216   // This flag is used for any browsing context where we should not sniff
217   // the content type. E.g if an iframe has the XCTO nosniff header, then
218   // that flag is set to true so we skip content sniffing for that browsing
219   bool skipContentSniffing;
221   uint32_t httpsOnlyStatus;
223   bool hstsStatus;
225   // Returns true if at the time of the loadinfo construction the document
226   // that triggered this load has the bit hasValidTransientUserGestureActivation
227   // set or the load was triggered from External. (Mostly this bool is used
228   // in the context of Sec-Fetch-User.)
229   bool hasValidUserGestureActivation;
231   // The SystemPrincipal is disallowed to make requests to the public web
232   // and all requests will be cancelled. Setting this flag to true prevents
233   // the request from being cancelled.
234   bool allowDeprecatedSystemRequests;
236   bool isInDevToolsContext;
238   // Only ever returns true if the loadinfo is of TYPE_SCRIPT and
239   // the script was created by the HTML parser.
240   bool parserCreatedScript;
242   // Sandbox Flags of the Document that triggered the load
243   uint32_t triggeringSandboxFlags;
245   // Window ID and UsingStorageAccess of the Document that triggered the load.
246   // Used by the Storage Access API to determine if SubDocument loads should
247   // be partitioned or not.
248   uint64_t triggeringWindowId;
249   bool triggeringStorageAccess;
251   // We must also note that the tainting value was explicitly set
252   // by the service worker.
253   bool serviceWorkerTaintingSynthesized;
255   bool documentHasUserInteracted;
256   bool allowListFutureDocumentsCreatedFromThisRedirectChain;
258   CookieJarSettingsArgs? cookieJarSettings;
260   uint32_t requestBlockingReason;
262   StoragePermissionState storagePermission;
264   uint64_t? overriddenFingerprintingSettings;
266   bool isMetaRefresh;
268   bool? isThirdPartyContextToTopWindow;
270   bool isInThirdPartyContext;
272   nullable nsIURI unstrippedURI;
274   // IMPORTANT: when you add new properites here you must also update
275   // LoadInfoToParentLoadInfoForwarder and MergeParentLoadInfoForwarder
276   // in BackgroundUtils.cpp/.h!
280  * This structure is used to carry selected properties of a LoadInfo
281  * object to the parent process that might have changed in the child
282  * during a redirect.  We don't want to use LoadInfoArgs for that since
283  * it's too huge and we only care about small subpart of properties
284  * anyway.
285  */
286 struct ChildLoadInfoForwarderArgs
288   // The reserved and initial ClientInfo values may change during a
289   // redirect if the new channel is cross-origin to the old channel.
290   IPCClientInfo? reservedClientInfo;
291   IPCClientInfo? initialClientInfo;
293   // The ServiceWorker controller may be cleared in the child during
294   // a redirect.
295   IPCServiceWorkerDescriptor? controller;
297   uint32_t requestBlockingReason;
300 //-----------------------------------------------------------------------------
301 // HTTP IPDL structs
302 //-----------------------------------------------------------------------------
304 struct CorsPreflightArgs
306   nsCString[]   unsafeHeaders;
309 struct HttpChannelOpenArgs
311   nullable nsIURI             uri;
312   // - TODO: bug 571161: unclear if any HTTP channel clients ever
313   // set originalURI != uri (about:credits?); also not clear if
314   // chrome channel would ever need to know.  Get rid of next arg?
315   nullable nsIURI             original;
316   nullable nsIURI             doc;
317   nullable nsIReferrerInfo    referrerInfo;
318   nullable nsIURI             apiRedirectTo;
319   nullable nsIURI             topWindowURI;
320   RequestHeaderTuples         requestHeaders;
321   PreferredAlternativeDataTypeParams[] preferredAlternativeTypes;
322   TimeStamp                   launchServiceWorkerStart;
323   TimeStamp                   launchServiceWorkerEnd;
324   TimeStamp                   dispatchFetchEventStart;
325   TimeStamp                   dispatchFetchEventEnd;
326   TimeStamp                   handleFetchEventStart;
327   TimeStamp                   handleFetchEventEnd;
328   TimeStamp                   navigationStartTimeStamp;
329   uint64_t                    startPos;
330   uint64_t                    requestContextID;
331   uint64_t                    channelId;
332   uint64_t                    contentWindowId;
333   uint64_t                    browserId;
334   uint64_t                    earlyHintPreloaderId;
335   nsCString                   requestMethod;
336   ClassOfService              classOfService;
337   nsCString                   entityID;
338   nsCString                   appCacheClientID;
339   CorsPreflightArgs?          preflightArgs;
340   nsCString                   contentTypeHint;
341   nsString                    integrityMetadata;
342   IPCStream?                  uploadStream;
343   LoadInfoArgs                loadInfo;
344   uint32_t                    loadFlags;
345   uint32_t                    thirdPartyFlags;
346   uint32_t                    tlsFlags;
347   uint32_t                    cacheKey;
348   uint32_t                    initialRwin;
349   uint32_t                    redirectMode;
350   int16_t                     priority;
351   bool                        uploadStreamHasHeaders;
352   bool                        allowSTS;
353   bool                        resumeAt;
354   bool                        allowSpdy;
355   bool                        allowHttp3;
356   bool                        allowAltSvc;
357   bool                        beConservative;
358   bool                        bypassProxy;
359   bool                        blockAuthPrompt;
360   bool                        allowStaleCacheContent;
361   RequestMode                 requestMode;
362   bool                        forceValidateCacheContent;
363   bool                        preferCacheLoadOverBypass;
364   bool                        forceMainDocumentChannel;
365   uint8_t                     redirectionLimit;
366   nsString                    classicScriptHintCharset;
367   nsString                    documentCharacterSet;
370 struct HttpChannelConnectArgs
372   uint32_t registrarId;
375 union HttpChannelCreationArgs
377   HttpChannelOpenArgs;      // For AsyncOpen: the common case.
378   HttpChannelConnectArgs;   // Used for redirected-to channels
381 struct ProxyInfoCloneArgs
383   nsCString type;
384   nsCString host;
385   int32_t port;
386   nsCString username;
387   nsCString password;
388   uint32_t flags;
389   uint32_t timeout;
390   uint32_t resolveFlags;
391   nsCString proxyAuthorizationHeader;
392   nsCString connectionIsolationKey;
395 struct HttpConnectionInfoCloneArgs
397   nsCString host;
398   int32_t port;
399   nsCString npnToken;
400   nsCString username;
401   OriginAttributes originAttributes;
402   bool endToEndSSL;
403   nsCString routedHost;
404   int32_t routedPort;
405   bool anonymous;
406   bool aPrivate; // use prefix to avoid code generation error
407   bool insecureScheme;
408   bool noSpdy;
409   bool beConservative;
410   bool bypassProxy;
411   bool anonymousAllowClientCert;
412   bool fallbackConnection;
413   uint32_t tlsFlags;
414   bool isolated;
415   bool isTrrServiceChannel;
416   uint8_t trrMode;
417   bool isIPv4Disabled;
418   bool isIPv6Disabled;
419   nsCString topWindowOrigin;
420   bool isHttp3;
421   bool webTransport;
422   bool hasIPHintAddress;
423   nsCString echConfig;
424   ProxyInfoCloneArgs[] proxyInfo;
427 struct ConsoleReportCollected {
428   uint32_t errorFlags;
429   nsCString category;
430   uint32_t propertiesFile;
431   nsCString sourceFileURI;
432   uint32_t lineNumber;
433   uint32_t columnNumber;
434   nsCString messageName;
435   nsString[] stringParams;
438 struct CookieStruct
440   nsCString name;
441   nsCString value;
442   nsCString host;
443   nsCString path;
444   int64_t   expiry;
445   int64_t   lastAccessed;
446   int64_t   creationTime;
447   bool      isHttpOnly;
448   bool      isSession;
449   bool      isSecure;
450   bool      isPartitioned;
451   int32_t   sameSite;
452   int32_t   rawSameSite;
453   uint8_t   schemeMap;
456 struct DocumentCreationArgs {
457   bool uriModified;
458   bool isEmbeddingBlockedError;
461 struct ObjectCreationArgs {
462   uint64_t embedderInnerWindowId;
463   uint32_t loadFlags;
464   nsContentPolicyType contentPolicyType;
465   bool isUrgentStart;
468 union DocumentChannelElementCreationArgs {
469   DocumentCreationArgs;
470   ObjectCreationArgs;
473 struct DocumentChannelCreationArgs {
474   nsDocShellLoadState loadState;
475   TimeStamp asyncOpenTime;
476   uint64_t channelId;
477   uint32_t cacheKey;
478   nullable nsDOMNavigationTiming timing;
479   IPCClientInfo? initialClientInfo;
480   DocumentChannelElementCreationArgs elementCreationArgs;
481   uint64_t parentInitiatedNavigationEpoch;
484 struct EarlyHintConnectArgs {
485   LinkHeader link;
486   uint64_t earlyHintPreloaderId;
489 struct RedirectToRealChannelArgs {
490   uint32_t registrarId;
491   nullable nsIURI uri;
492   uint32_t newLoadFlags;
493   ReplacementChannelConfigInit? init;
494   LoadInfoArgs loadInfo;
495   uint64_t channelId;
496   nullable nsIURI originalURI;
497   uint32_t redirectMode;
498   uint32_t redirectFlags;
499   uint32_t? contentDisposition;
500   nsString? contentDispositionFilename;
501   nullable nsIPropertyBag2 properties;
502   uint32_t loadStateExternalLoadFlags;
503   uint32_t loadStateInternalLoadFlags;
504   uint32_t loadStateLoadType;
505   nullable nsDOMNavigationTiming timing;
506   nsString srcdocData;
507   nullable nsIURI baseUri;
508   LoadingSessionHistoryInfo? loadingSessionHistoryInfo;
509   uint64_t loadIdentifier;
510   nsCString? originalUriString;
511   EarlyHintConnectArgs[] earlyHints;
512   uint32_t earlyHintLinkType;
515 struct TimingStructArgs {
516   TimeStamp domainLookupStart;
517   TimeStamp domainLookupEnd;
518   TimeStamp connectStart;
519   TimeStamp tcpConnectEnd;
520   TimeStamp secureConnectionStart;
521   TimeStamp connectEnd;
522   TimeStamp requestStart;
523   TimeStamp responseStart;
524   TimeStamp responseEnd;
525   TimeStamp transactionPending;
528 struct ResourceTimingStructArgs {
529   TimeStamp domainLookupStart;
530   TimeStamp domainLookupEnd;
531   TimeStamp connectStart;
532   TimeStamp tcpConnectEnd;
533   TimeStamp secureConnectionStart;
534   TimeStamp connectEnd;
535   TimeStamp requestStart;
536   TimeStamp responseStart;
537   TimeStamp responseEnd;
538   TimeStamp fetchStart;
539   TimeStamp redirectStart;
540   TimeStamp redirectEnd;
541   uint64_t transferSize;
542   uint64_t encodedBodySize;
544   // Not actually part of resource timing, but not part of the transaction
545   // timings either. These need to be passed to HttpChannelChild along with
546   // the rest of the timings so the timing information in the child is complete.
547   TimeStamp cacheReadStart;
548   TimeStamp cacheReadEnd;
550   TimeStamp transactionPending;
553 struct HttpActivity
555   nsCString host;
556   int32_t port;
557   bool endToEndSSL;
560 struct HttpConnectionActivity
562   nsCString connInfoKey;
563   nsCString host;
564   int32_t port;
565   bool ssl;
566   bool hasECH;
567   bool isHttp3;
570 union HttpActivityArgs
572   uint64_t;
573   HttpActivity;
574   HttpConnectionActivity;
577 struct TransactionObserverResult
579   bool versionOk;
580   bool authOk;
581   nsresult closeReason;
584 struct SpeculativeConnectionOverriderArgs {
585   uint32_t parallelSpeculativeConnectLimit;
586   bool ignoreIdle;
587   bool isFromPredictor;
588   bool allow1918;
591 //-----------------------------------------------------------------------------
592 // GIO IPDL structs
593 //-----------------------------------------------------------------------------
595 struct GIOChannelOpenArgs
597   URIParams                 uri;
598   uint64_t                  startPos;
599   nsCString                 entityID;
600   IPCStream?                uploadStream;
601   LoadInfoArgs              loadInfo;
602   uint32_t                  loadFlags;
605 struct GIOChannelConnectArgs
607   uint32_t channelId;
610 union GIOChannelCreationArgs
612   GIOChannelOpenArgs;      // For AsyncOpen: the common case.
613   GIOChannelConnectArgs;   // Used for redirected-to channels
616 struct RemoteStreamInfo {
617   nullable nsIInputStream inputStream;
618   nsCString contentType;
619   int64_t contentLength;
621 } // namespace net
622 } // namespace mozilla