|
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/. */ |
|
6 |
|
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 PCrashReporter; |
|
14 include protocol PExternalHelperApp; |
|
15 include protocol PDeviceStorageRequest; |
|
16 include protocol PFileDescriptorSet; |
|
17 include protocol PFMRadio; |
|
18 include protocol PFileSystemRequest; |
|
19 include protocol PHal; |
|
20 include protocol PImageBridge; |
|
21 include protocol PIndexedDB; |
|
22 include protocol PMemoryReportRequest; |
|
23 include protocol PNecko; |
|
24 include protocol PSms; |
|
25 include protocol PSpeechSynthesis; |
|
26 include protocol PStorage; |
|
27 include protocol PTelephony; |
|
28 include protocol PTestShell; |
|
29 include protocol PJavaScript; |
|
30 include DOMTypes; |
|
31 include JavaScriptTypes; |
|
32 include InputStreamParams; |
|
33 include PTabContext; |
|
34 include URIParams; |
|
35 include ProtocolTypes; |
|
36 |
|
37 using GeoPosition from "nsGeoPositionIPCSerialiser.h"; |
|
38 |
|
39 using struct ChromePackage from "mozilla/chrome/RegistryMessageUtils.h"; |
|
40 using struct ResourceMapping from "mozilla/chrome/RegistryMessageUtils.h"; |
|
41 using struct OverrideMapping from "mozilla/chrome/RegistryMessageUtils.h"; |
|
42 using base::ChildPrivileges from "base/process_util.h"; |
|
43 using struct IPC::Permission from "mozilla/net/NeckoMessageUtils.h"; |
|
44 using class IPC::Principal from "mozilla/dom/PermissionMessageUtils.h"; |
|
45 using struct mozilla::null_t from "ipc/IPCMessageUtils.h"; |
|
46 using struct mozilla::void_t from "ipc/IPCMessageUtils.h"; |
|
47 using mozilla::dom::asmjscache::OpenMode from "mozilla/dom/asmjscache/AsmJSCache.h"; |
|
48 using mozilla::dom::asmjscache::WriteParams from "mozilla/dom/asmjscache/AsmJSCache.h"; |
|
49 using mozilla::dom::AudioChannel from "mozilla/dom/AudioChannelBinding.h"; |
|
50 using mozilla::dom::AudioChannelState from "AudioChannelCommon.h"; |
|
51 using mozilla::dom::NativeThreadId from "mozilla/dom/TabMessageUtils.h"; |
|
52 using mozilla::hal::ProcessPriority from "mozilla/HalTypes.h"; |
|
53 using gfxIntSize from "nsSize.h"; |
|
54 |
|
55 namespace mozilla { |
|
56 namespace dom { |
|
57 |
|
58 struct FontListEntry { |
|
59 nsString familyName; |
|
60 nsString faceName; |
|
61 nsCString filepath; |
|
62 uint16_t weight; |
|
63 int16_t stretch; |
|
64 uint8_t italic; |
|
65 uint8_t index; |
|
66 }; |
|
67 |
|
68 struct DeviceStorageFreeSpaceParams |
|
69 { |
|
70 nsString type; |
|
71 nsString storageName; |
|
72 }; |
|
73 |
|
74 struct DeviceStorageUsedSpaceParams |
|
75 { |
|
76 nsString type; |
|
77 nsString storageName; |
|
78 }; |
|
79 |
|
80 struct DeviceStorageAvailableParams |
|
81 { |
|
82 nsString type; |
|
83 nsString storageName; |
|
84 }; |
|
85 |
|
86 struct DeviceStorageStatusParams |
|
87 { |
|
88 nsString type; |
|
89 nsString storageName; |
|
90 }; |
|
91 |
|
92 struct DeviceStorageFormatParams |
|
93 { |
|
94 nsString type; |
|
95 nsString storageName; |
|
96 }; |
|
97 |
|
98 struct DeviceStorageMountParams |
|
99 { |
|
100 nsString type; |
|
101 nsString storageName; |
|
102 }; |
|
103 |
|
104 struct DeviceStorageUnmountParams |
|
105 { |
|
106 nsString type; |
|
107 nsString storageName; |
|
108 }; |
|
109 |
|
110 struct DeviceStorageAddParams |
|
111 { |
|
112 nsString type; |
|
113 nsString storageName; |
|
114 nsString relpath; |
|
115 PBlob blob; |
|
116 }; |
|
117 |
|
118 struct DeviceStorageCreateFdParams |
|
119 { |
|
120 nsString type; |
|
121 nsString storageName; |
|
122 nsString relpath; |
|
123 }; |
|
124 |
|
125 struct DeviceStorageGetParams |
|
126 { |
|
127 nsString type; |
|
128 nsString storageName; |
|
129 nsString rootDir; |
|
130 nsString relpath; |
|
131 }; |
|
132 |
|
133 struct DeviceStorageDeleteParams |
|
134 { |
|
135 nsString type; |
|
136 nsString storageName; |
|
137 nsString relpath; |
|
138 }; |
|
139 |
|
140 struct DeviceStorageEnumerationParams |
|
141 { |
|
142 nsString type; |
|
143 nsString storageName; |
|
144 nsString rootdir; |
|
145 uint64_t since; |
|
146 }; |
|
147 |
|
148 union DeviceStorageParams |
|
149 { |
|
150 DeviceStorageAddParams; |
|
151 DeviceStorageCreateFdParams; |
|
152 DeviceStorageGetParams; |
|
153 DeviceStorageDeleteParams; |
|
154 DeviceStorageEnumerationParams; |
|
155 DeviceStorageFreeSpaceParams; |
|
156 DeviceStorageUsedSpaceParams; |
|
157 DeviceStorageAvailableParams; |
|
158 DeviceStorageStatusParams; |
|
159 DeviceStorageFormatParams; |
|
160 DeviceStorageMountParams; |
|
161 DeviceStorageUnmountParams; |
|
162 }; |
|
163 |
|
164 struct FMRadioRequestEnableParams |
|
165 { |
|
166 double frequency; |
|
167 }; |
|
168 |
|
169 struct FMRadioRequestDisableParams |
|
170 { |
|
171 |
|
172 }; |
|
173 |
|
174 struct FMRadioRequestSetFrequencyParams |
|
175 { |
|
176 double frequency; |
|
177 }; |
|
178 |
|
179 struct FMRadioRequestSeekParams |
|
180 { |
|
181 bool upward; |
|
182 }; |
|
183 |
|
184 struct FMRadioRequestCancelSeekParams |
|
185 { |
|
186 |
|
187 }; |
|
188 |
|
189 union FMRadioRequestParams |
|
190 { |
|
191 FMRadioRequestEnableParams; |
|
192 FMRadioRequestDisableParams; |
|
193 FMRadioRequestSetFrequencyParams; |
|
194 FMRadioRequestSeekParams; |
|
195 FMRadioRequestCancelSeekParams; |
|
196 }; |
|
197 |
|
198 struct FileSystemCreateDirectoryParams |
|
199 { |
|
200 nsString filesystem; |
|
201 nsString realPath; |
|
202 }; |
|
203 |
|
204 union FileSystemFileDataValue |
|
205 { |
|
206 uint8_t[]; |
|
207 PBlob; |
|
208 }; |
|
209 |
|
210 struct FileSystemCreateFileParams |
|
211 { |
|
212 nsString filesystem; |
|
213 nsString realPath; |
|
214 FileSystemFileDataValue data; |
|
215 bool replace; |
|
216 }; |
|
217 |
|
218 struct FileSystemGetFileOrDirectoryParams |
|
219 { |
|
220 nsString filesystem; |
|
221 nsString realPath; |
|
222 }; |
|
223 |
|
224 union FileSystemPathOrFileValue |
|
225 { |
|
226 nsString; |
|
227 PBlob; |
|
228 }; |
|
229 |
|
230 struct FileSystemRemoveParams |
|
231 { |
|
232 nsString filesystem; |
|
233 nsString directory; |
|
234 FileSystemPathOrFileValue target; |
|
235 bool recursive; |
|
236 }; |
|
237 |
|
238 union FileSystemParams |
|
239 { |
|
240 FileSystemCreateDirectoryParams; |
|
241 FileSystemCreateFileParams; |
|
242 FileSystemGetFileOrDirectoryParams; |
|
243 FileSystemRemoveParams; |
|
244 }; |
|
245 |
|
246 union PrefValue { |
|
247 nsCString; |
|
248 int32_t; |
|
249 bool; |
|
250 }; |
|
251 |
|
252 union MaybePrefValue { |
|
253 PrefValue; |
|
254 null_t; |
|
255 }; |
|
256 |
|
257 struct PrefSetting { |
|
258 nsCString name; |
|
259 MaybePrefValue defaultValue; |
|
260 MaybePrefValue userValue; |
|
261 }; |
|
262 |
|
263 intr protocol PContent |
|
264 { |
|
265 parent opens PCompositor; |
|
266 parent opens PImageBridge; |
|
267 child opens PBackground; |
|
268 |
|
269 manages PAsmJSCacheEntry; |
|
270 manages PBlob; |
|
271 manages PBluetooth; |
|
272 manages PBrowser; |
|
273 manages PCrashReporter; |
|
274 manages PDeviceStorageRequest; |
|
275 manages PFileSystemRequest; |
|
276 manages PExternalHelperApp; |
|
277 manages PFileDescriptorSet; |
|
278 manages PFMRadio; |
|
279 manages PHal; |
|
280 manages PIndexedDB; |
|
281 manages PMemoryReportRequest; |
|
282 manages PNecko; |
|
283 manages PSms; |
|
284 manages PSpeechSynthesis; |
|
285 manages PStorage; |
|
286 manages PTelephony; |
|
287 manages PTestShell; |
|
288 manages PJavaScript; |
|
289 |
|
290 both: |
|
291 // Depending on exactly how the new browser is being created, it might be |
|
292 // created from either the child or parent process! |
|
293 // |
|
294 // The child creates the PBrowser as part of |
|
295 // TabChild::BrowserFrameProvideWindow (which happens when the child's |
|
296 // content calls window.open()), and the parent creates the PBrowser as part |
|
297 // of ContentParent::CreateBrowserOrApp. |
|
298 // |
|
299 // When the parent constructs a PBrowser, the child trusts the app token it |
|
300 // receives from the parent. In that case, context can be any of the |
|
301 // IPCTabContext subtypes. |
|
302 // |
|
303 // When the child constructs a PBrowser, the parent doesn't trust the app |
|
304 // token it receives from the child. In this case, context must have type |
|
305 // PopupIPCTabContext. The browser created using a PopupIPCTabContext has |
|
306 // the opener PBrowser's app-id and containing-app-id. The parent checks |
|
307 // that if the opener is a browser element, the context is also for a |
|
308 // browser element. |
|
309 // |
|
310 // This allows the parent to prevent a malicious child from escalating its |
|
311 // privileges by requesting a PBrowser corresponding to a highly-privileged |
|
312 // app; the child can only request privileges for an app which the child has |
|
313 // access to (in the form of a TabChild). |
|
314 async PBrowser(IPCTabContext context, uint32_t chromeFlags); |
|
315 |
|
316 async PBlob(BlobConstructorParams params); |
|
317 |
|
318 async PJavaScript(); |
|
319 |
|
320 PFileDescriptorSet(FileDescriptor fd); |
|
321 |
|
322 child: |
|
323 /** |
|
324 * Enable system-level sandboxing features, if available. Can |
|
325 * usually only be performed zero or one times. The child may |
|
326 * abnormally exit if this fails; the details are OS-specific. |
|
327 */ |
|
328 async SetProcessSandbox(); |
|
329 |
|
330 PMemoryReportRequest(uint32_t generation, bool minimizeMemoryUsage, nsString DMDDumpIdent); |
|
331 |
|
332 /** |
|
333 * Notify the AudioChannelService in the child processes. |
|
334 */ |
|
335 async AudioChannelNotify(); |
|
336 |
|
337 async SpeakerManagerNotify(); |
|
338 |
|
339 /** |
|
340 * Dump this process's GC and CC logs. |
|
341 * |
|
342 * For documentation on the args, see dumpGCAndCCLogsToFile in |
|
343 * nsIMemoryInfoDumper.idl |
|
344 */ |
|
345 async DumpGCAndCCLogsToFile(nsString identifier, |
|
346 bool dumpAllTraces, |
|
347 bool dumpChildProcesses); |
|
348 |
|
349 PTestShell(); |
|
350 |
|
351 RegisterChrome(ChromePackage[] packages, ResourceMapping[] resources, |
|
352 OverrideMapping[] overrides, nsCString locale); |
|
353 |
|
354 async SetOffline(bool offline); |
|
355 |
|
356 async NotifyVisited(URIParams uri); |
|
357 |
|
358 PreferenceUpdate(PrefSetting pref); |
|
359 |
|
360 NotifyAlertsObserver(nsCString topic, nsString data); |
|
361 |
|
362 GeolocationUpdate(GeoPosition somewhere); |
|
363 |
|
364 // nsIPermissionManager messages |
|
365 AddPermission(Permission permission); |
|
366 |
|
367 ScreenSizeChanged(gfxIntSize size); |
|
368 |
|
369 FlushMemory(nsString reason); |
|
370 |
|
371 GarbageCollect(); |
|
372 CycleCollect(); |
|
373 |
|
374 /** |
|
375 * Start accessibility engine in content process. |
|
376 */ |
|
377 ActivateA11y(); |
|
378 |
|
379 AppInfo(nsCString version, nsCString buildID, nsCString name, nsCString UAName); |
|
380 |
|
381 // Notify child that last-pb-context-exited notification was observed |
|
382 LastPrivateDocShellDestroyed(); |
|
383 |
|
384 FilePathUpdate(nsString storageType, nsString storageName, nsString filepath, |
|
385 nsCString reasons); |
|
386 |
|
387 FileSystemUpdate(nsString fsName, nsString mountPoint, int32_t fsState, |
|
388 int32_t mountGeneration, bool isMediaPresent, |
|
389 bool isSharing, bool isFormatting); |
|
390 |
|
391 // Ask the Nuwa process to create a new child process. |
|
392 NuwaFork(); |
|
393 |
|
394 NotifyProcessPriorityChanged(ProcessPriority priority); |
|
395 MinimizeMemoryUsage(); |
|
396 |
|
397 /** |
|
398 * Used to manage nsIStyleSheetService across processes. |
|
399 */ |
|
400 async LoadAndRegisterSheet(URIParams uri, uint32_t type); |
|
401 async UnregisterSheet(URIParams uri, uint32_t type); |
|
402 |
|
403 NotifyPhoneStateChange(nsString newState); |
|
404 |
|
405 /** |
|
406 * Notify idle observers in the child |
|
407 */ |
|
408 NotifyIdleObserver(uint64_t observerId, nsCString topic, nsString str); |
|
409 parent: |
|
410 /** |
|
411 * Tell the content process some attributes of itself. This is |
|
412 * among the first information queried by content processes after |
|
413 * startup. (The message is sync to allow the content process to |
|
414 * control when it receives the information.) |
|
415 * |
|
416 * |id| is a unique ID among all subprocesses. When |isForApp && |
|
417 * isForBrowser|, we're loading <browser> for an app. When |
|
418 * |isForBrowser|, we're loading <browser>. When |!isForApp && |
|
419 * !isForBrowser|, we're probably loading <xul:browser remote>. |
|
420 */ |
|
421 sync GetProcessAttributes() |
|
422 returns (uint64_t id, bool isForApp, bool isForBrowser); |
|
423 sync GetXPCOMProcessAttributes() |
|
424 returns (bool isOffline); |
|
425 |
|
426 PDeviceStorageRequest(DeviceStorageParams params); |
|
427 |
|
428 PFileSystemRequest(FileSystemParams params); |
|
429 |
|
430 sync PCrashReporter(NativeThreadId tid, uint32_t processType); |
|
431 |
|
432 sync GetRandomValues(uint32_t length) |
|
433 returns (uint8_t[] randomValues); |
|
434 |
|
435 PHal(); |
|
436 |
|
437 PIndexedDB(); |
|
438 |
|
439 PNecko(); |
|
440 |
|
441 PSms(); |
|
442 |
|
443 PSpeechSynthesis(); |
|
444 |
|
445 PStorage(); |
|
446 |
|
447 PTelephony(); |
|
448 |
|
449 PBluetooth(); |
|
450 |
|
451 PFMRadio(); |
|
452 |
|
453 PAsmJSCacheEntry(OpenMode openMode, WriteParams write, Principal principal); |
|
454 |
|
455 // Services remoting |
|
456 |
|
457 async StartVisitedQuery(URIParams uri); |
|
458 async VisitURI(URIParams uri, OptionalURIParams referrer, uint32_t flags); |
|
459 async SetURITitle(URIParams uri, nsString title); |
|
460 |
|
461 async LoadURIExternal(URIParams uri); |
|
462 |
|
463 // PrefService message |
|
464 sync ReadPrefsArray() returns (PrefSetting[] prefs); |
|
465 |
|
466 sync ReadFontList() returns (FontListEntry[] retValue); |
|
467 |
|
468 sync SyncMessage(nsString aMessage, ClonedMessageData aData, |
|
469 CpowEntry[] aCpows, Principal aPrincipal) |
|
470 returns (nsString[] retval); |
|
471 |
|
472 rpc RpcMessage(nsString aMessage, ClonedMessageData aData, |
|
473 CpowEntry[] aCpows, Principal aPrincipal) |
|
474 returns (nsString[] retval); |
|
475 |
|
476 ShowAlertNotification(nsString imageUrl, |
|
477 nsString title, |
|
478 nsString text, |
|
479 bool textClickable, |
|
480 nsString cookie, |
|
481 nsString name, |
|
482 nsString bidi, |
|
483 nsString lang, |
|
484 Principal principal); |
|
485 |
|
486 CloseAlert(nsString name, Principal principal); |
|
487 |
|
488 PExternalHelperApp(OptionalURIParams uri, |
|
489 nsCString aMimeContentType, |
|
490 nsCString aContentDisposition, |
|
491 uint32_t aContentDispositionHint, |
|
492 nsString aContentDispositionFilename, |
|
493 bool aForceSave, |
|
494 int64_t aContentLength, |
|
495 OptionalURIParams aReferrer, |
|
496 nullable PBrowser aBrowser); |
|
497 |
|
498 AddGeolocationListener(Principal principal, bool highAccuracy); |
|
499 RemoveGeolocationListener(); |
|
500 SetGeolocationHigherAccuracy(bool enable); |
|
501 |
|
502 ConsoleMessage(nsString message); |
|
503 ScriptError(nsString message, nsString sourceName, nsString sourceLine, |
|
504 uint32_t lineNumber, uint32_t colNumber, uint32_t flags, |
|
505 nsCString category); |
|
506 |
|
507 // nsIPermissionManager messages |
|
508 sync ReadPermissions() returns (Permission[] permissions); |
|
509 |
|
510 SetClipboardText(nsString text, bool isPrivateData, int32_t whichClipboard); |
|
511 sync GetClipboardText(int32_t whichClipboard) |
|
512 returns (nsString text); |
|
513 EmptyClipboard(int32_t whichClipboard); |
|
514 sync ClipboardHasText(int32_t whichClipboard) |
|
515 returns (bool hasText); |
|
516 |
|
517 sync GetSystemColors(uint32_t colorsCount) |
|
518 returns (uint32_t[] colors); |
|
519 |
|
520 sync GetIconForExtension(nsCString aFileExt, uint32_t aIconSize) |
|
521 returns (uint8_t[] bits); |
|
522 |
|
523 sync GetShowPasswordSetting() |
|
524 returns (bool showPassword); |
|
525 |
|
526 // Notify the parent of the presence or absence of private docshells |
|
527 PrivateDocShellsExist(bool aExist); |
|
528 |
|
529 // Tell the parent that the child has gone idle for the first time |
|
530 async FirstIdle(); |
|
531 |
|
532 // Get Muted from the main AudioChannelService. |
|
533 sync AudioChannelGetState(AudioChannel aChannel, bool aElementHidden, |
|
534 bool aElementWasHidden) |
|
535 returns (AudioChannelState value); |
|
536 |
|
537 sync AudioChannelRegisterType(AudioChannel aChannel, bool aWithVideo); |
|
538 sync AudioChannelUnregisterType(AudioChannel aChannel, |
|
539 bool aElementHidden, |
|
540 bool aWithVideo); |
|
541 |
|
542 async AudioChannelChangedNotification(); |
|
543 async AudioChannelChangeDefVolChannel(int32_t aChannel, bool aHidden); |
|
544 |
|
545 async FilePathUpdateNotify(nsString aType, |
|
546 nsString aStorageName, |
|
547 nsString aFilepath, |
|
548 nsCString aReason); |
|
549 // get nsIVolumeService to broadcast volume information |
|
550 async BroadcastVolume(nsString volumeName); |
|
551 |
|
552 // Notify the parent that the child has finished handling a system message. |
|
553 async SystemMessageHandled(); |
|
554 |
|
555 NuwaReady(); |
|
556 |
|
557 sync AddNewProcess(uint32_t pid, ProtocolFdMapping[] aFds); |
|
558 |
|
559 // called by the child (test code only) to propagate volume changes to the parent |
|
560 async CreateFakeVolume(nsString fsName, nsString mountPoint); |
|
561 async SetFakeVolumeState(nsString fsName, int32_t fsState); |
|
562 |
|
563 sync KeywordToURI(nsCString keyword) |
|
564 returns (OptionalInputStreamParams postData, OptionalURIParams uri); |
|
565 |
|
566 sync SpeakerManagerForceSpeaker(bool aEnable); |
|
567 |
|
568 sync SpeakerManagerGetSpeakerStatus() |
|
569 returns (bool value); |
|
570 |
|
571 /** |
|
572 * Notifies the parent about a recording device is starting or shutdown. |
|
573 * @param recordingStatus starting or shutdown |
|
574 * @param pageURL URL that request that changing the recording status |
|
575 * @param isAudio recording start with microphone |
|
576 * @param isVideo recording start with camera |
|
577 */ |
|
578 async RecordingDeviceEvents(nsString recordingStatus, |
|
579 nsString pageURL, |
|
580 bool isAudio, |
|
581 bool isVideo); |
|
582 |
|
583 sync GetGraphicsFeatureStatus(int32_t aFeature) returns (int32_t aStatus, bool aSuccess); |
|
584 |
|
585 AddIdleObserver(uint64_t observerId, uint32_t idleTimeInS); |
|
586 RemoveIdleObserver(uint64_t observerId, uint32_t idleTimeInS); |
|
587 |
|
588 /** |
|
589 * This message is only used on X11 platforms. |
|
590 * |
|
591 * Send a dup of the plugin process's X socket to the parent |
|
592 * process. In theory, this scheme keeps the plugin's X resources |
|
593 * around until after both the plugin process shuts down *and* the |
|
594 * parent process closes the dup fd. This is used to prevent the |
|
595 * parent process from crashing on X errors if, e.g., the plugin |
|
596 * crashes *just before* a repaint and the parent process tries to |
|
597 * use the newly-invalid surface. |
|
598 */ |
|
599 BackUpXResources(FileDescriptor aXSocketFd); |
|
600 |
|
601 both: |
|
602 AsyncMessage(nsString aMessage, ClonedMessageData aData, |
|
603 CpowEntry[] aCpows, Principal aPrincipal); |
|
604 }; |
|
605 |
|
606 } |
|
607 } |