dom/bindings/test/TestCodeGen.webidl

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:25b97bb96b60
1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
4 * You can obtain one at http://mozilla.org/MPL/2.0/.
5 */
6
7 typedef long myLong;
8 typedef TestInterface AnotherNameForTestInterface;
9 typedef TestInterface? NullableTestInterface;
10
11 interface TestExternalInterface;
12
13 [AvailableIn=PrivilegedApps, Pref="xyz"]
14 interface TestRenamedInterface {
15 };
16
17 callback interface TestCallbackInterface {
18 readonly attribute long foo;
19 attribute DOMString bar;
20 void doSomething();
21 long doSomethingElse(DOMString arg, TestInterface otherArg);
22 void doSequenceLongArg(sequence<long> arg);
23 void doSequenceStringArg(sequence<DOMString> arg);
24 void doMozMapLongArg(MozMap<long> arg);
25 sequence<long> getSequenceOfLong();
26 sequence<TestInterface> getSequenceOfInterfaces();
27 sequence<TestInterface>? getNullableSequenceOfInterfaces();
28 sequence<TestInterface?> getSequenceOfNullableInterfaces();
29 sequence<TestInterface?>? getNullableSequenceOfNullableInterfaces();
30 sequence<TestCallbackInterface> getSequenceOfCallbackInterfaces();
31 sequence<TestCallbackInterface>? getNullableSequenceOfCallbackInterfaces();
32 sequence<TestCallbackInterface?> getSequenceOfNullableCallbackInterfaces();
33 sequence<TestCallbackInterface?>? getNullableSequenceOfNullableCallbackInterfaces();
34 MozMap<long> getMozMapOfLong();
35 Dict? getDictionary();
36 };
37
38 callback interface TestSingleOperationCallbackInterface {
39 TestInterface doSomething(short arg, sequence<double> anotherArg);
40 };
41
42 enum TestEnum {
43 "1",
44 "a",
45 "b"
46 };
47
48 callback TestCallback = void();
49 [TreatNonCallableAsNull] callback TestTreatAsNullCallback = void();
50
51 // Callback return value tests
52 callback TestIntegerReturn = long();
53 callback TestNullableIntegerReturn = long?();
54 callback TestBooleanReturn = boolean();
55 callback TestFloatReturn = float();
56 callback TestStringReturn = DOMString(long arg);
57 callback TestEnumReturn = TestEnum();
58 callback TestInterfaceReturn = TestInterface();
59 callback TestNullableInterfaceReturn = TestInterface?();
60 callback TestExternalInterfaceReturn = TestExternalInterface();
61 callback TestNullableExternalInterfaceReturn = TestExternalInterface?();
62 callback TestCallbackInterfaceReturn = TestCallbackInterface();
63 callback TestNullableCallbackInterfaceReturn = TestCallbackInterface?();
64 callback TestCallbackReturn = TestCallback();
65 callback TestNullableCallbackReturn = TestCallback?();
66 callback TestObjectReturn = object();
67 callback TestNullableObjectReturn = object?();
68 callback TestTypedArrayReturn = ArrayBuffer();
69 callback TestNullableTypedArrayReturn = ArrayBuffer?();
70 callback TestSequenceReturn = sequence<boolean>();
71 callback TestNullableSequenceReturn = sequence<boolean>?();
72 // Callback argument tests
73 callback TestIntegerArguments = sequence<long>(long arg1, long? arg2,
74 sequence<long> arg3,
75 sequence<long?>? arg4);
76 callback TestInterfaceArguments = void(TestInterface arg1, TestInterface? arg2,
77 TestExternalInterface arg3,
78 TestExternalInterface? arg4,
79 TestCallbackInterface arg5,
80 TestCallbackInterface? arg6,
81 sequence<TestInterface> arg7,
82 sequence<TestInterface?>? arg8,
83 sequence<TestExternalInterface> arg9,
84 sequence<TestExternalInterface?>? arg10,
85 sequence<TestCallbackInterface> arg11,
86 sequence<TestCallbackInterface?>? arg12);
87 callback TestStringEnumArguments = void(DOMString myString, DOMString? nullString,
88 TestEnum myEnum);
89 callback TestObjectArguments = void(object anObj, object? anotherObj,
90 ArrayBuffer buf, ArrayBuffer? buf2);
91 callback TestOptionalArguments = void(optional DOMString aString,
92 optional object something,
93 optional sequence<TestInterface> aSeq,
94 optional TestInterface? anInterface,
95 optional TestInterface anotherInterface,
96 optional long aLong);
97
98 TestInterface implements ImplementedInterface;
99
100 // This interface is only for use in the constructor below
101 interface OnlyForUseInConstructor {
102 };
103
104 [Constructor,
105 Constructor(DOMString str),
106 Constructor(unsigned long num, boolean? boolArg),
107 Constructor(TestInterface? iface),
108 Constructor(long arg1, IndirectlyImplementedInterface iface),
109 Constructor(Date arg1),
110 // Constructor(long arg1, long arg2, (TestInterface or OnlyForUseInConstructor) arg3),
111 AvailableIn=CertifiedApps,
112 NamedConstructor=Test,
113 NamedConstructor=Test(DOMString str),
114 NamedConstructor=Test2(DictForConstructor dict, any any1, object obj1,
115 object? obj2, sequence<Dict> seq, optional any any2,
116 optional object obj3, optional object? obj4)
117 ]
118 interface TestInterface {
119 // Integer types
120 // XXXbz add tests for throwing versions of all the integer stuff
121 readonly attribute byte readonlyByte;
122 attribute byte writableByte;
123 void passByte(byte arg);
124 byte receiveByte();
125 void passOptionalByte(optional byte arg);
126 void passOptionalByteBeforeRequired(optional byte arg1, byte arg2);
127 void passOptionalByteWithDefault(optional byte arg = 0);
128 void passOptionalByteWithDefaultBeforeRequired(optional byte arg1 = 0, byte arg2);
129 void passNullableByte(byte? arg);
130 void passOptionalNullableByte(optional byte? arg);
131 void passVariadicByte(byte... arg);
132 [StoreInSlot, Pure]
133 readonly attribute byte cachedByte;
134 [StoreInSlot, Constant]
135 readonly attribute byte cachedConstantByte;
136 [StoreInSlot, Pure]
137 attribute byte cachedWritableByte;
138
139 readonly attribute short readonlyShort;
140 attribute short writableShort;
141 void passShort(short arg);
142 short receiveShort();
143 void passOptionalShort(optional short arg);
144 void passOptionalShortWithDefault(optional short arg = 5);
145
146 readonly attribute long readonlyLong;
147 attribute long writableLong;
148 void passLong(long arg);
149 long receiveLong();
150 void passOptionalLong(optional long arg);
151 void passOptionalLongWithDefault(optional long arg = 7);
152
153 readonly attribute long long readonlyLongLong;
154 attribute long long writableLongLong;
155 void passLongLong(long long arg);
156 long long receiveLongLong();
157 void passOptionalLongLong(optional long long arg);
158 void passOptionalLongLongWithDefault(optional long long arg = -12);
159
160 readonly attribute octet readonlyOctet;
161 attribute octet writableOctet;
162 void passOctet(octet arg);
163 octet receiveOctet();
164 void passOptionalOctet(optional octet arg);
165 void passOptionalOctetWithDefault(optional octet arg = 19);
166
167 readonly attribute unsigned short readonlyUnsignedShort;
168 attribute unsigned short writableUnsignedShort;
169 void passUnsignedShort(unsigned short arg);
170 unsigned short receiveUnsignedShort();
171 void passOptionalUnsignedShort(optional unsigned short arg);
172 void passOptionalUnsignedShortWithDefault(optional unsigned short arg = 2);
173
174 readonly attribute unsigned long readonlyUnsignedLong;
175 attribute unsigned long writableUnsignedLong;
176 void passUnsignedLong(unsigned long arg);
177 unsigned long receiveUnsignedLong();
178 void passOptionalUnsignedLong(optional unsigned long arg);
179 void passOptionalUnsignedLongWithDefault(optional unsigned long arg = 6);
180
181 readonly attribute unsigned long long readonlyUnsignedLongLong;
182 attribute unsigned long long writableUnsignedLongLong;
183 void passUnsignedLongLong(unsigned long long arg);
184 unsigned long long receiveUnsignedLongLong();
185 void passOptionalUnsignedLongLong(optional unsigned long long arg);
186 void passOptionalUnsignedLongLongWithDefault(optional unsigned long long arg = 17);
187
188 attribute float writableFloat;
189 attribute unrestricted float writableUnrestrictedFloat;
190 attribute float? writableNullableFloat;
191 attribute unrestricted float? writableNullableUnrestrictedFloat;
192 attribute double writableDouble;
193 attribute unrestricted double writableUnrestrictedDouble;
194 attribute double? writableNullableDouble;
195 attribute unrestricted double? writableNullableUnrestrictedDouble;
196 void passFloat(float arg1, unrestricted float arg2,
197 float? arg3, unrestricted float? arg4,
198 double arg5, unrestricted double arg6,
199 double? arg7, unrestricted double? arg8,
200 sequence<float> arg9, sequence<unrestricted float> arg10,
201 sequence<float?> arg11, sequence<unrestricted float?> arg12,
202 sequence<double> arg13, sequence<unrestricted double> arg14,
203 sequence<double?> arg15, sequence<unrestricted double?> arg16);
204 [LenientFloat]
205 void passLenientFloat(float arg1, unrestricted float arg2,
206 float? arg3, unrestricted float? arg4,
207 double arg5, unrestricted double arg6,
208 double? arg7, unrestricted double? arg8,
209 sequence<float> arg9,
210 sequence<unrestricted float> arg10,
211 sequence<float?> arg11,
212 sequence<unrestricted float?> arg12,
213 sequence<double> arg13,
214 sequence<unrestricted double> arg14,
215 sequence<double?> arg15,
216 sequence<unrestricted double?> arg16);
217 [LenientFloat]
218 attribute float lenientFloatAttr;
219 [LenientFloat]
220 attribute double lenientDoubleAttr;
221
222 void passUnrestricted(optional unrestricted float arg1 = 0,
223 optional unrestricted float arg2 = Infinity,
224 optional unrestricted float arg3 = -Infinity,
225 optional unrestricted float arg4 = NaN,
226 optional unrestricted double arg5 = 0,
227 optional unrestricted double arg6 = Infinity,
228 optional unrestricted double arg7 = -Infinity,
229 optional unrestricted double arg8 = NaN);
230
231 // Castable interface types
232 // XXXbz add tests for throwing versions of all the castable interface stuff
233 TestInterface receiveSelf();
234 TestInterface? receiveNullableSelf();
235 TestInterface receiveWeakSelf();
236 TestInterface? receiveWeakNullableSelf();
237 void passSelf(TestInterface arg);
238 void passNullableSelf(TestInterface? arg);
239 attribute TestInterface nonNullSelf;
240 attribute TestInterface? nullableSelf;
241 [Cached, Pure]
242 readonly attribute TestInterface cachedSelf;
243 // Optional arguments
244 void passOptionalSelf(optional TestInterface? arg);
245 void passOptionalNonNullSelf(optional TestInterface arg);
246 void passOptionalSelfWithDefault(optional TestInterface? arg = null);
247
248 // Non-wrapper-cache interface types
249 [NewObject]
250 TestNonWrapperCacheInterface receiveNonWrapperCacheInterface();
251 [NewObject]
252 TestNonWrapperCacheInterface? receiveNullableNonWrapperCacheInterface();
253 [NewObject]
254 sequence<TestNonWrapperCacheInterface> receiveNonWrapperCacheInterfaceSequence();
255 [NewObject]
256 sequence<TestNonWrapperCacheInterface?> receiveNullableNonWrapperCacheInterfaceSequence();
257 [NewObject]
258 sequence<TestNonWrapperCacheInterface>? receiveNonWrapperCacheInterfaceNullableSequence();
259 [NewObject]
260 sequence<TestNonWrapperCacheInterface?>? receiveNullableNonWrapperCacheInterfaceNullableSequence();
261
262 // Non-castable interface types
263 IndirectlyImplementedInterface receiveOther();
264 IndirectlyImplementedInterface? receiveNullableOther();
265 IndirectlyImplementedInterface receiveWeakOther();
266 IndirectlyImplementedInterface? receiveWeakNullableOther();
267 void passOther(IndirectlyImplementedInterface arg);
268 void passNullableOther(IndirectlyImplementedInterface? arg);
269 attribute IndirectlyImplementedInterface nonNullOther;
270 attribute IndirectlyImplementedInterface? nullableOther;
271 // Optional arguments
272 void passOptionalOther(optional IndirectlyImplementedInterface? arg);
273 void passOptionalNonNullOther(optional IndirectlyImplementedInterface arg);
274 void passOptionalOtherWithDefault(optional IndirectlyImplementedInterface? arg = null);
275
276 // External interface types
277 TestExternalInterface receiveExternal();
278 TestExternalInterface? receiveNullableExternal();
279 TestExternalInterface receiveWeakExternal();
280 TestExternalInterface? receiveWeakNullableExternal();
281 void passExternal(TestExternalInterface arg);
282 void passNullableExternal(TestExternalInterface? arg);
283 attribute TestExternalInterface nonNullExternal;
284 attribute TestExternalInterface? nullableExternal;
285 // Optional arguments
286 void passOptionalExternal(optional TestExternalInterface? arg);
287 void passOptionalNonNullExternal(optional TestExternalInterface arg);
288 void passOptionalExternalWithDefault(optional TestExternalInterface? arg = null);
289
290 // Callback interface types
291 TestCallbackInterface receiveCallbackInterface();
292 TestCallbackInterface? receiveNullableCallbackInterface();
293 TestCallbackInterface receiveWeakCallbackInterface();
294 TestCallbackInterface? receiveWeakNullableCallbackInterface();
295 void passCallbackInterface(TestCallbackInterface arg);
296 void passNullableCallbackInterface(TestCallbackInterface? arg);
297 attribute TestCallbackInterface nonNullCallbackInterface;
298 attribute TestCallbackInterface? nullableCallbackInterface;
299 // Optional arguments
300 void passOptionalCallbackInterface(optional TestCallbackInterface? arg);
301 void passOptionalNonNullCallbackInterface(optional TestCallbackInterface arg);
302 void passOptionalCallbackInterfaceWithDefault(optional TestCallbackInterface? arg = null);
303
304 // Miscellaneous interface tests
305 IndirectlyImplementedInterface receiveConsequentialInterface();
306 void passConsequentialInterface(IndirectlyImplementedInterface arg);
307
308 // Sequence types
309 [Cached, Pure]
310 readonly attribute sequence<long> readonlySequence;
311 [Cached, Pure]
312 readonly attribute sequence<Dict> readonlySequenceOfDictionaries;
313 [Cached, Pure]
314 readonly attribute sequence<Dict>? readonlyNullableSequenceOfDictionaries;
315 [Cached, Pure, Frozen]
316 readonly attribute sequence<Dict> readonlyFrozenSequence;
317 [Cached, Pure, Frozen]
318 readonly attribute sequence<Dict>? readonlyFrozenNullableSequence;
319 sequence<long> receiveSequence();
320 sequence<long>? receiveNullableSequence();
321 sequence<long?> receiveSequenceOfNullableInts();
322 sequence<long?>? receiveNullableSequenceOfNullableInts();
323 void passSequence(sequence<long> arg);
324 void passNullableSequence(sequence<long>? arg);
325 void passSequenceOfNullableInts(sequence<long?> arg);
326 void passOptionalSequenceOfNullableInts(optional sequence<long?> arg);
327 void passOptionalNullableSequenceOfNullableInts(optional sequence<long?>? arg);
328 sequence<TestInterface> receiveCastableObjectSequence();
329 sequence<TestCallbackInterface> receiveCallbackObjectSequence();
330 sequence<TestInterface?> receiveNullableCastableObjectSequence();
331 sequence<TestCallbackInterface?> receiveNullableCallbackObjectSequence();
332 sequence<TestInterface>? receiveCastableObjectNullableSequence();
333 sequence<TestInterface?>? receiveNullableCastableObjectNullableSequence();
334 sequence<TestInterface> receiveWeakCastableObjectSequence();
335 sequence<TestInterface?> receiveWeakNullableCastableObjectSequence();
336 sequence<TestInterface>? receiveWeakCastableObjectNullableSequence();
337 sequence<TestInterface?>? receiveWeakNullableCastableObjectNullableSequence();
338 void passCastableObjectSequence(sequence<TestInterface> arg);
339 void passNullableCastableObjectSequence(sequence<TestInterface?> arg);
340 void passCastableObjectNullableSequence(sequence<TestInterface>? arg);
341 void passNullableCastableObjectNullableSequence(sequence<TestInterface?>? arg);
342 void passOptionalSequence(optional sequence<long> arg);
343 void passOptionalNullableSequence(optional sequence<long>? arg);
344 void passOptionalNullableSequenceWithDefaultValue(optional sequence<long>? arg = null);
345 void passOptionalObjectSequence(optional sequence<TestInterface> arg);
346 void passExternalInterfaceSequence(sequence<TestExternalInterface> arg);
347 void passNullableExternalInterfaceSequence(sequence<TestExternalInterface?> arg);
348
349 sequence<DOMString> receiveStringSequence();
350 void passStringSequence(sequence<DOMString> arg);
351
352 sequence<ByteString> receiveByteStringSequence();
353 void passByteStringSequence(sequence<ByteString> arg);
354
355 sequence<any> receiveAnySequence();
356 sequence<any>? receiveNullableAnySequence();
357 sequence<sequence<any>> receiveAnySequenceSequence();
358
359 sequence<object> receiveObjectSequence();
360 sequence<object?> receiveNullableObjectSequence();
361
362 void passSequenceOfSequences(sequence<sequence<long>> arg);
363 sequence<sequence<long>> receiveSequenceOfSequences();
364
365 // MozMap types
366 void passMozMap(MozMap<long> arg);
367 void passNullableMozMap(MozMap<long>? arg);
368 void passMozMapOfNullableInts(MozMap<long?> arg);
369 void passOptionalMozMapOfNullableInts(optional MozMap<long?> arg);
370 void passOptionalNullableMozMapOfNullableInts(optional MozMap<long?>? arg);
371 void passCastableObjectMozMap(MozMap<TestInterface> arg);
372 void passNullableCastableObjectMozMap(MozMap<TestInterface?> arg);
373 void passCastableObjectNullableMozMap(MozMap<TestInterface>? arg);
374 void passNullableCastableObjectNullableMozMap(MozMap<TestInterface?>? arg);
375 void passOptionalMozMap(optional MozMap<long> arg);
376 void passOptionalNullableMozMap(optional MozMap<long>? arg);
377 void passOptionalNullableMozMapWithDefaultValue(optional MozMap<long>? arg = null);
378 void passOptionalObjectMozMap(optional MozMap<TestInterface> arg);
379 void passExternalInterfaceMozMap(MozMap<TestExternalInterface> arg);
380 void passNullableExternalInterfaceMozMap(MozMap<TestExternalInterface?> arg);
381 void passStringMozMap(MozMap<DOMString> arg);
382 void passByteStringMozMap(MozMap<ByteString> arg);
383 void passMozMapOfMozMaps(MozMap<MozMap<long>> arg);
384 MozMap<long> receiveMozMap();
385 MozMap<long>? receiveNullableMozMap();
386 MozMap<long?> receiveMozMapOfNullableInts();
387 MozMap<long?>? receiveNullableMozMapOfNullableInts();
388 MozMap<MozMap<long>> receiveMozMapOfMozMaps();
389 MozMap<any> receiveAnyMozMap();
390
391 // Typed array types
392 void passArrayBuffer(ArrayBuffer arg);
393 void passNullableArrayBuffer(ArrayBuffer? arg);
394 void passOptionalArrayBuffer(optional ArrayBuffer arg);
395 void passOptionalNullableArrayBuffer(optional ArrayBuffer? arg);
396 void passOptionalNullableArrayBufferWithDefaultValue(optional ArrayBuffer? arg= null);
397 void passArrayBufferView(ArrayBufferView arg);
398 void passInt8Array(Int8Array arg);
399 void passInt16Array(Int16Array arg);
400 void passInt32Array(Int32Array arg);
401 void passUint8Array(Uint8Array arg);
402 void passUint16Array(Uint16Array arg);
403 void passUint32Array(Uint32Array arg);
404 void passUint8ClampedArray(Uint8ClampedArray arg);
405 void passFloat32Array(Float32Array arg);
406 void passFloat64Array(Float64Array arg);
407 void passSequenceOfArrayBuffers(sequence<ArrayBuffer> arg);
408 void passSequenceOfNullableArrayBuffers(sequence<ArrayBuffer?> arg);
409 void passMozMapOfArrayBuffers(MozMap<ArrayBuffer> arg);
410 void passMozMapOfNullableArrayBuffers(MozMap<ArrayBuffer?> arg);
411 void passVariadicTypedArray(Float32Array... arg);
412 void passVariadicNullableTypedArray(Float32Array?... arg);
413 Uint8Array receiveUint8Array();
414
415 // DOMString types
416 void passString(DOMString arg);
417 void passNullableString(DOMString? arg);
418 void passOptionalString(optional DOMString arg);
419 void passOptionalStringWithDefaultValue(optional DOMString arg = "abc");
420 void passOptionalNullableString(optional DOMString? arg);
421 void passOptionalNullableStringWithDefaultValue(optional DOMString? arg = null);
422 void passVariadicString(DOMString... arg);
423
424 // ByteString types
425 void passByteString(ByteString arg);
426 void passNullableByteString(ByteString? arg);
427 void passOptionalByteString(optional ByteString arg);
428 void passOptionalNullableByteString(optional ByteString? arg);
429 void passVariadicByteString(ByteString... arg);
430
431 // Enumerated types
432 void passEnum(TestEnum arg);
433 void passNullableEnum(TestEnum? arg);
434 void passOptionalEnum(optional TestEnum arg);
435 void passEnumWithDefault(optional TestEnum arg = "a");
436 void passOptionalNullableEnum(optional TestEnum? arg);
437 void passOptionalNullableEnumWithDefaultValue(optional TestEnum? arg = null);
438 void passOptionalNullableEnumWithDefaultValue2(optional TestEnum? arg = "a");
439 TestEnum receiveEnum();
440 TestEnum? receiveNullableEnum();
441 attribute TestEnum enumAttribute;
442 readonly attribute TestEnum readonlyEnumAttribute;
443
444 // Callback types
445 void passCallback(TestCallback arg);
446 void passNullableCallback(TestCallback? arg);
447 void passOptionalCallback(optional TestCallback arg);
448 void passOptionalNullableCallback(optional TestCallback? arg);
449 void passOptionalNullableCallbackWithDefaultValue(optional TestCallback? arg = null);
450 TestCallback receiveCallback();
451 TestCallback? receiveNullableCallback();
452 void passNullableTreatAsNullCallback(TestTreatAsNullCallback? arg);
453 void passOptionalNullableTreatAsNullCallback(optional TestTreatAsNullCallback? arg);
454 void passOptionalNullableTreatAsNullCallbackWithDefaultValue(optional TestTreatAsNullCallback? arg = null);
455 attribute TestTreatAsNullCallback treatAsNullCallback;
456 attribute TestTreatAsNullCallback? nullableTreatAsNullCallback;
457
458 // Any types
459 void passAny(any arg);
460 void passVariadicAny(any... arg);
461 void passOptionalAny(optional any arg);
462 void passAnyDefaultNull(optional any arg = null);
463 void passSequenceOfAny(sequence<any> arg);
464 void passNullableSequenceOfAny(sequence<any>? arg);
465 void passOptionalSequenceOfAny(optional sequence<any> arg);
466 void passOptionalNullableSequenceOfAny(optional sequence<any>? arg);
467 void passOptionalSequenceOfAnyWithDefaultValue(optional sequence<any>? arg = null);
468 void passSequenceOfSequenceOfAny(sequence<sequence<any>> arg);
469 void passSequenceOfNullableSequenceOfAny(sequence<sequence<any>?> arg);
470 void passNullableSequenceOfNullableSequenceOfAny(sequence<sequence<any>?>? arg);
471 void passOptionalNullableSequenceOfNullableSequenceOfAny(optional sequence<sequence<any>?>? arg);
472 void passMozMapOfAny(MozMap<any> arg);
473 void passNullableMozMapOfAny(MozMap<any>? arg);
474 void passOptionalMozMapOfAny(optional MozMap<any> arg);
475 void passOptionalNullableMozMapOfAny(optional MozMap<any>? arg);
476 void passOptionalMozMapOfAnyWithDefaultValue(optional MozMap<any>? arg = null);
477 void passMozMapOfMozMapOfAny(MozMap<MozMap<any>> arg);
478 void passMozMapOfNullableMozMapOfAny(MozMap<MozMap<any>?> arg);
479 void passNullableMozMapOfNullableMozMapOfAny(MozMap<MozMap<any>?>? arg);
480 void passOptionalNullableMozMapOfNullableMozMapOfAny(optional MozMap<MozMap<any>?>? arg);
481 void passOptionalNullableMozMapOfNullableSequenceOfAny(optional MozMap<sequence<any>?>? arg);
482 void passOptionalNullableSequenceOfNullableMozMapOfAny(optional sequence<MozMap<any>?>? arg);
483 any receiveAny();
484
485 // object types
486 void passObject(object arg);
487 void passVariadicObject(object... arg);
488 void passNullableObject(object? arg);
489 void passVariadicNullableObject(object... arg);
490 void passOptionalObject(optional object arg);
491 void passOptionalNullableObject(optional object? arg);
492 void passOptionalNullableObjectWithDefaultValue(optional object? arg = null);
493 void passSequenceOfObject(sequence<object> arg);
494 void passSequenceOfNullableObject(sequence<object?> arg);
495 void passNullableSequenceOfObject(sequence<object>? arg);
496 void passOptionalNullableSequenceOfNullableSequenceOfObject(optional sequence<sequence<object>?>? arg);
497 void passOptionalNullableSequenceOfNullableSequenceOfNullableObject(optional sequence<sequence<object?>?>? arg);
498 void passMozMapOfObject(MozMap<object> arg);
499 object receiveObject();
500 object? receiveNullableObject();
501
502 // Union types
503 void passUnion((object or long) arg);
504 // Some union tests are debug-only to avoid creating all those
505 // unused union types in opt builds.
506 #ifdef DEBUG
507 void passUnion2((long or boolean) arg);
508 void passUnion3((object or long or boolean) arg);
509 void passUnion4((Node or long or boolean) arg);
510 void passUnion5((object or boolean) arg);
511 void passUnion6((object or DOMString) arg);
512 void passUnion7((object or DOMString or long) arg);
513 void passUnion8((object or DOMString or boolean) arg);
514 void passUnion9((object or DOMString or long or boolean) arg);
515 void passUnion10(optional (EventInit or long) arg);
516 void passUnion11(optional (CustomEventInit or long) arg);
517 void passUnion12(optional (EventInit or long) arg = 5);
518 void passUnion13(optional (object or long?) arg = null);
519 void passUnion14(optional (object or long?) arg = 5);
520 void passUnionWithCallback((EventHandler or long) arg);
521 #endif
522 void passUnionWithNullable((object? or long) arg);
523 void passNullableUnion((object or long)? arg);
524 void passOptionalUnion(optional (object or long) arg);
525 void passOptionalNullableUnion(optional (object or long)? arg);
526 void passOptionalNullableUnionWithDefaultValue(optional (object or long)? arg = null);
527 //void passUnionWithInterfaces((TestInterface or TestExternalInterface) arg);
528 //void passUnionWithInterfacesAndNullable((TestInterface? or TestExternalInterface) arg);
529 //void passUnionWithSequence((sequence<object> or long) arg);
530 void passUnionWithArrayBuffer((ArrayBuffer or long) arg);
531 void passUnionWithString((DOMString or object) arg);
532 //void passUnionWithEnum((TestEnum or object) arg);
533 // Trying to use a callback in a union won't include the test
534 // headers, unfortunately, so won't compile.
535 //void passUnionWithCallback((TestCallback or long) arg);
536 void passUnionWithObject((object or long) arg);
537 //void passUnionWithDict((Dict or long) arg);
538
539 void passUnionWithDefaultValue1(optional (double or DOMString) arg = "");
540 void passUnionWithDefaultValue2(optional (double or DOMString) arg = 1);
541 void passUnionWithDefaultValue3(optional (double or DOMString) arg = 1.5);
542 void passUnionWithDefaultValue4(optional (float or DOMString) arg = "");
543 void passUnionWithDefaultValue5(optional (float or DOMString) arg = 1);
544 void passUnionWithDefaultValue6(optional (float or DOMString) arg = 1.5);
545 void passUnionWithDefaultValue7(optional (unrestricted double or DOMString) arg = "");
546 void passUnionWithDefaultValue8(optional (unrestricted double or DOMString) arg = 1);
547 void passUnionWithDefaultValue9(optional (unrestricted double or DOMString) arg = 1.5);
548 void passUnionWithDefaultValue10(optional (unrestricted double or DOMString) arg = Infinity);
549 void passUnionWithDefaultValue11(optional (unrestricted float or DOMString) arg = "");
550 void passUnionWithDefaultValue12(optional (unrestricted float or DOMString) arg = 1);
551 void passUnionWithDefaultValue13(optional (unrestricted float or DOMString) arg = Infinity);
552
553 void passNullableUnionWithDefaultValue1(optional (double or DOMString)? arg = "");
554 void passNullableUnionWithDefaultValue2(optional (double or DOMString)? arg = 1);
555 void passNullableUnionWithDefaultValue3(optional (double or DOMString)? arg = null);
556 void passNullableUnionWithDefaultValue4(optional (float or DOMString)? arg = "");
557 void passNullableUnionWithDefaultValue5(optional (float or DOMString)? arg = 1);
558 void passNullableUnionWithDefaultValue6(optional (float or DOMString)? arg = null);
559 void passNullableUnionWithDefaultValue7(optional (unrestricted double or DOMString)? arg = "");
560 void passNullableUnionWithDefaultValue8(optional (unrestricted double or DOMString)? arg = 1);
561 void passNullableUnionWithDefaultValue9(optional (unrestricted double or DOMString)? arg = null);
562 void passNullableUnionWithDefaultValue10(optional (unrestricted float or DOMString)? arg = "");
563 void passNullableUnionWithDefaultValue11(optional (unrestricted float or DOMString)? arg = 1);
564 void passNullableUnionWithDefaultValue12(optional (unrestricted float or DOMString)? arg = null);
565
566 void passSequenceOfUnions(sequence<(CanvasPattern or CanvasGradient)> arg);
567 void passSequenceOfUnions2(sequence<(object or long)> arg);
568 void passVariadicUnion((CanvasPattern or CanvasGradient)... arg);
569
570 void passSequenceOfNullableUnions(sequence<(CanvasPattern or CanvasGradient)?> arg);
571 void passVariadicNullableUnion((CanvasPattern or CanvasGradient)?... arg);
572 void passMozMapOfUnions(MozMap<(CanvasPattern or CanvasGradient)> arg);
573 // XXXbz no move constructor on some unions
574 // void passMozMapOfUnions2(MozMap<(object or long)> arg);
575
576 (CanvasPattern or CanvasGradient) receiveUnion();
577 (object or long) receiveUnion2();
578 (CanvasPattern? or CanvasGradient) receiveUnionContainingNull();
579 (CanvasPattern or CanvasGradient)? receiveNullableUnion();
580 (object or long)? receiveNullableUnion2();
581
582 attribute (CanvasPattern or CanvasGradient) writableUnion;
583 attribute (CanvasPattern? or CanvasGradient) writableUnionContainingNull;
584 attribute (CanvasPattern or CanvasGradient)? writableNullableUnion;
585
586 // Date types
587 void passDate(Date arg);
588 void passNullableDate(Date? arg);
589 void passOptionalDate(optional Date arg);
590 void passOptionalNullableDate(optional Date? arg);
591 void passOptionalNullableDateWithDefaultValue(optional Date? arg = null);
592 void passDateSequence(sequence<Date> arg);
593 void passNullableDateSequence(sequence<Date?> arg);
594 void passDateMozMap(MozMap<Date> arg);
595 Date receiveDate();
596 Date? receiveNullableDate();
597
598 // binaryNames tests
599 void methodRenamedFrom();
600 void methodRenamedFrom(byte argument);
601 readonly attribute byte attributeGetterRenamedFrom;
602 attribute byte attributeRenamedFrom;
603
604 void passDictionary(optional Dict x);
605 [Cached, Pure]
606 readonly attribute Dict readonlyDictionary;
607 [Cached, Pure]
608 readonly attribute Dict? readonlyNullableDictionary;
609 [Cached, Pure]
610 attribute Dict writableDictionary;
611 [Cached, Pure, Frozen]
612 readonly attribute Dict readonlyFrozenDictionary;
613 [Cached, Pure, Frozen]
614 readonly attribute Dict? readonlyFrozenNullableDictionary;
615 [Cached, Pure, Frozen]
616 attribute Dict writableFrozenDictionary;
617 Dict receiveDictionary();
618 Dict? receiveNullableDictionary();
619 void passOtherDictionary(optional GrandparentDict x);
620 void passSequenceOfDictionaries(sequence<Dict> x);
621 void passMozMapOfDictionaries(MozMap<GrandparentDict> x);
622 // No support for nullable dictionaries inside a sequence (nor should there be)
623 // void passSequenceOfNullableDictionaries(sequence<Dict?> x);
624 void passDictionaryOrLong(optional Dict x);
625 void passDictionaryOrLong(long x);
626
627 void passDictContainingDict(optional DictContainingDict arg);
628 void passDictContainingSequence(optional DictContainingSequence arg);
629 DictContainingSequence receiveDictContainingSequence();
630
631 // EnforceRange/Clamp tests
632 void dontEnforceRangeOrClamp(byte arg);
633 void doEnforceRange([EnforceRange] byte arg);
634 void doClamp([Clamp] byte arg);
635 [EnforceRange] attribute byte enforcedByte;
636 [Clamp] attribute byte clampedByte;
637
638 // Typedefs
639 const myLong myLongConstant = 5;
640 void exerciseTypedefInterfaces1(AnotherNameForTestInterface arg);
641 AnotherNameForTestInterface exerciseTypedefInterfaces2(NullableTestInterface arg);
642 void exerciseTypedefInterfaces3(YetAnotherNameForTestInterface arg);
643
644 // Static methods and attributes
645 static attribute boolean staticAttribute;
646 static void staticMethod(boolean arg);
647 static void staticMethodWithContext(any arg);
648
649 // Overload resolution tests
650 //void overload1(DOMString... strs);
651 boolean overload1(TestInterface arg);
652 TestInterface overload1(DOMString strs, TestInterface arg);
653 void overload2(TestInterface arg);
654 void overload2(optional Dict arg);
655 void overload2(boolean arg);
656 void overload2(DOMString arg);
657 void overload2(Date arg);
658 void overload3(TestInterface arg);
659 void overload3(TestCallback arg);
660 void overload3(boolean arg);
661 void overload4(TestInterface arg);
662 void overload4(TestCallbackInterface arg);
663 void overload4(DOMString arg);
664 void overload5(long arg);
665 void overload5(TestEnum arg);
666 void overload6(long arg);
667 void overload6(boolean arg);
668 void overload7(long arg);
669 void overload7(boolean arg);
670 void overload7(ByteString arg);
671 void overload8(long arg);
672 void overload8(TestInterface arg);
673 void overload9(long? arg);
674 void overload9(DOMString arg);
675 void overload10(long? arg);
676 void overload10(object arg);
677 void overload11(long arg);
678 void overload11(DOMString? arg);
679 void overload12(long arg);
680 void overload12(boolean? arg);
681 void overload13(long? arg);
682 void overload13(boolean arg);
683 void overload14(optional long arg);
684 void overload14(TestInterface arg);
685 void overload15(long arg);
686 void overload15(optional TestInterface arg);
687 void overload16(long arg);
688 void overload16(optional TestInterface? arg);
689
690 // Variadic handling
691 void passVariadicThirdArg(DOMString arg1, long arg2, TestInterface... arg3);
692
693 // Conditionally exposed methods/attributes
694 [Pref="abc.def"]
695 readonly attribute boolean prefable1;
696 [Pref="abc.def"]
697 readonly attribute boolean prefable2;
698 [Pref="ghi.jkl"]
699 readonly attribute boolean prefable3;
700 [Pref="ghi.jkl"]
701 readonly attribute boolean prefable4;
702 [Pref="abc.def"]
703 readonly attribute boolean prefable5;
704 [Pref="abc.def", Func="nsGenericHTMLElement::TouchEventsEnabled"]
705 readonly attribute boolean prefable6;
706 [Pref="abc.def", Func="nsGenericHTMLElement::TouchEventsEnabled"]
707 readonly attribute boolean prefable7;
708 [Pref="ghi.jkl", Func="nsGenericHTMLElement::TouchEventsEnabled"]
709 readonly attribute boolean prefable8;
710 [Pref="abc.def", Func="nsGenericHTMLElement::TouchEventsEnabled"]
711 readonly attribute boolean prefable9;
712 [Pref="abc.def"]
713 void prefable10();
714 [Pref="abc.def", Func="nsGenericHTMLElement::TouchEventsEnabled"]
715 void prefable11();
716 [Pref="abc.def", Func="TestFuncControlledMember"]
717 readonly attribute boolean prefable12;
718 [Pref="abc.def", Func="nsGenericHTMLElement::TouchEventsEnabled"]
719 void prefable13();
720 [Pref="abc.def", Func="TestFuncControlledMember"]
721 readonly attribute boolean prefable14;
722 [Func="TestFuncControlledMember"]
723 readonly attribute boolean prefable15;
724 [Func="TestFuncControlledMember"]
725 readonly attribute boolean prefable16;
726 [Pref="abc.def", Func="TestFuncControlledMember"]
727 void prefable17();
728 [Func="TestFuncControlledMember"]
729 void prefable18();
730 [Func="TestFuncControlledMember"]
731 void prefable19();
732 [Pref="abc.def", Func="TestFuncControlledMember", ChromeOnly]
733 void prefable20();
734 [Func="TestFuncControlledMember", AvailableIn=CertifiedApps]
735 void prefable21();
736 [Func="TestFuncControlledMember", AvailableIn=CertifiedApps]
737 void prefable22();
738 [Pref="abc.def", Func="TestFuncControlledMember", AvailableIn=CertifiedApps]
739 void prefable23();
740 [Pref="abc.def", Func="TestFuncControlledMember", AvailableIn=PrivilegedApps]
741 void prefable24();
742
743 // Miscellania
744 [LenientThis] attribute long attrWithLenientThis;
745 [Unforgeable] readonly attribute long unforgeableAttr;
746 [Unforgeable, ChromeOnly] readonly attribute long unforgeableAttr2;
747 stringifier;
748 void passRenamedInterface(TestRenamedInterface arg);
749 [PutForwards=writableByte] readonly attribute TestInterface putForwardsAttr;
750 [PutForwards=writableByte, LenientThis] readonly attribute TestInterface putForwardsAttr2;
751 [PutForwards=writableByte, ChromeOnly] readonly attribute TestInterface putForwardsAttr3;
752 [Throws] void throwingMethod();
753 [Throws] attribute boolean throwingAttr;
754 [GetterThrows] attribute boolean throwingGetterAttr;
755 [SetterThrows] attribute boolean throwingSetterAttr;
756 legacycaller short(unsigned long arg1, TestInterface arg2);
757 void passArgsWithDefaults(optional long arg1,
758 optional TestInterface? arg2 = null,
759 optional Dict arg3, optional double arg4 = 5.0,
760 optional float arg5);
761
762 attribute any jsonifierShouldSkipThis;
763 attribute TestParentInterface jsonifierShouldSkipThis2;
764 attribute TestCallbackInterface jsonifierShouldSkipThis3;
765 jsonifier;
766
767 // If you add things here, add them to TestExampleGen and TestJSImplGen as well
768 };
769
770 interface TestParentInterface {
771 };
772
773 interface TestChildInterface : TestParentInterface {
774 };
775
776 interface TestNonWrapperCacheInterface {
777 };
778
779 [NoInterfaceObject]
780 interface ImplementedInterfaceParent {
781 void implementedParentMethod();
782 attribute boolean implementedParentProperty;
783
784 const long implementedParentConstant = 8;
785 };
786
787 ImplementedInterfaceParent implements IndirectlyImplementedInterface;
788
789 [NoInterfaceObject]
790 interface IndirectlyImplementedInterface {
791 void indirectlyImplementedMethod();
792 attribute boolean indirectlyImplementedProperty;
793
794 const long indirectlyImplementedConstant = 9;
795 };
796
797 [NoInterfaceObject]
798 interface ImplementedInterface : ImplementedInterfaceParent {
799 void implementedMethod();
800 attribute boolean implementedProperty;
801
802 const long implementedConstant = 5;
803 };
804
805 [NoInterfaceObject]
806 interface DiamondImplements {
807 readonly attribute long diamondImplementedProperty;
808 };
809 [NoInterfaceObject]
810 interface DiamondBranch1A {
811 };
812 [NoInterfaceObject]
813 interface DiamondBranch1B {
814 };
815 [NoInterfaceObject]
816 interface DiamondBranch2A : DiamondImplements {
817 };
818 [NoInterfaceObject]
819 interface DiamondBranch2B : DiamondImplements {
820 };
821 TestInterface implements DiamondBranch1A;
822 TestInterface implements DiamondBranch1B;
823 TestInterface implements DiamondBranch2A;
824 TestInterface implements DiamondBranch2B;
825 DiamondBranch1A implements DiamondImplements;
826 DiamondBranch1B implements DiamondImplements;
827
828 dictionary Dict : ParentDict {
829 TestEnum someEnum;
830 long x;
831 long a;
832 long b = 8;
833 long z = 9;
834 [EnforceRange] unsigned long enforcedUnsignedLong;
835 [Clamp] unsigned long clampedUnsignedLong;
836 DOMString str;
837 DOMString empty = "";
838 TestEnum otherEnum = "b";
839 DOMString otherStr = "def";
840 DOMString? yetAnotherStr = null;
841 DOMString template;
842 object someObj;
843 boolean prototype;
844 object? anotherObj = null;
845 TestCallback? someCallback = null;
846 any someAny;
847 any anotherAny = null;
848
849 unrestricted float urFloat = 0;
850 unrestricted float urFloat2 = 1.1;
851 unrestricted float urFloat3 = -1.1;
852 unrestricted float? urFloat4 = null;
853 unrestricted float infUrFloat = Infinity;
854 unrestricted float negativeInfUrFloat = -Infinity;
855 unrestricted float nanUrFloat = NaN;
856
857 unrestricted double urDouble = 0;
858 unrestricted double urDouble2 = 1.1;
859 unrestricted double urDouble3 = -1.1;
860 unrestricted double? urDouble4 = null;
861 unrestricted double infUrDouble = Infinity;
862 unrestricted double negativeInfUrDouble = -Infinity;
863 unrestricted double nanUrDouble = NaN;
864
865 (float or DOMString) floatOrString = "str";
866 (object or long) objectOrLong;
867 #ifdef DEBUG
868 (EventInit or long) eventInitOrLong;
869 (EventInit or long)? nullableEventInitOrLong;
870 (Node or long)? nullableNodeOrLong;
871 // CustomEventInit is useful to test because it needs rooting.
872 (CustomEventInit or long) eventInitOrLong2;
873 (CustomEventInit or long)? nullableEventInitOrLong2;
874 (EventInit or long) eventInitOrLongWithDefaultValue = null;
875 (CustomEventInit or long) eventInitOrLongWithDefaultValue2 = null;
876 (EventInit or long) eventInitOrLongWithDefaultValue3 = 5;
877 (CustomEventInit or long) eventInitOrLongWithDefaultValue4 = 5;
878 #endif
879
880 ArrayBuffer arrayBuffer;
881 ArrayBuffer? nullableArrayBuffer;
882 Uint8Array uint8Array;
883 Float64Array? float64Array = null;
884 };
885
886 dictionary ParentDict : GrandparentDict {
887 long c = 5;
888 TestInterface someInterface;
889 TestInterface? someNullableInterface = null;
890 TestExternalInterface someExternalInterface;
891 any parentAny;
892 };
893
894 dictionary DictContainingDict {
895 Dict memberDict;
896 };
897
898 dictionary DictContainingSequence {
899 sequence<long> ourSequence;
900 sequence<TestInterface> ourSequence2;
901 sequence<any> ourSequence3;
902 sequence<object> ourSequence4;
903 sequence<object?> ourSequence5;
904 sequence<object>? ourSequence6;
905 sequence<object?>? ourSequence7;
906 sequence<object>? ourSequence8 = null;
907 sequence<object?>? ourSequence9 = null;
908 sequence<(float or DOMString)> ourSequence10;
909 };
910
911 dictionary DictForConstructor {
912 Dict dict;
913 DictContainingDict dict2;
914 sequence<Dict> seq1;
915 sequence<sequence<Dict>>? seq2;
916 sequence<sequence<Dict>?> seq3;
917 sequence<any> seq4;
918 sequence<any> seq5;
919 sequence<DictContainingSequence> seq6;
920 object obj1;
921 object? obj2;
922 any any1 = null;
923 };
924
925 interface TestIndexedGetterInterface {
926 getter long item(unsigned long idx);
927 readonly attribute unsigned long length;
928 legacycaller void();
929 };
930
931 interface TestNamedGetterInterface {
932 getter DOMString (DOMString name);
933 };
934
935 interface TestIndexedGetterAndSetterAndNamedGetterInterface {
936 getter DOMString (DOMString myName);
937 getter long (unsigned long index);
938 setter creator void (unsigned long index, long arg);
939 };
940
941 interface TestIndexedAndNamedGetterInterface {
942 getter long (unsigned long index);
943 getter DOMString namedItem(DOMString name);
944 readonly attribute unsigned long length;
945 };
946
947 interface TestIndexedSetterInterface {
948 setter creator void setItem(unsigned long idx, DOMString item);
949 getter DOMString (unsigned long idx);
950 };
951
952 interface TestNamedSetterInterface {
953 setter creator void (DOMString myName, TestIndexedSetterInterface item);
954 getter TestIndexedSetterInterface (DOMString name);
955 };
956
957 interface TestIndexedAndNamedSetterInterface {
958 setter creator void (unsigned long index, TestIndexedSetterInterface item);
959 getter TestIndexedSetterInterface (unsigned long index);
960 setter creator void setNamedItem(DOMString name, TestIndexedSetterInterface item);
961 getter TestIndexedSetterInterface (DOMString name);
962 };
963
964 interface TestIndexedAndNamedGetterAndSetterInterface : TestIndexedSetterInterface {
965 getter long item(unsigned long index);
966 getter DOMString namedItem(DOMString name);
967 setter creator void (unsigned long index, long item);
968 setter creator void (DOMString name, DOMString item);
969 stringifier DOMString ();
970 readonly attribute unsigned long length;
971 };
972
973 interface TestIndexedDeleterInterface {
974 deleter void delItem(unsigned long idx);
975 getter long (unsigned long index);
976 };
977
978 interface TestIndexedDeleterWithRetvalInterface {
979 deleter boolean delItem(unsigned long index);
980 getter long (unsigned long index);
981 };
982
983 interface TestNamedDeleterInterface {
984 deleter void (DOMString name);
985 getter long (DOMString name);
986 };
987
988 interface TestNamedDeleterWithRetvalInterface {
989 deleter boolean delNamedItem(DOMString name);
990 getter long (DOMString name);
991 };
992
993 interface TestIndexedAndNamedDeleterInterface {
994 deleter void (unsigned long index);
995 getter long (unsigned long index);
996 deleter void delNamedItem(DOMString name);
997 getter long (DOMString name);
998 };
999
1000 interface TestCppKeywordNamedMethodsInterface {
1001 boolean continue();
1002 boolean delete();
1003 long volatile();
1004 };
1005

mercurial