Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/ipc/ipdl/PContentBridgeParent.cpp
Line
Count
Source (jump to first uncovered line)
1
//
2
// Automatically generated by ipdlc.
3
// Edit at your own risk
4
//
5
6
7
#include "mozilla/dom/PContentBridgeParent.h"
8
#include "mozilla/dom/MessagePort.h"
9
#include "mozilla/dom/PermissionMessageUtils.h"
10
#include "mozilla/dom/ipc/StructuredCloneData.h"
11
12
#include "mozilla/dom/PBrowserParent.h"
13
#include "mozilla/dom/PContentParent.h"
14
#include "mozilla/jsipc/PJavaScriptParent.h"
15
#include "mozilla/ipc/PFileDescriptorSetParent.h"
16
#include "mozilla/ipc/PChildToParentStreamParent.h"
17
#include "mozilla/ipc/PParentToChildStreamParent.h"
18
#include "mozilla/ipc/PIPCBlobInputStreamParent.h"
19
20
#include "nsIFile.h"
21
#include "GeckoProfiler.h"
22
23
namespace mozilla {
24
namespace dom {
25
26
27
auto PContentBridgeParent::RecvPJavaScriptConstructor(PJavaScriptParent* actor) -> mozilla::ipc::IPCResult
28
0
{
29
0
    return IPC_OK();
30
0
}
31
32
auto PContentBridgeParent::RecvPChildToParentStreamConstructor(PChildToParentStreamParent* actor) -> mozilla::ipc::IPCResult
33
0
{
34
0
    return IPC_OK();
35
0
}
36
37
auto PContentBridgeParent::RecvPBrowserConstructor(
38
        PBrowserParent* actor,
39
        const TabId& tabId,
40
        const TabId& sameTabGroupAs,
41
        const IPCTabContext& context,
42
        const uint32_t& chromeFlags,
43
        const ContentParentId& cpId,
44
        const bool& isForBrowser) -> mozilla::ipc::IPCResult
45
0
{
46
0
    return IPC_OK();
47
0
}
48
49
auto PContentBridgeParent::RecvPFileDescriptorSetConstructor(
50
        PFileDescriptorSetParent* actor,
51
        const FileDescriptor& fd) -> mozilla::ipc::IPCResult
52
0
{
53
0
    return IPC_OK();
54
0
}
55
56
auto PContentBridgeParent::ActorDestroy(ActorDestroyReason aWhy) -> void
57
0
{
58
0
}
59
60
auto PContentBridgeParent::ProcessingError(
61
        Result aCode,
62
        const char* aReason) -> void
63
0
{
64
0
}
65
66
auto PContentBridgeParent::ShouldContinueFromReplyTimeout() -> bool
67
0
{
68
0
    return true;
69
0
}
70
71
auto PContentBridgeParent::EnteredCxxStack() -> void
72
0
{
73
0
}
74
75
auto PContentBridgeParent::ExitedCxxStack() -> void
76
0
{
77
0
}
78
79
auto PContentBridgeParent::EnteredCall() -> void
80
0
{
81
0
}
82
83
auto PContentBridgeParent::ExitedCall() -> void
84
0
{
85
0
}
86
87
MOZ_IMPLICIT PContentBridgeParent::PContentBridgeParent() :
88
    mozilla::ipc::IToplevelProtocol("PContentBridgeParent", PContentBridgeMsgStart, mozilla::ipc::ParentSide),
89
    mLivenessState(mozilla::ipc::LivenessState::Start)
90
0
{
91
0
    MOZ_COUNT_CTOR(PContentBridgeParent);
92
0
}
93
94
PContentBridgeParent::~PContentBridgeParent()
95
0
{
96
0
    MOZ_COUNT_DTOR(PContentBridgeParent);
97
0
}
98
99
auto PContentBridgeParent::ManagedPBrowserParent(nsTArray<PBrowserParent*>& aArr) const -> void
100
0
{
101
0
    (mManagedPBrowserParent).ToArray(aArr);
102
0
}
103
104
auto PContentBridgeParent::ManagedPBrowserParent() const -> const ManagedContainer<PBrowserParent>&
105
0
{
106
0
    return mManagedPBrowserParent;
107
0
}
108
109
auto PContentBridgeParent::ManagedPFileDescriptorSetParent(nsTArray<PFileDescriptorSetParent*>& aArr) const -> void
110
0
{
111
0
    (mManagedPFileDescriptorSetParent).ToArray(aArr);
112
0
}
113
114
auto PContentBridgeParent::ManagedPFileDescriptorSetParent() const -> const ManagedContainer<PFileDescriptorSetParent>&
115
0
{
116
0
    return mManagedPFileDescriptorSetParent;
117
0
}
118
119
auto PContentBridgeParent::ManagedPJavaScriptParent(nsTArray<PJavaScriptParent*>& aArr) const -> void
120
0
{
121
0
    (mManagedPJavaScriptParent).ToArray(aArr);
122
0
}
123
124
auto PContentBridgeParent::ManagedPJavaScriptParent() const -> const ManagedContainer<PJavaScriptParent>&
125
0
{
126
0
    return mManagedPJavaScriptParent;
127
0
}
128
129
auto PContentBridgeParent::ManagedPChildToParentStreamParent(nsTArray<PChildToParentStreamParent*>& aArr) const -> void
130
0
{
131
0
    (mManagedPChildToParentStreamParent).ToArray(aArr);
132
0
}
133
134
auto PContentBridgeParent::ManagedPChildToParentStreamParent() const -> const ManagedContainer<PChildToParentStreamParent>&
135
0
{
136
0
    return mManagedPChildToParentStreamParent;
137
0
}
138
139
auto PContentBridgeParent::ManagedPParentToChildStreamParent(nsTArray<PParentToChildStreamParent*>& aArr) const -> void
140
0
{
141
0
    (mManagedPParentToChildStreamParent).ToArray(aArr);
142
0
}
143
144
auto PContentBridgeParent::ManagedPParentToChildStreamParent() const -> const ManagedContainer<PParentToChildStreamParent>&
145
0
{
146
0
    return mManagedPParentToChildStreamParent;
147
0
}
148
149
auto PContentBridgeParent::ManagedPIPCBlobInputStreamParent(nsTArray<PIPCBlobInputStreamParent*>& aArr) const -> void
150
0
{
151
0
    (mManagedPIPCBlobInputStreamParent).ToArray(aArr);
152
0
}
153
154
auto PContentBridgeParent::ManagedPIPCBlobInputStreamParent() const -> const ManagedContainer<PIPCBlobInputStreamParent>&
155
0
{
156
0
    return mManagedPIPCBlobInputStreamParent;
157
0
}
158
159
auto PContentBridgeParent::SendPParentToChildStreamConstructor() -> PParentToChildStreamParent*
160
0
{
161
0
    return SendPParentToChildStreamConstructor(AllocPParentToChildStreamParent());
162
0
}
163
164
auto PContentBridgeParent::SendPParentToChildStreamConstructor(PParentToChildStreamParent* actor) -> PParentToChildStreamParent*
165
0
{
166
0
    if ((!(actor))) {
167
0
        NS_WARNING("Error constructing actor PParentToChildStreamParent");
168
0
        return nullptr;
169
0
    }
170
0
    (actor)->SetManagerAndRegister(this);
171
0
    (mManagedPParentToChildStreamParent).PutEntry(actor);
172
0
    (actor)->mLivenessState = mozilla::ipc::LivenessState::Start;
173
0
174
0
    IPC::Message* msg__ = PContentBridge::Msg_PParentToChildStreamConstructor(MSG_ROUTING_CONTROL);
175
0
176
0
    MOZ_RELEASE_ASSERT(actor, "NULL actor value passed to non-nullable param");
177
0
    WriteIPDLParam(msg__, this, actor);
178
0
    // Sentinel = 'actor'
179
0
    (msg__)->WriteSentinel(875202478);
180
0
181
0
182
0
183
0
    if (mozilla::ipc::LoggingEnabledFor("PContentBridgeParent")) {
184
0
        mozilla::ipc::LogMessageForProtocol("PContentBridgeParent", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
185
0
    }
186
0
    AUTO_PROFILER_LABEL("PContentBridge::Msg_PParentToChildStreamConstructor", OTHER);
187
0
    if ((!(StateTransition(false, (&(mLivenessState)))))) {
188
0
        mozilla::ipc::LogicError("Transition error");
189
0
    }
190
0
191
0
    bool sendok__ = (GetIPCChannel())->Send(msg__);
192
0
    if ((!(sendok__))) {
193
0
        IProtocol* mgr = (actor)->Manager();
194
0
        (actor)->DestroySubtree(FailedConstructor);
195
0
        (actor)->DeallocSubtree();
196
0
        (mgr)->RemoveManagee(PParentToChildStreamMsgStart, actor);
197
0
        return nullptr;
198
0
    }
199
0
    return actor;
200
0
}
201
202
auto PContentBridgeParent::SendActivate(PBrowserParent* aTab) -> bool
203
0
{
204
0
    IPC::Message* msg__ = PContentBridge::Msg_Activate(MSG_ROUTING_CONTROL);
205
0
206
0
    MOZ_RELEASE_ASSERT(aTab, "NULL actor value passed to non-nullable param");
207
0
    WriteIPDLParam(msg__, this, aTab);
208
0
    // Sentinel = 'aTab'
209
0
    (msg__)->WriteSentinel(1179125994);
210
0
211
0
212
0
213
0
214
0
    if (mozilla::ipc::LoggingEnabledFor("PContentBridgeParent")) {
215
0
        mozilla::ipc::LogMessageForProtocol("PContentBridgeParent", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
216
0
    }
217
0
    AUTO_PROFILER_LABEL("PContentBridge::Msg_Activate", OTHER);
218
0
    if ((!(StateTransition(false, (&(mLivenessState)))))) {
219
0
        mozilla::ipc::LogicError("Transition error");
220
0
    }
221
0
222
0
    bool sendok__ = (GetIPCChannel())->Send(msg__);
223
0
    return sendok__;
224
0
}
225
226
auto PContentBridgeParent::SendDeactivate(PBrowserParent* aTab) -> bool
227
0
{
228
0
    IPC::Message* msg__ = PContentBridge::Msg_Deactivate(MSG_ROUTING_CONTROL);
229
0
230
0
    MOZ_RELEASE_ASSERT(aTab, "NULL actor value passed to non-nullable param");
231
0
    WriteIPDLParam(msg__, this, aTab);
232
0
    // Sentinel = 'aTab'
233
0
    (msg__)->WriteSentinel(1179125994);
234
0
235
0
236
0
237
0
238
0
    if (mozilla::ipc::LoggingEnabledFor("PContentBridgeParent")) {
239
0
        mozilla::ipc::LogMessageForProtocol("PContentBridgeParent", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
240
0
    }
241
0
    AUTO_PROFILER_LABEL("PContentBridge::Msg_Deactivate", OTHER);
242
0
    if ((!(StateTransition(false, (&(mLivenessState)))))) {
243
0
        mozilla::ipc::LogicError("Transition error");
244
0
    }
245
0
246
0
    bool sendok__ = (GetIPCChannel())->Send(msg__);
247
0
    return sendok__;
248
0
}
249
250
auto PContentBridgeParent::SendPIPCBlobInputStreamConstructor(
251
        const nsID& aID,
252
        const uint64_t& aSize) -> PIPCBlobInputStreamParent*
253
0
{
254
0
    return SendPIPCBlobInputStreamConstructor(AllocPIPCBlobInputStreamParent(aID, aSize), aID, aSize);
255
0
}
256
257
auto PContentBridgeParent::SendPIPCBlobInputStreamConstructor(
258
        PIPCBlobInputStreamParent* actor,
259
        const nsID& aID,
260
        const uint64_t& aSize) -> PIPCBlobInputStreamParent*
261
0
{
262
0
    if ((!(actor))) {
263
0
        NS_WARNING("Error constructing actor PIPCBlobInputStreamParent");
264
0
        return nullptr;
265
0
    }
266
0
    (actor)->SetManagerAndRegister(this);
267
0
    (mManagedPIPCBlobInputStreamParent).PutEntry(actor);
268
0
    (actor)->mLivenessState = mozilla::ipc::LivenessState::Start;
269
0
270
0
    IPC::Message* msg__ = PContentBridge::Msg_PIPCBlobInputStreamConstructor(MSG_ROUTING_CONTROL);
271
0
272
0
    MOZ_RELEASE_ASSERT(actor, "NULL actor value passed to non-nullable param");
273
0
    WriteIPDLParam(msg__, this, actor);
274
0
    // Sentinel = 'actor'
275
0
    (msg__)->WriteSentinel(875202478);
276
0
    WriteIPDLParam(msg__, this, aID);
277
0
    // Sentinel = 'aID'
278
0
    (msg__)->WriteSentinel(2735041849);
279
0
    WriteIPDLParam(msg__, this, aSize);
280
0
    // Sentinel = 'aSize'
281
0
    (msg__)->WriteSentinel(2556665555);
282
0
283
0
284
0
285
0
    if (mozilla::ipc::LoggingEnabledFor("PContentBridgeParent")) {
286
0
        mozilla::ipc::LogMessageForProtocol("PContentBridgeParent", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
287
0
    }
288
0
    AUTO_PROFILER_LABEL("PContentBridge::Msg_PIPCBlobInputStreamConstructor", OTHER);
289
0
    if ((!(StateTransition(false, (&(mLivenessState)))))) {
290
0
        mozilla::ipc::LogicError("Transition error");
291
0
    }
292
0
293
0
    bool sendok__ = (GetIPCChannel())->Send(msg__);
294
0
    if ((!(sendok__))) {
295
0
        IProtocol* mgr = (actor)->Manager();
296
0
        (actor)->DestroySubtree(FailedConstructor);
297
0
        (actor)->DeallocSubtree();
298
0
        (mgr)->RemoveManagee(PIPCBlobInputStreamMsgStart, actor);
299
0
        return nullptr;
300
0
    }
301
0
    return actor;
302
0
}
303
304
auto PContentBridgeParent::SendPBrowserConstructor(
305
        const TabId& tabId,
306
        const TabId& sameTabGroupAs,
307
        const IPCTabContext& context,
308
        const uint32_t& chromeFlags,
309
        const ContentParentId& cpId,
310
        const bool& isForBrowser) -> PBrowserParent*
311
0
{
312
0
    return SendPBrowserConstructor(AllocPBrowserParent(tabId, sameTabGroupAs, context, chromeFlags, cpId, isForBrowser), tabId, sameTabGroupAs, context, chromeFlags, cpId, isForBrowser);
313
0
}
314
315
auto PContentBridgeParent::SendPBrowserConstructor(
316
        PBrowserParent* actor,
317
        const TabId& tabId,
318
        const TabId& sameTabGroupAs,
319
        const IPCTabContext& context,
320
        const uint32_t& chromeFlags,
321
        const ContentParentId& cpId,
322
        const bool& isForBrowser) -> PBrowserParent*
323
0
{
324
0
    if ((!(actor))) {
325
0
        NS_WARNING("Error constructing actor PBrowserParent");
326
0
        return nullptr;
327
0
    }
328
0
    (actor)->SetManagerAndRegister(this);
329
0
    (mManagedPBrowserParent).PutEntry(actor);
330
0
    (actor)->mLivenessState = mozilla::ipc::LivenessState::Start;
331
0
332
0
    IPC::Message* msg__ = PContentBridge::Msg_PBrowserConstructor(MSG_ROUTING_CONTROL);
333
0
334
0
    MOZ_RELEASE_ASSERT(actor, "NULL actor value passed to non-nullable param");
335
0
    WriteIPDLParam(msg__, this, actor);
336
0
    // Sentinel = 'actor'
337
0
    (msg__)->WriteSentinel(875202478);
338
0
    WriteIPDLParam(msg__, this, tabId);
339
0
    // Sentinel = 'tabId'
340
0
    (msg__)->WriteSentinel(3419081923);
341
0
    WriteIPDLParam(msg__, this, sameTabGroupAs);
342
0
    // Sentinel = 'sameTabGroupAs'
343
0
    (msg__)->WriteSentinel(3969365410);
344
0
    WriteIPDLParam(msg__, this, context);
345
0
    // Sentinel = 'context'
346
0
    (msg__)->WriteSentinel(3514529014);
347
0
    WriteIPDLParam(msg__, this, chromeFlags);
348
0
    // Sentinel = 'chromeFlags'
349
0
    (msg__)->WriteSentinel(299515804);
350
0
    WriteIPDLParam(msg__, this, cpId);
351
0
    // Sentinel = 'cpId'
352
0
    (msg__)->WriteSentinel(2452595622);
353
0
    WriteIPDLParam(msg__, this, isForBrowser);
354
0
    // Sentinel = 'isForBrowser'
355
0
    (msg__)->WriteSentinel(2051565587);
356
0
357
0
358
0
359
0
    if (mozilla::ipc::LoggingEnabledFor("PContentBridgeParent")) {
360
0
        mozilla::ipc::LogMessageForProtocol("PContentBridgeParent", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
361
0
    }
362
0
    AUTO_PROFILER_LABEL("PContentBridge::Msg_PBrowserConstructor", OTHER);
363
0
    if ((!(StateTransition(false, (&(mLivenessState)))))) {
364
0
        mozilla::ipc::LogicError("Transition error");
365
0
    }
366
0
367
0
    bool sendok__ = (GetIPCChannel())->Send(msg__);
368
0
    if ((!(sendok__))) {
369
0
        IProtocol* mgr = (actor)->Manager();
370
0
        (actor)->DestroySubtree(FailedConstructor);
371
0
        (actor)->DeallocSubtree();
372
0
        (mgr)->RemoveManagee(PBrowserMsgStart, actor);
373
0
        return nullptr;
374
0
    }
375
0
    return actor;
376
0
}
377
378
auto PContentBridgeParent::SendPFileDescriptorSetConstructor(const FileDescriptor& fd) -> PFileDescriptorSetParent*
379
0
{
380
0
    return SendPFileDescriptorSetConstructor(AllocPFileDescriptorSetParent(fd), fd);
381
0
}
382
383
auto PContentBridgeParent::SendPFileDescriptorSetConstructor(
384
        PFileDescriptorSetParent* actor,
385
        const FileDescriptor& fd) -> PFileDescriptorSetParent*
386
0
{
387
0
    if ((!(actor))) {
388
0
        NS_WARNING("Error constructing actor PFileDescriptorSetParent");
389
0
        return nullptr;
390
0
    }
391
0
    (actor)->SetManagerAndRegister(this);
392
0
    (mManagedPFileDescriptorSetParent).PutEntry(actor);
393
0
    (actor)->mLivenessState = mozilla::ipc::LivenessState::Start;
394
0
395
0
    IPC::Message* msg__ = PContentBridge::Msg_PFileDescriptorSetConstructor(MSG_ROUTING_CONTROL);
396
0
397
0
    MOZ_RELEASE_ASSERT(actor, "NULL actor value passed to non-nullable param");
398
0
    WriteIPDLParam(msg__, this, actor);
399
0
    // Sentinel = 'actor'
400
0
    (msg__)->WriteSentinel(875202478);
401
0
    WriteIPDLParam(msg__, this, fd);
402
0
    // Sentinel = 'fd'
403
0
    (msg__)->WriteSentinel(628535764);
404
0
405
0
406
0
407
0
    if (mozilla::ipc::LoggingEnabledFor("PContentBridgeParent")) {
408
0
        mozilla::ipc::LogMessageForProtocol("PContentBridgeParent", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
409
0
    }
410
0
    AUTO_PROFILER_LABEL("PContentBridge::Msg_PFileDescriptorSetConstructor", OTHER);
411
0
    if ((!(StateTransition(false, (&(mLivenessState)))))) {
412
0
        mozilla::ipc::LogicError("Transition error");
413
0
    }
414
0
415
0
    bool sendok__ = (GetIPCChannel())->Send(msg__);
416
0
    if ((!(sendok__))) {
417
0
        IProtocol* mgr = (actor)->Manager();
418
0
        (actor)->DestroySubtree(FailedConstructor);
419
0
        (actor)->DeallocSubtree();
420
0
        (mgr)->RemoveManagee(PFileDescriptorSetMsgStart, actor);
421
0
        return nullptr;
422
0
    }
423
0
    return actor;
424
0
}
425
426
auto PContentBridgeParent::SendAsyncMessage(
427
        const nsString& aMessage,
428
        const nsTArray<CpowEntry>& aCpows,
429
        const Principal& aPrincipal,
430
        const ClonedMessageData& aData) -> bool
431
0
{
432
0
    IPC::Message* msg__ = PContentBridge::Msg_AsyncMessage(MSG_ROUTING_CONTROL);
433
0
434
0
    WriteIPDLParam(msg__, this, aMessage);
435
0
    // Sentinel = 'aMessage'
436
0
    (msg__)->WriteSentinel(3453110902);
437
0
    WriteIPDLParam(msg__, this, aCpows);
438
0
    // Sentinel = 'aCpows'
439
0
    (msg__)->WriteSentinel(2178221451);
440
0
    WriteIPDLParam(msg__, this, aPrincipal);
441
0
    // Sentinel = 'aPrincipal'
442
0
    (msg__)->WriteSentinel(4097511);
443
0
    WriteIPDLParam(msg__, this, aData);
444
0
    // Sentinel = 'aData'
445
0
    (msg__)->WriteSentinel(3285075324);
446
0
447
0
448
0
449
0
450
0
    if (mozilla::ipc::LoggingEnabledFor("PContentBridgeParent")) {
451
0
        mozilla::ipc::LogMessageForProtocol("PContentBridgeParent", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
452
0
    }
453
0
    AUTO_PROFILER_LABEL("PContentBridge::Msg_AsyncMessage", OTHER);
454
0
    if ((!(StateTransition(false, (&(mLivenessState)))))) {
455
0
        mozilla::ipc::LogicError("Transition error");
456
0
    }
457
0
458
0
    bool sendok__ = (GetIPCChannel())->Send(msg__);
459
0
    return sendok__;
460
0
}
461
462
auto PContentBridgeParent::RemoveManagee(
463
        int32_t aProtocolId,
464
        IProtocol* aListener) -> void
465
0
{
466
0
    switch (aProtocolId) {
467
0
    case PBrowserMsgStart:
468
0
        {
469
0
            PBrowserParent* actor = static_cast<PBrowserParent*>(aListener);
470
0
            auto& container = mManagedPBrowserParent;
471
0
            MOZ_RELEASE_ASSERT((container).Contains(actor), "actor not managed by this!");
472
0
473
0
            (container).RemoveEntry(actor);
474
0
            DeallocPBrowserParent(actor);
475
0
            return;
476
0
        }
477
0
    case PFileDescriptorSetMsgStart:
478
0
        {
479
0
            PFileDescriptorSetParent* actor = static_cast<PFileDescriptorSetParent*>(aListener);
480
0
            auto& container = mManagedPFileDescriptorSetParent;
481
0
            MOZ_RELEASE_ASSERT((container).Contains(actor), "actor not managed by this!");
482
0
483
0
            (container).RemoveEntry(actor);
484
0
            DeallocPFileDescriptorSetParent(actor);
485
0
            return;
486
0
        }
487
0
    case PJavaScriptMsgStart:
488
0
        {
489
0
            PJavaScriptParent* actor = static_cast<PJavaScriptParent*>(aListener);
490
0
            auto& container = mManagedPJavaScriptParent;
491
0
            MOZ_RELEASE_ASSERT((container).Contains(actor), "actor not managed by this!");
492
0
493
0
            (container).RemoveEntry(actor);
494
0
            DeallocPJavaScriptParent(actor);
495
0
            return;
496
0
        }
497
0
    case PChildToParentStreamMsgStart:
498
0
        {
499
0
            PChildToParentStreamParent* actor = static_cast<PChildToParentStreamParent*>(aListener);
500
0
            auto& container = mManagedPChildToParentStreamParent;
501
0
            MOZ_RELEASE_ASSERT((container).Contains(actor), "actor not managed by this!");
502
0
503
0
            (container).RemoveEntry(actor);
504
0
            DeallocPChildToParentStreamParent(actor);
505
0
            return;
506
0
        }
507
0
    case PParentToChildStreamMsgStart:
508
0
        {
509
0
            PParentToChildStreamParent* actor = static_cast<PParentToChildStreamParent*>(aListener);
510
0
            auto& container = mManagedPParentToChildStreamParent;
511
0
            MOZ_RELEASE_ASSERT((container).Contains(actor), "actor not managed by this!");
512
0
513
0
            (container).RemoveEntry(actor);
514
0
            DeallocPParentToChildStreamParent(actor);
515
0
            return;
516
0
        }
517
0
    case PIPCBlobInputStreamMsgStart:
518
0
        {
519
0
            PIPCBlobInputStreamParent* actor = static_cast<PIPCBlobInputStreamParent*>(aListener);
520
0
            auto& container = mManagedPIPCBlobInputStreamParent;
521
0
            MOZ_RELEASE_ASSERT((container).Contains(actor), "actor not managed by this!");
522
0
523
0
            (container).RemoveEntry(actor);
524
0
            DeallocPIPCBlobInputStreamParent(actor);
525
0
            return;
526
0
        }
527
0
    default:
528
0
        {
529
0
            FatalError("unreached");
530
0
            return;
531
0
        }
532
0
    }
533
0
}
534
535
auto PContentBridgeParent::OnMessageReceived(const Message& msg__) -> PContentBridgeParent::Result
536
0
{
537
0
    int32_t route__ = (msg__).routing_id();
538
0
    if ((MSG_ROUTING_CONTROL) != (route__)) {
539
0
        IProtocol* routed__ = Lookup(route__);
540
0
        if ((!(routed__))) {
541
0
            return MsgRouteError;
542
0
        }
543
0
        return (routed__)->OnMessageReceived(msg__);
544
0
    }
545
0
546
0
    switch ((msg__).type()) {
547
0
    case PContentBridge::Reply_PParentToChildStreamConstructor__ID:
548
0
        {
549
0
            return MsgProcessed;
550
0
        }
551
0
    case PContentBridge::Reply_PIPCBlobInputStreamConstructor__ID:
552
0
        {
553
0
            return MsgProcessed;
554
0
        }
555
0
    case PContentBridge::Msg_PJavaScriptConstructor__ID:
556
0
        {
557
0
            if (mozilla::ipc::LoggingEnabledFor("PContentBridgeParent")) {
558
0
                mozilla::ipc::LogMessageForProtocol("PContentBridgeParent", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
559
0
            }
560
0
            AUTO_PROFILER_LABEL("PContentBridge::Msg_PJavaScriptConstructor", OTHER);
561
0
562
0
            PickleIterator iter__(msg__);
563
0
            ActorHandle handle__;
564
0
            PJavaScriptParent* actor;
565
0
566
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(handle__)))))) {
567
0
                FatalError("Error deserializing 'ActorHandle'");
568
0
                return MsgValueError;
569
0
            }
570
0
            // Sentinel = 'actor'
571
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 875202478)))) {
572
0
                mozilla::ipc::SentinelReadError("Error deserializing 'ActorHandle'");
573
0
                return MsgValueError;
574
0
            }
575
0
            (msg__).EndRead(iter__, (msg__).type());
576
0
            if ((!(StateTransition(false, (&(mLivenessState)))))) {
577
0
                FatalError("Transition error");
578
0
                return MsgValueError;
579
0
            }
580
0
            actor = AllocPJavaScriptParent();
581
0
            if ((!(actor))) {
582
0
                NS_WARNING("Error constructing actor PJavaScriptParent");
583
0
                return MsgValueError;
584
0
            }
585
0
            (actor)->SetManagerAndRegister(this, (handle__).mId);
586
0
            (mManagedPJavaScriptParent).PutEntry(actor);
587
0
            (actor)->mLivenessState = mozilla::ipc::LivenessState::Start;
588
0
589
0
            if ((!(RecvPJavaScriptConstructor(actor)))) {
590
0
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
591
0
                // Error handled in mozilla::ipc::IPCResult
592
0
                return MsgProcessingError;
593
0
            }
594
0
595
0
            return MsgProcessed;
596
0
        }
597
0
    case PContentBridge::Msg_PChildToParentStreamConstructor__ID:
598
0
        {
599
0
            if (mozilla::ipc::LoggingEnabledFor("PContentBridgeParent")) {
600
0
                mozilla::ipc::LogMessageForProtocol("PContentBridgeParent", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
601
0
            }
602
0
            AUTO_PROFILER_LABEL("PContentBridge::Msg_PChildToParentStreamConstructor", OTHER);
603
0
604
0
            PickleIterator iter__(msg__);
605
0
            ActorHandle handle__;
606
0
            PChildToParentStreamParent* actor;
607
0
608
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(handle__)))))) {
609
0
                FatalError("Error deserializing 'ActorHandle'");
610
0
                return MsgValueError;
611
0
            }
