1 /* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 8 -*- */
2 /* vim: set sw=4 ts=8 et tw=80 ft=cpp : */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 include "mozilla/dom/DomSecurityIPCUtils.h";
8 include "mozilla/GfxMessageUtils.h";
9 include "mozilla/dom/CSPMessageUtils.h";
10 include "mozilla/dom/DocShellMessageUtils.h";
11 include "mozilla/dom/PermissionMessageUtils.h";
12 include "mozilla/dom/PropertyBagUtils.h";
13 include "mozilla/dom/ReferrerInfoUtils.h";
14 include "mozilla/dom/TabMessageUtils.h";
15 include "mozilla/ipc/URIUtils.h";
16 include "mozilla/layers/LayersMessageUtils.h";
17 include "mozilla/net/NeckoMessageUtils.h";
21 include ProtocolTypes;
23 using struct mozilla::void_t from "mozilla/ipc/IPCCore.h";
25 [MoveOnly=data] using struct mozilla::SerializedStructuredCloneBuffer
26 from "mozilla/ipc/SerializedStructuredCloneBuffer.h";
28 using struct mozilla::dom::LoadingSessionHistoryInfo
29 from "mozilla/dom/SessionHistoryEntry.h";
31 using mozilla::net::ClassOfService from "mozilla/net/ClassOfService.h";
34 using mozilla::hal::ScreenOrientation from "mozilla/HalIPCUtils.h";
35 using mozilla::LayoutDeviceIntRect from "Units.h";
36 using mozilla::DesktopIntRect from "Units.h";
37 using mozilla::DesktopToLayoutDeviceScale from "Units.h";
38 using mozilla::CSSToLayoutDeviceScale from "Units.h";
39 using mozilla::CSSRect from "Units.h";
40 using mozilla::CSSSize from "Units.h";
41 using mozilla::ScreenIntSize from "Units.h";
42 using mozilla::LayoutDeviceIntPoint from "Units.h";
43 using mozilla::ImageIntSize from "Units.h";
44 using nsSizeMode from "nsIWidgetListener.h";
45 using mozilla::ScrollbarPreference from "mozilla/ScrollbarPreferences.h";
46 using mozilla::gfx::SurfaceFormat from "mozilla/gfx/Types.h";
47 using nsILoadInfo::HTTPSUpgradeTelemetryType from "nsILoadInfo.h";
48 [RefCounted] using class nsIPrincipal from "nsIPrincipal.h";
49 using mozilla::dom::MaybeDiscardedBrowsingContext from "mozilla/dom/BrowsingContext.h";
50 [RefCounted] using class nsIURI from "nsIURI.h";
51 [RefCounted] using class nsIContentSecurityPolicy from "nsIContentSecurityPolicy.h";
52 [RefCounted] using class nsIInputStream from "mozilla/ipc/IPCStreamUtils.h";
53 [RefCounted] using class nsIReferrerInfo from "nsIReferrerInfo.h";
54 [RefCounted] using class nsIVariant from "nsIVariant.h";
55 using mozilla::TimeStamp from "mozilla/TimeStamp.h";
56 [RefCounted] using class mozilla::RemoteLazyInputStream from "mozilla/RemoteLazyInputStream.h";
57 [MoveOnly] using class mozilla::ipc::BigBuffer from "mozilla/ipc/BigBuffer.h";
62 struct MessagePortIdentifier
71 * Cross-process representation for postMessage() style payloads where Blobs may
72 * be referenced/"cloned" and (optionally) messageports transferred. Use
73 * StructuredCloneData in your code to convert between this wire representation
74 * and the StructuredCloneData StructuredCloneHolder-subclass.
76 struct ClonedMessageData
78 SerializedStructuredCloneBuffer data;
80 IPCStream[] inputStreams;
81 MessagePortIdentifier[] identifiers;
84 struct ErrorMessageData {
87 union ClonedOrErrorMessageData {
92 struct RefMessageData {
96 union MessageDataType {
102 nsID? agentClusterId;
103 MessageDataType data;
106 struct ScreenDetails {
107 LayoutDeviceIntRect rect;
108 DesktopIntRect rectDisplayPix;
109 LayoutDeviceIntRect availRect;
110 DesktopIntRect availRectDisplayPix;
113 uint32_t refreshRate; // In Hz, or 0 if not known.
114 DesktopToLayoutDeviceScale contentsScaleFactor;
115 CSSToLayoutDeviceScale defaultCSSScaleFactor;
117 ScreenOrientation orientation;
118 uint16_t orientationAngle;
119 bool isPseudoDisplay;
127 LayoutDeviceIntPoint clientOffset;
128 LayoutDeviceIntPoint chromeOffset;
131 struct FrameScriptInfo
134 bool runInGlobalScope;
138 * The information required to complete a window creation request.
140 struct CreatedWindowInfo
144 FrameScriptInfo[] frameScripts;
145 uint32_t maxTouchPoints;
146 DimensionInfo dimensions;
150 struct DocShellLoadStateInit
153 nullable nsIURI OriginalURI;
154 nullable nsIURI ResultPrincipalURI;
155 nullable nsIPrincipal TriggeringPrincipal;
156 nullable nsIReferrerInfo ReferrerInfo;
157 nullable nsIPrincipal PrincipalToInherit;
158 nullable nsIPrincipal PartitionedPrincipalToInherit;
159 nullable nsIURI BaseURI;
160 // The Content Security Policy of the load, that is, the CSP of the entity
161 // responsible for causing the load to occur. Most likely this is the CSP
162 // of the document that started the load. In case the entity starting the
163 // load did not use a CSP, then Csp can be null. Please note that this is
164 // also the CSP that will be applied to the load in case the load
165 // encounters a server side redirect.
166 nullable nsIContentSecurityPolicy Csp;
167 nullable nsIInputStream PostDataStream;
168 nullable nsIInputStream HeadersStream;
169 nullable nsIURI UnstrippedURI;
170 uint64_t LoadIdentifier;
175 MaybeDiscardedBrowsingContext SourceBrowsingContext;
176 MaybeDiscardedBrowsingContext TargetBrowsingContext;
178 // The provided remote type of the process responsible for causing the load to
179 // occur. Validated in the parent process.
180 nsCString TriggeringRemoteType;
182 nsString SrcdocData; // useless without sourcedocshell
184 nsCString? OriginalURIString;
186 nsCString? RemoteTypeOverride;
188 LoadingSessionHistoryInfo? loadingSessionHistoryInfo;
192 uint32_t InternalLoadFlags;
194 // The TriggineringSandboxFlags are the SandboxFlags of the entity
195 // responsible for causing the load to occur.
196 uint32_t TriggeringSandboxFlags;
197 uint64_t TriggeringWindowId;
198 bool TriggeringStorageAccess;
199 int32_t? CancelContentJSEpoch;
201 bool ResultPrincipalURIIsSome;
202 bool KeepResultPrincipalURIIfSet;
204 bool InheritPrincipal;
205 bool PrincipalIsExplicit;
206 bool ForceAllowDataURI;
207 bool IsExemptFromHTTPSFirstMode;
208 bool OriginalFrameSrc;
209 bool IsFormSubmission;
211 bool HasValidUserGestureActivation;
212 bool TextDirectiveUserActivation;
214 bool IsFromProcessingFrameAttributes;
215 bool WasSchemelessInput;
216 HTTPSUpgradeTelemetryType HttpsUpgradeTelemetry;
218 // Fields missing due to lack of need or serialization
219 // nsCOMPtr<nsIDocShell> mSourceDocShell;
220 // bool mIsSrcDocLoad; // useless without sourcedocshell
221 // nsIChannel pendingRedirectedChannel; // sent through other mechanism
223 bool ChannelInitialized;
225 bool TryToReplaceWithSessionHistoryLoad;
230 struct TimedChannelInfo
233 int8_t redirectCount;
234 int8_t internalRedirectCount;
236 TimeStamp channelCreation;
237 TimeStamp redirectStart;
238 TimeStamp redirectEnd;
239 nsString initiatorType;
240 bool allRedirectsSameOrigin;
241 bool allRedirectsPassTimingAllowCheck;
242 bool? timingAllowCheckForPrincipal;
244 TimeStamp launchServiceWorkerStart;
245 TimeStamp launchServiceWorkerEnd;
246 TimeStamp dispatchFetchEventStart;
247 TimeStamp dispatchFetchEventEnd;
248 TimeStamp handleFetchEventStart;
249 TimeStamp handleFetchEventEnd;
250 TimeStamp responseStart;
251 TimeStamp responseEnd;
254 struct ReplacementChannelConfigInit
256 uint32_t redirectFlags;
257 ClassOfService classOfService;
258 bool? privateBrowsing;
260 nullable nsIReferrerInfo referrerInfo;
261 TimedChannelInfo? timedChannelInfo;
262 nullable RemoteLazyInputStream uploadStream;
263 uint64_t uploadStreamLength;
264 bool uploadStreamHasHeaders;
265 nsCString? contentType;
266 nsCString? contentLength;
269 union IPDLVariantValue
272 uint8_t; // In practice, uint8_t and uint16_t are likely unneeded,
273 int16_t; // as signed->unsigned->signed has universal behavior.
274 uint16_t; // but those conversions are only guaranteed in C++20.
283 nullable nsIPrincipal;
288 uint32_t type; // We explicitly store the original nsIVariant type so that
289 // the conversion back into a nsVariant later is lossless.
290 IPDLVariantValue data;
296 nullable nsIVariant value;
299 // Struct with information to show a frame from the parent process.
300 struct ParentShowInfo
306 int32_t widgetRounding;
310 // Struct with information to show an iframe from the process that owns the
312 struct OwnerShowInfo {
313 // This can be an IntSize rather than a Rect because content processes always
314 // render to a virtual <0, 0> top-left point.
317 // TODO(emilio): Margin preferences go here.
318 ScrollbarPreference scrollbarPreference;
320 // TODO(emilio): I think we should really be able to figure this out from the
321 // parent process too instead.
328 SurfaceFormat format;
333 } // namespace mozilla