tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

DOMTypes.ipdlh (11674B)


      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/. */
      6 
      7 include "mozilla/dom/DomSecurityIPCUtils.h";
      8 include "mozilla/GfxMessageUtils.h";
      9 include "mozilla/dom/CSPMessageUtils.h";
     10 include "mozilla/dom/PolicyContainerMessageUtils.h";
     11 include "mozilla/dom/DocShellMessageUtils.h";
     12 include "mozilla/dom/NavigationAPIIPCUtils.h";
     13 include "mozilla/dom/PermissionMessageUtils.h";
     14 include "mozilla/dom/PropertyBagUtils.h";
     15 include "mozilla/dom/ReferrerInfoUtils.h";
     16 include "mozilla/dom/TabMessageUtils.h";
     17 include "mozilla/dom/notification/IPCUtils.h";
     18 include "mozilla/ipc/URIUtils.h";
     19 include "mozilla/layers/LayersMessageUtils.h";
     20 include "mozilla/net/NeckoMessageUtils.h";
     21 include "mozilla/URLClassifierIPCUtils.h";
     22 
     23 include IPCBlob;
     24 include IPCStream;
     25 include ProtocolTypes;
     26 
     27 using struct mozilla::void_t from "mozilla/ipc/IPCCore.h";
     28 
     29 [MoveOnly=data] using struct mozilla::SerializedStructuredCloneBuffer
     30   from "mozilla/ipc/SerializedStructuredCloneBuffer.h";
     31 
     32 using struct mozilla::dom::LoadingSessionHistoryInfo
     33   from "mozilla/dom/SessionHistoryEntry.h";
     34 
     35 using mozilla::net::ClassOfService from "mozilla/net/ClassOfService.h";
     36 
     37 
     38 using mozilla::hal::ScreenOrientation from "mozilla/HalIPCUtils.h";
     39 using mozilla::LayoutDeviceIntRect from "Units.h";
     40 using mozilla::DesktopIntRect from "Units.h";
     41 using mozilla::DesktopToLayoutDeviceScale from "Units.h";
     42 using mozilla::CSSToLayoutDeviceScale from "Units.h";
     43 using mozilla::CSSRect from "Units.h";
     44 using mozilla::CSSSize from "Units.h";
     45 using mozilla::LayoutDeviceIntSize from "Units.h";
     46 using mozilla::LayoutDeviceIntPoint from "Units.h";
     47 using mozilla::ImageIntSize from "Units.h";
     48 using nsSizeMode from "nsIWidgetListener.h";
     49 using mozilla::ScrollbarPreference from "mozilla/ScrollbarPreferences.h";
     50 using mozilla::gfx::SurfaceFormat from "mozilla/gfx/Types.h";
     51 using nsILoadInfo::HTTPSUpgradeTelemetryType from "nsILoadInfo.h";
     52 using nsILoadInfo::SchemelessInputType from "nsILoadInfo.h";
     53 [RefCounted] using class nsIPrincipal from "nsIPrincipal.h";
     54 using mozilla::dom::MaybeDiscardedBrowsingContext from "mozilla/dom/BrowsingContext.h";
     55 [RefCounted] using class nsIURI from "nsIURI.h";
     56 [RefCounted] using class nsIPolicyContainer from "nsIPolicyContainer.h";
     57 [RefCounted] using class nsIInputStream from "mozilla/ipc/IPCStreamUtils.h";
     58 [RefCounted] using class nsIReferrerInfo from "nsIReferrerInfo.h";
     59 [RefCounted] using class nsIVariant from "nsIVariant.h";
     60 using mozilla::TimeStamp from "mozilla/TimeStamp.h";
     61 [RefCounted] using class mozilla::RemoteLazyInputStream from "mozilla/RemoteLazyInputStream.h";
     62 [MoveOnly] using class mozilla::ipc::BigBuffer from "mozilla/ipc/BigBuffer.h";
     63 using mozilla::dom::NotificationDirection from "mozilla/dom/NotificationBinding.h";
     64 using mozilla::dom::UserNavigationInvolvement from "mozilla/dom/UserNavigationInvolvement.h";
     65 using mozilla::net::ClassificationFlags from "nsIClassifiedChannel.h";
     66 using mozilla::dom::ForceMediaDocument from "mozilla/dom/LoadURIOptionsBinding.h";
     67 using mozilla::dom::NavigationHistoryBehavior from "mozilla/dom/NavigationBinding.h";
     68 
     69 namespace mozilla {
     70 namespace dom {
     71 
     72 struct MessagePortIdentifier
     73 {
     74   nsID uuid;
     75   nsID destinationUuid;
     76   uint32_t sequenceId;
     77   bool neutered;
     78 };
     79 
     80 /**
     81  * Cross-process representation for postMessage() style payloads where Blobs may
     82  * be referenced/"cloned" and (optionally) messageports transferred.  Use
     83  * StructuredCloneData in your code to convert between this wire representation
     84  * and the StructuredCloneData StructuredCloneHolder-subclass.
     85  */
     86 struct ClonedMessageData
     87 {
     88   SerializedStructuredCloneBuffer data;
     89   IPCBlob[] blobs;
     90   IPCStream[] inputStreams;
     91   MessagePortIdentifier[] identifiers;
     92 };
     93 
     94 struct ErrorMessageData {
     95 };
     96 
     97 union ClonedOrErrorMessageData {
     98   ClonedMessageData;
     99   ErrorMessageData;
    100 };
    101 
    102 struct RefMessageData {
    103   nsID uuid;
    104 };
    105 
    106 union MessageDataType {
    107   ClonedMessageData;
    108   RefMessageData;
    109 };
    110 
    111 struct MessageData {
    112   nsID? agentClusterId;
    113   MessageDataType data;
    114 };
    115 
    116 struct ScreenDetails {
    117   LayoutDeviceIntRect rect;
    118   DesktopIntRect rectDisplayPix;
    119   LayoutDeviceIntRect availRect;
    120   DesktopIntRect availRectDisplayPix;
    121   int32_t pixelDepth;
    122   int32_t colorDepth;
    123   uint32_t refreshRate; // In Hz, or 0 if not known.
    124   DesktopToLayoutDeviceScale contentsScaleFactor;
    125   CSSToLayoutDeviceScale defaultCSSScaleFactor;
    126   float dpi;
    127   ScreenOrientation orientation;
    128   uint16_t orientationAngle;
    129   bool isPseudoDisplay;
    130   bool isHDR;
    131 };
    132 
    133 struct DimensionInfo
    134 {
    135   CSSRect rect;
    136   CSSSize size;
    137   LayoutDeviceIntPoint clientOffset;
    138   LayoutDeviceIntPoint chromeOffset;
    139 };
    140 
    141 struct FrameScriptInfo
    142 {
    143   nsString url;
    144   bool runInGlobalScope;
    145 };
    146 
    147 /**
    148  * The information required to complete a window creation request.
    149  */
    150 struct CreatedWindowInfo
    151 {
    152   nsresult rv;
    153   bool windowOpened;
    154   FrameScriptInfo[] frameScripts;
    155   uint32_t maxTouchPoints;
    156   DimensionInfo dimensions;
    157 };
    158 
    159 
    160 struct DocShellLoadStateInit
    161 {
    162   nullable nsIURI URI;
    163   nullable nsIURI OriginalURI;
    164   nullable nsIURI ResultPrincipalURI;
    165   nullable nsIPrincipal TriggeringPrincipal;
    166   nullable nsIReferrerInfo ReferrerInfo;
    167   nullable nsIPrincipal PrincipalToInherit;
    168   nullable nsIPrincipal PartitionedPrincipalToInherit;
    169   nullable nsIURI BaseURI;
    170   // The Policy Container of the load, that is, the policyContainer of the entity
    171   // responsible for causing the load to occur. Most likely this is the policyContainer
    172   // of the document that started the load. In case the entity starting the
    173   // load did not use a policyContainer, then policyContainer can be null. Please note that
    174   // this is also the policyContainer that will be applied to the load in case the load
    175   // encounters a server side redirect.
    176   nullable nsIPolicyContainer PolicyContainer;
    177   nullable nsIInputStream PostDataStream;
    178   nullable nsIInputStream HeadersStream;
    179   nullable nsIURI UnstrippedURI;
    180   uint64_t LoadIdentifier;
    181   nsString Target;
    182   nsCString TypeHint;
    183   nsString FileName;
    184 
    185   MaybeDiscardedBrowsingContext SourceBrowsingContext;
    186   MaybeDiscardedBrowsingContext TargetBrowsingContext;
    187 
    188   // The provided remote type of the process responsible for causing the load to
    189   // occur. Validated in the parent process.
    190   nsCString TriggeringRemoteType;
    191 
    192   nsString SrcdocData; // useless without sourcedocshell
    193 
    194   nsCString? OriginalURIString;
    195 
    196   nsCString? RemoteTypeOverride;
    197 
    198   LoadingSessionHistoryInfo? loadingSessionHistoryInfo;
    199 
    200   uint32_t LoadType;
    201   uint32_t LoadFlags;
    202   uint32_t InternalLoadFlags;
    203 
    204   // https://html.spec.whatwg.org/#user-navigation-involvement
    205   UserNavigationInvolvement userNavigationInvolvement;
    206 
    207   // The TriggeringSandboxFlags are the SandboxFlags of the entity
    208   // responsible for causing the load to occur.
    209   uint32_t TriggeringSandboxFlags;
    210   uint64_t TriggeringWindowId;
    211   bool TriggeringStorageAccess;
    212   ClassificationFlags TriggeringClassificationFlags;
    213   int32_t? CancelContentJSEpoch;
    214 
    215   bool ResultPrincipalURIIsSome;
    216   bool KeepResultPrincipalURIIfSet;
    217   bool LoadReplace;
    218   bool InheritPrincipal;
    219   bool PrincipalIsExplicit;
    220   bool NotifiedBeforeUnloadListeners;
    221   bool ForceAllowDataURI;
    222   bool IsExemptFromHTTPSFirstMode;
    223   bool OriginalFrameSrc;
    224   bool ShouldCheckForRecursion;
    225   bool IsFormSubmission;
    226   bool FirstParty;
    227   bool HasValidUserGestureActivation;
    228   bool TextDirectiveUserActivation;
    229   bool AllowFocusMove;
    230   bool IsFromProcessingFrameAttributes;
    231   bool NeedsCompletelyLoadedDocument;
    232   bool ShouldNotForceReplaceInOnLoad;
    233   NavigationHistoryBehavior? HistoryBehavior;
    234 
    235   SchemelessInputType SchemelessInput;
    236   ForceMediaDocument forceMediaDocument;
    237   HTTPSUpgradeTelemetryType HttpsUpgradeTelemetry;
    238 
    239   // https://html.spec.whatwg.org/#she-navigation-api-state
    240   ClonedMessageData? NavigationAPIState;
    241 
    242   // Fields missing due to lack of need or serialization
    243   // nsCOMPtr<nsIDocShell> mSourceDocShell;
    244   // bool mIsSrcDocLoad; // useless without sourcedocshell
    245   // nsIChannel pendingRedirectedChannel; // sent through other mechanism
    246 
    247   bool ChannelInitialized;
    248 
    249   bool TryToReplaceWithSessionHistoryLoad;
    250 
    251   bool IsMetaRefresh;
    252 
    253   bool IsCaptivePortalTab;
    254 
    255   bool IsInitialAboutBlankHandlingProhibited;
    256 };
    257 
    258 struct TimedChannelInfo
    259 {
    260   int8_t redirectCount;
    261   int8_t internalRedirectCount;
    262   TimeStamp asyncOpen;
    263   TimeStamp channelCreation;
    264   TimeStamp redirectStart;
    265   TimeStamp redirectEnd;
    266   nsString initiatorType;
    267   bool allRedirectsSameOrigin;
    268   bool allRedirectsPassTimingAllowCheck;
    269   bool? timingAllowCheckForPrincipal;
    270   bool renderBlocking;
    271   TimeStamp launchServiceWorkerStart;
    272   TimeStamp launchServiceWorkerEnd;
    273   TimeStamp dispatchFetchEventStart;
    274   TimeStamp dispatchFetchEventEnd;
    275   TimeStamp handleFetchEventStart;
    276   TimeStamp handleFetchEventEnd;
    277   TimeStamp responseStart;
    278   TimeStamp responseEnd;
    279 };
    280 
    281 struct ReplacementChannelConfigInit
    282 {
    283   uint32_t redirectFlags;
    284   ClassOfService classOfService;
    285   bool? privateBrowsing;
    286   nsCString? method;
    287   nullable nsIReferrerInfo referrerInfo;
    288   TimedChannelInfo? timedChannelInfo;
    289   nullable RemoteLazyInputStream uploadStream;
    290   uint64_t uploadStreamLength;
    291   bool uploadStreamHasHeaders;
    292   nsCString? contentType;
    293   nsCString? contentLength;
    294 };
    295 
    296 union IPDLVariantValue
    297 {
    298   bool;
    299   uint8_t;   // In practice, uint8_t and uint16_t are likely unneeded,
    300   int16_t;   // as signed->unsigned->signed has universal behavior.
    301   uint16_t;  // but those conversions are only guaranteed in C++20.
    302   int32_t;
    303   uint32_t;
    304   float;
    305   double;
    306   nsID;
    307   nsString;
    308   nsCString;
    309   nullable nsIURI;
    310   nullable nsIPrincipal;
    311 };
    312 
    313 struct IDPLVariant
    314 {
    315   uint32_t type;  // We explicitly store the original nsIVariant type so that
    316                   // the conversion back into a nsVariant later is lossless.
    317   IPDLVariantValue data;
    318 };
    319 
    320 struct IPDLProperty
    321 {
    322   nsString name;
    323   nullable nsIVariant value;
    324 };
    325 
    326 // Struct with information to show a frame from the parent process.
    327 struct ParentShowInfo
    328 {
    329   nsString name;
    330   bool fakeShowInfo;
    331   bool isTransparent;
    332   float dpi;
    333   int32_t widgetRounding;
    334   double defaultScale;
    335 };
    336 
    337 // Struct with information to show an iframe from the process that owns the
    338 // frame.
    339 struct OwnerShowInfo {
    340   // This can be an IntSize rather than a Rect because content processes always
    341   // render to a virtual <0, 0> top-left point.
    342   LayoutDeviceIntSize size;
    343 
    344   // TODO(emilio): Margin preferences go here.
    345   ScrollbarPreference scrollbarPreference;
    346 
    347   // TODO(emilio): I think we should really be able to figure this out from the
    348   // parent process too instead.
    349   nsSizeMode sizeMode;
    350 };
    351 
    352 struct IPCImage {
    353     BigBuffer data;
    354     uint32_t stride;
    355     SurfaceFormat format;
    356     ImageIntSize size;
    357 };
    358 
    359 struct IPCNotificationAction {
    360   nsString name;
    361   nsString title;
    362 };
    363 
    364 // Mostly same as NotificationOptions except:
    365 // * `title` is included (it's a separate parameter in the Notification constructor)
    366 // * `icon` is parsed into nsIURI
    367 // * `data` is serialized to base64 string by StructuredCloneContainer
    368 // * `vibrate` is normalized to sequence
    369 struct IPCNotificationOptions {
    370   nsString title;
    371   NotificationDirection dir;
    372   nsString lang;
    373   nsString body;
    374   nsString tag;
    375   nullable nsIURI icon;
    376   bool requireInteraction;
    377   bool silent;
    378   uint32_t[] vibrate;
    379   nsString dataSerialized;
    380   IPCNotificationAction[] actions;
    381 };
    382 
    383 struct IPCNotification {
    384   nsString id;
    385   IPCNotificationOptions options;
    386 };
    387 
    388 union IPCNotificationsOrError {
    389   IPCNotification[];
    390   nsresult;
    391 };
    392 
    393 } // namespace dom
    394 } // namespace mozilla