612
0
            // Sentinel = 'actor'
613
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 875202478)))) {
614
0
                mozilla::ipc::SentinelReadError("Error deserializing 'ActorHandle'");
615
0
                return MsgValueError;
616
0
            }
617
0
            (msg__).EndRead(iter__, (msg__).type());
618
0
            if ((!(StateTransition(false, (&(mLivenessState)))))) {
619
0
                FatalError("Transition error");
620
0
                return MsgValueError;
621
0
            }
622
0
            actor = AllocPChildToParentStreamParent();
623
0
            if ((!(actor))) {
624
0
                NS_WARNING("Error constructing actor PChildToParentStreamParent");
625
0
                return MsgValueError;
626
0
            }
627
0
            (actor)->SetManagerAndRegister(this, (handle__).mId);
628
0
            (mManagedPChildToParentStreamParent).PutEntry(actor);
629
0
            (actor)->mLivenessState = mozilla::ipc::LivenessState::Start;
630
0
631
0
            if ((!(RecvPChildToParentStreamConstructor(actor)))) {
632
0
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
633
0
                // Error handled in mozilla::ipc::IPCResult
634
0
                return MsgProcessingError;
635
0
            }
636
0
637
0
            return MsgProcessed;
638
0
        }
639
0
    case PContentBridge::Reply_PBrowserConstructor__ID:
