Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/ipc/ipdl/PServiceWorkerRegistrationChild.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/PServiceWorkerRegistrationChild.h"
8
9
#include "mozilla/ipc/PBackgroundChild.h"
10
11
#include "nsIFile.h"
12
#include "GeckoProfiler.h"
13
14
namespace mozilla {
15
namespace dom {
16
17
18
auto PServiceWorkerRegistrationChild::Recv__delete__() -> mozilla::ipc::IPCResult
19
0
{
20
0
    return IPC_OK();
21
0
}
22
23
auto PServiceWorkerRegistrationChild::ActorDestroy(ActorDestroyReason aWhy) -> void
24
0
{
25
0
}
26
27
MOZ_IMPLICIT PServiceWorkerRegistrationChild::PServiceWorkerRegistrationChild() :
28
    mozilla::ipc::IProtocol(mozilla::ipc::ChildSide),
29
    mLivenessState(mozilla::ipc::LivenessState::Dead)
30
0
{
31
0
    MOZ_COUNT_CTOR(PServiceWorkerRegistrationChild);
32
0
}
33
34
PServiceWorkerRegistrationChild::~PServiceWorkerRegistrationChild()
35
0
{
36
0
    MOZ_COUNT_DTOR(PServiceWorkerRegistrationChild);
37
0
}
38
39
auto PServiceWorkerRegistrationChild::Manager() const -> PBackgroundChild*
40
0
{
41
0
    return static_cast<PBackgroundChild*>(IProtocol::Manager());
42
0
}
43
44
auto PServiceWorkerRegistrationChild::SendTeardown() -> bool
45
0
{
46
0
    IPC::Message* msg__ = PServiceWorkerRegistration::Msg_Teardown(Id());
47
0
48
0
49
0
50
0
51
0
52
0
    if (mozilla::ipc::LoggingEnabledFor("PServiceWorkerRegistrationChild")) {
53
0
        mozilla::ipc::LogMessageForProtocol("PServiceWorkerRegistrationChild", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
54
0
    }
55
0
    AUTO_PROFILER_LABEL("PServiceWorkerRegistration::Msg_Teardown", OTHER);
56
0
    if ((!(StateTransition(false, (&(mLivenessState)))))) {
57
0
        mozilla::ipc::LogicError("Transition error");
58
0
    }
59
0
60
0
    bool sendok__ = (GetIPCChannel())->Send(msg__);
61
0
    return sendok__;
62
0
}
63
64
auto PServiceWorkerRegistrationChild::SendUnregister(
65
        mozilla::ipc::ResolveCallback<Tuple<bool, CopyableErrorResult>>&& aResolve,
66
        mozilla::ipc::RejectCallback&& aReject) -> void
67
0
{
68
0
    IPC::Message* msg__ = PServiceWorkerRegistration::Msg_Unregister(Id());
69
0
70
0
71
0
72
0
73
0
74
0
    if (mozilla::ipc::LoggingEnabledFor("PServiceWorkerRegistrationChild")) {
75
0
        mozilla::ipc::LogMessageForProtocol("PServiceWorkerRegistrationChild", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
76
0
    }
77
0
    AUTO_PROFILER_LABEL("PServiceWorkerRegistration::Msg_Unregister", OTHER);
78
0
    if ((!(StateTransition(false, (&(mLivenessState)))))) {
79
0
        mozilla::ipc::LogicError("Transition error");
80
0
    }
81
0
82
0
    (GetIPCChannel())->Send(msg__, this, std::move(aResolve), std::move(aReject));
83
0
    return;
84
0
}
85
86
auto PServiceWorkerRegistrationChild::SendUnregister() -> RefPtr<UnregisterPromise>
87
0
{
88
0
89
0
    RefPtr<MozPromise<Tuple<bool, CopyableErrorResult>, ResponseRejectReason, false>::Private> promise__ = new MozPromise<Tuple<bool, CopyableErrorResult>, ResponseRejectReason, false>::Private(__func__);
90
0
91
0
    SendUnregister([promise__](Tuple<bool, CopyableErrorResult>&& aValue) {
92
0
        (promise__)->Resolve(std::move(aValue), __func__);
93
0
    }, [promise__](ResponseRejectReason aReason) {
94
0
        (promise__)->Reject(aReason, __func__);
95
0
    });
96
0
    return promise__;
97
0
}
98
99
auto PServiceWorkerRegistrationChild::SendUpdate(
100
        mozilla::ipc::ResolveCallback<IPCServiceWorkerRegistrationDescriptorOrCopyableErrorResult>&& aResolve,
101
        mozilla::ipc::RejectCallback&& aReject) -> void
102
0
{
103
0
    IPC::Message* msg__ = PServiceWorkerRegistration::Msg_Update(Id());
104
0
105
0
106
0
107
0
108
0
109
0
    if (mozilla::ipc::LoggingEnabledFor("PServiceWorkerRegistrationChild")) {
110
0
        mozilla::ipc::LogMessageForProtocol("PServiceWorkerRegistrationChild", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
111
0
    }
112
0
    AUTO_PROFILER_LABEL("PServiceWorkerRegistration::Msg_Update", OTHER);
113
0
    if ((!(StateTransition(false, (&(mLivenessState)))))) {
114
0
        mozilla::ipc::LogicError("Transition error");
115
0
    }
116
0
117
0
    (GetIPCChannel())->Send(msg__, this, std::move(aResolve), std::move(aReject));
118
0
    return;
119
0
}
120
121
auto PServiceWorkerRegistrationChild::SendUpdate() -> RefPtr<UpdatePromise>
122
0
{
123
0
124
0
    RefPtr<MozPromise<IPCServiceWorkerRegistrationDescriptorOrCopyableErrorResult, ResponseRejectReason, false>::Private> promise__ = new MozPromise<IPCServiceWorkerRegistrationDescriptorOrCopyableErrorResult, ResponseRejectReason, false>::Private(__func__);
125
0
126
0
    SendUpdate([promise__](IPCServiceWorkerRegistrationDescriptorOrCopyableErrorResult&& aValue) {
127
0
        (promise__)->Resolve(std::move(aValue), __func__);
128
0
    }, [promise__](ResponseRejectReason aReason) {
129
0
        (promise__)->Reject(aReason, __func__);
130
0
    });
131
0
    return promise__;
132
0
}
133
134
auto PServiceWorkerRegistrationChild::RemoveManagee(
135
        int32_t aProtocolId,
136
        IProtocol* aListener) -> void
137
0
{
138
0
    FatalError("unreached");
139
0
    return;
140
0
}
141
142
auto PServiceWorkerRegistrationChild::OnMessageReceived(const Message& msg__) -> PServiceWorkerRegistrationChild::Result
143
0
{
144
0
    switch ((msg__).type()) {
145
0
    case PServiceWorkerRegistration::Reply_Unregister__ID:
146
0
        {
147
0
            if (mozilla::ipc::LoggingEnabledFor("PServiceWorkerRegistrationChild")) {
148
0
                mozilla::ipc::LogMessageForProtocol("PServiceWorkerRegistrationChild", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
149
0
            }
150
0
            AUTO_PROFILER_LABEL("PServiceWorkerRegistration::Msg_Unregister", OTHER);
151
0
152
0
            PickleIterator iter__(msg__);
153
0
            bool resolve__;
154
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(resolve__)))))) {
155
0
                FatalError("Error deserializing 'resolve__'");
156
0
                return MsgValueError;
157
0
            }
158
0
            // Sentinel = 'resolve__'
159
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 3997392463)))) {
160
0
                mozilla::ipc::SentinelReadError("Error deserializing 'resolve__'");
161
0
                return MsgValueError;
162
0
            }
