Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dist/include/mozilla/net/NeckoParent.h
Line
Count
Source (jump to first uncovered line)
1
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* vim: set sw=2 ts=8 et tw=80 : */
3
4
/* This Source Code Form is subject to the terms of the Mozilla Public
5
 * License, v. 2.0. If a copy of the MPL was not distributed with this
6
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7
8
#include "mozilla/BasePrincipal.h"
9
#include "mozilla/net/PNeckoParent.h"
10
#include "mozilla/net/NeckoCommon.h"
11
#include "nsIAuthPrompt2.h"
12
#include "nsINetworkPredictor.h"
13
#include "nsNetUtil.h"
14
15
#ifndef mozilla_net_NeckoParent_h
16
#define mozilla_net_NeckoParent_h
17
18
namespace mozilla {
19
namespace net {
20
21
// Used to override channel Private Browsing status if needed.
22
enum PBOverrideStatus {
23
  kPBOverride_Unset = 0,
24
  kPBOverride_Private,
25
  kPBOverride_NotPrivate
26
};
27
28
// Header file contents
29
class NeckoParent
30
  : public PNeckoParent
31
{
32
public:
33
  NeckoParent();
34
  virtual ~NeckoParent() = default;
35
36
  MOZ_MUST_USE
37
  static const char *
38
  GetValidatedOriginAttributes(const SerializedLoadContext& aSerialized,
39
                               PContentParent* aBrowser,
40
                               nsIPrincipal* aRequestingPrincipal,
41
                               mozilla::OriginAttributes& aAttrs);
42
43
  /*
44
   * Creates LoadContext for parent-side of an e10s channel.
45
   *
46
   * PContentParent corresponds to the process that is requesting the load.
47
   *
48
   * Returns null if successful, or an error string if failed.
49
   */
50
  MOZ_MUST_USE
51
  static const char*
52
  CreateChannelLoadContext(const PBrowserOrId& aBrowser,
53
                           PContentParent* aContent,
54
                           const SerializedLoadContext& aSerialized,
55
                           nsIPrincipal* aRequestingPrincipal,
56
                           nsCOMPtr<nsILoadContext> &aResult);
57
58
  virtual void ActorDestroy(ActorDestroyReason aWhy) override;
59
  virtual PCookieServiceParent* AllocPCookieServiceParent() override;
60
  virtual mozilla::ipc::IPCResult
61
  RecvPCookieServiceConstructor(PCookieServiceParent* aActor) override
62
0
  {
63
0
    return PNeckoParent::RecvPCookieServiceConstructor(aActor);
64
0
  }
65
66
  /*
67
   * This implementation of nsIAuthPrompt2 is used for nested remote iframes that
68
   * want an auth prompt.  This class lives in the parent process and informs the
69
   * NeckoChild that we want an auth prompt, which forwards the request to the
70
   * TabParent in the remote iframe that contains the nested iframe
71
   */
72
  class NestedFrameAuthPrompt final : public nsIAuthPrompt2
73
  {
74
0
    ~NestedFrameAuthPrompt() {}
75
76
  public:
77
    NS_DECL_ISUPPORTS
78
79
    NestedFrameAuthPrompt(PNeckoParent* aParent, TabId aNestedFrameId);
80
81
    NS_IMETHOD PromptAuth(nsIChannel*, uint32_t, nsIAuthInformation*, bool*) override
82
0
    {
83
0
      return NS_ERROR_NOT_IMPLEMENTED;
84
0
    }
85
86
    NS_IMETHOD AsyncPromptAuth(nsIChannel* aChannel, nsIAuthPromptCallback* callback,
87
                               nsISupports*, uint32_t,
88
                               nsIAuthInformation* aInfo, nsICancelable**) override;
89
90
  protected:
91
    PNeckoParent* mNeckoParent;
92
    TabId mNestedFrameId;
93
  };
94
95
protected:
96
  virtual PHttpChannelParent*
97
    AllocPHttpChannelParent(const PBrowserOrId&, const SerializedLoadContext&,
98
                            const HttpChannelCreationArgs& aOpenArgs) override;
99
  virtual mozilla::ipc::IPCResult
100
    RecvPHttpChannelConstructor(
101
      PHttpChannelParent* aActor,
102
      const PBrowserOrId& aBrowser,
103
      const SerializedLoadContext& aSerialized,
104
      const HttpChannelCreationArgs& aOpenArgs) override;
