forked from mozilla/gecko-dev
-
Notifications
You must be signed in to change notification settings - Fork 2
/
PContent.ipdl
447 lines (365 loc) · 12.5 KB
/
PContent.ipdl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
/* -*- Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 8 -*- */
/* vim: set sw=4 ts=8 et tw=80 ft=cpp : */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
include protocol PBlob;
include protocol PBluetooth;
include protocol PBrowser;
include protocol PCompositor;
include protocol PCrashReporter;
include protocol PExternalHelperApp;
include protocol PDeviceStorageRequest;
include protocol PHal;
include protocol PImageBridge;
include protocol PIndexedDB;
include protocol PMemoryReportRequest;
include protocol PNecko;
include protocol PSms;
include protocol PStorage;
include protocol PTestShell;
include DOMTypes;
include URIParams;
include "mozilla/chrome/RegistryMessageUtils.h";
include "mozilla/dom/PermissionMessageUtils.h";
include "mozilla/dom/TabMessageUtils.h";
include "mozilla/layout/RenderFrameUtils.h";
include "mozilla/net/NeckoMessageUtils.h";
include "nsGeoPositionIPCSerialiser.h";
using GeoPosition;
using PrefTuple;
using ChromePackage;
using ResourceMapping;
using OverrideMapping;
using IPC::Permission;
using IPC::Principal;
using mozilla::null_t;
using mozilla::void_t;
using mozilla::dom::AudioChannelType;
using mozilla::dom::NativeThreadId;
using mozilla::layout::ScrollingBehavior;
using gfxIntSize;
namespace mozilla {
namespace dom {
// Data required to clone an existing DOMStorageImpl in the parent
struct StorageClone
{
// Existing cross-process storage actor to clone
PStorage actor;
// Result of calling IsCallerSecure() in the child
bool callerSecure;
};
// When creating a new PStorage protocol, an existing one can be
// cloned (see nsDOMStorage2::Clone)
union StorageConstructData
{
null_t;
StorageClone;
};
struct FontListEntry {
nsString familyName;
nsString faceName;
nsCString filepath;
uint16_t weight;
int16_t stretch;
uint8_t italic;
uint8_t index;
};
struct DeviceStorageStatParams
{
nsString type;
nsString fullpath;
};
struct DeviceStorageAddParams
{
nsString type;
PBlob blob;
nsString name;
nsString fullpath;
};
struct DeviceStorageGetParams
{
nsString type;
nsString name;
nsString fullpath;
};
struct DeviceStorageDeleteParams
{
nsString type;
nsString fullpath;
};
struct DeviceStorageEnumerationParams
{
nsString type;
nsString fullpath;
uint64_t since;
};
union DeviceStorageParams
{
DeviceStorageAddParams;
DeviceStorageGetParams;
DeviceStorageDeleteParams;
DeviceStorageEnumerationParams;
DeviceStorageStatParams;
};
struct SlicedBlobConstructorParams
{
PBlob source;
uint64_t begin;
uint64_t end;
nsString contentType;
};
struct MysteryBlobConstructorParams
{
// Nothing is known about this type of blob.
};
union BlobConstructorParams
{
NormalBlobConstructorParams;
FileBlobConstructorParams;
SlicedBlobConstructorParams;
MysteryBlobConstructorParams;
};
// An IPCTabContext which corresponds to a PBrowser opened by a child when it
// receives window.open().
//
// If isBrowserElement is false, this PopupIPCTabContext corresponds to an app
// frame, and the frame's app-id and app-frame-owner-app-id will be equal to the
// opener's values.
//
// If isBrowserElement is true, the frame's browserFrameOwnerAppId will be equal
// to the opener's app-id.
//
// It's an error to set isBrowserElement == false if opener is a browser
// element. Such a PopupIPCTabContext should be rejected by code which receives
// it.
struct PopupIPCTabContext
{
PBrowser opener;
bool isBrowserElement;
};
// An IPCTabContext which corresponds to an app frame.
struct AppFrameIPCTabContext
{
// The ID of the app this frame corresponds to. May be NO_APP_ID.
uint32_t ownAppId;
// The ID of the app containing this frame. May be NO_APP_ID.
uint32_t appFrameOwnerAppId;
};
// An IPCTabContext which corresponds to a browser frame.
struct BrowserFrameIPCTabContext
{
// The ID of the app which contains this browser frame. May be NO_APP_ID.
uint32_t browserFrameOwnerAppId;
};
// This is equivalent to AppFrameIPCTabContext with all fields set to NO_APP_ID.
struct VanillaFrameIPCTabContext
{};
// IPCTabContext is an analog to mozilla::dom::TabContext. Both specify an
// iframe/PBrowser's own and containing app-ids and tell you whether the
// iframe/PBrowser is a browser frame. But only IPCTabContext is allowed to
// travel over IPC.
//
// We need IPCTabContext (specifically, PopupIPCTabContext) to prevent a
// privilege escalation attack by a compromised child process. See the comment
// on AllocPBrowser for details.
union IPCTabAppBrowserContext
{
PopupIPCTabContext;
AppFrameIPCTabContext;
BrowserFrameIPCTabContext;
VanillaFrameIPCTabContext;
};
struct IPCTabContext {
IPCTabAppBrowserContext appBrowserContext;
ScrollingBehavior scrollingBehavior;
};
union PrefValue {
nsCString;
int32_t;
bool;
};
union MaybePrefValue {
PrefValue;
null_t;
};
struct PrefSetting {
nsCString name;
MaybePrefValue defaultValue;
MaybePrefValue userValue;
};
rpc protocol PContent
{
parent opens PCompositor;
parent opens PImageBridge;
manages PBlob;
manages PBluetooth;
manages PBrowser;
manages PCrashReporter;
manages PDeviceStorageRequest;
manages PExternalHelperApp;
manages PHal;
manages PIndexedDB;
manages PMemoryReportRequest;
manages PNecko;
manages PSms;
manages PStorage;
manages PTestShell;
both:
// Depending on exactly how the new browser is being created, it might be
// created from either the child or parent process!
//
// The child creates the PBrowser as part of
// TabChild::BrowserFrameProvideWindow (which happens when the child's
// content calls window.open()), and the parent creates the PBrowser as part
// of ContentParent::CreateTab.
//
// When the parent constructs a PBrowser, the child trusts the app token it
// receives from the parent. In that case, context can be any of the
// IPCTabContext subtypes.
//
// When the child constructs a PBrowser, the parent doesn't trust the app
// token it receives from the child. In this case, context must have type
// PopupIPCTabContext. The browser created using a PopupIPCTabContext has
// the opener PBrowser's app-id and containing-app-id. The parent checks
// that if the opener is a browser element, the context is also for a
// browser element.
//
// This allows the parent to prevent a malicious child from escalating its
// privileges by requesting a PBrowser corresponding to a highly-privileged
// app; the child can only request privileges for an app which the child has
// access to (in the form of a TabChild).
async PBrowser(IPCTabContext context, uint32_t chromeFlags);
async PBlob(BlobConstructorParams params);
child:
PMemoryReportRequest();
/**
* Notify the AudioChannelService in the child processes.
*/
async AudioChannelNotify();
/**
* Dump the contents of about:memory to a file in our temp directory.
*
* For documentation on the args, see
* MemoryInfoDumper::dumpMemoryReportsToFile.
*/
async DumpMemoryReportsToFile(nsString identifier,
bool minimizeMemoryUsage,
bool dumpChildProcesses);
/**
* Dump this process's GC and CC logs.
*
* For documentation on the args, see
* MemoryInfoDumper::dumpGCAndCCLogsToFile.
*/
async DumpGCAndCCLogsToFile(nsString identifier,
bool dumpChildProcesses);
PTestShell();
RegisterChrome(ChromePackage[] packages, ResourceMapping[] resources,
OverrideMapping[] overrides, nsCString locale);
async SetOffline(bool offline);
async NotifyVisited(URIParams uri);
PreferenceUpdate(PrefSetting pref);
NotifyAlertsObserver(nsCString topic, nsString data);
GeolocationUpdate(GeoPosition somewhere);
// nsIPermissionManager messages
AddPermission(Permission permission);
ScreenSizeChanged(gfxIntSize size);
FlushMemory(nsString reason);
GarbageCollect();
CycleCollect();
/**
* Start accessibility engine in content process.
*/
ActivateA11y();
AppInfo(nsCString version, nsCString buildID);
// Notify child that last-pb-context-exited notification was observed
LastPrivateDocShellDestroyed();
FilePathUpdate(nsString type, nsString filepath, nsCString reasons);
FileSystemUpdate(nsString fsName, nsString mountPoint, int32_t fsState);
parent:
/**
* Tell the content process some attributes of itself. This is
* among the first information queried by content processes after
* startup. (The message is sync to allow the content process to
* control when it receives the information.)
*
* |id| is a unique ID among all subprocesses. When |isForApp &&
* isForBrowser|, we're loading <browser> for an app. When
* |isForBrowser|, we're loading <browser>. When |!isForApp &&
* !isForBrowser|, we're probably loading <xul:browser remote>.
*/
sync GetProcessAttributes()
returns (uint64_t id, bool startBackground,
bool isForApp, bool isForBrowser);
sync GetXPCOMProcessAttributes()
returns (bool isOffline);
PDeviceStorageRequest(DeviceStorageParams params);
sync PCrashReporter(NativeThreadId tid, uint32_t processType);
PHal();
PIndexedDB();
PNecko();
PSms();
PStorage(StorageConstructData data);
PBluetooth();
// Services remoting
async StartVisitedQuery(URIParams uri);
async VisitURI(URIParams uri, OptionalURIParams referrer, uint32_t flags);
async SetURITitle(URIParams uri, nsString title);
// filepicker remoting
sync ShowFilePicker(int16_t mode, int16_t selectedType, bool addToRecentDocs,
nsString title, nsString defaultFile, nsString defaultExtension,
nsString[] filters, nsString[] filterNames)
returns (nsString[] files, int16_t retValue, nsresult result);
async LoadURIExternal(URIParams uri);
// PrefService message
sync ReadPrefsArray() returns (PrefSetting[] prefs);
sync ReadFontList() returns (FontListEntry[] retValue);
sync SyncMessage(nsString aMessage, ClonedMessageData aData)
returns (nsString[] retval);
ShowAlertNotification(nsString imageUrl,
nsString title,
nsString text,
bool textClickable,
nsString cookie,
nsString name);
PExternalHelperApp(OptionalURIParams uri, nsCString aMimeContentType,
nsCString aContentDisposition, bool aForceSave,
int64_t aContentLength, OptionalURIParams aReferrer);
AddGeolocationListener(Principal principal);
RemoveGeolocationListener();
SetGeolocationHigherAccuracy(bool enable);
ConsoleMessage(nsString message);
ScriptError(nsString message, nsString sourceName, nsString sourceLine,
uint32_t lineNumber, uint32_t colNumber, uint32_t flags,
nsCString category);
// nsIPermissionManager messages
sync ReadPermissions() returns (Permission[] permissions);
// These clipboard methods are only really used on Android since
// the clipboard is not available in the content process.
SetClipboardText(nsString text, bool isPrivateData, int32_t whichClipboard);
sync GetClipboardText(int32_t whichClipboard)
returns (nsString text);
EmptyClipboard();
sync ClipboardHasText()
returns (bool hasText);
sync GetSystemColors(uint32_t colorsCount)
returns (uint32_t[] colors);
sync GetIconForExtension(nsCString aFileExt, uint32_t aIconSize)
returns (uint8_t[] bits);
sync GetShowPasswordSetting()
returns (bool showPassword);
// Notify the parent of the presence or absence of private docshells
PrivateDocShellsExist(bool aExist);
// Tell the parent that the child has gone idle for the first time
async FirstIdle();
// Get Muted from the main AudioChannelService.
sync AudioChannelGetMuted(AudioChannelType aType, bool aMozHidden)
returns (bool value);
async AudioChannelRegisterType(AudioChannelType aType);
async AudioChannelUnregisterType(AudioChannelType aType);
both:
AsyncMessage(nsString aMessage, ClonedMessageData aData);
};
}
}