1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/ipc/PContent.ipdl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,607 @@ 1.4 +/* -*- Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 8 -*- */ 1.5 +/* vim: set sw=4 ts=8 et tw=80 ft=cpp : */ 1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 + 1.10 +include protocol PAsmJSCacheEntry; 1.11 +include protocol PBackground; 1.12 +include protocol PBlob; 1.13 +include protocol PBluetooth; 1.14 +include protocol PBrowser; 1.15 +include protocol PCompositor; 1.16 +include protocol PCrashReporter; 1.17 +include protocol PExternalHelperApp; 1.18 +include protocol PDeviceStorageRequest; 1.19 +include protocol PFileDescriptorSet; 1.20 +include protocol PFMRadio; 1.21 +include protocol PFileSystemRequest; 1.22 +include protocol PHal; 1.23 +include protocol PImageBridge; 1.24 +include protocol PIndexedDB; 1.25 +include protocol PMemoryReportRequest; 1.26 +include protocol PNecko; 1.27 +include protocol PSms; 1.28 +include protocol PSpeechSynthesis; 1.29 +include protocol PStorage; 1.30 +include protocol PTelephony; 1.31 +include protocol PTestShell; 1.32 +include protocol PJavaScript; 1.33 +include DOMTypes; 1.34 +include JavaScriptTypes; 1.35 +include InputStreamParams; 1.36 +include PTabContext; 1.37 +include URIParams; 1.38 +include ProtocolTypes; 1.39 + 1.40 +using GeoPosition from "nsGeoPositionIPCSerialiser.h"; 1.41 + 1.42 +using struct ChromePackage from "mozilla/chrome/RegistryMessageUtils.h"; 1.43 +using struct ResourceMapping from "mozilla/chrome/RegistryMessageUtils.h"; 1.44 +using struct OverrideMapping from "mozilla/chrome/RegistryMessageUtils.h"; 1.45 +using base::ChildPrivileges from "base/process_util.h"; 1.46 +using struct IPC::Permission from "mozilla/net/NeckoMessageUtils.h"; 1.47 +using class IPC::Principal from "mozilla/dom/PermissionMessageUtils.h"; 1.48 +using struct mozilla::null_t from "ipc/IPCMessageUtils.h"; 1.49 +using struct mozilla::void_t from "ipc/IPCMessageUtils.h"; 1.50 +using mozilla::dom::asmjscache::OpenMode from "mozilla/dom/asmjscache/AsmJSCache.h"; 1.51 +using mozilla::dom::asmjscache::WriteParams from "mozilla/dom/asmjscache/AsmJSCache.h"; 1.52 +using mozilla::dom::AudioChannel from "mozilla/dom/AudioChannelBinding.h"; 1.53 +using mozilla::dom::AudioChannelState from "AudioChannelCommon.h"; 1.54 +using mozilla::dom::NativeThreadId from "mozilla/dom/TabMessageUtils.h"; 1.55 +using mozilla::hal::ProcessPriority from "mozilla/HalTypes.h"; 1.56 +using gfxIntSize from "nsSize.h"; 1.57 + 1.58 +namespace mozilla { 1.59 +namespace dom { 1.60 + 1.61 +struct FontListEntry { 1.62 + nsString familyName; 1.63 + nsString faceName; 1.64 + nsCString filepath; 1.65 + uint16_t weight; 1.66 + int16_t stretch; 1.67 + uint8_t italic; 1.68 + uint8_t index; 1.69 +}; 1.70 + 1.71 +struct DeviceStorageFreeSpaceParams 1.72 +{ 1.73 + nsString type; 1.74 + nsString storageName; 1.75 +}; 1.76 + 1.77 +struct DeviceStorageUsedSpaceParams 1.78 +{ 1.79 + nsString type; 1.80 + nsString storageName; 1.81 +}; 1.82 + 1.83 +struct DeviceStorageAvailableParams 1.84 +{ 1.85 + nsString type; 1.86 + nsString storageName; 1.87 +}; 1.88 + 1.89 +struct DeviceStorageStatusParams 1.90 +{ 1.91 + nsString type; 1.92 + nsString storageName; 1.93 +}; 1.94 + 1.95 +struct DeviceStorageFormatParams 1.96 +{ 1.97 + nsString type; 1.98 + nsString storageName; 1.99 +}; 1.100 + 1.101 +struct DeviceStorageMountParams 1.102 +{ 1.103 + nsString type; 1.104 + nsString storageName; 1.105 +}; 1.106 + 1.107 +struct DeviceStorageUnmountParams 1.108 +{ 1.109 + nsString type; 1.110 + nsString storageName; 1.111 +}; 1.112 + 1.113 +struct DeviceStorageAddParams 1.114 +{ 1.115 + nsString type; 1.116 + nsString storageName; 1.117 + nsString relpath; 1.118 + PBlob blob; 1.119 +}; 1.120 + 1.121 +struct DeviceStorageCreateFdParams 1.122 +{ 1.123 + nsString type; 1.124 + nsString storageName; 1.125 + nsString relpath; 1.126 +}; 1.127 + 1.128 +struct DeviceStorageGetParams 1.129 +{ 1.130 + nsString type; 1.131 + nsString storageName; 1.132 + nsString rootDir; 1.133 + nsString relpath; 1.134 +}; 1.135 + 1.136 +struct DeviceStorageDeleteParams 1.137 +{ 1.138 + nsString type; 1.139 + nsString storageName; 1.140 + nsString relpath; 1.141 +}; 1.142 + 1.143 +struct DeviceStorageEnumerationParams 1.144 +{ 1.145 + nsString type; 1.146 + nsString storageName; 1.147 + nsString rootdir; 1.148 + uint64_t since; 1.149 +}; 1.150 + 1.151 +union DeviceStorageParams 1.152 +{ 1.153 + DeviceStorageAddParams; 1.154 + DeviceStorageCreateFdParams; 1.155 + DeviceStorageGetParams; 1.156 + DeviceStorageDeleteParams; 1.157 + DeviceStorageEnumerationParams; 1.158 + DeviceStorageFreeSpaceParams; 1.159 + DeviceStorageUsedSpaceParams; 1.160 + DeviceStorageAvailableParams; 1.161 + DeviceStorageStatusParams; 1.162 + DeviceStorageFormatParams; 1.163 + DeviceStorageMountParams; 1.164 + DeviceStorageUnmountParams; 1.165 +}; 1.166 + 1.167 +struct FMRadioRequestEnableParams 1.168 +{ 1.169 + double frequency; 1.170 +}; 1.171 + 1.172 +struct FMRadioRequestDisableParams 1.173 +{ 1.174 + 1.175 +}; 1.176 + 1.177 +struct FMRadioRequestSetFrequencyParams 1.178 +{ 1.179 + double frequency; 1.180 +}; 1.181 + 1.182 +struct FMRadioRequestSeekParams 1.183 +{ 1.184 + bool upward; 1.185 +}; 1.186 + 1.187 +struct FMRadioRequestCancelSeekParams 1.188 +{ 1.189 + 1.190 +}; 1.191 + 1.192 +union FMRadioRequestParams 1.193 +{ 1.194 + FMRadioRequestEnableParams; 1.195 + FMRadioRequestDisableParams; 1.196 + FMRadioRequestSetFrequencyParams; 1.197 + FMRadioRequestSeekParams; 1.198 + FMRadioRequestCancelSeekParams; 1.199 +}; 1.200 + 1.201 +struct FileSystemCreateDirectoryParams 1.202 +{ 1.203 + nsString filesystem; 1.204 + nsString realPath; 1.205 +}; 1.206 + 1.207 +union FileSystemFileDataValue 1.208 +{ 1.209 + uint8_t[]; 1.210 + PBlob; 1.211 +}; 1.212 + 1.213 +struct FileSystemCreateFileParams 1.214 +{ 1.215 + nsString filesystem; 1.216 + nsString realPath; 1.217 + FileSystemFileDataValue data; 1.218 + bool replace; 1.219 +}; 1.220 + 1.221 +struct FileSystemGetFileOrDirectoryParams 1.222 +{ 1.223 + nsString filesystem; 1.224 + nsString realPath; 1.225 +}; 1.226 + 1.227 +union FileSystemPathOrFileValue 1.228 +{ 1.229 + nsString; 1.230 + PBlob; 1.231 +}; 1.232 + 1.233 +struct FileSystemRemoveParams 1.234 +{ 1.235 + nsString filesystem; 1.236 + nsString directory; 1.237 + FileSystemPathOrFileValue target; 1.238 + bool recursive; 1.239 +}; 1.240 + 1.241 +union FileSystemParams 1.242 +{ 1.243 + FileSystemCreateDirectoryParams; 1.244 + FileSystemCreateFileParams; 1.245 + FileSystemGetFileOrDirectoryParams; 1.246 + FileSystemRemoveParams; 1.247 +}; 1.248 + 1.249 +union PrefValue { 1.250 + nsCString; 1.251 + int32_t; 1.252 + bool; 1.253 +}; 1.254 + 1.255 +union MaybePrefValue { 1.256 + PrefValue; 1.257 + null_t; 1.258 +}; 1.259 + 1.260 +struct PrefSetting { 1.261 + nsCString name; 1.262 + MaybePrefValue defaultValue; 1.263 + MaybePrefValue userValue; 1.264 +}; 1.265 + 1.266 +intr protocol PContent 1.267 +{ 1.268 + parent opens PCompositor; 1.269 + parent opens PImageBridge; 1.270 + child opens PBackground; 1.271 + 1.272 + manages PAsmJSCacheEntry; 1.273 + manages PBlob; 1.274 + manages PBluetooth; 1.275 + manages PBrowser; 1.276 + manages PCrashReporter; 1.277 + manages PDeviceStorageRequest; 1.278 + manages PFileSystemRequest; 1.279 + manages PExternalHelperApp; 1.280 + manages PFileDescriptorSet; 1.281 + manages PFMRadio; 1.282 + manages PHal; 1.283 + manages PIndexedDB; 1.284 + manages PMemoryReportRequest; 1.285 + manages PNecko; 1.286 + manages PSms; 1.287 + manages PSpeechSynthesis; 1.288 + manages PStorage; 1.289 + manages PTelephony; 1.290 + manages PTestShell; 1.291 + manages PJavaScript; 1.292 + 1.293 +both: 1.294 + // Depending on exactly how the new browser is being created, it might be 1.295 + // created from either the child or parent process! 1.296 + // 1.297 + // The child creates the PBrowser as part of 1.298 + // TabChild::BrowserFrameProvideWindow (which happens when the child's 1.299 + // content calls window.open()), and the parent creates the PBrowser as part 1.300 + // of ContentParent::CreateBrowserOrApp. 1.301 + // 1.302 + // When the parent constructs a PBrowser, the child trusts the app token it 1.303 + // receives from the parent. In that case, context can be any of the 1.304 + // IPCTabContext subtypes. 1.305 + // 1.306 + // When the child constructs a PBrowser, the parent doesn't trust the app 1.307 + // token it receives from the child. In this case, context must have type 1.308 + // PopupIPCTabContext. The browser created using a PopupIPCTabContext has 1.309 + // the opener PBrowser's app-id and containing-app-id. The parent checks 1.310 + // that if the opener is a browser element, the context is also for a 1.311 + // browser element. 1.312 + // 1.313 + // This allows the parent to prevent a malicious child from escalating its 1.314 + // privileges by requesting a PBrowser corresponding to a highly-privileged 1.315 + // app; the child can only request privileges for an app which the child has 1.316 + // access to (in the form of a TabChild). 1.317 + async PBrowser(IPCTabContext context, uint32_t chromeFlags); 1.318 + 1.319 + async PBlob(BlobConstructorParams params); 1.320 + 1.321 + async PJavaScript(); 1.322 + 1.323 + PFileDescriptorSet(FileDescriptor fd); 1.324 + 1.325 +child: 1.326 + /** 1.327 + * Enable system-level sandboxing features, if available. Can 1.328 + * usually only be performed zero or one times. The child may 1.329 + * abnormally exit if this fails; the details are OS-specific. 1.330 + */ 1.331 + async SetProcessSandbox(); 1.332 + 1.333 + PMemoryReportRequest(uint32_t generation, bool minimizeMemoryUsage, nsString DMDDumpIdent); 1.334 + 1.335 + /** 1.336 + * Notify the AudioChannelService in the child processes. 1.337 + */ 1.338 + async AudioChannelNotify(); 1.339 + 1.340 + async SpeakerManagerNotify(); 1.341 + 1.342 + /** 1.343 + * Dump this process's GC and CC logs. 1.344 + * 1.345 + * For documentation on the args, see dumpGCAndCCLogsToFile in 1.346 + * nsIMemoryInfoDumper.idl 1.347 + */ 1.348 + async DumpGCAndCCLogsToFile(nsString identifier, 1.349 + bool dumpAllTraces, 1.350 + bool dumpChildProcesses); 1.351 + 1.352 + PTestShell(); 1.353 + 1.354 + RegisterChrome(ChromePackage[] packages, ResourceMapping[] resources, 1.355 + OverrideMapping[] overrides, nsCString locale); 1.356 + 1.357 + async SetOffline(bool offline); 1.358 + 1.359 + async NotifyVisited(URIParams uri); 1.360 + 1.361 + PreferenceUpdate(PrefSetting pref); 1.362 + 1.363 + NotifyAlertsObserver(nsCString topic, nsString data); 1.364 + 1.365 + GeolocationUpdate(GeoPosition somewhere); 1.366 + 1.367 + // nsIPermissionManager messages 1.368 + AddPermission(Permission permission); 1.369 + 1.370 + ScreenSizeChanged(gfxIntSize size); 1.371 + 1.372 + FlushMemory(nsString reason); 1.373 + 1.374 + GarbageCollect(); 1.375 + CycleCollect(); 1.376 + 1.377 + /** 1.378 + * Start accessibility engine in content process. 1.379 + */ 1.380 + ActivateA11y(); 1.381 + 1.382 + AppInfo(nsCString version, nsCString buildID, nsCString name, nsCString UAName); 1.383 + 1.384 + // Notify child that last-pb-context-exited notification was observed 1.385 + LastPrivateDocShellDestroyed(); 1.386 + 1.387 + FilePathUpdate(nsString storageType, nsString storageName, nsString filepath, 1.388 + nsCString reasons); 1.389 + 1.390 + FileSystemUpdate(nsString fsName, nsString mountPoint, int32_t fsState, 1.391 + int32_t mountGeneration, bool isMediaPresent, 1.392 + bool isSharing, bool isFormatting); 1.393 + 1.394 + // Ask the Nuwa process to create a new child process. 1.395 + NuwaFork(); 1.396 + 1.397 + NotifyProcessPriorityChanged(ProcessPriority priority); 1.398 + MinimizeMemoryUsage(); 1.399 + 1.400 + /** 1.401 + * Used to manage nsIStyleSheetService across processes. 1.402 + */ 1.403 + async LoadAndRegisterSheet(URIParams uri, uint32_t type); 1.404 + async UnregisterSheet(URIParams uri, uint32_t type); 1.405 + 1.406 + NotifyPhoneStateChange(nsString newState); 1.407 + 1.408 + /** 1.409 + * Notify idle observers in the child 1.410 + */ 1.411 + NotifyIdleObserver(uint64_t observerId, nsCString topic, nsString str); 1.412 +parent: 1.413 + /** 1.414 + * Tell the content process some attributes of itself. This is 1.415 + * among the first information queried by content processes after 1.416 + * startup. (The message is sync to allow the content process to 1.417 + * control when it receives the information.) 1.418 + * 1.419 + * |id| is a unique ID among all subprocesses. When |isForApp && 1.420 + * isForBrowser|, we're loading <browser> for an app. When 1.421 + * |isForBrowser|, we're loading <browser>. When |!isForApp && 1.422 + * !isForBrowser|, we're probably loading <xul:browser remote>. 1.423 + */ 1.424 + sync GetProcessAttributes() 1.425 + returns (uint64_t id, bool isForApp, bool isForBrowser); 1.426 + sync GetXPCOMProcessAttributes() 1.427 + returns (bool isOffline); 1.428 + 1.429 + PDeviceStorageRequest(DeviceStorageParams params); 1.430 + 1.431 + PFileSystemRequest(FileSystemParams params); 1.432 + 1.433 + sync PCrashReporter(NativeThreadId tid, uint32_t processType); 1.434 + 1.435 + sync GetRandomValues(uint32_t length) 1.436 + returns (uint8_t[] randomValues); 1.437 + 1.438 + PHal(); 1.439 + 1.440 + PIndexedDB(); 1.441 + 1.442 + PNecko(); 1.443 + 1.444 + PSms(); 1.445 + 1.446 + PSpeechSynthesis(); 1.447 + 1.448 + PStorage(); 1.449 + 1.450 + PTelephony(); 1.451 + 1.452 + PBluetooth(); 1.453 + 1.454 + PFMRadio(); 1.455 + 1.456 + PAsmJSCacheEntry(OpenMode openMode, WriteParams write, Principal principal); 1.457 + 1.458 + // Services remoting 1.459 + 1.460 + async StartVisitedQuery(URIParams uri); 1.461 + async VisitURI(URIParams uri, OptionalURIParams referrer, uint32_t flags); 1.462 + async SetURITitle(URIParams uri, nsString title); 1.463 + 1.464 + async LoadURIExternal(URIParams uri); 1.465 + 1.466 + // PrefService message 1.467 + sync ReadPrefsArray() returns (PrefSetting[] prefs); 1.468 + 1.469 + sync ReadFontList() returns (FontListEntry[] retValue); 1.470 + 1.471 + sync SyncMessage(nsString aMessage, ClonedMessageData aData, 1.472 + CpowEntry[] aCpows, Principal aPrincipal) 1.473 + returns (nsString[] retval); 1.474 + 1.475 + rpc RpcMessage(nsString aMessage, ClonedMessageData aData, 1.476 + CpowEntry[] aCpows, Principal aPrincipal) 1.477 + returns (nsString[] retval); 1.478 + 1.479 + ShowAlertNotification(nsString imageUrl, 1.480 + nsString title, 1.481 + nsString text, 1.482 + bool textClickable, 1.483 + nsString cookie, 1.484 + nsString name, 1.485 + nsString bidi, 1.486 + nsString lang, 1.487 + Principal principal); 1.488 + 1.489 + CloseAlert(nsString name, Principal principal); 1.490 + 1.491 + PExternalHelperApp(OptionalURIParams uri, 1.492 + nsCString aMimeContentType, 1.493 + nsCString aContentDisposition, 1.494 + uint32_t aContentDispositionHint, 1.495 + nsString aContentDispositionFilename, 1.496 + bool aForceSave, 1.497 + int64_t aContentLength, 1.498 + OptionalURIParams aReferrer, 1.499 + nullable PBrowser aBrowser); 1.500 + 1.501 + AddGeolocationListener(Principal principal, bool highAccuracy); 1.502 + RemoveGeolocationListener(); 1.503 + SetGeolocationHigherAccuracy(bool enable); 1.504 + 1.505 + ConsoleMessage(nsString message); 1.506 + ScriptError(nsString message, nsString sourceName, nsString sourceLine, 1.507 + uint32_t lineNumber, uint32_t colNumber, uint32_t flags, 1.508 + nsCString category); 1.509 + 1.510 + // nsIPermissionManager messages 1.511 + sync ReadPermissions() returns (Permission[] permissions); 1.512 + 1.513 + SetClipboardText(nsString text, bool isPrivateData, int32_t whichClipboard); 1.514 + sync GetClipboardText(int32_t whichClipboard) 1.515 + returns (nsString text); 1.516 + EmptyClipboard(int32_t whichClipboard); 1.517 + sync ClipboardHasText(int32_t whichClipboard) 1.518 + returns (bool hasText); 1.519 + 1.520 + sync GetSystemColors(uint32_t colorsCount) 1.521 + returns (uint32_t[] colors); 1.522 + 1.523 + sync GetIconForExtension(nsCString aFileExt, uint32_t aIconSize) 1.524 + returns (uint8_t[] bits); 1.525 + 1.526 + sync GetShowPasswordSetting() 1.527 + returns (bool showPassword); 1.528 + 1.529 + // Notify the parent of the presence or absence of private docshells 1.530 + PrivateDocShellsExist(bool aExist); 1.531 + 1.532 + // Tell the parent that the child has gone idle for the first time 1.533 + async FirstIdle(); 1.534 + 1.535 + // Get Muted from the main AudioChannelService. 1.536 + sync AudioChannelGetState(AudioChannel aChannel, bool aElementHidden, 1.537 + bool aElementWasHidden) 1.538 + returns (AudioChannelState value); 1.539 + 1.540 + sync AudioChannelRegisterType(AudioChannel aChannel, bool aWithVideo); 1.541 + sync AudioChannelUnregisterType(AudioChannel aChannel, 1.542 + bool aElementHidden, 1.543 + bool aWithVideo); 1.544 + 1.545 + async AudioChannelChangedNotification(); 1.546 + async AudioChannelChangeDefVolChannel(int32_t aChannel, bool aHidden); 1.547 + 1.548 + async FilePathUpdateNotify(nsString aType, 1.549 + nsString aStorageName, 1.550 + nsString aFilepath, 1.551 + nsCString aReason); 1.552 + // get nsIVolumeService to broadcast volume information 1.553 + async BroadcastVolume(nsString volumeName); 1.554 + 1.555 + // Notify the parent that the child has finished handling a system message. 1.556 + async SystemMessageHandled(); 1.557 + 1.558 + NuwaReady(); 1.559 + 1.560 + sync AddNewProcess(uint32_t pid, ProtocolFdMapping[] aFds); 1.561 + 1.562 + // called by the child (test code only) to propagate volume changes to the parent 1.563 + async CreateFakeVolume(nsString fsName, nsString mountPoint); 1.564 + async SetFakeVolumeState(nsString fsName, int32_t fsState); 1.565 + 1.566 + sync KeywordToURI(nsCString keyword) 1.567 + returns (OptionalInputStreamParams postData, OptionalURIParams uri); 1.568 + 1.569 + sync SpeakerManagerForceSpeaker(bool aEnable); 1.570 + 1.571 + sync SpeakerManagerGetSpeakerStatus() 1.572 + returns (bool value); 1.573 + 1.574 + /** 1.575 + * Notifies the parent about a recording device is starting or shutdown. 1.576 + * @param recordingStatus starting or shutdown 1.577 + * @param pageURL URL that request that changing the recording status 1.578 + * @param isAudio recording start with microphone 1.579 + * @param isVideo recording start with camera 1.580 + */ 1.581 + async RecordingDeviceEvents(nsString recordingStatus, 1.582 + nsString pageURL, 1.583 + bool isAudio, 1.584 + bool isVideo); 1.585 + 1.586 + sync GetGraphicsFeatureStatus(int32_t aFeature) returns (int32_t aStatus, bool aSuccess); 1.587 + 1.588 + AddIdleObserver(uint64_t observerId, uint32_t idleTimeInS); 1.589 + RemoveIdleObserver(uint64_t observerId, uint32_t idleTimeInS); 1.590 + 1.591 + /** 1.592 + * This message is only used on X11 platforms. 1.593 + * 1.594 + * Send a dup of the plugin process's X socket to the parent 1.595 + * process. In theory, this scheme keeps the plugin's X resources 1.596 + * around until after both the plugin process shuts down *and* the 1.597 + * parent process closes the dup fd. This is used to prevent the 1.598 + * parent process from crashing on X errors if, e.g., the plugin 1.599 + * crashes *just before* a repaint and the parent process tries to 1.600 + * use the newly-invalid surface. 1.601 + */ 1.602 + BackUpXResources(FileDescriptor aXSocketFd); 1.603 + 1.604 +both: 1.605 + AsyncMessage(nsString aMessage, ClonedMessageData aData, 1.606 + CpowEntry[] aCpows, Principal aPrincipal); 1.607 +}; 1.608 + 1.609 +} 1.610 +}