summaryrefslogtreecommitdiffstats
path: root/dom/ipc/PContent.ipdl
blob: 3f93b5fb7322dfb3180b51529c28f81f3aba3ece (plain)
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
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
/* -*- tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* 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 PBackgroundStarter;
include protocol PBrowser;
include protocol PClipboardWriteRequest;
include protocol PCompositorManager;
include protocol PContentPermissionRequest;
include protocol PCycleCollectWithLogs;
include protocol PDocumentChannel;
include protocol PExtensions;
include protocol PExternalHelperApp;
include protocol PHandlerService;
include protocol PHal;
include protocol PHeapSnapshotTempFileHelper;
include protocol PProcessHangMonitor;
include protocol PImageBridge;
include protocol PRemotePrintJob;
include protocol PLoginReputation;
include protocol PMedia;
include protocol PNecko;
include protocol PStreamFilter;
include protocol PGMPContent;
include protocol PGMPService;
include protocol PGMP;
#ifdef MOZ_WEBSPEECH
include protocol PSpeechSynthesis;
#endif
include protocol PTestShell;
include protocol PRemoteSpellcheckEngine;
include protocol PWebBrowserPersistDocument;
#ifdef MOZ_WEBRTC
include protocol PWebrtcGlobal;
#endif
include protocol PWindowGlobal;
include protocol PURLClassifier;
include protocol PURLClassifierLocal;
include protocol PVRManager;
include protocol PRemoteDecoderManager;
include protocol PProfiler;
include protocol PScriptCache;
include protocol PSessionStorageObserver;
include protocol PBenchmarkStorage;
include DOMTypes;
include WindowGlobalTypes;
include IPCBlob;
include IPCStream;
include IPCTransferable;
include PPrintingTypes;
include PTabContext;
include ProtocolTypes;
include PBackgroundSharedTypes;
include PContentPermission;
include GraphicsMessages;
include MemoryReportTypes;
include ClientIPCTypes;
include HangTypes;
include PrefsTypes;
include NeckoChannelParams;
include PSMIPCTypes;
include LookAndFeelTypes;

#if defined(MOZ_SANDBOX) && defined(MOZ_DEBUG) && defined(ENABLE_TESTS)
include protocol PSandboxTesting;
#endif

include "ipc/MediaControlIPC.h";
include "mozilla/AntiTrackingIPCUtils.h";
include "mozilla/GfxMessageUtils.h";
include "mozilla/dom/BindingIPCUtils.h";
include "mozilla/dom/CSPMessageUtils.h";
include "mozilla/dom/DocShellMessageUtils.h";
include "mozilla/dom/FeaturePolicyUtils.h";
include "mozilla/dom/MediaSessionIPCUtils.h";
include "mozilla/dom/PageLoadEventUtils.h";
include "mozilla/dom/ReferrerInfoUtils.h";
include "mozilla/glean/GleanMetrics.h";
include "mozilla/ipc/ByteBufUtils.h";
include "mozilla/ipc/TransportSecurityInfoUtils.h";
include "mozilla/ipc/URIUtils.h";
include "mozilla/net/NeckoMessageUtils.h";
include "mozilla/PermissionDelegateIPCUtils.h";

[RefCounted] using class nsIDOMGeoPosition from "nsGeoPositionIPCSerialiser.h";
[RefCounted] using class nsIAlertNotification from "mozilla/AlertNotificationIPCSerializer.h";

using struct ChromePackage from "mozilla/chrome/RegistryMessageUtils.h";
using struct SubstitutionMapping from "mozilla/chrome/RegistryMessageUtils.h";
using struct OverrideMapping from "mozilla/chrome/RegistryMessageUtils.h";
using base::ProcessId from "base/process.h";
using struct IPC::Permission from "mozilla/net/NeckoMessageUtils.h";
using mozilla::dom::NativeThreadId from "mozilla/dom/NativeThreadId.h";
using mozilla::hal::ProcessPriority from "mozilla/HalTypes.h";
using mozilla::gfx::IntSize from "mozilla/gfx/2D.h";
using mozilla::gfx::SurfaceFormat from "mozilla/gfx/Types.h";
using mozilla::dom::TabId from "mozilla/dom/ipc/IdType.h";
using mozilla::dom::ContentParentId from "mozilla/dom/ipc/IdType.h";
using mozilla::LayoutDeviceIntPoint from "Units.h";
using mozilla::ImagePoint from "Units.h";
using mozilla::ImageIntSize from "Units.h";
using mozilla::widget::ThemeChangeKind from "mozilla/widget/WidgetMessageUtils.h";
using class mozilla::dom::MessagePort from "mozilla/dom/MessagePort.h";
using class mozilla::dom::ipc::StructuredCloneData from "mozilla/dom/ipc/StructuredCloneData.h";
using mozilla::OriginAttributes from "mozilla/ipc/BackgroundUtils.h";
using struct mozilla::layers::TextureFactoryIdentifier from "mozilla/layers/CompositorTypes.h";
using mozilla::layers::CompositorOptions from "mozilla/layers/CompositorOptions.h";
using mozilla::layers::LayersId from "mozilla/layers/LayersTypes.h";
using mozilla::Telemetry::HistogramAccumulation from "mozilla/TelemetryComms.h";
using mozilla::Telemetry::KeyedHistogramAccumulation from "mozilla/TelemetryComms.h";
using mozilla::Telemetry::ScalarAction from "mozilla/TelemetryComms.h";
using mozilla::Telemetry::KeyedScalarAction from "mozilla/TelemetryComms.h";
using mozilla::Telemetry::DynamicScalarDefinition from "mozilla/TelemetryComms.h";
using mozilla::Telemetry::ChildEventData from "mozilla/TelemetryComms.h";

#if defined(XP_WIN)
[MoveOnly] using mozilla::UntrustedModulesData from "mozilla/UntrustedModulesData.h";
[MoveOnly] using mozilla::ModulePaths from "mozilla/UntrustedModulesData.h";
[MoveOnly] using mozilla::ModulesMapResult from "mozilla/UntrustedModulesData.h";
#endif  // defined(XP_WIN)

using mozilla::Telemetry::DiscardedData from "mozilla/TelemetryComms.h";
using mozilla::glean::perf::PageLoadExtra from "mozilla/glean/GleanMetrics.h";
[MoveOnly] using mozilla::CrossProcessMutexHandle from "mozilla/ipc/CrossProcessMutex.h";
using mozilla::dom::MaybeDiscardedBrowsingContext from "mozilla/dom/BrowsingContext.h";
using mozilla::dom::BrowsingContextTransaction from "mozilla/dom/BrowsingContext.h";
using mozilla::dom::BrowsingContextInitializer from "mozilla/dom/BrowsingContext.h";
using mozilla::dom::PermitUnloadResult from "nsIContentViewer.h";
using mozilla::dom::MaybeDiscardedWindowContext from "mozilla/dom/WindowContext.h";
using mozilla::dom::WindowContextTransaction from "mozilla/dom/WindowContext.h";
[MoveOnly] using base::SharedMemoryHandle from "base/shared_memory.h";
using mozilla::fontlist::Pointer from "SharedFontList.h";
using gfxSparseBitSet from "gfxFontUtils.h";
using FontVisibility from "gfxFontEntry.h";
using mozilla::dom::MediaControlAction from "mozilla/dom/MediaControlKeySource.h";
using mozilla::dom::MediaPlaybackState from "mozilla/dom/MediaPlaybackStatus.h";
using mozilla::dom::MediaAudibleState from "mozilla/dom/MediaPlaybackStatus.h";
using mozilla::dom::MediaMetadataBase from "mozilla/dom/MediaMetadata.h";
using mozilla::dom::MediaSessionAction from "mozilla/dom/MediaSessionBinding.h";
using mozilla::dom::MediaSessionPlaybackState from "mozilla/dom/MediaSessionBinding.h";
using mozilla::dom::PositionState from "mozilla/dom/MediaSession.h";
using mozilla::dom::ServiceWorkerShutdownState::Progress from "mozilla/dom/ServiceWorkerShutdownState.h";
using mozilla::ContentBlockingNotifier::StorageAccessPermissionGrantedReason from "mozilla/ContentBlockingNotifier.h";
using mozilla::ContentBlockingNotifier::BlockingDecision from "mozilla/ContentBlockingNotifier.h";
using mozilla::StorageAccessAPIHelper::StorageAccessPromptChoices from "mozilla/StorageAccessAPIHelper.h";
using mozilla::dom::JSActorMessageKind from "mozilla/dom/JSActor.h";
using mozilla::dom::JSActorMessageMeta from "mozilla/dom/PWindowGlobal.h";
using mozilla::PermissionDelegateHandler::DelegatedPermissionList from "mozilla/PermissionDelegateHandler.h";
[RefCounted] using class nsILayoutHistoryState from "nsILayoutHistoryState.h";
using class mozilla::dom::SessionHistoryInfo from "mozilla/dom/SessionHistoryEntry.h";
using struct nsPoint from "nsPoint.h";
using struct mozilla::dom::LoadingSessionHistoryInfo from "mozilla/dom/SessionHistoryEntry.h";
using mozilla::media::MediaCodecsSupported from "MediaCodecsSupport.h";
using mozilla::RemoteDecodeIn from "mozilla/RemoteDecoderManagerChild.h";
using mozilla::dom::PerformanceTimingData from "mozilla/dom/PerformanceTiming.h";
[RefCounted] using mozilla::dom::FeaturePolicy from "mozilla/dom/FeaturePolicy.h";
using mozilla::dom::Wireframe from "mozilla/dom/DocumentBinding.h";
using mozilla::PerfStats::MetricMask from "mozilla/PerfStats.h";
[RefCounted] using class nsIX509Cert from "nsIX509Cert.h";
using nsIDNSService::ResolverMode from "nsIDNSService.h";

union ChromeRegistryItem
{
    ChromePackage;
    OverrideMapping;
    SubstitutionMapping;
};

namespace mozilla {
namespace dom {

// SetXPCOMProcessAttributes passes an array of font data to the child,
// but each platform needs different details so we have platform-specific
// versions of the SystemFontListEntry type:
#if defined(ANDROID)
// Used on Android to pass the list of fonts on the device
// to the child process
struct SystemFontListEntry {
    nsCString familyName;
    nsCString faceName;
    nsCString filepath;
    uint32_t  weightRange;
    uint32_t  stretchRange;
    uint32_t  styleRange;
    uint8_t   index;
    FontVisibility visibility;
};
#elif defined(XP_MACOSX)
// Used on Mac OS X to pass the list of font families (not faces)
// from chrome to content processes.
// The entryType field distinguishes several types of font family
// record; see gfxMacPlatformFontList.h for values and meaning.
struct SystemFontListEntry {
    nsCString familyName;
    FontVisibility visibility;
    uint8_t   entryType;
};
#else
// Used on Linux to pass list of font patterns from chrome to content.
// (Unused on Windows, but there needs to be a definition of the type.)
struct SystemFontListEntry {
    nsCString pattern;
    bool      appFontFamily;
};
#endif

#ifdef MOZ_WIDGET_GTK
struct SystemFontOptions {
    int32_t antialias; // cairo_antialias_t
    int32_t subpixelOrder; // cairo_subpixel_order_t
    int32_t hintStyle; // cairo_hint_style_t
    int32_t lcdFilter; // cairo_lcd_filter_t
};
#endif

struct SystemFontList {
    SystemFontListEntry[] entries;
#ifdef MOZ_WIDGET_GTK
    SystemFontOptions options;
#endif
};

union SystemParameterValue {
  bool;
  float;
};

struct ClipboardCapabilities {
  bool supportsSelectionClipboard;
  bool supportsFindClipboard;
  bool supportsSelectionCache;
};

union FileDescOrError {
    FileDescriptor;
    nsresult;
};

struct DomainPolicyClone
{
    bool        active;
    nullable nsIURI[] blocklist;
    nullable nsIURI[] allowlist;
    nullable nsIURI[] superBlocklist;
    nullable nsIURI[] superAllowlist;
};

struct AndroidSystemInfo
{
    nsString device;
    nsString manufacturer;
    nsString release_version;
    nsString hardware;
    uint32_t sdk_version;
    bool     isTablet;
};

struct GetFilesResponseSuccess
{
  IPCBlob[] blobs;
};

struct GetFilesResponseFailure
{
  nsresult errorCode;
};

union GetFilesResponseResult
{
  GetFilesResponseSuccess;
  GetFilesResponseFailure;
};

struct BlobURLRegistrationData
{
  nsCString url;
  IPCBlob blob;
  nullable nsIPrincipal principal;
  nsID? agentClusterId;
  bool revoked;
};

struct JSWindowActorEventDecl
{
  nsString name;
  bool capture;
  bool systemGroup;
  bool allowUntrusted;
  bool? passive;
  bool createActor;
};

struct JSWindowActorInfo
{
  nsCString name;
  bool allFrames;

  // True if `url` is for ESM.
  // False if `url` is for JSM or nothing.
  bool isESModule;

  // The module of the url.
  nsCString? url;

  JSWindowActorEventDecl[] events;

  // Observer notifications this actor listens to.
  nsCString[] observers;
  nsString[] matches;
  nsCString[] remoteTypes;
  nsString[] messageManagerGroups;
};

struct JSProcessActorInfo
{
    // The name of the actor.
    nsCString name;

    // True if `url` is for ESM.
    // False if `url` is for JSM or nothing.
    bool isESModule;

    // The module of the url.
    nsCString? url;

    // Observer notifications this actor listens to.
    nsCString[] observers;
    nsCString[] remoteTypes;
};

struct GMPAPITags
{
    nsCString api;
    nsCString[] tags;
};

struct GMPCapabilityData
{
    nsCString name;
    nsCString version;
    GMPAPITags[] capabilities;
};

struct L10nFileSourceDescriptor {
  nsCString name;
  nsCString metasource;
  nsCString[] locales;
  nsCString prePath;
  nsCString[] index;
};

struct XPCOMInitData
{
    bool isOffline;
    bool isConnected;
    int32_t captivePortalState;
    bool isLangRTL;
    bool haveBidiKeyboards;
    nsCString[] dictionaries;
    ClipboardCapabilities clipboardCaps;
    DomainPolicyClone domainPolicy;
    nullable nsIURI userContentSheetURL;
    GfxVarUpdate[] gfxNonDefaultVarUpdates;
    ContentDeviceData contentDeviceData;
    GfxInfoFeatureStatus[] gfxFeatureStatus;
    nsCString[] appLocales;
    nsCString[] requestedLocales;
    L10nFileSourceDescriptor[] l10nFileSources;
    DynamicScalarDefinition[] dynamicScalarDefs;
    MetricMask perfStatsMask;
    nsCString trrDomain;
    ResolverMode trrMode;
    // This is the value of network.trr.mode and can be diffrent than trrMode.
    ResolverMode trrModeFromPref;
};

struct VisitedQueryResult
{
    nullable nsIURI uri;
    bool visited;
};

struct StringBundleDescriptor
{
    nsCString bundleURL;
    FileDescriptor mapFile;
    uint32_t mapSize;
};

struct IPCURLClassifierFeature
{
    nsCString featureName;
    nsCString[] tables;
    nsCString exceptionHostList;
};

// Transport structure for Notifications API notifications
// (https://developer.mozilla.org/en-US/docs/Web/API/notification) instances
// used exclusively by the NotificationEvent PContent method.
struct NotificationEventData
{
    nsCString originSuffix;
    nsCString scope;
    nsString ID;
    nsString title;
    nsString dir;
    nsString lang;
    nsString body;
    nsString tag;
    nsString icon;
    nsString data;
    nsString behavior;
};

struct PostMessageData
{
    MaybeDiscardedBrowsingContext source;
    nsString origin;
    nsString targetOrigin;
    nullable nsIURI targetOriginURI;
    nullable nsIPrincipal callerPrincipal;
    nullable nsIPrincipal subjectPrincipal;
    nullable nsIURI callerURI;
    bool isFromPrivateWindow;
    nsCString scriptLocation;
    uint64_t innerWindowId;
};

union SyncedContextInitializer
{
    BrowsingContextInitializer;
    WindowContextInitializer;
};

union BlobURLDataRequestResult
{
  IPCBlob;
  nsresult;
};

struct TextRecognitionQuad {
    float confidence;
    nsString string;
    ImagePoint[] points;
};

struct TextRecognitionResult {
    TextRecognitionQuad[] quads;
};

union TextRecognitionResultOrError {
    TextRecognitionResult;
    nsCString;
};

struct IPCImage {
    BigBuffer data;
    uint32_t stride;
    SurfaceFormat format;
    ImageIntSize size;
};

union IPCTransferableDataOrError {
    IPCTransferableData;
    nsresult;
};

/**
 * The PContent protocol is a top-level protocol between the UI process
 * and a content process. There is exactly one PContentParent/PContentChild pair
 * for each content process.
 */
