tor-browser

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

PContent.ipdl (83682B)


      1 /* -*- tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* vim: set ts=2 et sw=2 tw=80: */
      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 protocol PBackgroundStarter;
      8 include protocol PBrowser;
      9 include protocol PClipboardContentAnalysis;
     10 include protocol PClipboardReadRequest;
     11 include protocol PClipboardWriteRequest;
     12 include protocol PCompositorManager;
     13 include protocol PContentPermissionRequest;
     14 include protocol PCycleCollectWithLogs;
     15 include protocol PDocumentChannel;
     16 include protocol PExtensions;
     17 include protocol PExternalHelperApp;
     18 include protocol PHandlerService;
     19 include protocol PHal;
     20 include protocol PHeapSnapshotTempFileHelper;
     21 include protocol PProcessHangMonitor;
     22 include protocol PImageBridge;
     23 include protocol PRemotePrintJob;
     24 include protocol PMedia;
     25 include protocol PNecko;
     26 include protocol PStreamFilter;
     27 include protocol PGMPContent;
     28 include protocol PGMPService;
     29 include protocol PGMP;
     30 #ifdef MOZ_WEBSPEECH
     31 include protocol PSpeechSynthesis;
     32 #endif
     33 include protocol PTestShell;
     34 include protocol PRemoteSpellcheckEngine;
     35 include protocol PWebBrowserPersistDocument;
     36 #ifdef MOZ_WEBRTC
     37 include protocol PWebrtcGlobal;
     38 #endif
     39 include protocol PWindowGlobal;
     40 include protocol PURLClassifier;
     41 include protocol PURLClassifierLocal;
     42 include protocol PURLClassifierLocalByName;
     43 include protocol PVRManager;
     44 include protocol PRemoteMediaManager;
     45 include protocol PRemoteWorkerDebuggerManager;
     46 include protocol PRemoteWorkerService;
     47 include protocol PProfiler;
     48 include protocol PScriptCache;
     49 include protocol PSessionStorageObserver;
     50 include CrashReporterInitArgs;
     51 include DOMTypes;
     52 include WindowGlobalTypes;
     53 include IPCBlob;
     54 include IPCStream;
     55 include IPCTransferable;
     56 include JSIPCValue;
     57 include PPrintingTypes;
     58 include PTabContext;
     59 include ProtocolTypes;
     60 include PBackgroundSharedTypes;
     61 include PContentPermission;
     62 include GraphicsMessages;
     63 include MemoryReportTypes;
     64 include ClientIPCTypes;
     65 include HangTypes;
     66 include PrefsTypes;
     67 include NeckoChannelParams;
     68 include PSMIPCTypes;
     69 include LookAndFeelTypes;
     70 
     71 #if defined(MOZ_SANDBOX) && defined(MOZ_DEBUG) && defined(ENABLE_TESTS)
     72 include protocol PSandboxTesting;
     73 #endif
     74 
     75 include "ipc/MediaControlIPC.h";
     76 include "mozilla/AntiTrackingIPCUtils.h";
     77 include "mozilla/GfxMessageUtils.h";
     78 include "mozilla/URLClassifierIPCUtils.h";
     79 include "mozilla/dom/BindingIPCUtils.h";
     80 include "mozilla/dom/CSPMessageUtils.h";
     81 include "mozilla/dom/DocShellMessageUtils.h";
     82 include "mozilla/dom/FeaturePolicyUtils.h";
     83 include "mozilla/dom/GeolocationIPCUtils.h";
     84 include "mozilla/dom/MediaSessionIPCUtils.h";
     85 include "mozilla/dom/PageLoadEventUtils.h";
     86 include "mozilla/dom/ReferrerInfoUtils.h";
     87 include "mozilla/glean/DomMetrics.h";
     88 include "mozilla/ipc/ByteBufUtils.h";
     89 include "mozilla/ipc/TransportSecurityInfoUtils.h";
     90 include "mozilla/ipc/URIUtils.h";
     91 include "mozilla/net/NeckoMessageUtils.h";
     92 include "mozilla/widget/WidgetMessageUtils.h";
     93 include "mozilla/PermissionDelegateIPCUtils.h";
     94 
     95 [RefCounted] using class nsIDOMGeoPosition from "nsGeoPositionIPCSerialiser.h";
     96 
     97 using struct ChromePackage from "mozilla/chrome/RegistryMessageUtils.h";
     98 using struct SubstitutionMapping from "mozilla/chrome/RegistryMessageUtils.h";
     99 using struct OverrideMapping from "mozilla/chrome/RegistryMessageUtils.h";
    100 using base::ProcessId from "base/process.h";
    101 using struct IPC::Permission from "mozilla/net/NeckoMessageUtils.h";
    102 using mozilla::dom::NativeThreadId from "mozilla/dom/NativeThreadId.h";
    103 using mozilla::hal::ProcessPriority from "mozilla/HalTypes.h";
    104 using mozilla::gfx::IntSize from "mozilla/gfx/2D.h";
    105 using mozilla::gfx::SurfaceFormat from "mozilla/gfx/Types.h";
    106 using gfxPlatform::GlobalReflowFlags from "gfxPlatform.h";
    107 using mozilla::dom::TabId from "mozilla/dom/ipc/IdType.h";
    108 using mozilla::dom::ContentParentId from "mozilla/dom/ipc/IdType.h";
    109 using mozilla::EventMessage from "mozilla/EventForwards.h";
    110 using mozilla::LayoutDeviceIntPoint from "Units.h";
    111 using mozilla::ImagePoint from "Units.h";
    112 using mozilla::widget::ThemeChangeKind from "mozilla/widget/WidgetMessageUtils.h";
    113 using class mozilla::dom::MessagePort from "mozilla/dom/MessagePort.h";
    114 using class mozilla::dom::ipc::StructuredCloneData from "mozilla/dom/ipc/StructuredCloneData.h";
    115 using mozilla::OriginAttributes from "mozilla/ipc/BackgroundUtils.h";
    116 using mozilla::OriginAttributesPattern from "mozilla/dom/quota/SerializationHelpers.h";
    117 using struct mozilla::layers::TextureFactoryIdentifier from "mozilla/layers/CompositorTypes.h";
    118 using mozilla::layers::CompositorOptions from "mozilla/layers/CompositorOptions.h";
    119 using mozilla::layers::LayersId from "mozilla/layers/LayersTypes.h";
    120 using mozilla::Telemetry::HistogramAccumulation from "mozilla/TelemetryComms.h";
    121 using mozilla::Telemetry::KeyedHistogramAccumulation from "mozilla/TelemetryComms.h";
    122 using mozilla::Telemetry::ScalarAction from "mozilla/TelemetryComms.h";
    123 using mozilla::Telemetry::KeyedScalarAction from "mozilla/TelemetryComms.h";
    124 using mozilla::Telemetry::DynamicScalarDefinition from "mozilla/TelemetryComms.h";
    125 using mozilla::Telemetry::ChildEventData from "mozilla/TelemetryComms.h";
    126 using mozilla::TimeStamp from "mozilla/TimeStamp.h";
    127 using mozilla::dom::geolocation::SystemGeolocationPermissionBehavior from "mozilla/dom/GeolocationIPCUtils.h";
    128 using mozilla::dom::geolocation::GeolocationPermissionStatus from "mozilla/dom/GeolocationIPCUtils.h";
    129 
    130 #if defined(XP_WIN)
    131 [MoveOnly] using mozilla::UntrustedModulesData from "mozilla/UntrustedModulesData.h";
    132 [MoveOnly] using mozilla::ModulePaths from "mozilla/UntrustedModulesData.h";
    133 [MoveOnly] using mozilla::ModulesMapResult from "mozilla/UntrustedModulesData.h";
    134 #endif  // defined(XP_WIN)
    135 
    136 using mozilla::Telemetry::DiscardedData from "mozilla/TelemetryComms.h";
    137 using mozilla::performance::pageload_event::PageloadEventData from "mozilla/PageloadEvent.h";
    138 [MoveOnly] using mozilla::CrossProcessMutexHandle from "mozilla/ipc/CrossProcessMutex.h";
    139 using mozilla::dom::MaybeDiscardedBrowsingContext from "mozilla/dom/BrowsingContext.h";
    140 using mozilla::dom::BrowsingContextTransaction from "mozilla/dom/BrowsingContext.h";
    141 using mozilla::dom::BrowsingContextInitializer from "mozilla/dom/BrowsingContext.h";
    142 using mozilla::dom::PermitUnloadResult from "nsIDocumentViewer.h";
    143 using mozilla::dom::MaybeDiscardedWindowContext from "mozilla/dom/WindowContext.h";
    144 using mozilla::dom::WindowContextTransaction from "mozilla/dom/WindowContext.h";
    145 [MoveOnly] using mozilla::ipc::ReadOnlySharedMemoryHandle from "mozilla/ipc/SharedMemoryHandle.h";
    146 using gfxSparseBitSet from "gfxFontUtils.h";
    147 using FontVisibility from "gfxFontEntry.h";
    148 using mozilla::dom::MediaControlAction from "mozilla/dom/MediaControlKeySource.h";
    149 using mozilla::dom::MediaPlaybackState from "mozilla/dom/MediaPlaybackStatus.h";
    150 using mozilla::dom::MediaAudibleState from "mozilla/dom/MediaPlaybackStatus.h";
    151 using mozilla::dom::MediaMetadataBase from "mozilla/dom/MediaMetadata.h";
    152 using mozilla::dom::MediaSessionAction from "mozilla/dom/MediaSessionBinding.h";
    153 using mozilla::dom::MediaSessionPlaybackState from "mozilla/dom/MediaSessionBinding.h";
    154 using mozilla::dom::PositionState from "mozilla/dom/MediaSession.h";
    155 using mozilla::dom::ServiceWorkerShutdownState::Progress from "mozilla/dom/ServiceWorkerShutdownState.h";
    156 using mozilla::ContentBlockingNotifier::StorageAccessPermissionGrantedReason from "mozilla/ContentBlockingNotifier.h";
    157 using mozilla::ContentBlockingNotifier::BlockingDecision from "mozilla/ContentBlockingNotifier.h";
    158 using mozilla::StorageAccessAPIHelper::StorageAccessPromptChoices from "mozilla/StorageAccessAPIHelper.h";
    159 using mozilla::dom::JSActorMessageKind from "mozilla/dom/JSActor.h";
    160 using mozilla::dom::JSActorMessageMeta from "mozilla/dom/PWindowGlobal.h";
    161 using mozilla::PermissionDelegateHandler::DelegatedPermissionList from "mozilla/PermissionDelegateHandler.h";
    162 [RefCounted] using class nsILayoutHistoryState from "nsILayoutHistoryState.h";
    163 using class mozilla::dom::SessionHistoryInfo from "mozilla/dom/SessionHistoryEntry.h";
    164 using struct nsPoint from "nsPoint.h";
    165 using struct mozilla::dom::LoadingSessionHistoryInfo from "mozilla/dom/SessionHistoryEntry.h";
    166 using mozilla::media::MediaCodecsSupported from "MediaCodecsSupport.h";
    167 using mozilla::RemoteMediaIn from "mozilla/RemoteMediaManagerChild.h";
    168 using mozilla::dom::PerformanceTimingData from "mozilla/dom/PerformanceTiming.h";
    169 using mozilla::dom::MaybeFeaturePolicyInfo from "mozilla/dom/FeaturePolicy.h";
    170 using mozilla::dom::Wireframe from "mozilla/dom/DocumentBinding.h";
    171 using mozilla::PerfStats::MetricMask from "mozilla/PerfStats.h";
    172 [RefCounted] using class nsIX509Cert from "nsIX509Cert.h";
    173 using nsIDNSService::ResolverMode from "nsIDNSService.h";
    174 using mozilla::dom::UserActivation::Modifiers from "mozilla/dom/UserActivation.h";
    175 using mozilla::dom::PrivateAttributionImpressionType from "mozilla/dom/PrivateAttributionIPCUtils.h";
    176 using nsIClipboard::ClipboardType from "nsIClipboard.h";
    177 using nsIUrlClassifierFeature::listType from "nsIUrlClassifierFeature.h";
    178 using mozilla::dom::ReferrerPolicy from "mozilla/dom/ReferrerPolicyBinding.h";
    179 
    180 #ifdef MOZ_WMF_CDM
    181 using nsIOriginStatusEntry from "nsIWindowsMediaFoundationCDMOriginsListService.h";
    182 #endif
    183 
    184 union ChromeRegistryItem
    185 {
    186     ChromePackage;
    187     OverrideMapping;
    188     SubstitutionMapping;
    189 };
    190 
    191 namespace mozilla {
    192 namespace dom {
    193 
    194 // SetXPCOMProcessAttributes passes an array of font data to the child,
    195 // but each platform needs different details so we have platform-specific
    196 // versions of the SystemFontListEntry type:
    197 #if defined(ANDROID)
    198 // Used on Android to pass the list of fonts on the device
    199 // to the child process
    200 struct SystemFontListEntry {
    201     nsCString familyName;
    202     nsCString faceName;
    203     nsCString filepath;
    204     uint32_t  weightRange;
    205     uint32_t  stretchRange;
    206     uint32_t  styleRange;
    207     uint8_t   index;
    208     FontVisibility visibility;
    209 };
    210 #elif defined(XP_MACOSX) || defined(XP_IOS)
    211 // Used on Mac OS X to pass the list of font families (not faces)
    212 // from chrome to content processes.
    213 // The entryType field distinguishes several types of font family
    214 // record; see gfxMacPlatformFontList.h for values and meaning.
    215 struct SystemFontListEntry {
    216     nsCString familyName;
    217     FontVisibility visibility;
    218     uint8_t   entryType;
    219 };
    220 #else
    221 // Used on Linux to pass list of font patterns from chrome to content.
    222 // (Unused on Windows, but there needs to be a definition of the type.)
    223 struct SystemFontListEntry {
    224     nsCString pattern;
    225     bool      appFontFamily;
    226 };
    227 #endif
    228 
    229 #ifdef MOZ_WIDGET_GTK
    230 struct SystemFontOptions {
    231     int32_t antialias; // cairo_antialias_t
    232     int32_t subpixelOrder; // cairo_subpixel_order_t
    233     int32_t hintStyle; // cairo_hint_style_t
    234     int32_t lcdFilter; // cairo_lcd_filter_t
    235 };
    236 #endif
    237 
    238 struct SystemFontList {
    239     SystemFontListEntry[] entries;
    240 #ifdef MOZ_WIDGET_GTK
    241     SystemFontOptions options;
    242 #endif
    243 };
    244 
    245 union SystemParameterValue {
    246   bool;
    247   float;
    248 };
    249 
    250 struct ClipboardCapabilities {
    251   bool supportsSelectionClipboard;
    252   bool supportsFindClipboard;
    253   bool supportsSelectionCache;
    254 };
    255 
    256 union FileDescOrError {
    257     FileDescriptor;
    258     nsresult;
    259 };
    260 
    261 struct DomainPolicyClone
    262 {
    263     bool        active;
    264     nullable nsIURI[] blocklist;
    265     nullable nsIURI[] allowlist;
    266     nullable nsIURI[] superBlocklist;
    267     nullable nsIURI[] superAllowlist;
    268 };
    269 
    270 struct AndroidSystemInfo
    271 {
    272     nsString device;
    273     nsString manufacturer;
    274     nsString release_version;
    275     nsString hardware;
    276     uint32_t sdk_version;
    277     bool     isTablet;
    278 };
    279 
    280 struct GetFilesResponseSuccess
    281 {
    282   IPCBlob[] blobs;
    283 };
    284 
    285 struct GetFilesResponseFailure
    286 {
    287   nsresult errorCode;
    288 };
    289 
    290 union GetFilesResponseResult
    291 {
    292   GetFilesResponseSuccess;
    293   GetFilesResponseFailure;
    294 };
    295 
    296 struct BlobURLRegistrationData
    297 {
    298   nsCString url;
    299   IPCBlob blob;
    300   nsIPrincipal principal;
    301   nsCString partitionKey;
    302   bool revoked;
    303 };
    304 
    305 struct JSWindowActorEventDecl
    306 {
    307   nsString name;
    308   bool capture;
    309   bool systemGroup;
    310   bool allowUntrusted;
    311   bool? passive;
    312   bool createActor;
    313 };
    314 
    315 struct JSWindowActorInfo
    316 {
    317   nsCString name;
    318   bool allFrames;
    319 
    320   // This is to align with JSProcessActorInfo.
    321   // This attribute isn't used for JSWindow Actors.
    322   bool loadInDevToolsLoader;
    323 
    324   // The module of the url.
    325   nsCString? url;
    326 
    327   JSWindowActorEventDecl[] events;
    328 
    329   // Observer notifications this actor listens to.
    330   nsCString[] observers;
    331   nsString[] matches;
    332   nsCString[] remoteTypes;
    333   nsString[] messageManagerGroups;
    334 };
    335 
    336 struct JSProcessActorInfo
    337 {
    338     // The name of the actor.
    339     nsCString name;
    340 
    341     // True if `url` is for ESM.
    342     // False if `url` is for JSM or nothing.
    343     bool isESModule;
    344 
    345     // True if the actor should be loaded in the distinct loader dedicated to DevTools.
    346     bool loadInDevToolsLoader;
    347 
    348     // The module of the url.
    349     nsCString? url;
    350 
    351     // Observer notifications this actor listens to.
    352     nsCString[] observers;
    353     nsCString[] remoteTypes;
    354 };
    355 
    356 struct GMPAPITags
    357 {
    358     nsCString api;
    359     nsCString[] tags;
    360 };
    361 
    362 struct GMPCapabilityData
    363 {
    364     nsCString name;
    365     nsCString version;
    366     GMPAPITags[] capabilities;
    367 };
    368 
    369 struct L10nFileSourceDescriptor {
    370   nsCString name;
    371   nsCString metasource;
    372   nsCString[] locales;
    373   nsCString prePath;
    374   nsCString[] index;
    375 };
    376 
    377 struct XPCOMInitData
    378 {
    379     bool isOffline;
    380     bool isConnected;
    381     int32_t captivePortalState;
    382     bool isLangRTL;
    383     bool haveBidiKeyboards;
    384     nsCString[] dictionaries;
    385     ClipboardCapabilities clipboardCaps;
    386     DomainPolicyClone domainPolicy;
    387     nullable nsIURI userContentSheetURL;
    388     GfxVarUpdate[] gfxNonDefaultVarUpdates;
    389     ContentDeviceData contentDeviceData;
    390     GfxInfoFeatureStatus[] gfxFeatureStatus;
    391     nsCString[] sysLocales;
    392     nsCString[] appLocales;
    393     nsCString[] requestedLocales;
    394     L10nFileSourceDescriptor[] l10nFileSources;
    395     DynamicScalarDefinition[] dynamicScalarDefs;
    396     MetricMask perfStatsMask;
    397     nsCString trrDomain;
    398     ResolverMode trrMode;
    399     // This is the value of network.trr.mode and can be diffrent than trrMode.
    400     ResolverMode trrModeFromPref;
    401 };
    402 
    403 struct VisitedQueryResult
    404 {
    405     nullable nsIURI uri;
    406     bool visited;
    407 };
    408 
    409 struct StringBundleDescriptor
    410 {
    411     nsCString bundleURL;
    412     ReadOnlySharedMemoryHandle mapHandle;
    413 };
    414 
    415 struct IPCURLClassifierFeature
    416 {
    417     nsCString featureName;
    418     nsCString[] tables;
    419 };
    420 
    421 struct PostMessageData
    422 {
    423     MaybeDiscardedBrowsingContext source;
    424     nsString origin;
    425     nsString targetOrigin;
    426     nullable nsIURI targetOriginURI;
    427     nullable nsIPrincipal callerPrincipal;
    428     nullable nsIPrincipal subjectPrincipal;
    429     nullable nsIURI callerURI;
    430     bool isFromPrivateWindow;
    431     nsCString scriptLocation;
    432     uint64_t innerWindowId;
    433 };
    434 
    435 union SyncedContextInitializer
    436 {
    437     BrowsingContextInitializer;
    438     WindowContextInitializer;
    439 };
    440 
    441 struct OriginAgentClusterInitializer
    442 {
    443     nsIPrincipal principal;
    444     bool useOriginAgentCluster;
    445 };
    446 
    447 union BlobURLDataRequestResult
    448 {
    449   IPCBlob;
    450   nsresult;
    451 };
    452 
    453 struct TextRecognitionQuad {
    454     float confidence;
    455     nsString string;
    456     ImagePoint[] points;
    457 };
    458 
    459 struct TextRecognitionResult {
    460     TextRecognitionQuad[] quads;
    461 };
    462 
    463 union TextRecognitionResultOrError {
    464     TextRecognitionResult;
    465     nsCString;
    466 };
    467 
    468 struct ClipboardReadRequest {
    469     ManagedEndpoint<PClipboardReadRequestChild> childEndpoint;
    470     nsCString[] availableTypes;
    471 };
    472 
    473 union ClipboardReadRequestOrError {
    474     ClipboardReadRequest;
    475     nsresult;
    476 };
    477 
    478 struct BroadcastBlobURLUnregistrationRequest {
    479     nsCString url;
    480     nullable nsIPrincipal principal;
    481 };
    482 
    483 #ifdef MOZ_WMF_CDM
    484 struct IPCOriginStatusEntry {
    485     nsCString origin;
    486     int32_t status;
    487 };
    488 #endif
    489 
    490 /**
    491  * The PContent protocol is a top-level protocol between the UI process
    492  * and a content process. There is exactly one PContentParent/PContentChild pair
    493  * for each content process.
    494  */
    495 [NestedUpTo=inside_cpow, NeedsOtherPid, ChildProc=Content]
    496 sync protocol PContent
    497 {
    498     manages PBrowser;
    499     manages PClipboardReadRequest;
    500     manages PClipboardWriteRequest;
    501     manages PContentPermissionRequest;
    502     manages PCycleCollectWithLogs;
    503     manages PExtensions;
    504     manages PExternalHelperApp;
    505     manages PHal;
    506     manages PHandlerService;
    507     manages PHeapSnapshotTempFileHelper;
    508     manages PRemotePrintJob;
    509     manages PMedia;
    510     manages PNecko;
    511 #ifdef MOZ_WEBSPEECH
    512     manages PSpeechSynthesis;
    513 #endif
    514     manages PTestShell;
    515     manages PRemoteSpellcheckEngine;
    516     manages PWebBrowserPersistDocument;
    517 #ifdef MOZ_WEBRTC
    518     manages PWebrtcGlobal;
    519 #endif
    520     manages PURLClassifier;
    521     manages PURLClassifierLocal;
    522     manages PURLClassifierLocalByName;
    523     manages PScriptCache;
    524     manages PSessionStorageObserver;
    525 
    526     // Depending on exactly how the new browser is being created, it might be
    527     // created from either the child or parent process!
    528     //
    529     // The child creates the PBrowser as part of
    530     // BrowserChild::BrowserFrameProvideWindow (which happens when the child's
    531     // content calls window.open()), and the parent creates the PBrowser as part
    532     // of ContentParent::CreateBrowser.
    533     //
    534     // When the parent constructs a PBrowser, the child trusts the attributes it
    535     // receives from the parent.  In that case, the context should be
    536     // FrameIPCTabContext.
    537     //
    538     // When the child constructs a PBrowser, the parent doesn't trust the
    539     // attributes it receives from the child.  In this case, context must have
    540     // type PopupIPCTabContext.  The parent checks that if the opener is a
    541     // browser element, the context is also for a browser element.
    542     //
    543     // If |sameTabGroupAs| is non-zero, the new tab should go in the same
    544     // TabGroup as |sameTabGroupAs|. This parameter should always be zero
    545     // for PBrowser messages sent from the child to the parent.
    546     //
    547     // Separate messages are used for the parent and child side constructors due
    548     // to the differences in data and actor setup required.
    549     //
    550     // Keep the last 3 attributes in sync with GetProcessAttributes!
    551 parent:
    552     async ConstructPopupBrowser(ManagedEndpoint<PBrowserParent> browserEp,
    553                                 ManagedEndpoint<PWindowGlobalParent> windowEp,
    554                                 TabId tabId, IPCTabContext context,
    555                                 WindowGlobalInit windowInit,
    556                                 uint32_t chromeFlags);
    557 
    558     // TODO: Do I need to make this return something to watch for completion?
    559     // Guess we'll see how we end up triggering the actual print, for preview
    560     // this should be enough...
    561     async CloneDocumentTreeInto(MaybeDiscardedBrowsingContext aSourceBc,
    562                                 MaybeDiscardedBrowsingContext aTargetBc,
    563                                 PrintData aPrintData);
    564 
    565     async UpdateRemotePrintSettings(MaybeDiscardedBrowsingContext aBc,
    566                                     PrintData aPrintData);
    567 
    568     async PExtensions();
    569 
    570 child:
    571     async ConstructBrowser(ManagedEndpoint<PBrowserChild> browserEp,
    572                            ManagedEndpoint<PWindowGlobalChild> windowEp,
    573                            TabId tabId,
    574                            IPCTabContext context,
    575                            WindowGlobalInit windowInit,
    576                            uint32_t chromeFlags, ContentParentId cpId,
    577                            bool isForBrowser, bool isTopLevel);
    578 
    579 both:
    580     // For parent->child, aBrowser must be non-null; aContext can
    581     // be null to indicate the browser's current root document, or non-null
    582     // to persist a subdocument.  For child->parent, arguments are
    583     // ignored and should be null.
    584     async PWebBrowserPersistDocument(nullable PBrowser aBrowser,
    585                                      MaybeDiscardedBrowsingContext aContext);
    586 
    587     async RawMessage(JSActorMessageMeta aMetadata, JSIPCValue aData,
    588                      UniquePtr<ClonedMessageData> aStack);
    589 
    590 child:
    591     async InitGMPService(Endpoint<PGMPServiceChild> service);
    592     async InitProcessHangMonitor(Endpoint<PProcessHangMonitorChild> hangMonitor);
    593     async InitProfiler(Endpoint<PProfilerChild> aEndpoint);
    594 
    595     // Give the content process its endpoints to the compositor.
    596     async InitRendering(
    597       Endpoint<PCompositorManagerChild> compositor,
    598       Endpoint<PImageBridgeChild> imageBridge,
    599       Endpoint<PVRManagerChild> vr,
    600       Endpoint<PRemoteMediaManagerChild> video,
    601       uint32_t[] namespaces);
    602 
    603     // Re-create the rendering stack using the given endpoints. This is sent
    604     // after the compositor process has crashed. The new endpoints may be to a
    605     // newly launched GPU process, or the compositor thread of the UI process.
    606     async ReinitRendering(
    607       Endpoint<PCompositorManagerChild> compositor,
    608       Endpoint<PImageBridgeChild> bridge,
    609       Endpoint<PVRManagerChild> vr,
    610       Endpoint<PRemoteMediaManagerChild> video,
    611       uint32_t[] namespaces);
    612 
    613     async NetworkLinkTypeChange(uint32_t type);
    614     async SocketProcessCrashed();
    615 
    616     // Re-create the rendering stack for a device reset.
    617     async ReinitRenderingForDeviceReset();
    618 
    619     /**
    620      * Enable system-level sandboxing features, if available.  Can
    621      * usually only be performed zero or one times.  The child may
    622      * abnormally exit if this fails; the details are OS-specific.
    623      */
    624     async SetProcessSandbox(FileDescriptor? aBroker);
    625 
    626     async RequestMemoryReport(uint32_t generation,
    627                               bool anonymize,
    628                               bool minimizeMemoryUsage,
    629                               FileDescriptor? DMDFile)
    630         returns (uint32_t aGeneration);
    631 
    632     async DecodeImage(nsIURI aURI, ImageIntSize aSize) returns (nsresult rv, IPCImage? image);
    633 
    634 #if defined(XP_WIN)
    635     /**
    636      * Used by third-party modules telemetry (aka "untrusted modules" telemetry)
    637      * to pull data from content processes.
    638      */
    639     async GetUntrustedModulesData() returns (UntrustedModulesData? data);
    640 
    641     /**
    642     * This method is used to notifty a child process to start
    643     * processing module loading events in UntrustedModulesProcessor.
    644     * This should be called when the parent process has gone idle.
    645     */
    646     async UnblockUntrustedModulesThread();
    647 #endif  // defined(XP_WIN)
    648 
    649     /**
    650      * Communication between the PuppetBidiKeyboard and the actual
    651      * BidiKeyboard hosted by the parent
    652      */
    653     async BidiKeyboardNotify(bool isLangRTL, bool haveBidiKeyboards);
    654 
    655     /**
    656      * Dump this process's GC and CC logs to the provided files.
    657      *
    658      * For documentation on the other args, see dumpGCAndCCLogsToFile in
    659      * nsIMemoryInfoDumper.idl
    660      */
    661     async PCycleCollectWithLogs(bool dumpAllTraces,
    662                                 FileDescriptor gcLog,
    663                                 FileDescriptor ccLog);
    664 
    665     async PTestShell();
    666 
    667     async PScriptCache(FileDescOrError cacheFile, bool wantCacheData);
    668 
    669     async RegisterChrome(ChromePackage[] packages, SubstitutionMapping[] substitutions,
    670                          OverrideMapping[] overrides, nsCString locale, bool reset);
    671     async RegisterChromeItem(ChromeRegistryItem item);
    672 
    673     async ClearImageCache(bool? privateLoader,
    674                           bool? aChrome,
    675                           nullable nsIPrincipal? aPrincipal,
    676                           nsCString? aSchemelessSite,
    677                           OriginAttributesPattern? aPattern,
    678                           nsCString? aURL);
    679 
    680     async ClearStyleSheetCache(bool? aChrome,
    681                                nullable nsIPrincipal? aPrincipal,
    682                                nsCString? aSchemelessSite,
    683                                OriginAttributesPattern? aPattern,
    684                                nsCString? aURL);
    685 
    686     async ClearScriptCache(bool? aChrome,
    687                            nullable nsIPrincipal? aPrincipal,
    688                            nsCString? aSchemelessSite,
    689                            OriginAttributesPattern? aPattern,
    690                            nsCString? aURL);
    691 
    692     async InvalidateScriptCache();
    693 
    694     async SetOffline(bool offline);
    695     async SetConnectivity(bool connectivity);
    696     async SetCaptivePortalState(int32_t aState);
    697     async SetTRRMode(ResolverMode aMode, ResolverMode aModeFromPref);
    698 
    699     async NotifyVisited(VisitedQueryResult[] uri);
    700 
    701     /**
    702      * Tell the child that the system theme has changed, and that a repaint is
    703      * necessary.
    704      */
    705     async ThemeChanged(FullLookAndFeel lookAndFeelData, ThemeChangeKind aKind);
    706 
    707     async PreferenceUpdate(Pref pref);
    708     async VarUpdate(GfxVarUpdate[] var);
    709 
    710     async UpdatePerfStatsCollectionMask(uint64_t aMask);
    711     async CollectPerfStatsJSON() returns (nsCString aStats);
    712 
    713     async CollectScrollingMetrics() returns (uint32_t pixelsScrolled, uint32_t scrollDurationMS);
    714 
    715     async GeolocationUpdate(nullable nsIDOMGeoPosition aPosition);
    716 
    717     async GeolocationError(uint16_t errorCode);
    718 
    719     async UpdateDictionaryList(nsCString[] dictionaries);
    720 
    721     async UpdateFontList(SystemFontList fontList);
    722 
    723     /**
    724      * The shared font list has been updated by the parent, so child processes
    725      * should globally reflow everything to pick up new character coverage etc.
    726      * If aFullRebuild is true, child processes must discard and recreate
    727      * their mappings to the shmem blocks, as those are no longer valid.
    728      * This message has raised priority so that it will take precedence over
    729      * vsync messages to the child.
    730      */
    731     [Priority=mediumhigh] async RebuildFontList(bool aFullRebuild);
    732 
    733     /**
    734      * The font list or prefs have been updated in such a way that we might need
    735      * to do a reflow and maybe reframe.
    736      */
    737     async ForceGlobalReflow(GlobalReflowFlags aFlags);
    738 
    739     /**
    740      * A new shmem block has been added to the font list; the child process
    741      * should map the new block and add to its index.
    742      */
    743     async FontListShmBlockAdded(uint32_t aGeneration, uint32_t aIndex,
    744                                 ReadOnlySharedMemoryHandle aHandle);
    745 
    746     async UpdateAppLocales(nsCString[] appLocales);
    747     async UpdateRequestedLocales(nsCString[] requestedLocales);
    748 
    749     /**
    750      * The system timezone has changed; the child process should ensure that
    751      * calls to get the default timezone return the new value.
    752      */
    753     async SystemTimezoneChanged();
    754 
    755     async UpdateL10nFileSources(L10nFileSourceDescriptor[] sources);
    756 
    757     async RegisterStringBundles(StringBundleDescriptor[] stringBundles);
    758 
    759     async SimpleURIUnknownRemoteSchemes(nsCString[] remoteSchemes);
    760 
    761     async UpdateSharedData(ReadOnlySharedMemoryHandle aMapHandle,
    762                            IPCBlob[] blobs,
    763                            nsCString[] changedKeys);
    764 
    765     // nsIPermissionManager messages
    766     async AddPermission(Permission permission);
    767     async RemoveAllPermissions();
    768 
    769     async FlushMemory(nsString reason);
    770 
    771     async ApplicationBackground();
    772     async ApplicationForeground();
    773     async GarbageCollect();
    774     async CycleCollect();
    775     async UnlinkGhosts();
    776 
    777     /**
    778      * Start accessibility engine in content process. aDomains specifies the
    779      * cache domains for which content processes should send info.
    780      */
    781     async ActivateA11y(uint64_t aDomains);
    782 
    783     /**
    784      * Shutdown accessibility engine in content process (if not in use).
    785      */
    786     async ShutdownA11y();
    787 
    788     /**
    789      * Set accessibility cache domains, effectively requesting more or less
    790      * cached information from the content process.
    791      */
    792     async SetCacheDomains(uint64_t aCacheDomains);
    793 
    794     async AppInfo(nsCString version, nsCString buildID, nsCString name, nsCString UAName,
    795                   nsCString ID, nsCString vendor, nsCString sourceURL, nsCString updateURL);
    796 
    797     /**
    798      * Send the remote type associated with the content process.
    799      */
    800     async RemoteType(nsCString aRemoteType, nsCString aProfile);
    801 
    802     /**
    803      * Initialize the RemoteWorkerService thread in the content process.
    804      */
    805     async InitRemoteWorkerService(Endpoint<PRemoteWorkerServiceChild> aEndpoint,
    806         Endpoint<PRemoteWorkerDebuggerManagerChild> aDebuggerChildEp);
    807 
    808     /**
    809      * Send BlobURLRegistrationData to child process.
    810      */
    811     async InitBlobURLs(BlobURLRegistrationData[] registrations);
    812 
    813     /**
    814      * Send JS{Content, Window}ActorInfos to child process.
    815      */
    816     async InitJSActorInfos(JSProcessActorInfo[] aContentInfos, JSWindowActorInfo[] aWindowInfos);
    817 
    818     /**
    819      * Unregister a previously registered JSWindowActor in the child process.
    820      */
    821     async UnregisterJSWindowActor(nsCString name);
    822 
    823     /**
    824      * Unregister a previously registered JSProcessActor in the child process.
    825      */
    826     async UnregisterJSProcessActor(nsCString name);
    827 
    828     async SetXPCOMProcessAttributes(XPCOMInitData xpcomInit,
    829                                     UniquePtr<StructuredCloneData> initialData,
    830                                     FullLookAndFeel lookAndFeeldata,
    831                                     /* used on MacOSX/Linux/Android only: */
    832                                     SystemFontList systemFontList,
    833                                     ReadOnlySharedMemoryHandle? sharedUASheetHandle,
    834                                     uintptr_t sharedUASheetAddress,
    835                                     ReadOnlySharedMemoryHandle[] sharedFontListBlocks,
    836                                     bool aIsStartingUp);
    837 
    838     // Notify child that last-pb-context-exited notification was observed
    839     async LastPrivateDocShellDestroyed();
    840 
    841     async NotifyProcessPriorityChanged(ProcessPriority priority);
    842     async MinimizeMemoryUsage();
    843 
    844     /**
    845      * Used to manage nsIStyleSheetService across processes.
    846      */
    847     async LoadAndRegisterSheet(nullable nsIURI uri, uint32_t type);
    848     async UnregisterSheet(nullable nsIURI uri, uint32_t type);
    849 
    850     /**
    851      * Notify idle observers in the child
    852      */
    853     async NotifyIdleObserver(uint64_t observerId, nsCString topic, nsString str);
    854 
    855     async DomainSetChanged(uint32_t aSetType, uint32_t aChangeType, nullable nsIURI aDomain);
    856 
    857     /**
    858      * Notify the child to shutdown. The child will in turn call FinishShutdown
    859      * and let the parent close the channel.
    860      */
    861     async Shutdown();
    862 
    863     async LoadProcessScript(nsString url);
    864 
    865     /**
    866      * Requests a full native update of a native plugin child window. This is
    867      * a Windows specific call.
    868      */
    869     async UpdateWindow(uintptr_t aChildId);
    870 
    871     /**
    872      * Notify the child that cache is emptied.
    873      */
    874     async NotifyEmptyHTTPCache();
    875 
    876     /**
    877      * Send a `push` event without data to a service worker in the child.
    878      */
    879     async Push(nsCString scope, nullable nsIPrincipal principal, nsString messageId);
    880 
    881     /**
    882      * Send a `push` event with data to a service worker in the child.
    883      */
    884     async PushWithData(nsCString scope, nullable nsIPrincipal principal,
    885                        nsString messageId, uint8_t[] data);
    886 
    887     async GetFilesResponse(nsID aID, GetFilesResponseResult aResult);
    888 
    889     async BlobURLRegistration(nsCString aURI, IPCBlob aBlob,
    890                               nullable nsIPrincipal aPrincipal, nsCString aPartitionKey);
    891 
    892     async BlobURLUnregistration(nsCString[] aURIs);
    893 
    894     async GMPsChanged(GMPCapabilityData[] capabilities);
    895 
    896 
    897     async ProvideAnonymousTemporaryFile(uint64_t aID, FileDescOrError aFD);
    898 
    899     async SetPermissionsWithKey(nsCString aPermissionKey, Permission[] aPermissions);
    900 
    901     async RefreshScreens(ScreenDetails[] aScreens);
    902 
    903     async ShareCodeCoverageMutex(CrossProcessMutexHandle handle);
    904     async FlushCodeCoverageCounters() returns (bool unused);
    905 
    906     /*
    907      * IPC message to enable the input event queue on the main thread of the
    908      * content process.
    909      */
    910     async SetInputEventQueueEnabled();
    911 
    912     /*
    913      * IPC message to flush the input event queue on the main thread of the
    914      * content process.
    915      *
    916      * When the ContentParent stops sending the input event with input priority,
    917      * there may be some pending events in the input event queue and normal
    918      * event queue. Here is a possible scenario.
    919      * R: Runnables.
    920      * D: Enable the input priority event.
    921      * E: Disable the input priority evnet.
    922      *
    923      *                     D       E
    924      * Normal Queue: R1      R2      R3
    925      * Input Queue:     II      I2      I3
    926      *
    927      * To avoid the newly added normal events (e.g. R2, which may be an input
    928      * event) preempt the pending input events (e.g. I1), or the newly added
    929      * input events (e.g. I3) preempt the pending normal events (e.g. R2), we
    930      * have to flush all pending events before enabling and disabling the input
    931      * priority event.
    932      *
    933      * To flush the normal event queue and the input event queue, we use three
    934      * IPC messages as the followings.
    935      * FI: Flush the input queue.
    936      * SI: Suspend the input queue.
    937      * RI: Resume the input queue.
    938      *
    939      * Normal Queue: R1    FI    RI R2   FI    RI R3
    940      * Input Queue:     II    SI      I2    SI       I3
    941      *
    942      * When the flush input request is processed before the other two requests,
    943      * we consume all input events until the suspend request. After handling the
    944      * suspend request, we stop consuming the input events until the resume
    945      * request to make sure we consume all pending normal events.
    946      *
    947      * If we process the suspend request before the other two requests, we
    948      * ignore the flush request and consume all pending normal events until the
    949      * resume request.
    950      */
    951     async FlushInputEventQueue();
    952 
    953     /*
    954      * IPC message to resume consuming the pending events in the input event
    955      * queue.
    956      */
    957     async ResumeInputEventQueue();
    958 
    959     /*
    960      * IPC message to suspend consuming the pending events in the input event
    961      * queue.
    962      */
    963     [Priority=input] async SuspendInputEventQueue();
    964 
    965     /*
    966      * IPC message to propagate dynamic scalar definitions, added after the
    967      * content process is spawned, from the parent to the child.
    968      * Dynamic scalar definitions added at the process startup are handled
    969      * using the |TelemetryIPC::AddDynamicScalarDefinitions| functions.
    970      */
    971     async AddDynamicScalars(DynamicScalarDefinition[] definitions);
    972 
    973     // This message is sent to content processes, and triggers the creation of a
    974     // new HttpChannelChild that will be connected to the parent channel
    975     // represented by registrarId.
    976     // This is on PContent not PNecko, as PNecko may not be initialized yet.
    977     // The returned loadInfo needs to be set on the channel - since the channel
    978     // moved to a new process it now has different properties.
    979 
    980     async CrossProcessRedirect(RedirectToRealChannelArgs args,
    981                                Endpoint<PStreamFilterParent>[] aEndpoint)
    982         returns (nsresult rv);
    983 
    984     /**
    985     * This method is used to notifty content process to start delayed autoplay
    986     * media via browsing context.
    987     */
    988     async StartDelayedAutoplayMediaComponents(MaybeDiscardedBrowsingContext aContext);
    989 
    990     /**
    991      * This method is used to dispatch MediaControlAction to content process in
    992      * order to control media within a specific browsing context tree.
    993      */
    994     async UpdateMediaControlAction(MaybeDiscardedBrowsingContext aContext,
    995                                    MediaControlAction aAction);
    996 
    997     // Begin subscribing to a new BrowsingContextGroup, sending down the current
    998     // value for every individual BrowsingContext.
    999     async RegisterBrowsingContextGroup(uint64_t aGroupId,
   1000                                        SyncedContextInitializer[] aInits,
   1001                                        OriginAgentClusterInitializer[] aUseOriginAgentCluster);
   1002 
   1003     // The BrowsingContextGroup has been destroyed in the parent process. The
   1004     // content process won't destroy the group until it receives this message or
   1005     // during shutdown.
   1006     //
   1007     // When the content process receives this message, all contexts in the group
   1008     // should have already been destroyed.
   1009     async DestroyBrowsingContextGroup(uint64_t aGroupId);
   1010 
   1011     // Set the "use origin agent cluster" flag on the given BrowsingContextGroup
   1012     // for the given principal.
   1013     async SetUseOriginAgentCluster(uint64_t aGroupId, nsIPrincipal aPrincipal,
   1014                                    bool aUseOriginAgentCluster);
   1015 
   1016 #if defined(MOZ_SANDBOX) && defined(MOZ_DEBUG) && defined(ENABLE_TESTS)
   1017     // Initialize top-level actor for testing content process sandbox.
   1018     async InitSandboxTesting(Endpoint<PSandboxTestingChild> aEndpoint);
   1019 #endif
   1020 
   1021     async LoadURI(MaybeDiscardedBrowsingContext aContext, nsDocShellLoadState aLoadState, bool aSetNavigating)
   1022         returns (bool aSuccess);
   1023 
   1024     async InternalLoad(nsDocShellLoadState aLoadState);
   1025 
   1026     async DisplayLoadError(MaybeDiscardedBrowsingContext aContext, nsString aURI);
   1027 
   1028     async GoBack(MaybeDiscardedBrowsingContext aContext, int32_t? aCancelContentJSEpoch, bool aRequireUserInteraction, bool aUserActivation);
   1029     async GoForward(MaybeDiscardedBrowsingContext aContext, int32_t? aCancelContentJSEpoch, bool aRequireUserInteraction, bool aUserActivation);
   1030     async GoToIndex(MaybeDiscardedBrowsingContext aContext, int32_t aIndex, int32_t? aCancelContentJSEpoch, bool aUserActivation);
   1031     async Reload(MaybeDiscardedBrowsingContext aContext, uint32_t aReloadFlags);
   1032     async StopLoad(MaybeDiscardedBrowsingContext aContext, uint32_t aStopFlags);
   1033 
   1034     async OnAllowAccessFor(MaybeDiscardedBrowsingContext aParentContext,
   1035                            nsCString aTrackingOrigin,
   1036                            uint32_t aCookieBehavior,
   1037                            StorageAccessPermissionGrantedReason aReason);
   1038 
   1039     async OnContentBlockingDecision(MaybeDiscardedBrowsingContext aContext,
   1040                                     BlockingDecision aReason,
   1041                                     uint32_t aRejectedReason);
   1042 
   1043     /**
   1044      * Abort orientationPendingPromises for documents in the child which
   1045      * are part of a BrowsingContextGroup.
   1046      */
   1047     async AbortOrientationPendingPromises(MaybeDiscardedBrowsingContext aContext);
   1048 
   1049     async HistoryCommitIndexAndLength(MaybeDiscardedBrowsingContext aContext,
   1050                                       uint32_t aIndex, uint32_t aLength,
   1051                                       nsID aChangeID);
   1052 
   1053     async GetLayoutHistoryState(MaybeDiscardedBrowsingContext aContext)
   1054         returns (nullable nsILayoutHistoryState aState, Wireframe? aWireframe);
   1055 
   1056     async DispatchLocationChangeEvent(MaybeDiscardedBrowsingContext aContext);
   1057 
   1058     // Dispatches a "beforeunload" event to each in-process content window in the
   1059     // subtree beginning at `aStartingAt`, and returns the result as documented in
   1060     // the `PermitUnloadResult` enum. If `aStartingAt` is an in-process, top-level
   1061     // browsing context, then a "navigate" event will also be dispatched.
   1062     // See https://html.spec.whatwg.org/#preventing-navigation:fire-a-traverse-navigate-event
   1063     async DispatchBeforeUnloadToSubtree(MaybeDiscardedBrowsingContext aStartingAt, SessionHistoryInfo? info)
   1064         returns (PermitUnloadResult result);
   1065 
   1066     // Only dispatches "navigate" to the traversable. Used in case we don't want to dispatch beforeunload.
   1067     async DispatchNavigateToTraversable(MaybeDiscardedBrowsingContext aTraversable, SessionHistoryInfo? info)
   1068         returns (PermitUnloadResult result);
   1069 
   1070     // Update the cached list of codec supported in the given process.
   1071     async UpdateMediaCodecsSupported(RemoteMediaIn aLocation, MediaCodecsSupported aSupported);
   1072 
   1073     // Used to initialize the global variable in content processes with the
   1074     // latched value in the parent process. See dom/LocalStorageCommon.h for more
   1075     // details.
   1076     async InitNextGenLocalStorageEnabled(bool enabled);
   1077 
   1078     async PRemotePrintJob();
   1079 
   1080 #ifdef MOZ_WMF_CDM
   1081     async UpdateMFCDMOriginEntries(IPCOriginStatusEntry[] aEntries);
   1082 #endif
   1083 
   1084 both:
   1085     // Update the "History Action Activation" timestamp for all parents in the
   1086     // subtree beginning at `aTop`.
   1087     async ConsumeHistoryActivation(MaybeDiscardedBrowsingContext aTop);
   1088 
   1089 parent:
   1090     async SynchronizeLayoutHistoryState(MaybeDiscardedBrowsingContext aContext,
   1091                                         nullable nsILayoutHistoryState aState);
   1092 
   1093     async SessionHistoryEntryTitle(MaybeDiscardedBrowsingContext aContext,
   1094                                    nsString aTitle);
   1095 
   1096     async SessionHistoryEntryScrollRestorationIsManual(MaybeDiscardedBrowsingContext aContext,
   1097                                                        bool aIsManual);
   1098     async SessionHistoryEntryScrollPosition(MaybeDiscardedBrowsingContext aContext,
   1099                                             int32_t aX, int32_t aY);
   1100 
   1101     async SessionHistoryEntryCacheKey(MaybeDiscardedBrowsingContext aContext,
   1102                                       uint32_t aCacheKey);
   1103 
   1104     async SessionHistoryEntryStoreWindowNameInContiguousEntries(MaybeDiscardedBrowsingContext aContext,
   1105                                                                 nsString aName);
   1106 
   1107     async SessionHistoryEntryWireframe(MaybeDiscardedBrowsingContext aContext,
   1108                                        Wireframe aWireframe);
   1109 
   1110     async GetLoadingSessionHistoryInfoFromParent(MaybeDiscardedBrowsingContext aContext)
   1111         returns (LoadingSessionHistoryInfo? aLoadingInfo);
   1112 
   1113     async SynchronizeNavigationAPIState(MaybeDiscardedBrowsingContext aContext,
   1114         ClonedMessageData aState);
   1115 
   1116     async RemoveFromBFCache(MaybeDiscardedBrowsingContext aContext);
   1117 
   1118     async InitBackground(Endpoint<PBackgroundStarterParent> aEndpoint);
   1119 
   1120     async CreateGMPService();
   1121 
   1122     async CreateClipboardContentAnalysis(Endpoint<PClipboardContentAnalysisParent> aParentEndpoint);
   1123 
   1124     async InitStreamFilter(uint64_t channelId, nsString addonId)
   1125         returns (Endpoint<PStreamFilterChild> aEndpoint);
   1126 
   1127     async PRemoteSpellcheckEngine();
   1128 
   1129     async InitCrashReporter(CrashReporterInitArgs aInitArgs);
   1130 
   1131     sync IsSecureURI(nullable nsIURI aURI, OriginAttributes aOriginAttributes)
   1132         returns (bool isSecureURI);
   1133 
   1134     async AccumulateMixedContentHSTS(nullable nsIURI aURI, bool aActive,
   1135                                      OriginAttributes aOriginAttributes);
   1136 
   1137     [Nested=inside_cpow] async PHal();
   1138 
   1139     async PHeapSnapshotTempFileHelper();
   1140 
   1141     async PNecko();
   1142 
   1143 #ifdef MOZ_WEBSPEECH
   1144     async PSpeechSynthesis();
   1145 #endif
   1146 
   1147     async PMedia();
   1148 
   1149 #ifdef MOZ_WEBRTC
   1150     async PWebrtcGlobal();
   1151 #endif
   1152 
   1153     async CreateAudioIPCConnection() returns (FileDescOrError fd);
   1154 
   1155     sync PURLClassifier(nullable nsIPrincipal principal)
   1156         returns (bool success);
   1157 
   1158     async PURLClassifierLocal(nullable nsIURI uri, IPCURLClassifierFeature[] features);
   1159     async PURLClassifierLocalByName(nullable nsIURI uri, nsCString[] featureNames, listType aListType);
   1160 
   1161     async PSessionStorageObserver();
   1162 
   1163     // Services remoting
   1164 
   1165     async StartVisitedQueries(nullable nsIURI[] uri);
   1166     async SetURITitle(nullable nsIURI uri, nsString title);
   1167 
   1168     async LoadURIExternal(nullable nsIURI uri,
   1169                           nullable nsIPrincipal triggeringPrincipal,
   1170                           nullable nsIPrincipal redirectPrincipal,
   1171                           MaybeDiscardedBrowsingContext browsingContext,
   1172                           bool wasExternallyTriggered,
   1173                           bool hasValidUserGestureActivation,
   1174                           bool newWindowTarget);
   1175     async ExtProtocolChannelConnectParent(uint64_t registrarId);
   1176 
   1177     sync SyncMessage(nsString aMessage, ClonedMessageData aData)
   1178       returns (UniquePtr<StructuredCloneData>[] retval);
   1179 
   1180     async AddSecurityState(MaybeDiscardedWindowContext aContext, uint32_t aStateFlags);
   1181 
   1182     // Creates a helper for forwarding data from an nsExternalAppHandler
   1183     // running in the content process, to one running in the parent
   1184     // process.
   1185     // Bug 1574372 aims to run nsExternalAppHandler entirely in the
   1186     // parent so that we can remove this.
   1187     //
   1188     // Serializes the uri, loadInfo, contentType, referrer, contentDisposition
   1189     // headers and contentLength of the channel so that we can make them
   1190     // available to the parent instance via a nsIChannel helper. Also
   1191     // passes whether the original channel was an instance of nsIFileChannel.
   1192     //
   1193     // aContext is the BrowsingContext that initiated the load, and created the
   1194     // channel.
   1195     //
   1196     // Pass true for aForceSave to always save this content to disk, regardless of
   1197     // nsIMIMEInfo and other such influences.
   1198     async PExternalHelperApp(nullable nsIURI uri,
   1199                              LoadInfoArgs loadInfoArgs,
   1200                              nsCString aMimeContentType,
   1201                              nsCString aContentDisposition,
   1202                              uint32_t aContentDispositionHint,
   1203                              nsString aContentDispositionFilename,
   1204                              bool aForceSave,
   1205                              int64_t aContentLength,
   1206                              bool aWasFileChannel,
   1207                              nullable nsIURI aReferrer,
   1208                              MaybeDiscardedBrowsingContext aContext);
   1209 
   1210     async PHandlerService();
   1211 
   1212     async AddGeolocationListener(bool highAccuracy);
   1213     async RemoveGeolocationListener();
   1214     async SetGeolocationHigherAccuracy(bool enable);
   1215 
   1216     async ConsoleMessage(nsString message);
   1217     async ScriptErrorWithStack(nsString message, nsCString sourceName,
   1218                                uint32_t lineNumber, uint32_t colNumber, uint32_t flags,
   1219                                nsCString category, bool isFromPrivateWindow,
   1220                                bool isFromChromeContext, ClonedMessageData stack);
   1221 
   1222     // Places the items within dataTransfer on the clipboard.
   1223     async SetClipboard(IPCTransferable aTransferable,
   1224                        ClipboardType aWhichClipboard, MaybeDiscardedWindowContext aRequestingWindowContext);
   1225 
   1226     // Given a list of supported types, returns the clipboard data for the
   1227     // first type that matches.
   1228     // aRequestingWindowContext is the window that is requesting the clipboard,
   1229     // which is used for content analysis.
   1230     sync GetClipboard(nsCString[] aTypes, ClipboardType aWhichClipboard,
   1231                       MaybeDiscardedWindowContext aRequestingWindowContext)
   1232         returns (IPCTransferableDataOrError transferableDataOrError);
   1233 
   1234     // Requests getting data from clipboard.
   1235     async GetClipboardDataSnapshot(nsCString[] aTypes, ClipboardType aWhichClipboard,
   1236                                    MaybeDiscardedWindowContext aRequestingWindowContext,
   1237                                    nsIPrincipal aRequestingPrincipal)
   1238         returns (ClipboardReadRequestOrError aClipboardReadRequestOrError);
   1239 
   1240     // Requests getting data from clipboard.
   1241     sync GetClipboardDataSnapshotSync(nsCString[] aTypes, ClipboardType aWhichClipboard,
   1242                                       MaybeDiscardedWindowContext aRequestingWindowContext)
   1243         returns (ClipboardReadRequestOrError aClipboardReadRequestOrError);
   1244 
   1245     // Clears the clipboard.
   1246     async EmptyClipboard(ClipboardType aWhichClipboard);
   1247 
   1248     // Returns true if data of one of the specified types is on the clipboard.
   1249     sync ClipboardHasType(nsCString[] aTypes, ClipboardType aWhichClipboard)
   1250         returns (bool hasType);
   1251 
   1252     /**
   1253      * Notify the parent that the child has started a clipboard write request,
   1254      * and that the data will be sent over another IPC message once it is ready.
   1255      * @param  aClipboardType
   1256      *         The clipboard type defined in nsIClipboard.
   1257      * @param  aSettingWindowContext
   1258      *         The window context that is setting the clipboard, if any. This is used
   1259      *         to possibly bypass Content Analysis if a set clipboard and get clipboard
   1260      *         operation are done on the same page.
   1261      */
   1262     async PClipboardWriteRequest(ClipboardType aClipboardType, MaybeDiscardedWindowContext aSettingWindowContext);
   1263 
   1264     sync GetIconForExtension(nsCString aFileExt, uint32_t aIconSize)
   1265         returns (uint8_t[] bits);
   1266 
   1267     // Tell the parent that the child has gone idle for the first time.
   1268     async FirstIdle();
   1269 
   1270     async CopyFavicon(nullable nsIURI oldURI, nullable nsIURI newURI, bool isPrivate);
   1271 
   1272     async FindImageText(IPCImage image, nsCString[] languages)
   1273         returns (TextRecognitionResultOrError result);
   1274 
   1275     // Graphics errors
   1276     async GraphicsError(nsCString aError);
   1277 
   1278     // Driver crash guards. aGuardType must be a member of CrashGuardType.
   1279     sync BeginDriverCrashGuard(uint32_t aGuardType) returns (bool crashDetected);
   1280     sync EndDriverCrashGuard(uint32_t aGuardType);
   1281 
   1282     async AddIdleObserver(uint64_t observerId, uint32_t idleTimeInS);
   1283     async RemoveIdleObserver(uint64_t observerId, uint32_t idleTimeInS);
   1284 
   1285     /**
   1286      * This message is only used on X11 platforms.
   1287      *
   1288      * Send a dup of the plugin process's X socket to the parent
   1289      * process.  In theory, this scheme keeps the plugin's X resources
   1290      * around until after both the plugin process shuts down *and* the
   1291      * parent process closes the dup fd.  This is used to prevent the
   1292      * parent process from crashing on X errors if, e.g., the plugin
   1293      * crashes *just before* a repaint and the parent process tries to
   1294      * use the newly-invalid surface.
   1295      */
   1296     async BackUpXResources(FileDescriptor aXSocketFd);
   1297 
   1298     async RequestAnonymousTemporaryFile(uint64_t aID);
   1299 
   1300     /**
   1301      * Notifies the parent that the child needs no more ForceKill dump.
   1302      */
   1303     [Priority=control] async NotifyShutdownSuccess();
   1304 
   1305     /**
   1306      * Notifies the parent to continue shutting down after the child performs
   1307      * its shutdown tasks.
   1308      */
   1309     async FinishShutdown();
   1310 
   1311     /**
   1312      * Initiates an asynchronous request for permission for the
   1313      * provided principal.
   1314      *
   1315      * @param aRequests
   1316      *   The array of permissions to request.
   1317      * @param aPrincipal
   1318      *   The principal of the request.
   1319      * @param aTopLevelPrincipal
   1320      *   The principal of the top level page the request comes from.
   1321      * @param tabId
   1322      *   To identify which tab issues this request.
   1323      *
   1324      * NOTE: The principal is untrusted in the parent process. Only
   1325      *       principals that can live in the content process should
   1326      *       provided.
   1327      */
   1328     async PContentPermissionRequest(PermissionRequest[] aRequests,
   1329                                     nullable nsIPrincipal aPrincipal,
   1330                                     nullable nsIPrincipal aTopLevelPrincipal,
   1331                                     bool aIsHandlingUserInput,
   1332                                     bool aMaybeUnsafePermissionDelegate,
   1333                                     TabId tabId);
   1334 
   1335     /**
   1336      * If the profiler is running when the process shuts down, this sends the
   1337      * profile data collected so far.
   1338      *
   1339      * @param aProfile
   1340      *   This may contain an empty string (unknown issue), an error message
   1341      *   starting with '*', or a profile as a stringified JSON object.
   1342      */
   1343     async ShutdownProfile(nsCString aProfile);
   1344 
   1345     /**
   1346      * This sends any collected perf stats data on shutdown.
   1347      */
   1348     async ShutdownPerfStats(nsCString aPerfStats);
   1349 
   1350     /**
   1351      * A shared font list (see gfx/thebes/SharedFontList.*) contains a list
   1352      * of shared-memory blocks that are used to store all the font list data.
   1353      * The font list created in the parent process is the only one that can
   1354      * create or store objects into the shared memory; content processes font
   1355      * lists have read-only access to it.
   1356      *
   1357      * To minimize the cost of record allocations, the shared font list
   1358      * bump-allocates new objects that it adds to the shared memory blocks
   1359      * (i.e. the records stored in the shared memory blocks are only ever
   1360      * appended, and never freed except when the entire font list is
   1361      * reconstructed).
   1362      *
   1363      * When initially created by the parent process, the font list may contain
   1364      * nothing except a header, and the list of the system's installed font
   1365      * family names. Additional data about the families (styled faces available
   1366      * and character coverage) is appended to the font list during the session
   1367      * as a given font is considered for use, because loading all data for all
   1368      * installed fonts during startup is too expensive/slow.
   1369      *
   1370      * During content process launch, a content process's first step in
   1371      * gaining access to the font list is to call GetFontListShmBlock,
   1372      * passing index zero in order to get access to the first block, which
   1373      * contains the font list header and the list of font-family records
   1374      * (which may be virtually all uninitialized at this time, containing
   1375      * nothing but the family names). Once a content process determines a
   1376      * font-family name it wants to use (e.g. from a CSS font-family list, or
   1377      * from preferences), if that Family record has not yet been initialized,
   1378      * it will call InitializeFamily (below) to have the parent process
   1379      * populate Face records in the shared memory with the family's styles.
   1380      * The content process can then pick the face with best style match from
   1381      * the available faces according to the CSS font matching algorithm, load
   1382      * its character map, then send the map to the parent process using
   1383      * SetCharacterMap (so that the parent process can share the map with all
   1384      * processes to avoid duplication of work).
   1385      *
   1386      * At some point, as the parent process adds data to the font list, a new
   1387      * shared-memory block will probably be needed. At that point the parent
   1388      * will create a new block and append it to its share memory block list.
   1389      * The new Block index will start to appear in Pointer records in the
   1390      * shared memory, and the content process's can then fetch those other
   1391      * blocks using this function as needed.
   1392      *
   1393      * @param aGeneration
   1394      *   The font list has a Generation ID stored in its Header, and any time
   1395      *   the parent process needs to reinitialize the list (because of a change
   1396      *   in the available font repertoire) a new Generation ID is assigned.
   1397      *   Content processes pass the Generation of the list they're using in
   1398      *   all messages, so that the parent can recognize if they're out of date
   1399      *   and safely ignore such messages. (When the parent rebuilds the list,
   1400      *   it will notify all content processes, but they may still send a few
   1401      *   messages that relate to the obsolete list before they have processed
   1402      *   this notification.)
   1403      * @param aIndex
   1404      *   (Zero-based) index of the shared-memory block to be mapped.
   1405      *   In a typical case, there will be a handful of blocks altogether, so
   1406      *   each content process only needs to make this request a few times.
   1407      * @returns aHandle
   1408      *   Handle that can be used to construct a SharedMemory that maps the
   1409      *   requested block of memory.
   1410      *   If aGeneration does not match the parent's font list generation ID, or
   1411      *   if requesting a block that does not exist (i.e. with aIndex greater
   1412      *   than or equal to the number of blocks actually in existence), returns
   1413      *   a null handle.
   1414      *
   1415      * This is a sync message because the content process needs font data in
   1416      * order to perform font-matching (e.g. during reflow), and cannot continue
   1417      * until it has mapped the font-list memory.
   1418      */
   1419     sync GetFontListShmBlock(uint32_t aGeneration, uint32_t aIndex)
   1420         returns (ReadOnlySharedMemoryHandle aHandle);
   1421 
   1422     /**
   1423      * Ask the parent to initialize a given font family, so that face metadata
   1424      * will be available. Content processes will only call this for families
   1425      * where the Face data has not yet been populated, so it will generally be
   1426      * called no more than once per family. (It may not be needed at all, if
   1427      * the parent process has already initialized the families that content
   1428      * wants to use.)
   1429      *
   1430      * @param aGeneration
   1431      *   Font-list generation, so requests relating to an obsolete list can be
   1432      *   ignored (see comments for GetFontListShmBlock).
   1433      * @param aFamilyIndex
   1434      *   The 0-based index of the Family within the font-list that a content
   1435      *   process needs to use.
   1436      * @param aLoadCmaps
   1437      *   If true, the parent should eagerly load character maps for the faces
   1438      *   in the family.
   1439      *
   1440      * This is a sync message because the content process cannot complete its
   1441      * font-matching until the family is fully populated with Face records.
   1442      * If we make it async, content processes will reflow using fallbacks,
   1443      * and then have to reflow again once all the font information needed
   1444      * becomes available.
   1445      */
   1446     sync InitializeFamily(uint32_t aGeneration, uint32_t aFamilyIndex,
   1447                           bool aLoadCmaps);
   1448 
   1449     /**
   1450      * Record the character map of a given Face in the font list.
   1451      *
   1452      * @param aGeneration
   1453      *   Font-list generation, so requests relating to an obsolete list can be
   1454      *   ignored (see comments for GetFontListShmBlock).
   1455      * @param aFamilyIndex
   1456      *   Index of the font family in the font list (see aAlias for which list).
   1457      * @param aAlias
   1458      *   Whether aFamilyIndex refers to the Families() or AliasFamilies() list.
   1459      * @param aFaceIndex
   1460      *   Index of the face within the family's Faces() list.
   1461      * @param aMap
   1462      *   The character coverage map of the face. (This will be stored as a
   1463      *   SharedBitSet record within the shared font list, and the Face record
   1464      *   will be updated to reference it.)
   1465      */
   1466     async SetCharacterMap(uint32_t aGeneration, uint32_t aFamilyIndex, bool aAlias,
   1467                           uint32_t aFaceIndex, gfxSparseBitSet aMap);
   1468 
   1469     /**
   1470      * Ask the parent to set up the merged charmap for a family, to accelerate
   1471      * future fallback searches.
   1472      * aFamilyIndex may refer to an element in either Families() or AliasFamilies(),
   1473      * with aAlias determining which.
   1474      */
   1475     async SetupFamilyCharMap(uint32_t aGeneration, uint32_t aFamilyIndex, bool aAlias);
   1476 
   1477     /**
   1478      * Ask the parent to try and complete the InitOtherFamilyNames task, because
   1479      * we're trying to look up a localized font name. This is a sync method so that
   1480      * the update will be available before the child continues reflow; however, it
   1481      * is possible the task will have timed-out in the parent and not actually
   1482      * completed during this call.
   1483      *
   1484      * @param aGeneration
   1485      *   Font-list generation, so requests relating to an obsolete list can be
   1486      *   ignored (see comments for GetFontListShmBlock).
   1487      * @param aDefer
   1488      *   Parameter aDeferOtherFamilyNamesLoading to be passed to
   1489      *   gfxPlatformFontList::InitOtherFamilyNames, to determine whether name
   1490      *   loading should be deferred to a background task or run immediately.
   1491      * @param aLoaded
   1492      *   Returns whether the font name loading process has completed.
   1493      *
   1494      * TODO: This is currently a sync message but can probably be made async,
   1495      * at the cost of an increased chance of some testcases failing because
   1496      * they depend on lazily-loaded font names.
   1497      */
   1498     sync InitOtherFamilyNames(uint32_t aGeneration, bool aDefer) returns (bool aLoaded);
   1499 
   1500     /**
   1501      * Ask the parent to load all font character maps, as we need to do an
   1502      * exhaustive font-fallback search. This is done asynchronously; when it
   1503      * finishes, the parent will trigger global reflow so that font selection
   1504      * is re-done in all content, making use of the newly-loaded cmaps.
   1505      * Normally this will only happen once per browser session (unless the
   1506      * font list is rebuilt due to installation/removal of system fonts).
   1507      *
   1508      * @param aGeneration
   1509      *   Font-list generation, so requests relating to an obsolete list can be
   1510      *   ignored (see comments for GetFontListShmBlock).
   1511      * @param aStartIndex
   1512      *   The family index to start from; the sender has determined that cmaps
   1513      *   up to this point are already loaded.
   1514      */
   1515     async StartCmapLoading(uint32_t aGeneration, uint32_t aStartIndex);
   1516 
   1517     /**
   1518      * Ask the parent for a specific hyphenation resource (identified by URI)
   1519      * as a shared memory block.
   1520      *
   1521      * This is a sync method because at the point where a content process finds
   1522      * that it requires a particular hyphenation dictionary, this is blocking
   1523      * reflow; making it async would require scheduling another reflow after
   1524      * the resource is available, and a possible layout "jump" as line-breaks
   1525      * change. Note that the content process retains a reference to each such
   1526      * resource it requests, so it will only make this call once per locale for
   1527      * which hyphenation data exists.
   1528      *
   1529      * @param aURI
   1530      *   The URI (which currently must always point to an omnijar resource)
   1531      *   for the required hyphenation dictionary.
   1532      * @param aHandle
   1533      *   Returns the shmem handle to the resource (or an invalid shmem handle
   1534      *   in case of failure).
   1535      * @param aLoaded
   1536      *   Returns the size in bytes of the resource.
   1537      */
   1538     sync GetHyphDict(nullable nsIURI aURI) returns (ReadOnlySharedMemoryHandle aHandle);
   1539 
   1540     async CreateWindow(PBrowser aThisTab,
   1541                        MaybeDiscardedBrowsingContext aParent,
   1542                        PBrowser aNewTab,
   1543                        uint32_t aChromeFlags,
   1544                        bool aCalledFromJS,
   1545                        bool aForPrinting,
   1546                        bool aForWindowDotPrint,
   1547                        bool aTopLevelCreatedByContent,
   1548                        nullable nsIURI aURIToLoad,
   1549                        nsCString aFeatures,
   1550                        Modifiers aModifiers,
   1551                        nullable nsIPrincipal aTriggeringPrincipal,
   1552                        nullable nsIPolicyContainer aPolicyContainer,
   1553                        nullable nsIReferrerInfo aReferrerInfo,
   1554                        OriginAttributes aOriginAttributes,
   1555                        bool aUserActivation,
   1556                        bool aTextDirectiveUserActivation)
   1557         returns (CreatedWindowInfo window);
   1558 
   1559     async CreateWindowInDifferentProcess(
   1560       PBrowser aThisTab,
   1561       MaybeDiscardedBrowsingContext aParent,
   1562       uint32_t aChromeFlags,
   1563       bool aCalledFromJS,
   1564       bool aTopLevelCreatedByContent,
   1565       nullable nsIURI aURIToLoad,
   1566       nsCString aFeatures,
   1567       Modifiers aModifiers,
   1568       nsString aName,
   1569       nullable nsIPrincipal aTriggeringPrincipal,
   1570       nullable nsIPolicyContainer aPolicyContainer,
   1571       nullable nsIReferrerInfo aReferrerInfo,
   1572       OriginAttributes aOriginAttributes,
   1573       bool aUserActivation,
   1574       bool aTextDirectiveUserActivation);
   1575 
   1576     /**
   1577      * Notify `push-message` observers without data in the parent.
   1578      */
   1579     async NotifyPushObservers(nsCString scope, nullable nsIPrincipal principal,
   1580                               nsString messageId);
   1581 
   1582     /**
   1583      * Notify `push-message` observers with data in the parent.
   1584      */
   1585     async NotifyPushObserversWithData(nsCString scope, nullable nsIPrincipal principal,
   1586                                       nsString messageId, uint8_t[] data);
   1587 
   1588      async GetFilesRequest(nsID aID, nsString[] aDirectories, bool aRecursiveFlag);
   1589      async DeleteGetFilesRequest(nsID aID);
   1590 
   1591      async StoreAndBroadcastBlobURLRegistration(nsCString url, IPCBlob blob,
   1592                                                 nullable nsIPrincipal principal, nsCString aPartitionKey);
   1593 
   1594      async UnstoreAndBroadcastBlobURLUnregistration(BroadcastBlobURLUnregistrationRequest[] aRequests);
   1595 
   1596     /**
   1597      * Messages for communicating child Glean data to the parent process
   1598      */
   1599     async RecordPageLoadEvent(PageloadEventData event, TimeStamp navigationStartTime, uint64_t aAndroidAppLinkLoadIdentifier);
   1600 
   1601     /**
   1602      * Messages for communicating child Telemetry to the parent process
   1603      */
   1604     async AccumulateChildHistograms(HistogramAccumulation[] accumulations);
   1605     async AccumulateChildKeyedHistograms(KeyedHistogramAccumulation[] accumulations);
   1606     async UpdateChildScalars(ScalarAction[] updates);
   1607     async UpdateChildKeyedScalars(KeyedScalarAction[] updates);
   1608     async RecordChildEvents(ChildEventData[] events);
   1609     async RecordDiscardedData(DiscardedData data);
   1610 
   1611     async AddMemoryReport(MemoryReport aReport);
   1612 
   1613     async BHRThreadHang(HangDetails aHangDetails);
   1614 
   1615     /*
   1616      * Adds a certificate exception for the given hostname and port.
   1617      */
   1618     async AddCertException(nullable nsIX509Cert aCert, nsCString aHostName,
   1619                            int32_t aPort, OriginAttributes aOriginAttributes,
   1620                            bool aIsTemporary)
   1621           returns (nsresult success);
   1622 
   1623     /*
   1624      * Determines whether storage access can be granted automatically by the
   1625      * storage access API without showing a user prompt.
   1626      */
   1627     async AutomaticStorageAccessPermissionCanBeGranted(nullable nsIPrincipal aPrincipal)
   1628           returns (bool success);
   1629 
   1630     /*
   1631      * A 3rd party tracking origin (aTrackingOrigin) has received the permission
   1632      * granted to have access to aGrantedOrigin when loaded by aParentWindowId.
   1633      */
   1634     async StorageAccessPermissionGrantedForOrigin(uint64_t aTopLevelWindowId,
   1635                                                   MaybeDiscardedBrowsingContext aParentContext,
   1636                                                   nullable nsIPrincipal aTrackingPrincipal,
   1637                                                   nsCString aTrackingOrigin,
   1638                                                   int aAllowMode,
   1639                                                   StorageAccessPermissionGrantedReason? aReason,
   1640                                                   bool aFrameOnly)
   1641           returns (bool unused);
   1642 
   1643     async CompleteAllowAccessFor(MaybeDiscardedBrowsingContext aParentContext,
   1644                                  uint64_t aTopLevelWindowId,
   1645                                  nullable nsIPrincipal aTrackingPrincipal,
   1646                                  nsCString aTrackingOrigin,
   1647                                  uint32_t aCookieBehavior,
   1648                                  StorageAccessPermissionGrantedReason aReason)
   1649           returns (StorageAccessPromptChoices? choice);
   1650 
   1651     async SetAllowStorageAccessRequestFlag(
   1652                                  nullable nsIPrincipal aEmbeddingPrincipal,
   1653                                  nullable nsIURI aEmbeddedOrigin)
   1654           returns (bool success);
   1655 
   1656     async TestAllowStorageAccessRequestFlag(
   1657                                  nullable nsIPrincipal aEmbeddedPrincipal,
   1658                                  nullable nsIURI aEmbeddingOrigin)
   1659           returns (bool success);
   1660 
   1661     async StoreUserInteractionAsPermission(nullable nsIPrincipal aPrincipal);
   1662 
   1663     async TestCookiePermissionDecided(MaybeDiscardedBrowsingContext aContext,
   1664                          nullable nsIPrincipal aPrincipal)
   1665           returns (bool? allowed);
   1666 
   1667     async TestStorageAccessPermission(nullable nsIPrincipal aEmbeddingPrincipal,
   1668                          nsCString aEmbeddedOrigin)
   1669           returns (bool? allowed);
   1670 
   1671    /**
   1672     * When media element's controlled state changed in the content process, we
   1673     * have to notify the chrome process in order to update the status of the
   1674     * corresponding media controller, which is used to control all media in the
   1675     * certain tab. We would use the browsing context to find the corresponding
   1676     * controller.
   1677     */
   1678     async NotifyMediaPlaybackChanged(MaybeDiscardedBrowsingContext aContext,
   1679                                      MediaPlaybackState aState);
   1680 
   1681    /**
   1682     * When media became audible or inaudible in content process, we have to
   1683     * notify chrome process in order to which tab is audible.
   1684     */
   1685     async NotifyMediaAudibleChanged(MaybeDiscardedBrowsingContext aContext,
   1686                                     MediaAudibleState aState);
   1687 
   1688    /**
   1689     * When media enabled or disabled the Picture-in-Picture mode, we have to
   1690     * update that to the media controller in the chrome process.
   1691     */
   1692     async NotifyPictureInPictureModeChanged(
   1693         MaybeDiscardedBrowsingContext aContext, bool aEnabled);
   1694 
   1695    /**
   1696     * This method is used to update media session's status when it's being
   1697     * created or destroyed.
   1698     */
   1699     async NotifyMediaSessionUpdated(MaybeDiscardedBrowsingContext aContext, bool aIsCreated);
   1700 
   1701     /**
   1702      * This method is used to update media session's media metadata whenever its
   1703      * metadata is being updated.
   1704      */
   1705     async NotifyUpdateMediaMetadata(MaybeDiscardedBrowsingContext aContext,
   1706                                     MediaMetadataBase? aMetadata);
   1707 
   1708     /**
   1709      * This method is used to update media session's playback state whenever its
   1710      * playback state is changed.
   1711      */
   1712     async NotifyMediaSessionPlaybackStateChanged(
   1713         MaybeDiscardedBrowsingContext aContext,
   1714         MediaSessionPlaybackState aMetadata);
   1715 
   1716     /**
   1717      * This method is used to update media session's supported media session
   1718      * action when the action becomes supported or unsupported.
   1719      */
   1720     async NotifyMediaSessionSupportedActionChanged(
   1721         MaybeDiscardedBrowsingContext aContext,
   1722         MediaSessionAction aAction,
   1723         bool aEnabled);
   1724 
   1725     /**
   1726      * This method is used to notify the media controller in chrome process that
   1727      * the media element in the browsing context entered fullscreen.
   1728      */
   1729     async NotifyMediaFullScreenState(
   1730         MaybeDiscardedBrowsingContext aContext,
   1731         bool aIsInFullScreen);
   1732 
   1733     /**
   1734      * This method is used to update media session's position state whenever its
   1735      * position state is being updated.
   1736      */
   1737     async NotifyPositionStateChanged(
   1738         MaybeDiscardedBrowsingContext aContext,
   1739         PositionState? aState);
   1740 
   1741     /**
   1742      * This method is used to update a media's position state whenever its
   1743      * guessed position state is being updated.
   1744      */
   1745     async NotifyGuessedPositionStateChanged(
   1746         MaybeDiscardedBrowsingContext aContext,
   1747         nsID aMediaId,
   1748         PositionState? aState);
   1749 
   1750     /**
   1751      * This method will make canonical browsing context to update the count of
   1752      * callers which want to keep the page from being suspended even if the page
   1753      * is inactive.
   1754      */
   1755     async AddOrRemovePageAwakeRequest(MaybeDiscardedBrowsingContext aContext,
   1756                                       bool aShouldAddCount);
   1757 
   1758 #if defined(XP_WIN)
   1759     /**
   1760      * Due to sandboxing, a child process's UntrustedModulesProcessor cannot
   1761      * obtain enough information about a DLL file to determine its
   1762      * trustworthiness. This API asks the chrome process to perform that
   1763      * evaluation.
   1764      */
   1765     async GetModulesTrust(ModulePaths aModPaths, bool aRunAtNormalPriority)
   1766         returns (ModulesMapResult? modMapResult);
   1767 #endif  // defined(XP_WIN)
   1768 
   1769     /**
   1770      * Used to route shutdown diagnostic info from the content process
   1771      * ServiceWorkers to the parent process' ServiceWorkerManager's
   1772      * ServiceWorkerShutdownBlocker. (The only other actor chain available
   1773      * for this would be very convoluted and create ordering problems).
   1774      */
   1775     async ReportServiceWorkerShutdownProgress(uint32_t aShutdownStateId,
   1776                                               Progress aProgress);
   1777 
   1778     /**
   1779      * Whenever a document is updating the OrientationLock, we need to
   1780      * reject the orientationPendingPromises in other processes.
   1781      */
   1782     async AbortOtherOrientationPendingPromises(MaybeDiscardedBrowsingContext aContext);
   1783 
   1784     async HistoryReload(MaybeDiscardedBrowsingContext aContext, uint32_t aReloadFlags);
   1785 
   1786     async NotifyOnHistoryReload(MaybeDiscardedBrowsingContext aContext,
   1787                                 bool aForceReload)
   1788             returns (bool canReload, nsDocShellLoadState? loadState,
   1789                      bool? reloadActiveEntry);
   1790 
   1791     async HistoryCommit(MaybeDiscardedBrowsingContext aContext,
   1792                         uint64_t aLoadID, nsID aChangeID, uint32_t aLoadType,
   1793                         bool aCloneEntryChildren,
   1794                         bool aChannelExpired, uint32_t aCacheKey);
   1795 
   1796     async HistoryGo(MaybeDiscardedBrowsingContext aContext, int32_t aOffset,
   1797                     uint64_t aHistoryEpoch, bool aRequireUserInteraction,
   1798                     bool aUserActivation, bool aCheckForCancelation)
   1799       returns(int32_t? requestedIndex);
   1800 
   1801     async NavigationTraverse(MaybeDiscardedBrowsingContext aContext, nsID aKey,
   1802                              uint64_t aHistoryEpoch, bool aUserActivation,
   1803                              bool aCheckForCancelation)
   1804       returns(nsresult result);
   1805 
   1806     async BlobURLDataRequest(nsCString aBlobURL,
   1807                              nsIPrincipal aTriggeringPrincipal,
   1808                              nullable nsIPrincipal aLoadingPrincipal,
   1809                              OriginAttributes aOriginAttributes,
   1810                              uint64_t aInnerWindowId,
   1811                              nsCString aPartitionKey)
   1812       returns (BlobURLDataRequestResult aResult);
   1813 
   1814     async SetActiveSessionHistoryEntry(MaybeDiscardedBrowsingContext context,
   1815                                        nsPoint? previousScrollPosition,
   1816                                        SessionHistoryInfo info, uint32_t loadType,
   1817                                        uint32_t updatedCacheKey, nsID changeID);
   1818     async ReplaceActiveSessionHistoryEntry(
   1819         MaybeDiscardedBrowsingContext context, SessionHistoryInfo info);
   1820 
   1821     async RemoveDynEntriesFromActiveSessionHistoryEntry(
   1822         MaybeDiscardedBrowsingContext aContext);
   1823 
   1824     async RemoveFromSessionHistory(
   1825         MaybeDiscardedBrowsingContext aContext, nsID changeID);
   1826 
   1827     // Called when a nsDocShellLoadState which was received over IPC is
   1828     // destroyed in the content process to clean up pending state left behind
   1829     // tracking the load state in the parent process.
   1830     [LazySend] async CleanupPendingLoadState(uint64_t aLoadIdentifier);
   1831 
   1832 both:
   1833     async ScriptError(nsString message, nsCString sourceName,
   1834                       uint32_t lineNumber, uint32_t colNumber, uint32_t flags,
   1835                       nsCString category, bool isFromPrivateWindow, uint64_t innerWindowId,
   1836                       bool isFromChromeContext);
   1837 
   1838     /**
   1839      * Used in fission to report timing data when the parent window is in
   1840      * another process. Child frame will send data to its ContentParent which
   1841      * will then identify the ContentParent for the innerWindowId and pass
   1842      * the data to the correct process.
   1843      * loadInfo is passed in order to enforce same-origin security checks
   1844      * aData must be non-null.
   1845      */
   1846     async ReportFrameTimingData(LoadInfoArgs loadInfo, nsString entryName,
   1847                                 nsString initiatorType,
   1848                                 UniquePtr<PerformanceTimingData> aData);
   1849 
   1850     async CommitBrowsingContextTransaction(MaybeDiscardedBrowsingContext aContext,
   1851                                            BrowsingContextTransaction aTransaction,
   1852                                            uint64_t aEpoch);
   1853 
   1854     async AsyncMessage(nsString aMessage, ClonedMessageData aData);
   1855 
   1856     /**
   1857      * Notify `push-subscription-modified` observers in the parent and child.
   1858      */
   1859     async NotifyPushSubscriptionModifiedObservers(nsCString scope,
   1860                                                   nullable nsIPrincipal principal);
   1861 
   1862     /**
   1863      * Send a Push error message to all service worker clients in the parent or
   1864      * child.
   1865      */
   1866     async PushError(nsCString scope, nullable nsIPrincipal principal, nsString message,
   1867                     uint32_t flags);
   1868 
   1869     /**
   1870      * Creates a new BrowsingContext, initialized with the values provided in
   1871      * `BrowsingContextInitializer`.
   1872      *
   1873      * This message may only be sent to the parent in limited situations. If the
   1874      * new BrowsingContext has a parent window, it must be owned by the
   1875      * embedding process, otherwise it must be owned by the opener, if set.
   1876      */
   1877     [LazySend] async CreateBrowsingContext(uint64_t aGroupId, BrowsingContextInitializer aInit);
   1878 
   1879     /**
   1880      * If aDoDiscard is true, discards the passed-in BrowsingContext. If the
   1881      * BrowsingContext has already been discarded, this message does nothing.
   1882      * If the receiver is the parent process, resolves when all content
   1883      * processes have flagged the BrowsingContext as discarded, and if the
   1884      * receiver is a child process, resolves when that child process has flagged
   1885      * the BrowsingContext as discarded.
   1886      */
   1887     async DiscardBrowsingContext(MaybeDiscardedBrowsingContext aContext, bool aDoDiscard)
   1888             returns (uint64_t unused);
   1889 
   1890     /**
   1891      * aContext is the one that's taking the affect. Either the one that
   1892      * receives the focus, or the one that loses the focus.
   1893      *
   1894      * aAncestorBrowsingContextToFocus can only be non-null when
   1895      * aShouldClearAncestorFocus is true. This is the browsing context
   1896      * that receives the focus when aContext loses the focus.
   1897      */
   1898     async AdjustWindowFocus(MaybeDiscardedBrowsingContext aContext,
   1899                             bool aIsVisible, uint64_t aActionId,
   1900                             bool aShouldClearAncestorFocus,
   1901                             MaybeDiscardedBrowsingContext aAncestorBrowsingContextToFocus);
   1902     async WindowClose(MaybeDiscardedBrowsingContext aContext,
   1903                       bool aTrustedCaller);
   1904     async WindowFocus(MaybeDiscardedBrowsingContext aContext,
   1905                       CallerType aCallerType, uint64_t aActionId);
   1906     async WindowBlur(MaybeDiscardedBrowsingContext aContext,
   1907                      CallerType aCallerType);
   1908     async RaiseWindow(MaybeDiscardedBrowsingContext aContext, CallerType aCallerType, uint64_t aActionId);
   1909     async ClearFocus(MaybeDiscardedBrowsingContext aContext);
   1910     async SetFocusedBrowsingContext(MaybeDiscardedBrowsingContext aContext, uint64_t aActionId);
   1911     async SetActiveBrowsingContext(MaybeDiscardedBrowsingContext aContext, uint64_t aActionId);
   1912     async UnsetActiveBrowsingContext(MaybeDiscardedBrowsingContext aContext, uint64_t aActionId);
   1913     async SetFocusedElement(MaybeDiscardedBrowsingContext aContext, bool aNeedsFocus);
   1914     async FinalizeFocusOuter(MaybeDiscardedBrowsingContext aContext, bool aCanFocus,
   1915                              CallerType aCallerType);
   1916 parent:
   1917     [LazySend] async InsertNewFocusActionId(uint64_t aActionId);
   1918     async BlurToParent(MaybeDiscardedBrowsingContext aFocusedBrowsingContext,
   1919                       MaybeDiscardedBrowsingContext aBrowsingContextToClear,
   1920                       MaybeDiscardedBrowsingContext aAncestorBrowsingContextToFocus,
   1921                       bool aIsLeavingDocument, bool aAdjustWidget,
   1922                       bool aBrowsingContextToClearHandled,
   1923                       bool aAncestorBrowsingContextToFocusHandled, uint64_t aActionId);
   1924 child:
   1925     async BlurToChild(MaybeDiscardedBrowsingContext aFocusedBrowsingContext,
   1926                       MaybeDiscardedBrowsingContext aBrowsingContextToClear,
   1927                       MaybeDiscardedBrowsingContext aAncestorBrowsingContextToFocus,
   1928                       bool aIsLeavingDocument, bool aAdjustWidget, uint64_t aActionId);
   1929     async SetupFocusedAndActive(MaybeDiscardedBrowsingContext aFocusedBrowsingContext,
   1930                                 uint64_t aActionIdForFocused,
   1931                                 MaybeDiscardedBrowsingContext aActiveBrowsingContext,
   1932                                 uint64_t aActionId);
   1933     async ReviseActiveBrowsingContext(uint64_t aOldActionId,
   1934                                       MaybeDiscardedBrowsingContext aActiveBrowsingContext,
   1935                                       uint64_t aNewActionId);
   1936     async ReviseFocusedBrowsingContext(uint64_t aOldActionId,
   1937                                        MaybeDiscardedBrowsingContext aFocusedBrowsingContext,
   1938                                        uint64_t aNewActionId);
   1939 both:
   1940     async MaybeExitFullscreen(MaybeDiscardedBrowsingContext aContext);
   1941     async WindowPostMessage(MaybeDiscardedBrowsingContext aContext,
   1942                             ClonedOrErrorMessageData aMessage,
   1943                             PostMessageData aData);
   1944 
   1945     async CommitWindowContextTransaction(MaybeDiscardedWindowContext aContext,
   1946                                          WindowContextTransaction aTransaction,
   1947                                          uint64_t aEpoch);
   1948 
   1949 child:
   1950     // NOTE: These methods are only needed on the child, as the parent
   1951     // WindowContext is managed using the PWindowGlobal actor's lifecycle.
   1952     [LazySend] async CreateWindowContext(WindowContextInitializer aInit);
   1953     async DiscardWindowContext(uint64_t aContextId) returns (bool unused);
   1954 
   1955 parent:
   1956     // Temporary (bug 1641989) conduit for Glean data in content processes.
   1957     // Sent from time-to-time to limit the amount of data vulnerable to loss.
   1958     // Buffer contains bincoded Rust structs.
   1959     async FOGData(ByteBuf buf);
   1960 
   1961 parent:
   1962     async GeckoTraceExport(ByteBuf aBuf);
   1963 
   1964 child:
   1965     // Temporary (bug 1641989) conduit for Glean data in content processes.
   1966     // Tells the child to flush any pending data. Used in tests and ping
   1967     // assembly. Buffer contains bincoded Rust structs.
   1968     async FlushFOGData() returns (ByteBuf buf);
   1969 
   1970 parent:
   1971     async SetContainerFeaturePolicy(MaybeDiscardedBrowsingContext aContainerContext,
   1972                                     MaybeFeaturePolicyInfo aContainerFeaturePolicyInfo);
   1973 
   1974     // Notify parent process that aContext must update its ancestor origins list
   1975     // This is only used for about:blank, because for normal navigations 
   1976     // the internal ancestor origins list will be created during load.
   1977     async UpdateAncestorOriginsList(MaybeDiscardedBrowsingContext aContext);
   1978 
   1979     // Bookkeep referrer policy of the embedding iframe (if any) in the parent process for browsing contexts
   1980     async SetReferrerPolicyForEmbedderFrame(MaybeDiscardedBrowsingContext aBrowsingContext, ReferrerPolicy aPolicy);
   1981 
   1982     // Obtain an icon from the system widget toolkit, in nsIconDecoder
   1983     // format.  Not supported (or needed) on all platforms; see the
   1984     // implementation in ContentParent::RecvGetSystemIcon for details.
   1985     async GetSystemIcon(nullable nsIURI aURI) returns (nsresult aResult, ByteBuf? aData);
   1986 
   1987     // Returns the status of the geolocation permission on this system.
   1988     // May not be accurate if the information is not known.
   1989     async GetSystemGeolocationPermissionBehavior() returns (SystemGeolocationPermissionBehavior permission);
   1990 
   1991     // Opens system geolocation settings and posts a modal dialog dialog
   1992     // to the tab that requested geolocation.  Returns permission status
   1993     // after user has granted or canceled permission.
   1994     async RequestGeolocationPermissionFromUser(MaybeDiscardedBrowsingContext aBrowsingContext) returns (GeolocationPermissionStatus aStatus);
   1995 
   1996 #ifdef FUZZING_SNAPSHOT
   1997     // Used by the child process to signal that it is ready to start fuzzing.
   1998     // This can in particular be used to wait for a particular event in a
   1999     // test document before taking the snapshot and starting e.g. IPC fuzzing.
   2000     async SignalFuzzingReady();
   2001 #endif
   2002 
   2003 #ifdef FUZZING
   2004     // Used by the child process to signal restarting the GPU process.
   2005     async KillGPUProcess();
   2006 #endif
   2007 
   2008   async AttributionEvent(nsCString aSourceHost,
   2009                          PrivateAttributionImpressionType aType,
   2010                          uint32_t aIndex, nsString aAd, nsCString aTargetHost);
   2011 
   2012   async AttributionConversion(nsCString aTargetHost, nsString aTask,
   2013                               uint32_t aHistogramSize,
   2014                               uint32_t? aLookbackDays,
   2015                               PrivateAttributionImpressionType? aImpressionType,
   2016                               nsString[] aAds,
   2017                               nsCString[] aImpressionSourceHosts);
   2018 };
   2019 
   2020 }
   2021 }