Line data Source code
1 : /* THIS FILE IS AUTOGENERATED FROM RTCIdentityProvider.webidl BY Codegen.py - DO NOT EDIT */
2 :
3 : #ifndef mozilla_dom_RTCIdentityProviderBinding_h
4 : #define mozilla_dom_RTCIdentityProviderBinding_h
5 :
6 : #include "js/RootingAPI.h"
7 : #include "jspubtd.h"
8 : #include "mozilla/ErrorResult.h"
9 : #include "mozilla/dom/BindingDeclarations.h"
10 : #include "mozilla/dom/CallbackFunction.h"
11 : #include "mozilla/dom/Nullable.h"
12 : #include "mozilla/dom/ToJSValue.h"
13 :
14 : namespace mozilla {
15 : namespace dom {
16 :
17 : class GenerateAssertionCallback;
18 : struct NativePropertyHooks;
19 : class Promise;
20 : class ProtoAndIfaceCache;
21 : struct RTCIdentityAssertionResultAtoms;
22 : struct RTCIdentityProviderAtoms;
23 : struct RTCIdentityProviderDetails;
24 : struct RTCIdentityProviderDetailsAtoms;
25 : class RTCIdentityProviderRegistrar;
26 : struct RTCIdentityProviderRegistrarAtoms;
27 : struct RTCIdentityValidationResultAtoms;
28 : class ValidateAssertionCallback;
29 :
30 : } // namespace dom
31 : } // namespace mozilla
32 :
33 : namespace mozilla {
34 : namespace dom {
35 :
36 0 : struct RTCIdentityProvider : public DictionaryBase
37 : {
38 : MOZ_INIT_OUTSIDE_CTOR OwningNonNull<GenerateAssertionCallback> mGenerateAssertion;
39 : MOZ_INIT_OUTSIDE_CTOR OwningNonNull<ValidateAssertionCallback> mValidateAssertion;
40 :
41 : RTCIdentityProvider();
42 :
43 0 : explicit inline RTCIdentityProvider(const FastDictionaryInitializer& )
44 0 : {
45 : // Do nothing here; this is used by our "Fast" subclass
46 0 : }
47 :
48 : private:
49 : RTCIdentityProvider(const RTCIdentityProvider&) = delete;
50 : RTCIdentityProvider& operator=(const RTCIdentityProvider&) = delete;
51 :
52 : static bool
53 : InitIds(JSContext* cx, RTCIdentityProviderAtoms* atomsCache);
54 :
55 : public:
56 : bool
57 : Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
58 :
59 : bool
60 : ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
61 :
62 : void
63 : TraceDictionary(JSTracer* trc);
64 : };
65 :
66 : namespace binding_detail {
67 0 : struct FastRTCIdentityProvider : public RTCIdentityProvider
68 : {
69 0 : inline FastRTCIdentityProvider()
70 0 : : RTCIdentityProvider(FastDictionaryInitializer())
71 : {
72 : // Doesn't matter what int we pass to the parent constructor
73 0 : }
74 : };
75 : } // namespace binding_detail
76 :
77 :
78 : struct RTCIdentityProviderDetails : public DictionaryBase
79 : {
80 : MOZ_INIT_OUTSIDE_CTOR nsString mDomain;
81 : MOZ_INIT_OUTSIDE_CTOR nsString mProtocol;
82 :
83 : RTCIdentityProviderDetails();
84 :
85 0 : explicit inline RTCIdentityProviderDetails(const FastDictionaryInitializer& )
86 0 : {
87 : // Do nothing here; this is used by our "Fast" subclass
88 0 : }
89 :
90 : explicit inline RTCIdentityProviderDetails(const RTCIdentityProviderDetails& aOther)
91 : {
92 : *this = aOther;
93 : }
94 :
95 : bool
96 : Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
97 :
98 : bool
99 : Init(const nsAString& aJSON);
100 :
101 : bool
102 : ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
103 :
104 : bool
105 : ToJSON(nsAString& aJSON) const;
106 :
107 : void
108 : TraceDictionary(JSTracer* trc);
109 :
110 : RTCIdentityProviderDetails&
111 : operator=(const RTCIdentityProviderDetails& aOther);
112 :
113 : private:
114 : static bool
115 : InitIds(JSContext* cx, RTCIdentityProviderDetailsAtoms* atomsCache);
116 : };
117 :
118 : namespace binding_detail {
119 : struct FastRTCIdentityProviderDetails : public RTCIdentityProviderDetails
120 : {
121 : inline FastRTCIdentityProviderDetails()
122 : : RTCIdentityProviderDetails(FastDictionaryInitializer())
123 : {
124 : // Doesn't matter what int we pass to the parent constructor
125 : }
126 : };
127 : } // namespace binding_detail
128 :
129 :
130 : struct RTCIdentityValidationResult : public DictionaryBase
131 : {
132 : MOZ_INIT_OUTSIDE_CTOR nsString mContents;
133 : MOZ_INIT_OUTSIDE_CTOR nsString mIdentity;
134 :
135 : RTCIdentityValidationResult();
136 :
137 : explicit inline RTCIdentityValidationResult(const FastDictionaryInitializer& )
138 : {
139 : // Do nothing here; this is used by our "Fast" subclass
140 : }
141 :
142 : explicit inline RTCIdentityValidationResult(const RTCIdentityValidationResult& aOther)
143 : {
144 : *this = aOther;
145 : }
146 :
147 : bool
148 : Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
149 :
150 : bool
151 : Init(const nsAString& aJSON);
152 :
153 : bool
154 : ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
155 :
156 : bool
157 : ToJSON(nsAString& aJSON) const;
158 :
159 : void
160 : TraceDictionary(JSTracer* trc);
161 :
162 : RTCIdentityValidationResult&
163 : operator=(const RTCIdentityValidationResult& aOther);
164 :
165 : private:
166 : static bool
167 : InitIds(JSContext* cx, RTCIdentityValidationResultAtoms* atomsCache);
168 : };
169 :
170 : namespace binding_detail {
171 : struct FastRTCIdentityValidationResult : public RTCIdentityValidationResult
172 : {
173 : inline FastRTCIdentityValidationResult()
174 : : RTCIdentityValidationResult(FastDictionaryInitializer())
175 : {
176 : // Doesn't matter what int we pass to the parent constructor
177 : }
178 : };
179 : } // namespace binding_detail
180 :
181 :
182 : struct RTCIdentityAssertionResult : public DictionaryBase
183 : {
184 : MOZ_INIT_OUTSIDE_CTOR nsString mAssertion;
185 : MOZ_INIT_OUTSIDE_CTOR RTCIdentityProviderDetails mIdp;
186 :
187 : RTCIdentityAssertionResult();
188 :
189 : explicit inline RTCIdentityAssertionResult(const FastDictionaryInitializer& )
190 : : mIdp(FastDictionaryInitializer())
191 : {
192 : // Do nothing here; this is used by our "Fast" subclass
193 : }
194 :
195 : explicit inline RTCIdentityAssertionResult(const RTCIdentityAssertionResult& aOther)
196 : : mIdp(FastDictionaryInitializer())
197 : {
198 : *this = aOther;
199 : }
200 :
201 : bool
202 : Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
203 :
204 : bool
205 : Init(const nsAString& aJSON);
206 :
207 : bool
208 : ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
209 :
210 : bool
211 : ToJSON(nsAString& aJSON) const;
212 :
213 : void
214 : TraceDictionary(JSTracer* trc);
215 :
216 : RTCIdentityAssertionResult&
217 : operator=(const RTCIdentityAssertionResult& aOther);
218 :
219 : private:
220 : static bool
221 : InitIds(JSContext* cx, RTCIdentityAssertionResultAtoms* atomsCache);
222 : };
223 :
224 : namespace binding_detail {
225 : struct FastRTCIdentityAssertionResult : public RTCIdentityAssertionResult
226 : {
227 : inline FastRTCIdentityAssertionResult()
228 : : RTCIdentityAssertionResult(FastDictionaryInitializer())
229 : {
230 : // Doesn't matter what int we pass to the parent constructor
231 : }
232 : };
233 : } // namespace binding_detail
234 :
235 :
236 0 : class GenerateAssertionCallback : public CallbackFunction
237 : {
238 : public:
239 0 : explicit inline GenerateAssertionCallback(JSContext* aCx, JS::Handle<JSObject*> aCallback, nsIGlobalObject* aIncumbentGlobal)
240 0 : : CallbackFunction(aCx, aCallback, aIncumbentGlobal)
241 : {
242 0 : MOZ_ASSERT(JS::IsCallable(mCallback));
243 0 : }
244 :
245 : explicit inline GenerateAssertionCallback(JS::Handle<JSObject*> aCallback, const FastCallbackConstructor& )
246 : : CallbackFunction(aCallback, FastCallbackConstructor())
247 : {
248 : MOZ_ASSERT(JS::IsCallable(mCallback));
249 : }
250 :
251 : explicit inline GenerateAssertionCallback(JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aAsyncStack, nsIGlobalObject* aIncumbentGlobal)
252 : : CallbackFunction(aCallback, aAsyncStack, aIncumbentGlobal)
253 : {
254 : MOZ_ASSERT(JS::IsCallable(mCallback));
255 : }
256 :
257 : explicit inline GenerateAssertionCallback(CallbackFunction* aOther)
258 : : CallbackFunction(aOther)
259 : {
260 : }
261 :
262 : template <typename T>
263 : inline already_AddRefed<Promise>
264 : Call(const T& thisVal, const nsAString& contents, const nsAString& origin, const Optional<nsAString>& usernameHint, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JSCompartment* aCompartment = nullptr)
265 : {
266 : MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
267 : if (!aExecutionReason) {
268 : aExecutionReason = "GenerateAssertionCallback";
269 : }
270 : CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aCompartment);
271 : if (!s.GetContext()) {
272 : MOZ_ASSERT(aRv.Failed());
273 : return nullptr;
274 : }
275 : JS::Rooted<JS::Value> thisValJS(s.GetContext());
276 : if (!ToJSValue(s.GetContext(), thisVal, &thisValJS)) {
277 : aRv.Throw(NS_ERROR_FAILURE);
278 : return nullptr;
279 : }
280 : return Call(s.GetContext(), thisValJS, contents, origin, usernameHint, aRv);
281 : }
282 :
283 : inline already_AddRefed<Promise>
284 0 : Call(const nsAString& contents, const nsAString& origin, const Optional<nsAString>& usernameHint, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JSCompartment* aCompartment = nullptr)
285 : {
286 0 : MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
287 0 : if (!aExecutionReason) {
288 0 : aExecutionReason = "GenerateAssertionCallback";
289 : }
290 0 : CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aCompartment);
291 0 : if (!s.GetContext()) {
292 0 : MOZ_ASSERT(aRv.Failed());
293 0 : return nullptr;
294 : }
295 0 : return Call(s.GetContext(), JS::UndefinedHandleValue, contents, origin, usernameHint, aRv);
296 : }
297 :
298 : template <typename T>
299 : inline already_AddRefed<Promise>
300 : Call(const T& thisVal, const nsAString& contents, const nsAString& origin, const Optional<nsAString>& usernameHint, const char* aExecutionReason = nullptr)
301 : {
302 : IgnoredErrorResult rv;
303 : return Call(thisVal, contents, origin, usernameHint, rv, aExecutionReason);
304 : }
305 :
306 : inline already_AddRefed<Promise>
307 : Call(const nsAString& contents, const nsAString& origin, const Optional<nsAString>& usernameHint, const char* aExecutionReason = nullptr)
308 : {
309 : IgnoredErrorResult rv;
310 : return Call(contents, origin, usernameHint, rv, aExecutionReason, eReportExceptions, nullptr);
311 : }
312 :
313 : inline bool
314 : operator==(const GenerateAssertionCallback& aOther) const
315 : {
316 : return CallbackFunction::operator==(aOther);
317 : }
318 :
319 : private:
320 : already_AddRefed<Promise> Call(JSContext* cx, JS::Handle<JS::Value> aThisVal, const nsAString& contents, const nsAString& origin, const Optional<nsAString>& usernameHint, ErrorResult& aRv);
321 : };
322 :
323 :
324 0 : class ValidateAssertionCallback : public CallbackFunction
325 : {
326 : public:
327 0 : explicit inline ValidateAssertionCallback(JSContext* aCx, JS::Handle<JSObject*> aCallback, nsIGlobalObject* aIncumbentGlobal)
328 0 : : CallbackFunction(aCx, aCallback, aIncumbentGlobal)
329 : {
330 0 : MOZ_ASSERT(JS::IsCallable(mCallback));
331 0 : }
332 :
333 : explicit inline ValidateAssertionCallback(JS::Handle<JSObject*> aCallback, const FastCallbackConstructor& )
334 : : CallbackFunction(aCallback, FastCallbackConstructor())
335 : {
336 : MOZ_ASSERT(JS::IsCallable(mCallback));
337 : }
338 :
339 : explicit inline ValidateAssertionCallback(JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aAsyncStack, nsIGlobalObject* aIncumbentGlobal)
340 : : CallbackFunction(aCallback, aAsyncStack, aIncumbentGlobal)
341 : {
342 : MOZ_ASSERT(JS::IsCallable(mCallback));
343 : }
344 :
345 : explicit inline ValidateAssertionCallback(CallbackFunction* aOther)
346 : : CallbackFunction(aOther)
347 : {
348 : }
349 :
350 : template <typename T>
351 : inline already_AddRefed<Promise>
352 : Call(const T& thisVal, const nsAString& assertion, const nsAString& origin, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JSCompartment* aCompartment = nullptr)
353 : {
354 : MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
355 : if (!aExecutionReason) {
356 : aExecutionReason = "ValidateAssertionCallback";
357 : }
358 : CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aCompartment);
359 : if (!s.GetContext()) {
360 : MOZ_ASSERT(aRv.Failed());
361 : return nullptr;
362 : }
363 : JS::Rooted<JS::Value> thisValJS(s.GetContext());
364 : if (!ToJSValue(s.GetContext(), thisVal, &thisValJS)) {
365 : aRv.Throw(NS_ERROR_FAILURE);
366 : return nullptr;
367 : }
368 : return Call(s.GetContext(), thisValJS, assertion, origin, aRv);
369 : }
370 :
371 : inline already_AddRefed<Promise>
372 0 : Call(const nsAString& assertion, const nsAString& origin, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JSCompartment* aCompartment = nullptr)
373 : {
374 0 : MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
375 0 : if (!aExecutionReason) {
376 0 : aExecutionReason = "ValidateAssertionCallback";
377 : }
378 0 : CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aCompartment);
379 0 : if (!s.GetContext()) {
380 0 : MOZ_ASSERT(aRv.Failed());
381 0 : return nullptr;
382 : }
383 0 : return Call(s.GetContext(), JS::UndefinedHandleValue, assertion, origin, aRv);
384 : }
385 :
386 : template <typename T>
387 : inline already_AddRefed<Promise>
388 : Call(const T& thisVal, const nsAString& assertion, const nsAString& origin, const char* aExecutionReason = nullptr)
389 : {
390 : IgnoredErrorResult rv;
391 : return Call(thisVal, assertion, origin, rv, aExecutionReason);
392 : }
393 :
394 : inline already_AddRefed<Promise>
395 : Call(const nsAString& assertion, const nsAString& origin, const char* aExecutionReason = nullptr)
396 : {
397 : IgnoredErrorResult rv;
398 : return Call(assertion, origin, rv, aExecutionReason, eReportExceptions, nullptr);
399 : }
400 :
401 : inline bool
402 : operator==(const ValidateAssertionCallback& aOther) const
403 : {
404 : return CallbackFunction::operator==(aOther);
405 : }
406 :
407 : private:
408 : already_AddRefed<Promise> Call(JSContext* cx, JS::Handle<JS::Value> aThisVal, const nsAString& assertion, const nsAString& origin, ErrorResult& aRv);
409 : };
410 :
411 :
412 : namespace binding_detail {
413 : class FastGenerateAssertionCallback : public GenerateAssertionCallback
414 : {
415 : public:
416 : explicit inline FastGenerateAssertionCallback(JS::Handle<JSObject*> aCallback)
417 : : GenerateAssertionCallback(aCallback, FastCallbackConstructor())
418 : {
419 : }
420 :
421 : inline void
422 : Trace(JSTracer* aTracer)
423 : {
424 : GenerateAssertionCallback::Trace(aTracer);
425 : }
426 :
427 : inline void
428 : FinishSlowJSInitIfMoreThanOneOwner(JSContext* aCx)
429 : {
430 : GenerateAssertionCallback::FinishSlowJSInitIfMoreThanOneOwner(aCx);
431 : }
432 : };
433 : } // namespace binding_detail
434 :
435 :
436 : namespace binding_detail {
437 : class FastValidateAssertionCallback : public ValidateAssertionCallback
438 : {
439 : public:
440 : explicit inline FastValidateAssertionCallback(JS::Handle<JSObject*> aCallback)
441 : : ValidateAssertionCallback(aCallback, FastCallbackConstructor())
442 : {
443 : }
444 :
445 : inline void
446 : Trace(JSTracer* aTracer)
447 : {
448 : ValidateAssertionCallback::Trace(aTracer);
449 : }
450 :
451 : inline void
452 : FinishSlowJSInitIfMoreThanOneOwner(JSContext* aCx)
453 : {
454 : ValidateAssertionCallback::FinishSlowJSInitIfMoreThanOneOwner(aCx);
455 : }
456 : };
457 : } // namespace binding_detail
458 :
459 :
460 : namespace RTCIdentityProviderRegistrarBinding {
461 :
462 : typedef mozilla::dom::RTCIdentityProviderRegistrar NativeType;
463 :
464 : const JSClass*
465 : GetJSClass();
466 :
467 : bool
468 : Wrap(JSContext* aCx, mozilla::dom::RTCIdentityProviderRegistrar* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
469 :
470 : template <class T>
471 0 : inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
472 : {
473 0 : JS::Rooted<JSObject*> reflector(aCx);
474 0 : return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
475 : }
476 :
477 : // We declare this as an array so that retrieving a pointer to this
478 : // binding's property hooks only requires compile/link-time resolvable
479 : // address arithmetic. Declaring it as a pointer instead would require
480 : // doing a run-time load to fetch a pointer to this binding's property
481 : // hooks. And then structures which embedded a pointer to this structure
482 : // would require a run-time load for proper initialization, which would
483 : // then induce static constructors. Lots of static constructors.
484 : extern const NativePropertyHooks sNativePropertyHooks[];
485 :
486 : void
487 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
488 :
489 : JS::Handle<JSObject*>
490 : GetProtoObjectHandle(JSContext* aCx);
491 :
492 : } // namespace RTCIdentityProviderRegistrarBinding
493 :
494 :
495 :
496 : } // namespace dom
497 : } // namespace mozilla
498 :
499 : #endif // mozilla_dom_RTCIdentityProviderBinding_h
|