Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/ipc/ipdl/PWebBrowserPersistDocumentParent.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/PWebBrowserPersistDocumentParent.h"
8
9
#include "mozilla/dom/PContentParent.h"
10
#include "mozilla/PWebBrowserPersistResourcesParent.h"
11
#include "mozilla/PWebBrowserPersistSerializeParent.h"
12
#include "mozilla/ipc/PFileDescriptorSetParent.h"
13
#include "mozilla/ipc/PChildToParentStreamParent.h"
14
#include "mozilla/ipc/PParentToChildStreamParent.h"
15
16
#include "nsIFile.h"
17
#include "GeckoProfiler.h"
18
19
namespace mozilla {
20
21
22
auto PWebBrowserPersistDocumentParent::ActorDestroy(ActorDestroyReason aWhy) -> void
23
0
{
24
0
}
25
26
MOZ_IMPLICIT PWebBrowserPersistDocumentParent::PWebBrowserPersistDocumentParent() :
27
    mozilla::ipc::IProtocol(mozilla::ipc::ParentSide),
28
    mLivenessState(mozilla::ipc::LivenessState::Dead)
29
0
{
30
0
    MOZ_COUNT_CTOR(PWebBrowserPersistDocumentParent);
31
0
}
32
33
PWebBrowserPersistDocumentParent::~PWebBrowserPersistDocumentParent()
34
0
{
35
0
    MOZ_COUNT_DTOR(PWebBrowserPersistDocumentParent);
36
0
}
37
38
auto PWebBrowserPersistDocumentParent::Manager() const -> PContentParent*
39
0
{
40
0
    return static_cast<PContentParent*>(IProtocol::Manager());
41
0
}
42
43
auto PWebBrowserPersistDocumentParent::ManagedPWebBrowserPersistResourcesParent(nsTArray<PWebBrowserPersistResourcesParent*>& aArr) const -> void
44
0
{
45
0
    (mManagedPWebBrowserPersistResourcesParent).ToArray(aArr);
46
0
}
47
48
auto PWebBrowserPersistDocumentParent::ManagedPWebBrowserPersistResourcesParent() const -> const ManagedContainer<PWebBrowserPersistResourcesParent>&
49
0
{
50
0
    return mManagedPWebBrowserPersistResourcesParent;
51
0
}
52
53
auto PWebBrowserPersistDocumentParent::ManagedPWebBrowserPersistSerializeParent(nsTArray<PWebBrowserPersistSerializeParent*>& aArr) const -> void
54
0
{
55
0
    (mManagedPWebBrowserPersistSerializeParent).ToArray(aArr);
56
0
}
57
58
auto PWebBrowserPersistDocumentParent::ManagedPWebBrowserPersistSerializeParent() const -> const ManagedContainer<PWebBrowserPersistSerializeParent>&
59
0
{
60
0
    return mManagedPWebBrowserPersistSerializeParent;
61
0
}
62
63
auto PWebBrowserPersistDocumentParent::SendSetPersistFlags(const uint32_t& aNewFlags) -> bool
64
0
{
65
0
    IPC::Message* msg__ = PWebBrowserPersistDocument::Msg_SetPersistFlags(Id());
66
0
67
0
    WriteIPDLParam(msg__, this, aNewFlags);
68
0
    // Sentinel = 'aNewFlags'
69
0
    (msg__)->WriteSentinel(4032949079);
70
0
71
0
72
0
73
0
74
0
    if (mozilla::ipc::LoggingEnabledFor("PWebBrowserPersistDocumentParent")) {
75
0
        mozilla::ipc::LogMessageForProtocol("PWebBrowserPersistDocumentParent", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
76
0
    }
77
0
    AUTO_PROFILER_LABEL("PWebBrowserPersistDocument::Msg_SetPersistFlags", OTHER);
78
0
    if ((!(StateTransition(false, (&(mLivenessState)))))) {
79
0
        mozilla::ipc::LogicError("Transition error");
80
0
    }
81
0
82
0
    bool sendok__ = (GetIPCChannel())->Send(msg__);
83
0
    return sendok__;
84
0
}
85
86
auto PWebBrowserPersistDocumentParent::SendPWebBrowserPersistResourcesConstructor() -> PWebBrowserPersistResourcesParent*
87
0
{
88
0
    return SendPWebBrowserPersistResourcesConstructor(AllocPWebBrowserPersistResourcesParent());
89
0
}
90
91
auto PWebBrowserPersistDocumentParent::SendPWebBrowserPersistResourcesConstructor(PWebBrowserPersistResourcesParent* actor) -> PWebBrowserPersistResourcesParent*
92
0
{
93
0
    if ((!(actor))) {
94
0
        NS_WARNING("Error constructing actor PWebBrowserPersistResourcesParent");
95
0
        return nullptr;
96
0
    }
97
0
    (actor)->SetManagerAndRegister(this);
98
0
    (mManagedPWebBrowserPersistResourcesParent).PutEntry(actor);
99
0
    (actor)->mLivenessState = mozilla::ipc::LivenessState::Start;
100
0
101
0
    IPC::Message* msg__ = PWebBrowserPersistDocument::Msg_PWebBrowserPersistResourcesConstructor(Id());
102
0
103
0
    MOZ_RELEASE_ASSERT(actor, "NULL actor value passed to non-nullable param");
104
0
    WriteIPDLParam(msg__, this, actor);
105
0
    // Sentinel = 'actor'
106
0
    (msg__)->WriteSentinel(875202478);
107
0
108
0
109
0
110
0
    if (mozilla::ipc::LoggingEnabledFor("PWebBrowserPersistDocumentParent")) {
111
0
        mozilla::ipc::LogMessageForProtocol("PWebBrowserPersistDocumentParent", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
112
0
    }
113
0
    AUTO_PROFILER_LABEL("PWebBrowserPersistDocument::Msg_PWebBrowserPersistResourcesConstructor", OTHER);
114
0
    if ((!(StateTransition(false, (&(mLivenessState)))))) {
115
0
        mozilla::ipc::LogicError("Transition error");
116
0
    }
117
0
118
0
    bool sendok__ = (GetIPCChannel())->Send(msg__);
119
0
    if ((!(sendok__))) {
120
0
        IProtocol* mgr = (actor)->Manager();
121
0
        (actor)->DestroySubtree(FailedConstructor);
122
0
        (actor)->DeallocSubtree();
123
0
        (mgr)->RemoveManagee(PWebBrowserPersistResourcesMsgStart, actor);
124
0
        return nullptr;
125
0
    }
126
0
    return actor;
127
0
}
128
129
auto PWebBrowserPersistDocumentParent::SendPWebBrowserPersistSerializeConstructor(
130
        const WebBrowserPersistURIMap& aMap,
131
        const nsCString& aRequestedContentType,
132
        const uint32_t& aEncoderFlags,
133
        const uint32_t& aWrapColumn) -> PWebBrowserPersistSerializeParent*
134
0
{
135
0
    return SendPWebBrowserPersistSerializeConstructor(AllocPWebBrowserPersistSerializeParent(aMap, aRequestedContentType, aEncoderFlags, aWrapColumn), aMap, aRequestedContentType, aEncoderFlags, aWrapColumn);
136
0
}
137
138
auto PWebBrowserPersistDocumentParent::SendPWebBrowserPersistSerializeConstructor(
139
        PWebBrowserPersistSerializeParent* actor,
140
        const WebBrowserPersistURIMap& aMap,
141
        const nsCString& aRequestedContentType,
142
        const uint32_t& aEncoderFlags,
143
        const uint32_t& aWrapColumn) -> PWebBrowserPersistSerializeParent*
144
0
{
145
0
    if ((!(actor))) {
146
0
        NS_WARNING("Error constructing actor PWebBrowserPersistSerializeParent");
147
0
        return nullptr;
148
0
    }
149
0
    (actor)->SetManagerAndRegister(this);
150
0
    (mManagedPWebBrowserPersistSerializeParent).PutEntry(actor);
151
0
    (actor)->mLivenessState = mozilla::ipc::LivenessState::Start;
152
0
153
0
    IPC::Message* msg__ = PWebBrowserPersistDocument::Msg_PWebBrowserPersistSerializeConstructor(Id());
154
0
155
0
    MOZ_RELEASE_ASSERT(actor, "NULL actor value passed to non-nullable param");
156
0
    WriteIPDLParam(msg__, this, actor);
157
0
    // Sentinel = 'actor'
158
0
    (msg__)->WriteSentinel(875202478);
159
0
    WriteIPDLParam(msg__, this, aMap);
160
0
    // Sentinel = 'aMap'
161
0
    (msg__)->WriteSentinel(3570578933);
162
0
    WriteIPDLParam(msg__, this, aRequestedContentType);
163
0
    // Sentinel = 'aRequestedContentType'
164
0
    (msg__)->WriteSentinel(193281947);
165
0
    WriteIPDLParam(msg__, this, aEncoderFlags);
166
0
    // Sentinel = 'aEncoderFlags'
167
0
    (msg__)->WriteSentinel(1146908877);
168
0
    WriteIPDLParam(msg__, this, aWrapColumn);
169
0
    // Sentinel = 'aWrapColumn'
170
0
    (msg__)->WriteSentinel(3600022264);
171
0
172
0
173
0
174
0
    if (mozilla::ipc::LoggingEnabledFor("PWebBrowserPersistDocumentParent")) {
175
0
        mozilla::ipc::LogMessageForProtocol("PWebBrowserPersistDocumentParent", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
176
0
    }
177
0
    AUTO_PROFILER_LABEL("PWebBrowserPersistDocument::Msg_PWebBrowserPersistSerializeConstructor", OTHER);
178
0
    if ((!(StateTransition(false, (&(mLivenessState)))))) {
179
0
        mozilla::ipc::LogicError("Transition error");
180
0
    }
181
0
182
0
    bool sendok__ = (GetIPCChannel())->Send(msg__);
183
0
    if ((!(sendok__))) {
184
0
        IProtocol* mgr = (actor)->Manager();
185
0
        (actor)->DestroySubtree(FailedConstructor);
186
0
        (actor)->DeallocSubtree();
187
0
        (mgr)->RemoveManagee(PWebBrowserPersistSerializeMsgStart, actor);
188
0
        return nullptr;
189
0
    }
190
0
    return actor;
191
0
}
192
193
auto PWebBrowserPersistDocumentParent::Send__delete__(PWebBrowserPersistDocumentParent* actor) -> bool
194
0
{
195
0
    if ((!(actor))) {
196
0
        return false;
197
0
    }
198
0
199
0
    IPC::Message* msg__ = PWebBrowserPersistDocument::Msg___delete__((actor)->Id());
200
0
201
0
    MOZ_RELEASE_ASSERT(actor, "NULL actor value passed to non-nullable param");
202
0
    WriteIPDLParam(msg__, actor, actor);
203
0
    // Sentinel = 'actor'
204
0
    (msg__)->WriteSentinel(875202478);
205
0
206
0
207
0
208
0
    if (mozilla::ipc::LoggingEnabledFor("PWebBrowserPersistDocumentParent")) {
209
0
        mozilla::ipc::LogMessageForProtocol("PWebBrowserPersistDocumentParent", (actor)->OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
210
0
    }
211
0
    AUTO_PROFILER_LABEL("PWebBrowserPersistDocument::Msg___delete__", OTHER);
212
0
    if ((!(StateTransition(true, (&((actor)->mLivenessState)))))) {
213
0
        mozilla::ipc::LogicError("Transition error");
214
0
    }
215
0
216
0
    bool sendok__ = ((actor)->GetIPCChannel())->Send(msg__);
217
0
218
0
    IProtocol* mgr = (actor)->Manager();
219
0
    (actor)->DestroySubtree(Deletion);
220
0
    (actor)->DeallocSubtree();
221
0
    (mgr)->RemoveManagee(PWebBrowserPersistDocumentMsgStart, actor);
222
0
    return sendok__;
223
0
}
224
225
auto PWebBrowserPersistDocumentParent::RemoveManagee(
226
        int32_t aProtocolId,
227
        IProtocol* aListener) -> void
228
0
{
229
0
    switch (aProtocolId) {
230
0
    case PWebBrowserPersistResourcesMsgStart:
231
0
        {
232
0
            PWebBrowserPersistResourcesParent* actor = static_cast<PWebBrowserPersistResourcesParent*>(aListener);
233
0
            auto& container = mManagedPWebBrowserPersistResourcesParent;
234
0
            MOZ_RELEASE_ASSERT((container).Contains(actor), "actor not managed by this!");
235
0
236
0
            (container).RemoveEntry(actor);
237
0
            DeallocPWebBrowserPersistResourcesParent(actor);
238
0
            return;
239
0
        }
240
0
    case PWebBrowserPersistSerializeMsgStart:
241
0
        {
242
0
            PWebBrowserPersistSerializeParent* actor = static_cast<PWebBrowserPersistSerializeParent*>(aListener);
243
0
            auto& container = mManagedPWebBrowserPersistSerializeParent;
244
0
            MOZ_RELEASE_ASSERT((container).Contains(actor), "actor not managed by this!");
245
0
246
0
            (container).RemoveEntry(actor);
247
0
            DeallocPWebBrowserPersistSerializeParent(actor);
248
0
            return;
249
0
        }
250
0
    default:
251
0
        {
252
0
            FatalError("unreached");
253
0
            return;
254
0
        }
255
0
    }
256
0
}
257
258
auto PWebBrowserPersistDocumentParent::OnMessageReceived(const Message& msg__) -> PWebBrowserPersistDocumentParent::Result
259
0
{
260
0
    switch ((msg__).type()) {
261
0
    case PWebBrowserPersistDocument::Msg_Attributes__ID:
262
0
        {
263
0
            if (mozilla::ipc::LoggingEnabledFor("PWebBrowserPersistDocumentParent")) {
264
0
                mozilla::ipc::LogMessageForProtocol("PWebBrowserPersistDocumentParent", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
265
0
            }
266
0
            AUTO_PROFILER_LABEL("PWebBrowserPersistDocument::Msg_Attributes", OTHER);
267
0
268
0
            PickleIterator iter__(msg__);
269
0
            WebBrowserPersistDocumentAttrs aAttrs;
270
0
            OptionalIPCStream stream;
271
0
272
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(aAttrs)))))) {
273
0
                FatalError("Error deserializing 'WebBrowserPersistDocumentAttrs'");
274
0
                return MsgValueError;
275
0
            }
276
0
            // Sentinel = 'aAttrs'
277
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 2405661289)))) {
278
0
                mozilla::ipc::SentinelReadError("Error deserializing 'WebBrowserPersistDocumentAttrs'");
279
0
                return MsgValueError;
280
0
            }