640
0
        {
641
0
            return MsgProcessed;
642
0
        }
643
0
    case PContentBridge::Msg_PBrowserConstructor__ID:
644
0
        {
645
0
            if (mozilla::ipc::LoggingEnabledFor("PContentBridgeParent")) {
646
0
                mozilla::ipc::LogMessageForProtocol("PContentBridgeParent", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
647
0
            }
648
0
            AUTO_PROFILER_LABEL("PContentBridge::Msg_PBrowserConstructor", OTHER);
649
0
650
0
            PickleIterator iter__(msg__);
651
0
            ActorHandle handle__;
652
0
            PBrowserParent* actor;
653
0
            TabId tabId;
654
0
            TabId sameTabGroupAs;
655
0
            IPCTabContext context;
656
0
            uint32_t chromeFlags;
657
0
            ContentParentId cpId;
658
0
            bool isForBrowser;
659
0
660
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(handle__)))))) {
661
0
                FatalError("Error deserializing 'ActorHandle'");
662
0
                return MsgValueError;
663
0
            }
664
0
            // Sentinel = 'actor'
665
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 875202478)))) {
666
0
                mozilla::ipc::SentinelReadError("Error deserializing 'ActorHandle'");
667
0
                return MsgValueError;
668
0
            }
669
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(tabId)))))) {
670
0
                FatalError("Error deserializing 'TabId'");
671
0
                return MsgValueError;
672
0
            }