105
  virtual bool DeallocPHttpChannelParent(PHttpChannelParent*) override;
106
107
  virtual PStunAddrsRequestParent* AllocPStunAddrsRequestParent() override;
108
  virtual bool
109
    DeallocPStunAddrsRequestParent(PStunAddrsRequestParent* aActor) override;
110
111
  virtual PAltDataOutputStreamParent* AllocPAltDataOutputStreamParent(
112
    const nsCString& type, const int64_t& predictedSize, PHttpChannelParent* channel) override;
113
  virtual bool DeallocPAltDataOutputStreamParent(
114
    PAltDataOutputStreamParent* aActor) override;
115
116
  virtual bool DeallocPCookieServiceParent(PCookieServiceParent*) override;
117
  virtual PWyciwygChannelParent* AllocPWyciwygChannelParent() override;
118
  virtual bool DeallocPWyciwygChannelParent(PWyciwygChannelParent*) override;
119
  virtual PFTPChannelParent*
120
    AllocPFTPChannelParent(const PBrowserOrId& aBrowser,
121
                           const SerializedLoadContext& aSerialized,
122
                           const FTPChannelCreationArgs& aOpenArgs) override;
123
  virtual mozilla::ipc::IPCResult
124
    RecvPFTPChannelConstructor(
125
      PFTPChannelParent* aActor,
126
      const PBrowserOrId& aBrowser,
127
      const SerializedLoadContext& aSerialized,
128
      const FTPChannelCreationArgs& aOpenArgs) override;
129
  virtual bool DeallocPFTPChannelParent(PFTPChannelParent*) override;
130
  virtual PWebSocketParent*
131
    AllocPWebSocketParent(const PBrowserOrId& browser,
132
                          const SerializedLoadContext& aSerialized,
133
                          const uint32_t& aSerial) override;
134
  virtual bool DeallocPWebSocketParent(PWebSocketParent*) override;
135
  virtual PTCPSocketParent* AllocPTCPSocketParent(const nsString& host,
136
                                                  const uint16_t& port) override;
137
138
  virtual bool DeallocPTCPSocketParent(PTCPSocketParent*) override;
139
  virtual PTCPServerSocketParent*
140
    AllocPTCPServerSocketParent(const uint16_t& aLocalPort,
141
                                const uint16_t& aBacklog,
142
                                const bool& aUseArrayBuffers) override;
143
  virtual mozilla::ipc::IPCResult RecvPTCPServerSocketConstructor(PTCPServerSocketParent*,
144
                                                                  const uint16_t& aLocalPort,
145
                                                                  const uint16_t& aBacklog,
146
                                                                  const bool& aUseArrayBuffers) override;
147
  virtual bool DeallocPTCPServerSocketParent(PTCPServerSocketParent*) override;
148
  virtual PUDPSocketParent* AllocPUDPSocketParent(const Principal& aPrincipal,
149
                                                  const nsCString& aFilter) override;
150
  virtual mozilla::ipc::IPCResult RecvPUDPSocketConstructor(PUDPSocketParent*,
151
                                                            const Principal& aPrincipal,
152
                                                            const nsCString& aFilter) override;
153
  virtual bool DeallocPUDPSocketParent(PUDPSocketParent*) override;
154
  virtual PDNSRequestParent* AllocPDNSRequestParent(const nsCString& aHost,
155
                                                    const OriginAttributes& aOriginAttributes,
156
                                                    const uint32_t& aFlags) override;
157
  virtual mozilla::ipc::IPCResult RecvPDNSRequestConstructor(PDNSRequestParent* actor,
158
                                                             const nsCString& hostName,
159
                                                             const OriginAttributes& aOriginAttributes,
160
                                                             const uint32_t& flags) override;
161
  virtual bool DeallocPDNSRequestParent(PDNSRequestParent*) override;
162
  virtual mozilla::ipc::IPCResult RecvSpeculativeConnect(const URIParams& aURI,
163
                                                         const Principal& aPrincipal,
164
                                                         const bool& aAnonymous) override;
165
  virtual mozilla::ipc::IPCResult RecvHTMLDNSPrefetch(const nsString& hostname,
166
                                                      const bool& isHttps,
167
                                                      const OriginAttributes& aOriginAttributes,
168
                                                      const uint16_t& flags) override;