281
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(stream)))))) {
282
0
                FatalError("Error deserializing 'OptionalIPCStream'");
283
0
                return MsgValueError;
284
0
            }
285
0
            // Sentinel = 'stream'
286
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 4152748422)))) {
287
0
                mozilla::ipc::SentinelReadError("Error deserializing 'OptionalIPCStream'");
288
0
                return MsgValueError;
289
0
            }
290
0
            (msg__).EndRead(iter__, (msg__).type());
291
0
            if ((!(StateTransition(false, (&(mLivenessState)))))) {
292
0
                FatalError("Transition error");
293
0
                return MsgValueError;
294
0
            }
295
0
            if ((!(RecvAttributes(aAttrs, stream)))) {
296
0
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
297
0
                // Error handled in mozilla::ipc::IPCResult
298
0
                return MsgProcessingError;
299
0
            }
300
0
301
0
            return MsgProcessed;
302
0
        }
303
0
    case PWebBrowserPersistDocument::Msg_InitFailure__ID:
304
0
        {
305
0
            if (mozilla::ipc::LoggingEnabledFor("PWebBrowserPersistDocumentParent")) {
306
0
                mozilla::ipc::LogMessageForProtocol("PWebBrowserPersistDocumentParent", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
307
0
            }
308
0
            AUTO_PROFILER_LABEL("PWebBrowserPersistDocument::Msg_InitFailure", OTHER);
309
0
310
0
            PickleIterator iter__(msg__);
311
0
            nsresult aStatus;
312
0
313
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(aStatus)))))) {
314
0
                FatalError("Error deserializing 'nsresult'");
315
0
                return MsgValueError;
316
0
            }
