/work/obj-fuzz/dom/bindings/PeerConnectionImplBinding.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* THIS FILE IS AUTOGENERATED FROM PeerConnectionImpl.webidl BY Codegen.py - DO NOT EDIT */ |
2 | | |
3 | | #include "PeerConnectionImpl.h" |
4 | | #include "PeerConnectionImplBinding.h" |
5 | | #include "PeerConnectionObserverBinding.h" |
6 | | #include "RTCConfigurationBinding.h" |
7 | | #include "RTCPeerConnectionBinding.h" |
8 | | #include "RTCRtpSenderBinding.h" |
9 | | #include "RTCRtpSourcesBinding.h" |
10 | | #include "TransceiverImpl.h" |
11 | | #include "WrapperFactory.h" |
12 | | #include "mozilla/FloatingPoint.h" |
13 | | #include "mozilla/OwningNonNull.h" |
14 | | #include "mozilla/dom/BindingUtils.h" |
15 | | #include "mozilla/dom/DOMJSClass.h" |
16 | | #include "mozilla/dom/MediaStreamTrack.h" |
17 | | #include "mozilla/dom/NonRefcountedDOMObject.h" |
18 | | #include "mozilla/dom/Nullable.h" |
19 | | #include "mozilla/dom/PrimitiveConversions.h" |
20 | | #include "mozilla/dom/RTCCertificate.h" |
21 | | #include "mozilla/dom/XrayExpandoClass.h" |
22 | | #include "nsContentUtils.h" |
23 | | #include "nsDOMDataChannel.h" |
24 | | #include "nsGlobalWindow.h" |
25 | | #include "nsISupports.h" |
26 | | |
27 | | namespace mozilla { |
28 | | namespace dom { |
29 | | |
30 | | namespace binding_detail {}; // Just to make sure it's known as a namespace |
31 | | using namespace mozilla::dom::binding_detail; |
32 | | |
33 | | |
34 | | namespace PeerConnectionImpl_Binding { |
35 | | |
36 | | MOZ_CAN_RUN_SCRIPT static bool |
37 | | initialize(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, const JSJitMethodCallArgs& args) |
38 | 0 | { |
39 | 0 | AUTO_PROFILER_LABEL_FAST("PeerConnectionImpl.initialize", DOM, cx); |
40 | 0 |
|
41 | 0 | if (MOZ_UNLIKELY(args.length() < 4)) { |
42 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "PeerConnectionImpl.initialize"); |
43 | 0 | } |
44 | 0 | NonNull<mozilla::dom::PeerConnectionObserver> arg0; |
45 | 0 | if (args[0].isObject()) { |
46 | 0 | { |
47 | 0 | nsresult rv = UnwrapObject<prototypes::id::PeerConnectionObserver, mozilla::dom::PeerConnectionObserver>(args[0], arg0); |
48 | 0 | if (NS_FAILED(rv)) { |
49 | 0 | ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of PeerConnectionImpl.initialize", "PeerConnectionObserver"); |
50 | 0 | return false; |
51 | 0 | } |
52 | 0 | } |
53 | 0 | } else { |
54 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of PeerConnectionImpl.initialize"); |
55 | 0 | return false; |
56 | 0 | } |
57 | 0 | NonNull<nsGlobalWindowInner> arg1; |
58 | 0 | if (args[1].isObject()) { |
59 | 0 | { |
60 | 0 | nsresult rv = UnwrapObject<prototypes::id::Window, nsGlobalWindowInner>(args[1], arg1); |
61 | 0 | if (NS_FAILED(rv)) { |
62 | 0 | ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 2 of PeerConnectionImpl.initialize", "Window"); |
63 | 0 | return false; |
64 | 0 | } |
65 | 0 | } |
66 | 0 | } else { |
67 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 2 of PeerConnectionImpl.initialize"); |
68 | 0 | return false; |
69 | 0 | } |
70 | 0 | binding_detail::FastRTCConfiguration arg2; |
71 | 0 | if (!arg2.Init(cx, args[2], "Argument 3 of PeerConnectionImpl.initialize", false)) { |
72 | 0 | return false; |
73 | 0 | } |
74 | 0 | nsISupports* arg3; |
75 | 0 | RefPtr<nsISupports> arg3_holder; |
76 | 0 | if (args[3].isObject()) { |
77 | 0 | JS::Rooted<JSObject*> source(cx, &args[3].toObject()); |
78 | 0 | if (NS_FAILED(UnwrapArg<nsISupports>(cx, source, getter_AddRefs(arg3_holder)))) { |
79 | 0 | ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 4 of PeerConnectionImpl.initialize", "nsISupports"); |
80 | 0 | return false; |
81 | 0 | } |
82 | 0 | MOZ_ASSERT(arg3_holder); |
83 | 0 | arg3 = arg3_holder; |
84 | 0 | } else { |
85 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 4 of PeerConnectionImpl.initialize"); |
86 | 0 | return false; |
87 | 0 | } |
88 | 0 | FastErrorResult rv; |
89 | 0 | self->Initialize(MOZ_KnownLive(NonNullHelper(arg0)), MOZ_KnownLive(NonNullHelper(arg1)), Constify(arg2), MOZ_KnownLive(NonNullHelper(arg3)), rv); |
90 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
91 | 0 | return false; |
92 | 0 | } |
93 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
94 | 0 | args.rval().setUndefined(); |
95 | 0 | return true; |
96 | 0 | } |
97 | | |
98 | | static const JSJitInfo initialize_methodinfo = { |
99 | | { (JSJitGetterOp)initialize }, |
100 | | { prototypes::id::PeerConnectionImpl }, |
101 | | { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth }, |
102 | | JSJitInfo::Method, |
103 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
104 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
105 | | false, /* isInfallible. False in setters. */ |
106 | | false, /* isMovable. Not relevant for setters. */ |
107 | | false, /* isEliminatable. Not relevant for setters. */ |
108 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
109 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
110 | | false, /* isTypedMethod. Only relevant for methods. */ |
111 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
112 | | }; |
113 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
114 | | static_assert(0 < 1, "There is no slot for us"); |
115 | | |
116 | | MOZ_CAN_RUN_SCRIPT static bool |
117 | | createOffer(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, const JSJitMethodCallArgs& args) |
118 | 0 | { |
119 | 0 | AUTO_PROFILER_LABEL_FAST("PeerConnectionImpl.createOffer", DOM, cx); |
120 | 0 |
|
121 | 0 | binding_detail::FastRTCOfferOptions arg0; |
122 | 0 | if (!arg0.Init(cx, (args.hasDefined(0)) ? args[0] : JS::NullHandleValue, "Argument 1 of PeerConnectionImpl.createOffer", false)) { |
123 | 0 | return false; |
124 | 0 | } |
125 | 0 | FastErrorResult rv; |
126 | 0 | self->CreateOffer(Constify(arg0), rv); |
127 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
128 | 0 | return false; |
129 | 0 | } |
130 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
131 | 0 | args.rval().setUndefined(); |
132 | 0 | return true; |
133 | 0 | } |
134 | | |
135 | | static const JSJitInfo createOffer_methodinfo = { |
136 | | { (JSJitGetterOp)createOffer }, |
137 | | { prototypes::id::PeerConnectionImpl }, |
138 | | { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth }, |
139 | | JSJitInfo::Method, |
140 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
141 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
142 | | false, /* isInfallible. False in setters. */ |
143 | | false, /* isMovable. Not relevant for setters. */ |
144 | | false, /* isEliminatable. Not relevant for setters. */ |
145 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
146 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
147 | | false, /* isTypedMethod. Only relevant for methods. */ |
148 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
149 | | }; |
150 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
151 | | static_assert(0 < 1, "There is no slot for us"); |
152 | | |
153 | | MOZ_CAN_RUN_SCRIPT static bool |
154 | | createAnswer(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, const JSJitMethodCallArgs& args) |
155 | 0 | { |
156 | 0 | AUTO_PROFILER_LABEL_FAST("PeerConnectionImpl.createAnswer", DOM, cx); |
157 | 0 |
|
158 | 0 | FastErrorResult rv; |
159 | 0 | self->CreateAnswer(rv); |
160 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
161 | 0 | return false; |
162 | 0 | } |
163 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
164 | 0 | args.rval().setUndefined(); |
165 | 0 | return true; |
166 | 0 | } |
167 | | |
168 | | static const JSJitInfo createAnswer_methodinfo = { |
169 | | { (JSJitGetterOp)createAnswer }, |
170 | | { prototypes::id::PeerConnectionImpl }, |
171 | | { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth }, |
172 | | JSJitInfo::Method, |
173 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
174 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
175 | | false, /* isInfallible. False in setters. */ |
176 | | false, /* isMovable. Not relevant for setters. */ |
177 | | false, /* isEliminatable. Not relevant for setters. */ |
178 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
179 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
180 | | false, /* isTypedMethod. Only relevant for methods. */ |
181 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
182 | | }; |
183 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
184 | | static_assert(0 < 1, "There is no slot for us"); |
185 | | |
186 | | MOZ_CAN_RUN_SCRIPT static bool |
187 | | setLocalDescription(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, const JSJitMethodCallArgs& args) |
188 | 0 | { |
189 | 0 | AUTO_PROFILER_LABEL_FAST("PeerConnectionImpl.setLocalDescription", DOM, cx); |
190 | 0 |
|
191 | 0 | if (MOZ_UNLIKELY(args.length() < 2)) { |
192 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "PeerConnectionImpl.setLocalDescription"); |
193 | 0 | } |
194 | 0 | int32_t arg0; |
195 | 0 | if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) { |
196 | 0 | return false; |
197 | 0 | } |
198 | 0 | binding_detail::FakeString arg1; |
199 | 0 | if (!ConvertJSValueToString(cx, args[1], eStringify, eStringify, arg1)) { |
200 | 0 | return false; |
201 | 0 | } |
202 | 0 | FastErrorResult rv; |
203 | 0 | self->SetLocalDescription(arg0, NonNullHelper(Constify(arg1)), rv); |
204 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
205 | 0 | return false; |
206 | 0 | } |
207 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
208 | 0 | args.rval().setUndefined(); |
209 | 0 | return true; |
210 | 0 | } |
211 | | |
212 | | static const JSJitInfo setLocalDescription_methodinfo = { |
213 | | { (JSJitGetterOp)setLocalDescription }, |
214 | | { prototypes::id::PeerConnectionImpl }, |
215 | | { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth }, |
216 | | JSJitInfo::Method, |
217 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
218 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
219 | | false, /* isInfallible. False in setters. */ |
220 | | false, /* isMovable. Not relevant for setters. */ |
221 | | false, /* isEliminatable. Not relevant for setters. */ |
222 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
223 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
224 | | false, /* isTypedMethod. Only relevant for methods. */ |
225 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
226 | | }; |
227 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
228 | | static_assert(0 < 1, "There is no slot for us"); |
229 | | |
230 | | MOZ_CAN_RUN_SCRIPT static bool |
231 | | setRemoteDescription(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, const JSJitMethodCallArgs& args) |
232 | 0 | { |
233 | 0 | AUTO_PROFILER_LABEL_FAST("PeerConnectionImpl.setRemoteDescription", DOM, cx); |
234 | 0 |
|
235 | 0 | if (MOZ_UNLIKELY(args.length() < 2)) { |
236 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "PeerConnectionImpl.setRemoteDescription"); |
237 | 0 | } |
238 | 0 | int32_t arg0; |
239 | 0 | if (!ValueToPrimitive<int32_t, eDefault>(cx, args[0], &arg0)) { |
240 | 0 | return false; |
241 | 0 | } |
242 | 0 | binding_detail::FakeString arg1; |
243 | 0 | if (!ConvertJSValueToString(cx, args[1], eStringify, eStringify, arg1)) { |
244 | 0 | return false; |
245 | 0 | } |
246 | 0 | FastErrorResult rv; |
247 | 0 | self->SetRemoteDescription(arg0, NonNullHelper(Constify(arg1)), rv); |
248 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
249 | 0 | return false; |
250 | 0 | } |
251 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
252 | 0 | args.rval().setUndefined(); |
253 | 0 | return true; |
254 | 0 | } |
255 | | |
256 | | static const JSJitInfo setRemoteDescription_methodinfo = { |
257 | | { (JSJitGetterOp)setRemoteDescription }, |
258 | | { prototypes::id::PeerConnectionImpl }, |
259 | | { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth }, |
260 | | JSJitInfo::Method, |
261 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
262 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
263 | | false, /* isInfallible. False in setters. */ |
264 | | false, /* isMovable. Not relevant for setters. */ |
265 | | false, /* isEliminatable. Not relevant for setters. */ |
266 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
267 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
268 | | false, /* isTypedMethod. Only relevant for methods. */ |
269 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
270 | | }; |
271 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
272 | | static_assert(0 < 1, "There is no slot for us"); |
273 | | |
274 | | MOZ_CAN_RUN_SCRIPT static bool |
275 | | getStats(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, const JSJitMethodCallArgs& args) |
276 | 0 | { |
277 | 0 | AUTO_PROFILER_LABEL_FAST("PeerConnectionImpl.getStats", DOM, cx); |
278 | 0 |
|
279 | 0 | if (MOZ_UNLIKELY(args.length() < 1)) { |
280 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "PeerConnectionImpl.getStats"); |
281 | 0 | } |
282 | 0 | mozilla::dom::MediaStreamTrack* arg0; |
283 | 0 | if (args[0].isObject()) { |
284 | 0 | { |
285 | 0 | nsresult rv = UnwrapObject<prototypes::id::MediaStreamTrack, mozilla::dom::MediaStreamTrack>(args[0], arg0); |
286 | 0 | if (NS_FAILED(rv)) { |
287 | 0 | ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of PeerConnectionImpl.getStats", "MediaStreamTrack"); |
288 | 0 | return false; |
289 | 0 | } |
290 | 0 | } |
291 | 0 | } else if (args[0].isNullOrUndefined()) { |
292 | 0 | arg0 = nullptr; |
293 | 0 | } else { |
294 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of PeerConnectionImpl.getStats"); |
295 | 0 | return false; |
296 | 0 | } |
297 | 0 | FastErrorResult rv; |
298 | 0 | self->GetStats(MOZ_KnownLive(Constify(arg0)), rv); |
299 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
300 | 0 | return false; |
301 | 0 | } |
302 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
303 | 0 | args.rval().setUndefined(); |
304 | 0 | return true; |
305 | 0 | } |
306 | | |
307 | | static const JSJitInfo getStats_methodinfo = { |
308 | | { (JSJitGetterOp)getStats }, |
309 | | { prototypes::id::PeerConnectionImpl }, |
310 | | { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth }, |
311 | | JSJitInfo::Method, |
312 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
313 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
314 | | false, /* isInfallible. False in setters. */ |
315 | | false, /* isMovable. Not relevant for setters. */ |
316 | | false, /* isEliminatable. Not relevant for setters. */ |
317 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
318 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
319 | | false, /* isTypedMethod. Only relevant for methods. */ |
320 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
321 | | }; |
322 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
323 | | static_assert(0 < 1, "There is no slot for us"); |
324 | | |
325 | | MOZ_CAN_RUN_SCRIPT static bool |
326 | | createTransceiverImpl(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, const JSJitMethodCallArgs& args) |
327 | 0 | { |
328 | 0 | AUTO_PROFILER_LABEL_FAST("PeerConnectionImpl.createTransceiverImpl", DOM, cx); |
329 | 0 |
|
330 | 0 | if (MOZ_UNLIKELY(args.length() < 2)) { |
331 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "PeerConnectionImpl.createTransceiverImpl"); |
332 | 0 | } |
333 | 0 | binding_detail::FakeString arg0; |
334 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
335 | 0 | return false; |
336 | 0 | } |
337 | 0 | mozilla::dom::MediaStreamTrack* arg1; |
338 | 0 | if (args[1].isObject()) { |
339 | 0 | { |
340 | 0 | nsresult rv = UnwrapObject<prototypes::id::MediaStreamTrack, mozilla::dom::MediaStreamTrack>(args[1], arg1); |
341 | 0 | if (NS_FAILED(rv)) { |
342 | 0 | ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 2 of PeerConnectionImpl.createTransceiverImpl", "MediaStreamTrack"); |
343 | 0 | return false; |
344 | 0 | } |
345 | 0 | } |
346 | 0 | } else if (args[1].isNullOrUndefined()) { |
347 | 0 | arg1 = nullptr; |
348 | 0 | } else { |
349 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 2 of PeerConnectionImpl.createTransceiverImpl"); |
350 | 0 | return false; |
351 | 0 | } |
352 | 0 | FastErrorResult rv; |
353 | 0 | auto result(StrongOrRawPtr<mozilla::TransceiverImpl>(self->CreateTransceiverImpl(NonNullHelper(Constify(arg0)), MOZ_KnownLive(Constify(arg1)), rv))); |
354 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
355 | 0 | return false; |
356 | 0 | } |
357 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
358 | 0 | if (!WrapNewBindingNonWrapperCachedObject(cx, obj, result, args.rval())) { |
359 | 0 | MOZ_ASSERT(JS_IsExceptionPending(cx)); |
360 | 0 | return false; |
361 | 0 | } |
362 | 0 | return true; |
363 | 0 | } |
364 | | |
365 | | static const JSJitInfo createTransceiverImpl_methodinfo = { |
366 | | { (JSJitGetterOp)createTransceiverImpl }, |
367 | | { prototypes::id::PeerConnectionImpl }, |
368 | | { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth }, |
369 | | JSJitInfo::Method, |
370 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
371 | | JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */ |
372 | | false, /* isInfallible. False in setters. */ |
373 | | false, /* isMovable. Not relevant for setters. */ |
374 | | false, /* isEliminatable. Not relevant for setters. */ |
375 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
376 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
377 | | false, /* isTypedMethod. Only relevant for methods. */ |
378 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
379 | | }; |
380 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
381 | | static_assert(0 < 1, "There is no slot for us"); |
382 | | |
383 | | MOZ_CAN_RUN_SCRIPT static bool |
384 | | checkNegotiationNeeded(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, const JSJitMethodCallArgs& args) |
385 | 0 | { |
386 | 0 | AUTO_PROFILER_LABEL_FAST("PeerConnectionImpl.checkNegotiationNeeded", DOM, cx); |
387 | 0 |
|
388 | 0 | FastErrorResult rv; |
389 | 0 | bool result(self->CheckNegotiationNeeded(rv)); |
390 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
391 | 0 | return false; |
392 | 0 | } |
393 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
394 | 0 | args.rval().setBoolean(result); |
395 | 0 | return true; |
396 | 0 | } |
397 | | |
398 | | static const JSJitInfo checkNegotiationNeeded_methodinfo = { |
399 | | { (JSJitGetterOp)checkNegotiationNeeded }, |
400 | | { prototypes::id::PeerConnectionImpl }, |
401 | | { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth }, |
402 | | JSJitInfo::Method, |
403 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
404 | | JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */ |
405 | | false, /* isInfallible. False in setters. */ |
406 | | false, /* isMovable. Not relevant for setters. */ |
407 | | false, /* isEliminatable. Not relevant for setters. */ |
408 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
409 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
410 | | false, /* isTypedMethod. Only relevant for methods. */ |
411 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
412 | | }; |
413 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
414 | | static_assert(0 < 1, "There is no slot for us"); |
415 | | |
416 | | MOZ_CAN_RUN_SCRIPT static bool |
417 | | insertDTMF(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, const JSJitMethodCallArgs& args) |
418 | 0 | { |
419 | 0 | AUTO_PROFILER_LABEL_FAST("PeerConnectionImpl.insertDTMF", DOM, cx); |
420 | 0 |
|
421 | 0 | if (MOZ_UNLIKELY(args.length() < 2)) { |
422 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "PeerConnectionImpl.insertDTMF"); |
423 | 0 | } |
424 | 0 | NonNull<mozilla::TransceiverImpl> arg0; |
425 | 0 | if (args[0].isObject()) { |
426 | 0 | { |
427 | 0 | nsresult rv = UnwrapObject<prototypes::id::TransceiverImpl, mozilla::TransceiverImpl>(args[0], arg0); |
428 | 0 | if (NS_FAILED(rv)) { |
429 | 0 | ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of PeerConnectionImpl.insertDTMF", "TransceiverImpl"); |
430 | 0 | return false; |
431 | 0 | } |
432 | 0 | } |
433 | 0 | } else { |
434 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of PeerConnectionImpl.insertDTMF"); |
435 | 0 | return false; |
436 | 0 | } |
437 | 0 | binding_detail::FakeString arg1; |
438 | 0 | if (!ConvertJSValueToString(cx, args[1], eStringify, eStringify, arg1)) { |
439 | 0 | return false; |
440 | 0 | } |
441 | 0 | uint32_t arg2; |
442 | 0 | if (args.hasDefined(2)) { |
443 | 0 | if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[2], &arg2)) { |
444 | 0 | return false; |
445 | 0 | } |
446 | 0 | } else { |
447 | 0 | arg2 = 100U; |
448 | 0 | } |
449 | 0 | uint32_t arg3; |
450 | 0 | if (args.hasDefined(3)) { |
451 | 0 | if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[3], &arg3)) { |
452 | 0 | return false; |
453 | 0 | } |
454 | 0 | } else { |
455 | 0 | arg3 = 70U; |
456 | 0 | } |
457 | 0 | FastErrorResult rv; |
458 | 0 | self->InsertDTMF(MOZ_KnownLive(NonNullHelper(arg0)), NonNullHelper(Constify(arg1)), arg2, arg3, rv); |
459 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
460 | 0 | return false; |
461 | 0 | } |
462 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
463 | 0 | args.rval().setUndefined(); |
464 | 0 | return true; |
465 | 0 | } |
466 | | |
467 | | static const JSJitInfo insertDTMF_methodinfo = { |
468 | | { (JSJitGetterOp)insertDTMF }, |
469 | | { prototypes::id::PeerConnectionImpl }, |
470 | | { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth }, |
471 | | JSJitInfo::Method, |
472 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
473 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
474 | | false, /* isInfallible. False in setters. */ |
475 | | false, /* isMovable. Not relevant for setters. */ |
476 | | false, /* isEliminatable. Not relevant for setters. */ |
477 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
478 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
479 | | false, /* isTypedMethod. Only relevant for methods. */ |
480 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
481 | | }; |
482 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
483 | | static_assert(0 < 1, "There is no slot for us"); |
484 | | |
485 | | MOZ_CAN_RUN_SCRIPT static bool |
486 | | getDTMFToneBuffer(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, const JSJitMethodCallArgs& args) |
487 | 0 | { |
488 | 0 | AUTO_PROFILER_LABEL_FAST("PeerConnectionImpl.getDTMFToneBuffer", DOM, cx); |
489 | 0 |
|
490 | 0 | if (MOZ_UNLIKELY(args.length() < 1)) { |
491 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "PeerConnectionImpl.getDTMFToneBuffer"); |
492 | 0 | } |
493 | 0 | NonNull<mozilla::dom::RTCRtpSender> arg0; |
494 | 0 | if (args[0].isObject()) { |
495 | 0 | { |
496 | 0 | nsresult rv = UnwrapObject<prototypes::id::RTCRtpSender, mozilla::dom::RTCRtpSender>(args[0], arg0); |
497 | 0 | if (NS_FAILED(rv)) { |
498 | 0 | ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of PeerConnectionImpl.getDTMFToneBuffer", "RTCRtpSender"); |
499 | 0 | return false; |
500 | 0 | } |
501 | 0 | } |
502 | 0 | } else { |
503 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of PeerConnectionImpl.getDTMFToneBuffer"); |
504 | 0 | return false; |
505 | 0 | } |
506 | 0 | FastErrorResult rv; |
507 | 0 | DOMString result; |
508 | 0 | self->GetDTMFToneBuffer(MOZ_KnownLive(NonNullHelper(arg0)), result, rv); |
509 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
510 | 0 | return false; |
511 | 0 | } |
512 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
513 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
514 | 0 | return false; |
515 | 0 | } |
516 | 0 | return true; |
517 | 0 | } |
518 | | |
519 | | static const JSJitInfo getDTMFToneBuffer_methodinfo = { |
520 | | { (JSJitGetterOp)getDTMFToneBuffer }, |
521 | | { prototypes::id::PeerConnectionImpl }, |
522 | | { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth }, |
523 | | JSJitInfo::Method, |
524 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
525 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
526 | | false, /* isInfallible. False in setters. */ |
527 | | false, /* isMovable. Not relevant for setters. */ |
528 | | false, /* isEliminatable. Not relevant for setters. */ |
529 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
530 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
531 | | false, /* isTypedMethod. Only relevant for methods. */ |
532 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
533 | | }; |
534 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
535 | | static_assert(0 < 1, "There is no slot for us"); |
536 | | |
537 | | MOZ_CAN_RUN_SCRIPT static bool |
538 | | getRtpSources(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, const JSJitMethodCallArgs& args) |
539 | 0 | { |
540 | 0 | AUTO_PROFILER_LABEL_FAST("PeerConnectionImpl.getRtpSources", DOM, cx); |
541 | 0 |
|
542 | 0 | if (MOZ_UNLIKELY(args.length() < 2)) { |
543 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "PeerConnectionImpl.getRtpSources"); |
544 | 0 | } |
545 | 0 | NonNull<mozilla::dom::MediaStreamTrack> arg0; |
546 | 0 | if (args[0].isObject()) { |
547 | 0 | { |
548 | 0 | nsresult rv = UnwrapObject<prototypes::id::MediaStreamTrack, mozilla::dom::MediaStreamTrack>(args[0], arg0); |
549 | 0 | if (NS_FAILED(rv)) { |
550 | 0 | ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of PeerConnectionImpl.getRtpSources", "MediaStreamTrack"); |
551 | 0 | return false; |
552 | 0 | } |
553 | 0 | } |
554 | 0 | } else { |
555 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of PeerConnectionImpl.getRtpSources"); |
556 | 0 | return false; |
557 | 0 | } |
558 | 0 | double arg1; |
559 | 0 | if (!ValueToPrimitive<double, eDefault>(cx, args[1], &arg1)) { |
560 | 0 | return false; |
561 | 0 | } else if (!mozilla::IsFinite(arg1)) { |
562 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Argument 2 of PeerConnectionImpl.getRtpSources"); |
563 | 0 | return false; |
564 | 0 | } |
565 | 0 | FastErrorResult rv; |
566 | 0 | nsTArray<RTCRtpSourceEntry> result; |
567 | 0 | self->GetRtpSources(MOZ_KnownLive(NonNullHelper(arg0)), arg1, result, rv); |
568 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
569 | 0 | return false; |
570 | 0 | } |
571 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
572 | 0 |
|
573 | 0 | uint32_t length = result.Length(); |
574 | 0 | JS::Rooted<JSObject*> returnArray(cx, JS_NewArrayObject(cx, length)); |
575 | 0 | if (!returnArray) { |
576 | 0 | return false; |
577 | 0 | } |
578 | 0 | // Scope for 'tmp' |
579 | 0 | { |
580 | 0 | JS::Rooted<JS::Value> tmp(cx); |
581 | 0 | for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) { |
582 | 0 | // Control block to let us common up the JS_DefineElement calls when there |
583 | 0 | // are different ways to succeed at wrapping the object. |
584 | 0 | do { |
585 | 0 | if (!result[sequenceIdx0].ToObjectInternal(cx, &tmp)) { |
586 | 0 | return false; |
587 | 0 | } |
588 | 0 | break; |
589 | 0 | } while (false); |
590 | 0 | if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp, |
591 | 0 | JSPROP_ENUMERATE)) { |
592 | 0 | return false; |
593 | 0 | } |
594 | 0 | } |
595 | 0 | } |
596 | 0 | args.rval().setObject(*returnArray); |
597 | 0 | return true; |
598 | 0 | } |
599 | | |
600 | | static const JSJitInfo getRtpSources_methodinfo = { |
601 | | { (JSJitGetterOp)getRtpSources }, |
602 | | { prototypes::id::PeerConnectionImpl }, |
603 | | { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth }, |
604 | | JSJitInfo::Method, |
605 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
606 | | JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */ |
607 | | false, /* isInfallible. False in setters. */ |
608 | | false, /* isMovable. Not relevant for setters. */ |
609 | | false, /* isEliminatable. Not relevant for setters. */ |
610 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
611 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
612 | | false, /* isTypedMethod. Only relevant for methods. */ |
613 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
614 | | }; |
615 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
616 | | static_assert(0 < 1, "There is no slot for us"); |
617 | | |
618 | | MOZ_CAN_RUN_SCRIPT static bool |
619 | | getNowInRtpSourceReferenceTime(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, const JSJitMethodCallArgs& args) |
620 | 0 | { |
621 | 0 | AUTO_PROFILER_LABEL_FAST("PeerConnectionImpl.getNowInRtpSourceReferenceTime", DOM, cx); |
622 | 0 |
|
623 | 0 | double result(self->GetNowInRtpSourceReferenceTime()); |
624 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
625 | 0 | args.rval().set(JS_NumberValue(double(result))); |
626 | 0 | return true; |
627 | 0 | } |
628 | | |
629 | | static const JSJitInfo getNowInRtpSourceReferenceTime_methodinfo = { |
630 | | { (JSJitGetterOp)getNowInRtpSourceReferenceTime }, |
631 | | { prototypes::id::PeerConnectionImpl }, |
632 | | { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth }, |
633 | | JSJitInfo::Method, |
634 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
635 | | JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ |
636 | | true, /* isInfallible. False in setters. */ |
637 | | false, /* isMovable. Not relevant for setters. */ |
638 | | false, /* isEliminatable. Not relevant for setters. */ |
639 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
640 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
641 | | false, /* isTypedMethod. Only relevant for methods. */ |
642 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
643 | | }; |
644 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
645 | | static_assert(0 < 1, "There is no slot for us"); |
646 | | |
647 | | MOZ_CAN_RUN_SCRIPT static bool |
648 | | replaceTrackNoRenegotiation(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, const JSJitMethodCallArgs& args) |
649 | 0 | { |
650 | 0 | AUTO_PROFILER_LABEL_FAST("PeerConnectionImpl.replaceTrackNoRenegotiation", DOM, cx); |
651 | 0 |
|
652 | 0 | if (MOZ_UNLIKELY(args.length() < 2)) { |
653 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "PeerConnectionImpl.replaceTrackNoRenegotiation"); |
654 | 0 | } |
655 | 0 | NonNull<mozilla::TransceiverImpl> arg0; |
656 | 0 | if (args[0].isObject()) { |
657 | 0 | { |
658 | 0 | nsresult rv = UnwrapObject<prototypes::id::TransceiverImpl, mozilla::TransceiverImpl>(args[0], arg0); |
659 | 0 | if (NS_FAILED(rv)) { |
660 | 0 | ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of PeerConnectionImpl.replaceTrackNoRenegotiation", "TransceiverImpl"); |
661 | 0 | return false; |
662 | 0 | } |
663 | 0 | } |
664 | 0 | } else { |
665 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of PeerConnectionImpl.replaceTrackNoRenegotiation"); |
666 | 0 | return false; |
667 | 0 | } |
668 | 0 | mozilla::dom::MediaStreamTrack* arg1; |
669 | 0 | if (args[1].isObject()) { |
670 | 0 | { |
671 | 0 | nsresult rv = UnwrapObject<prototypes::id::MediaStreamTrack, mozilla::dom::MediaStreamTrack>(args[1], arg1); |
672 | 0 | if (NS_FAILED(rv)) { |
673 | 0 | ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 2 of PeerConnectionImpl.replaceTrackNoRenegotiation", "MediaStreamTrack"); |
674 | 0 | return false; |
675 | 0 | } |
676 | 0 | } |
677 | 0 | } else if (args[1].isNullOrUndefined()) { |
678 | 0 | arg1 = nullptr; |
679 | 0 | } else { |
680 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 2 of PeerConnectionImpl.replaceTrackNoRenegotiation"); |
681 | 0 | return false; |
682 | 0 | } |
683 | 0 | FastErrorResult rv; |
684 | 0 | self->ReplaceTrackNoRenegotiation(MOZ_KnownLive(NonNullHelper(arg0)), MOZ_KnownLive(Constify(arg1)), rv); |
685 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
686 | 0 | return false; |
687 | 0 | } |
688 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
689 | 0 | args.rval().setUndefined(); |
690 | 0 | return true; |
691 | 0 | } |
692 | | |
693 | | static const JSJitInfo replaceTrackNoRenegotiation_methodinfo = { |
694 | | { (JSJitGetterOp)replaceTrackNoRenegotiation }, |
695 | | { prototypes::id::PeerConnectionImpl }, |
696 | | { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth }, |
697 | | JSJitInfo::Method, |
698 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
699 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
700 | | false, /* isInfallible. False in setters. */ |
701 | | false, /* isMovable. Not relevant for setters. */ |
702 | | false, /* isEliminatable. Not relevant for setters. */ |
703 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
704 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
705 | | false, /* isTypedMethod. Only relevant for methods. */ |
706 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
707 | | }; |
708 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
709 | | static_assert(0 < 1, "There is no slot for us"); |
710 | | |
711 | | MOZ_CAN_RUN_SCRIPT static bool |
712 | | closeStreams(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, const JSJitMethodCallArgs& args) |
713 | 0 | { |
714 | 0 | AUTO_PROFILER_LABEL_FAST("PeerConnectionImpl.closeStreams", DOM, cx); |
715 | 0 |
|
716 | 0 | FastErrorResult rv; |
717 | 0 | self->CloseStreams(rv); |
718 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
719 | 0 | return false; |
720 | 0 | } |
721 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
722 | 0 | args.rval().setUndefined(); |
723 | 0 | return true; |
724 | 0 | } |
725 | | |
726 | | static const JSJitInfo closeStreams_methodinfo = { |
727 | | { (JSJitGetterOp)closeStreams }, |
728 | | { prototypes::id::PeerConnectionImpl }, |
729 | | { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth }, |
730 | | JSJitInfo::Method, |
731 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
732 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
733 | | false, /* isInfallible. False in setters. */ |
734 | | false, /* isMovable. Not relevant for setters. */ |
735 | | false, /* isEliminatable. Not relevant for setters. */ |
736 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
737 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
738 | | false, /* isTypedMethod. Only relevant for methods. */ |
739 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
740 | | }; |
741 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
742 | | static_assert(0 < 1, "There is no slot for us"); |
743 | | |
744 | | MOZ_CAN_RUN_SCRIPT static bool |
745 | | addRIDExtension(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, const JSJitMethodCallArgs& args) |
746 | 0 | { |
747 | 0 | AUTO_PROFILER_LABEL_FAST("PeerConnectionImpl.addRIDExtension", DOM, cx); |
748 | 0 |
|
749 | 0 | if (MOZ_UNLIKELY(args.length() < 2)) { |
750 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "PeerConnectionImpl.addRIDExtension"); |
751 | 0 | } |
752 | 0 | NonNull<mozilla::dom::MediaStreamTrack> arg0; |
753 | 0 | if (args[0].isObject()) { |
754 | 0 | { |
755 | 0 | nsresult rv = UnwrapObject<prototypes::id::MediaStreamTrack, mozilla::dom::MediaStreamTrack>(args[0], arg0); |
756 | 0 | if (NS_FAILED(rv)) { |
757 | 0 | ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of PeerConnectionImpl.addRIDExtension", "MediaStreamTrack"); |
758 | 0 | return false; |
759 | 0 | } |
760 | 0 | } |
761 | 0 | } else { |
762 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of PeerConnectionImpl.addRIDExtension"); |
763 | 0 | return false; |
764 | 0 | } |
765 | 0 | uint16_t arg1; |
766 | 0 | if (!ValueToPrimitive<uint16_t, eDefault>(cx, args[1], &arg1)) { |
767 | 0 | return false; |
768 | 0 | } |
769 | 0 | FastErrorResult rv; |
770 | 0 | self->AddRIDExtension(MOZ_KnownLive(NonNullHelper(arg0)), arg1, rv); |
771 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
772 | 0 | return false; |
773 | 0 | } |
774 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
775 | 0 | args.rval().setUndefined(); |
776 | 0 | return true; |
777 | 0 | } |
778 | | |
779 | | static const JSJitInfo addRIDExtension_methodinfo = { |
780 | | { (JSJitGetterOp)addRIDExtension }, |
781 | | { prototypes::id::PeerConnectionImpl }, |
782 | | { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth }, |
783 | | JSJitInfo::Method, |
784 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
785 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
786 | | false, /* isInfallible. False in setters. */ |
787 | | false, /* isMovable. Not relevant for setters. */ |
788 | | false, /* isEliminatable. Not relevant for setters. */ |
789 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
790 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
791 | | false, /* isTypedMethod. Only relevant for methods. */ |
792 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
793 | | }; |
794 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
795 | | static_assert(0 < 1, "There is no slot for us"); |
796 | | |
797 | | MOZ_CAN_RUN_SCRIPT static bool |
798 | | addRIDFilter(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, const JSJitMethodCallArgs& args) |
799 | 0 | { |
800 | 0 | AUTO_PROFILER_LABEL_FAST("PeerConnectionImpl.addRIDFilter", DOM, cx); |
801 | 0 |
|
802 | 0 | if (MOZ_UNLIKELY(args.length() < 2)) { |
803 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "PeerConnectionImpl.addRIDFilter"); |
804 | 0 | } |
805 | 0 | NonNull<mozilla::dom::MediaStreamTrack> arg0; |
806 | 0 | if (args[0].isObject()) { |
807 | 0 | { |
808 | 0 | nsresult rv = UnwrapObject<prototypes::id::MediaStreamTrack, mozilla::dom::MediaStreamTrack>(args[0], arg0); |
809 | 0 | if (NS_FAILED(rv)) { |
810 | 0 | ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of PeerConnectionImpl.addRIDFilter", "MediaStreamTrack"); |
811 | 0 | return false; |
812 | 0 | } |
813 | 0 | } |
814 | 0 | } else { |
815 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of PeerConnectionImpl.addRIDFilter"); |
816 | 0 | return false; |
817 | 0 | } |
818 | 0 | binding_detail::FakeString arg1; |
819 | 0 | if (!ConvertJSValueToString(cx, args[1], eStringify, eStringify, arg1)) { |
820 | 0 | return false; |
821 | 0 | } |
822 | 0 | FastErrorResult rv; |
823 | 0 | self->AddRIDFilter(MOZ_KnownLive(NonNullHelper(arg0)), NonNullHelper(Constify(arg1)), rv); |
824 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
825 | 0 | return false; |
826 | 0 | } |
827 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
828 | 0 | args.rval().setUndefined(); |
829 | 0 | return true; |
830 | 0 | } |
831 | | |
832 | | static const JSJitInfo addRIDFilter_methodinfo = { |
833 | | { (JSJitGetterOp)addRIDFilter }, |
834 | | { prototypes::id::PeerConnectionImpl }, |
835 | | { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth }, |
836 | | JSJitInfo::Method, |
837 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
838 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
839 | | false, /* isInfallible. False in setters. */ |
840 | | false, /* isMovable. Not relevant for setters. */ |
841 | | false, /* isEliminatable. Not relevant for setters. */ |
842 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
843 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
844 | | false, /* isTypedMethod. Only relevant for methods. */ |
845 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
846 | | }; |
847 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
848 | | static_assert(0 < 1, "There is no slot for us"); |
849 | | |
850 | | MOZ_CAN_RUN_SCRIPT static bool |
851 | | insertAudioLevelForContributingSource(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, const JSJitMethodCallArgs& args) |
852 | 0 | { |
853 | 0 | AUTO_PROFILER_LABEL_FAST("PeerConnectionImpl.insertAudioLevelForContributingSource", DOM, cx); |
854 | 0 |
|
855 | 0 | if (MOZ_UNLIKELY(args.length() < 5)) { |
856 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "PeerConnectionImpl.insertAudioLevelForContributingSource"); |
857 | 0 | } |
858 | 0 | NonNull<mozilla::dom::MediaStreamTrack> arg0; |
859 | 0 | if (args[0].isObject()) { |
860 | 0 | { |
861 | 0 | nsresult rv = UnwrapObject<prototypes::id::MediaStreamTrack, mozilla::dom::MediaStreamTrack>(args[0], arg0); |
862 | 0 | if (NS_FAILED(rv)) { |
863 | 0 | ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of PeerConnectionImpl.insertAudioLevelForContributingSource", "MediaStreamTrack"); |
864 | 0 | return false; |
865 | 0 | } |
866 | 0 | } |
867 | 0 | } else { |
868 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of PeerConnectionImpl.insertAudioLevelForContributingSource"); |
869 | 0 | return false; |
870 | 0 | } |
871 | 0 | uint32_t arg1; |
872 | 0 | if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[1], &arg1)) { |
873 | 0 | return false; |
874 | 0 | } |
875 | 0 | double arg2; |
876 | 0 | if (!ValueToPrimitive<double, eDefault>(cx, args[2], &arg2)) { |
877 | 0 | return false; |
878 | 0 | } else if (!mozilla::IsFinite(arg2)) { |
879 | 0 | ThrowErrorMessage(cx, MSG_NOT_FINITE, "Argument 3 of PeerConnectionImpl.insertAudioLevelForContributingSource"); |
880 | 0 | return false; |
881 | 0 | } |
882 | 0 | bool arg3; |
883 | 0 | if (!ValueToPrimitive<bool, eDefault>(cx, args[3], &arg3)) { |
884 | 0 | return false; |
885 | 0 | } |
886 | 0 | int8_t arg4; |
887 | 0 | if (!ValueToPrimitive<int8_t, eDefault>(cx, args[4], &arg4)) { |
888 | 0 | return false; |
889 | 0 | } |
890 | 0 | FastErrorResult rv; |
891 | 0 | self->InsertAudioLevelForContributingSource(MOZ_KnownLive(NonNullHelper(arg0)), arg1, arg2, arg3, arg4, rv); |
892 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
893 | 0 | return false; |
894 | 0 | } |
895 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
896 | 0 | args.rval().setUndefined(); |
897 | 0 | return true; |
898 | 0 | } |
899 | | |
900 | | static const JSJitInfo insertAudioLevelForContributingSource_methodinfo = { |
901 | | { (JSJitGetterOp)insertAudioLevelForContributingSource }, |
902 | | { prototypes::id::PeerConnectionImpl }, |
903 | | { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth }, |
904 | | JSJitInfo::Method, |
905 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
906 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
907 | | false, /* isInfallible. False in setters. */ |
908 | | false, /* isMovable. Not relevant for setters. */ |
909 | | false, /* isEliminatable. Not relevant for setters. */ |
910 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
911 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
912 | | false, /* isTypedMethod. Only relevant for methods. */ |
913 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
914 | | }; |
915 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
916 | | static_assert(0 < 1, "There is no slot for us"); |
917 | | |
918 | | MOZ_CAN_RUN_SCRIPT static bool |
919 | | enablePacketDump(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, const JSJitMethodCallArgs& args) |
920 | 0 | { |
921 | 0 | AUTO_PROFILER_LABEL_FAST("PeerConnectionImpl.enablePacketDump", DOM, cx); |
922 | 0 |
|
923 | 0 | if (MOZ_UNLIKELY(args.length() < 3)) { |
924 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "PeerConnectionImpl.enablePacketDump"); |
925 | 0 | } |
926 | 0 | uint32_t arg0; |
927 | 0 | if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) { |
928 | 0 | return false; |
929 | 0 | } |
930 | 0 | mozPacketDumpType arg1; |
931 | 0 | { |
932 | 0 | int index; |
933 | 0 | if (!FindEnumStringIndex<true>(cx, args[1], mozPacketDumpTypeValues::strings, "mozPacketDumpType", "Argument 2 of PeerConnectionImpl.enablePacketDump", &index)) { |
934 | 0 | return false; |
935 | 0 | } |
936 | 0 | MOZ_ASSERT(index >= 0); |
937 | 0 | arg1 = static_cast<mozPacketDumpType>(index); |
938 | 0 | } |
939 | 0 | bool arg2; |
940 | 0 | if (!ValueToPrimitive<bool, eDefault>(cx, args[2], &arg2)) { |
941 | 0 | return false; |
942 | 0 | } |
943 | 0 | FastErrorResult rv; |
944 | 0 | self->EnablePacketDump(arg0, arg1, arg2, rv); |
945 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
946 | 0 | return false; |
947 | 0 | } |
948 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
949 | 0 | args.rval().setUndefined(); |
950 | 0 | return true; |
951 | 0 | } |
952 | | |
953 | | static const JSJitInfo enablePacketDump_methodinfo = { |
954 | | { (JSJitGetterOp)enablePacketDump }, |
955 | | { prototypes::id::PeerConnectionImpl }, |
956 | | { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth }, |
957 | | JSJitInfo::Method, |
958 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
959 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
960 | | false, /* isInfallible. False in setters. */ |
961 | | false, /* isMovable. Not relevant for setters. */ |
962 | | false, /* isEliminatable. Not relevant for setters. */ |
963 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
964 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
965 | | false, /* isTypedMethod. Only relevant for methods. */ |
966 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
967 | | }; |
968 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
969 | | static_assert(0 < 1, "There is no slot for us"); |
970 | | |
971 | | MOZ_CAN_RUN_SCRIPT static bool |
972 | | disablePacketDump(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, const JSJitMethodCallArgs& args) |
973 | 0 | { |
974 | 0 | AUTO_PROFILER_LABEL_FAST("PeerConnectionImpl.disablePacketDump", DOM, cx); |
975 | 0 |
|
976 | 0 | if (MOZ_UNLIKELY(args.length() < 3)) { |
977 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "PeerConnectionImpl.disablePacketDump"); |
978 | 0 | } |
979 | 0 | uint32_t arg0; |
980 | 0 | if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) { |
981 | 0 | return false; |
982 | 0 | } |
983 | 0 | mozPacketDumpType arg1; |
984 | 0 | { |
985 | 0 | int index; |
986 | 0 | if (!FindEnumStringIndex<true>(cx, args[1], mozPacketDumpTypeValues::strings, "mozPacketDumpType", "Argument 2 of PeerConnectionImpl.disablePacketDump", &index)) { |
987 | 0 | return false; |
988 | 0 | } |
989 | 0 | MOZ_ASSERT(index >= 0); |
990 | 0 | arg1 = static_cast<mozPacketDumpType>(index); |
991 | 0 | } |
992 | 0 | bool arg2; |
993 | 0 | if (!ValueToPrimitive<bool, eDefault>(cx, args[2], &arg2)) { |
994 | 0 | return false; |
995 | 0 | } |
996 | 0 | FastErrorResult rv; |
997 | 0 | self->DisablePacketDump(arg0, arg1, arg2, rv); |
998 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
999 | 0 | return false; |
1000 | 0 | } |
1001 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1002 | 0 | args.rval().setUndefined(); |
1003 | 0 | return true; |
1004 | 0 | } |
1005 | | |
1006 | | static const JSJitInfo disablePacketDump_methodinfo = { |
1007 | | { (JSJitGetterOp)disablePacketDump }, |
1008 | | { prototypes::id::PeerConnectionImpl }, |
1009 | | { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth }, |
1010 | | JSJitInfo::Method, |
1011 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1012 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
1013 | | false, /* isInfallible. False in setters. */ |
1014 | | false, /* isMovable. Not relevant for setters. */ |
1015 | | false, /* isEliminatable. Not relevant for setters. */ |
1016 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1017 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1018 | | false, /* isTypedMethod. Only relevant for methods. */ |
1019 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1020 | | }; |
1021 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1022 | | static_assert(0 < 1, "There is no slot for us"); |
1023 | | |
1024 | | MOZ_CAN_RUN_SCRIPT static bool |
1025 | | addIceCandidate(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, const JSJitMethodCallArgs& args) |
1026 | 0 | { |
1027 | 0 | AUTO_PROFILER_LABEL_FAST("PeerConnectionImpl.addIceCandidate", DOM, cx); |
1028 | 0 |
|
1029 | 0 | if (MOZ_UNLIKELY(args.length() < 3)) { |
1030 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "PeerConnectionImpl.addIceCandidate"); |
1031 | 0 | } |
1032 | 0 | binding_detail::FakeString arg0; |
1033 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
1034 | 0 | return false; |
1035 | 0 | } |
1036 | 0 | binding_detail::FakeString arg1; |
1037 | 0 | if (!ConvertJSValueToString(cx, args[1], eStringify, eStringify, arg1)) { |
1038 | 0 | return false; |
1039 | 0 | } |
1040 | 0 | uint16_t arg2; |
1041 | 0 | if (!ValueToPrimitive<uint16_t, eDefault>(cx, args[2], &arg2)) { |
1042 | 0 | return false; |
1043 | 0 | } |
1044 | 0 | FastErrorResult rv; |
1045 | 0 | self->AddIceCandidate(NonNullHelper(Constify(arg0)), NonNullHelper(Constify(arg1)), arg2, rv); |
1046 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
1047 | 0 | return false; |
1048 | 0 | } |
1049 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1050 | 0 | args.rval().setUndefined(); |
1051 | 0 | return true; |
1052 | 0 | } |
1053 | | |
1054 | | static const JSJitInfo addIceCandidate_methodinfo = { |
1055 | | { (JSJitGetterOp)addIceCandidate }, |
1056 | | { prototypes::id::PeerConnectionImpl }, |
1057 | | { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth }, |
1058 | | JSJitInfo::Method, |
1059 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1060 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
1061 | | false, /* isInfallible. False in setters. */ |
1062 | | false, /* isMovable. Not relevant for setters. */ |
1063 | | false, /* isEliminatable. Not relevant for setters. */ |
1064 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1065 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1066 | | false, /* isTypedMethod. Only relevant for methods. */ |
1067 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1068 | | }; |
1069 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1070 | | static_assert(0 < 1, "There is no slot for us"); |
1071 | | |
1072 | | MOZ_CAN_RUN_SCRIPT static bool |
1073 | | close(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, const JSJitMethodCallArgs& args) |
1074 | 0 | { |
1075 | 0 | AUTO_PROFILER_LABEL_FAST("PeerConnectionImpl.close", DOM, cx); |
1076 | 0 |
|
1077 | 0 | FastErrorResult rv; |
1078 | 0 | self->Close(rv); |
1079 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
1080 | 0 | return false; |
1081 | 0 | } |
1082 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1083 | 0 | args.rval().setUndefined(); |
1084 | 0 | return true; |
1085 | 0 | } |
1086 | | |
1087 | | static const JSJitInfo close_methodinfo = { |
1088 | | { (JSJitGetterOp)close }, |
1089 | | { prototypes::id::PeerConnectionImpl }, |
1090 | | { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth }, |
1091 | | JSJitInfo::Method, |
1092 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1093 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
1094 | | false, /* isInfallible. False in setters. */ |
1095 | | false, /* isMovable. Not relevant for setters. */ |
1096 | | false, /* isEliminatable. Not relevant for setters. */ |
1097 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1098 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1099 | | false, /* isTypedMethod. Only relevant for methods. */ |
1100 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1101 | | }; |
1102 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1103 | | static_assert(0 < 1, "There is no slot for us"); |
1104 | | |
1105 | | MOZ_CAN_RUN_SCRIPT static bool |
1106 | | pluginCrash(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, const JSJitMethodCallArgs& args) |
1107 | 0 | { |
1108 | 0 | AUTO_PROFILER_LABEL_FAST("PeerConnectionImpl.pluginCrash", DOM, cx); |
1109 | 0 |
|
1110 | 0 | if (MOZ_UNLIKELY(args.length() < 2)) { |
1111 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "PeerConnectionImpl.pluginCrash"); |
1112 | 0 | } |
1113 | 0 | uint64_t arg0; |
1114 | 0 | if (!ValueToPrimitive<uint64_t, eDefault>(cx, args[0], &arg0)) { |
1115 | 0 | return false; |
1116 | 0 | } |
1117 | 0 | binding_detail::FakeString arg1; |
1118 | 0 | if (!ConvertJSValueToString(cx, args[1], eStringify, eStringify, arg1)) { |
1119 | 0 | return false; |
1120 | 0 | } |
1121 | 0 | bool result(self->PluginCrash(arg0, NonNullHelper(Constify(arg1)))); |
1122 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1123 | 0 | args.rval().setBoolean(result); |
1124 | 0 | return true; |
1125 | 0 | } |
1126 | | |
1127 | | static const JSJitInfo pluginCrash_methodinfo = { |
1128 | | { (JSJitGetterOp)pluginCrash }, |
1129 | | { prototypes::id::PeerConnectionImpl }, |
1130 | | { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth }, |
1131 | | JSJitInfo::Method, |
1132 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1133 | | JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */ |
1134 | | false, /* isInfallible. False in setters. */ |
1135 | | false, /* isMovable. Not relevant for setters. */ |
1136 | | false, /* isEliminatable. Not relevant for setters. */ |
1137 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1138 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1139 | | false, /* isTypedMethod. Only relevant for methods. */ |
1140 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1141 | | }; |
1142 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1143 | | static_assert(0 < 1, "There is no slot for us"); |
1144 | | |
1145 | | MOZ_CAN_RUN_SCRIPT static bool |
1146 | | get_certificate(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, JSJitGetterCallArgs args) |
1147 | 0 | { |
1148 | 0 | AUTO_PROFILER_LABEL_FAST("get PeerConnectionImpl.certificate", DOM, cx); |
1149 | 0 |
|
1150 | 0 | auto result(StrongOrRawPtr<mozilla::dom::RTCCertificate>(self->Certificate())); |
1151 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1152 | 0 | if (!GetOrCreateDOMReflector(cx, result, args.rval())) { |
1153 | 0 | MOZ_ASSERT(JS_IsExceptionPending(cx)); |
1154 | 0 | return false; |
1155 | 0 | } |
1156 | 0 | return true; |
1157 | 0 | } |
1158 | | |
1159 | | MOZ_CAN_RUN_SCRIPT static bool |
1160 | | set_certificate(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, JSJitSetterCallArgs args) |
1161 | 0 | { |
1162 | 0 | AUTO_PROFILER_LABEL_FAST("set PeerConnectionImpl.certificate", DOM, cx); |
1163 | 0 |
|
1164 | 0 | NonNull<mozilla::dom::RTCCertificate> arg0; |
1165 | 0 | if (args[0].isObject()) { |
1166 | 0 | { |
1167 | 0 | nsresult rv = UnwrapObject<prototypes::id::RTCCertificate, mozilla::dom::RTCCertificate>(args[0], arg0); |
1168 | 0 | if (NS_FAILED(rv)) { |
1169 | 0 | ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Value being assigned to PeerConnectionImpl.certificate", "RTCCertificate"); |
1170 | 0 | return false; |
1171 | 0 | } |
1172 | 0 | } |
1173 | 0 | } else { |
1174 | 0 | ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Value being assigned to PeerConnectionImpl.certificate"); |
1175 | 0 | return false; |
1176 | 0 | } |
1177 | 0 | self->SetCertificate(MOZ_KnownLive(NonNullHelper(arg0))); |
1178 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1179 | 0 |
|
1180 | 0 | return true; |
1181 | 0 | } |
1182 | | |
1183 | | static const JSJitInfo certificate_getterinfo = { |
1184 | | { (JSJitGetterOp)get_certificate }, |
1185 | | { prototypes::id::PeerConnectionImpl }, |
1186 | | { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth }, |
1187 | | JSJitInfo::Getter, |
1188 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1189 | | JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */ |
1190 | | false, /* isInfallible. False in setters. */ |
1191 | | false, /* isMovable. Not relevant for setters. */ |
1192 | | false, /* isEliminatable. Not relevant for setters. */ |
1193 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1194 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1195 | | false, /* isTypedMethod. Only relevant for methods. */ |
1196 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1197 | | }; |
1198 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1199 | | static_assert(0 < 1, "There is no slot for us"); |
1200 | | static const JSJitInfo certificate_setterinfo = { |
1201 | | { (JSJitGetterOp)set_certificate }, |
1202 | | { prototypes::id::PeerConnectionImpl }, |
1203 | | { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth }, |
1204 | | JSJitInfo::Setter, |
1205 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1206 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
1207 | | false, /* isInfallible. False in setters. */ |
1208 | | false, /* isMovable. Not relevant for setters. */ |
1209 | | false, /* isEliminatable. Not relevant for setters. */ |
1210 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1211 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1212 | | false, /* isTypedMethod. Only relevant for methods. */ |
1213 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1214 | | }; |
1215 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1216 | | static_assert(0 < 1, "There is no slot for us"); |
1217 | | |
1218 | | MOZ_CAN_RUN_SCRIPT static bool |
1219 | | get_fingerprint(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, JSJitGetterCallArgs args) |
1220 | 0 | { |
1221 | 0 | AUTO_PROFILER_LABEL_FAST("get PeerConnectionImpl.fingerprint", DOM, cx); |
1222 | 0 |
|
1223 | 0 | DOMString result; |
1224 | 0 | self->GetFingerprint(result); |
1225 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1226 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
1227 | 0 | return false; |
1228 | 0 | } |
1229 | 0 | return true; |
1230 | 0 | } |
1231 | | |
1232 | | static const JSJitInfo fingerprint_getterinfo = { |
1233 | | { (JSJitGetterOp)get_fingerprint }, |
1234 | | { prototypes::id::PeerConnectionImpl }, |
1235 | | { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth }, |
1236 | | JSJitInfo::Getter, |
1237 | | JSJitInfo::AliasNone, /* aliasSet. Not relevant for setters. */ |
1238 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
1239 | | false, /* isInfallible. False in setters. */ |
1240 | | true, /* isMovable. Not relevant for setters. */ |
1241 | | true, /* isEliminatable. Not relevant for setters. */ |
1242 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1243 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1244 | | false, /* isTypedMethod. Only relevant for methods. */ |
1245 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1246 | | }; |
1247 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1248 | | static_assert(0 < 1, "There is no slot for us"); |
1249 | | |
1250 | | MOZ_CAN_RUN_SCRIPT static bool |
1251 | | get_localDescription(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, JSJitGetterCallArgs args) |
1252 | 0 | { |
1253 | 0 | AUTO_PROFILER_LABEL_FAST("get PeerConnectionImpl.localDescription", DOM, cx); |
1254 | 0 |
|
1255 | 0 | DOMString result; |
1256 | 0 | self->GetLocalDescription(result); |
1257 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1258 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
1259 | 0 | return false; |
1260 | 0 | } |
1261 | 0 | return true; |
1262 | 0 | } |
1263 | | |
1264 | | static const JSJitInfo localDescription_getterinfo = { |
1265 | | { (JSJitGetterOp)get_localDescription }, |
1266 | | { prototypes::id::PeerConnectionImpl }, |
1267 | | { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth }, |
1268 | | JSJitInfo::Getter, |
1269 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1270 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
1271 | | false, /* isInfallible. False in setters. */ |
1272 | | false, /* isMovable. Not relevant for setters. */ |
1273 | | false, /* isEliminatable. Not relevant for setters. */ |
1274 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1275 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1276 | | false, /* isTypedMethod. Only relevant for methods. */ |
1277 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1278 | | }; |
1279 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1280 | | static_assert(0 < 1, "There is no slot for us"); |
1281 | | |
1282 | | MOZ_CAN_RUN_SCRIPT static bool |
1283 | | get_currentLocalDescription(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, JSJitGetterCallArgs args) |
1284 | 0 | { |
1285 | 0 | AUTO_PROFILER_LABEL_FAST("get PeerConnectionImpl.currentLocalDescription", DOM, cx); |
1286 | 0 |
|
1287 | 0 | DOMString result; |
1288 | 0 | self->GetCurrentLocalDescription(result); |
1289 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1290 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
1291 | 0 | return false; |
1292 | 0 | } |
1293 | 0 | return true; |
1294 | 0 | } |
1295 | | |
1296 | | static const JSJitInfo currentLocalDescription_getterinfo = { |
1297 | | { (JSJitGetterOp)get_currentLocalDescription }, |
1298 | | { prototypes::id::PeerConnectionImpl }, |
1299 | | { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth }, |
1300 | | JSJitInfo::Getter, |
1301 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1302 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
1303 | | false, /* isInfallible. False in setters. */ |
1304 | | false, /* isMovable. Not relevant for setters. */ |
1305 | | false, /* isEliminatable. Not relevant for setters. */ |
1306 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1307 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1308 | | false, /* isTypedMethod. Only relevant for methods. */ |
1309 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1310 | | }; |
1311 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1312 | | static_assert(0 < 1, "There is no slot for us"); |
1313 | | |
1314 | | MOZ_CAN_RUN_SCRIPT static bool |
1315 | | get_pendingLocalDescription(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, JSJitGetterCallArgs args) |
1316 | 0 | { |
1317 | 0 | AUTO_PROFILER_LABEL_FAST("get PeerConnectionImpl.pendingLocalDescription", DOM, cx); |
1318 | 0 |
|
1319 | 0 | DOMString result; |
1320 | 0 | self->GetPendingLocalDescription(result); |
1321 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1322 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
1323 | 0 | return false; |
1324 | 0 | } |
1325 | 0 | return true; |
1326 | 0 | } |
1327 | | |
1328 | | static const JSJitInfo pendingLocalDescription_getterinfo = { |
1329 | | { (JSJitGetterOp)get_pendingLocalDescription }, |
1330 | | { prototypes::id::PeerConnectionImpl }, |
1331 | | { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth }, |
1332 | | JSJitInfo::Getter, |
1333 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1334 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
1335 | | false, /* isInfallible. False in setters. */ |
1336 | | false, /* isMovable. Not relevant for setters. */ |
1337 | | false, /* isEliminatable. Not relevant for setters. */ |
1338 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1339 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1340 | | false, /* isTypedMethod. Only relevant for methods. */ |
1341 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1342 | | }; |
1343 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1344 | | static_assert(0 < 1, "There is no slot for us"); |
1345 | | |
1346 | | MOZ_CAN_RUN_SCRIPT static bool |
1347 | | get_remoteDescription(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, JSJitGetterCallArgs args) |
1348 | 0 | { |
1349 | 0 | AUTO_PROFILER_LABEL_FAST("get PeerConnectionImpl.remoteDescription", DOM, cx); |
1350 | 0 |
|
1351 | 0 | DOMString result; |
1352 | 0 | self->GetRemoteDescription(result); |
1353 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1354 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
1355 | 0 | return false; |
1356 | 0 | } |
1357 | 0 | return true; |
1358 | 0 | } |
1359 | | |
1360 | | static const JSJitInfo remoteDescription_getterinfo = { |
1361 | | { (JSJitGetterOp)get_remoteDescription }, |
1362 | | { prototypes::id::PeerConnectionImpl }, |
1363 | | { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth }, |
1364 | | JSJitInfo::Getter, |
1365 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1366 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
1367 | | false, /* isInfallible. False in setters. */ |
1368 | | false, /* isMovable. Not relevant for setters. */ |
1369 | | false, /* isEliminatable. Not relevant for setters. */ |
1370 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1371 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1372 | | false, /* isTypedMethod. Only relevant for methods. */ |
1373 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1374 | | }; |
1375 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1376 | | static_assert(0 < 1, "There is no slot for us"); |
1377 | | |
1378 | | MOZ_CAN_RUN_SCRIPT static bool |
1379 | | get_currentRemoteDescription(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, JSJitGetterCallArgs args) |
1380 | 0 | { |
1381 | 0 | AUTO_PROFILER_LABEL_FAST("get PeerConnectionImpl.currentRemoteDescription", DOM, cx); |
1382 | 0 |
|
1383 | 0 | DOMString result; |
1384 | 0 | self->GetCurrentRemoteDescription(result); |
1385 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1386 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
1387 | 0 | return false; |
1388 | 0 | } |
1389 | 0 | return true; |
1390 | 0 | } |
1391 | | |
1392 | | static const JSJitInfo currentRemoteDescription_getterinfo = { |
1393 | | { (JSJitGetterOp)get_currentRemoteDescription }, |
1394 | | { prototypes::id::PeerConnectionImpl }, |
1395 | | { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth }, |
1396 | | JSJitInfo::Getter, |
1397 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1398 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
1399 | | false, /* isInfallible. False in setters. */ |
1400 | | false, /* isMovable. Not relevant for setters. */ |
1401 | | false, /* isEliminatable. Not relevant for setters. */ |
1402 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1403 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1404 | | false, /* isTypedMethod. Only relevant for methods. */ |
1405 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1406 | | }; |
1407 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1408 | | static_assert(0 < 1, "There is no slot for us"); |
1409 | | |
1410 | | MOZ_CAN_RUN_SCRIPT static bool |
1411 | | get_pendingRemoteDescription(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, JSJitGetterCallArgs args) |
1412 | 0 | { |
1413 | 0 | AUTO_PROFILER_LABEL_FAST("get PeerConnectionImpl.pendingRemoteDescription", DOM, cx); |
1414 | 0 |
|
1415 | 0 | DOMString result; |
1416 | 0 | self->GetPendingRemoteDescription(result); |
1417 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1418 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
1419 | 0 | return false; |
1420 | 0 | } |
1421 | 0 | return true; |
1422 | 0 | } |
1423 | | |
1424 | | static const JSJitInfo pendingRemoteDescription_getterinfo = { |
1425 | | { (JSJitGetterOp)get_pendingRemoteDescription }, |
1426 | | { prototypes::id::PeerConnectionImpl }, |
1427 | | { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth }, |
1428 | | JSJitInfo::Getter, |
1429 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1430 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
1431 | | false, /* isInfallible. False in setters. */ |
1432 | | false, /* isMovable. Not relevant for setters. */ |
1433 | | false, /* isEliminatable. Not relevant for setters. */ |
1434 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1435 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1436 | | false, /* isTypedMethod. Only relevant for methods. */ |
1437 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1438 | | }; |
1439 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1440 | | static_assert(0 < 1, "There is no slot for us"); |
1441 | | |
1442 | | MOZ_CAN_RUN_SCRIPT static bool |
1443 | | get_iceConnectionState(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, JSJitGetterCallArgs args) |
1444 | 0 | { |
1445 | 0 | AUTO_PROFILER_LABEL_FAST("get PeerConnectionImpl.iceConnectionState", DOM, cx); |
1446 | 0 |
|
1447 | 0 | PCImplIceConnectionState result(self->IceConnectionState()); |
1448 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1449 | 0 | if (!ToJSValue(cx, result, args.rval())) { |
1450 | 0 | return false; |
1451 | 0 | } |
1452 | 0 | return true; |
1453 | 0 | } |
1454 | | |
1455 | | static const JSJitInfo iceConnectionState_getterinfo = { |
1456 | | { (JSJitGetterOp)get_iceConnectionState }, |
1457 | | { prototypes::id::PeerConnectionImpl }, |
1458 | | { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth }, |
1459 | | JSJitInfo::Getter, |
1460 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1461 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
1462 | | false, /* isInfallible. False in setters. */ |
1463 | | false, /* isMovable. Not relevant for setters. */ |
1464 | | false, /* isEliminatable. Not relevant for setters. */ |
1465 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1466 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1467 | | false, /* isTypedMethod. Only relevant for methods. */ |
1468 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1469 | | }; |
1470 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1471 | | static_assert(0 < 1, "There is no slot for us"); |
1472 | | |
1473 | | MOZ_CAN_RUN_SCRIPT static bool |
1474 | | get_iceGatheringState(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, JSJitGetterCallArgs args) |
1475 | 0 | { |
1476 | 0 | AUTO_PROFILER_LABEL_FAST("get PeerConnectionImpl.iceGatheringState", DOM, cx); |
1477 | 0 |
|
1478 | 0 | PCImplIceGatheringState result(self->IceGatheringState()); |
1479 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1480 | 0 | if (!ToJSValue(cx, result, args.rval())) { |
1481 | 0 | return false; |
1482 | 0 | } |
1483 | 0 | return true; |
1484 | 0 | } |
1485 | | |
1486 | | static const JSJitInfo iceGatheringState_getterinfo = { |
1487 | | { (JSJitGetterOp)get_iceGatheringState }, |
1488 | | { prototypes::id::PeerConnectionImpl }, |
1489 | | { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth }, |
1490 | | JSJitInfo::Getter, |
1491 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1492 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
1493 | | false, /* isInfallible. False in setters. */ |
1494 | | false, /* isMovable. Not relevant for setters. */ |
1495 | | false, /* isEliminatable. Not relevant for setters. */ |
1496 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1497 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1498 | | false, /* isTypedMethod. Only relevant for methods. */ |
1499 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1500 | | }; |
1501 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1502 | | static_assert(0 < 1, "There is no slot for us"); |
1503 | | |
1504 | | MOZ_CAN_RUN_SCRIPT static bool |
1505 | | get_signalingState(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, JSJitGetterCallArgs args) |
1506 | 0 | { |
1507 | 0 | AUTO_PROFILER_LABEL_FAST("get PeerConnectionImpl.signalingState", DOM, cx); |
1508 | 0 |
|
1509 | 0 | PCImplSignalingState result(self->SignalingState()); |
1510 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1511 | 0 | if (!ToJSValue(cx, result, args.rval())) { |
1512 | 0 | return false; |
1513 | 0 | } |
1514 | 0 | return true; |
1515 | 0 | } |
1516 | | |
1517 | | static const JSJitInfo signalingState_getterinfo = { |
1518 | | { (JSJitGetterOp)get_signalingState }, |
1519 | | { prototypes::id::PeerConnectionImpl }, |
1520 | | { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth }, |
1521 | | JSJitInfo::Getter, |
1522 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1523 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
1524 | | false, /* isInfallible. False in setters. */ |
1525 | | false, /* isMovable. Not relevant for setters. */ |
1526 | | false, /* isEliminatable. Not relevant for setters. */ |
1527 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1528 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1529 | | false, /* isTypedMethod. Only relevant for methods. */ |
1530 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1531 | | }; |
1532 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1533 | | static_assert(0 < 1, "There is no slot for us"); |
1534 | | |
1535 | | MOZ_CAN_RUN_SCRIPT static bool |
1536 | | get_id(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, JSJitGetterCallArgs args) |
1537 | 0 | { |
1538 | 0 | AUTO_PROFILER_LABEL_FAST("get PeerConnectionImpl.id", DOM, cx); |
1539 | 0 |
|
1540 | 0 | DOMString result; |
1541 | 0 | self->GetId(result); |
1542 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1543 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
1544 | 0 | return false; |
1545 | 0 | } |
1546 | 0 | return true; |
1547 | 0 | } |
1548 | | |
1549 | | MOZ_CAN_RUN_SCRIPT static bool |
1550 | | set_id(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, JSJitSetterCallArgs args) |
1551 | 0 | { |
1552 | 0 | AUTO_PROFILER_LABEL_FAST("set PeerConnectionImpl.id", DOM, cx); |
1553 | 0 |
|
1554 | 0 | binding_detail::FakeString arg0; |
1555 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
1556 | 0 | return false; |
1557 | 0 | } |
1558 | 0 | self->SetId(NonNullHelper(Constify(arg0))); |
1559 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1560 | 0 |
|
1561 | 0 | return true; |
1562 | 0 | } |
1563 | | |
1564 | | static const JSJitInfo id_getterinfo = { |
1565 | | { (JSJitGetterOp)get_id }, |
1566 | | { prototypes::id::PeerConnectionImpl }, |
1567 | | { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth }, |
1568 | | JSJitInfo::Getter, |
1569 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1570 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
1571 | | false, /* isInfallible. False in setters. */ |
1572 | | false, /* isMovable. Not relevant for setters. */ |
1573 | | false, /* isEliminatable. Not relevant for setters. */ |
1574 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1575 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1576 | | false, /* isTypedMethod. Only relevant for methods. */ |
1577 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1578 | | }; |
1579 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1580 | | static_assert(0 < 1, "There is no slot for us"); |
1581 | | static const JSJitInfo id_setterinfo = { |
1582 | | { (JSJitGetterOp)set_id }, |
1583 | | { prototypes::id::PeerConnectionImpl }, |
1584 | | { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth }, |
1585 | | JSJitInfo::Setter, |
1586 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1587 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
1588 | | false, /* isInfallible. False in setters. */ |
1589 | | false, /* isMovable. Not relevant for setters. */ |
1590 | | false, /* isEliminatable. Not relevant for setters. */ |
1591 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1592 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1593 | | false, /* isTypedMethod. Only relevant for methods. */ |
1594 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1595 | | }; |
1596 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1597 | | static_assert(0 < 1, "There is no slot for us"); |
1598 | | |
1599 | | MOZ_CAN_RUN_SCRIPT static bool |
1600 | | get_peerIdentity(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, JSJitGetterCallArgs args) |
1601 | 0 | { |
1602 | 0 | AUTO_PROFILER_LABEL_FAST("get PeerConnectionImpl.peerIdentity", DOM, cx); |
1603 | 0 |
|
1604 | 0 | DOMString result; |
1605 | 0 | self->GetPeerIdentity(result); |
1606 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1607 | 0 | if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { |
1608 | 0 | return false; |
1609 | 0 | } |
1610 | 0 | return true; |
1611 | 0 | } |
1612 | | |
1613 | | MOZ_CAN_RUN_SCRIPT static bool |
1614 | | set_peerIdentity(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, JSJitSetterCallArgs args) |
1615 | 0 | { |
1616 | 0 | AUTO_PROFILER_LABEL_FAST("set PeerConnectionImpl.peerIdentity", DOM, cx); |
1617 | 0 |
|
1618 | 0 | binding_detail::FakeString arg0; |
1619 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
1620 | 0 | return false; |
1621 | 0 | } |
1622 | 0 | FastErrorResult rv; |
1623 | 0 | self->SetPeerIdentity(NonNullHelper(Constify(arg0)), rv); |
1624 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
1625 | 0 | return false; |
1626 | 0 | } |
1627 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1628 | 0 |
|
1629 | 0 | return true; |
1630 | 0 | } |
1631 | | |
1632 | | static const JSJitInfo peerIdentity_getterinfo = { |
1633 | | { (JSJitGetterOp)get_peerIdentity }, |
1634 | | { prototypes::id::PeerConnectionImpl }, |
1635 | | { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth }, |
1636 | | JSJitInfo::Getter, |
1637 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1638 | | JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ |
1639 | | false, /* isInfallible. False in setters. */ |
1640 | | false, /* isMovable. Not relevant for setters. */ |
1641 | | false, /* isEliminatable. Not relevant for setters. */ |
1642 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1643 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1644 | | false, /* isTypedMethod. Only relevant for methods. */ |
1645 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1646 | | }; |
1647 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1648 | | static_assert(0 < 1, "There is no slot for us"); |
1649 | | static const JSJitInfo peerIdentity_setterinfo = { |
1650 | | { (JSJitGetterOp)set_peerIdentity }, |
1651 | | { prototypes::id::PeerConnectionImpl }, |
1652 | | { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth }, |
1653 | | JSJitInfo::Setter, |
1654 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1655 | | JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ |
1656 | | false, /* isInfallible. False in setters. */ |
1657 | | false, /* isMovable. Not relevant for setters. */ |
1658 | | false, /* isEliminatable. Not relevant for setters. */ |
1659 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1660 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1661 | | false, /* isTypedMethod. Only relevant for methods. */ |
1662 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1663 | | }; |
1664 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1665 | | static_assert(0 < 1, "There is no slot for us"); |
1666 | | |
1667 | | MOZ_CAN_RUN_SCRIPT static bool |
1668 | | get_privacyRequested(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, JSJitGetterCallArgs args) |
1669 | 0 | { |
1670 | 0 | AUTO_PROFILER_LABEL_FAST("get PeerConnectionImpl.privacyRequested", DOM, cx); |
1671 | 0 |
|
1672 | 0 | bool result(self->PrivacyRequested()); |
1673 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1674 | 0 | args.rval().setBoolean(result); |
1675 | 0 | return true; |
1676 | 0 | } |
1677 | | |
1678 | | static const JSJitInfo privacyRequested_getterinfo = { |
1679 | | { (JSJitGetterOp)get_privacyRequested }, |
1680 | | { prototypes::id::PeerConnectionImpl }, |
1681 | | { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth }, |
1682 | | JSJitInfo::Getter, |
1683 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1684 | | JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */ |
1685 | | true, /* isInfallible. False in setters. */ |
1686 | | false, /* isMovable. Not relevant for setters. */ |
1687 | | false, /* isEliminatable. Not relevant for setters. */ |
1688 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1689 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1690 | | false, /* isTypedMethod. Only relevant for methods. */ |
1691 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1692 | | }; |
1693 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1694 | | static_assert(0 < 1, "There is no slot for us"); |
1695 | | |
1696 | | MOZ_CAN_RUN_SCRIPT static bool |
1697 | | createDataChannel(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::PeerConnectionImpl* self, const JSJitMethodCallArgs& args) |
1698 | 0 | { |
1699 | 0 | AUTO_PROFILER_LABEL_FAST("PeerConnectionImpl.createDataChannel", DOM, cx); |
1700 | 0 |
|
1701 | 0 | if (MOZ_UNLIKELY(args.length() < 8)) { |
1702 | 0 | return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "PeerConnectionImpl.createDataChannel"); |
1703 | 0 | } |
1704 | 0 | binding_detail::FakeString arg0; |
1705 | 0 | if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { |
1706 | 0 | return false; |
1707 | 0 | } |
1708 | 0 | binding_detail::FakeString arg1; |
1709 | 0 | if (!ConvertJSValueToString(cx, args[1], eStringify, eStringify, arg1)) { |
1710 | 0 | return false; |
1711 | 0 | } |
1712 | 0 | uint16_t arg2; |
1713 | 0 | if (!ValueToPrimitive<uint16_t, eDefault>(cx, args[2], &arg2)) { |
1714 | 0 | return false; |
1715 | 0 | } |
1716 | 0 | bool arg3; |
1717 | 0 | if (!ValueToPrimitive<bool, eDefault>(cx, args[3], &arg3)) { |
1718 | 0 | return false; |
1719 | 0 | } |
1720 | 0 | uint16_t arg4; |
1721 | 0 | if (!ValueToPrimitive<uint16_t, eDefault>(cx, args[4], &arg4)) { |
1722 | 0 | return false; |
1723 | 0 | } |
1724 | 0 | uint16_t arg5; |
1725 | 0 | if (!ValueToPrimitive<uint16_t, eDefault>(cx, args[5], &arg5)) { |
1726 | 0 | return false; |
1727 | 0 | } |
1728 | 0 | bool arg6; |
1729 | 0 | if (!ValueToPrimitive<bool, eDefault>(cx, args[6], &arg6)) { |
1730 | 0 | return false; |
1731 | 0 | } |
1732 | 0 | uint16_t arg7; |
1733 | 0 | if (!ValueToPrimitive<uint16_t, eDefault>(cx, args[7], &arg7)) { |
1734 | 0 | return false; |
1735 | 0 | } |
1736 | 0 | FastErrorResult rv; |
1737 | 0 | auto result(StrongOrRawPtr<nsDOMDataChannel>(self->CreateDataChannel(NonNullHelper(Constify(arg0)), NonNullHelper(Constify(arg1)), arg2, arg3, arg4, arg5, arg6, arg7, rv))); |
1738 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
1739 | 0 | return false; |
1740 | 0 | } |
1741 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1742 | 0 | if (!GetOrCreateDOMReflector(cx, result, args.rval())) { |
1743 | 0 | MOZ_ASSERT(JS_IsExceptionPending(cx)); |
1744 | 0 | return false; |
1745 | 0 | } |
1746 | 0 | return true; |
1747 | 0 | } |
1748 | | |
1749 | | static const JSJitInfo createDataChannel_methodinfo = { |
1750 | | { (JSJitGetterOp)createDataChannel }, |
1751 | | { prototypes::id::PeerConnectionImpl }, |
1752 | | { PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth }, |
1753 | | JSJitInfo::Method, |
1754 | | JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ |
1755 | | JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */ |
1756 | | false, /* isInfallible. False in setters. */ |
1757 | | false, /* isMovable. Not relevant for setters. */ |
1758 | | false, /* isEliminatable. Not relevant for setters. */ |
1759 | | false, /* isAlwaysInSlot. Only relevant for getters. */ |
1760 | | false, /* isLazilyCachedInSlot. Only relevant for getters. */ |
1761 | | false, /* isTypedMethod. Only relevant for methods. */ |
1762 | | 0 /* Reserved slot index, if we're stored in a slot, else 0. */ |
1763 | | }; |
1764 | | static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit"); |
1765 | | static_assert(0 < 1, "There is no slot for us"); |
1766 | | |
1767 | | static void |
1768 | | _finalize(js::FreeOp* fop, JSObject* obj) |
1769 | 0 | { |
1770 | 0 | mozilla::PeerConnectionImpl* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::PeerConnectionImpl>(obj); |
1771 | 0 | if (self) { |
1772 | 0 | AddForDeferredFinalization<mozilla::PeerConnectionImpl>(self); |
1773 | 0 | } |
1774 | 0 | } |
1775 | | |
1776 | | // We deliberately use brace-elision to make Visual Studio produce better initalization code. |
1777 | | #if defined(__clang__) |
1778 | | #pragma clang diagnostic push |
1779 | | #pragma clang diagnostic ignored "-Wmissing-braces" |
1780 | | #endif |
1781 | | static const JSFunctionSpec sMethods_specs[] = { |
1782 | | JS_FNSPEC("initialize", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&initialize_methodinfo), 4, JSPROP_ENUMERATE, nullptr), |
1783 | | JS_FNSPEC("createOffer", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&createOffer_methodinfo), 0, JSPROP_ENUMERATE, nullptr), |
1784 | | JS_FNSPEC("createAnswer", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&createAnswer_methodinfo), 0, JSPROP_ENUMERATE, nullptr), |
1785 | | JS_FNSPEC("setLocalDescription", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&setLocalDescription_methodinfo), 2, JSPROP_ENUMERATE, nullptr), |
1786 | | JS_FNSPEC("setRemoteDescription", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&setRemoteDescription_methodinfo), 2, JSPROP_ENUMERATE, nullptr), |
1787 | | JS_FNSPEC("getStats", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&getStats_methodinfo), 1, JSPROP_ENUMERATE, nullptr), |
1788 | | JS_FNSPEC("createTransceiverImpl", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&createTransceiverImpl_methodinfo), 2, JSPROP_ENUMERATE, nullptr), |
1789 | | JS_FNSPEC("checkNegotiationNeeded", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&checkNegotiationNeeded_methodinfo), 0, JSPROP_ENUMERATE, nullptr), |
1790 | | JS_FNSPEC("insertDTMF", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&insertDTMF_methodinfo), 2, JSPROP_ENUMERATE, nullptr), |
1791 | | JS_FNSPEC("getDTMFToneBuffer", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&getDTMFToneBuffer_methodinfo), 1, JSPROP_ENUMERATE, nullptr), |
1792 | | JS_FNSPEC("getRtpSources", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&getRtpSources_methodinfo), 2, JSPROP_ENUMERATE, nullptr), |
1793 | | JS_FNSPEC("getNowInRtpSourceReferenceTime", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&getNowInRtpSourceReferenceTime_methodinfo), 0, JSPROP_ENUMERATE, nullptr), |
1794 | | JS_FNSPEC("replaceTrackNoRenegotiation", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&replaceTrackNoRenegotiation_methodinfo), 2, JSPROP_ENUMERATE, nullptr), |
1795 | | JS_FNSPEC("closeStreams", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&closeStreams_methodinfo), 0, JSPROP_ENUMERATE, nullptr), |
1796 | | JS_FNSPEC("addRIDExtension", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&addRIDExtension_methodinfo), 2, JSPROP_ENUMERATE, nullptr), |
1797 | | JS_FNSPEC("addRIDFilter", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&addRIDFilter_methodinfo), 2, JSPROP_ENUMERATE, nullptr), |
1798 | | JS_FNSPEC("insertAudioLevelForContributingSource", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&insertAudioLevelForContributingSource_methodinfo), 5, JSPROP_ENUMERATE, nullptr), |
1799 | | JS_FNSPEC("enablePacketDump", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&enablePacketDump_methodinfo), 3, JSPROP_ENUMERATE, nullptr), |
1800 | | JS_FNSPEC("disablePacketDump", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&disablePacketDump_methodinfo), 3, JSPROP_ENUMERATE, nullptr), |
1801 | | JS_FNSPEC("addIceCandidate", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&addIceCandidate_methodinfo), 3, JSPROP_ENUMERATE, nullptr), |
1802 | | JS_FNSPEC("close", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&close_methodinfo), 0, JSPROP_ENUMERATE, nullptr), |
1803 | | JS_FNSPEC("pluginCrash", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&pluginCrash_methodinfo), 2, JSPROP_ENUMERATE, nullptr), |
1804 | | JS_FNSPEC("createDataChannel", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&createDataChannel_methodinfo), 8, JSPROP_ENUMERATE, nullptr), |
1805 | | JS_FS_END |
1806 | | }; |
1807 | | #if defined(__clang__) |
1808 | | #pragma clang diagnostic pop |
1809 | | #endif |
1810 | | |
1811 | | |
1812 | | static const Prefable<const JSFunctionSpec> sMethods[] = { |
1813 | | { nullptr, &sMethods_specs[0] }, |
1814 | | { nullptr, nullptr } |
1815 | | }; |
1816 | | |
1817 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, |
1818 | | "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); |
1819 | | static_assert(23 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX, |
1820 | | "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)"); |
1821 | | |
1822 | | // We deliberately use brace-elision to make Visual Studio produce better initalization code. |
1823 | | #if defined(__clang__) |
1824 | | #pragma clang diagnostic push |
1825 | | #pragma clang diagnostic ignored "-Wmissing-braces" |
1826 | | #endif |
1827 | | static const JSPropertySpec sAttributes_specs[] = { |
1828 | | { "certificate", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &certificate_getterinfo, GenericSetter<NormalThisPolicy>, &certificate_setterinfo }, |
1829 | | { "fingerprint", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &fingerprint_getterinfo, nullptr, nullptr }, |
1830 | | { "localDescription", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &localDescription_getterinfo, nullptr, nullptr }, |
1831 | | { "currentLocalDescription", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, ¤tLocalDescription_getterinfo, nullptr, nullptr }, |
1832 | | { "pendingLocalDescription", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &pendingLocalDescription_getterinfo, nullptr, nullptr }, |
1833 | | { "remoteDescription", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &remoteDescription_getterinfo, nullptr, nullptr }, |
1834 | | { "currentRemoteDescription", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, ¤tRemoteDescription_getterinfo, nullptr, nullptr }, |
1835 | | { "pendingRemoteDescription", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &pendingRemoteDescription_getterinfo, nullptr, nullptr }, |
1836 | | { "iceConnectionState", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &iceConnectionState_getterinfo, nullptr, nullptr }, |
1837 | | { "iceGatheringState", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &iceGatheringState_getterinfo, nullptr, nullptr }, |
1838 | | { "signalingState", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &signalingState_getterinfo, nullptr, nullptr }, |
1839 | | { "id", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &id_getterinfo, GenericSetter<NormalThisPolicy>, &id_setterinfo }, |
1840 | | { "peerIdentity", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &peerIdentity_getterinfo, GenericSetter<NormalThisPolicy>, &peerIdentity_setterinfo }, |
1841 | | { "privacyRequested", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &privacyRequested_getterinfo, nullptr, nullptr }, |
1842 | | { nullptr, 0, nullptr, nullptr, nullptr, nullptr } |
1843 | | }; |
1844 | | #if defined(__clang__) |
1845 | | #pragma clang diagnostic pop |
1846 | | #endif |
1847 | | |
1848 | | |
1849 | | static const Prefable<const JSPropertySpec> sAttributes[] = { |
1850 | | { nullptr, &sAttributes_specs[0] }, |
1851 | | { nullptr, nullptr } |
1852 | | }; |
1853 | | |
1854 | | static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, |
1855 | | "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); |
1856 | | static_assert(14 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX, |
1857 | | "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)"); |
1858 | | |
1859 | | |
1860 | | static uint16_t sNativeProperties_sortedPropertyIndices[37]; |
1861 | | static PropertyInfo sNativeProperties_propertyInfos[37]; |
1862 | | |
1863 | | static const NativePropertiesN<2> sNativeProperties = { |
1864 | | false, 0, |
1865 | | false, 0, |
1866 | | true, 0 /* sMethods */, |
1867 | | true, 1 /* sAttributes */, |
1868 | | false, 0, |
1869 | | false, 0, |
1870 | | false, 0, |
1871 | | -1, |
1872 | | 37, |
1873 | | sNativeProperties_sortedPropertyIndices, |
1874 | | { |
1875 | | { sMethods, &sNativeProperties_propertyInfos[0] }, |
1876 | | { sAttributes, &sNativeProperties_propertyInfos[23] } |
1877 | | } |
1878 | | }; |
1879 | | static_assert(37 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount), |
1880 | | "We have a property info count that is oversized"); |
1881 | | |
1882 | | static bool |
1883 | | _constructor(JSContext* cx, unsigned argc, JS::Value* vp) |
1884 | 0 | { |
1885 | 0 | AUTO_PROFILER_LABEL_FAST("PeerConnectionImpl constructor", DOM, cx); |
1886 | 0 |
|
1887 | 0 | JS::CallArgs args = JS::CallArgsFromVp(argc, vp); |
1888 | 0 | JS::Rooted<JSObject*> obj(cx, &args.callee()); |
1889 | 0 | if (!args.isConstructing()) { |
1890 | 0 | // XXXbz wish I could get the name from the callee instead of |
1891 | 0 | // Adding more relocations |
1892 | 0 | return ThrowConstructorWithoutNew(cx, "PeerConnectionImpl"); |
1893 | 0 | } |
1894 | 0 | |
1895 | 0 | JS::Rooted<JSObject*> desiredProto(cx); |
1896 | 0 | if (!GetDesiredProto(cx, args, &desiredProto)) { |
1897 | 0 | return false; |
1898 | 0 | } |
1899 | 0 | |
1900 | 0 | GlobalObject global(cx, obj); |
1901 | 0 | if (global.Failed()) { |
1902 | 0 | return false; |
1903 | 0 | } |
1904 | 0 | |
1905 | 0 | bool objIsXray = xpc::WrapperFactory::IsXrayWrapper(obj); |
1906 | 0 | Maybe<JSAutoRealm> ar; |
1907 | 0 | if (objIsXray) { |
1908 | 0 | obj = js::CheckedUnwrap(obj); |
1909 | 0 | if (!obj) { |
1910 | 0 | return false; |
1911 | 0 | } |
1912 | 0 | ar.emplace(cx, obj); |
1913 | 0 | if (!JS_WrapObject(cx, &desiredProto)) { |
1914 | 0 | return false; |
1915 | 0 | } |
1916 | 0 | } |
1917 | 0 | FastErrorResult rv; |
1918 | 0 | auto result(StrongOrRawPtr<mozilla::PeerConnectionImpl>(mozilla::PeerConnectionImpl::Constructor(global, rv))); |
1919 | 0 | if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) { |
1920 | 0 | return false; |
1921 | 0 | } |
1922 | 0 | MOZ_ASSERT(!JS_IsExceptionPending(cx)); |
1923 | 0 | static_assert(!IsPointer<decltype(result)>::value, |
1924 | 0 | "NewObject implies that we need to keep the object alive with a strong reference."); |
1925 | 0 | if (!WrapNewBindingNonWrapperCachedObject(cx, obj, result, args.rval(), desiredProto)) { |
1926 | 0 | MOZ_ASSERT(JS_IsExceptionPending(cx)); |
1927 | 0 | return false; |
1928 | 0 | } |
1929 | 0 | return true; |
1930 | 0 | } |
1931 | | |
1932 | | static const js::ClassOps sInterfaceObjectClassOps = { |
1933 | | nullptr, /* addProperty */ |
1934 | | nullptr, /* delProperty */ |
1935 | | nullptr, /* enumerate */ |
1936 | | nullptr, /* newEnumerate */ |
1937 | | nullptr, /* resolve */ |
1938 | | nullptr, /* mayResolve */ |
1939 | | nullptr, /* finalize */ |
1940 | | _constructor, /* call */ |
1941 | | nullptr, /* hasInstance */ |
1942 | | _constructor, /* construct */ |
1943 | | nullptr, /* trace */ |
1944 | | }; |
1945 | | |
1946 | | static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = { |
1947 | | { |
1948 | | "Function", |
1949 | | JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE), |
1950 | | &sInterfaceObjectClassOps, |
1951 | | JS_NULL_CLASS_SPEC, |
1952 | | JS_NULL_CLASS_EXT, |
1953 | | &sInterfaceObjectClassObjectOps |
1954 | | }, |
1955 | | eInterface, |
1956 | | true, |
1957 | | prototypes::id::PeerConnectionImpl, |
1958 | | PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth, |
1959 | | sNativePropertyHooks, |
1960 | | "function PeerConnectionImpl() {\n [native code]\n}", |
1961 | | JS::GetRealmFunctionPrototype |
1962 | | }; |
1963 | | |
1964 | | static const DOMIfaceAndProtoJSClass sPrototypeClass = { |
1965 | | { |
1966 | | "PeerConnectionImplPrototype", |
1967 | | JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE), |
1968 | | JS_NULL_CLASS_OPS, |
1969 | | JS_NULL_CLASS_SPEC, |
1970 | | JS_NULL_CLASS_EXT, |
1971 | | JS_NULL_OBJECT_OPS |
1972 | | }, |
1973 | | eInterfacePrototype, |
1974 | | false, |
1975 | | prototypes::id::PeerConnectionImpl, |
1976 | | PrototypeTraits<prototypes::id::PeerConnectionImpl>::Depth, |
1977 | | sNativePropertyHooks, |
1978 | | "[object PeerConnectionImplPrototype]", |
1979 | | JS::GetRealmObjectPrototype |
1980 | | }; |
1981 | | |
1982 | | bool |
1983 | | ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj) |
1984 | 0 | { |
1985 | 0 | return nsContentUtils::ThreadsafeIsSystemCaller(aCx); |
1986 | 0 | } |
1987 | | |
1988 | | static const js::ClassOps sClassOps = { |
1989 | | nullptr, /* addProperty */ |
1990 | | nullptr, /* delProperty */ |
1991 | | nullptr, /* enumerate */ |
1992 | | nullptr, /* newEnumerate */ |
1993 | | nullptr, /* resolve */ |
1994 | | nullptr, /* mayResolve */ |
1995 | | _finalize, /* finalize */ |
1996 | | nullptr, /* call */ |
1997 | | nullptr, /* hasInstance */ |
1998 | | nullptr, /* construct */ |
1999 | | nullptr, /* trace */ |
2000 | | }; |
2001 | | |
2002 | | static const js::ClassExtension sClassExtension = { |
2003 | | nullptr, /* weakmapKeyDelegateOp */ |
2004 | | nullptr /* objectMovedOp */ |
2005 | | }; |
2006 | | |
2007 | | static const DOMJSClass sClass = { |
2008 | | { "PeerConnectionImpl", |
2009 | | JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1), |
2010 | | &sClassOps, |
2011 | | JS_NULL_CLASS_SPEC, |
2012 | | &sClassExtension, |
2013 | | JS_NULL_OBJECT_OPS |
2014 | | }, |
2015 | | { prototypes::id::PeerConnectionImpl, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count }, |
2016 | | IsBaseOf<nsISupports, mozilla::PeerConnectionImpl >::value, |
2017 | | sNativePropertyHooks, |
2018 | | FindAssociatedGlobalForNative<mozilla::PeerConnectionImpl>::Get, |
2019 | | GetProtoObjectHandle, |
2020 | | GetCCParticipant<mozilla::PeerConnectionImpl>::Get() |
2021 | | }; |
2022 | | static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS, |
2023 | | "Must have the right minimal number of reserved slots."); |
2024 | | static_assert(1 >= 1, |
2025 | | "Must have enough reserved slots."); |
2026 | | |
2027 | | const JSClass* |
2028 | | GetJSClass() |
2029 | 0 | { |
2030 | 0 | return sClass.ToJSClass(); |
2031 | 0 | } |
2032 | | |
2033 | | bool |
2034 | | Wrap(JSContext* aCx, mozilla::PeerConnectionImpl* aObject, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector) |
2035 | 0 | { |
2036 | 0 | MOZ_ASSERT(static_cast<mozilla::PeerConnectionImpl*>(aObject) == |
2037 | 0 | reinterpret_cast<mozilla::PeerConnectionImpl*>(aObject), |
2038 | 0 | "Multiple inheritance for mozilla::PeerConnectionImpl is broken."); |
2039 | 0 | MOZ_ASSERT(ToSupportsIsCorrect(aObject)); |
2040 | 0 | MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx)); |
2041 | 0 |
|
2042 | 0 | JS::Rooted<JSObject*> global(aCx, JS::CurrentGlobalOrNull(aCx)); |
2043 | 0 | JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx); |
2044 | 0 | if (!canonicalProto) { |
2045 | 0 | return false; |
2046 | 0 | } |
2047 | 0 | JS::Rooted<JSObject*> proto(aCx); |
2048 | 0 | if (aGivenProto) { |
2049 | 0 | proto = aGivenProto; |
2050 | 0 | // Unfortunately, while aGivenProto was in the compartment of aCx |
2051 | 0 | // coming in, we changed compartments to that of "parent" so may need |
2052 | 0 | // to wrap the proto here. |
2053 | 0 | if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) { |
2054 | 0 | if (!JS_WrapObject(aCx, &proto)) { |
2055 | 0 | return false; |
2056 | 0 | } |
2057 | 0 | } |
2058 | 0 | } else { |
2059 | 0 | proto = canonicalProto; |
2060 | 0 | } |
2061 | 0 |
|
2062 | 0 | BindingJSObjectCreator<mozilla::PeerConnectionImpl> creator(aCx); |
2063 | 0 | creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector); |
2064 | 0 | if (!aReflector) { |
2065 | 0 | return false; |
2066 | 0 | } |
2067 | 0 | |
2068 | 0 | |
2069 | 0 | |
2070 | 0 | creator.InitializationSucceeded(); |
2071 | 0 | return true; |
2072 | 0 | } |
2073 | | |
2074 | | const NativePropertyHooks sNativePropertyHooks[] = { { |
2075 | | nullptr, |
2076 | | nullptr, |
2077 | | nullptr, |
2078 | | { sNativeProperties.Upcast(), nullptr }, |
2079 | | prototypes::id::PeerConnectionImpl, |
2080 | | constructors::id::PeerConnectionImpl, |
2081 | | nullptr, |
2082 | | &DefaultXrayExpandoObjectClass |
2083 | | } }; |
2084 | | |
2085 | | void |
2086 | | CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal) |
2087 | 0 | { |
2088 | 0 | JS::Rooted<JSObject*> parentProto(aCx, JS::GetRealmObjectPrototype(aCx)); |
2089 | 0 | if (!parentProto) { |
2090 | 0 | return; |
2091 | 0 | } |
2092 | 0 | |
2093 | 0 | JS::Rooted<JSObject*> constructorProto(aCx, JS::GetRealmFunctionPrototype(aCx)); |
2094 | 0 | if (!constructorProto) { |
2095 | 0 | return; |
2096 | 0 | } |
2097 | 0 | |
2098 | 0 | static bool sIdsInited = false; |
2099 | 0 | if (!sIdsInited && NS_IsMainThread()) { |
2100 | 0 | if (!InitIds(aCx, sNativeProperties.Upcast())) { |
2101 | 0 | return; |
2102 | 0 | } |
2103 | 0 | sIdsInited = true; |
2104 | 0 | } |
2105 | 0 |
|
2106 | 0 | JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::PeerConnectionImpl); |
2107 | 0 | JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::PeerConnectionImpl); |
2108 | 0 | dom::CreateInterfaceObjects(aCx, aGlobal, parentProto, |
2109 | 0 | &sPrototypeClass.mBase, protoCache, |
2110 | 0 | nullptr, |
2111 | 0 | constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr, |
2112 | 0 | interfaceCache, |
2113 | 0 | sNativeProperties.Upcast(), |
2114 | 0 | nullptr, |
2115 | 0 | "PeerConnectionImpl", aDefineOnGlobal, |
2116 | 0 | nullptr, |
2117 | 0 | false); |
2118 | 0 | } |
2119 | | |
2120 | | JSObject* |
2121 | | GetConstructorObject(JSContext* aCx) |
2122 | 0 | { |
2123 | 0 | return GetConstructorObjectHandle(aCx); |
2124 | 0 | } |
2125 | | |
2126 | | } // namespace PeerConnectionImpl_Binding |
2127 | | |
2128 | | |
2129 | | |
2130 | | } // namespace dom |
2131 | | } // namespace mozilla |