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;
11 include IPCServiceWorkerDescriptor;
13 include PBackgroundSharedTypes;
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";
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;
63 nsString partitionKey;
64 bool hasFingerprintingRandomizationKey;
65 uint8_t[] fingerprintingRandomizationKey;
68 //-----------------------------------------------------------------------------
69 // Preferrer alternative data type
70 //-----------------------------------------------------------------------------
72 struct PreferredAlternativeDataTypeParams
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;
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;
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;
139 * ClientInfo structure representing the window or worker that triggered
140 * this network request. May be Nothing if its a system internal request.
142 IPCClientInfo? clientInfo;
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.
151 IPCClientInfo? reservedClientInfo;
152 IPCClientInfo? initialClientInfo;
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.
159 IPCServiceWorkerDescriptor? controller;
161 nsCString[] corsUnsafeHeaders;
164 bool loadTriggeredFromExternal;
165 bool serviceWorkerTaintingSynthesized;
166 bool documentHasUserInteracted;
167 bool allowListFutureDocumentsCreatedFromThisRedirectChain;
168 bool needForCheckingAntiTrackingHeuristic;
170 nsString integrityMetadata;
171 bool skipContentSniffing;
172 uint32_t httpsOnlyStatus;
174 bool hasValidUserGestureActivation;
175 bool allowDeprecatedSystemRequests;
176 bool isInDevToolsContext;
177 bool parserCreatedScript;
178 bool isFromProcessingFrameAttributes;
180 bool isMediaInitialRequest;
181 bool isFromObjectOrEmbed;
182 CookieJarSettingsArgs cookieJarSettings;
183 uint32_t requestBlockingReason;
184 CSPInfo? cspToInheritInfo;
185 StoragePermissionState storagePermission;
186 uint64_t? overriddenFingerprintingSettings;
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.
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
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
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;
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;
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
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
295 IPCServiceWorkerDescriptor? controller;
297 uint32_t requestBlockingReason;
300 //-----------------------------------------------------------------------------
302 //-----------------------------------------------------------------------------
304 struct CorsPreflightArgs
306 nsCString[] unsafeHeaders;
309 struct HttpChannelOpenArgs
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;
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;
330 uint64_t requestContextID;
332 uint64_t contentWindowId;
334 uint64_t earlyHintPreloaderId;
335 nsCString requestMethod;
336 ClassOfService classOfService;
338 nsCString appCacheClientID;
339 CorsPreflightArgs? preflightArgs;
340 nsCString contentTypeHint;
341 nsString integrityMetadata;
342 IPCStream? uploadStream;
343 LoadInfoArgs loadInfo;
345 uint32_t thirdPartyFlags;
348 uint32_t initialRwin;
349 uint32_t redirectMode;
351 bool uploadStreamHasHeaders;
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
390 uint32_t resolveFlags;
391 nsCString proxyAuthorizationHeader;
392 nsCString connectionIsolationKey;
395 struct HttpConnectionInfoCloneArgs
401 OriginAttributes originAttributes;
403 nsCString routedHost;
406 bool aPrivate; // use prefix to avoid code generation error
411 bool anonymousAllowClientCert;
412 bool fallbackConnection;
415 bool isTrrServiceChannel;
419 nsCString topWindowOrigin;
422 bool hasIPHintAddress;
424 ProxyInfoCloneArgs[] proxyInfo;
427 struct ConsoleReportCollected {
430 uint32_t propertiesFile;
431 nsCString sourceFileURI;
433 uint32_t columnNumber;
434 nsCString messageName;
435 nsString[] stringParams;
445 int64_t lastAccessed;
446 int64_t creationTime;
456 struct DocumentCreationArgs {
458 bool isEmbeddingBlockedError;
461 struct ObjectCreationArgs {
462 uint64_t embedderInnerWindowId;
464 nsContentPolicyType contentPolicyType;
468 union DocumentChannelElementCreationArgs {
469 DocumentCreationArgs;
473 struct DocumentChannelCreationArgs {
474 nsDocShellLoadState loadState;
475 TimeStamp asyncOpenTime;
478 nullable nsDOMNavigationTiming timing;
479 IPCClientInfo? initialClientInfo;
480 DocumentChannelElementCreationArgs elementCreationArgs;
481 uint64_t parentInitiatedNavigationEpoch;
484 struct EarlyHintConnectArgs {
486 uint64_t earlyHintPreloaderId;
489 struct RedirectToRealChannelArgs {
490 uint32_t registrarId;
492 uint32_t newLoadFlags;
493 ReplacementChannelConfigInit? init;
494 LoadInfoArgs loadInfo;
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;
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;
560 struct HttpConnectionActivity
562 nsCString connInfoKey;
570 union HttpActivityArgs
574 HttpConnectionActivity;
577 struct TransactionObserverResult
581 nsresult closeReason;
584 struct SpeculativeConnectionOverriderArgs {
585 uint32_t parallelSpeculativeConnectLimit;
587 bool isFromPredictor;
591 //-----------------------------------------------------------------------------
593 //-----------------------------------------------------------------------------
595 struct GIOChannelOpenArgs
600 IPCStream? uploadStream;
601 LoadInfoArgs loadInfo;
605 struct GIOChannelConnectArgs
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;
622 } // namespace mozilla