Bug 1941128 - Turn off network.dns.native_https_query on Mac again
[gecko.git] / dom / bindings / test / TestBindingHeader.h
blob26ff212b8091587b95cf0c3ba387919ef64906c2
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
5 * You can obtain one at http://mozilla.org/MPL/2.0/.
6 */
8 #ifndef TestBindingHeader_h
9 #define TestBindingHeader_h
11 #include "mozilla/dom/BindingUtils.h"
12 #include "mozilla/dom/Record.h"
13 #include "mozilla/dom/TypedArray.h"
14 #include "mozilla/ErrorResult.h"
15 #include "nsCOMPtr.h"
16 #include "nsGenericHTMLElement.h"
17 #include "nsWrapperCache.h"
18 #include "js/Object.h" // JS::GetClass
20 // Forward declare this before we include TestCodeGenBinding.h, because that
21 // header relies on including this one for it, for ParentDict. Hopefully it
22 // won't begin to rely on it in more fundamental ways.
23 namespace mozilla {
24 namespace dom {
25 class DocGroup;
26 class TestExternalInterface;
27 class TestUnionArguments;
28 class Promise;
29 } // namespace dom
30 } // namespace mozilla
32 // We don't export TestCodeGenBinding.h, but it's right in our parent dir.
33 #include "../TestCodeGenBinding.h"
35 extern bool TestFuncControlledMember(JSContext*, JSObject*);
37 namespace mozilla {
38 namespace dom {
40 // IID for nsRenamedInterface
41 #define NS_RENAMED_INTERFACE_IID \
42 { \
43 0xd4b19ef3, 0xe68b, 0x4e3f, { \
44 0x94, 0xbc, 0xc9, 0xde, 0x3a, 0x69, 0xb0, 0xe8 \
45 } \
48 class nsRenamedInterface : public nsISupports, public nsWrapperCache {
49 public:
50 NS_DECLARE_STATIC_IID_ACCESSOR(NS_RENAMED_INTERFACE_IID)
51 NS_DECL_ISUPPORTS
53 // We need a GetParentObject to make binding codegen happy
54 virtual nsISupports* GetParentObject();
57 NS_DEFINE_STATIC_IID_ACCESSOR(nsRenamedInterface, NS_RENAMED_INTERFACE_IID)
59 // IID for the TestExternalInterface
60 #define NS_TEST_EXTERNAL_INTERFACE_IID \
61 { \
62 0xd5ba0c99, 0x9b1d, 0x4e71, { \
63 0x8a, 0x94, 0x56, 0x38, 0x6c, 0xa3, 0xda, 0x3d \
64 } \
66 class TestExternalInterface : public nsISupports {
67 public:
68 NS_DECLARE_STATIC_IID_ACCESSOR(NS_TEST_EXTERNAL_INTERFACE_IID)
69 NS_DECL_ISUPPORTS
72 NS_DEFINE_STATIC_IID_ACCESSOR(TestExternalInterface,
73 NS_TEST_EXTERNAL_INTERFACE_IID)
75 class TestNonWrapperCacheInterface : public nsISupports {
76 public:
77 NS_DECL_ISUPPORTS
79 bool WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto,
80 JS::MutableHandle<JSObject*> aReflector);
83 class OnlyForUseInConstructor : public nsISupports, public nsWrapperCache {
84 public:
85 NS_DECL_ISUPPORTS
86 // We need a GetParentObject to make binding codegen happy
87 virtual nsISupports* GetParentObject();
90 class TestInterface : public nsISupports, public nsWrapperCache {
91 public:
92 NS_DECL_ISUPPORTS
94 // We need a GetParentObject and GetDocGroup to make binding codegen happy
95 virtual nsISupports* GetParentObject();
96 DocGroup* GetDocGroup() const;
98 // And now our actual WebIDL API
99 // Constructors
100 static already_AddRefed<TestInterface> Constructor(const GlobalObject&);
101 static already_AddRefed<TestInterface> Constructor(const GlobalObject&,
102 const nsAString&);
103 static already_AddRefed<TestInterface> Constructor(const GlobalObject&,
104 uint32_t,
105 const Nullable<bool>&);
106 static already_AddRefed<TestInterface> Constructor(const GlobalObject&,
107 TestInterface*);
108 static already_AddRefed<TestInterface> Constructor(const GlobalObject&,
109 uint32_t, TestInterface&);
111 static already_AddRefed<TestInterface> Constructor(const GlobalObject&,
112 const ArrayBuffer&);
113 static already_AddRefed<TestInterface> Constructor(const GlobalObject&,
114 const Uint8Array&);
115 /* static
116 already_AddRefed<TestInterface>
117 Constructor(const GlobalObject&, uint32_t, uint32_t,
118 const TestInterfaceOrOnlyForUseInConstructor&);
121 static already_AddRefed<TestInterface> Test(const GlobalObject&,
122 ErrorResult&);
123 static already_AddRefed<TestInterface> Test(const GlobalObject&,
124 const nsAString&, ErrorResult&);
125 static already_AddRefed<TestInterface> Test(const GlobalObject&,
126 const nsACString&, ErrorResult&);
128 static already_AddRefed<TestInterface> Test2(
129 const GlobalObject&, const DictForConstructor&, JS::Handle<JS::Value>,
130 JS::Handle<JSObject*>, JS::Handle<JSObject*>, const Sequence<Dict>&,
131 JS::Handle<JS::Value>, const Optional<JS::Handle<JSObject*>>&,
132 const Optional<JS::Handle<JSObject*>>&, ErrorResult&);
134 // Integer types
135 int8_t ReadonlyByte();
136 int8_t WritableByte();
137 void SetWritableByte(int8_t);
138 void PassByte(int8_t);
139 int8_t ReceiveByte();
140 void PassOptionalByte(const Optional<int8_t>&);
141 void PassOptionalByteBeforeRequired(const Optional<int8_t>&, int8_t);
142 void PassOptionalByteWithDefault(int8_t);
143 void PassOptionalByteWithDefaultBeforeRequired(int8_t, int8_t);
144 void PassNullableByte(const Nullable<int8_t>&);
145 void PassOptionalNullableByte(const Optional<Nullable<int8_t>>&);
146 void PassVariadicByte(const Sequence<int8_t>&);
147 int8_t CachedByte();
148 int8_t CachedConstantByte();
149 int8_t CachedWritableByte();
150 void SetCachedWritableByte(int8_t);
151 int8_t SideEffectFreeByte();
152 void SetSideEffectFreeByte(int8_t);
153 int8_t DomDependentByte();
154 void SetDomDependentByte(int8_t);
155 int8_t ConstantByte();
156 int8_t DeviceStateDependentByte();
157 int8_t ReturnByteSideEffectFree();
158 int8_t ReturnDOMDependentByte();
159 int8_t ReturnConstantByte();
160 int8_t ReturnDeviceStateDependentByte();
162 void UnsafePrerenderMethod();
163 int32_t UnsafePrerenderWritable();
164 void SetUnsafePrerenderWritable(int32_t);
165 int32_t UnsafePrerenderReadonly();
166 int16_t ReadonlyShort();
167 int16_t WritableShort();
168 void SetWritableShort(int16_t);
169 void PassShort(int16_t);
170 int16_t ReceiveShort();
171 void PassOptionalShort(const Optional<int16_t>&);
172 void PassOptionalShortWithDefault(int16_t);
174 int32_t ReadonlyLong();
175 int32_t WritableLong();
176 void SetWritableLong(int32_t);
177 void PassLong(int32_t);
178 int16_t ReceiveLong();
179 void PassOptionalLong(const Optional<int32_t>&);
180 void PassOptionalLongWithDefault(int32_t);
182 int64_t ReadonlyLongLong();
183 int64_t WritableLongLong();
184 void SetWritableLongLong(int64_t);
185 void PassLongLong(int64_t);
186 int64_t ReceiveLongLong();
187 void PassOptionalLongLong(const Optional<int64_t>&);
188 void PassOptionalLongLongWithDefault(int64_t);
190 uint8_t ReadonlyOctet();
191 uint8_t WritableOctet();
192 void SetWritableOctet(uint8_t);
193 void PassOctet(uint8_t);
194 uint8_t ReceiveOctet();
195 void PassOptionalOctet(const Optional<uint8_t>&);
196 void PassOptionalOctetWithDefault(uint8_t);
198 uint16_t ReadonlyUnsignedShort();
199 uint16_t WritableUnsignedShort();
200 void SetWritableUnsignedShort(uint16_t);
201 void PassUnsignedShort(uint16_t);
202 uint16_t ReceiveUnsignedShort();
203 void PassOptionalUnsignedShort(const Optional<uint16_t>&);
204 void PassOptionalUnsignedShortWithDefault(uint16_t);
206 uint32_t ReadonlyUnsignedLong();
207 uint32_t WritableUnsignedLong();
208 void SetWritableUnsignedLong(uint32_t);
209 void PassUnsignedLong(uint32_t);
210 uint32_t ReceiveUnsignedLong();
211 void PassOptionalUnsignedLong(const Optional<uint32_t>&);
212 void PassOptionalUnsignedLongWithDefault(uint32_t);
214 uint64_t ReadonlyUnsignedLongLong();
215 uint64_t WritableUnsignedLongLong();
216 void SetWritableUnsignedLongLong(uint64_t);
217 void PassUnsignedLongLong(uint64_t);
218 uint64_t ReceiveUnsignedLongLong();
219 void PassOptionalUnsignedLongLong(const Optional<uint64_t>&);
220 void PassOptionalUnsignedLongLongWithDefault(uint64_t);
222 float WritableFloat() const;
223 void SetWritableFloat(float);
224 float WritableUnrestrictedFloat() const;
225 void SetWritableUnrestrictedFloat(float);
226 Nullable<float> GetWritableNullableFloat() const;
227 void SetWritableNullableFloat(const Nullable<float>&);
228 Nullable<float> GetWritableNullableUnrestrictedFloat() const;
229 void SetWritableNullableUnrestrictedFloat(const Nullable<float>&);
230 double WritableDouble() const;
231 void SetWritableDouble(double);
232 double WritableUnrestrictedDouble() const;
233 void SetWritableUnrestrictedDouble(double);
234 Nullable<double> GetWritableNullableDouble() const;
235 void SetWritableNullableDouble(const Nullable<double>&);
236 Nullable<double> GetWritableNullableUnrestrictedDouble() const;
237 void SetWritableNullableUnrestrictedDouble(const Nullable<double>&);
238 void PassFloat(float, float, const Nullable<float>&, const Nullable<float>&,
239 double, double, const Nullable<double>&,
240 const Nullable<double>&, const Sequence<float>&,
241 const Sequence<float>&, const Sequence<Nullable<float>>&,
242 const Sequence<Nullable<float>>&, const Sequence<double>&,
243 const Sequence<double>&, const Sequence<Nullable<double>>&,
244 const Sequence<Nullable<double>>&);
245 void PassLenientFloat(float, float, const Nullable<float>&,
246 const Nullable<float>&, double, double,
247 const Nullable<double>&, const Nullable<double>&,
248 const Sequence<float>&, const Sequence<float>&,
249 const Sequence<Nullable<float>>&,
250 const Sequence<Nullable<float>>&,
251 const Sequence<double>&, const Sequence<double>&,
252 const Sequence<Nullable<double>>&,
253 const Sequence<Nullable<double>>&);
254 float LenientFloatAttr() const;
255 void SetLenientFloatAttr(float);
256 double LenientDoubleAttr() const;
257 void SetLenientDoubleAttr(double);
259 void PassUnrestricted(float arg1, float arg2, float arg3, float arg4,
260 double arg5, double arg6, double arg7, double arg8);
262 // Interface types
263 already_AddRefed<TestInterface> ReceiveSelf();
264 already_AddRefed<TestInterface> ReceiveNullableSelf();
265 TestInterface* ReceiveWeakSelf();
266 TestInterface* ReceiveWeakNullableSelf();
267 void PassSelf(TestInterface&);
268 void PassNullableSelf(TestInterface*);
269 already_AddRefed<TestInterface> NonNullSelf();
270 void SetNonNullSelf(TestInterface&);
271 already_AddRefed<TestInterface> GetNullableSelf();
272 already_AddRefed<TestInterface> CachedSelf();
273 void SetNullableSelf(TestInterface*);
274 void PassOptionalSelf(const Optional<TestInterface*>&);
275 void PassOptionalNonNullSelf(const Optional<NonNull<TestInterface>>&);
276 void PassOptionalSelfWithDefault(TestInterface*);
278 already_AddRefed<TestNonWrapperCacheInterface>
279 ReceiveNonWrapperCacheInterface();
280 already_AddRefed<TestNonWrapperCacheInterface>
281 ReceiveNullableNonWrapperCacheInterface();
282 void ReceiveNonWrapperCacheInterfaceSequence(
283 nsTArray<RefPtr<TestNonWrapperCacheInterface>>&);
284 void ReceiveNullableNonWrapperCacheInterfaceSequence(
285 nsTArray<RefPtr<TestNonWrapperCacheInterface>>&);
286 void ReceiveNonWrapperCacheInterfaceNullableSequence(
287 Nullable<nsTArray<RefPtr<TestNonWrapperCacheInterface>>>&);
288 void ReceiveNullableNonWrapperCacheInterfaceNullableSequence(
289 Nullable<nsTArray<RefPtr<TestNonWrapperCacheInterface>>>&);
291 already_AddRefed<TestExternalInterface> ReceiveExternal();
292 already_AddRefed<TestExternalInterface> ReceiveNullableExternal();
293 TestExternalInterface* ReceiveWeakExternal();
294 TestExternalInterface* ReceiveWeakNullableExternal();
295 void PassExternal(TestExternalInterface*);
296 void PassNullableExternal(TestExternalInterface*);
297 already_AddRefed<TestExternalInterface> NonNullExternal();
298 void SetNonNullExternal(TestExternalInterface*);
299 already_AddRefed<TestExternalInterface> GetNullableExternal();
300 void SetNullableExternal(TestExternalInterface*);
301 void PassOptionalExternal(const Optional<TestExternalInterface*>&);
302 void PassOptionalNonNullExternal(const Optional<TestExternalInterface*>&);
303 void PassOptionalExternalWithDefault(TestExternalInterface*);
305 already_AddRefed<TestCallbackInterface> ReceiveCallbackInterface();
306 already_AddRefed<TestCallbackInterface> ReceiveNullableCallbackInterface();
307 TestCallbackInterface* ReceiveWeakCallbackInterface();
308 TestCallbackInterface* ReceiveWeakNullableCallbackInterface();
309 void PassCallbackInterface(TestCallbackInterface&);
310 void PassNullableCallbackInterface(TestCallbackInterface*);
311 already_AddRefed<TestCallbackInterface> NonNullCallbackInterface();
312 void SetNonNullCallbackInterface(TestCallbackInterface&);
313 already_AddRefed<TestCallbackInterface> GetNullableCallbackInterface();
314 void SetNullableCallbackInterface(TestCallbackInterface*);
315 void PassOptionalCallbackInterface(
316 const Optional<RefPtr<TestCallbackInterface>>&);
317 void PassOptionalNonNullCallbackInterface(
318 const Optional<OwningNonNull<TestCallbackInterface>>&);
319 void PassOptionalCallbackInterfaceWithDefault(TestCallbackInterface*);
321 // Sequence types
322 void GetReadonlySequence(nsTArray<int32_t>&);
323 void GetReadonlySequenceOfDictionaries(JSContext*, nsTArray<Dict>&);
324 void GetReadonlyNullableSequenceOfDictionaries(JSContext*,
325 Nullable<nsTArray<Dict>>&);
326 void GetReadonlyFrozenSequence(JSContext*, nsTArray<Dict>&);
327 void GetReadonlyFrozenNullableSequence(JSContext*, Nullable<nsTArray<Dict>>&);
328 void ReceiveSequence(nsTArray<int32_t>&);
329 void ReceiveNullableSequence(Nullable<nsTArray<int32_t>>&);
330 void ReceiveSequenceOfNullableInts(nsTArray<Nullable<int32_t>>&);
331 void ReceiveNullableSequenceOfNullableInts(
332 Nullable<nsTArray<Nullable<int32_t>>>&);
333 void PassSequence(const Sequence<int32_t>&);
334 void PassNullableSequence(const Nullable<Sequence<int32_t>>&);
335 void PassSequenceOfNullableInts(const Sequence<Nullable<int32_t>>&);
336 void PassOptionalSequenceOfNullableInts(
337 const Optional<Sequence<Nullable<int32_t>>>&);
338 void PassOptionalNullableSequenceOfNullableInts(
339 const Optional<Nullable<Sequence<Nullable<int32_t>>>>&);
340 void ReceiveCastableObjectSequence(nsTArray<RefPtr<TestInterface>>&);
341 void ReceiveCallbackObjectSequence(nsTArray<RefPtr<TestCallbackInterface>>&);
342 void ReceiveNullableCastableObjectSequence(nsTArray<RefPtr<TestInterface>>&);
343 void ReceiveNullableCallbackObjectSequence(
344 nsTArray<RefPtr<TestCallbackInterface>>&);
345 void ReceiveCastableObjectNullableSequence(
346 Nullable<nsTArray<RefPtr<TestInterface>>>&);
347 void ReceiveNullableCastableObjectNullableSequence(
348 Nullable<nsTArray<RefPtr<TestInterface>>>&);
349 void ReceiveWeakCastableObjectSequence(nsTArray<RefPtr<TestInterface>>&);
350 void ReceiveWeakNullableCastableObjectSequence(
351 nsTArray<RefPtr<TestInterface>>&);
352 void ReceiveWeakCastableObjectNullableSequence(
353 Nullable<nsTArray<RefPtr<TestInterface>>>&);
354 void ReceiveWeakNullableCastableObjectNullableSequence(
355 Nullable<nsTArray<RefPtr<TestInterface>>>&);
356 void PassCastableObjectSequence(
357 const Sequence<OwningNonNull<TestInterface>>&);
358 void PassNullableCastableObjectSequence(
359 const Sequence<RefPtr<TestInterface>>&);
360 void PassCastableObjectNullableSequence(
361 const Nullable<Sequence<OwningNonNull<TestInterface>>>&);
362 void PassNullableCastableObjectNullableSequence(
363 const Nullable<Sequence<RefPtr<TestInterface>>>&);
364 void PassOptionalSequence(const Optional<Sequence<int32_t>>&);
365 void PassOptionalSequenceWithDefaultValue(const Sequence<int32_t>&);
366 void PassOptionalNullableSequence(
367 const Optional<Nullable<Sequence<int32_t>>>&);
368 void PassOptionalNullableSequenceWithDefaultValue(
369 const Nullable<Sequence<int32_t>>&);
370 void PassOptionalNullableSequenceWithDefaultValue2(
371 const Nullable<Sequence<int32_t>>&);
372 void PassOptionalObjectSequence(
373 const Optional<Sequence<OwningNonNull<TestInterface>>>&);
374 void PassExternalInterfaceSequence(
375 const Sequence<RefPtr<TestExternalInterface>>&);
376 void PassNullableExternalInterfaceSequence(
377 const Sequence<RefPtr<TestExternalInterface>>&);
379 void ReceiveStringSequence(nsTArray<nsString>&);
380 void PassStringSequence(const Sequence<nsString>&);
382 void ReceiveByteStringSequence(nsTArray<nsCString>&);
383 void PassByteStringSequence(const Sequence<nsCString>&);
385 void ReceiveUTF8StringSequence(nsTArray<nsCString>&);
386 void PassUTF8StringSequence(const Sequence<nsCString>&);
388 void ReceiveAnySequence(JSContext*, nsTArray<JS::Value>&);
389 void ReceiveNullableAnySequence(JSContext*, Nullable<nsTArray<JS::Value>>&);
390 void ReceiveAnySequenceSequence(JSContext*, nsTArray<nsTArray<JS::Value>>&);
392 void ReceiveObjectSequence(JSContext*, nsTArray<JSObject*>&);
393 void ReceiveNullableObjectSequence(JSContext*, nsTArray<JSObject*>&);
395 void PassSequenceOfSequences(const Sequence<Sequence<int32_t>>&);
396 void PassSequenceOfSequencesOfSequences(
397 const Sequence<Sequence<Sequence<int32_t>>>&);
398 void ReceiveSequenceOfSequences(nsTArray<nsTArray<int32_t>>&);
399 void ReceiveSequenceOfSequencesOfSequences(
400 nsTArray<nsTArray<nsTArray<int32_t>>>&);
402 // Record types
403 void PassRecord(const Record<nsString, int32_t>&);
404 void PassNullableRecord(const Nullable<Record<nsString, int32_t>>&);
405 void PassRecordOfNullableInts(const Record<nsString, Nullable<int32_t>>&);
406 void PassOptionalRecordOfNullableInts(
407 const Optional<Record<nsString, Nullable<int32_t>>>&);
408 void PassOptionalNullableRecordOfNullableInts(
409 const Optional<Nullable<Record<nsString, Nullable<int32_t>>>>&);
410 void PassCastableObjectRecord(
411 const Record<nsString, OwningNonNull<TestInterface>>&);
412 void PassNullableCastableObjectRecord(
413 const Record<nsString, RefPtr<TestInterface>>&);
414 void PassCastableObjectNullableRecord(
415 const Nullable<Record<nsString, OwningNonNull<TestInterface>>>&);
416 void PassNullableCastableObjectNullableRecord(
417 const Nullable<Record<nsString, RefPtr<TestInterface>>>&);
418 void PassOptionalRecord(const Optional<Record<nsString, int32_t>>&);
419 void PassOptionalNullableRecord(
420 const Optional<Nullable<Record<nsString, int32_t>>>&);
421 void PassOptionalNullableRecordWithDefaultValue(
422 const Nullable<Record<nsString, int32_t>>&);
423 void PassOptionalObjectRecord(
424 const Optional<Record<nsString, OwningNonNull<TestInterface>>>&);
425 void PassExternalInterfaceRecord(
426 const Record<nsString, RefPtr<TestExternalInterface>>&);
427 void PassNullableExternalInterfaceRecord(
428 const Record<nsString, RefPtr<TestExternalInterface>>&);
429 void PassStringRecord(const Record<nsString, nsString>&);
430 void PassByteStringRecord(const Record<nsString, nsCString>&);
431 void PassUTF8StringRecord(const Record<nsString, nsCString>&);
432 void PassRecordOfRecords(const Record<nsString, Record<nsString, int32_t>>&);
433 void ReceiveRecord(Record<nsString, int32_t>&);
434 void ReceiveNullableRecord(Nullable<Record<nsString, int32_t>>&);
435 void ReceiveRecordOfNullableInts(Record<nsString, Nullable<int32_t>>&);
436 void ReceiveNullableRecordOfNullableInts(
437 Nullable<Record<nsString, Nullable<int32_t>>>&);
438 void ReceiveRecordOfRecords(Record<nsString, Record<nsString, int32_t>>&);
439 void ReceiveAnyRecord(JSContext*, Record<nsString, JS::Value>&);
441 // Typed array types
442 void PassArrayBuffer(const ArrayBuffer&);
443 void PassNullableArrayBuffer(const Nullable<ArrayBuffer>&);
444 void PassOptionalArrayBuffer(const Optional<ArrayBuffer>&);
445 void PassOptionalNullableArrayBuffer(const Optional<Nullable<ArrayBuffer>>&);
446 void PassOptionalNullableArrayBufferWithDefaultValue(
447 const Nullable<ArrayBuffer>&);
448 void PassArrayBufferView(const ArrayBufferView&);
449 void PassInt8Array(const Int8Array&);
450 void PassInt16Array(const Int16Array&);
451 void PassInt32Array(const Int32Array&);
452 void PassUint8Array(const Uint8Array&);
453 void PassUint16Array(const Uint16Array&);
454 void PassUint32Array(const Uint32Array&);
455 void PassUint8ClampedArray(const Uint8ClampedArray&);
456 void PassFloat32Array(const Float32Array&);
457 void PassFloat64Array(const Float64Array&);
458 void PassSequenceOfArrayBuffers(const Sequence<ArrayBuffer>&);
459 void PassSequenceOfNullableArrayBuffers(
460 const Sequence<Nullable<ArrayBuffer>>&);
461 void PassRecordOfArrayBuffers(const Record<nsString, ArrayBuffer>&);
462 void PassRecordOfNullableArrayBuffers(
463 const Record<nsString, Nullable<ArrayBuffer>>&);
464 void PassVariadicTypedArray(const Sequence<Float32Array>&);
465 void PassVariadicNullableTypedArray(const Sequence<Nullable<Float32Array>>&);
466 void ReceiveUint8Array(JSContext*, JS::MutableHandle<JSObject*>);
467 void SetUint8ArrayAttr(const Uint8Array&);
468 void GetUint8ArrayAttr(JSContext*, JS::MutableHandle<JSObject*>);
470 // DOMString types
471 void PassString(const nsAString&);
472 void PassNullableString(const nsAString&);
473 void PassOptionalString(const Optional<nsAString>&);
474 void PassOptionalStringWithDefaultValue(const nsAString&);
475 void PassOptionalNullableString(const Optional<nsAString>&);
476 void PassOptionalNullableStringWithDefaultValue(const nsAString&);
477 void PassVariadicString(const Sequence<nsString>&);
478 void ReceiveString(DOMString&);
480 // ByteString types
481 void PassByteString(const nsCString&);
482 void PassNullableByteString(const nsCString&);
483 void PassOptionalByteString(const Optional<nsCString>&);
484 void PassOptionalByteStringWithDefaultValue(const nsCString&);
485 void PassOptionalNullableByteString(const Optional<nsCString>&);
486 void PassOptionalNullableByteStringWithDefaultValue(const nsCString&);
487 void PassVariadicByteString(const Sequence<nsCString>&);
488 void PassOptionalUnionByteString(const Optional<ByteStringOrLong>&);
489 void PassOptionalUnionByteStringWithDefaultValue(const ByteStringOrLong&);
491 // UTF8String types
492 void PassUTF8String(const nsACString&);
493 void PassNullableUTF8String(const nsACString&);
494 void PassOptionalUTF8String(const Optional<nsACString>&);
495 void PassOptionalUTF8StringWithDefaultValue(const nsACString&);
496 void PassOptionalNullableUTF8String(const Optional<nsACString>&);
497 void PassOptionalNullableUTF8StringWithDefaultValue(const nsACString&);
498 void PassVariadicUTF8String(const Sequence<nsCString>&);
499 void PassOptionalUnionUTF8String(const Optional<UTF8StringOrLong>&);
500 void PassOptionalUnionUTF8StringWithDefaultValue(const UTF8StringOrLong&);
502 // USVString types
503 void PassUSVS(const nsAString&);
504 void PassNullableUSVS(const nsAString&);
505 void PassOptionalUSVS(const Optional<nsAString>&);
506 void PassOptionalUSVSWithDefaultValue(const nsAString&);
507 void PassOptionalNullableUSVS(const Optional<nsAString>&);
508 void PassOptionalNullableUSVSWithDefaultValue(const nsAString&);
509 void PassVariadicUSVS(const Sequence<nsString>&);
510 void ReceiveUSVS(DOMString&);
512 // JSString types
513 void PassJSString(JSContext*, JS::Handle<JSString*>);
514 void PassOptionalJSStringWithDefaultValue(JSContext*, JS::Handle<JSString*>);
515 void ReceiveJSString(JSContext*, JS::MutableHandle<JSString*>);
516 void GetReadonlyJSStringAttr(JSContext*, JS::MutableHandle<JSString*>);
517 void GetJsStringAttr(JSContext*, JS::MutableHandle<JSString*>);
518 void SetJsStringAttr(JSContext*, JS::Handle<JSString*>);
520 // Enumerated types
521 void PassEnum(TestEnum);
522 void PassNullableEnum(const Nullable<TestEnum>&);
523 void PassOptionalEnum(const Optional<TestEnum>&);
524 void PassEnumWithDefault(TestEnum);
525 void PassOptionalNullableEnum(const Optional<Nullable<TestEnum>>&);
526 void PassOptionalNullableEnumWithDefaultValue(const Nullable<TestEnum>&);
527 void PassOptionalNullableEnumWithDefaultValue2(const Nullable<TestEnum>&);
528 TestEnum ReceiveEnum();
529 Nullable<TestEnum> ReceiveNullableEnum();
530 TestEnum EnumAttribute();
531 TestEnum ReadonlyEnumAttribute();
532 void SetEnumAttribute(TestEnum);
534 // Callback types
535 void PassCallback(TestCallback&);
536 void PassNullableCallback(TestCallback*);
537 void PassOptionalCallback(const Optional<OwningNonNull<TestCallback>>&);
538 void PassOptionalNullableCallback(const Optional<RefPtr<TestCallback>>&);
539 void PassOptionalNullableCallbackWithDefaultValue(TestCallback*);
540 already_AddRefed<TestCallback> ReceiveCallback();
541 already_AddRefed<TestCallback> ReceiveNullableCallback();
542 void PassNullableTreatAsNullCallback(TestTreatAsNullCallback*);
543 void PassOptionalNullableTreatAsNullCallback(
544 const Optional<RefPtr<TestTreatAsNullCallback>>&);
545 void PassOptionalNullableTreatAsNullCallbackWithDefaultValue(
546 TestTreatAsNullCallback*);
547 void SetTreatAsNullCallback(TestTreatAsNullCallback&);
548 already_AddRefed<TestTreatAsNullCallback> TreatAsNullCallback();
549 void SetNullableTreatAsNullCallback(TestTreatAsNullCallback*);
550 already_AddRefed<TestTreatAsNullCallback> GetNullableTreatAsNullCallback();
552 void ForceCallbackGeneration(
553 TestIntegerReturn&, TestNullableIntegerReturn&, TestBooleanReturn&,
554 TestFloatReturn&, TestStringReturn&, TestEnumReturn&,
555 TestInterfaceReturn&, TestNullableInterfaceReturn&,
556 TestExternalInterfaceReturn&, TestNullableExternalInterfaceReturn&,
557 TestCallbackInterfaceReturn&, TestNullableCallbackInterfaceReturn&,
558 TestCallbackReturn&, TestNullableCallbackReturn&, TestObjectReturn&,
559 TestNullableObjectReturn&, TestTypedArrayReturn&,
560 TestNullableTypedArrayReturn&, TestSequenceReturn&,
561 TestNullableSequenceReturn&, TestIntegerArguments&,
562 TestInterfaceArguments&, TestStringEnumArguments&, TestObjectArguments&,
563 TestOptionalArguments&, TestUnionArguments&, TestUndefinedConstruction&,
564 TestIntegerConstruction&, TestBooleanConstruction&,
565 TestFloatConstruction&, TestStringConstruction&, TestEnumConstruction&,
566 TestInterfaceConstruction&, TestExternalInterfaceConstruction&,
567 TestCallbackInterfaceConstruction&, TestCallbackConstruction&,
568 TestObjectConstruction&, TestTypedArrayConstruction&,
569 TestSequenceConstruction&);
571 // Any types
572 void PassAny(JSContext*, JS::Handle<JS::Value>);
573 void PassVariadicAny(JSContext*, const Sequence<JS::Value>&);
574 void PassOptionalAny(JSContext*, JS::Handle<JS::Value>);
575 void PassAnyDefaultNull(JSContext*, JS::Handle<JS::Value>);
576 void PassSequenceOfAny(JSContext*, const Sequence<JS::Value>&);
577 void PassNullableSequenceOfAny(JSContext*,
578 const Nullable<Sequence<JS::Value>>&);
579 void PassOptionalSequenceOfAny(JSContext*,
580 const Optional<Sequence<JS::Value>>&);
581 void PassOptionalNullableSequenceOfAny(
582 JSContext*, const Optional<Nullable<Sequence<JS::Value>>>&);
583 void PassOptionalSequenceOfAnyWithDefaultValue(
584 JSContext*, const Nullable<Sequence<JS::Value>>&);
585 void PassSequenceOfSequenceOfAny(JSContext*,
586 const Sequence<Sequence<JS::Value>>&);
587 void PassSequenceOfNullableSequenceOfAny(
588 JSContext*, const Sequence<Nullable<Sequence<JS::Value>>>&);
589 void PassNullableSequenceOfNullableSequenceOfAny(
590 JSContext*, const Nullable<Sequence<Nullable<Sequence<JS::Value>>>>&);
591 void PassOptionalNullableSequenceOfNullableSequenceOfAny(
592 JSContext*,
593 const Optional<Nullable<Sequence<Nullable<Sequence<JS::Value>>>>>&);
594 void PassRecordOfAny(JSContext*, const Record<nsString, JS::Value>&);
595 void PassNullableRecordOfAny(JSContext*,
596 const Nullable<Record<nsString, JS::Value>>&);
597 void PassOptionalRecordOfAny(JSContext*,
598 const Optional<Record<nsString, JS::Value>>&);
599 void PassOptionalNullableRecordOfAny(
600 JSContext*, const Optional<Nullable<Record<nsString, JS::Value>>>&);
601 void PassOptionalRecordOfAnyWithDefaultValue(
602 JSContext*, const Nullable<Record<nsString, JS::Value>>&);
603 void PassRecordOfRecordOfAny(
604 JSContext*, const Record<nsString, Record<nsString, JS::Value>>&);
605 void PassRecordOfNullableRecordOfAny(
606 JSContext*,
607 const Record<nsString, Nullable<Record<nsString, JS::Value>>>&);
608 void PassNullableRecordOfNullableRecordOfAny(
609 JSContext*,
610 const Nullable<Record<nsString, Nullable<Record<nsString, JS::Value>>>>&);
611 void PassOptionalNullableRecordOfNullableRecordOfAny(
612 JSContext*,
613 const Optional<
614 Nullable<Record<nsString, Nullable<Record<nsString, JS::Value>>>>>&);
615 void PassOptionalNullableRecordOfNullableSequenceOfAny(
616 JSContext*,
617 const Optional<
618 Nullable<Record<nsString, Nullable<Sequence<JS::Value>>>>>&);
619 void PassOptionalNullableSequenceOfNullableRecordOfAny(
620 JSContext*,
621 const Optional<
622 Nullable<Sequence<Nullable<Record<nsString, JS::Value>>>>>&);
623 void ReceiveAny(JSContext*, JS::MutableHandle<JS::Value>);
625 // object types
626 void PassObject(JSContext*, JS::Handle<JSObject*>);
627 void PassVariadicObject(JSContext*, const Sequence<JSObject*>&);
628 void PassNullableObject(JSContext*, JS::Handle<JSObject*>);
629 void PassVariadicNullableObject(JSContext*, const Sequence<JSObject*>&);
630 void PassOptionalObject(JSContext*, const Optional<JS::Handle<JSObject*>>&);
631 void PassOptionalNullableObject(JSContext*,
632 const Optional<JS::Handle<JSObject*>>&);
633 void PassOptionalNullableObjectWithDefaultValue(JSContext*,
634 JS::Handle<JSObject*>);
635 void PassSequenceOfObject(JSContext*, const Sequence<JSObject*>&);
636 void PassSequenceOfNullableObject(JSContext*, const Sequence<JSObject*>&);
637 void PassNullableSequenceOfObject(JSContext*,
638 const Nullable<Sequence<JSObject*>>&);
639 void PassOptionalNullableSequenceOfNullableSequenceOfObject(
640 JSContext*,
641 const Optional<Nullable<Sequence<Nullable<Sequence<JSObject*>>>>>&);
642 void PassOptionalNullableSequenceOfNullableSequenceOfNullableObject(
643 JSContext*,
644 const Optional<Nullable<Sequence<Nullable<Sequence<JSObject*>>>>>&);
645 void PassRecordOfObject(JSContext*, const Record<nsString, JSObject*>&);
646 void ReceiveObject(JSContext*, JS::MutableHandle<JSObject*>);
647 void ReceiveNullableObject(JSContext*, JS::MutableHandle<JSObject*>);
649 // Union types
650 void PassUnion(JSContext*, const ObjectOrLong& arg);
651 void PassUnionWithNullable(JSContext* cx, const ObjectOrNullOrLong& arg) {
652 OwningObjectOrLong returnValue;
653 if (arg.IsNull()) {
654 } else if (arg.IsObject()) {
655 JS::Rooted<JSObject*> obj(cx, arg.GetAsObject());
656 JS::GetClass(obj);
657 returnValue.SetAsObject() = obj;
658 } else {
659 int32_t i = arg.GetAsLong();
660 i += 1;
661 returnValue.SetAsLong() = i;
664 #ifdef DEBUG
665 void PassUnion2(const LongOrBoolean& arg);
666 void PassUnion3(JSContext*, const ObjectOrLongOrBoolean& arg);
667 void PassUnion4(const NodeOrLongOrBoolean& arg);
668 void PassUnion5(JSContext*, const ObjectOrBoolean& arg);
669 void PassUnion6(JSContext*, const ObjectOrString& arg);
670 void PassUnion7(JSContext*, const ObjectOrStringOrLong& arg);
671 void PassUnion8(JSContext*, const ObjectOrStringOrBoolean& arg);
672 void PassUnion9(JSContext*, const ObjectOrStringOrLongOrBoolean& arg);
673 void PassUnion10(const EventInitOrLong& arg);
674 void PassUnion11(JSContext*, const CustomEventInitOrLong& arg);
675 void PassUnion12(const EventInitOrLong& arg);
676 void PassUnion13(JSContext*, const ObjectOrLongOrNull& arg);
677 void PassUnion14(JSContext*, const ObjectOrLongOrNull& arg);
678 void PassUnion15(const LongSequenceOrLong&);
679 void PassUnion16(const Optional<LongSequenceOrLong>&);
680 void PassUnion17(const LongSequenceOrNullOrLong&);
681 void PassUnion18(JSContext*, const ObjectSequenceOrLong&);
682 void PassUnion19(JSContext*, const Optional<ObjectSequenceOrLong>&);
683 void PassUnion20(JSContext*, const ObjectSequenceOrLong&);
684 void PassUnion21(const StringLongRecordOrLong&);
685 void PassUnion22(JSContext*, const StringObjectRecordOrLong&);
686 void PassUnion23(const ImageDataSequenceOrLong&);
687 void PassUnion24(const ImageDataOrNullSequenceOrLong&);
688 void PassUnion25(const ImageDataSequenceSequenceOrLong&);
689 void PassUnion26(const ImageDataOrNullSequenceSequenceOrLong&);
690 void PassUnion27(const StringSequenceOrEventInit&);
691 void PassUnion28(const EventInitOrStringSequence&);
692 void PassUnionWithCallback(const EventHandlerNonNullOrNullOrLong& arg);
693 void PassUnionWithByteString(const ByteStringOrLong&);
694 void PassUnionWithUTF8String(const UTF8StringOrLong&);
695 void PassUnionWithRecord(const StringStringRecordOrString&);
696 void PassUnionWithRecordAndSequence(
697 const StringStringRecordOrStringSequence&);
698 void PassUnionWithSequenceAndRecord(
699 const StringSequenceOrStringStringRecord&);
700 void PassUnionWithUSVS(const USVStringOrLong&);
701 #endif
702 void PassNullableUnion(JSContext*, const Nullable<ObjectOrLong>&);
703 void PassOptionalUnion(JSContext*, const Optional<ObjectOrLong>&);
704 void PassOptionalNullableUnion(JSContext*,
705 const Optional<Nullable<ObjectOrLong>>&);
706 void PassOptionalNullableUnionWithDefaultValue(JSContext*,
707 const Nullable<ObjectOrLong>&);
708 // void PassUnionWithInterfaces(const TestInterfaceOrTestExternalInterface&
709 // arg); void PassUnionWithInterfacesAndNullable(const
710 // TestInterfaceOrNullOrTestExternalInterface& arg);
711 void PassUnionWithArrayBuffer(const UTF8StringOrArrayBuffer& aArg) {
712 auto processor = [](const Span<uint8_t>& aData) -> int { return -1; };
713 static_assert(
714 std::is_same_v<decltype(ProcessTypedArraysFixed(aArg, processor)),
715 Maybe<int>>,
716 "If the union can contain non-typedarray members we need to signal "
717 "that with a Maybe<…> rv.");
719 void PassUnionWithArrayBufferOrNull(
720 const UTF8StringOrArrayBufferOrNull& aArg) {
721 auto processor = [](const Span<uint8_t>& aData) -> int { return -1; };
722 static_assert(
723 std::is_same_v<decltype(ProcessTypedArraysFixed(aArg, processor)),
724 Maybe<int>>,
725 "If the union can contain non-typedarray members or null we need to "
726 "signal that with a Maybe<…> rv.");
728 void PassUnionWithTypedArrays(const ArrayBufferViewOrArrayBuffer& aArg) {
729 auto processor = [](const Span<uint8_t>& aData) -> int { return -1; };
730 static_assert(
731 std::is_same_v<decltype(ProcessTypedArraysFixed(aArg, processor)), int>,
732 "If the union can't contain non-typedarray members or null we can just "
733 "return the result of calling the lambda.");
735 void PassUnionWithTypedArraysOrNull(
736 const ArrayBufferViewOrArrayBufferOrNull& aArg) {
737 auto processor = [](const Span<uint8_t>& aData) -> int { return -1; };
738 static_assert(
739 std::is_same_v<decltype(ProcessTypedArraysFixed(aArg, processor)),
740 Maybe<int>>,
741 "If the union can contain non-typedarray members or null we need to "
742 "signal that with a Maybe<…> rv.");
744 void PassUnionWithString(JSContext*, const StringOrObject&);
745 void PassUnionWithEnum(JSContext*, const SupportedTypeOrObject&);
746 // void PassUnionWithCallback(JSContext*, const TestCallbackOrLong&);
747 void PassUnionWithObject(JSContext*, const ObjectOrLong&);
749 void PassUnionWithDefaultValue1(const DoubleOrString& arg);
750 void PassUnionWithDefaultValue2(const DoubleOrString& arg);
751 void PassUnionWithDefaultValue3(const DoubleOrString& arg);
752 void PassUnionWithDefaultValue4(const FloatOrString& arg);
753 void PassUnionWithDefaultValue5(const FloatOrString& arg);
754 void PassUnionWithDefaultValue6(const FloatOrString& arg);
755 void PassUnionWithDefaultValue7(const UnrestrictedDoubleOrString& arg);
756 void PassUnionWithDefaultValue8(const UnrestrictedDoubleOrString& arg);
757 void PassUnionWithDefaultValue9(const UnrestrictedDoubleOrString& arg);
758 void PassUnionWithDefaultValue10(const UnrestrictedDoubleOrString& arg);
759 void PassUnionWithDefaultValue11(const UnrestrictedFloatOrString& arg);
760 void PassUnionWithDefaultValue12(const UnrestrictedFloatOrString& arg);
761 void PassUnionWithDefaultValue13(const UnrestrictedFloatOrString& arg);
762 void PassUnionWithDefaultValue14(const DoubleOrByteString& arg);
763 void PassUnionWithDefaultValue15(const DoubleOrByteString& arg);
764 void PassUnionWithDefaultValue16(const DoubleOrByteString& arg);
765 void PassUnionWithDefaultValue17(const DoubleOrSupportedType& arg);
766 void PassUnionWithDefaultValue18(const DoubleOrSupportedType& arg);
767 void PassUnionWithDefaultValue19(const DoubleOrSupportedType& arg);
768 void PassUnionWithDefaultValue20(const DoubleOrUSVString& arg);
769 void PassUnionWithDefaultValue21(const DoubleOrUSVString& arg);
770 void PassUnionWithDefaultValue22(const DoubleOrUSVString& arg);
771 void PassUnionWithDefaultValue23(const DoubleOrUTF8String& arg);
772 void PassUnionWithDefaultValue24(const DoubleOrUTF8String& arg);
773 void PassUnionWithDefaultValue25(const DoubleOrUTF8String& arg);
775 void PassNullableUnionWithDefaultValue1(const Nullable<DoubleOrString>& arg);
776 void PassNullableUnionWithDefaultValue2(const Nullable<DoubleOrString>& arg);
777 void PassNullableUnionWithDefaultValue3(const Nullable<DoubleOrString>& arg);
778 void PassNullableUnionWithDefaultValue4(const Nullable<FloatOrString>& arg);
779 void PassNullableUnionWithDefaultValue5(const Nullable<FloatOrString>& arg);
780 void PassNullableUnionWithDefaultValue6(const Nullable<FloatOrString>& arg);
781 void PassNullableUnionWithDefaultValue7(
782 const Nullable<UnrestrictedDoubleOrString>& arg);
783 void PassNullableUnionWithDefaultValue8(
784 const Nullable<UnrestrictedDoubleOrString>& arg);
785 void PassNullableUnionWithDefaultValue9(
786 const Nullable<UnrestrictedDoubleOrString>& arg);
787 void PassNullableUnionWithDefaultValue10(
788 const Nullable<UnrestrictedFloatOrString>& arg);
789 void PassNullableUnionWithDefaultValue11(
790 const Nullable<UnrestrictedFloatOrString>& arg);
791 void PassNullableUnionWithDefaultValue12(
792 const Nullable<UnrestrictedFloatOrString>& arg);
793 void PassNullableUnionWithDefaultValue13(
794 const Nullable<DoubleOrByteString>& arg);
795 void PassNullableUnionWithDefaultValue14(
796 const Nullable<DoubleOrByteString>& arg);
797 void PassNullableUnionWithDefaultValue15(
798 const Nullable<DoubleOrByteString>& arg);
799 void PassNullableUnionWithDefaultValue16(
800 const Nullable<DoubleOrByteString>& arg);
801 void PassNullableUnionWithDefaultValue17(
802 const Nullable<DoubleOrSupportedType>& arg);
803 void PassNullableUnionWithDefaultValue18(
804 const Nullable<DoubleOrSupportedType>& arg);
805 void PassNullableUnionWithDefaultValue19(
806 const Nullable<DoubleOrSupportedType>& arg);
807 void PassNullableUnionWithDefaultValue20(
808 const Nullable<DoubleOrSupportedType>& arg);
809 void PassNullableUnionWithDefaultValue21(
810 const Nullable<DoubleOrUSVString>& arg);
811 void PassNullableUnionWithDefaultValue22(
812 const Nullable<DoubleOrUSVString>& arg);
813 void PassNullableUnionWithDefaultValue23(
814 const Nullable<DoubleOrUSVString>& arg);
815 void PassNullableUnionWithDefaultValue24(
816 const Nullable<DoubleOrUSVString>& arg);
817 void PassNullableUnionWithDefaultValue25(
818 const Nullable<DoubleOrUTF8String>& arg);
819 void PassNullableUnionWithDefaultValue26(
820 const Nullable<DoubleOrUTF8String>& arg);
821 void PassNullableUnionWithDefaultValue27(
822 const Nullable<DoubleOrUTF8String>& arg);
823 void PassNullableUnionWithDefaultValue28(
824 const Nullable<DoubleOrUTF8String>& arg);
826 void PassSequenceOfUnions(
827 const Sequence<OwningCanvasPatternOrCanvasGradient>&);
828 void PassSequenceOfUnions2(JSContext*, const Sequence<OwningObjectOrLong>&);
829 void PassVariadicUnion(const Sequence<OwningCanvasPatternOrCanvasGradient>&);
831 void PassSequenceOfNullableUnions(
832 const Sequence<Nullable<OwningCanvasPatternOrCanvasGradient>>&);
833 void PassVariadicNullableUnion(
834 const Sequence<Nullable<OwningCanvasPatternOrCanvasGradient>>&);
835 void PassRecordOfUnions(
836 const Record<nsString, OwningCanvasPatternOrCanvasGradient>&);
837 void PassRecordOfUnions2(JSContext*,
838 const Record<nsString, OwningObjectOrLong>&);
840 void PassUnionWithSequenceOfUnions(
841 const StringOrOnlyForUseInInnerUnionOrCanvasPatternSequence& arg);
842 void PassUnionWithRecordOfUnions(
843 const LongSequenceOrStringOnlyForUseInInnerUnionOrLongSequenceRecord&
844 arg);
846 void ReceiveUnion(OwningCanvasPatternOrCanvasGradient&);
847 void ReceiveUnion2(JSContext*, OwningObjectOrLong&);
848 void ReceiveUnionContainingNull(OwningCanvasPatternOrNullOrCanvasGradient&);
849 void ReceiveNullableUnion(Nullable<OwningCanvasPatternOrCanvasGradient>&);
850 void ReceiveNullableUnion2(JSContext*, Nullable<OwningObjectOrLong>&);
851 void ReceiveUnionWithUndefined(OwningUndefinedOrCanvasPattern&);
852 void ReceiveUnionWithNullableUndefined(OwningUndefinedOrNullOrCanvasPattern&);
853 void ReceiveUnionWithUndefinedAndNullable(
854 OwningUndefinedOrCanvasPatternOrNull&);
855 void ReceiveNullableUnionWithUndefined(
856 Nullable<OwningUndefinedOrCanvasPattern>&);
858 void GetWritableUnion(OwningCanvasPatternOrCanvasGradient&);
859 void SetWritableUnion(const CanvasPatternOrCanvasGradient&);
860 void GetWritableUnionContainingNull(
861 OwningCanvasPatternOrNullOrCanvasGradient&);
862 void SetWritableUnionContainingNull(
863 const CanvasPatternOrNullOrCanvasGradient&);
864 void GetWritableNullableUnion(Nullable<OwningCanvasPatternOrCanvasGradient>&);
865 void SetWritableNullableUnion(const Nullable<CanvasPatternOrCanvasGradient>&);
866 void GetWritableUnionWithUndefined(OwningUndefinedOrCanvasPattern&);
867 void SetWritableUnionWithUndefined(const UndefinedOrCanvasPattern&);
868 void GetWritableUnionWithNullableUndefined(
869 OwningUndefinedOrNullOrCanvasPattern&);
870 void SetWritableUnionWithNullableUndefined(
871 const UndefinedOrNullOrCanvasPattern&);
872 void GetWritableUnionWithUndefinedAndNullable(
873 OwningUndefinedOrCanvasPatternOrNull&);
874 void SetWritableUnionWithUndefinedAndNullable(
875 const UndefinedOrCanvasPatternOrNull&);
876 void GetWritableNullableUnionWithUndefined(
877 Nullable<OwningUndefinedOrCanvasPattern>&);
878 void SetWritableNullableUnionWithUndefined(
879 const Nullable<UndefinedOrCanvasPattern>&);
881 // Promise types
882 void PassPromise(Promise&);
883 void PassOptionalPromise(const Optional<OwningNonNull<Promise>>&);
884 void PassPromiseSequence(const Sequence<OwningNonNull<Promise>>&);
885 void PassPromiseRecord(const Record<nsString, RefPtr<Promise>>&);
886 Promise* ReceivePromise();
887 already_AddRefed<Promise> ReceiveAddrefedPromise();
889 // ObservableArray types
890 void OnDeleteBooleanObservableArray(bool, uint32_t, ErrorResult&);
891 void OnSetBooleanObservableArray(bool, uint32_t, ErrorResult&);
892 void OnDeleteObjectObservableArray(JSContext*, JS::Handle<JSObject*>,
893 uint32_t, ErrorResult&);
894 void OnSetObjectObservableArray(JSContext*, JS::Handle<JSObject*>, uint32_t,
895 ErrorResult&);
896 void OnDeleteAnyObservableArray(JSContext*, JS::Handle<JS::Value>, uint32_t,
897 ErrorResult&);
898 void OnSetAnyObservableArray(JSContext*, JS::Handle<JS::Value>, uint32_t,
899 ErrorResult&);
900 void OnDeleteInterfaceObservableArray(TestInterface*, uint32_t, ErrorResult&);
901 void OnSetInterfaceObservableArray(TestInterface*, uint32_t, ErrorResult&);
902 void OnDeleteNullableObservableArray(const Nullable<int>&, uint32_t,
903 ErrorResult&);
904 void OnSetNullableObservableArray(const Nullable<int>&, uint32_t,
905 ErrorResult&);
907 // binaryNames tests
908 void MethodRenamedTo();
909 void MethodRenamedTo(int8_t);
910 int8_t AttributeGetterRenamedTo();
911 int8_t AttributeRenamedTo();
912 void SetAttributeRenamedTo(int8_t);
914 // Dictionary tests
915 void PassDictionary(JSContext*, const Dict&);
916 void PassDictionary2(JSContext*, const Dict&);
917 void GetReadonlyDictionary(JSContext*, Dict&);
918 void GetReadonlyNullableDictionary(JSContext*, Nullable<Dict>&);
919 void GetWritableDictionary(JSContext*, Dict&);
920 void SetWritableDictionary(JSContext*, const Dict&);
921 void GetReadonlyFrozenDictionary(JSContext*, Dict&);
922 void GetReadonlyFrozenNullableDictionary(JSContext*, Nullable<Dict>&);
923 void GetWritableFrozenDictionary(JSContext*, Dict&);
924 void SetWritableFrozenDictionary(JSContext*, const Dict&);
925 void ReceiveDictionary(JSContext*, Dict&);
926 void ReceiveNullableDictionary(JSContext*, Nullable<Dict>&);
927 void PassOtherDictionary(const GrandparentDict&);
928 void PassSequenceOfDictionaries(JSContext*, const Sequence<Dict>&);
929 void PassRecordOfDictionaries(const Record<nsString, GrandparentDict>&);
930 void PassDictionaryOrLong(JSContext*, const Dict&);
931 void PassDictionaryOrLong(int32_t);
932 void PassDictContainingDict(JSContext*, const DictContainingDict&);
933 void PassDictContainingSequence(JSContext*, const DictContainingSequence&);
934 void ReceiveDictContainingSequence(JSContext*, DictContainingSequence&);
935 void PassVariadicDictionary(JSContext*, const Sequence<Dict>&);
937 // Typedefs
938 void ExerciseTypedefInterfaces1(TestInterface&);
939 already_AddRefed<TestInterface> ExerciseTypedefInterfaces2(TestInterface*);
940 void ExerciseTypedefInterfaces3(TestInterface&);
942 // Deprecated methods and attributes
943 int8_t DeprecatedAttribute();
944 void SetDeprecatedAttribute(int8_t);
945 int8_t DeprecatedMethod();
946 int8_t DeprecatedMethodWithContext(JSContext*, const JS::Value&);
948 // Static methods and attributes
949 static void StaticMethod(const GlobalObject&, bool);
950 static void StaticMethodWithContext(const GlobalObject&, const JS::Value&);
951 static bool StaticAttribute(const GlobalObject&);
952 static void SetStaticAttribute(const GlobalObject&, bool);
953 static void Assert(const GlobalObject&, bool);
955 // Deprecated static methods and attributes
956 static int8_t StaticDeprecatedAttribute(const GlobalObject&);
957 static void SetStaticDeprecatedAttribute(const GlobalObject&, int8_t);
958 static void StaticDeprecatedMethod(const GlobalObject&);
959 static void StaticDeprecatedMethodWithContext(const GlobalObject&,
960 const JS::Value&);
962 // Overload resolution tests
963 bool Overload1(TestInterface&);
964 TestInterface* Overload1(const nsAString&, TestInterface&);
965 void Overload2(TestInterface&);
966 void Overload2(JSContext*, const Dict&);
967 void Overload2(bool);
968 void Overload2(const nsAString&);
969 void Overload3(TestInterface&);
970 void Overload3(const TestCallback&);
971 void Overload3(bool);
972 void Overload4(TestInterface&);
973 void Overload4(TestCallbackInterface&);
974 void Overload4(const nsAString&);
975 void Overload5(int32_t);
976 void Overload5(TestEnum);
977 void Overload6(int32_t);
978 void Overload6(bool);
979 void Overload7(int32_t);
980 void Overload7(bool);
981 void Overload7(const nsCString&);
982 void Overload8(int32_t);
983 void Overload8(TestInterface&);
984 void Overload9(const Nullable<int32_t>&);
985 void Overload9(const nsAString&);
986 void Overload10(const Nullable<int32_t>&);
987 void Overload10(JSContext*, JS::Handle<JSObject*>);
988 void Overload11(int32_t);
989 void Overload11(const nsAString&);
990 void Overload12(int32_t);
991 void Overload12(const Nullable<bool>&);
992 void Overload13(const Nullable<int32_t>&);
993 void Overload13(bool);
994 void Overload14(const Optional<int32_t>&);
995 void Overload14(TestInterface&);
996 void Overload15(int32_t);
997 void Overload15(const Optional<NonNull<TestInterface>>&);
998 void Overload16(int32_t);
999 void Overload16(const Optional<TestInterface*>&);
1000 void Overload17(const Sequence<int32_t>&);
1001 void Overload17(const Record<nsString, int32_t>&);
1002 void Overload18(const Record<nsString, nsString>&);
1003 void Overload18(const Sequence<nsString>&);
1004 void Overload19(const Sequence<int32_t>&);
1005 void Overload19(JSContext*, const Dict&);
1006 void Overload20(JSContext*, const Dict&);
1007 void Overload20(const Sequence<int32_t>&);
1009 // Variadic handling
1010 void PassVariadicThirdArg(const nsAString&, int32_t,
1011 const Sequence<OwningNonNull<TestInterface>>&);
1013 // Conditionally exposed methods/attributes
1014 bool Prefable1();
1015 bool Prefable2();
1016 bool Prefable3();
1017 bool Prefable4();
1018 bool Prefable5();
1019 bool Prefable6();
1020 bool Prefable7();
1021 bool Prefable8();
1022 bool Prefable9();
1023 void Prefable10();
1024 void Prefable11();
1025 bool Prefable12();
1026 void Prefable13();
1027 bool Prefable14();
1028 bool Prefable15();
1029 bool Prefable16();
1030 void Prefable17();
1031 void Prefable18();
1032 void Prefable19();
1033 void Prefable20();
1034 void Prefable21();
1035 void Prefable22();
1036 void Prefable23();
1037 void Prefable24();
1039 // Conditionally exposed methods/attributes involving [SecureContext]
1040 bool ConditionalOnSecureContext1();
1041 bool ConditionalOnSecureContext2();
1042 bool ConditionalOnSecureContext3();
1043 bool ConditionalOnSecureContext4();
1044 void ConditionalOnSecureContext5();
1045 void ConditionalOnSecureContext6();
1046 void ConditionalOnSecureContext7();
1047 void ConditionalOnSecureContext8();
1049 bool ConditionalOnSecureContext9();
1050 void ConditionalOnSecureContext10();
1052 // Miscellania
1053 int32_t AttrWithLenientThis();
1054 void SetAttrWithLenientThis(int32_t);
1055 uint32_t UnforgeableAttr();
1056 uint32_t UnforgeableAttr2();
1057 uint32_t UnforgeableMethod();
1058 uint32_t UnforgeableMethod2();
1059 void Stringify(nsString&);
1060 void PassRenamedInterface(nsRenamedInterface&);
1061 TestInterface* PutForwardsAttr();
1062 TestInterface* PutForwardsAttr2();
1063 TestInterface* PutForwardsAttr3();
1064 void GetToJSONShouldSkipThis(JSContext*, JS::MutableHandle<JS::Value>);
1065 void SetToJSONShouldSkipThis(JSContext*, JS::Rooted<JS::Value>&);
1066 TestParentInterface* ToJSONShouldSkipThis2();
1067 void SetToJSONShouldSkipThis2(TestParentInterface&);
1068 TestCallbackInterface* ToJSONShouldSkipThis3();
1069 void SetToJSONShouldSkipThis3(TestCallbackInterface&);
1070 void ThrowingMethod(ErrorResult& aRv);
1071 bool GetThrowingAttr(ErrorResult& aRv) const;
1072 void SetThrowingAttr(bool arg, ErrorResult& aRv);
1073 bool GetThrowingGetterAttr(ErrorResult& aRv) const;
1074 void SetThrowingGetterAttr(bool arg);
1075 bool ThrowingSetterAttr() const;
1076 void SetThrowingSetterAttr(bool arg, ErrorResult& aRv);
1077 void CanOOMMethod(OOMReporter& aRv);
1078 bool GetCanOOMAttr(OOMReporter& aRv) const;
1079 void SetCanOOMAttr(bool arg, OOMReporter& aRv);
1080 bool GetCanOOMGetterAttr(OOMReporter& aRv) const;
1081 void SetCanOOMGetterAttr(bool arg);
1082 bool CanOOMSetterAttr() const;
1083 void SetCanOOMSetterAttr(bool arg, OOMReporter& aRv);
1084 void NeedsSubjectPrincipalMethod(nsIPrincipal&);
1085 bool NeedsSubjectPrincipalAttr(nsIPrincipal&);
1086 void SetNeedsSubjectPrincipalAttr(bool, nsIPrincipal&);
1087 void NeedsCallerTypeMethod(CallerType);
1088 bool NeedsCallerTypeAttr(CallerType);
1089 void SetNeedsCallerTypeAttr(bool, CallerType);
1090 void NeedsNonSystemSubjectPrincipalMethod(nsIPrincipal*);
1091 bool NeedsNonSystemSubjectPrincipalAttr(nsIPrincipal*);
1092 void SetNeedsNonSystemSubjectPrincipalAttr(bool, nsIPrincipal*);
1093 void CeReactionsMethod();
1094 void CeReactionsMethodOverload();
1095 void CeReactionsMethodOverload(const nsAString&);
1096 bool CeReactionsAttr() const;
1097 void SetCeReactionsAttr(bool);
1098 int16_t LegacyCall(const JS::Value&, uint32_t, TestInterface&);
1099 void PassArgsWithDefaults(JSContext*, const Optional<int32_t>&,
1100 TestInterface*, const Dict&, double,
1101 const Optional<float>&);
1103 void SetDashed_attribute(int8_t);
1104 int8_t Dashed_attribute();
1105 void Dashed_method();
1107 bool NonEnumerableAttr() const;
1108 void SetNonEnumerableAttr(bool);
1109 void NonEnumerableMethod();
1111 // Methods and properties imported via "includes"
1112 bool MixedInProperty();
1113 void SetMixedInProperty(bool);
1114 void MixedInMethod();
1116 // Test EnforceRange/Clamp
1117 void DontEnforceRangeOrClamp(int8_t);
1118 void DoEnforceRange(int8_t);
1119 void DoEnforceRangeNullable(const Nullable<int8_t>&);
1120 void DoClamp(int8_t);
1121 void DoClampNullable(const Nullable<int8_t>&);
1122 void SetEnforcedByte(int8_t);
1123 int8_t EnforcedByte();
1124 void SetEnforcedNullableByte(const Nullable<int8_t>&);
1125 Nullable<int8_t> GetEnforcedNullableByte() const;
1126 void SetClampedNullableByte(const Nullable<int8_t>&);
1127 Nullable<int8_t> GetClampedNullableByte() const;
1128 void SetClampedByte(int8_t);
1129 int8_t ClampedByte();
1131 // Test AllowShared
1132 void SetAllowSharedArrayBufferViewTypedef(const ArrayBufferView&);
1133 void GetAllowSharedArrayBufferViewTypedef(JSContext*,
1134 JS::MutableHandle<JSObject*>);
1135 void SetAllowSharedArrayBufferView(const ArrayBufferView&);
1136 void GetAllowSharedArrayBufferView(JSContext*, JS::MutableHandle<JSObject*>);
1137 void SetAllowSharedNullableArrayBufferView(const Nullable<ArrayBufferView>&);
1138 void GetAllowSharedNullableArrayBufferView(JSContext*,
1139 JS::MutableHandle<JSObject*>);
1140 void SetAllowSharedArrayBuffer(const ArrayBuffer&);
1141 void GetAllowSharedArrayBuffer(JSContext*, JS::MutableHandle<JSObject*>);
1142 void SetAllowSharedNullableArrayBuffer(const Nullable<ArrayBuffer>&);
1143 void GetAllowSharedNullableArrayBuffer(JSContext*,
1144 JS::MutableHandle<JSObject*>);
1146 void PassAllowSharedArrayBufferViewTypedef(const ArrayBufferView&);
1147 void PassAllowSharedArrayBufferView(const ArrayBufferView&);
1148 void PassAllowSharedNullableArrayBufferView(const Nullable<ArrayBufferView>&);
1149 void PassAllowSharedArrayBuffer(const ArrayBuffer&);
1150 void PassAllowSharedNullableArrayBuffer(const Nullable<ArrayBuffer>&);
1151 void PassUnionArrayBuffer(const StringOrArrayBuffer& foo);
1152 void PassUnionAllowSharedArrayBuffer(
1153 const StringOrMaybeSharedArrayBuffer& foo);
1155 void GetReflectedHTMLAttributeReturningFrozenArray(
1156 bool*, Nullable<nsTArray<RefPtr<Element>>>&) const;
1157 void SetReflectedHTMLAttributeReturningFrozenArray(
1158 const Nullable<Sequence<OwningNonNull<Element>>>&);
1160 private:
1161 // We add signatures here that _could_ start matching if the codegen
1162 // got data types wrong. That way if it ever does we'll have a call
1163 // to these private deleted methods and compilation will fail.
1164 void SetReadonlyByte(int8_t) = delete;
1165 template <typename T>
1166 void SetWritableByte(T) = delete;
1167 template <typename T>
1168 void PassByte(T) = delete;
1169 void PassNullableByte(Nullable<int8_t>&) = delete;
1170 template <typename T>
1171 void PassOptionalByte(const Optional<T>&) = delete;
1172 template <typename T>
1173 void PassOptionalByteWithDefault(T) = delete;
1174 void PassVariadicByte(Sequence<int8_t>&) = delete;
1176 void SetReadonlyShort(int16_t) = delete;
1177 template <typename T>
1178 void SetWritableShort(T) = delete;
1179 template <typename T>
1180 void PassShort(T) = delete;
1181 template <typename T>
1182 void PassOptionalShort(const Optional<T>&) = delete;
1183 template <typename T>
1184 void PassOptionalShortWithDefault(T) = delete;
1186 void SetReadonlyLong(int32_t) = delete;
1187 template <typename T>
1188 void SetWritableLong(T) = delete;
1189 template <typename T>
1190 void PassLong(T) = delete;
1191 template <typename T>
1192 void PassOptionalLong(const Optional<T>&) = delete;
1193 template <typename T>
1194 void PassOptionalLongWithDefault(T) = delete;
1196 void SetReadonlyLongLong(int64_t) = delete;
1197 template <typename T>
1198 void SetWritableLongLong(T) = delete;
1199 template <typename T>
1200 void PassLongLong(T) = delete;
1201 template <typename T>
1202 void PassOptionalLongLong(const Optional<T>&) = delete;
1203 template <typename T>
1204 void PassOptionalLongLongWithDefault(T) = delete;
1206 void SetReadonlyOctet(uint8_t) = delete;
1207 template <typename T>
1208 void SetWritableOctet(T) = delete;
1209 template <typename T>
1210 void PassOctet(T) = delete;
1211 template <typename T>
1212 void PassOptionalOctet(const Optional<T>&) = delete;
1213 template <typename T>
1214 void PassOptionalOctetWithDefault(T) = delete;
1216 void SetReadonlyUnsignedShort(uint16_t) = delete;
1217 template <typename T>
1218 void SetWritableUnsignedShort(T) = delete;
1219 template <typename T>
1220 void PassUnsignedShort(T) = delete;
1221 template <typename T>
1222 void PassOptionalUnsignedShort(const Optional<T>&) = delete;
1223 template <typename T>
1224 void PassOptionalUnsignedShortWithDefault(T) = delete;
1226 void SetReadonlyUnsignedLong(uint32_t) = delete;
1227 template <typename T>
1228 void SetWritableUnsignedLong(T) = delete;
1229 template <typename T>
1230 void PassUnsignedLong(T) = delete;
1231 template <typename T>
1232 void PassOptionalUnsignedLong(const Optional<T>&) = delete;
1233 template <typename T>
1234 void PassOptionalUnsignedLongWithDefault(T) = delete;
1236 void SetReadonlyUnsignedLongLong(uint64_t) = delete;
1237 template <typename T>
1238 void SetWritableUnsignedLongLong(T) = delete;
1239 template <typename T>
1240 void PassUnsignedLongLong(T) = delete;
1241 template <typename T>
1242 void PassOptionalUnsignedLongLong(const Optional<T>&) = delete;
1243 template <typename T>
1244 void PassOptionalUnsignedLongLongWithDefault(T) = delete;
1246 // Enforce that only const things are passed for sequences
1247 void PassSequence(Sequence<int32_t>&) = delete;
1248 void PassNullableSequence(Nullable<Sequence<int32_t>>&) = delete;
1249 void PassOptionalNullableSequenceWithDefaultValue(
1250 Nullable<Sequence<int32_t>>&) = delete;
1251 void PassSequenceOfAny(JSContext*, Sequence<JS::Value>&) = delete;
1252 void PassNullableSequenceOfAny(JSContext*,
1253 Nullable<Sequence<JS::Value>>&) = delete;
1254 void PassOptionalSequenceOfAny(JSContext*,
1255 Optional<Sequence<JS::Value>>&) = delete;
1256 void PassOptionalNullableSequenceOfAny(
1257 JSContext*, Optional<Nullable<Sequence<JS::Value>>>&) = delete;
1258 void PassOptionalSequenceOfAnyWithDefaultValue(
1259 JSContext*, Nullable<Sequence<JS::Value>>&) = delete;
1260 void PassSequenceOfSequenceOfAny(JSContext*,
1261 Sequence<Sequence<JS::Value>>&) = delete;
1262 void PassSequenceOfNullableSequenceOfAny(
1263 JSContext*, Sequence<Nullable<Sequence<JS::Value>>>&) = delete;
1264 void PassNullableSequenceOfNullableSequenceOfAny(
1265 JSContext*, Nullable<Sequence<Nullable<Sequence<JS::Value>>>>&) = delete;
1266 void PassOptionalNullableSequenceOfNullableSequenceOfAny(
1267 JSContext*,
1268 Optional<Nullable<Sequence<Nullable<Sequence<JS::Value>>>>>&) = delete;
1269 void PassSequenceOfObject(JSContext*, Sequence<JSObject*>&) = delete;
1270 void PassSequenceOfNullableObject(JSContext*, Sequence<JSObject*>&) = delete;
1271 void PassOptionalNullableSequenceOfNullableSequenceOfObject(
1272 JSContext*,
1273 Optional<Nullable<Sequence<Nullable<Sequence<JSObject*>>>>>&) = delete;
1274 void PassOptionalNullableSequenceOfNullableSequenceOfNullableObject(
1275 JSContext*,
1276 Optional<Nullable<Sequence<Nullable<Sequence<JSObject*>>>>>&) = delete;
1278 // Enforce that only const things are passed for optional
1279 void PassOptionalByte(Optional<int8_t>&) = delete;
1280 void PassOptionalNullableByte(Optional<Nullable<int8_t>>&) = delete;
1281 void PassOptionalShort(Optional<int16_t>&) = delete;
1282 void PassOptionalLong(Optional<int32_t>&) = delete;
1283 void PassOptionalLongLong(Optional<int64_t>&) = delete;
1284 void PassOptionalOctet(Optional<uint8_t>&) = delete;
1285 void PassOptionalUnsignedShort(Optional<uint16_t>&) = delete;
1286 void PassOptionalUnsignedLong(Optional<uint32_t>&) = delete;
1287 void PassOptionalUnsignedLongLong(Optional<uint64_t>&) = delete;
1288 void PassOptionalSelf(Optional<TestInterface*>&) = delete;
1289 void PassOptionalNonNullSelf(Optional<NonNull<TestInterface>>&) = delete;
1290 void PassOptionalExternal(Optional<TestExternalInterface*>&) = delete;
1291 void PassOptionalNonNullExternal(Optional<TestExternalInterface*>&) = delete;
1292 void PassOptionalSequence(Optional<Sequence<int32_t>>&) = delete;
1293 void PassOptionalNullableSequence(Optional<Nullable<Sequence<int32_t>>>&) =
1294 delete;
1295 void PassOptionalObjectSequence(
1296 Optional<Sequence<OwningNonNull<TestInterface>>>&) = delete;
1297 void PassOptionalArrayBuffer(Optional<ArrayBuffer>&) = delete;
1298 void PassOptionalNullableArrayBuffer(Optional<ArrayBuffer*>&) = delete;
1299 void PassOptionalEnum(Optional<TestEnum>&) = delete;
1300 void PassOptionalCallback(JSContext*,
1301 Optional<OwningNonNull<TestCallback>>&) = delete;
1302 void PassOptionalNullableCallback(JSContext*,
1303 Optional<RefPtr<TestCallback>>&) = delete;
1304 void PassOptionalAny(Optional<JS::Handle<JS::Value>>&) = delete;
1306 // And test that string stuff is always const
1307 void PassString(nsAString&) = delete;
1308 void PassNullableString(nsAString&) = delete;
1309 void PassOptionalString(Optional<nsAString>&) = delete;
1310 void PassOptionalStringWithDefaultValue(nsAString&) = delete;
1311 void PassOptionalNullableString(Optional<nsAString>&) = delete;
1312 void PassOptionalNullableStringWithDefaultValue(nsAString&) = delete;
1313 void PassVariadicString(Sequence<nsString>&) = delete;
1315 // cstrings should be const as well
1316 void PassByteString(nsCString&) = delete;
1317 void PassNullableByteString(nsCString&) = delete;
1318 void PassOptionalByteString(Optional<nsCString>&) = delete;
1319 void PassOptionalByteStringWithDefaultValue(nsCString&) = delete;
1320 void PassOptionalNullableByteString(Optional<nsCString>&) = delete;
1321 void PassOptionalNullableByteStringWithDefaultValue(nsCString&) = delete;
1322 void PassVariadicByteString(Sequence<nsCString>&) = delete;
1324 // cstrings should be const as well
1325 void PassUTF8String(nsACString&) = delete;
1326 void PassNullableUTF8String(nsACString&) = delete;
1327 void PassOptionalUTF8String(Optional<nsACString>&) = delete;
1328 void PassOptionalUTF8StringWithDefaultValue(nsACString&) = delete;
1329 void PassOptionalNullableUTF8String(Optional<nsACString>&) = delete;
1330 void PassOptionalNullableUTF8StringWithDefaultValue(nsACString&) = delete;
1331 void PassVariadicUTF8String(Sequence<nsCString>&) = delete;
1333 // Make sure dictionary arguments are always const
1334 void PassDictionary(JSContext*, Dict&) = delete;
1335 void PassOtherDictionary(GrandparentDict&) = delete;
1336 void PassSequenceOfDictionaries(JSContext*, Sequence<Dict>&) = delete;
1337 void PassDictionaryOrLong(JSContext*, Dict&) = delete;
1338 void PassDictContainingDict(JSContext*, DictContainingDict&) = delete;
1339 void PassDictContainingSequence(DictContainingSequence&) = delete;
1341 // Make sure various nullable things are always const
1342 void PassNullableEnum(Nullable<TestEnum>&) = delete;
1344 // Make sure unions are always const
1345 void PassUnion(JSContext*, ObjectOrLong& arg) = delete;
1346 void PassUnionWithNullable(JSContext*, ObjectOrNullOrLong& arg) = delete;
1347 void PassNullableUnion(JSContext*, Nullable<ObjectOrLong>&) = delete;
1348 void PassOptionalUnion(JSContext*, Optional<ObjectOrLong>&) = delete;
1349 void PassOptionalNullableUnion(JSContext*,
1350 Optional<Nullable<ObjectOrLong>>&) = delete;
1351 void PassOptionalNullableUnionWithDefaultValue(
1352 JSContext*, Nullable<ObjectOrLong>&) = delete;
1354 // Make sure variadics are const as needed
1355 void PassVariadicAny(JSContext*, Sequence<JS::Value>&) = delete;
1356 void PassVariadicObject(JSContext*, Sequence<JSObject*>&) = delete;
1357 void PassVariadicNullableObject(JSContext*, Sequence<JSObject*>&) = delete;
1359 // Ensure NonNull does not leak in
1360 void PassSelf(NonNull<TestInterface>&) = delete;
1361 void PassSelf(OwningNonNull<TestInterface>&) = delete;
1362 void PassSelf(const NonNull<TestInterface>&) = delete;
1363 void PassSelf(const OwningNonNull<TestInterface>&) = delete;
1364 void PassCallbackInterface(OwningNonNull<TestCallbackInterface>&) = delete;
1365 void PassCallbackInterface(const OwningNonNull<TestCallbackInterface>&) =
1366 delete;
1367 void PassCallbackInterface(NonNull<TestCallbackInterface>&) = delete;
1368 void PassCallbackInterface(const NonNull<TestCallbackInterface>&) = delete;
1369 void PassCallback(OwningNonNull<TestCallback>&) = delete;
1370 void PassCallback(const OwningNonNull<TestCallback>&) = delete;
1371 void PassCallback(NonNull<TestCallback>&) = delete;
1372 void PassCallback(const NonNull<TestCallback>&) = delete;
1373 void PassString(const NonNull<nsAString>&) = delete;
1374 void PassString(NonNull<nsAString>&) = delete;
1375 void PassString(const OwningNonNull<nsAString>&) = delete;
1376 void PassString(OwningNonNull<nsAString>&) = delete;
1379 class TestLegacyFactoryFunctionInterface : public nsISupports,
1380 public nsWrapperCache {
1381 public:
1382 NS_DECL_ISUPPORTS
1384 // We need a GetParentObject to make binding codegen happy
1385 virtual nsISupports* GetParentObject();
1387 // And now our actual WebIDL API
1388 static already_AddRefed<TestLegacyFactoryFunctionInterface> Test3(
1389 const GlobalObject&, const LongOrStringAnyRecord&, ErrorResult&);
1391 static already_AddRefed<TestLegacyFactoryFunctionInterface> Test4(
1392 const GlobalObject&, const Record<nsString, Record<nsString, JS::Value>>&,
1393 ErrorResult&);
1396 class TestLegacyFactoryFunctionInterface2 : public nsISupports,
1397 public nsWrapperCache {
1398 public:
1399 NS_DECL_ISUPPORTS
1401 // We need a GetParentObject to make binding codegen happy
1402 virtual nsISupports* GetParentObject();
1404 // And now our actual WebIDL API
1405 static already_AddRefed<TestLegacyFactoryFunctionInterface2> Test5(
1406 const GlobalObject&,
1407 const Record<
1408 nsString,
1409 Sequence<Record<nsString,
1410 Record<nsString, Sequence<Sequence<JS::Value>>>>>>&,
1411 ErrorResult&);
1413 static already_AddRefed<TestLegacyFactoryFunctionInterface2> Test6(
1414 const GlobalObject&,
1415 const Sequence<Record<
1416 nsCString,
1417 Sequence<Sequence<Record<nsCString, Record<nsString, JS::Value>>>>>>&,
1418 ErrorResult&);
1421 class TestIndexedGetterInterface : public nsISupports, public nsWrapperCache {
1422 public:
1423 NS_DECL_ISUPPORTS
1425 // We need a GetParentObject to make binding codegen happy
1426 virtual nsISupports* GetParentObject();
1428 uint32_t IndexedGetter(uint32_t, bool&);
1429 uint32_t IndexedGetter(uint32_t&) = delete;
1430 uint32_t Item(uint32_t&);
1431 uint32_t Item(uint32_t, bool&) = delete;
1432 uint32_t Length();
1433 void LegacyCall(JS::Handle<JS::Value>);
1434 int32_t CachedAttr();
1435 int32_t StoreInSlotAttr();
1438 class TestNamedGetterInterface : public nsISupports, public nsWrapperCache {
1439 public:
1440 NS_DECL_ISUPPORTS
1442 // We need a GetParentObject to make binding codegen happy
1443 virtual nsISupports* GetParentObject();
1445 void NamedGetter(const nsAString&, bool&, nsAString&);
1446 void GetSupportedNames(nsTArray<nsString>&);
1449 class TestIndexedGetterAndSetterAndNamedGetterInterface
1450 : public nsISupports,
1451 public nsWrapperCache {
1452 public:
1453 NS_DECL_ISUPPORTS
1455 // We need a GetParentObject to make binding codegen happy
1456 virtual nsISupports* GetParentObject();
1458 void NamedGetter(const nsAString&, bool&, nsAString&);
1459 void GetSupportedNames(nsTArray<nsString>&);
1460 int32_t IndexedGetter(uint32_t, bool&);
1461 void IndexedSetter(uint32_t, int32_t);
1462 uint32_t Length();
1465 class TestIndexedAndNamedGetterInterface : public nsISupports,
1466 public nsWrapperCache {
1467 public:
1468 NS_DECL_ISUPPORTS
1470 // We need a GetParentObject to make binding codegen happy
1471 virtual nsISupports* GetParentObject();
1473 uint32_t IndexedGetter(uint32_t, bool&);
1474 void NamedGetter(const nsAString&, bool&, nsAString&);
1475 void NamedItem(const nsAString&, nsAString&);
1476 uint32_t Length();
1477 void GetSupportedNames(nsTArray<nsString>&);
1480 class TestIndexedSetterInterface : public nsISupports, public nsWrapperCache {
1481 public:
1482 NS_DECL_ISUPPORTS
1484 // We need a GetParentObject to make binding codegen happy
1485 virtual nsISupports* GetParentObject();
1487 void IndexedSetter(uint32_t, const nsAString&);
1488 void IndexedGetter(uint32_t, bool&, nsString&);
1489 uint32_t Length();
1490 void SetItem(uint32_t, const nsAString&);
1493 class TestNamedSetterInterface : public nsISupports, public nsWrapperCache {
1494 public:
1495 NS_DECL_ISUPPORTS
1497 // We need a GetParentObject to make binding codegen happy
1498 virtual nsISupports* GetParentObject();
1500 void NamedSetter(const nsAString&, TestIndexedSetterInterface&);
1501 TestIndexedSetterInterface* NamedGetter(const nsAString&, bool&);
1502 void GetSupportedNames(nsTArray<nsString>&);
1505 class TestIndexedAndNamedSetterInterface : public nsISupports,
1506 public nsWrapperCache {
1507 public:
1508 NS_DECL_ISUPPORTS
1510 // We need a GetParentObject to make binding codegen happy
1511 virtual nsISupports* GetParentObject();
1513 void IndexedSetter(uint32_t, TestIndexedSetterInterface&);
1514 TestIndexedSetterInterface* IndexedGetter(uint32_t, bool&);
1515 uint32_t Length();
1516 void NamedSetter(const nsAString&, TestIndexedSetterInterface&);
1517 TestIndexedSetterInterface* NamedGetter(const nsAString&, bool&);
1518 void SetNamedItem(const nsAString&, TestIndexedSetterInterface&);
1519 void GetSupportedNames(nsTArray<nsString>&);
1522 class TestIndexedAndNamedGetterAndSetterInterface
1523 : public TestIndexedSetterInterface {
1524 public:
1525 uint32_t IndexedGetter(uint32_t, bool&);
1526 uint32_t Item(uint32_t);
1527 void NamedGetter(const nsAString&, bool&, nsAString&);
1528 void NamedItem(const nsAString&, nsAString&);
1529 void IndexedSetter(uint32_t, int32_t&);
1530 void IndexedSetter(uint32_t, const nsAString&) = delete;
1531 void NamedSetter(const nsAString&, const nsAString&);
1532 void Stringify(nsAString&);
1533 uint32_t Length();
1534 void GetSupportedNames(nsTArray<nsString>&);
1537 class TestCppKeywordNamedMethodsInterface : public nsISupports,
1538 public nsWrapperCache {
1539 public:
1540 NS_DECL_ISUPPORTS
1542 // We need a GetParentObject to make binding codegen happy
1543 virtual nsISupports* GetParentObject();
1545 bool Continue();
1546 bool Delete();
1547 int32_t Volatile();
1550 class TestNamedDeleterInterface : public nsISupports, public nsWrapperCache {
1551 public:
1552 NS_DECL_ISUPPORTS
1554 // We need a GetParentObject to make binding codegen happy
1555 virtual nsISupports* GetParentObject();
1557 void NamedDeleter(const nsAString&, bool&);
1558 long NamedGetter(const nsAString&, bool&);
1559 void GetSupportedNames(nsTArray<nsString>&);
1562 class TestNamedDeleterWithRetvalInterface : public nsISupports,
1563 public nsWrapperCache {
1564 public:
1565 NS_DECL_ISUPPORTS
1567 // We need a GetParentObject to make binding codegen happy
1568 virtual nsISupports* GetParentObject();
1570 bool NamedDeleter(const nsAString&, bool&);
1571 bool NamedDeleter(const nsAString&) = delete;
1572 long NamedGetter(const nsAString&, bool&);
1573 bool DelNamedItem(const nsAString&);
1574 bool DelNamedItem(const nsAString&, bool&) = delete;
1575 void GetSupportedNames(nsTArray<nsString>&);
1578 class TestParentInterface : public nsISupports, public nsWrapperCache {
1579 public:
1580 NS_DECL_ISUPPORTS
1582 // We need a GetParentObject to make binding codegen happy
1583 virtual nsISupports* GetParentObject();
1586 class TestChildInterface : public TestParentInterface {};
1588 class TestDeprecatedInterface : public nsISupports, public nsWrapperCache {
1589 public:
1590 NS_DECL_ISUPPORTS
1592 static already_AddRefed<TestDeprecatedInterface> Constructor(
1593 const GlobalObject&);
1595 static void AlsoDeprecated(const GlobalObject&);
1597 virtual nsISupports* GetParentObject();
1600 class TestInterfaceWithPromiseConstructorArg : public nsISupports,
1601 public nsWrapperCache {
1602 public:
1603 NS_DECL_ISUPPORTS
1605 static already_AddRefed<TestInterfaceWithPromiseConstructorArg> Constructor(
1606 const GlobalObject&, Promise&);
1608 virtual nsISupports* GetParentObject();
1611 class TestSecureContextInterface : public nsISupports, public nsWrapperCache {
1612 public:
1613 NS_DECL_ISUPPORTS
1615 static already_AddRefed<TestSecureContextInterface> Constructor(
1616 const GlobalObject&, ErrorResult&);
1618 static void AlsoSecureContext(const GlobalObject&);
1620 virtual nsISupports* GetParentObject();
1623 class TestNamespace {
1624 public:
1625 static bool Foo(const GlobalObject&);
1626 static int32_t Bar(const GlobalObject&);
1627 static void Baz(const GlobalObject&);
1630 class TestRenamedNamespace {};
1632 class TestProtoObjectHackedNamespace {};
1634 class TestWorkerExposedInterface : public nsISupports, public nsWrapperCache {
1635 public:
1636 NS_DECL_ISUPPORTS
1638 // We need a GetParentObject to make binding codegen happy
1639 nsISupports* GetParentObject();
1641 void NeedsSubjectPrincipalMethod(nsIPrincipal&);
1642 bool NeedsSubjectPrincipalAttr(nsIPrincipal&);
1643 void SetNeedsSubjectPrincipalAttr(bool, nsIPrincipal&);
1644 void NeedsCallerTypeMethod(CallerType);
1645 bool NeedsCallerTypeAttr(CallerType);
1646 void SetNeedsCallerTypeAttr(bool, CallerType);
1647 void NeedsNonSystemSubjectPrincipalMethod(nsIPrincipal*);
1648 bool NeedsNonSystemSubjectPrincipalAttr(nsIPrincipal*);
1649 void SetNeedsNonSystemSubjectPrincipalAttr(bool, nsIPrincipal*);
1652 class TestHTMLConstructorInterface : public nsGenericHTMLElement {
1653 public:
1654 virtual nsISupports* GetParentObject();
1657 class TestThrowingConstructorInterface : public nsISupports,
1658 public nsWrapperCache {
1659 public:
1660 static already_AddRefed<TestThrowingConstructorInterface> Constructor(
1661 const GlobalObject&, ErrorResult&);
1662 static already_AddRefed<TestThrowingConstructorInterface> Constructor(
1663 const GlobalObject&, const nsAString&, ErrorResult&);
1664 static already_AddRefed<TestThrowingConstructorInterface> Constructor(
1665 const GlobalObject&, uint32_t, const Nullable<bool>&, ErrorResult&);
1666 static already_AddRefed<TestThrowingConstructorInterface> Constructor(
1667 const GlobalObject&, TestInterface*, ErrorResult&);
1668 static already_AddRefed<TestThrowingConstructorInterface> Constructor(
1669 const GlobalObject&, uint32_t, TestInterface&, ErrorResult&);
1671 static already_AddRefed<TestThrowingConstructorInterface> Constructor(
1672 const GlobalObject&, const ArrayBuffer&, ErrorResult&);
1673 static already_AddRefed<TestThrowingConstructorInterface> Constructor(
1674 const GlobalObject&, const Uint8Array&, ErrorResult&);
1675 /* static
1676 already_AddRefed<TestThrowingConstructorInterface>
1677 Constructor(const GlobalObject&, uint32_t, uint32_t,
1678 const TestInterfaceOrOnlyForUseInConstructor&, ErrorResult&);
1681 virtual nsISupports* GetParentObject();
1684 class TestCEReactionsInterface : public nsISupports, public nsWrapperCache {
1685 public:
1686 NS_DECL_ISUPPORTS
1688 // We need a GetParentObject and GetDocGroup to make binding codegen happy
1689 virtual nsISupports* GetParentObject();
1690 DocGroup* GetDocGroup() const;
1692 int32_t Item(uint32_t);
1693 uint32_t Length() const;
1694 int32_t IndexedGetter(uint32_t, bool&);
1695 void IndexedSetter(uint32_t, int32_t);
1696 void NamedDeleter(const nsAString&, bool&);
1697 void NamedGetter(const nsAString&, bool&, nsString&);
1698 void NamedSetter(const nsAString&, const nsAString&);
1699 void GetSupportedNames(nsTArray<nsString>&);
1702 class TestAttributesOnTypes : public nsISupports, public nsWrapperCache {
1703 public:
1704 NS_DECL_ISUPPORTS
1706 // We need a GetParentObject and GetDocGroup to make binding codegen happy
1707 virtual nsISupports* GetParentObject();
1709 void Foo(uint8_t arg);
1710 void Bar(uint8_t arg);
1711 void Baz(const nsAString& arg);
1712 uint8_t SomeAttr();
1713 void SetSomeAttr(uint8_t);
1714 void ArgWithAttr(uint8_t arg1, const Optional<uint8_t>& arg2);
1717 class TestPrefConstructorForInterface : public nsISupports,
1718 public nsWrapperCache {
1719 public:
1720 NS_DECL_ISUPPORTS
1721 virtual nsISupports* GetParentObject();
1723 // Since only the constructor is under a pref,
1724 // the generated constructor should check for the pref.
1725 static already_AddRefed<TestPrefConstructorForInterface> Constructor(
1726 const GlobalObject&);
1729 class TestConstructorForPrefInterface : public nsISupports,
1730 public nsWrapperCache {
1731 public:
1732 NS_DECL_ISUPPORTS
1733 virtual nsISupports* GetParentObject();
1735 // Since the interface itself is under a Pref, there should be no
1736 // check for the pref in the generated constructor.
1737 static already_AddRefed<TestConstructorForPrefInterface> Constructor(
1738 const GlobalObject&);
1741 class TestPrefConstructorForDifferentPrefInterface : public nsISupports,
1742 public nsWrapperCache {
1743 public:
1744 NS_DECL_ISUPPORTS
1745 virtual nsISupports* GetParentObject();
1747 // Since the constructor's pref is different than the interface pref
1748 // there should still be a check for the pref in the generated constructor.
1749 static already_AddRefed<TestPrefConstructorForDifferentPrefInterface>
1750 Constructor(const GlobalObject&);
1753 class TestConstructorForSCInterface : public nsISupports,
1754 public nsWrapperCache {
1755 public:
1756 NS_DECL_ISUPPORTS
1757 virtual nsISupports* GetParentObject();
1759 // Since the interface itself is SecureContext, there should be no
1760 // check for SecureContext in the constructor.
1761 static already_AddRefed<TestConstructorForSCInterface> Constructor(
1762 const GlobalObject&);
1765 class TestSCConstructorForInterface : public nsISupports,
1766 public nsWrapperCache {
1767 public:
1768 NS_DECL_ISUPPORTS
1769 virtual nsISupports* GetParentObject();
1771 // Since the interface context is unspecified but the constructor is
1772 // SecureContext, the generated constructor should check for SecureContext.
1773 static already_AddRefed<TestSCConstructorForInterface> Constructor(
1774 const GlobalObject&);
1777 class TestConstructorForFuncInterface : public nsISupports,
1778 public nsWrapperCache {
1779 public:
1780 NS_DECL_ISUPPORTS
1781 virtual nsISupports* GetParentObject();
1783 // Since the interface has a Func attribute, but the constructor does not,
1784 // the generated constructor should not check for the Func.
1785 static already_AddRefed<TestConstructorForFuncInterface> Constructor(
1786 const GlobalObject&);
1789 class TestFuncConstructorForInterface : public nsISupports,
1790 public nsWrapperCache {
1791 public:
1792 NS_DECL_ISUPPORTS
1793 virtual nsISupports* GetParentObject();
1795 // Since the constructor has a Func attribute, but the interface does not,
1796 // the generated constructor should check for the Func.
1797 static already_AddRefed<TestFuncConstructorForInterface> Constructor(
1798 const GlobalObject&);
1801 class TestFuncConstructorForDifferentFuncInterface : public nsISupports,
1802 public nsWrapperCache {
1803 public:
1804 NS_DECL_ISUPPORTS
1805 virtual nsISupports* GetParentObject();
1807 // Since the constructor has a different Func attribute from the interface,
1808 // the generated constructor should still check for its conditional func.
1809 static already_AddRefed<TestFuncConstructorForDifferentFuncInterface>
1810 Constructor(const GlobalObject&);
1813 class TestPrefChromeOnlySCFuncConstructorForInterface : public nsISupports,
1814 public nsWrapperCache {
1815 public:
1816 NS_DECL_ISUPPORTS
1817 virtual nsISupports* GetParentObject();
1819 // There should be checks for all Pref/ChromeOnly/SecureContext/Func
1820 // in the generated constructor.
1821 static already_AddRefed<TestPrefChromeOnlySCFuncConstructorForInterface>
1822 Constructor(const GlobalObject&);
1825 class TestCallbackDictUnionOverload : public nsISupports,
1826 public nsWrapperCache {
1827 public:
1828 NS_DECL_ISUPPORTS
1829 virtual nsISupports* GetParentObject();
1831 void Overload1(bool);
1832 void Overload1(TestCallback&);
1833 void Overload1(const GrandparentDict&);
1834 void Overload2(bool);
1835 void Overload2(const GrandparentDict&);
1836 void Overload2(TestCallback&);
1839 } // namespace dom
1840 } // namespace mozilla
1842 #endif /* TestBindingHeader_h */