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