163
0
164
0
            UniquePtr<MessageChannel::UntypedCallbackHolder> untypedCallback = (GetIPCChannel())->PopCallback(msg__);
165
0
            MessageChannel::CallbackHolder<Tuple<bool, CopyableErrorResult>>* callback = static_cast<MessageChannel::CallbackHolder<Tuple<bool, CopyableErrorResult>>*>((untypedCallback).get());
166
0
            if ((!(callback))) {
167
0
                FatalError("Error unknown callback");
168
0
                return MsgProcessingError;
169
0
            }
170
0
            if (resolve__) {
171
0
                bool aSuccess;
172
0
                CopyableErrorResult aRv;
173
0
174
0
                if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(aSuccess)))))) {
175
0
                    FatalError("Error deserializing 'bool'");
176
0
                    return MsgValueError;
177
0
                }
178
0
                // Sentinel = 'aSuccess'
179
0
                if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 2132928722)))) {
180
0
                    mozilla::ipc::SentinelReadError("Error deserializing 'bool'");
181
0
                    return MsgValueError;
182
0
                }
183
0
                if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(aRv)))))) {
184
0
                    FatalError("Error deserializing 'CopyableErrorResult'");
185
0
                    return MsgValueError;
186
0
                }
187
0
                // Sentinel = 'aRv'