673
0
            // Sentinel = 'tabId'
674
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 3419081923)))) {
675
0
                mozilla::ipc::SentinelReadError("Error deserializing 'TabId'");
676
0
                return MsgValueError;
677
0
            }
678
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(sameTabGroupAs)))))) {
679
0
                FatalError("Error deserializing 'TabId'");
680
0
                return MsgValueError;
681
0
            }
682
0
            // Sentinel = 'sameTabGroupAs'
683
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 3969365410)))) {
684
0
                mozilla::ipc::SentinelReadError("Error deserializing 'TabId'");
685
0
                return MsgValueError;
686
0
            }
687
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(context)))))) {
688
0
                FatalError("Error deserializing 'IPCTabContext'");
689
0
                return MsgValueError;
690
0
            }
691
0
            // Sentinel = 'context'
692
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 3514529014)))) {
693
0
                mozilla::ipc::SentinelReadError("Error deserializing 'IPCTabContext'");
694
0
                return MsgValueError;
695
0
            }
696
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(chromeFlags)))))) {
697
0
                FatalError("Error deserializing 'uint32_t'");
698
0
                return MsgValueError;
699
0
            }
700
0
            // Sentinel = 'chromeFlags'
701
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 299515804)))) {
702
0
                mozilla::ipc::SentinelReadError("Error deserializing 'uint32_t'");
703
0
                return MsgValueError;
704
0
            }
