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