Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/ipc/ipdl/PFilePickerParent.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/PFilePickerParent.h"
8
#include "ipc/IPCMessageUtils.h"
9
10
#include "mozilla/dom/PBrowserParent.h"
11
#include "mozilla/ipc/PChildToParentStreamParent.h"
12
#include "mozilla/ipc/PIPCBlobInputStreamParent.h"
13
#include "mozilla/ipc/PFileDescriptorSetParent.h"
14
#include "mozilla/ipc/PParentToChildStreamParent.h"
15
16
#include "nsIFile.h"
17
#include "GeckoProfiler.h"
18
19
namespace mozilla {
20
namespace dom {
21
22
23
auto PFilePickerParent::ActorDestroy(ActorDestroyReason aWhy) -> void
24
0
{
25
0
}
26
27
MOZ_IMPLICIT PFilePickerParent::PFilePickerParent() :
28
    mozilla::ipc::IProtocol(mozilla::ipc::ParentSide),
29
    mLivenessState(mozilla::ipc::LivenessState::Dead)
30
0
{
31
0
    MOZ_COUNT_CTOR(PFilePickerParent);
32
0
}
33
34
PFilePickerParent::~PFilePickerParent()
35
0
{
36
0
    MOZ_COUNT_DTOR(PFilePickerParent);
37
0
}
38
39
auto PFilePickerParent::Manager() const -> PBrowserParent*
40
0
{
41
0
    return static_cast<PBrowserParent*>(IProtocol::Manager());
42
0
}
43
44
auto PFilePickerParent::Send__delete__(
45
        PFilePickerParent* actor,
46
        const MaybeInputData& data,
47
        const int16_t& result) -> bool
48
0
{
49
0
    if ((!(actor))) {
50
0
        return false;
51
0
    }
52
0
53
0
    IPC::Message* msg__ = PFilePicker::Msg___delete__((actor)->Id());
54
0
55
0
    MOZ_RELEASE_ASSERT(actor, "NULL actor value passed to non-nullable param");
56
0
    WriteIPDLParam(msg__, actor, actor);
57
0
    // Sentinel = 'actor'
58
0
    (msg__)->WriteSentinel(875202478);
59
0
    WriteIPDLParam(msg__, actor, data);
60
0
    // Sentinel = 'data'
61
0
    (msg__)->WriteSentinel(843352540);
62
0
    WriteIPDLParam(msg__, actor, result);
63
0
    // Sentinel = 'result'
64
0
    (msg__)->WriteSentinel(3991766165);
65
0
66
0
67
0
68
0
    if (mozilla::ipc::LoggingEnabledFor("PFilePickerParent")) {
69
0
        mozilla::ipc::LogMessageForProtocol("PFilePickerParent", (actor)->OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
70
0
    }
71
0
    AUTO_PROFILER_LABEL("PFilePicker::Msg___delete__", OTHER);
72
0
    if ((!(StateTransition(true, (&((actor)->mLivenessState)))))) {
73
0
        mozilla::ipc::LogicError("Transition error");
74
0
    }
75
0
76
0
    bool sendok__ = ((actor)->GetIPCChannel())->Send(msg__);
77
0
78
0
    IProtocol* mgr = (actor)->Manager();
79
0
    (actor)->DestroySubtree(Deletion);
80
0
    (actor)->DeallocSubtree();
81
0
    (mgr)->RemoveManagee(PFilePickerMsgStart, actor);
82
0
    return sendok__;
83
0
}
84
85
auto PFilePickerParent::RemoveManagee(
86
        int32_t aProtocolId,
87
        IProtocol* aListener) -> void
88
0
{
89
0
    FatalError("unreached");
90
0
    return;
91
0
}
92
93
auto PFilePickerParent::OnMessageReceived(const Message& msg__) -> PFilePickerParent::Result
94
0
{
95
0
    switch ((msg__).type()) {
96
0
    case PFilePicker::Msg_Open__ID:
97
0
        {
98
0
            if (mozilla::ipc::LoggingEnabledFor("PFilePickerParent")) {
99
0
                mozilla::ipc::LogMessageForProtocol("PFilePickerParent", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
100
0
            }
101
0
            AUTO_PROFILER_LABEL("PFilePicker::Msg_Open", OTHER);
102
0
103
0
            PickleIterator iter__(msg__);
104
0
            int16_t selectedType;
105
0
            bool addToRecentDocs;
106
0
            nsString defaultFile;
107
0
            nsString defaultExtension;
108
0
            nsTArray<nsString> filters;
109
0
            nsTArray<nsString> filterNames;
110
0
            nsString displayDirectory;
111
0
            nsString displaySpecialDirectory;
112
0
            nsString okButtonLabel;
113
0
114
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(selectedType)))))) {
115
0
                FatalError("Error deserializing 'int16_t'");
116
0
                return MsgValueError;
117
0
            }
118
0
            // Sentinel = 'selectedType'
119
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 2754221735)))) {
120
0
                mozilla::ipc::SentinelReadError("Error deserializing 'int16_t'");
121
0
                return MsgValueError;
122
0
            }