705
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(cpId)))))) {
706
0
                FatalError("Error deserializing 'ContentParentId'");
707
0
                return MsgValueError;
708
0
            }
709
0
            // Sentinel = 'cpId'
710
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 2452595622)))) {
711
0
                mozilla::ipc::SentinelReadError("Error deserializing 'ContentParentId'");
712
0
                return MsgValueError;
713
0
            }
714
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(isForBrowser)))))) {
715
0
                FatalError("Error deserializing 'bool'");
716
0
                return MsgValueError;
717
0
            }
718
0
            // Sentinel = 'isForBrowser'
719
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 2051565587)))) {
720
0
                mozilla::ipc::SentinelReadError("Error deserializing 'bool'");
721
0
                return MsgValueError;
722
0
            }
723
0
            (msg__).EndRead(iter__, (msg__).type());
724
0
            if ((!(StateTransition(false, (&(mLivenessState)))))) {
725
0
                FatalError("Transition error");
726
0
                return MsgValueError;
727
0
            }
728
0
            actor = AllocPBrowserParent(tabId, sameTabGroupAs, context, chromeFlags, cpId, isForBrowser);
729
0
            if ((!(actor))) {
730
0
                NS_WARNING("Error constructing actor PBrowserParent");
731
0
                return MsgValueError;
732
0
            }
733
0
            (actor)->SetManagerAndRegister(this, (handle__).mId);
734
0
            (mManagedPBrowserParent).PutEntry(actor);
735
0
            (actor)->mLivenessState = mozilla::ipc::LivenessState::Start;
736
0
737
0
            if ((!(RecvPBrowserConstructor(actor, tabId, sameTabGroupAs, context, chromeFlags, cpId, isForBrowser)))) {
738
0
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
739
0
                // Error handled in mozilla::ipc::IPCResult
740
0
                return MsgProcessingError;
741
0
            }
742
0
743
0
            return MsgProcessed;
744
0
        }
745
0
    case PContentBridge::Reply_PFileDescriptorSetConstructor__ID:
