Bug 1886946: Remove incorrect assertion that buffer is not-pinned. r=sfink
[gecko.git] / dom / ipc / DOMTypes.ipdlh
blob1be3537e6853e9eb79c471fc9c35d5b9da511989
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;
117   bool isHDR;
120 struct DimensionInfo
122   CSSRect rect;
123   CSSSize size;
124   LayoutDeviceIntPoint clientOffset;
125   LayoutDeviceIntPoint chromeOffset;
128 struct FrameScriptInfo
130   nsString url;
131   bool runInGlobalScope;
134 struct FeaturePolicyInfo
136   nsString[]   inheritedDeniedFeatureNames;
137   nsString[]   attributeEnabledFeatureNames;
138   nsString     declaredString;
139   nullable nsIPrincipal defaultOrigin;
140   nullable nsIPrincipal selfOrigin;
141   nullable nsIPrincipal srcOrigin;
145  * The information required to complete a window creation request.
146  */
147 struct CreatedWindowInfo
149   nsresult rv;
150   bool windowOpened;
151   FrameScriptInfo[] frameScripts;
152   uint32_t maxTouchPoints;
153   DimensionInfo dimensions;
157 struct DocShellLoadStateInit
159   nullable nsIURI URI;
160   nullable nsIURI OriginalURI;
161   nullable nsIURI ResultPrincipalURI;
162   nullable nsIPrincipal TriggeringPrincipal;
163   nullable nsIReferrerInfo ReferrerInfo;
164   nullable nsIPrincipal PrincipalToInherit;
165   nullable nsIPrincipal PartitionedPrincipalToInherit;
166   nullable nsIURI BaseURI;
167   // The Content Security Policy of the load, that is, the CSP of the entity
168   // responsible for causing the load to occur. Most likely this is the CSP
169   // of the document that started the load. In case the entity starting the
170   // load did not use a CSP, then Csp can be null. Please note that this is
171   // also the CSP that will be applied to the load in case the load
172   // encounters a server side redirect.
173   nullable nsIContentSecurityPolicy Csp;
174   nullable nsIInputStream PostDataStream;
175   nullable nsIInputStream HeadersStream;
176   nullable nsIURI UnstrippedURI;
177   uint64_t LoadIdentifier;
178   nsString Target;
179   nsCString TypeHint;
180   nsString FileName;
182   MaybeDiscardedBrowsingContext SourceBrowsingContext;
183   MaybeDiscardedBrowsingContext TargetBrowsingContext;
185   // The provided remote type of the process responsible for causing the load to
186   // occur. Validated in the parent process.
187   nsCString TriggeringRemoteType;
189   nsString SrcdocData; // useless without sourcedocshell
191   nsCString? OriginalURIString;
193   nsCString? RemoteTypeOverride;
195   LoadingSessionHistoryInfo? loadingSessionHistoryInfo;
197   uint32_t LoadType;
198   uint32_t LoadFlags;
199   uint32_t InternalLoadFlags;
200   
201   // The TriggineringSandboxFlags are the SandboxFlags of the entity
202   // responsible for causing the load to occur.
203   uint32_t TriggeringSandboxFlags;
204   uint64_t TriggeringWindowId;
205   bool TriggeringStorageAccess;
206   int32_t? CancelContentJSEpoch;
208   bool ResultPrincipalURIIsSome;
209   bool KeepResultPrincipalURIIfSet;
210   bool LoadReplace;
211   bool InheritPrincipal;
212   bool PrincipalIsExplicit;
213   bool ForceAllowDataURI;
214   bool IsExemptFromHTTPSFirstMode;
215   bool OriginalFrameSrc;
216   bool IsFormSubmission;
217   bool FirstParty;
218   bool HasValidUserGestureActivation;
219   bool AllowFocusMove;
220   bool IsFromProcessingFrameAttributes;
221   bool WasSchemelessInput;
223   // Fields missing due to lack of need or serialization
224   // nsCOMPtr<nsIDocShell> mSourceDocShell;
225   // bool mIsSrcDocLoad; // useless without sourcedocshell
226   // nsIChannel pendingRedirectedChannel; // sent through other mechanism
228   bool ChannelInitialized;
230   bool TryToReplaceWithSessionHistoryLoad;
232   bool IsMetaRefresh;
235 struct TimedChannelInfo
237   bool timingEnabled;
238   int8_t redirectCount;
239   int8_t internalRedirectCount;
240   TimeStamp asyncOpen;
241   TimeStamp channelCreation;
242   TimeStamp redirectStart;
243   TimeStamp redirectEnd;
244   nsString initiatorType;
245   bool allRedirectsSameOrigin;
246   bool allRedirectsPassTimingAllowCheck;
247   bool? timingAllowCheckForPrincipal;
248   TimeStamp launchServiceWorkerStart;
249   TimeStamp launchServiceWorkerEnd;
250   TimeStamp dispatchFetchEventStart;
251   TimeStamp dispatchFetchEventEnd;
252   TimeStamp handleFetchEventStart;
253   TimeStamp handleFetchEventEnd;
254   TimeStamp responseStart;
255   TimeStamp responseEnd;
258 struct ReplacementChannelConfigInit
260   uint32_t redirectFlags;
261   ClassOfService classOfService;
262   bool? privateBrowsing;
263   nsCString? method;
264   nullable nsIReferrerInfo referrerInfo;
265   TimedChannelInfo? timedChannelInfo;
266   nullable RemoteLazyInputStream uploadStream;
267   uint64_t uploadStreamLength;
268   bool uploadStreamHasHeaders;
269   nsCString? contentType;
270   nsCString? contentLength;
273 union IPDLVariantValue
275   bool;
276   uint8_t;   // In practice, uint8_t and uint16_t are likely unneeded,
277   int16_t;   // as signed->unsigned->signed has universal behavior.
278   uint16_t;  // but those conversions are only guaranteed in C++20.
279   int32_t;
280   uint32_t;
281   float;
282   double;
283   nsID;
284   nsString;
285   nsCString;
286   nullable nsIURI;
287   nullable nsIPrincipal;
290 struct IDPLVariant
292   uint32_t type;  // We explicitly store the original nsIVariant type so that
293                   // the conversion back into a nsVariant later is lossless.
294   IPDLVariantValue data;
297 struct IPDLProperty
299   nsString name;
300   nullable nsIVariant value;
303 // Struct with information to show a frame from the parent process.
304 struct ParentShowInfo
306   nsString name;
307   bool fakeShowInfo;
308   bool isTransparent;
309   float dpi;
310   int32_t widgetRounding;
311   double defaultScale;
314 // Struct with information to show an iframe from the process that owns the
315 // frame.
316 struct OwnerShowInfo {
317   // This can be an IntSize rather than a Rect because content processes always
318   // render to a virtual <0, 0> top-left point.
319   ScreenIntSize size;
321   // TODO(emilio): Margin preferences go here.
322   ScrollbarPreference scrollbarPreference;
324   // TODO(emilio): I think we should really be able to figure this out from the
325   // parent process too instead.
326   nsSizeMode sizeMode;
329 } // namespace dom
330 } // namespace mozilla