123
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(addToRecentDocs)))))) {
124
0
                FatalError("Error deserializing 'bool'");
125
0
                return MsgValueError;
126
0
            }
127
0
            // Sentinel = 'addToRecentDocs'
128
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 3834132697)))) {
129
0
                mozilla::ipc::SentinelReadError("Error deserializing 'bool'");
130
0
                return MsgValueError;
131
0
            }
132
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(defaultFile)))))) {
133
0
                FatalError("Error deserializing 'nsString'");
134
0
                return MsgValueError;
135
0
            }
136
0
            // Sentinel = 'defaultFile'
137
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 3931097842)))) {
138
0
                mozilla::ipc::SentinelReadError("Error deserializing 'nsString'");
139
0
                return MsgValueError;
140
0
            }
141
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(defaultExtension)))))) {
142
0
                FatalError("Error deserializing 'nsString'");
143
0
                return MsgValueError;
144
0
            }
145
0
            // Sentinel = 'defaultExtension'
146
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 1359835382)))) {
147
0
                mozilla::ipc::SentinelReadError("Error deserializing 'nsString'");
148
0
                return MsgValueError;
149
0
            }
150
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(filters)))))) {
151
0
                FatalError("Error deserializing 'nsTArray'");
152
0
                return MsgValueError;
153
0
            }
154
0
            // Sentinel = 'filters'
155
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 4001190422)))) {
156
0
                mozilla::ipc::SentinelReadError("Error deserializing 'nsTArray'");
157
0
                return MsgValueError;
158
0
            }
159
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(filterNames)))))) {
160
0
                FatalError("Error deserializing 'nsTArray'");
161
0
                return MsgValueError;
162
0
            }
163
0
            // Sentinel = 'filterNames'
164
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 1860280721)))) {
165
0
                mozilla::ipc::SentinelReadError("Error deserializing 'nsTArray'");
166
0
                return MsgValueError;
167
0
            }
168
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(displayDirectory)))))) {
169
0
                FatalError("Error deserializing 'nsString'");
170
0
                return MsgValueError;
171
0
            }
172
0
            // Sentinel = 'displayDirectory'
173
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 2246103527)))) {
174
0
                mozilla::ipc::SentinelReadError("Error deserializing 'nsString'");
175
0
                return MsgValueError;
176
0
            }
177
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(displaySpecialDirectory)))))) {
178
0
                FatalError("Error deserializing 'nsString'");
179
0
                return MsgValueError;
180
0
            }
181
0
            // Sentinel = 'displaySpecialDirectory'
182
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 4025076023)))) {
183
0
                mozilla::ipc::SentinelReadError("Error deserializing 'nsString'");
184
0
                return MsgValueError;
185
0
            }
186
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(okButtonLabel)))))) {
187
0
                FatalError("Error deserializing 'nsString'");
188
0
                return MsgValueError;
189
0
            }