746
0
        {
747
0
            return MsgProcessed;
748
0
        }
749
0
    case PContentBridge::Msg_PFileDescriptorSetConstructor__ID:
750
0
        {
751
0
            if (mozilla::ipc::LoggingEnabledFor("PContentBridgeParent")) {
752
0
                mozilla::ipc::LogMessageForProtocol("PContentBridgeParent", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
753
0
            }
754
0
            AUTO_PROFILER_LABEL("PContentBridge::Msg_PFileDescriptorSetConstructor", OTHER);
755
0
756
0
            PickleIterator iter__(msg__);
757
0
            ActorHandle handle__;
758
0
            PFileDescriptorSetParent* actor;
759
0
            FileDescriptor fd;
760
0
761
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(handle__)))))) {
762
0
                FatalError("Error deserializing 'ActorHandle'");
763
0
                return MsgValueError;
764
0
            }
765
0
            // Sentinel = 'actor'
766
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 875202478)))) {
767
0
                mozilla::ipc::SentinelReadError("Error deserializing 'ActorHandle'");
768
0
                return MsgValueError;
769
0
            }
770
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(fd)))))) {
771
0
                FatalError("Error deserializing 'FileDescriptor'");
772
0
                return MsgValueError;
773
0
            }
774
0
            // Sentinel = 'fd'
775
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 628535764)))) {
776
0
                mozilla::ipc::SentinelReadError("Error deserializing 'FileDescriptor'");
777
0
                return MsgValueError;
778
0
            }
779
0
            (msg__).EndRead(iter__, (msg__).type());
780
0
            if ((!(StateTransition(false, (&(mLivenessState)))))) {
781
0
                FatalError("Transition error");
782
0
                return MsgValueError;
783
0
            }
784
0
            actor = AllocPFileDescriptorSetParent(fd);
785
0
            if ((!(actor))) {
786
0
                NS_WARNING("Error constructing actor PFileDescriptorSetParent");
787
0
                return MsgValueError;
788
0
            }
789
0
            (actor)->SetManagerAndRegister(this, (handle__).mId);
790
0
            (mManagedPFileDescriptorSetParent).PutEntry(actor);
791
0
            (actor)->mLivenessState = mozilla::ipc::LivenessState::Start;
792
0
793
0
            if ((!(RecvPFileDescriptorSetConstructor(actor, fd)))) {
794
0
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
795
0
                // Error handled in mozilla::ipc::IPCResult
796
0
                return MsgProcessingError;
797
0
            }
798
0
799
0
            return MsgProcessed;
800
0
        }
801
0
    case PContentBridge::Msg_AsyncMessage__ID:
802
0
        {
803
0
            if (mozilla::ipc::LoggingEnabledFor("PContentBridgeParent")) {
804
0
                mozilla::ipc::LogMessageForProtocol("PContentBridgeParent", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
805
0
            }
806
0
            AUTO_PROFILER_LABEL("PContentBridge::Msg_AsyncMessage", OTHER);
807
0
808
0
            PickleIterator iter__(msg__);
809
0
            nsString aMessage;
810
0
            nsTArray<CpowEntry> aCpows;
811
0
            Principal aPrincipal;
812
0
            ClonedMessageData aData;
813
0
814
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(aMessage)))))) {
815
0
                FatalError("Error deserializing 'nsString'");
816
0
                return MsgValueError;
817
0
            }
818
0
            // Sentinel = 'aMessage'
819
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 3453110902)))) {
820
0
                mozilla::ipc::SentinelReadError("Error deserializing 'nsString'");
821
0
                return MsgValueError;
822
0
            }
823
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(aCpows)))))) {
824
0
                FatalError("Error deserializing 'nsTArray'");
825
0
                return MsgValueError;
826
0
            }
827
0
            // Sentinel = 'aCpows'
828
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 2178221451)))) {
829
0
                mozilla::ipc::SentinelReadError("Error deserializing 'nsTArray'");
830
0
                return MsgValueError;
831
0
            }
832
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(aPrincipal)))))) {
833
0
                FatalError("Error deserializing 'Principal'");
834
0
                return MsgValueError;
835
0
            }
836
0
            // Sentinel = 'aPrincipal'
837
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 4097511)))) {
838
0
                mozilla::ipc::SentinelReadError("Error deserializing 'Principal'");
839
0
                return MsgValueError;
840
0
            }
841
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(aData)))))) {
842
0
                FatalError("Error deserializing 'ClonedMessageData'");
843
0
                return MsgValueError;
844
0
            }
845
0
            // Sentinel = 'aData'
846
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 3285075324)))) {
847
0
                mozilla::ipc::SentinelReadError("Error deserializing 'ClonedMessageData'");
848
0
                return MsgValueError;
849
0
            }
850
0
            (msg__).EndRead(iter__, (msg__).type());
851
0
            if ((!(StateTransition(false, (&(mLivenessState)))))) {
852
0
                FatalError("Transition error");
853
0
                return MsgValueError;
854
0
            }
855
0
            if ((!(RecvAsyncMessage(aMessage, std::move(aCpows), aPrincipal, aData)))) {
856
0
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
857
0
                // Error handled in mozilla::ipc::IPCResult
858
0
                return MsgProcessingError;
859
0
            }
860
0
861
0
            return MsgProcessed;
862
0
        }
863
0
    default:
864
0
        {
865
0
            return MsgNotKnown;
866
0
        }
867
0
    case SHMEM_CREATED_MESSAGE_TYPE:
868
0
        {
869
0
            if ((!(ShmemCreated(msg__)))) {
870
0
                return MsgPayloadError;
871
0
            }
872
0
            return MsgProcessed;
873
0
        }
874
0
    case SHMEM_DESTROYED_MESSAGE_TYPE:
875
0
        {
876
0
            if ((!(ShmemDestroyed(msg__)))) {
877
0
                return MsgPayloadError;
878
0
            }
879
0
            return MsgProcessed;
880
0
        }
881
0
    }
882
0
}
883
884
auto PContentBridgeParent::OnMessageReceived(
885
        const Message& msg__,
886
        Message*& reply__) -> PContentBridgeParent::Result
887
0
{
888
0
    int32_t route__ = (msg__).routing_id();
889
0
    if ((MSG_ROUTING_CONTROL) != (route__)) {
890
0
        IProtocol* routed__ = Lookup(route__);
891
0
        if ((!(routed__))) {
892
0
            return MsgRouteError;
893
0
        }
894
0
        return (routed__)->OnMessageReceived(msg__, reply__);
895
0
    }
896
0
897
0
    switch ((msg__).type()) {
898
0
    case PContentBridge::Msg_SyncMessage__ID:
899
0
        {
900
0
            if (mozilla::ipc::LoggingEnabledFor("PContentBridgeParent")) {
901
0
                mozilla::ipc::LogMessageForProtocol("PContentBridgeParent", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
902
0
            }
903
0
            AUTO_PROFILER_LABEL("PContentBridge::Msg_SyncMessage", OTHER);
904
0
905
0
            PickleIterator iter__(msg__);
906
0
            nsString aMessage;
907
0
            ClonedMessageData aData;
908
0
            nsTArray<CpowEntry> aCpows;
909
0
            Principal aPrincipal;
910
0
911
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(aMessage)))))) {
912
0
                FatalError("Error deserializing 'nsString'");
913
0
                return MsgValueError;
914
0
            }
