Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/ipc/ipdl/PDNSRequestChild.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/net/PDNSRequestChild.h"
8
9
#include "mozilla/net/PNeckoChild.h"
10
11
#include "nsIFile.h"
12
#include "GeckoProfiler.h"
13
14
namespace mozilla {
15
namespace net {
16
17
18
auto PDNSRequestChild::ActorDestroy(ActorDestroyReason aWhy) -> void
19
0
{
20
0
}
21
22
MOZ_IMPLICIT PDNSRequestChild::PDNSRequestChild() :
23
    mozilla::ipc::IProtocol(mozilla::ipc::ChildSide),
24
    mLivenessState(mozilla::ipc::LivenessState::Dead)
25
0
{
26
0
    MOZ_COUNT_CTOR(PDNSRequestChild);
27
0
}
28
29
PDNSRequestChild::~PDNSRequestChild()
30
0
{
31
0
    MOZ_COUNT_DTOR(PDNSRequestChild);
32
0
}
33
34
auto PDNSRequestChild::Manager() const -> PNeckoChild*
35
0
{
36
0
    return static_cast<PNeckoChild*>(IProtocol::Manager());
37
0
}
38
39
auto PDNSRequestChild::SendCancelDNSRequest(
40
        const nsCString& hostName,
41
        const uint16_t& type,
42
        const OriginAttributes& originAttributes,
43
        const uint32_t& flags,
44
        const nsresult& reason) -> bool
45
0
{
46
0
    IPC::Message* msg__ = PDNSRequest::Msg_CancelDNSRequest(Id());
47
0
48
0
    WriteIPDLParam(msg__, this, hostName);
49
0
    // Sentinel = 'hostName'
50
0
    (msg__)->WriteSentinel(1367899915);
51
0
    WriteIPDLParam(msg__, this, type);
52
0
    // Sentinel = 'type'
53
0
    (msg__)->WriteSentinel(2982068540);
54
0
    WriteIPDLParam(msg__, this, originAttributes);
55
0
    // Sentinel = 'originAttributes'
56
0
    (msg__)->WriteSentinel(2655275965);
57
0
    WriteIPDLParam(msg__, this, flags);
58
0
    // Sentinel = 'flags'
59
0
    (msg__)->WriteSentinel(2550519284);
60
0
    WriteIPDLParam(msg__, this, reason);
61
0
    // Sentinel = 'reason'
62
0
    (msg__)->WriteSentinel(4151390930);
63
0
64
0
65
0
66
0
67
0
    if (mozilla::ipc::LoggingEnabledFor("PDNSRequestChild")) {
68
0
        mozilla::ipc::LogMessageForProtocol("PDNSRequestChild", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
69
0
    }
70
0
    AUTO_PROFILER_LABEL("PDNSRequest::Msg_CancelDNSRequest", OTHER);
71
0
    if ((!(StateTransition(false, (&(mLivenessState)))))) {
72
0
        mozilla::ipc::LogicError("Transition error");
73
0
    }
74
0
75
0
    bool sendok__ = (GetIPCChannel())->Send(msg__);
76
0
    return sendok__;
77
0
}
78
79
auto PDNSRequestChild::Send__delete__(PDNSRequestChild* actor) -> bool
80
0
{
81
0
    if ((!(actor))) {
82
0
        return false;
83
0
    }
84
0
85
0
    IPC::Message* msg__ = PDNSRequest::Msg___delete__((actor)->Id());
86
0
87
0
    MOZ_RELEASE_ASSERT(actor, "NULL actor value passed to non-nullable param");
88
0
    WriteIPDLParam(msg__, actor, actor);
89
0
    // Sentinel = 'actor'
90
0
    (msg__)->WriteSentinel(875202478);
91
0
92
0
93
0
94
0
    if (mozilla::ipc::LoggingEnabledFor("PDNSRequestChild")) {
95
0
        mozilla::ipc::LogMessageForProtocol("PDNSRequestChild", (actor)->OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
96
0
    }
97
0
    AUTO_PROFILER_LABEL("PDNSRequest::Msg___delete__", OTHER);
98
0
    if ((!(StateTransition(true, (&((actor)->mLivenessState)))))) {
99
0
        mozilla::ipc::LogicError("Transition error");
100
0
    }
101
0
102
0
    bool sendok__ = ((actor)->GetIPCChannel())->Send(msg__);
103
0
104
0
    IProtocol* mgr = (actor)->Manager();
105
0
    (actor)->DestroySubtree(Deletion);
106
0
    (actor)->DeallocSubtree();
107
0
    (mgr)->RemoveManagee(PDNSRequestMsgStart, actor);
108
0
    return sendok__;
109
0
}
110
111
auto PDNSRequestChild::RemoveManagee(
112
        int32_t aProtocolId,
113
        IProtocol* aListener) -> void
114
0
{
115
0
    FatalError("unreached");
116
0
    return;
117
0
}
118
119
auto PDNSRequestChild::OnMessageReceived(const Message& msg__) -> PDNSRequestChild::Result
120
0
{
121
0
    switch ((msg__).type()) {
122
0
    case PDNSRequest::Reply___delete____ID:
123
0
        {
124
0
            return MsgProcessed;
125
0
        }
126
0
    case PDNSRequest::Msg_LookupCompleted__ID:
127
0
        {
128
0
            if (mozilla::ipc::LoggingEnabledFor("PDNSRequestChild")) {
129
0
                mozilla::ipc::LogMessageForProtocol("PDNSRequestChild", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
130
0
            }
131
0
            AUTO_PROFILER_LABEL("PDNSRequest::Msg_LookupCompleted", OTHER);
132
0
133
0
            PickleIterator iter__(msg__);
134
0
            DNSRequestResponse reply;
135
0
136
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(reply)))))) {
137
0
                FatalError("Error deserializing 'DNSRequestResponse'");
138
0
                return MsgValueError;
139
0
            }
140
0
            // Sentinel = 'reply'
141
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 3357927609)))) {
142
0
                mozilla::ipc::SentinelReadError("Error deserializing 'DNSRequestResponse'");
143
0
                return MsgValueError;
144
0
            }
