Bug 1861467 - [wpt-sync] Update web-platform-tests to eedf737ce39c512d0ca3471f988972e...
[gecko.git] / dom / ipc / DOMTypes.ipdlh
blobfaee4e861ceb0b0ccf5f741e844ab2733ab4507d
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/GfxMessageUtils.h";
8 include "mozilla/dom/CSPMessageUtils.h";
9 include "mozilla/dom/DocShellMessageUtils.h";
10 include "mozilla/dom/PermissionMessageUtils.h";
11 include "mozilla/dom/PropertyBagUtils.h";
12 include "mozilla/dom/ReferrerInfoUtils.h";
13 include "mozilla/dom/TabMessageUtils.h";
14 include "mozilla/ipc/URIUtils.h";
15 include "mozilla/layers/LayersMessageUtils.h";
16 include "mozilla/net/ClassOfService.h";
18 include IPCBlob;
19 include IPCStream;
20 include ProtocolTypes;
22 using struct mozilla::void_t from "mozilla/ipc/IPCCore.h";
24 [MoveOnly=data] using struct mozilla::SerializedStructuredCloneBuffer
25   from "mozilla/ipc/SerializedStructuredCloneBuffer.h";
27 using struct mozilla::dom::LoadingSessionHistoryInfo
28   from "mozilla/dom/SessionHistoryEntry.h";
30 using mozilla::net::ClassOfService from "mozilla/net/ClassOfService.h";
33 using mozilla::hal::ScreenOrientation from "mozilla/HalIPCUtils.h";
34 using mozilla::LayoutDeviceIntRect from "Units.h";
35 using mozilla::DesktopIntRect from "Units.h";
36 using mozilla::DesktopToLayoutDeviceScale from "Units.h";
37 using mozilla::CSSToLayoutDeviceScale from "Units.h";
38 using mozilla::CSSRect from "Units.h";
39 using mozilla::CSSSize from "Units.h";
40 using mozilla::ScreenIntSize from "Units.h";
41 using mozilla::LayoutDeviceIntPoint from "Units.h";
42 using nsSizeMode from "nsIWidgetListener.h";
43 using mozilla::ScrollbarPreference from "mozilla/ScrollbarPreferences.h";
44 using mozilla::gfx::SurfaceFormat from "mozilla/gfx/Types.h";
45 [RefCounted] using class nsIPrincipal from "nsIPrincipal.h";
46 using mozilla::dom::MaybeDiscardedBrowsingContext from "mozilla/dom/BrowsingContext.h";
47 [RefCounted] using class nsIURI from "nsIURI.h";
48 [RefCounted] using class nsIContentSecurityPolicy from "nsIContentSecurityPolicy.h";
49 [RefCounted] using class nsIInputStream from "mozilla/ipc/IPCStreamUtils.h";
50 [RefCounted] using class nsIReferrerInfo from "nsIReferrerInfo.h";
51 [RefCounted] using class nsIVariant from "nsIVariant.h";
52 using mozilla::TimeStamp from "mozilla/TimeStamp.h";
53 [RefCounted] using class mozilla::RemoteLazyInputStream from "mozilla/RemoteLazyInputStream.h";
54 [MoveOnly] using class mozilla::ipc::BigBuffer from "mozilla/ipc/BigBuffer.h";
56 namespace mozilla {
57 namespace dom {
59 struct MessagePortIdentifier
61   nsID uuid;
62   nsID destinationUuid;
63   uint32_t sequenceId;
64   bool neutered;
67 /**
68  * Cross-process representation for postMessage() style payloads where Blobs may
69  * be referenced/"cloned" and (optionally) messageports transferred.  Use
70  * StructuredCloneData in your code to convert between this wire representation
71  * and the StructuredCloneData StructuredCloneHolder-subclass.
72  */
73 struct ClonedMessageData
75   SerializedStructuredCloneBuffer data;
76   IPCBlob[] blobs;
77   IPCStream[] inputStreams;
78   MessagePortIdentifier[] identifiers;
81 struct ErrorMessageData {
84 union ClonedOrErrorMessageData {
85   ClonedMessageData;
86   ErrorMessageData;
89 struct RefMessageData {
90   nsID uuid;
93 union MessageDataType {
94   ClonedMessageData;
95   RefMessageData;
98 struct MessageData {
99   nsID? agentClusterId;
100   MessageDataType data;
103 struct ScreenDetails {
104   LayoutDeviceIntRect rect;
105   DesktopIntRect rectDisplayPix;
106   LayoutDeviceIntRect availRect;
107   DesktopIntRect availRectDisplayPix;
108   int32_t pixelDepth;
109   int32_t colorDepth;
110   uint32_t refreshRate; // In Hz, or 0 if not known.
111   DesktopToLayoutDeviceScale contentsScaleFactor;
112   CSSToLayoutDeviceScale defaultCSSScaleFactor;
113   float dpi;
114   ScreenOrientation orientation;
115   uint16_t orientationAngle;
116   bool isPseudoDisplay;
119 struct DimensionInfo
121   CSSRect rect;
122   CSSSize size;
123   LayoutDeviceIntPoint clientOffset;
124   LayoutDeviceIntPoint chromeOffset;
127 struct FrameScriptInfo
129   nsString url;
130   bool runInGlobalScope;
133 struct FeaturePolicyInfo
135   nsString[]   inheritedDeniedFeatureNames;
136   nsString[]   attributeEnabledFeatureNames;
137   nsString     declaredString;
138   nullable nsIPrincipal defaultOrigin;
139   nullable nsIPrincipal selfOrigin;
140   nullable nsIPrincipal srcOrigin;
144  * The information required to complete a window creation request.
145  */
146 struct CreatedWindowInfo
148   nsresult rv;
149   bool windowOpened;
150   FrameScriptInfo[] frameScripts;
151   uint32_t maxTouchPoints;
152   DimensionInfo dimensions;
156 struct DocShellLoadStateInit
158   nullable nsIURI URI;
159   nullable nsIURI OriginalURI;
160   nullable nsIURI ResultPrincipalURI;
161   nullable nsIPrincipal TriggeringPrincipal;
162   nullable nsIReferrerInfo ReferrerInfo;
163   nullable nsIPrincipal PrincipalToInherit;
164   nullable nsIPrincipal PartitionedPrincipalToInherit;
165   nullable nsIURI BaseURI;
166   // The Content Security Policy of the load, that is, the CSP of the entity
167   // responsible for causing the load to occur. Most likely this is the CSP
168   // of the document that started the load. In case the entity starting the
169   // load did not use a CSP, then Csp can be null. Please note that this is
170   // also the CSP that will be applied to the load in case the load
171   // encounters a server side redirect.
172   nullable nsIContentSecurityPolicy Csp;
173   nullable nsIInputStream PostDataStream;
174   nullable nsIInputStream HeadersStream;
175   nullable nsIURI UnstrippedURI;
176   uint64_t LoadIdentifier;
177   nsString Target;
178   nsCString TypeHint;
179   nsString FileName;
181   MaybeDiscardedBrowsingContext SourceBrowsingContext;
182   MaybeDiscardedBrowsingContext TargetBrowsingContext;
184   // The provided remote type of the process responsible for causing the load to
185   // occur. Validated in the parent process.
186   nsCString TriggeringRemoteType;
188   nsString SrcdocData; // useless without sourcedocshell
190   nsCString? OriginalURIString;
192   nsCString? RemoteTypeOverride;
194   LoadingSessionHistoryInfo? loadingSessionHistoryInfo;
196   uint32_t LoadType;
197   uint32_t LoadFlags;
198   uint32_t InternalLoadFlags;
199   
200   // The TriggineringSandboxFlags are the SandboxFlags of the entity
201   // responsible for causing the load to occur.
202   uint32_t TriggeringSandboxFlags;
203   uint64_t TriggeringWindowId;
204   bool TriggeringStorageAccess;
205   int32_t? CancelContentJSEpoch;
207   bool ResultPrincipalURIIsSome;
208   bool KeepResultPrincipalURIIfSet;
209   bool LoadReplace;
210   bool InheritPrincipal;
211   bool PrincipalIsExplicit;
212   bool ForceAllowDataURI;
213   bool IsExemptFromHTTPSFirstMode;
214   bool OriginalFrameSrc;
215   bool IsFormSubmission;
216   bool FirstParty;
217   bool HasValidUserGestureActivation;
218   bool AllowFocusMove;
219   bool IsFromProcessingFrameAttributes;
220   bool WasSchemelessInput;
222   // Fields missing due to lack of need or serialization
223   // nsCOMPtr<nsIDocShell> mSourceDocShell;
224   // bool mIsSrcDocLoad; // useless without sourcedocshell
225   // nsIChannel pendingRedirectedChannel; // sent through other mechanism
227   bool ChannelInitialized;
229   bool TryToReplaceWithSessionHistoryLoad;
231   bool IsMetaRefresh;
234 struct TimedChannelInfo
236   bool timingEnabled;
237   int8_t redirectCount;
238   int8_t internalRedirectCount;
239   TimeStamp asyncOpen;
240   TimeStamp channelCreation;
241   TimeStamp redirectStart;
242   TimeStamp redirectEnd;
243   nsString initiatorType;
244   bool allRedirectsSameOrigin;
245   bool allRedirectsPassTimingAllowCheck;
246   bool? timingAllowCheckForPrincipal;
247   TimeStamp launchServiceWorkerStart;
248   TimeStamp launchServiceWorkerEnd;
249   TimeStamp dispatchFetchEventStart;
250   TimeStamp dispatchFetchEventEnd;
251   TimeStamp handleFetchEventStart;
252   TimeStamp handleFetchEventEnd;
253   TimeStamp responseStart;
254   TimeStamp responseEnd;
257 struct ReplacementChannelConfigInit
259   uint32_t redirectFlags;
260   ClassOfService classOfService;
261   bool? privateBrowsing;
262   nsCString? method;
263   nullable nsIReferrerInfo referrerInfo;
264   TimedChannelInfo? timedChannelInfo;
265   nullable RemoteLazyInputStream uploadStream;
266   uint64_t uploadStreamLength;
267   bool uploadStreamHasHeaders;
268   nsCString? contentType;
269   nsCString? contentLength;
272 union IPDLVariantValue
274   bool;
275   uint8_t;   // In practice, uint8_t and uint16_t are likely unneeded,
276   int16_t;   // as signed->unsigned->signed has universal behavior.
277   uint16_t;  // but those conversions are only guaranteed in C++20.
278   int32_t;
279   uint32_t;
280   float;
281   double;
282   nsID;
283   nsString;
284   nsCString;
285   nullable nsIURI;
286   nullable nsIPrincipal;
289 struct IDPLVariant
291   uint32_t type;  // We explicitly store the original nsIVariant type so that
292                   // the conversion back into a nsVariant later is lossless.
293   IPDLVariantValue data;
296 struct IPDLProperty
298   nsString name;
299   nullable nsIVariant value;
302 // Struct with information to show a frame from the parent process.
303 struct ParentShowInfo
305   nsString name;
306   bool fakeShowInfo;
307   bool isTransparent;
308   float dpi;
309   int32_t widgetRounding;
310   double defaultScale;
313 // Struct with information to show an iframe from the process that owns the
314 // frame.
315 struct OwnerShowInfo {
316   // This can be an IntSize rather than a Rect because content processes always
317   // render to a virtual <0, 0> top-left point.
318   ScreenIntSize size;
320   // TODO(emilio): Margin preferences go here.
321   ScrollbarPreference scrollbarPreference;
323   // TODO(emilio): I think we should really be able to figure this out from the
324   // parent process too instead.
325   nsSizeMode sizeMode;
328 } // namespace dom
329 } // namespace mozilla