915
0
            // Sentinel = 'aMessage'
916
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 3453110902)))) {
917
0
                mozilla::ipc::SentinelReadError("Error deserializing 'nsString'");
918
0
                return MsgValueError;
919
0
            }
920
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(aData)))))) {
921
0
                FatalError("Error deserializing 'ClonedMessageData'");
922
0
                return MsgValueError;
923
0
            }
924
0
            // Sentinel = 'aData'
925
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 3285075324)))) {
926
0
                mozilla::ipc::SentinelReadError("Error deserializing 'ClonedMessageData'");
927
0
                return MsgValueError;
928
0
            }
929
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(aCpows)))))) {
930
0
                FatalError("Error deserializing 'nsTArray'");
931
0
                return MsgValueError;
932
0
            }
933
0
            // Sentinel = 'aCpows'
934
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 2178221451)))) {
935
0
                mozilla::ipc::SentinelReadError("Error deserializing 'nsTArray'");
936
0
                return MsgValueError;
937
0
            }
938
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(aPrincipal)))))) {
939
0
                FatalError("Error deserializing 'Principal'");
940
0
                return MsgValueError;
941
0
            }
942
0
            // Sentinel = 'aPrincipal'
943
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 4097511)))) {
944
0
                mozilla::ipc::SentinelReadError("Error deserializing 'Principal'");
945
0
                return MsgValueError;
946
0
            }
947
0
            (msg__).EndRead(iter__, (msg__).type());
948
0
            if ((!(StateTransition(false, (&(mLivenessState)))))) {
949
0
                FatalError("Transition error");
950
0
                return MsgValueError;
951
0
            }
952
0
            int32_t id__ = MSG_ROUTING_CONTROL;
953
0
            nsTArray<StructuredCloneData> retval;
954
0
            if ((!(RecvSyncMessage(aMessage, aData, std::move(aCpows), aPrincipal, (&(retval)))))) {
955
0
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
956
0
                // Error handled in mozilla::ipc::IPCResult
957
0
                return MsgProcessingError;
958
0
            }
959
0
960
0
            reply__ = PContentBridge::Reply_SyncMessage(id__);
961
0
962
0
            WriteIPDLParam(reply__, this, retval);
963
0
            // Sentinel = 'retval'
964
0
            (reply__)->WriteSentinel(3130628604);
965
0
966
0
            if (mozilla::ipc::LoggingEnabledFor("PContentBridgeParent")) {
967
0
                mozilla::ipc::LogMessageForProtocol("PContentBridgeParent", OtherPid(), "Sending reply ", (reply__)->type(), mozilla::ipc::MessageDirection::eSending);
968
0
            }
969
0
            return MsgProcessed;
970
0
        }
971
0
    default:
972
0
        {
973
0
            return MsgNotKnown;
974
0
        }
975
0
    }
976
0
}
977
978
auto PContentBridgeParent::OnCallReceived(
979
        const Message& msg__,
980
        Message*& reply__) -> PContentBridgeParent::Result