145
0
            (msg__).EndRead(iter__, (msg__).type());
146
0
            if ((!(StateTransition(false, (&(mLivenessState)))))) {
147
0
                FatalError("Transition error");
148
0
                return MsgValueError;
149
0
            }
150
0
            if ((!(RecvLookupCompleted(reply)))) {
151
0
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
152
0
                // Error handled in mozilla::ipc::IPCResult
153
0
                return MsgProcessingError;
154
0
            }
155
0
156
0
            return MsgProcessed;
157
0
        }
158
0
    default:
159
0
        {
160
0
            return MsgNotKnown;
161
0
        }
162
0
    }
163
0
}
164
165
auto PDNSRequestChild::OnMessageReceived(
166
        const Message& msg__,
167
        Message*& reply__) -> PDNSRequestChild::Result
168
0
{
169
0
    return MsgNotKnown;
170
0
}
171
172
auto PDNSRequestChild::OnCallReceived(
173
        const Message& msg__,
174
        Message*& reply__) -> PDNSRequestChild::Result
175
0
{
176
0
    MOZ_ASSERT_UNREACHABLE("message protocol not supported");
177
0
    return MsgNotKnown;
178
0
}
179
180
auto PDNSRequestChild::GetProtocolTypeId() -> int32_t
181
0
{
182
0
    return PDNSRequestMsgStart;
183
0
}
184
185
auto PDNSRequestChild::DestroySubtree(ActorDestroyReason why) -> void
186
0
{
187
0
    // Unregister from our manager.
188
0
    Unregister(Id());
189
0
190
0
    // Reject owning pending responses.
191
0
    (GetIPCChannel())->RejectPendingResponsesForActor(this);
192
0
193
0
    // Finally, destroy "us".
194
0
    ActorDestroy(why);
195
0
}
196
197
auto PDNSRequestChild::DeallocSubtree() -> void
198
0
{
199
0
}
200
201
202
203
} // namespace net
204
} // namespace mozilla
205
namespace mozilla {
206
namespace ipc {
207
auto IPDLParamTraits<mozilla::net::PDNSRequestChild>::Write(
208
        IPC::Message* aMsg,
209
        mozilla::ipc::IProtocol* aActor,
210
        const paramType& aVar) -> void
211
0
{
212
0
    int32_t id;
213
0
    if ((!(aVar))) {
214
0
        id = 0;
215
0
    }
216
0
    else {
217
0
        id = (aVar)->Id();
218
0
        if ((1) == (id)) {
219
0
            (aActor)->FatalError("actor has been |delete|d");
220
0
        }
221
0
    }
222
0
    WriteIPDLParam(aMsg, aActor, id);
223
0
}
224
225
auto IPDLParamTraits<mozilla::net::PDNSRequestChild>::Read(
226
        const IPC::Message* aMsg,
227
        PickleIterator* aIter,
228
        mozilla::ipc::IProtocol* aActor,
229
        paramType* aVar) -> bool
230
0
{
231
0
    mozilla::Maybe<mozilla::ipc::IProtocol*> actor = (aActor)->ReadActor(aMsg, aIter, true, "PDNSRequest", PDNSRequestMsgStart);
232
0
    if ((actor).isNothing()) {
233
0
        return false;
234
0
    }
235
0
236
0
    (*(aVar)) = static_cast<mozilla::net::PDNSRequestChild*>((actor).value());
237
0
    return true;
238
0
}
239
240
} // namespace ipc
241
} // namespace mozilla