/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ include "mozilla/dom/DomSecurityIPCUtils.h"; include "mozilla/GfxMessageUtils.h"; include "mozilla/dom/CSPMessageUtils.h"; include "mozilla/dom/PolicyContainerMessageUtils.h"; include "mozilla/dom/DocShellMessageUtils.h"; include "mozilla/dom/NavigationAPIIPCUtils.h"; include "mozilla/dom/PermissionMessageUtils.h"; include "mozilla/dom/PropertyBagUtils.h"; include "mozilla/dom/ReferrerInfoUtils.h"; include "mozilla/dom/TabMessageUtils.h"; include "mozilla/dom/notification/IPCUtils.h"; include "mozilla/ipc/URIUtils.h"; include "mozilla/layers/LayersMessageUtils.h"; include "mozilla/net/NeckoMessageUtils.h"; include "mozilla/URLClassifierIPCUtils.h"; include IPCBlob; include IPCStream; include ProtocolTypes; using struct mozilla::void_t from "mozilla/ipc/IPCCore.h"; using struct mozilla::dom::LoadingSessionHistoryInfo from "mozilla/dom/SessionHistoryEntry.h"; using mozilla::net::ClassOfService from "mozilla/net/ClassOfService.h"; using mozilla::hal::ScreenOrientation from "mozilla/HalIPCUtils.h"; using mozilla::LayoutDeviceIntRect from "Units.h"; using mozilla::DesktopIntRect from "Units.h"; using mozilla::DesktopToLayoutDeviceScale from "Units.h"; using mozilla::CSSToLayoutDeviceScale from "Units.h"; using mozilla::CSSRect from "Units.h"; using mozilla::CSSSize from "Units.h"; using mozilla::LayoutDeviceIntSize from "Units.h"; using mozilla::LayoutDeviceIntPoint from "Units.h"; using mozilla::ImageIntSize from "Units.h"; using nsSizeMode from "nsIWidgetListener.h"; using mozilla::ScrollbarPreference from "mozilla/ScrollbarPreferences.h"; using mozilla::gfx::SurfaceFormat from "mozilla/gfx/Types.h"; using nsILoadInfo::HTTPSUpgradeTelemetryType from "nsILoadInfo.h"; using nsILoadInfo::SchemelessInputType from "nsILoadInfo.h"; [RefCounted] using class nsIPrincipal from "nsIPrincipal.h"; using mozilla::dom::MaybeDiscardedBrowsingContext from "mozilla/dom/BrowsingContext.h"; [RefCounted] using class nsIURI from "nsIURI.h"; [RefCounted] using class nsIPolicyContainer from "nsIPolicyContainer.h"; [RefCounted] using class nsIInputStream from "mozilla/ipc/IPCStreamUtils.h"; [RefCounted] using class nsIReferrerInfo from "nsIReferrerInfo.h"; [RefCounted] using class nsIVariant from "nsIVariant.h"; using mozilla::TimeStamp from "mozilla/TimeStamp.h"; [RefCounted] using class mozilla::RemoteLazyInputStream from "mozilla/RemoteLazyInputStream.h"; [MoveOnly] using class mozilla::ipc::BigBuffer from "mozilla/ipc/BigBuffer.h"; using mozilla::dom::NotificationDirection from "mozilla/dom/NotificationBinding.h"; using mozilla::dom::UserNavigationInvolvement from "mozilla/dom/UserNavigationInvolvement.h"; using mozilla::net::ClassificationFlags from "nsIClassifiedChannel.h"; using mozilla::dom::ForceMediaDocument from "mozilla/dom/LoadURIOptionsBinding.h"; using mozilla::dom::NavigationHistoryBehavior from "mozilla/dom/NavigationBinding.h"; [RefCounted] using class mozilla::dom::ipc::StructuredCloneData from "mozilla/dom/ipc/StructuredCloneData.h"; [RefCounted] using class nsStructuredCloneContainer from "nsStructuredCloneContainer.h"; namespace mozilla { namespace dom { struct MessagePortIdentifier { nsID uuid; nsID destinationUuid; uint32_t sequenceId; bool neutered; }; struct ScreenDetails { LayoutDeviceIntRect rect; DesktopIntRect rectDisplayPix; LayoutDeviceIntRect availRect; DesktopIntRect availRectDisplayPix; int32_t pixelDepth; int32_t colorDepth; uint32_t refreshRate; // In Hz, or 0 if not known. DesktopToLayoutDeviceScale contentsScaleFactor; CSSToLayoutDeviceScale defaultCSSScaleFactor; float dpi; ScreenOrientation orientation; uint16_t orientationAngle; bool isPseudoDisplay; bool isHDR; }; struct DimensionInfo { CSSRect rect; CSSSize size; LayoutDeviceIntPoint clientOffset; LayoutDeviceIntPoint chromeOffset; }; struct FrameScriptInfo { nsString url; bool runInGlobalScope; }; /** * The information required to complete a window creation request. */ struct CreatedWindowInfo { nsresult rv; bool windowOpened; FrameScriptInfo[] frameScripts; uint32_t maxTouchPoints; DimensionInfo dimensions; }; struct DocShellLoadStateInit { nullable nsIURI URI; nullable nsIURI OriginalURI; nullable nsIURI ResultPrincipalURI; nullable nsIPrincipal TriggeringPrincipal; nullable nsIReferrerInfo ReferrerInfo; nullable nsIPrincipal PrincipalToInherit; nullable nsIPrincipal PartitionedPrincipalToInherit; nullable nsIURI BaseURI; // The Policy Container of the load, that is, the policyContainer of the entity // responsible for causing the load to occur. Most likely this is the policyContainer // of the document that started the load. In case the entity starting the // load did not use a policyContainer, then policyContainer can be null. Please note that // this is also the policyContainer that will be applied to the load in case the load // encounters a server side redirect. nullable nsIPolicyContainer PolicyContainer; nullable nsIInputStream PostDataStream; nullable nsIInputStream HeadersStream; nullable nsIURI UnstrippedURI; uint64_t LoadIdentifier; nsString Target; nsCString TypeHint; nsString FileName; MaybeDiscardedBrowsingContext SourceBrowsingContext; MaybeDiscardedBrowsingContext TargetBrowsingContext; // The provided remote type of the process responsible for causing the load to // occur. Validated in the parent process. nsCString TriggeringRemoteType; nsString SrcdocData; // useless without sourcedocshell nsCString? OriginalURIString; nsCString? RemoteTypeOverride; LoadingSessionHistoryInfo? loadingSessionHistoryInfo; uint32_t LoadType; uint32_t LoadFlags; uint32_t InternalLoadFlags; // https://html.spec.whatwg.org/#user-navigation-involvement UserNavigationInvolvement userNavigationInvolvement; // The TriggeringSandboxFlags are the SandboxFlags of the entity // responsible for causing the load to occur. uint32_t TriggeringSandboxFlags; uint64_t TriggeringWindowId; bool TriggeringStorageAccess; ClassificationFlags TriggeringClassificationFlags; int32_t? CancelContentJSEpoch; bool ResultPrincipalURIIsSome; bool KeepResultPrincipalURIIfSet; bool LoadReplace; bool InheritPrincipal; bool PrincipalIsExplicit; bool NotifiedBeforeUnloadListeners; bool ForceAllowDataURI; bool IsExemptFromHTTPSFirstMode; bool OriginalFrameSrc; bool ShouldCheckForRecursion; bool IsFormSubmission; bool FirstParty; bool HasValidUserGestureActivation; bool TextDirectiveUserActivation; bool AllowFocusMove; bool IsFromProcessingFrameAttributes; bool NeedsCompletelyLoadedDocument; bool ShouldNotForceReplaceInOnLoad; NavigationHistoryBehavior? HistoryBehavior; SchemelessInputType SchemelessInput; ForceMediaDocument forceMediaDocument; HTTPSUpgradeTelemetryType HttpsUpgradeTelemetry; // https://html.spec.whatwg.org/#she-navigation-api-state nullable nsStructuredCloneContainer NavigationAPIState; // Fields missing due to lack of need or serialization // nsCOMPtr mSourceDocShell; // bool mIsSrcDocLoad; // useless without sourcedocshell // nsIChannel pendingRedirectedChannel; // sent through other mechanism bool ChannelInitialized; bool TryToReplaceWithSessionHistoryLoad; bool IsMetaRefresh; bool IsCaptivePortalTab; bool IsInitialAboutBlankHandlingProhibited; }; struct TimedChannelInfo { int8_t redirectCount; int8_t internalRedirectCount; TimeStamp asyncOpen; TimeStamp channelCreation; TimeStamp redirectStart; TimeStamp redirectEnd; nsString initiatorType; bool allRedirectsSameOrigin; bool allRedirectsPassTimingAllowCheck; bool? timingAllowCheckForPrincipal; bool renderBlocking; TimeStamp launchServiceWorkerStart; TimeStamp launchServiceWorkerEnd; TimeStamp dispatchFetchEventStart; TimeStamp dispatchFetchEventEnd; TimeStamp handleFetchEventStart; TimeStamp handleFetchEventEnd; TimeStamp responseStart; TimeStamp responseEnd; }; struct ReplacementChannelConfigInit { uint32_t redirectFlags; ClassOfService classOfService; bool? privateBrowsing; nsCString? method; nullable nsIReferrerInfo referrerInfo; TimedChannelInfo? timedChannelInfo; nullable RemoteLazyInputStream uploadStream; uint64_t uploadStreamLength; bool uploadStreamHasHeaders; nsCString? contentType; nsCString? contentLength; }; union IPDLVariantValue { bool; uint8_t; // In practice, uint8_t and uint16_t are likely unneeded, int16_t; // as signed->unsigned->signed has universal behavior. uint16_t; // but those conversions are only guaranteed in C++20. int32_t; uint32_t; float; double; nsID; nsString; nsCString; nullable nsIURI; nullable nsIPrincipal; }; struct IDPLVariant { uint32_t type; // We explicitly store the original nsIVariant type so that // the conversion back into a nsVariant later is lossless. IPDLVariantValue data; }; struct IPDLProperty { nsString name; nullable nsIVariant value; }; // Struct with information to show a frame from the parent process. struct ParentShowInfo { nsString name; bool fakeShowInfo; bool isTransparent; float dpi; int32_t widgetRounding; double defaultScale; double desktopToDeviceScale; }; // Struct with information to show an iframe from the process that owns the // frame. struct OwnerShowInfo { // This can be an IntSize rather than a Rect because content processes always // render to a virtual <0, 0> top-left point. LayoutDeviceIntSize size; // TODO(emilio): Margin preferences go here. ScrollbarPreference scrollbarPreference; // TODO(emilio): I think we should really be able to figure this out from the // parent process too instead. nsSizeMode sizeMode; }; struct IPCImage { BigBuffer data; uint32_t stride; SurfaceFormat format; ImageIntSize size; }; struct IPCNotificationAction { nsString name; nsString title; }; // Mostly same as NotificationOptions except: // * `title` is included (it's a separate parameter in the Notification constructor) // * `icon` is parsed into nsIURI // * `data` is serialized to base64 string by StructuredCloneContainer // * `vibrate` is normalized to sequence struct IPCNotificationOptions { nsString title; NotificationDirection dir; nsString lang; nsString body; nsString tag; nullable nsIURI icon; bool requireInteraction; bool silent; uint32_t[] vibrate; nsString dataSerialized; IPCNotificationAction[] actions; }; struct IPCNotification { nsString id; IPCNotificationOptions options; }; union IPCNotificationsOrError { IPCNotification[]; nsresult; }; } // namespace dom } // namespace mozilla