981
0
{
982
0
    MOZ_ASSERT_UNREACHABLE("message protocol not supported");
983
0
    return MsgNotKnown;
984
0
}
985
986
auto PContentBridgeParent::GetProtocolTypeId() -> int32_t
987
0
{
988
0
    return PContentBridgeMsgStart;
989
0
}
990
991
auto PContentBridgeParent::OnChannelClose() -> void
992
0
{
993
0
    DestroySubtree(NormalShutdown);
994
0
    DeallocSubtree();
995
0
    DeallocShmems();
996
0
    DeallocPContentBridgeParent();
997
0
}
998
999
auto PContentBridgeParent::OnChannelError() -> void
1000
0
{
1001
0
    DestroySubtree(AbnormalShutdown);
1002
0
    DeallocSubtree();
1003
0
    DeallocShmems();
1004
0
    DeallocPContentBridgeParent();
1005
0
}
1006
1007
auto PContentBridgeParent::DestroySubtree(ActorDestroyReason why) -> void
1008
0
{
1009
0
    ActorDestroyReason subtreewhy = (((why) == (Deletion)) || ((why) == (FailedConstructor)) ? AncestorDeletion : why);
1010
0
1011
0
    {
1012
0
        // Recursively shutting down PBrowser kids
1013
0
        nsTArray<PBrowserParent*> kids;
1014
0
        // Accumulate kids into a stable structure to iterate over
1015
0
        ManagedPBrowserParent(kids);
1016
0
        for (auto& kid : kids) {
1017
0
            // Guarding against a child removing a sibling from the list during the iteration.
1018
0
            if ((mManagedPBrowserParent).Contains(kid)) {
1019
0
                (kid)->DestroySubtree(subtreewhy);
1020
0
            }
1021
0
        }
1022
0
    }
1023
0
    {
1024
0
        // Recursively shutting down PFileDescriptorSet kids
1025
0
        nsTArray<PFileDescriptorSetParent*> kids;
1026
0
        // Accumulate kids into a stable structure to iterate over
1027
0
        ManagedPFileDescriptorSetParent(kids);
1028
0
        for (auto& kid : kids) {
1029
0
            // Guarding against a child removing a sibling from the list during the iteration.
1030
0
            if ((mManagedPFileDescriptorSetParent).Contains(kid)) {
1031
0
                (kid)->DestroySubtree(subtreewhy);
1032
0
            }
1033
0
        }
1034
0
    }
1035
0
    {
1036
0
        // Recursively shutting down PJavaScript kids
1037
0
        nsTArray<PJavaScriptParent*> kids;
1038
0
        // Accumulate kids into a stable structure to iterate over
1039
0
        ManagedPJavaScriptParent(kids);
1040
0
        for (auto& kid : kids) {
1041
0
            // Guarding against a child removing a sibling from the list during the iteration.
1042
0
            if ((mManagedPJavaScriptParent).Contains(kid)) {
1043
0
                (kid)->DestroySubtree(subtreewhy);
1044
0
            }
1045
0
        }
1046
0
    }
1047
0
    {
1048
0
        // Recursively shutting down PChildToParentStream kids
1049
0
        nsTArray<PChildToParentStreamParent*> kids;
1050
0
        // Accumulate kids into a stable structure to iterate over
1051
0
        ManagedPChildToParentStreamParent(kids);
1052
0
        for (auto& kid : kids) {
1053
0
            // Guarding against a child removing a sibling from the list during the iteration.
1054
0
            if ((mManagedPChildToParentStreamParent).Contains(kid)) {
1055
0
                (kid)->DestroySubtree(subtreewhy);
1056
0
            }
1057
0
        }
1058
0
    }
1059
0
    {
1060
0
        // Recursively shutting down PParentToChildStream kids
1061
0
        nsTArray<PParentToChildStreamParent*> kids;
1062
0
        // Accumulate kids into a stable structure to iterate over
1063
0
        ManagedPParentToChildStreamParent(kids);
1064
0
        for (auto& kid : kids) {
1065
0
            // Guarding against a child removing a sibling from the list during the iteration.
1066
0
            if ((mManagedPParentToChildStreamParent).Contains(kid)) {
1067
0
                (kid)->DestroySubtree(subtreewhy);
1068
0
            }
1069
0
        }
1070
0
    }
1071
0
    {
1072
0
        // Recursively shutting down PIPCBlobInputStream kids
1073
0
        nsTArray<PIPCBlobInputStreamParent*> kids;
1074
0
        // Accumulate kids into a stable structure to iterate over
1075
0
        ManagedPIPCBlobInputStreamParent(kids);
1076
0
        for (auto& kid : kids) {
1077
0
            // Guarding against a child removing a sibling from the list during the iteration.
1078
0
            if ((mManagedPIPCBlobInputStreamParent).Contains(kid)) {
1079
0
                (kid)->DestroySubtree(subtreewhy);
1080
0
            }
1081
0
        }
1082
0
    }
1083
0
1084
0
    // Reject owning pending responses.
1085
0
    (GetIPCChannel())->RejectPendingResponsesForActor(this);
1086
0
1087
0
    // Finally, destroy "us".
1088
0
    ActorDestroy(why);
1089
0
}
1090
1091
auto PContentBridgeParent::DeallocSubtree() -> void
1092
0
{
1093
0
    {
1094
0
        // Recursively deleting PBrowser kids
1095
0
        for (auto iter = (mManagedPBrowserParent).Iter(); (!((iter).Done())); (iter).Next()) {
1096
0
            (((iter).Get())->GetKey())->DeallocSubtree();
1097
0
        }
1098
0
1099
0
        for (auto iter = (mManagedPBrowserParent).Iter(); (!((iter).Done())); (iter).Next()) {
1100
0
            DeallocPBrowserParent(((iter).Get())->GetKey());
1101
0
        }
1102
0
        (mManagedPBrowserParent).Clear();
1103
0
    }
1104
0
    {
1105
0
        // Recursively deleting PFileDescriptorSet kids
1106
0
        for (auto iter = (mManagedPFileDescriptorSetParent).Iter(); (!((iter).Done())); (iter).Next()) {
1107
0
            (((iter).Get())->GetKey())->DeallocSubtree();
1108
0
        }
1109
0
1110
0
        for (auto iter = (mManagedPFileDescriptorSetParent).Iter(); (!((iter).Done())); (iter).Next()) {
1111
0
            DeallocPFileDescriptorSetParent(((iter).Get())->GetKey());
1112
0
        }
1113
0
        (mManagedPFileDescriptorSetParent).Clear();
1114
0
    }
1115
0
    {
1116
0
        // Recursively deleting PJavaScript kids
1117
0
        for (auto iter = (mManagedPJavaScriptParent).Iter(); (!((iter).Done())); (iter).Next()) {
1118
0
            (((iter).Get())->GetKey())->DeallocSubtree();
1119
0
        }
1120
0
1121
0
        for (auto iter = (mManagedPJavaScriptParent).Iter(); (!((iter).Done())); (iter).Next()) {
1122
0
            DeallocPJavaScriptParent(((iter).Get())->GetKey());
1123
0
        }
1124
0
        (mManagedPJavaScriptParent).Clear();
1125
0
    }
1126
0
    {
1127
0
        // Recursively deleting PChildToParentStream kids
1128
0
        for (auto iter = (mManagedPChildToParentStreamParent).Iter(); (!((iter).Done())); (iter).Next()) {
1129
0
            (((iter).Get())->GetKey())->DeallocSubtree();
1130
0
        }
1131
0
1132
0
        for (auto iter = (mManagedPChildToParentStreamParent).Iter(); (!((iter).Done())); (iter).Next()) {
1133
0
            DeallocPChildToParentStreamParent(((iter).Get())->GetKey());
1134
0
        }
1135
0
        (mManagedPChildToParentStreamParent).Clear();
1136
0
    }
1137
0
    {
1138
0
        // Recursively deleting PParentToChildStream kids
1139
0
        for (auto iter = (mManagedPParentToChildStreamParent).Iter(); (!((iter).Done())); (iter).Next()) {
1140
0
            (((iter).Get())->GetKey())->DeallocSubtree();
1141
0
        }
1142
0
1143
0
        for (auto iter = (mManagedPParentToChildStreamParent).Iter(); (!((iter).Done())); (iter).Next()) {
1144
0
            DeallocPParentToChildStreamParent(((iter).Get())->GetKey());
1145
0
        }
1146
0
        (mManagedPParentToChildStreamParent).Clear();
1147
0
    }
1148
0
    {
1149
0
        // Recursively deleting PIPCBlobInputStream kids
1150
0
        for (auto iter = (mManagedPIPCBlobInputStreamParent).Iter(); (!((iter).Done())); (iter).Next()) {
1151
0
            (((iter).Get())->GetKey())->DeallocSubtree();
1152
0
        }
1153
0
1154
0
        for (auto iter = (mManagedPIPCBlobInputStreamParent).Iter(); (!((iter).Done())); (iter).Next()) {
1155
0
            DeallocPIPCBlobInputStreamParent(((iter).Get())->GetKey());
1156
0
        }
1157
0
        (mManagedPIPCBlobInputStreamParent).Clear();
1158
0
    }
1159
0
}
1160
1161
auto PContentBridgeParent::DeallocPContentBridgeParent() -> void
1162
0
{
1163
0
}
1164
1165
1166
1167
} // namespace dom
1168
} // namespace mozilla
1169
namespace mozilla {
1170
namespace ipc {
1171
auto IPDLParamTraits<mozilla::dom::PContentBridgeParent>::Write(
1172
        IPC::Message* aMsg,
1173
        mozilla::ipc::IProtocol* aActor,
1174
        const paramType& aVar) -> void
1175
0
{
1176
0
    int32_t id;
1177
0
    if ((!(aVar))) {
1178
0
        id = 0;
1179
0
    }
1180
0
    else {
1181
0
        id = (aVar)->Id();
1182
0
        if ((1) == (id)) {
1183
0
            (aActor)->FatalError("actor has been |delete|d");
1184
0
        }
1185
0
    }
1186
0
    WriteIPDLParam(aMsg, aActor, id);
1187
0
}
1188
1189
auto IPDLParamTraits<mozilla::dom::PContentBridgeParent>::Read(
1190
        const IPC::Message* aMsg,
1191
        PickleIterator* aIter,
1192
        mozilla::ipc::IProtocol* aActor,
1193
        paramType* aVar) -> bool
1194
0
{
1195
0
    mozilla::Maybe<mozilla::ipc::IProtocol*> actor = (aActor)->ReadActor(aMsg, aIter, true, "PContentBridge", PContentBridgeMsgStart);
1196
0
    if ((actor).isNothing()) {
1197
0
        return false;
1198
0
    }
1199
0
1200
0
    (*(aVar)) = static_cast<mozilla::dom::PContentBridgeParent*>((actor).value());
1201
0
    return true;
1202
0
}
1203
1204
} // namespace ipc
1205
} // namespace mozilla