188
0
                if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 2742041894)))) {
189
0
                    mozilla::ipc::SentinelReadError("Error deserializing 'CopyableErrorResult'");
190
0
                    return MsgValueError;
191
0
                }
192
0
                (msg__).EndRead(iter__, (msg__).type());
193
0
                (callback)->Resolve(MakeTuple(std::move(aSuccess), std::move(aRv)));
194
0
            }
195
0
            else {
196
0
                ResponseRejectReason reason__;
197
0
                if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(reason__)))))) {
198
0
                    FatalError("Error deserializing 'reason__'");
199
0
                    return MsgValueError;
200
0
                }
201
0
                // Sentinel = 'reason__'
202
0
                if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 913452670)))) {
203
0
                    mozilla::ipc::SentinelReadError("Error deserializing 'reason__'");
204
0
                    return MsgValueError;
205
0
                }
206
0
                (msg__).EndRead(iter__, (msg__).type());
207
0
                (callback)->Reject(reason__);
208
0
            }
209
0
            return MsgProcessed;
210
0
        }
211
0
    case PServiceWorkerRegistration::Reply_Update__ID:
212
0
        {
213
0
            if (mozilla::ipc::LoggingEnabledFor("PServiceWorkerRegistrationChild")) {
214
0
                mozilla::ipc::LogMessageForProtocol("PServiceWorkerRegistrationChild", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
215
0
            }
216
0
            AUTO_PROFILER_LABEL("PServiceWorkerRegistration::Msg_Update", OTHER);
217
0
218
0
            PickleIterator iter__(msg__);
219
0
            bool resolve__;
220
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(resolve__)))))) {
221
0
                FatalError("Error deserializing 'resolve__'");
222
0
                return MsgValueError;
223
0
            }
224
0
            // Sentinel = 'resolve__'
225
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 3997392463)))) {
226
0
                mozilla::ipc::SentinelReadError("Error deserializing 'resolve__'");
227
0
                return MsgValueError;
228
0
            }
229
0
230
0
            UniquePtr<MessageChannel::UntypedCallbackHolder> untypedCallback = (GetIPCChannel())->PopCallback(msg__);
231
0
            MessageChannel::CallbackHolder<IPCServiceWorkerRegistrationDescriptorOrCopyableErrorResult>* callback = static_cast<MessageChannel::CallbackHolder<IPCServiceWorkerRegistrationDescriptorOrCopyableErrorResult>*>((untypedCallback).get());
232
0
            if ((!(callback))) {
233
0
                FatalError("Error unknown callback");
234
0
                return MsgProcessingError;
235
0
            }
236
0
            if (resolve__) {
237
0
                IPCServiceWorkerRegistrationDescriptorOrCopyableErrorResult aResult;
238
0
239
0
                if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(aResult)))))) {
240
0
                    FatalError("Error deserializing 'IPCServiceWorkerRegistrationDescriptorOrCopyableErrorResult'");
241
0
                    return MsgValueError;
242
0
                }