190
0
            // Sentinel = 'okButtonLabel'
191
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 670178141)))) {
192
0
                mozilla::ipc::SentinelReadError("Error deserializing 'nsString'");
193
0
                return MsgValueError;
194
0
            }
195
0
            (msg__).EndRead(iter__, (msg__).type());
196
0
            if ((!(StateTransition(false, (&(mLivenessState)))))) {
197
0
                FatalError("Transition error");
198
0
                return MsgValueError;
199
0
            }
200
0
            if ((!(RecvOpen(selectedType, addToRecentDocs, defaultFile, defaultExtension, std::move(filters), std::move(filterNames), displayDirectory, displaySpecialDirectory, okButtonLabel)))) {
201
0
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
202
0
                // Error handled in mozilla::ipc::IPCResult
203
0
                return MsgProcessingError;
204
0
            }
205
0
206
0
            return MsgProcessed;
207
0
        }
208
0
    case PFilePicker::Reply___delete____ID:
209
0
        {
210
0
            return MsgProcessed;
211
0
        }
212
0
    default:
213
0
        {
214
0
            return MsgNotKnown;
215
0
        }
216
0
    }
217
0
}
218
219
auto PFilePickerParent::OnMessageReceived(
220
        const Message& msg__,
221
        Message*& reply__) -> PFilePickerParent::Result
222
0
{
223
0
    return MsgNotKnown;
224
0
}
225
226
auto PFilePickerParent::OnCallReceived(
227
        const Message& msg__,
228
        Message*& reply__) -> PFilePickerParent::Result
229
0
{
230
0
    MOZ_ASSERT_UNREACHABLE("message protocol not supported");
231
0
    return MsgNotKnown;
232
0
}
233
234
auto PFilePickerParent::GetProtocolTypeId() -> int32_t
235
0
{
236
0
    return PFilePickerMsgStart;
237
0
}
238
239
auto PFilePickerParent::DestroySubtree(ActorDestroyReason why) -> void
240
0
{
241
0
    // Unregister from our manager.
242
0
    Unregister(Id());
243
0
244
0
    // Reject owning pending responses.
245
0
    (GetIPCChannel())->RejectPendingResponsesForActor(this);
246
0
247
0
    // Finally, destroy "us".
248
0
    ActorDestroy(why);
249
0
}
250
251
auto PFilePickerParent::DeallocSubtree() -> void
252
0
{
253
0
}
254
255
256
257
} // namespace dom
258
} // namespace mozilla
259
namespace mozilla {
260
namespace ipc {
261
auto IPDLParamTraits<mozilla::dom::PFilePickerParent>::Write(
262
        IPC::Message* aMsg,
263
        mozilla::ipc::IProtocol* aActor,
264
        const paramType& aVar) -> void
265
0
{
266
0
    int32_t id;
267
0
    if ((!(aVar))) {
268
0
        id = 0;
269
0
    }
270
0
    else {
271
0
        id = (aVar)->Id();
272
0
        if ((1) == (id)) {
273
0
            (aActor)->FatalError("actor has been |delete|d");
274
0
        }
275
0
    }
276
0
    WriteIPDLParam(aMsg, aActor, id);
277
0
}
278
279
auto IPDLParamTraits<mozilla::dom::PFilePickerParent>::Read(
280
        const IPC::Message* aMsg,
281
        PickleIterator* aIter,
282
        mozilla::ipc::IProtocol* aActor,
283
        paramType* aVar) -> bool
284
0
{
285
0
    mozilla::Maybe<mozilla::ipc::IProtocol*> actor = (aActor)->ReadActor(aMsg, aIter, true, "PFilePicker", PFilePickerMsgStart);
286
0
    if ((actor).isNothing()) {
287
0
        return false;
288
0
    }
289
0
290
0
    (*(aVar)) = static_cast<mozilla::dom::PFilePickerParent*>((actor).value());
291
0
    return true;
292
0
}
293
294
} // namespace ipc
295
} // namespace mozilla