317
0
            // Sentinel = 'aStatus'
318
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 236002576)))) {
319
0
                mozilla::ipc::SentinelReadError("Error deserializing 'nsresult'");
320
0
                return MsgValueError;
321
0
            }
322
0
            (msg__).EndRead(iter__, (msg__).type());
323
0
            if ((!(StateTransition(false, (&(mLivenessState)))))) {
324
0
                FatalError("Transition error");
325
0
                return MsgValueError;
326
0
            }
327
0
            if ((!(RecvInitFailure(aStatus)))) {
328
0
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
329
0
                // Error handled in mozilla::ipc::IPCResult
330
0
                return MsgProcessingError;
331
0
            }
332
0
333
0
            return MsgProcessed;
334
0
        }
335
0
    case PWebBrowserPersistDocument::Reply_PWebBrowserPersistResourcesConstructor__ID:
336
0
        {
337
0
            return MsgProcessed;
338
0
        }
339
0
    case PWebBrowserPersistDocument::Reply_PWebBrowserPersistSerializeConstructor__ID:
340
0
        {
341
0
            return MsgProcessed;
342
0
        }
343
0
    case PWebBrowserPersistDocument::Reply___delete____ID:
344
0
        {
345
0
            return MsgProcessed;
346
0
        }
347
0
    default:
348
0
        {
349
0
            return MsgNotKnown;
350
0
        }
351
0
    }
352
0
}
353
354
auto PWebBrowserPersistDocumentParent::OnMessageReceived(
355
        const Message& msg__,
356
        Message*& reply__) -> PWebBrowserPersistDocumentParent::Result
357
0
{
358
0
    return MsgNotKnown;
359
0
}
360
361
auto PWebBrowserPersistDocumentParent::OnCallReceived(
362
        const Message& msg__,
363
        Message*& reply__) -> PWebBrowserPersistDocumentParent::Result
364
0
{
365
0
    MOZ_ASSERT_UNREACHABLE("message protocol not supported");
366
0
    return MsgNotKnown;
367
0
}
368
369
auto PWebBrowserPersistDocumentParent::GetProtocolTypeId() -> int32_t
370
0
{
371
0
    return PWebBrowserPersistDocumentMsgStart;
372
0
}
373
374
auto PWebBrowserPersistDocumentParent::DestroySubtree(ActorDestroyReason why) -> void
375
0
{
376
0
    // Unregister from our manager.
377
0
    Unregister(Id());
378
0
379
0
    ActorDestroyReason subtreewhy = (((why) == (Deletion)) || ((why) == (FailedConstructor)) ? AncestorDeletion : why);
380
0
381
0
    {
382
0
        // Recursively shutting down PWebBrowserPersistResources kids
383
0
        nsTArray<PWebBrowserPersistResourcesParent*> kids;
384
0
        // Accumulate kids into a stable structure to iterate over
385
0
        ManagedPWebBrowserPersistResourcesParent(kids);
386
0
        for (auto& kid : kids) {
387
0
            // Guarding against a child removing a sibling from the list during the iteration.
388
0
            if ((mManagedPWebBrowserPersistResourcesParent).Contains(kid)) {
389
0
                (kid)->DestroySubtree(subtreewhy);
390
0
            }
391
0
        }
392
0
    }
393
0
    {
394
0
        // Recursively shutting down PWebBrowserPersistSerialize kids
395
0
        nsTArray<PWebBrowserPersistSerializeParent*> kids;
396
0
        // Accumulate kids into a stable structure to iterate over
397
0
        ManagedPWebBrowserPersistSerializeParent(kids);
398
0
        for (auto& kid : kids) {
399
0
            // Guarding against a child removing a sibling from the list during the iteration.
400
0
            if ((mManagedPWebBrowserPersistSerializeParent).Contains(kid)) {
401
0
                (kid)->DestroySubtree(subtreewhy);
402
0
            }
403
0
        }
404
0
    }
405
0
406
0
    // Reject owning pending responses.
407
0
    (GetIPCChannel())->RejectPendingResponsesForActor(this);
408
0
409
0
    // Finally, destroy "us".
410
0
    ActorDestroy(why);
411
0
}
412
413
auto PWebBrowserPersistDocumentParent::DeallocSubtree() -> void
414
0
{
415
0
    {
416
0
        // Recursively deleting PWebBrowserPersistResources kids
417
0
        for (auto iter = (mManagedPWebBrowserPersistResourcesParent).Iter(); (!((iter).Done())); (iter).Next()) {
418
0
            (((iter).Get())->GetKey())->DeallocSubtree();
419
0
        }
420
0
421
0
        for (auto iter = (mManagedPWebBrowserPersistResourcesParent).Iter(); (!((iter).Done())); (iter).Next()) {
422
0
            DeallocPWebBrowserPersistResourcesParent(((iter).Get())->GetKey());
423
0
        }
424
0
        (mManagedPWebBrowserPersistResourcesParent).Clear();
425
0
    }
426
0
    {
427
0
        // Recursively deleting PWebBrowserPersistSerialize kids
428
0
        for (auto iter = (mManagedPWebBrowserPersistSerializeParent).Iter(); (!((iter).Done())); (iter).Next()) {
429
0
            (((iter).Get())->GetKey())->DeallocSubtree();
430
0
        }
431
0
432
0
        for (auto iter = (mManagedPWebBrowserPersistSerializeParent).Iter(); (!((iter).Done())); (iter).Next()) {
433
0
            DeallocPWebBrowserPersistSerializeParent(((iter).Get())->GetKey());
434
0
        }
435
0
        (mManagedPWebBrowserPersistSerializeParent).Clear();
436
0
    }
437
0
}
438
439
440
441
} // namespace mozilla
442
namespace mozilla {
443
namespace ipc {
444
auto IPDLParamTraits<mozilla::PWebBrowserPersistDocumentParent>::Write(
445
        IPC::Message* aMsg,
446
        mozilla::ipc::IProtocol* aActor,
447
        const paramType& aVar) -> void
448
0
{
449
0
    int32_t id;
450
0
    if ((!(aVar))) {
451
0
        id = 0;
452
0
    }
453
0
    else {
454
0
        id = (aVar)->Id();
455
0
        if ((1) == (id)) {
456
0
            (aActor)->FatalError("actor has been |delete|d");
457
0
        }
458
0
    }
459
0
    WriteIPDLParam(aMsg, aActor, id);
460
0
}
461
462
auto IPDLParamTraits<mozilla::PWebBrowserPersistDocumentParent>::Read(
463
        const IPC::Message* aMsg,
464
        PickleIterator* aIter,
465
        mozilla::ipc::IProtocol* aActor,
466
        paramType* aVar) -> bool
467
0
{
468
0
    mozilla::Maybe<mozilla::ipc::IProtocol*> actor = (aActor)->ReadActor(aMsg, aIter, true, "PWebBrowserPersistDocument", PWebBrowserPersistDocumentMsgStart);
469
0
    if ((actor).isNothing()) {
470
0
        return false;
471
0
    }
472
0
473
0
    (*(aVar)) = static_cast<mozilla::PWebBrowserPersistDocumentParent*>((actor).value());
474
0
    return true;
475
0
}
476
477
} // namespace ipc
478
} // namespace mozilla