243
0
                // Sentinel = 'aResult'
244
0
                if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 3888726089)))) {
245
0
                    mozilla::ipc::SentinelReadError("Error deserializing 'IPCServiceWorkerRegistrationDescriptorOrCopyableErrorResult'");
246
0
                    return MsgValueError;
247
0
                }
248
0
                (msg__).EndRead(iter__, (msg__).type());
249
0
                (callback)->Resolve(std::move(aResult));
250
0
            }
251
0
            else {
252
0
                ResponseRejectReason reason__;
253
0
                if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(reason__)))))) {
254
0
                    FatalError("Error deserializing 'reason__'");
255
0
                    return MsgValueError;
256
0
                }
257
0
                // Sentinel = 'reason__'
258
0
                if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 913452670)))) {
259
0
                    mozilla::ipc::SentinelReadError("Error deserializing 'reason__'");
260
0
                    return MsgValueError;
261
0
                }
262
0
                (msg__).EndRead(iter__, (msg__).type());
263
0
                (callback)->Reject(reason__);
264
0
            }
265
0
            return MsgProcessed;
266
0
        }
267
0
    case PServiceWorkerRegistration::Msg___delete____ID:
268
0
        {
269
0
            if (mozilla::ipc::LoggingEnabledFor("PServiceWorkerRegistrationChild")) {
270
0
                mozilla::ipc::LogMessageForProtocol("PServiceWorkerRegistrationChild", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
271
0
            }
272
0
            AUTO_PROFILER_LABEL("PServiceWorkerRegistration::Msg___delete__", OTHER);
273
0
274
0
            PickleIterator iter__(msg__);
275
0
            PServiceWorkerRegistrationChild* actor;
276
0
277
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(actor)))))) {
278
0
                FatalError("Error deserializing 'PServiceWorkerRegistrationChild'");
279
0
                return MsgValueError;
280
0
            }
281
0
            if ((!((*((&(actor))))))) {
282
0
                FatalError("Error deserializing 'PServiceWorkerRegistrationChild'");
283
0
                return MsgValueError;
284
0
            }
285
0
            // Sentinel = 'actor'
286
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 875202478)))) {
287
0
                mozilla::ipc::SentinelReadError("Error deserializing 'PServiceWorkerRegistrationChild'");
288
0
                return MsgValueError;
289
0
            }
290
0
            (msg__).EndRead(iter__, (msg__).type());
291
0
            if ((!(StateTransition(true, (&(mLivenessState)))))) {
292
0
                FatalError("Transition error");
293
0
                return MsgValueError;
294
0
            }
295
0
            if ((!(Recv__delete__()))) {
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
302
0
            IProtocol* mgr = (actor)->Manager();
303
0
            (actor)->DestroySubtree(Deletion);
304
0
            (actor)->DeallocSubtree();
305
0
            (mgr)->RemoveManagee(PServiceWorkerRegistrationMsgStart, actor);
306
0
307
0
            return MsgProcessed;
308
0
        }
309
0
    case PServiceWorkerRegistration::Msg_UpdateState__ID:
310
0
        {
311
0
            if (mozilla::ipc::LoggingEnabledFor("PServiceWorkerRegistrationChild")) {
312
0
                mozilla::ipc::LogMessageForProtocol("PServiceWorkerRegistrationChild", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
313
0
            }
314
0
            AUTO_PROFILER_LABEL("PServiceWorkerRegistration::Msg_UpdateState", OTHER);
315
0
316
0
            PickleIterator iter__(msg__);
317
0
            IPCServiceWorkerRegistrationDescriptor aDescriptor;
318
0
319
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(aDescriptor)))))) {
320
0
                FatalError("Error deserializing 'IPCServiceWorkerRegistrationDescriptor'");
321
0
                return MsgValueError;
322
0
            }