169
  virtual mozilla::ipc::IPCResult RecvCancelHTMLDNSPrefetch(const nsString& hostname,
170
                                                            const bool& isHttps,
171
                                                            const OriginAttributes& aOriginAttributes,
172
                                                            const uint16_t& flags,
173
                                                            const nsresult& reason) override;
174
  virtual PWebSocketEventListenerParent*
175
    AllocPWebSocketEventListenerParent(const uint64_t& aInnerWindowID) override;
176
  virtual bool DeallocPWebSocketEventListenerParent(PWebSocketEventListenerParent*) override;
177
178
  virtual PDataChannelParent*
179
    AllocPDataChannelParent(const uint32_t& channelId) override;
180
  virtual bool DeallocPDataChannelParent(PDataChannelParent* parent) override;
181
182
  virtual mozilla::ipc::IPCResult RecvPDataChannelConstructor(PDataChannelParent* aActor,
183
                                                              const uint32_t& channelId) override;
184
185
  virtual PSimpleChannelParent*
186
    AllocPSimpleChannelParent(const uint32_t& channelId) override;
187
  virtual bool DeallocPSimpleChannelParent(PSimpleChannelParent* parent) override;
188
189
  virtual mozilla::ipc::IPCResult RecvPSimpleChannelConstructor(PSimpleChannelParent* aActor,
190
                                                              const uint32_t& channelId) override;
191
192
  virtual PFileChannelParent*
193
    AllocPFileChannelParent(const uint32_t& channelId) override;
194
  virtual bool DeallocPFileChannelParent(PFileChannelParent* parent) override;
195
196
  virtual mozilla::ipc::IPCResult RecvPFileChannelConstructor(PFileChannelParent* aActor,
197
                                                              const uint32_t& channelId) override;
198
199
  virtual PChannelDiverterParent*
200
  AllocPChannelDiverterParent(const ChannelDiverterArgs& channel) override;
201
  virtual mozilla::ipc::IPCResult
202
  RecvPChannelDiverterConstructor(PChannelDiverterParent* actor,
203
                                  const ChannelDiverterArgs& channel) override;
204
  virtual bool DeallocPChannelDiverterParent(PChannelDiverterParent* actor)
205
                                                                override;
206
  virtual PTransportProviderParent*
207
  AllocPTransportProviderParent() override;
208
  virtual bool
209
  DeallocPTransportProviderParent(PTransportProviderParent* aActor) override;
210
211
  virtual mozilla::ipc::IPCResult RecvOnAuthAvailable(const uint64_t& aCallbackId,
212
                                                      const nsString& aUser,
213
                                                      const nsString& aPassword,
214
                                                      const nsString& aDomain) override;
215
  virtual mozilla::ipc::IPCResult RecvOnAuthCancelled(const uint64_t& aCallbackId,
216
                                                      const bool& aUserCancel) override;
217
218
  /* Predictor Messages */
219
  virtual mozilla::ipc::IPCResult RecvPredPredict(const ipc::OptionalURIParams& aTargetURI,
220
                                                  const ipc::OptionalURIParams& aSourceURI,
221
                                                  const PredictorPredictReason& aReason,
222
                                                  const OriginAttributes& aOriginAttributes,
223
                                                  const bool& hasVerifier) override;
224
225
  virtual mozilla::ipc::IPCResult RecvPredLearn(const ipc::URIParams& aTargetURI,
226
                                                const ipc::OptionalURIParams& aSourceURI,
227
                                                const PredictorPredictReason& aReason,
228
                                                const OriginAttributes& aOriginAttributes) override;
229
  virtual mozilla::ipc::IPCResult RecvPredReset() override;
230
231
  virtual mozilla::ipc::IPCResult RecvRequestContextLoadBegin(const uint64_t& rcid) override;
232
  virtual mozilla::ipc::IPCResult RecvRequestContextAfterDOMContentLoaded(const uint64_t& rcid) override;
233
  virtual mozilla::ipc::IPCResult RecvRemoveRequestContext(const uint64_t& rcid) override;
234
235
  /* WebExtensions */
236
  virtual mozilla::ipc::IPCResult
237
    RecvGetExtensionStream(const URIParams& aURI,
238
                           GetExtensionStreamResolver&& aResolve) override;
239
240
  virtual mozilla::ipc::IPCResult
241
    RecvGetExtensionFD(const URIParams& aURI,
242
                       GetExtensionFDResolver&& aResolve) override;
243
};
244
245
} // namespace net
246
} // namespace mozilla
247
248
#endif // mozilla_net_NeckoParent_h