[NestedUpTo=inside_cpow, NeedsOtherPid]
sync protocol PContent
{
    manages PBrowser;
    manages PClipboardWriteRequest;
    manages PContentPermissionRequest;
    manages PCycleCollectWithLogs;
    manages PExtensions;
    manages PExternalHelperApp;
    manages PHal;
    manages PHandlerService;
    manages PHeapSnapshotTempFileHelper;
    manages PRemotePrintJob;
    manages PMedia;
    manages PNecko;
#ifdef MOZ_WEBSPEECH
    manages PSpeechSynthesis;
#endif
    manages PTestShell;
    manages PRemoteSpellcheckEngine;
    manages PWebBrowserPersistDocument;
#ifdef MOZ_WEBRTC
    manages PWebrtcGlobal;
#endif
    manages PURLClassifier;
    manages PURLClassifierLocal;
    manages PScriptCache;
    manages PLoginReputation;
    manages PSessionStorageObserver;
    manages PBenchmarkStorage;

    // 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
    // BrowserChild::BrowserFrameProvideWindow (which happens when the child's
    // content calls window.open()), and the parent creates the PBrowser as part
    // of ContentParent::CreateBrowser.
    //
    // When the parent constructs a PBrowser, the child trusts the attributes it
    // receives from the parent.  In that case, the context should be
    // FrameIPCTabContext.
    //
    // When the child constructs a PBrowser, the parent doesn't trust the
    // attributes it receives from the child.  In this case, context must have
    // type PopupIPCTabContext.  The parent checks that if the opener is a
    // browser element, the context is also for a browser element.
    //
    // If |sameTabGroupAs| is non-zero, the new tab should go in the same
    // TabGroup as |sameTabGroupAs|. This parameter should always be zero
    // for PBrowser messages sent from the child to the parent.
    //
    // Separate messages are used for the parent and child side constructors due
    // to the differences in data and actor setup required.
    //
    // Keep the last 3 attributes in sync with GetProcessAttributes!
parent:
    async ConstructPopupBrowser(ManagedEndpoint<PBrowserParent> browserEp,
                                ManagedEndpoint<PWindowGlobalParent> windowEp,
                                TabId tabId, IPCTabContext context,
                                WindowGlobalInit windowInit,
                                uint32_t chromeFlags);

    // TODO: Do I need to make this return something to watch for completion?
    // Guess we'll see how we end up triggering the actual print, for preview
    // this should be enough...
    async CloneDocumentTreeInto(MaybeDiscardedBrowsingContext aSourceBc,
                                MaybeDiscardedBrowsingContext aTargetBc,
                                PrintData aPrintData);

    async UpdateRemotePrintSettings(MaybeDiscardedBrowsingContext aBc,
                                    PrintData aPrintData);

    async PExtensions();

child:
    async ConstructBrowser(ManagedEndpoint<PBrowserChild> browserEp,
                           ManagedEndpoint<PWindowGlobalChild> windowEp,
                           TabId tabId,
                           IPCTabContext context,
                           WindowGlobalInit windowInit,
                           uint32_t chromeFlags, ContentParentId cpId,
                           bool isForBrowser, bool isTopLevel);

both:
    // For parent->child, aBrowser must be non-null; aContext can
    // be null to indicate the browser's current root document, or non-null
    // to persist a subdocument.  For child->parent, arguments are
    // ignored and should be null.
    async PWebBrowserPersistDocument(nullable PBrowser aBrowser,
                                     MaybeDiscardedBrowsingContext aContext);

    async RawMessage(JSActorMessageMeta aMetadata, ClonedMessageData? aData,
                     ClonedMessageData? aStack);

child:
    async InitGMPService(Endpoint<PGMPServiceChild> service);
    async InitProcessHangMonitor(Endpoint<PProcessHangMonitorChild> hangMonitor);
    async InitProfiler(Endpoint<PProfilerChild> aEndpoint);

    // Give the content process its endpoints to the compositor.
    async InitRendering(
      Endpoint<PCompositorManagerChild> compositor,
      Endpoint<PImageBridgeChild> imageBridge,
      Endpoint<PVRManagerChild> vr,
      Endpoint<PRemoteDecoderManagerChild> video,
      uint32_t[] namespaces);

    // Re-create the rendering stack using the given endpoints. This is sent
    // after the compositor process has crashed. The new endpoints may be to a
    // newly launched GPU process, or the compositor thread of the UI process.
    async ReinitRendering(
      Endpoint<PCompositorManagerChild> compositor,
      Endpoint<PImageBridgeChild> bridge,
      Endpoint<PVRManagerChild> vr,
      Endpoint<PRemoteDecoderManagerChild> video,
      uint32_t[] namespaces);

    async NetworkLinkTypeChange(uint32_t type);
    async SocketProcessCrashed();

    // Re-create the rendering stack for a device reset.
    async ReinitRenderingForDeviceReset();

    /**
     * Enable system-level sandboxing features, if available.  Can
     * usually only be performed zero or one times.  The child may
     * abnormally exit if this fails; the details are OS-specific.
     */
    async SetProcessSandbox(FileDescriptor? aBroker);

    async RequestMemoryReport(uint32_t generation,
                              bool anonymize,
                              bool minimizeMemoryUsage,
                              FileDescriptor? DMDFile)
        returns (uint32_t aGeneration);

    async RequestPerformanceMetrics(nsID aID);

#if defined(XP_WIN)
    /**
     * Used by third-party modules telemetry (aka "untrusted modules" telemetry)
     * to pull data from content processes.
     */
    async GetUntrustedModulesData() returns (UntrustedModulesData? data);

    /**
    * This method is used to notifty a child process to start
    * processing module loading events in UntrustedModulesProcessor.
    * This should be called when the parent process has gone idle.
    */
    async UnblockUntrustedModulesThread();
#endif  // defined(XP_WIN)

    /**
     * Communication between the PuppetBidiKeyboard and the actual
     * BidiKeyboard hosted by the parent
     */
    async BidiKeyboardNotify(bool isLangRTL, bool haveBidiKeyboards);

    /**
     * Dump this process's GC and CC logs to the provided files.
     *
     * For documentation on the other args, see dumpGCAndCCLogsToFile in
     * nsIMemoryInfoDumper.idl
     */
    async PCycleCollectWithLogs(bool dumpAllTraces,
                                FileDescriptor gcLog,
                                FileDescriptor ccLog);

    async PTestShell();

    async PScriptCache(FileDescOrError cacheFile, bool wantCacheData);

    async RegisterChrome(ChromePackage[] packages, SubstitutionMapping[] substitutions,
                         OverrideMapping[] overrides, nsCString locale, bool reset);
    async RegisterChromeItem(ChromeRegistryItem item);

    async ClearImageCacheFromPrincipal(nullable nsIPrincipal aPrincipal);

    async ClearImageCacheFromBaseDomain(nsCString aBaseDomain);

    async ClearImageCache(bool privateLoader, bool chrome);

    async ClearStyleSheetCache(nullable nsIPrincipal? aForPrincipal,
                               nsCString? aBaseDomain);

    async SetOffline(bool offline);
    async SetConnectivity(bool connectivity);
    async SetCaptivePortalState(int32_t aState);
    async SetTRRMode(ResolverMode aMode, ResolverMode aModeFromPref);

    async NotifyVisited(VisitedQueryResult[] uri);

    /**
     * Tell the child that the system theme has changed, and that a repaint is
     * necessary.
     */
    async ThemeChanged(FullLookAndFeel lookAndFeelData, ThemeChangeKind aKind);

    async PreferenceUpdate(Pref pref);
    async VarUpdate(GfxVarUpdate var);

    async UpdatePerfStatsCollectionMask(uint64_t aMask);
    async CollectPerfStatsJSON() returns (nsCString aStats);

    async CollectScrollingMetrics() returns (uint32_t pixelsScrolled, uint32_t scrollDurationMS);

    async NotifyAlertsObserver(nsCString topic, nsString data);

    async GeolocationUpdate(nullable nsIDOMGeoPosition aPosition);

    async GeolocationError(uint16_t errorCode);

    async UpdateDictionaryList(nsCString[] dictionaries);

    async UpdateFontList(SystemFontList fontList);

    /**
     * The shared font list has been updated by the parent, so child processes
     * should globally reflow everything to pick up new character coverage etc.
     * If aFullRebuild is true, child processes must discard and recreate
     * their mappings to the shmem blocks, as those are no longer valid.
     * This message has raised priority so that it will take precedence over
     * vsync messages to the child.
     */
    [Priority=mediumhigh] async RebuildFontList(bool aFullRebuild);

    /**
     * The shared font list has been modified, potentially adding matches
     * for src:local() names that were previously not known, so content
     * may need to be reflowed.
     */
    async FontListChanged();

    /**
     * The font list or prefs have been updated in such a way that we might need
     * to do a reflow and maybe reframe.
     */
    async ForceGlobalReflow(bool aNeedsReframe);

    /**
     * A new shmem block has been added to the font list; the child process
     * should map the new block and add to its index.
     */
    async FontListShmBlockAdded(uint32_t aGeneration, uint32_t aIndex,
                                SharedMemoryHandle aHandle);

    async UpdateAppLocales(nsCString[] appLocales);
    async UpdateRequestedLocales(nsCString[] requestedLocales);

    /**
     * The system timezone has changed; the child process should ensure that
     * calls to get the default timezone return the new value.
     */
    async SystemTimezoneChanged();

    async UpdateL10nFileSources(L10nFileSourceDescriptor[] sources);

    async RegisterStringBundles(StringBundleDescriptor[] stringBundles);

    async UpdateSharedData(FileDescriptor mapFile, uint32_t aSize,
                           IPCBlob[] blobs,
                           nsCString[] changedKeys);

    // nsIPermissionManager messages
    async AddPermission(Permission permission);
    async RemoveAllPermissions();

    async FlushMemory(nsString reason);

    async ApplicationBackground();
    async ApplicationForeground();
    async GarbageCollect();
    async CycleCollect();
    async UnlinkGhosts();

    /**
     * Start accessibility engine in content process.
     */
    async ActivateA11y();

    /**
     * Shutdown accessibility engine in content process (if not in use).
     */
    async ShutdownA11y();

    async AppInfo(nsCString version, nsCString buildID, nsCString name, nsCString UAName,
                  nsCString ID, nsCString vendor, nsCString sourceURL, nsCString updateURL);

    /**
     * Send the remote type associated with the content process.
     */
    async RemoteType(nsCString aRemoteType, nsCString aProfile);

    /**
     * Send BlobURLRegistrationData to child process.
     */
    async InitBlobURLs(BlobURLRegistrationData[] registrations);

    /**
     * Send JS{Content, Window}ActorInfos to child process.
     */
    async InitJSActorInfos(JSProcessActorInfo[] aContentInfos, JSWindowActorInfo[] aWindowInfos);

    /**
     * Unregister a previously registered JSWindowActor in the child process.
     */
    async UnregisterJSWindowActor(nsCString name);

    /**
     * Unregister a previously registered JSProcessActor in the child process.
     */
    async UnregisterJSProcessActor(nsCString name);

    async SetXPCOMProcessAttributes(XPCOMInitData xpcomInit,
                                    StructuredCloneData initialData,
                                    FullLookAndFeel lookAndFeeldata,
                                    /* used on MacOSX/Linux/Android only: */
                                    SystemFontList systemFontList,
                                    SharedMemoryHandle? sharedUASheetHandle,
                                    uintptr_t sharedUASheetAddress,
                                    SharedMemoryHandle[] sharedFontListBlocks,
                                    bool aIsStartingUp);

    // Notify child that last-pb-context-exited notification was observed
    async LastPrivateDocShellDestroyed();

    async NotifyProcessPriorityChanged(ProcessPriority priority);
    async MinimizeMemoryUsage();

    /**
     * Used to manage nsIStyleSheetService across processes.
     */
    async LoadAndRegisterSheet(nullable nsIURI uri, uint32_t type);
    async UnregisterSheet(nullable nsIURI uri, uint32_t type);

    /**
     * Notify idle observers in the child
     */
    async NotifyIdleObserver(uint64_t observerId, nsCString topic, nsString str);

    async InvokeDragSession(MaybeDiscardedWindowContext aSourceWindowContext,
                            MaybeDiscardedWindowContext aSourceTopWindowContext,
                            IPCTransferableData[] transfers, uint32_t action);

    async EndDragSession(bool aDoneDrag, bool aUserCancelled,
                         LayoutDeviceIntPoint aDragEndPoint,
                         uint32_t aKeyModifiers,
                         uint32_t aDropEffect);

    async DomainSetChanged(uint32_t aSetType, uint32_t aChangeType, nullable nsIURI aDomain);

    /**
     * Notify the child that it will soon be asked to shutdown.
     * This is sent with high priority right before the normal shutdown.
     */
    [Priority=control] async ShutdownConfirmedHP();

    /**
     * Notify the child to shutdown. The child will in turn call FinishShutdown
     * and let the parent close the channel.
     */
    async Shutdown();

    async LoadProcessScript(nsString url);

    /**
     * Requests a full native update of a native plugin child window. This is
     * a Windows specific call.
     */
    async UpdateWindow(uintptr_t aChildId);

    /**
     * Notify the child that cache is emptied.
     */
    async NotifyEmptyHTTPCache();

    /**
     * Send a `push` event without data to a service worker in the child.
     */
    async Push(nsCString scope, nullable nsIPrincipal principal, nsString messageId);

    /**
     * Send a `push` event with data to a service worker in the child.
     */
    async PushWithData(nsCString scope, nullable nsIPrincipal principal,
                       nsString messageId, uint8_t[] data);

    /**
     * Send a `pushsubscriptionchange` event to a service worker in the child.
     */
    async PushSubscriptionChange(nsCString scope, nullable nsIPrincipal principal);

    async GetFilesResponse(nsID aID, GetFilesResponseResult aResult);

    async BlobURLRegistration(nsCString aURI, IPCBlob aBlob,
                              nullable nsIPrincipal aPrincipal,
                              nsID? aAgentClusterId);

    async BlobURLUnregistration(nsCString aURI);

    async GMPsChanged(GMPCapabilityData[] capabilities);


    async ProvideAnonymousTemporaryFile(uint64_t aID, FileDescOrError aFD);

    async SetPermissionsWithKey(nsCString aPermissionKey, Permission[] aPermissions);

    async RefreshScreens(ScreenDetails[] aScreens);

    async ShareCodeCoverageMutex(CrossProcessMutexHandle handle);
    async FlushCodeCoverageCounters() returns (bool unused);

    /*
     * IPC message to enable the input event queue on the main thread of the
     * content process.
     */
    async SetInputEventQueueEnabled();

    /*
     * IPC message to flush the input event queue on the main thread of the
     * content process.
     *
     * When the ContentParent stops sending the input event with input priority,
     * there may be some pending events in the input event queue and normal
     * event queue. Here is a possible scenario.
     * R: Runnables.
     * D: Enable the input priority event.
     * E: Disable the input priority evnet.
     *
     *                     D       E
     * Normal Queue: R1      R2      R3
     * Input Queue:     II      I2      I3
     *
     * To avoid the newly added normal events (e.g. R2, which may be an input
     * event) preempt the pending input events (e.g. I1), or the newly added
     * input events (e.g. I3) preempt the pending normal events (e.g. R2), we
     * have to flush all pending events before enabling and disabling the input
     * priority event.
     *
     * To flush the normal event queue and the input event queue, we use three
     * IPC messages as the followings.
     * FI: Flush the input queue.
     * SI: Suspend the input queue.
     * RI: Resume the input queue.
     *
     * Normal Queue: R1    FI    RI R2   FI    RI R3
     * Input Queue:     II    SI      I2    SI       I3
     *
     * When the flush input request is processed before the other two requests,
     * we consume all input events until the suspend request. After handling the
     * suspend request, we stop consuming the input events until the resume
     * request to make sure we consume all pending normal events.
     *
     * If we process the suspend request before the other two requests, we
     * ignore the flush request and consume all pending normal events until the
     * resume request.
     */
    async FlushInputEventQueue();

    /*
     * IPC message to resume consuming the pending events in the input event
     * queue.
     */
    async ResumeInputEventQueue();

    /*
     * IPC message to suspend consuming the pending events in the input event
     * queue.
     */
    [Priority=input] async SuspendInputEventQueue();

    /*
     * IPC message to propagate dynamic scalar definitions, added after the
     * content process is spawned, from the parent to the child.
     * Dynamic scalar definitions added at the process startup are handled
     * using the |TelemetryIPC::AddDynamicScalarDefinitions| functions.
     */
    async AddDynamicScalars(DynamicScalarDefinition[] definitions);

    // This message is sent to content processes, and triggers the creation of a
    // new HttpChannelChild that will be connected to the parent channel
    // represented by registrarId.
    // This is on PContent not PNecko, as PNecko may not be initialized yet.
    // The returned loadInfo needs to be set on the channel - since the channel
    // moved to a new process it now has different properties.

    async CrossProcessRedirect(RedirectToRealChannelArgs args,
                               Endpoint<PStreamFilterParent>[] aEndpoint)
        returns (nsresult rv);

    /**
    * This method is used to notifty content process to start delayed autoplay
    * media via browsing context.
    */
    async StartDelayedAutoplayMediaComponents(MaybeDiscardedBrowsingContext aContext);

    /**
     * This method is used to dispatch MediaControlAction to content process in
     * order to control media within a specific browsing context tree.
     */
    async UpdateMediaControlAction(MaybeDiscardedBrowsingContext aContext,
                                   MediaControlAction aAction);

    // Begin subscribing to a new BrowsingContextGroup, sending down the current
    // value for every individual BrowsingContext.
    async RegisterBrowsingContextGroup(uint64_t aGroupId, SyncedContextInitializer[] aInits);

    // The BrowsingContextGroup has been destroyed in the parent process. The
    // content process won't destroy the group until it receives this message or
    // during shutdown.
    //
    // When the content process receives this message, all contexts in the group
    // should have already been destroyed.
    async DestroyBrowsingContextGroup(uint64_t aGroupId);

#if defined(MOZ_SANDBOX) && defined(MOZ_DEBUG) && defined(ENABLE_TESTS)
    // Initialize top-level actor for testing content process sandbox.
    async InitSandboxTesting(Endpoint<PSandboxTestingChild> aEndpoint);
#endif

    async LoadURI(MaybeDiscardedBrowsingContext aContext, nsDocShellLoadState aLoadState, bool aSetNavigating)
        returns (bool aSuccess);

    async InternalLoad(nsDocShellLoadState aLoadState);

    async DisplayLoadError(MaybeDiscardedBrowsingContext aContext, nsString aURI);

    async GoBack(MaybeDiscardedBrowsingContext aContext, int32_t? aCancelContentJSEpoch, bool aRequireUserInteraction, bool aUserActivation);
    async GoForward(MaybeDiscardedBrowsingContext aContext, int32_t? aCancelContentJSEpoch, bool aRequireUserInteraction, bool aUserActivation);
    async GoToIndex(MaybeDiscardedBrowsingContext aContext, int32_t aIndex, int32_t? aCancelContentJSEpoch, bool aUserActivation);
    async Reload(MaybeDiscardedBrowsingContext aContext, uint32_t aReloadFlags);
    async StopLoad(MaybeDiscardedBrowsingContext aContext, uint32_t aStopFlags);

    async OnAllowAccessFor(MaybeDiscardedBrowsingContext aParentContext,
                           nsCString aTrackingOrigin,
                           uint32_t aCookieBehavior,
                           StorageAccessPermissionGrantedReason aReason);

    async OnContentBlockingDecision(MaybeDiscardedBrowsingContext aContext,
                                    BlockingDecision aReason,
                                    uint32_t aRejectedReason);

    /**
     * Abort orientationPendingPromises for documents in the child which
     * are part of a BrowsingContextGroup.
     */
    async AbortOrientationPendingPromises(MaybeDiscardedBrowsingContext aContext);

    async HistoryCommitIndexAndLength(MaybeDiscardedBrowsingContext aContext,
                                      uint32_t aIndex, uint32_t aLength,
                                      nsID aChangeID);

    async GetLayoutHistoryState(MaybeDiscardedBrowsingContext aContext)
        returns (nullable nsILayoutHistoryState aState, Wireframe? aWireframe);

    async DispatchLocationChangeEvent(MaybeDiscardedBrowsingContext aContext);

    // Dispatches a "beforeunload" event to each in-process content window in the
    // subtree beginning at `aStartingAt`, and returns the result as documented in
    // the `PermitUnloadResult` enum.
    async DispatchBeforeUnloadToSubtree(MaybeDiscardedBrowsingContext aStartingAt)
        returns (PermitUnloadResult result);

    // Update the cached list of codec supported in the given process.
    async UpdateMediaCodecsSupported(RemoteDecodeIn aLocation, MediaCodecsSupported aSupported);

    // Send the list of the supported mimetypes in the given process. GeckoView-specific
    async DecoderSupportedMimeTypes(nsCString[] supportedTypes);

    // Used to initialize the global variable in content processes with the
    // latched value in the parent process. See dom/LocalStorageCommon.h for more
    // details.
    async InitNextGenLocalStorageEnabled(bool enabled);

  async PRemotePrintJob();

parent:

    async SynchronizeLayoutHistoryState(MaybeDiscardedBrowsingContext aContext,
                                        nullable nsILayoutHistoryState aState);

    async SessionHistoryEntryTitle(MaybeDiscardedBrowsingContext aContext,
                                   nsString aTitle);

    async SessionHistoryEntryScrollRestorationIsManual(MaybeDiscardedBrowsingContext aContext,
                                                       bool aIsManual);
    async SessionHistoryEntryScrollPosition(MaybeDiscardedBrowsingContext aContext,
                                            int32_t aX, int32_t aY);

    async SessionHistoryEntryCacheKey(MaybeDiscardedBrowsingContext aContext,
                                      uint32_t aCacheKey);

    async SessionHistoryEntryStoreWindowNameInContiguousEntries(MaybeDiscardedBrowsingContext aContext,
                                                                nsString aName);

    async SessionHistoryEntryWireframe(MaybeDiscardedBrowsingContext aContext,
                                       Wireframe aWireframe);

    async GetLoadingSessionHistoryInfoFromParent(MaybeDiscardedBrowsingContext aContext)
        returns (LoadingSessionHistoryInfo? aLoadingInfo);

    async RemoveFromBFCache(MaybeDiscardedBrowsingContext aContext);

    async InitBackground(Endpoint<PBackgroundStarterParent> aEndpoint);

    async CreateGMPService();

    async InitStreamFilter(uint64_t channelId, nsString addonId)
        returns (Endpoint<PStreamFilterChild> aEndpoint);

    async PRemoteSpellcheckEngine();

    async InitCrashReporter(NativeThreadId tid);

    sync IsSecureURI(nullable nsIURI aURI, OriginAttributes aOriginAttributes)
        returns (bool isSecureURI);

    async AccumulateMixedContentHSTS(nullable nsIURI aURI, bool aActive,
                                     OriginAttributes aOriginAttributes);

    [Nested=inside_cpow] async PHal();

    async PHeapSnapshotTempFileHelper();

    async PNecko();

#ifdef MOZ_WEBSPEECH
    async PSpeechSynthesis();
#endif

    async PMedia();

#ifdef MOZ_WEBRTC
    async PWebrtcGlobal();
#endif

    async CreateAudioIPCConnection() returns (FileDescOrError fd);

    sync PURLClassifier(nullable nsIPrincipal principal)
        returns (bool success);

    async PURLClassifierLocal(nullable nsIURI uri, IPCURLClassifierFeature[] features);

    async PLoginReputation(nullable nsIURI formURI);

    async PSessionStorageObserver();

    async PBenchmarkStorage();

    // Services remoting

    async StartVisitedQueries(nullable nsIURI[] uri);
    async SetURITitle(nullable nsIURI uri, nsString title);

    async LoadURIExternal(nullable nsIURI uri,
                          nullable nsIPrincipal triggeringPrincipal,
                          nullable nsIPrincipal redirectPrincipal,
                          MaybeDiscardedBrowsingContext browsingContext,
                          bool wasExternallyTriggered,
                          bool hasValidUserGestureActivation);
    async ExtProtocolChannelConnectParent(uint64_t registrarId);

    // PrefService message
    sync GetGfxVars() returns (GfxVarUpdate[] vars);

    sync SyncMessage(nsString aMessage, ClonedMessageData aData)
      returns (StructuredCloneData[] retval);

    async ShowAlert(nullable nsIAlertNotification alert);

    async CloseAlert(nsString name, bool contextClosed);

    async DisableNotifications(nullable nsIPrincipal principal);

    async OpenNotificationSettings(nullable nsIPrincipal principal);

    async AddSecurityState(MaybeDiscardedWindowContext aContext, uint32_t aStateFlags);

    // Request that the ServiceWorkerManager in the parent process create a
    // notification "click" or "close" event and dispatch it on the relevant
    // ServiceWorker. This needs to happen because when a notification is
    // created it is tied to a specific content process and when the user clicks
    // on the notification, it will be that content process that is notified.
    // However, even if the ServiceWorker lives in that process (it may no
    // longer be in that process, or may have never lived there), the right/only
    // way to talk through the ServiceWorker is through the parent.
    //
    // This happens on PContent because the ServiceWorkerManager lives on the
    // main thread and bouncing this off of PBackground would be silly and
    // complex. In the long run, the notification implementation will be
    // overhauled to directly process the notification click/close and directly
    // translate that to a ServiceWorker event.
    async NotificationEvent(nsString type, NotificationEventData data);

    // Creates a helper for forwarding data from an nsExternalAppHandler
    // running in the content process, to one running in the parent
    // process.
    // Bug 1574372 aims to run nsExternalAppHandler entirely in the
    // parent so that we can remove this.
    //
    // Serializes the uri, loadInfo, contentType, referrer, contentDisposition
    // headers and contentLength of the channel so that we can make them
    // available to the parent instance via a nsIChannel helper. Also
    // passes whether the original channel was an instance of nsIFileChannel.
    //
    // aContext is the BrowsingContext that initiated the load, and created the
    // channel.
    //
    // Pass true for aForceSave to always save this content to disk, regardless of
    // nsIMIMEInfo and other such influences.
    // Pass true for aShouldCloseWindow to specify that aContext was opened specifically
    // for this load, and should be closed once we've handled it.
    async PExternalHelperApp(nullable nsIURI uri,
                             LoadInfoArgs? loadInfoArgs,
                             nsCString aMimeContentType,
                             nsCString aContentDisposition,
                             uint32_t aContentDispositionHint,
                             nsString aContentDispositionFilename,
                             bool aForceSave,
                             int64_t aContentLength,
                             bool aWasFileChannel,
                             nullable nsIURI aReferrer,
                             MaybeDiscardedBrowsingContext aContext,
                             bool aShouldCloseWindow);

    async PHandlerService();

    async AddGeolocationListener(bool highAccuracy);
    async RemoveGeolocationListener();
    async SetGeolocationHigherAccuracy(bool enable);

    async ConsoleMessage(nsString message);
    async ScriptErrorWithStack(nsString message, nsString sourceName, nsString sourceLine,
                               uint32_t lineNumber, uint32_t colNumber, uint32_t flags,
                               nsCString category, bool privateWindow,
                               bool fromChromeContext, ClonedMessageData stack);

    // Places the items within dataTransfer on the clipboard.
    async SetClipboard(IPCTransferable aTransferable,
                       int32_t aWhichClipboard);

    // Given a list of supported types, returns the clipboard data for the
    // first type that matches.
    sync GetClipboard(nsCString[] aTypes, int32_t aWhichClipboard)
        returns (IPCTransferableData transferableData);

    // Returns a list of formats supported by the clipboard
    sync GetExternalClipboardFormats(int32_t aWhichClipboard, bool aPlainTextOnly) returns (nsCString[] aTypes);

    // Given a list of supported types, returns the clipboard data for the
    // first type that matches.
    async GetClipboardAsync(nsCString[] aTypes, int32_t aWhichClipboard) returns (IPCTransferableDataOrError transferableData);

    // Clears the clipboard.
    async EmptyClipboard(int32_t aWhichClipboard);

    // Returns true if data of one of the specified types is on the clipboard.
    sync ClipboardHasType(nsCString[] aTypes, int32_t aWhichClipboard)
        returns (bool hasType);

    // Given a list of supported types, returns a list of types that clipboard
    // constains the data for the specified type.
    async ClipboardHasTypesAsync(nsCString [] aTypes, int32_t aWhichClipboard)
        returns (nsCString [] types);

    /**
     * Notify the parent that the child has started a clipboard write request,
     * and that the data will be sent over another IPC message once it is ready.
     * @param  aClipboardType
     *         The clipboard type defined in nsIClipboard.
     */
    async PClipboardWriteRequest(int32_t aClipboardType);

    // 'Play', 'Beep' and 'PlayEventSound' are the only nsISound methods used in
    // the content process.
    [Compress] async PlaySound(nullable nsIURI aURL);
    [Compress] async Beep();
    [Compress] async PlayEventSound(uint32_t aEventId);

    sync GetIconForExtension(nsCString aFileExt, uint32_t aIconSize)
        returns (uint8_t[] bits);

    // Tell the parent that the child has gone idle for the first time.
    async FirstIdle();

    async CopyFavicon(nullable nsIURI oldURI, nullable nsIURI newURI, bool isPrivate);

    async FindImageText(IPCImage image, nsCString[] languages)
        returns (TextRecognitionResultOrError result);

    /**
     * Notifies the parent about a recording device is starting or shutdown.
     * @param recordingStatus starting or shutdown
     * @param pageURL URL that request that changing the recording status
     * @param isAudio recording start with microphone
     * @param isVideo recording start with camera
     */
    async RecordingDeviceEvents(nsString recordingStatus,
                                nsString pageURL,
                                bool isAudio,
                                bool isVideo);

    // Graphics errors
    async GraphicsError(nsCString aError);

    // Driver crash guards. aGuardType must be a member of CrashGuardType.
    sync BeginDriverCrashGuard(uint32_t aGuardType) returns (bool crashDetected);
    sync EndDriverCrashGuard(uint32_t aGuardType);

    async AddIdleObserver(uint64_t observerId, uint32_t idleTimeInS);
    async RemoveIdleObserver(uint64_t observerId, uint32_t idleTimeInS);

    /**
     * This message is only used on X11 platforms.
     *
     * Send a dup of the plugin process's X socket to the parent
     * process.  In theory, this scheme keeps the plugin's X resources
     * around until after both the plugin process shuts down *and* the
     * parent process closes the dup fd.  This is used to prevent the
     * parent process from crashing on X errors if, e.g., the plugin
     * crashes *just before* a repaint and the parent process tries to
     * use the newly-invalid surface.
     */
    async BackUpXResources(FileDescriptor aXSocketFd);

    async RequestAnonymousTemporaryFile(uint64_t aID);

    /**
     * Notifies the parent that the child needs no more ForceKill dump.
     */
    [Priority=control] async NotifyShutdownSuccess();

    /**
     * Notifies the parent to continue shutting down after the child performs
     * its shutdown tasks.
     */
    async FinishShutdown();

    async UpdateDropEffect(uint32_t aDragAction, uint32_t aDropEffect);

    /**
     * Initiates an asynchronous request for permission for the
     * provided principal.
     *
     * @param aRequests
     *   The array of permissions to request.
     * @param aPrincipal
     *   The principal of the request.
     * @param aTopLevelPrincipal
     *   The principal of the top level page the request comes from.
     * @param tabId
     *   To identify which tab issues this request.
     *
     * NOTE: The principal is untrusted in the parent process. Only
     *       principals that can live in the content process should
     *       provided.
     */
    async PContentPermissionRequest(PermissionRequest[] aRequests,
                                    nullable nsIPrincipal aPrincipal,
                                    nullable nsIPrincipal aTopLevelPrincipal,
                                    bool aIsHandlingUserInput,
                                    bool aMaybeUnsafePermissionDelegate,
                                    TabId tabId);

    /**
     * If the profiler is running when the process shuts down, this sends the
     * profile data collected so far.
     *
     * @param aProfile
     *   This may contain an empty string (unknown issue), an error message
     *   starting with '*', or a profile as a stringified JSON object.
     */
    async ShutdownProfile(nsCString aProfile);

    /**
     * This sends any collected perf stats data on shutdown.
     */
    async ShutdownPerfStats(nsCString aPerfStats);

    /**
     * Request graphics initialization information from the parent.
     */
    sync GetGraphicsDeviceInitData()
        returns (ContentDeviceData aData);

    /**
     * Request a buffer containing the contents of the output color profile.
     * If set, this is the file pointed to by
     * gfx.color_management.display_profile, otherwise it contains a
     * platform-specific default
     */
    sync GetOutputColorProfileData()
        returns (uint8_t[] aOutputColorProfileData);

    /**
     * A shared font list (see gfx/thebes/SharedFontList.*) contains a list
     * of shared-memory blocks that are used to store all the font list data.
     * The font list created in the parent process is the only one that can
     * create or store objects into the shared memory; content processes font
     * lists have read-only access to it.
     *
     * To minimize the cost of record allocations, the shared font list
     * bump-allocates new objects that it adds to the shared memory blocks
     * (i.e. the records stored in the shared memory blocks are only ever
     * appended, and never freed except when the entire font list is
     * reconstructed).
     *
     * When initially created by the parent process, the font list may contain
     * nothing except a header, and the list of the system's installed font
     * family names. Additional data about the families (styled faces available
     * and character coverage) is appended to the font list during the session
     * as a given font is considered for use, because loading all data for all
     * installed fonts during startup is too expensive/slow.
     *
     * During content process launch, a content process's first step in
     * gaining access to the font list is to call GetFontListShmBlock,
     * passing index zero in order to get access to the first block, which
     * contains the font list header and the list of font-family records
     * (which may be virtually all uninitialized at this time, containing
     * nothing but the family names). Once a content process determines a
     * font-family name it wants to use (e.g. from a CSS font-family list, or
     * from preferences), if that Family record has not yet been initialized,
     * it will call InitializeFamily (below) to have the parent process
     * populate Face records in the shared memory with the family's styles.
     * The content process can then pick the face with best style match from
     * the available faces according to the CSS font matching algorithm, load
     * its character map, then send the map to the parent process using
     * SetCharacterMap (so that the parent process can share the map with all
     * processes to avoid duplication of work).
     *
     * At some point, as the parent process adds data to the font list, a new
     * shared-memory block will probably be needed. At that point the parent
     * will create a new block and append it to its share memory block list.
     * The new Block index will start to appear in Pointer records in the
     * shared memory, and the content process's can then fetch those other
     * blocks using this function as needed.
     *
     * @param aGeneration
     *   The font list has a Generation ID stored in its Header, and any time
     *   the parent process needs to reinitialize the list (because of a change
     *   in the available font repertoire) a new Generation ID is assigned.
     *   Content processes pass the Generation of the list they're using in
     *   all messages, so that the parent can recognize if they're out of date
     *   and safely ignore such messages. (When the parent rebuilds the list,
     *   it will notify all content processes, but they may still send a few
     *   messages that relate to the obsolete list before they have processed
     *   this notification.)
     * @param aIndex
     *   (Zero-based) index of the shared-memory block to be mapped.
     *   In a typical case, there will be a handful of blocks altogether, so
     *   each content process only needs to make this request a few times.
     * @returns aHandle
     *   Handle that can be used to construct a SharedMemory that maps the
     *   requested block of memory.
     *   If aGeneration does not match the parent's font list generation ID, or
     *   if requesting a block that does not exist (i.e. with aIndex greater
     *   than or equal to the number of blocks actually in existence), returns
     *   a null handle.
     *
     * This is a sync message because the content process needs font data in
     * order to perform font-matching (e.g. during reflow), and cannot continue
     * until it has mapped the font-list memory.
     */
    sync GetFontListShmBlock(uint32_t aGeneration, uint32_t aIndex)
        returns (SharedMemoryHandle aHandle);

    /**
     * Ask the parent to initialize a given font family, so that face metadata
     * will be available. Content processes will only call this for families
     * where the Face data has not yet been populated, so it will generally be
     * called no more than once per family. (It may not be needed at all, if
     * the parent process has already initialized the families that content
     * wants to use.)
     *
     * @param aGeneration
     *   Font-list generation, so requests relating to an obsolete list can be
     *   ignored (see comments for GetFontListShmBlock).
     * @param aFamilyIndex
     *   The 0-based index of the Family within the font-list that a content
     *   process needs to use.
     * @param aLoadCmaps
     *   If true, the parent should eagerly load character maps for the faces
     *   in the family.
     *
     * This is a sync message because the content process cannot complete its
     * font-matching until the family is fully populated with Face records.
     * If we make it async, content processes will reflow using fallbacks,
     * and then have to reflow again once all the font information needed
     * becomes available.
     */
    sync InitializeFamily(uint32_t aGeneration, uint32_t aFamilyIndex,
                          bool aLoadCmaps);

    /**
     * Record the character map of a given Face in the font list.
     *
     * @param aGeneration
     *   Font-list generation, so requests relating to an obsolete list can be
     *   ignored (see comments for GetFontListShmBlock).
     * @param aFacePtr
     *   Font-list shared-memory "pointer" to the Face record to be updated.
     *   A Pointer is a record of a shared-memory block index and an offset
     *   within that block, which each process that maps the block can convert
     *   into a real pointer in its address space.
     * @param aMap
     *   The character coverage map of the face. (This will be stored as a
     *   SharedBitSet record within the shared font list, and the Face record
     *   will be updated to reference it.)
     */
    async SetCharacterMap(uint32_t aGeneration, Pointer aFacePtr, gfxSparseBitSet aMap);

    /**
     * Ask the parent to set up the merged charmap for a family, to accelerate
     * future fallback searches.
     * aFamilyPtr may refer to an element of either the Families() or AliasFamilies().
     */
    async SetupFamilyCharMap(uint32_t aGeneration, Pointer aFamilyPtr);

    /**
     * Ask the parent to try and complete the InitOtherFamilyNames task, because
     * we're trying to look up a localized font name. This is a sync method so that
     * the update will be available before the child continues reflow; however, it
     * is possible the task will have timed-out in the parent and not actually
     * completed during this call.
     *
     * @param aGeneration
     *   Font-list generation, so requests relating to an obsolete list can be
     *   ignored (see comments for GetFontListShmBlock).
     * @param aDefer
     *   Parameter aDeferOtherFamilyNamesLoading to be passed to
     *   gfxPlatformFontList::InitOtherFamilyNames, to determine whether name
     *   loading should be deferred to a background task or run immediately.
     * @param aLoaded
     *   Returns whether the font name loading process has completed.
     *
     * TODO: This is currently a sync message but can probably be made async,
     * at the cost of an increased chance of some testcases failing because
     * they depend on lazily-loaded font names.
     */
    sync InitOtherFamilyNames(uint32_t aGeneration, bool aDefer) returns (bool aLoaded);

    /**
     * Ask the parent to load all font character maps, as we need to do an
     * exhaustive font-fallback search. This is done asynchronously; when it
     * finishes, the parent will trigger global reflow so that font selection
     * is re-done in all content, making use of the newly-loaded cmaps.
     * Normally this will only happen once per browser session (unless the
     * font list is rebuilt due to installation/removal of system fonts).
     *
     * @param aGeneration
     *   Font-list generation, so requests relating to an obsolete list can be
     *   ignored (see comments for GetFontListShmBlock).
     * @param aStartIndex
     *   The family index to start from; the sender has determined that cmaps
     *   up to this point are already loaded.
     */
    async StartCmapLoading(uint32_t aGeneration, uint32_t aStartIndex);

    /**
     * Ask the parent for a specific hyphenation resource (identified by URI)
     * as a shared memory block.
     *
     * This is a sync method because at the point where a content process finds
     * that it requires a particular hyphenation dictionary, this is blocking
     * reflow; making it async would require scheduling another reflow after
     * the resource is available, and a possible layout "jump" as line-breaks
     * change. Note that the content process retains a reference to each such
     * resource it requests, so it will only make this call once per locale for
     * which hyphenation data exists.
     *
     * @param aURI
     *   The URI (which currently must always point to an omnijar resource)
     *   for the required hyphenation dictionary.
     * @param aHandle
     *   Returns the shmem handle to the resource (or an invalid shmem handle
     *   in case of failure).
     * @param aLoaded
     *   Returns the size in bytes of the resource.
     */
    sync GetHyphDict(nullable nsIURI aURI) returns (SharedMemoryHandle aHandle, uint32_t aSize);

    async CreateWindow(PBrowser aThisTab,
                       MaybeDiscardedBrowsingContext aParent,
                       PBrowser aNewTab,
                       uint32_t aChromeFlags,
                       bool aCalledFromJS,
                       bool aForPrinting,
                       bool aForWindowDotPrint,
                       nullable nsIURI aURIToLoad,
                       nsCString aFeatures,
                       nullable nsIPrincipal aTriggeringPrincipal,
                       nullable nsIContentSecurityPolicy aCsp,
                       nullable nsIReferrerInfo aReferrerInfo,
                       OriginAttributes aOriginAttributes)
        returns (CreatedWindowInfo window);

    async CreateWindowInDifferentProcess(
      PBrowser aThisTab,
      MaybeDiscardedBrowsingContext aParent,
      uint32_t aChromeFlags,
      bool aCalledFromJS,
      nullable nsIURI aURIToLoad,
      nsCString aFeatures,
      nsString aName,
      nullable nsIPrincipal aTriggeringPrincipal,
      nullable nsIContentSecurityPolicy aCsp,
      nullable nsIReferrerInfo aReferrerInfo,
      OriginAttributes aOriginAttributes);

    sync RemovePermission(nullable nsIPrincipal principal, nsCString permissionType) returns (nsresult rv);

    /**
     * Tell the parent that a decoder's' benchmark has been completed.
     * The result can then be stored in permanent storage.
     */
    async NotifyBenchmarkResult(nsString aCodecName, uint32_t aDecodeFPS);

    /**
     * Notify `push-message` observers without data in the parent.
     */
    async NotifyPushObservers(nsCString scope, nullable nsIPrincipal principal,
                              nsString messageId);

    /**
     * Notify `push-message` observers with data in the parent.
     */
    async NotifyPushObserversWithData(nsCString scope, nullable nsIPrincipal principal,
                                      nsString messageId, uint8_t[] data);

    /**
     * Notify `push-subscription-change` observers in the parent.
     */
    async NotifyPushSubscriptionChangeObservers(nsCString scope,
                                                nullable nsIPrincipal principal);

     async GetFilesRequest(nsID aID, nsString aDirectory, bool aRecursiveFlag);
     async DeleteGetFilesRequest(nsID aID);

     async StoreAndBroadcastBlobURLRegistration(nsCString url, IPCBlob blob,
                                                nullable nsIPrincipal principal,
                                                nsID? aAgentClusterId);

     async UnstoreAndBroadcastBlobURLUnregistration(nsCString url, nullable nsIPrincipal principal);

    /**
     * Messages for communicating child Glean data to the parent process
     */
    async RecordPageLoadEvent(PageLoadExtra event);

    /**
     * Messages for communicating child Telemetry to the parent process
     */
    async AccumulateChildHistograms(HistogramAccumulation[] accumulations);
    async AccumulateChildKeyedHistograms(KeyedHistogramAccumulation[] accumulations);
    async UpdateChildScalars(ScalarAction[] updates);
    async UpdateChildKeyedScalars(KeyedScalarAction[] updates);
    async RecordChildEvents(ChildEventData[] events);
    async RecordDiscardedData(DiscardedData data);

    async AddMemoryReport(MemoryReport aReport);

    async BHRThreadHang(HangDetails aHangDetails);

    async AddPerformanceMetrics(nsID aID, PerformanceInfo[] aMetrics);

    /*
     * Adds a certificate exception for the given hostname and port.
     */
    async AddCertException(nullable nsIX509Cert aCert, nsCString aHostName,
                           int32_t aPort, OriginAttributes aOriginAttributes,
                           bool aIsTemporary)
          returns (nsresult success);

    /*
     * Determines whether storage access can be granted automatically by the
     * storage access API without showing a user prompt.
     */
    async AutomaticStorageAccessPermissionCanBeGranted(nullable nsIPrincipal aPrincipal)
          returns (bool success);

    /*
     * A 3rd party tracking origin (aTrackingOrigin) has received the permission
     * granted to have access to aGrantedOrigin when loaded by aParentWindowId.
     */
    async StorageAccessPermissionGrantedForOrigin(uint64_t aTopLevelWindowId,
                                                  MaybeDiscardedBrowsingContext aParentContext,
                                                  nullable nsIPrincipal aTrackingPrincipal,
                                                  nsCString aTrackingOrigin,
                                                  int aAllowMode,
                                                  StorageAccessPermissionGrantedReason? aReason)
          returns (bool unused);

    async CompleteAllowAccessFor(MaybeDiscardedBrowsingContext aParentContext,
                                 uint64_t aTopLevelWindowId,
                                 nullable nsIPrincipal aTrackingPrincipal,
                                 nsCString aTrackingOrigin,
                                 uint32_t aCookieBehavior,
                                 StorageAccessPermissionGrantedReason aReason)
          returns (StorageAccessPromptChoices? choice);

    async SetAllowStorageAccessRequestFlag(
                                 nullable nsIPrincipal aEmbeddingPrincipal,
                                 nullable nsIURI aEmbeddedOrigin)
          returns (bool success);

    async TestAllowStorageAccessRequestFlag(
                                 nullable nsIPrincipal aEmbeddedPrincipal,
                                 nullable nsIURI aEmbeddingOrigin)
          returns (bool success);

    async StoreUserInteractionAsPermission(nullable nsIPrincipal aPrincipal);

    async TestCookiePermissionDecided(MaybeDiscardedBrowsingContext aContext,
                         nullable nsIPrincipal aPrincipal)
          returns (bool? allowed);

    async TestStorageAccessPermission(nullable nsIPrincipal aEmbeddingPrincipal,
                         nsCString aEmbeddedOrigin)
          returns (bool? allowed);

   /**
    * When media element's controlled state changed in the content process, we
    * have to notify the chrome process in order to update the status of the
    * corresponding media controller, which is used to control all media in the
    * certain tab. We would use the browsing context to find the corresponding
    * controller.
    */
    async NotifyMediaPlaybackChanged(MaybeDiscardedBrowsingContext aContext,
                                     MediaPlaybackState aState);

   /**
    * When media became audible or inaudible in content process, we have to
    * notify chrome process in order to which tab is audible.
    */
    async NotifyMediaAudibleChanged(MaybeDiscardedBrowsingContext aContext,
                                    MediaAudibleState aState);

   /**
    * When media enabled or disabled the Picture-in-Picture mode, we have to
    * update that to the media controller in the chrome process.
    */
    async NotifyPictureInPictureModeChanged(
        MaybeDiscardedBrowsingContext aContext, bool aEnabled);

   /**
    * This method is used to update media session's status when it's being
    * created or destroyed.
    */
    async NotifyMediaSessionUpdated(MaybeDiscardedBrowsingContext aContext, bool aIsCreated);

    /**
     * This method is used to update media session's media metadata whenever its
     * metadata is being updated.
     */
    async NotifyUpdateMediaMetadata(MaybeDiscardedBrowsingContext aContext,
                                    MediaMetadataBase? aMetadata);

    /**
     * This method is used to update media session's playback state whenever its
     * playback state is changed.
     */
    async NotifyMediaSessionPlaybackStateChanged(
        MaybeDiscardedBrowsingContext aContext,
        MediaSessionPlaybackState aMetadata);

    /**
     * This method is used to update media session's supported media session
     * action when the action becomes supported or unsupported.
     */
    async NotifyMediaSessionSupportedActionChanged(
        MaybeDiscardedBrowsingContext aContext,
        MediaSessionAction aAction,
        bool aEnabled);

    /**
     * This method is used to notify the media controller in chrome process that
     * the media element in the browsing context entered fullscreen.
     */
    async NotifyMediaFullScreenState(
        MaybeDiscardedBrowsingContext aContext,
        bool aIsInFullScreen);

    /**
     * This method is used to update media session's position state whenever its
     * position state is being updated.
     */
    async NotifyPositionStateChanged(
        MaybeDiscardedBrowsingContext aContext,
        PositionState aState);

    /**
     * This method will make canonical browsing context to update the count of
     * callers which want to keep the page from being suspended even if the page
     * is inactive.
     */
    async AddOrRemovePageAwakeRequest(MaybeDiscardedBrowsingContext aContext,
                                      bool aShouldAddCount);

#if defined(XP_WIN)
    /**
     * Due to sandboxing, a child process's UntrustedModulesProcessor cannot
     * obtain enough information about a DLL file to determine its
     * trustworthiness. This API asks the chrome process to perform that
     * evaluation.
     */
    async GetModulesTrust(ModulePaths aModPaths, bool aRunAtNormalPriority)
        returns (ModulesMapResult? modMapResult);
#endif  // defined(XP_WIN)

    /**
     * Used to route shutdown diagnostic info from the content process
     * ServiceWorkers to the parent process' ServiceWorkerManager's
     * ServiceWorkerShutdownBlocker. (The only other actor chain available
     * for this would be very convoluted and create ordering problems).
     */
    async ReportServiceWorkerShutdownProgress(uint32_t aShutdownStateId,
                                              Progress aProgress);

    /**
     * Whenever a document is updating the OrientationLock, we need to
     * reject the orientationPendingPromises in other processes.
     */
    async AbortOtherOrientationPendingPromises(MaybeDiscardedBrowsingContext aContext);

    async HistoryReload(MaybeDiscardedBrowsingContext aContext, uint32_t aReloadFlags);

    async NotifyOnHistoryReload(MaybeDiscardedBrowsingContext aContext,
                                bool aForceReload)
            returns (bool canReload, nsDocShellLoadState? loadState,
                     bool? reloadActiveEntry);

    async HistoryCommit(MaybeDiscardedBrowsingContext aContext,
                        uint64_t aLoadID, nsID aChangeID, uint32_t aLoadType,
                        bool aPersist, bool aCloneEntryChildren,
                        bool aChannelExpired, uint32_t aCacheKey);

    async HistoryGo(MaybeDiscardedBrowsingContext aContext, int32_t aOffset,
                    uint64_t aHistoryEpoch, bool aRequireUserInteraction,
                    bool aUserActivation) returns(int32_t? requestedIndex);

    async BlobURLDataRequest(nsCString aBlobURL,
                             nullable nsIPrincipal aTriggeringPrincipal,
                             nullable nsIPrincipal aLoadingPrincipal,
                             OriginAttributes aOriginAttributes,
                             uint64_t aInnerWindowId,
                             nsID? aAgentClusterId)
      returns (BlobURLDataRequestResult aResult);

    async SetActiveSessionHistoryEntry(MaybeDiscardedBrowsingContext context,
                                       nsPoint? previousScrollPosition,
                                       SessionHistoryInfo info, uint32_t loadType,
                                       uint32_t updatedCacheKey, nsID changeID);
    async ReplaceActiveSessionHistoryEntry(
        MaybeDiscardedBrowsingContext context, SessionHistoryInfo info);

    async RemoveDynEntriesFromActiveSessionHistoryEntry(
        MaybeDiscardedBrowsingContext aContext);

    async RemoveFromSessionHistory(
        MaybeDiscardedBrowsingContext aContext, nsID changeID);

    // Called when a nsDocShellLoadState which was received over IPC is
    // destroyed in the content process to clean up pending state left behind
    // tracking the load state in the parent process.
    [LazySend] async CleanupPendingLoadState(uint64_t aLoadIdentifier);

both:
    async ScriptError(nsString message, nsString sourceName, nsString sourceLine,
                      uint32_t lineNumber, uint32_t colNumber, uint32_t flags,
                      nsCString category, bool privateWindow, uint64_t innerWindowId,
                      bool fromChromeContext);

    /**
     * Used in fission to report timing data when the parent window is in
     * another process. Child frame will send data to its ContentParent which
     * will then identify the ContentParent for the innerWindowId and pass
     * the data to the correct process.
     * loadInfo is passed in order to enforce same-origin security checks
     * aData must be non-null.
     */
    async ReportFrameTimingData(LoadInfoArgs? loadInfo, nsString entryName,
                                nsString initiatorType,
                                UniquePtr<PerformanceTimingData> aData);

    async CommitBrowsingContextTransaction(MaybeDiscardedBrowsingContext aContext,
                                           BrowsingContextTransaction aTransaction,
                                           uint64_t aEpoch);

    async AsyncMessage(nsString aMessage, ClonedMessageData aData);

    /**
     * Notify `push-subscription-modified` observers in the parent and child.
     */
    async NotifyPushSubscriptionModifiedObservers(nsCString scope,
                                                  nullable nsIPrincipal principal);

    /**
     * Send a Push error message to all service worker clients in the parent or
     * child.
     */
    async PushError(nsCString scope, nullable nsIPrincipal principal, nsString message,
                    uint32_t flags);

    /**
     * Creates a new BrowsingContext, initialized with the values provided in
     * `BrowsingContextInitializer`.
     *
     * This message may only be sent to the parent in limited situations. If the
     * new BrowsingContext has a parent window, it must be owned by the
     * embedding process, otherwise it must be owned by the opener, if set.
     */
    [LazySend] async CreateBrowsingContext(uint64_t aGroupId, BrowsingContextInitializer aInit);

    /**
     * If aDoDiscard is true, discards the passed-in BrowsingContext. If the
     * BrowsingContext has already been discarded, this message does nothing.
     * If the receiver is the parent process, resolves when all content
     * processes have flagged the BrowsingContext as discarded, and if the
     * receiver is a child process, resolves when that child process has flagged
     * the BrowsingContext as discarded.
     */
    async DiscardBrowsingContext(MaybeDiscardedBrowsingContext aContext, bool aDoDiscard)
            returns (uint64_t unused);

    async AdjustWindowFocus(MaybeDiscardedBrowsingContext aContext,
                            bool aIsVisible, uint64_t aActionId);
    async WindowClose(MaybeDiscardedBrowsingContext aContext,
                      bool aTrustedCaller);
    async WindowFocus(MaybeDiscardedBrowsingContext aContext,
                      CallerType aCallerType, uint64_t aActionId);
    async WindowBlur(MaybeDiscardedBrowsingContext aContext,
                     CallerType aCallerType);
    async RaiseWindow(MaybeDiscardedBrowsingContext aContext, CallerType aCallerType, uint64_t aActionId);
    async ClearFocus(MaybeDiscardedBrowsingContext aContext);
    async SetFocusedBrowsingContext(MaybeDiscardedBrowsingContext aContext, uint64_t aActionId);
    async SetActiveBrowsingContext(MaybeDiscardedBrowsingContext aContext, uint64_t aActionId);
    async UnsetActiveBrowsingContext(MaybeDiscardedBrowsingContext aContext, uint64_t aActionId);
    async SetFocusedElement(MaybeDiscardedBrowsingContext aContext, bool aNeedsFocus);
    async FinalizeFocusOuter(MaybeDiscardedBrowsingContext aContext, bool aCanFocus,
                             CallerType aCallerType);
parent:
    [LazySend] async InsertNewFocusActionId(uint64_t aActionId);
    async BlurToParent(MaybeDiscardedBrowsingContext aFocusedBrowsingContext,
                      MaybeDiscardedBrowsingContext aBrowsingContextToClear,
                      MaybeDiscardedBrowsingContext aAncestorBrowsingContextToFocus,
                      bool aIsLeavingDocument, bool aAdjustWidget,
                      bool aBrowsingContextToClearHandled,
                      bool aAncestorBrowsingContextToFocusHandled, uint64_t aActionId);
child:
    async BlurToChild(MaybeDiscardedBrowsingContext aFocusedBrowsingContext,
                      MaybeDiscardedBrowsingContext aBrowsingContextToClear,
                      MaybeDiscardedBrowsingContext aAncestorBrowsingContextToFocus,
                      bool aIsLeavingDocument, bool aAdjustWidget, uint64_t aActionId);
    async SetupFocusedAndActive(MaybeDiscardedBrowsingContext aFocusedBrowsingContext,
                                uint64_t aActionIdForFocused,
                                MaybeDiscardedBrowsingContext aActiveBrowsingContext,
                                uint64_t aActionId);
    async ReviseActiveBrowsingContext(uint64_t aOldActionId,
                                      MaybeDiscardedBrowsingContext aActiveBrowsingContext,
                                      uint64_t aNewActionId);
    async ReviseFocusedBrowsingContext(uint64_t aOldActionId,
                                       MaybeDiscardedBrowsingContext aFocusedBrowsingContext,
                                       uint64_t aNewActionId);
both:
    async MaybeExitFullscreen(MaybeDiscardedBrowsingContext aContext);
    async WindowPostMessage(MaybeDiscardedBrowsingContext aContext,
                            ClonedOrErrorMessageData aMessage,
                            PostMessageData aData);

    async CommitWindowContextTransaction(MaybeDiscardedWindowContext aContext,
                                         WindowContextTransaction aTransaction,
                                         uint64_t aEpoch);

child:
    // NOTE: These methods are only needed on the child, as the parent
    // WindowContext is managed using the PWindowGlobal actor's lifecycle.
    [LazySend] async CreateWindowContext(WindowContextInitializer aInit);
    async DiscardWindowContext(uint64_t aContextId) returns (bool unused);

parent:
    // Temporary (bug 1641989) conduit for Glean data in content processes.
    // Sent from time-to-time to limit the amount of data vulnerable to loss.
    // Buffer contains bincoded Rust structs.
    async FOGData(ByteBuf buf);

child:
    // Temporary (bug 1641989) conduit for Glean data in content processes.
    // Tells the child to flush any pending data. Used in tests and ping
    // assembly. Buffer contains bincoded Rust structs.
    async FlushFOGData() returns (ByteBuf buf);

parent:
    async SetContainerFeaturePolicy(MaybeDiscardedBrowsingContext aContainerContext,
                                    nullable FeaturePolicy aContainerFeaturePolicy);

    // Obtain an icon from the system widget toolkit, in nsIconDecoder
    // format.  Not supported (or needed) on all platforms; see the
    // implementation in ContentParent::RecvGetSystemIcon for details.
    async GetSystemIcon(nullable nsIURI aURI) returns (nsresult aResult, ByteBuf? aData);

#ifdef FUZZING_SNAPSHOT
    // Used by the child process to signal that it is ready to start fuzzing.
    // This can in particular be used to wait for a particular event in a
    // test document before taking the snapshot and starting e.g. IPC fuzzing.
    async SignalFuzzingReady();
#endif
};

}
}