1 /* -*- Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 8 -*- */
2 /* vim: set sw=4 ts=8 et tw=80 ft=cpp : */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 include protocol PAsmJSCacheEntry;
8 include protocol PBackground;
9 include protocol PBlob;
10 include protocol PBluetooth;
11 include protocol PBrowser;
12 include protocol PCompositor;
13 include protocol PContentBridge;
14 include protocol PCycleCollectWithLogs;
15 include protocol PCrashReporter;
16 include protocol PExternalHelperApp;
17 include protocol PDeviceStorageRequest;
18 include protocol PFileDescriptorSet;
19 include protocol PFMRadio;
20 include protocol PFileSystemRequest;
21 include protocol PHal;
22 include protocol PImageBridge;
23 include protocol PIndexedDB;
24 include protocol PMemoryReportRequest;
25 include protocol PNecko;
26 include protocol PScreenManager;
27 include protocol PSharedBufferManager;
28 include protocol PSms;
29 include protocol PSpeechSynthesis;
30 include protocol PStorage;
31 include protocol PTelephony;
32 include protocol PTestShell;
33 include protocol PJavaScript;
34 include protocol PRemoteSpellcheckEngine;
36 include JavaScriptTypes;
37 include InputStreamParams;
40 include ProtocolTypes;
42 using GeoPosition from "nsGeoPositionIPCSerialiser.h";
44 using struct ChromePackage from "mozilla/chrome/RegistryMessageUtils.h";
45 using struct ResourceMapping from "mozilla/chrome/RegistryMessageUtils.h";
46 using struct OverrideMapping from "mozilla/chrome/RegistryMessageUtils.h";
47 using base::ChildPrivileges from "base/process_util.h";
48 using struct IPC::Permission from "mozilla/net/NeckoMessageUtils.h";
49 using class IPC::Principal from "mozilla/dom/PermissionMessageUtils.h";
50 using struct mozilla::null_t from "ipc/IPCMessageUtils.h";
51 using struct mozilla::void_t from "ipc/IPCMessageUtils.h";
52 using mozilla::dom::asmjscache::OpenMode from "mozilla/dom/asmjscache/AsmJSCache.h";
53 using mozilla::dom::asmjscache::WriteParams from "mozilla/dom/asmjscache/AsmJSCache.h";
54 using mozilla::dom::AudioChannel from "mozilla/dom/AudioChannelBinding.h";
55 using mozilla::dom::AudioChannelState from "AudioChannelCommon.h";
56 using mozilla::dom::NativeThreadId from "mozilla/dom/TabMessageUtils.h";
57 using mozilla::hal::ProcessPriority from "mozilla/HalTypes.h";
58 using gfxIntSize from "nsSize.h";
60 union ChromeRegistryItem
69 struct FontListEntry {
80 struct DeviceStorageFreeSpaceParams
86 struct DeviceStorageUsedSpaceParams
92 struct DeviceStorageAvailableParams
98 struct DeviceStorageStatusParams
101 nsString storageName;
104 struct DeviceStorageFormatParams
107 nsString storageName;
110 struct DeviceStorageMountParams
113 nsString storageName;
116 struct DeviceStorageUnmountParams
119 nsString storageName;
122 struct DeviceStorageAddParams
125 nsString storageName;
130 struct DeviceStorageAppendParams
133 nsString storageName;
138 struct DeviceStorageCreateFdParams
141 nsString storageName;
145 struct DeviceStorageGetParams
148 nsString storageName;
153 struct DeviceStorageDeleteParams
156 nsString storageName;
160 struct DeviceStorageEnumerationParams
163 nsString storageName;
168 union DeviceStorageParams
170 DeviceStorageAddParams;
171 DeviceStorageAppendParams;
172 DeviceStorageCreateFdParams;
173 DeviceStorageGetParams;
174 DeviceStorageDeleteParams;
175 DeviceStorageEnumerationParams;
176 DeviceStorageFreeSpaceParams;
177 DeviceStorageUsedSpaceParams;
178 DeviceStorageAvailableParams;
179 DeviceStorageStatusParams;
180 DeviceStorageFormatParams;
181 DeviceStorageMountParams;
182 DeviceStorageUnmountParams;
185 struct FMRadioRequestEnableParams
190 struct FMRadioRequestDisableParams
195 struct FMRadioRequestSetFrequencyParams
200 struct FMRadioRequestSeekParams
205 struct FMRadioRequestCancelSeekParams
210 union FMRadioRequestParams
212 FMRadioRequestEnableParams;
213 FMRadioRequestDisableParams;
214 FMRadioRequestSetFrequencyParams;
215 FMRadioRequestSeekParams;
216 FMRadioRequestCancelSeekParams;
219 struct FileSystemCreateDirectoryParams
225 union FileSystemFileDataValue
231 struct FileSystemCreateFileParams
235 FileSystemFileDataValue data;
239 struct FileSystemGetFileOrDirectoryParams
245 union FileSystemPathOrFileValue
251 struct FileSystemRemoveParams
255 FileSystemPathOrFileValue target;
259 union FileSystemParams
261 FileSystemCreateDirectoryParams;
262 FileSystemCreateFileParams;
263 FileSystemGetFileOrDirectoryParams;
264 FileSystemRemoveParams;
273 union MaybePrefValue {
280 MaybePrefValue defaultValue;
281 MaybePrefValue userValue;
284 struct DataStoreSetting {
287 nsString manifestURL;
292 // Note: Any changes to this structure should also be changed in
293 // FileSystemUpdate below.
298 int32_t mountGeneration;
306 intr protocol PContent
308 parent opens PCompositor;
309 parent opens PSharedBufferManager;
310 parent opens PImageBridge;
311 child opens PBackground;
313 manages PAsmJSCacheEntry;
317 manages PCrashReporter;
318 manages PCycleCollectWithLogs;
319 manages PDeviceStorageRequest;
320 manages PFileSystemRequest;
321 manages PExternalHelperApp;
322 manages PFileDescriptorSet;
326 manages PMemoryReportRequest;
328 manages PScreenManager;
330 manages PSpeechSynthesis;
335 manages PRemoteSpellcheckEngine;
338 // Depending on exactly how the new browser is being created, it might be
339 // created from either the child or parent process!
341 // The child creates the PBrowser as part of
342 // TabChild::BrowserFrameProvideWindow (which happens when the child's
343 // content calls window.open()), and the parent creates the PBrowser as part
344 // of ContentParent::CreateBrowserOrApp.
346 // When the parent constructs a PBrowser, the child trusts the app token it
347 // receives from the parent. In that case, context can be any of the
348 // IPCTabContext subtypes.
350 // When the child constructs a PBrowser, the parent doesn't trust the app
351 // token it receives from the child. In this case, context must have type
352 // PopupIPCTabContext. The browser created using a PopupIPCTabContext has
353 // the opener PBrowser's app-id and containing-app-id. The parent checks
354 // that if the opener is a browser element, the context is also for a
357 // This allows the parent to prevent a malicious child from escalating its
358 // privileges by requesting a PBrowser corresponding to a highly-privileged
359 // app; the child can only request privileges for an app which the child has
360 // access to (in the form of a TabChild).
362 // Keep the last 3 attributes in sync with GetProcessAttributes!
363 async PBrowser(IPCTabContext context, uint32_t chromeFlags,
364 uint64_t id, bool isForApp, bool isForBrowser);
366 async PBlob(BlobConstructorParams params);
368 PFileDescriptorSet(FileDescriptor fd);
372 * Enable system-level sandboxing features, if available. Can
373 * usually only be performed zero or one times. The child may
374 * abnormally exit if this fails; the details are OS-specific.
376 async SetProcessSandbox();
378 PMemoryReportRequest(uint32_t generation, bool anonymize,
379 bool minimizeMemoryUsage, FileDescriptor DMDFile);
382 * Notify the AudioChannelService in the child processes.
384 async AudioChannelNotify();
386 async SpeakerManagerNotify();
388 async DataStoreNotify(uint32_t aAppId, nsString aName,
389 nsString aManifestURL);
392 * Dump this process's GC and CC logs to the provided files.
394 * For documentation on the other args, see dumpGCAndCCLogsToFile in
395 * nsIMemoryInfoDumper.idl
397 PCycleCollectWithLogs(bool dumpAllTraces,
398 FileDescriptor gcLog,
399 FileDescriptor ccLog);
403 RegisterChrome(ChromePackage[] packages, ResourceMapping[] resources,
404 OverrideMapping[] overrides, nsCString locale, bool reset);
405 RegisterChromeItem(ChromeRegistryItem item);
407 async SetOffline(bool offline);
409 async NotifyVisited(URIParams uri);
411 async SystemMemoryAvailable(uint64_t getterId, uint32_t memoryAvailable);
413 PreferenceUpdate(PrefSetting pref);
415 NotifyAlertsObserver(nsCString topic, nsString data);
417 GeolocationUpdate(GeoPosition somewhere);
419 // nsIPermissionManager messages
420 AddPermission(Permission permission);
422 ScreenSizeChanged(gfxIntSize size);
424 FlushMemory(nsString reason);
430 * Start accessibility engine in content process.
434 AppInfo(nsCString version, nsCString buildID, nsCString name, nsCString UAName);
436 // Notify child that last-pb-context-exited notification was observed
437 LastPrivateDocShellDestroyed();
439 FilePathUpdate(nsString storageType, nsString storageName, nsString filepath,
442 // Note: Any changes to this structure should also be changed in
444 FileSystemUpdate(nsString fsName, nsString mountPoint, int32_t fsState,
445 int32_t mountGeneration, bool isMediaPresent,
446 bool isSharing, bool isFormatting, bool isFake, bool isUnmounting);
448 // Ask the Nuwa process to create a new child process.
451 NotifyProcessPriorityChanged(ProcessPriority priority);
452 MinimizeMemoryUsage();
455 * Used to manage nsIStyleSheetService across processes.
457 async LoadAndRegisterSheet(URIParams uri, uint32_t type);
458 async UnregisterSheet(URIParams uri, uint32_t type);
460 NotifyPhoneStateChange(nsString newState);
463 * Notify idle observers in the child
465 NotifyIdleObserver(uint64_t observerId, nsCString topic, nsString str);
468 * Notify windows in the child to apply a new app style.
474 * Tell the content process some attributes of itself. This is
475 * among the first information queried by content processes after
476 * startup. (The message is sync to allow the content process to
477 * control when it receives the information.)
479 * |id| is a unique ID among all subprocesses. When |isForApp &&
480 * isForBrowser|, we're loading <browser> for an app. When
481 * |isForBrowser|, we're loading <browser>. When |!isForApp &&
482 * !isForBrowser|, we're probably loading <xul:browser remote>.
484 * Keep the return values in sync with PBrowser()!
486 sync GetProcessAttributes()
487 returns (uint64_t id, bool isForApp, bool isForBrowser);
488 sync GetXPCOMProcessAttributes()
489 returns (bool isOffline);
491 sync CreateChildProcess(IPCTabContext context,
492 ProcessPriority priority)
493 returns (uint64_t id, bool isForApp, bool isForBrowser);
494 intr BridgeToChildProcess(uint64_t id);
498 sync PRemoteSpellcheckEngine();
499 PDeviceStorageRequest(DeviceStorageParams params);
501 PFileSystemRequest(FileSystemParams params);
503 sync PCrashReporter(NativeThreadId tid, uint32_t processType);
505 sync GetRandomValues(uint32_t length)
506 returns (uint8_t[] randomValues);
508 async GetSystemMemory(uint64_t getterId);
510 sync IsSecureURI(uint32_t type, URIParams uri, uint32_t flags)
511 returns (bool isSecureURI);
520 returns (uint32_t numberOfScreens,
521 float systemDefaultScale,
536 PAsmJSCacheEntry(OpenMode openMode, WriteParams write, Principal principal);
540 async StartVisitedQuery(URIParams uri);
541 async VisitURI(URIParams uri, OptionalURIParams referrer, uint32_t flags);
542 async SetURITitle(URIParams uri, nsString title);
544 async LoadURIExternal(URIParams uri);
546 // PrefService message
547 sync ReadPrefsArray() returns (PrefSetting[] prefs);
549 sync ReadFontList() returns (FontListEntry[] retValue);
551 sync SyncMessage(nsString aMessage, ClonedMessageData aData,
552 CpowEntry[] aCpows, Principal aPrincipal)
553 returns (nsString[] retval);
555 rpc RpcMessage(nsString aMessage, ClonedMessageData aData,
556 CpowEntry[] aCpows, Principal aPrincipal)
557 returns (nsString[] retval);
559 ShowAlertNotification(nsString imageUrl,
568 Principal principal);
570 CloseAlert(nsString name, Principal principal);
572 PExternalHelperApp(OptionalURIParams uri,
573 nsCString aMimeContentType,
574 nsCString aContentDisposition,
575 uint32_t aContentDispositionHint,
576 nsString aContentDispositionFilename,
578 int64_t aContentLength,
579 OptionalURIParams aReferrer,
580 nullable PBrowser aBrowser);
582 AddGeolocationListener(Principal principal, bool highAccuracy);
583 RemoveGeolocationListener();
584 SetGeolocationHigherAccuracy(bool enable);
586 ConsoleMessage(nsString message);
587 ScriptError(nsString message, nsString sourceName, nsString sourceLine,
588 uint32_t lineNumber, uint32_t colNumber, uint32_t flags,
591 // nsIPermissionManager messages
592 sync ReadPermissions() returns (Permission[] permissions);
594 SetClipboardText(nsString text, bool isPrivateData, int32_t whichClipboard);
595 sync GetClipboardText(int32_t whichClipboard)
596 returns (nsString text);
597 EmptyClipboard(int32_t whichClipboard);
598 sync ClipboardHasText(int32_t whichClipboard)
599 returns (bool hasText);
601 sync GetSystemColors(uint32_t colorsCount)
602 returns (uint32_t[] colors);
604 sync GetIconForExtension(nsCString aFileExt, uint32_t aIconSize)
605 returns (uint8_t[] bits);
607 sync GetShowPasswordSetting()
608 returns (bool showPassword);
610 // Notify the parent of the presence or absence of private docshells
611 PrivateDocShellsExist(bool aExist);
613 // Tell the parent that the child has gone idle for the first time
616 // Get Muted from the main AudioChannelService.
617 sync AudioChannelGetState(AudioChannel aChannel, bool aElementHidden,
618 bool aElementWasHidden)
619 returns (AudioChannelState value);
621 sync AudioChannelRegisterType(AudioChannel aChannel, bool aWithVideo);
622 sync AudioChannelUnregisterType(AudioChannel aChannel,
626 async AudioChannelChangedNotification();
627 async AudioChannelChangeDefVolChannel(int32_t aChannel, bool aHidden);
629 sync DataStoreGetStores(nsString aName, nsString aOwner, Principal aPrincipal)
630 returns (DataStoreSetting[] dataStores);
632 async FilePathUpdateNotify(nsString aType,
633 nsString aStorageName,
637 sync GetVolumes() returns (VolumeInfo[] volumes);
639 // Notify the parent that the child has finished handling a system message.
640 async SystemMessageHandled();
644 sync AddNewProcess(uint32_t pid, ProtocolFdMapping[] aFds);
646 // called by the child (test code only) to propagate volume changes to the parent
647 async CreateFakeVolume(nsString fsName, nsString mountPoint);
648 async SetFakeVolumeState(nsString fsName, int32_t fsState);
650 sync KeywordToURI(nsCString keyword)
651 returns (OptionalInputStreamParams postData, OptionalURIParams uri);
653 // Tell the compositor to allocate a layer tree id for nested remote mozbrowsers.
654 sync AllocateLayerTreeId()
655 returns (uint64_t id);
656 async DeallocateLayerTreeId(uint64_t id);
658 sync SpeakerManagerForceSpeaker(bool aEnable);
660 sync SpeakerManagerGetSpeakerStatus()
661 returns (bool value);
664 * Notifies the parent about a recording device is starting or shutdown.
665 * @param recordingStatus starting or shutdown
666 * @param pageURL URL that request that changing the recording status
667 * @param isAudio recording start with microphone
668 * @param isVideo recording start with camera
670 async RecordingDeviceEvents(nsString recordingStatus,
675 sync GetGraphicsFeatureStatus(int32_t aFeature) returns (int32_t aStatus, bool aSuccess);
677 AddIdleObserver(uint64_t observerId, uint32_t idleTimeInS);
678 RemoveIdleObserver(uint64_t observerId, uint32_t idleTimeInS);
681 * This message is only used on X11 platforms.
683 * Send a dup of the plugin process's X socket to the parent
684 * process. In theory, this scheme keeps the plugin's X resources
685 * around until after both the plugin process shuts down *and* the
686 * parent process closes the dup fd. This is used to prevent the
687 * parent process from crashing on X errors if, e.g., the plugin
688 * crashes *just before* a repaint and the parent process tries to
689 * use the newly-invalid surface.
691 BackUpXResources(FileDescriptor aXSocketFd);
693 sync OpenAnonymousTemporaryFile() returns (FileDescriptor aFD);
696 AsyncMessage(nsString aMessage, ClonedMessageData aData,
697 CpowEntry[] aCpows, Principal aPrincipal);