323
0
            // Sentinel = 'aDescriptor'
324
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 897756877)))) {
325
0
                mozilla::ipc::SentinelReadError("Error deserializing 'IPCServiceWorkerRegistrationDescriptor'");
326
0
                return MsgValueError;
327
0
            }
328
0
            (msg__).EndRead(iter__, (msg__).type());
329
0
            if ((!(StateTransition(false, (&(mLivenessState)))))) {
330
0
                FatalError("Transition error");
331
0
                return MsgValueError;
332
0
            }
333
0
            if ((!(RecvUpdateState(aDescriptor)))) {
334
0
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
335
0
                // Error handled in mozilla::ipc::IPCResult
336
0
                return MsgProcessingError;
337
0
            }
338
0
339
0
            return MsgProcessed;
340
0
        }
341
0
    default:
342
0
        {
343
0
            return MsgNotKnown;
344
0
        }
345
0
    }
346
0
}
347
348
auto PServiceWorkerRegistrationChild::OnMessageReceived(
349
        const Message& msg__,
350
        Message*& reply__) -> PServiceWorkerRegistrationChild::Result
351
0
{
352
0
    return MsgNotKnown;
353
0
}
354
355
auto PServiceWorkerRegistrationChild::OnCallReceived(
356
        const Message& msg__,
357
        Message*& reply__) -> PServiceWorkerRegistrationChild::Result
358
0
{
359
0
    MOZ_ASSERT_UNREACHABLE("message protocol not supported");
360
0
    return MsgNotKnown;
361
0
}
362
363
auto PServiceWorkerRegistrationChild::GetProtocolTypeId() -> int32_t
364
0
{
365
0
    return PServiceWorkerRegistrationMsgStart;
366
0
}
367
368
auto PServiceWorkerRegistrationChild::DestroySubtree(ActorDestroyReason why) -> void
369
0
{
370
0
    // Unregister from our manager.
371
0
    Unregister(Id());
372
0
373
0
    // Reject owning pending responses.
374
0
    (GetIPCChannel())->RejectPendingResponsesForActor(this);
375
0
376
0
    // Finally, destroy "us".
377
0
    ActorDestroy(why);
378
0
}
379
380
auto PServiceWorkerRegistrationChild::DeallocSubtree() -> void
381
0
{
382
0
}
383
384
385
386
} // namespace dom
387
} // namespace mozilla
388
namespace mozilla {
389
namespace ipc {
390
auto IPDLParamTraits<mozilla::dom::PServiceWorkerRegistrationChild>::Write(
391
        IPC::Message* aMsg,
392
        mozilla::ipc::IProtocol* aActor,
393
        const paramType& aVar) -> void
394
0
{
395
0
    int32_t id;
396
0
    if ((!(aVar))) {
397
0
        id = 0;
398
0
    }
399
0
    else {
400
0
        id = (aVar)->Id();
401
0
        if ((1) == (id)) {
402
0
            (aActor)->FatalError("actor has been |delete|d");
403
0
        }
404
0
    }
405
0
    WriteIPDLParam(aMsg, aActor, id);
406
0
}
407
408
auto IPDLParamTraits<mozilla::dom::PServiceWorkerRegistrationChild>::Read(
409
        const IPC::Message* aMsg,
410
        PickleIterator* aIter,
411
        mozilla::ipc::IProtocol* aActor,
412
        paramType* aVar) -> bool
413
0
{
414
0
    mozilla::Maybe<mozilla::ipc::IProtocol*> actor = (aActor)->ReadActor(aMsg, aIter, true, "PServiceWorkerRegistration", PServiceWorkerRegistrationMsgStart);
415
0
    if ((actor).isNothing()) {
416
0
        return false;
417
0
    }
418
0
419
0
    (*(aVar)) = static_cast<mozilla::dom::PServiceWorkerRegistrationChild*>((actor).value());
420
0
    return true;
421
0
}
422
423
} // namespace ipc
424
} // namespace mozilla