Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dist/include/mozilla/dom/TCPSocketBinding.h
Line
Count
Source (jump to first uncovered line)
1
/* THIS FILE IS AUTOGENERATED FROM TCPSocket.webidl BY Codegen.py - DO NOT EDIT */
2
3
#ifndef mozilla_dom_TCPSocketBinding_h
4
#define mozilla_dom_TCPSocketBinding_h
5
6
#include "GeckoProfiler.h"
7
#include "js/RootingAPI.h"
8
#include "jspubtd.h"
9
#include "mozilla/ErrorResult.h"
10
#include "mozilla/dom/BindingDeclarations.h"
11
#include "mozilla/dom/Nullable.h"
12
#include "mozilla/dom/PrototypeList.h"
13
14
namespace mozilla {
15
namespace dom {
16
17
class LegacyMozTCPSocket;
18
struct LegacyMozTCPSocketAtoms;
19
struct NativePropertyHooks;
20
class ProtoAndIfaceCache;
21
struct SocketOptionsAtoms;
22
class TCPSocket;
23
struct TCPSocketAtoms;
24
25
} // namespace dom
26
} // namespace mozilla
27
28
namespace mozilla {
29
namespace dom {
30
31
enum class TCPSocketBinaryType : uint8_t {
32
  Arraybuffer,
33
  String,
34
  EndGuard_
35
};
36
37
namespace TCPSocketBinaryTypeValues {
38
extern const EnumEntry strings[3];
39
} // namespace TCPSocketBinaryTypeValues
40
41
bool
42
ToJSValue(JSContext* aCx, TCPSocketBinaryType aArgument, JS::MutableHandle<JS::Value> aValue);
43
44
45
enum class TCPReadyState : uint8_t {
46
  Connecting,
47
  Open,
48
  Closing,
49
  Closed,
50
  EndGuard_
51
};
52
53
namespace TCPReadyStateValues {
54
extern const EnumEntry strings[5];
55
} // namespace TCPReadyStateValues
56
57
bool
58
ToJSValue(JSContext* aCx, TCPReadyState aArgument, JS::MutableHandle<JS::Value> aValue);
59
60
61
struct SocketOptions : public DictionaryBase
62
{
63
  MOZ_INIT_OUTSIDE_CTOR TCPSocketBinaryType mBinaryType;
64
  MOZ_INIT_OUTSIDE_CTOR bool mUseSecureTransport;
65
66
  SocketOptions();
67
68
  explicit inline SocketOptions(const FastDictionaryInitializer& )
69
0
  {
70
0
    // Do nothing here; this is used by our "Fast" subclass
71
0
  }
72
73
  explicit inline SocketOptions(const SocketOptions& aOther)
74
0
  {
75
0
    *this = aOther;
76
0
  }
77
78
  bool
79
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
80
81
  bool
82
  Init(const nsAString& aJSON);
83
84
  bool
85
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
86
87
  bool
88
  ToJSON(nsAString& aJSON) const;
89
90
  void
91
  TraceDictionary(JSTracer* trc);
92
93
  SocketOptions&
94
  operator=(const SocketOptions& aOther);
95
96
private:
97
  static bool
98
  InitIds(JSContext* cx, SocketOptionsAtoms* atomsCache);
99
};
100
101
namespace binding_detail {
102
struct FastSocketOptions : public SocketOptions
103
{
104
  inline FastSocketOptions()
105
    : SocketOptions(FastDictionaryInitializer())
106
0
  {
107
0
    // Doesn't matter what int we pass to the parent constructor
108
0
  }
109
};
110
} // namespace binding_detail
111
112
113
namespace LegacyMozTCPSocket_Binding {
114
115
  typedef mozilla::dom::LegacyMozTCPSocket NativeType;
116
117
  const JSClass*
118
  GetJSClass();
119
120
  bool
121
  Wrap(JSContext* aCx, mozilla::dom::LegacyMozTCPSocket* aObject, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
122
123
  // We declare this as an array so that retrieving a pointer to this
124
  // binding's property hooks only requires compile/link-time resolvable
125
  // address arithmetic.  Declaring it as a pointer instead would require
126
  // doing a run-time load to fetch a pointer to this binding's property
127
  // hooks.  And then structures which embedded a pointer to this structure
128
  // would require a run-time load for proper initialization, which would
129
  // then induce static constructors.  Lots of static constructors.
130
  extern const NativePropertyHooks sNativePropertyHooks[];
131
132
  void
133
  CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
134
135
  inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx)
136
0
  {
137
0
    /* Get the interface prototype object for this class.  This will create the
138
0
       object as needed. */
139
0
    return GetPerInterfaceObjectHandle(aCx, prototypes::id::LegacyMozTCPSocket,
140
0
                                       &CreateInterfaceObjects,
141
0
                                       /* aDefineOnGlobal = */ true);
142
0
143
0
  }
144
145
} // namespace LegacyMozTCPSocket_Binding
146
147
148
149
namespace TCPSocket_Binding {
150
151
  typedef mozilla::dom::TCPSocket NativeType;
152
153
  bool
154
  ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
155
156
  const JSClass*
157
  GetJSClass();
158
159
  bool
160
  Wrap(JSContext* aCx, mozilla::dom::TCPSocket* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
161
162
  template <class T>
163
  inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
164
0
  {
165
0
    JS::Rooted<JSObject*> reflector(aCx);
166
0
    return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
167
0
  }
168
169
  // We declare this as an array so that retrieving a pointer to this
170
  // binding's property hooks only requires compile/link-time resolvable
171
  // address arithmetic.  Declaring it as a pointer instead would require
172
  // doing a run-time load to fetch a pointer to this binding's property
173
  // hooks.  And then structures which embedded a pointer to this structure
174
  // would require a run-time load for proper initialization, which would
175
  // then induce static constructors.  Lots of static constructors.
176
  extern const NativePropertyHooks sNativePropertyHooks[];
177
178
  void
179
  CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
180
181
  inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx)
182
0
  {
183
0
    /* Get the interface prototype object for this class.  This will create the
184
0
       object as needed. */
185
0
    return GetPerInterfaceObjectHandle(aCx, prototypes::id::TCPSocket,
186
0
                                       &CreateInterfaceObjects,
187
0
                                       /* aDefineOnGlobal = */ true);
188
0
189
0
  }
190
191
  inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true)
192
0
  {
193
0
    /* Get the interface object for this class.  This will create the object as
194
0
       needed. */
195
0
196
0
    return GetPerInterfaceObjectHandle(aCx, constructors::id::TCPSocket,
197
0
                                       &CreateInterfaceObjects,
198
0
                                       aDefineOnGlobal);
199
0
  }
200
201
  JSObject*
202
  GetConstructorObject(JSContext* aCx);
203
204
} // namespace TCPSocket_Binding
205
206
207
208
} // namespace dom
209
} // namespace mozilla
210
211
#endif // mozilla_dom_TCPSocketBinding_h