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/.
7 typedef TestJSImplInterface AnotherNameForTestJSImplInterface;
8 typedef TestJSImplInterface YetAnotherNameForTestJSImplInterface;
9 typedef TestJSImplInterface? NullableTestJSImplInterface;
11 callback MyTestCallback = undefined();
18 [Exposed=Window, JSImplementation="@mozilla.org/test-js-impl-interface;1"]
19 interface TestJSImplInterface {
20 // We don't support multiple constructors or legacy factory functions
21 // for JS-implemented WebIDL.
23 constructor(DOMString str, unsigned long num, boolean? boolArg,
24 TestInterface? iface, long arg1,
25 DictForConstructor dict, any any1,
27 object? obj2, sequence<Dict> seq, optional any any2,
29 optional object? obj4,
31 ArrayBuffer arrayBuf);
34 // XXXbz add tests for throwing versions of all the integer stuff
35 readonly attribute byte readonlyByte;
36 attribute byte writableByte;
37 undefined passByte(byte arg);
39 undefined passOptionalByte(optional byte arg);
40 undefined passOptionalByteBeforeRequired(optional byte arg1, byte arg2);
41 undefined passOptionalByteWithDefault(optional byte arg = 0);
42 undefined passOptionalByteWithDefaultBeforeRequired(optional byte arg1 = 0, byte arg2);
43 undefined passNullableByte(byte? arg);
44 undefined passOptionalNullableByte(optional byte? arg);
45 undefined passVariadicByte(byte... arg);
46 // [Cached] is not supported in JS-implemented WebIDL.
48 //readonly attribute byte cachedByte;
50 //readonly attribute byte cachedConstantByte;
52 //attribute byte cachedWritableByte;
54 attribute byte sideEffectFreeByte;
55 [Affects=Nothing, DependsOn=DOMState]
56 attribute byte domDependentByte;
57 [Affects=Nothing, DependsOn=Nothing]
58 readonly attribute byte constantByte;
59 [DependsOn=DeviceState, Affects=Nothing]
60 readonly attribute byte deviceStateDependentByte;
62 byte returnByteSideEffectFree();
63 [Affects=Nothing, DependsOn=DOMState]
64 byte returnDOMDependentByte();
65 [Affects=Nothing, DependsOn=Nothing]
66 byte returnConstantByte();
67 [DependsOn=DeviceState, Affects=Nothing]
68 byte returnDeviceStateDependentByte();
70 readonly attribute short readonlyShort;
71 attribute short writableShort;
72 undefined passShort(short arg);
74 undefined passOptionalShort(optional short arg);
75 undefined passOptionalShortWithDefault(optional short arg = 5);
77 readonly attribute long readonlyLong;
78 attribute long writableLong;
79 undefined passLong(long arg);
81 undefined passOptionalLong(optional long arg);
82 undefined passOptionalLongWithDefault(optional long arg = 7);
84 readonly attribute long long readonlyLongLong;
85 attribute long long writableLongLong;
86 undefined passLongLong(long long arg);
87 long long receiveLongLong();
88 undefined passOptionalLongLong(optional long long arg);
89 undefined passOptionalLongLongWithDefault(optional long long arg = -12);
91 readonly attribute octet readonlyOctet;
92 attribute octet writableOctet;
93 undefined passOctet(octet arg);
95 undefined passOptionalOctet(optional octet arg);
96 undefined passOptionalOctetWithDefault(optional octet arg = 19);
98 readonly attribute unsigned short readonlyUnsignedShort;
99 attribute unsigned short writableUnsignedShort;
100 undefined passUnsignedShort(unsigned short arg);
101 unsigned short receiveUnsignedShort();
102 undefined passOptionalUnsignedShort(optional unsigned short arg);
103 undefined passOptionalUnsignedShortWithDefault(optional unsigned short arg = 2);
105 readonly attribute unsigned long readonlyUnsignedLong;
106 attribute unsigned long writableUnsignedLong;
107 undefined passUnsignedLong(unsigned long arg);
108 unsigned long receiveUnsignedLong();
109 undefined passOptionalUnsignedLong(optional unsigned long arg);
110 undefined passOptionalUnsignedLongWithDefault(optional unsigned long arg = 6);
112 readonly attribute unsigned long long readonlyUnsignedLongLong;
113 attribute unsigned long long writableUnsignedLongLong;
114 undefined passUnsignedLongLong(unsigned long long arg);
115 unsigned long long receiveUnsignedLongLong();
116 undefined passOptionalUnsignedLongLong(optional unsigned long long arg);
117 undefined passOptionalUnsignedLongLongWithDefault(optional unsigned long long arg = 17);
119 attribute float writableFloat;
120 attribute unrestricted float writableUnrestrictedFloat;
121 attribute float? writableNullableFloat;
122 attribute unrestricted float? writableNullableUnrestrictedFloat;
123 attribute double writableDouble;
124 attribute unrestricted double writableUnrestrictedDouble;
125 attribute double? writableNullableDouble;
126 attribute unrestricted double? writableNullableUnrestrictedDouble;
127 undefined passFloat(float arg1, unrestricted float arg2,
128 float? arg3, unrestricted float? arg4,
129 double arg5, unrestricted double arg6,
130 double? arg7, unrestricted double? arg8,
131 sequence<float> arg9, sequence<unrestricted float> arg10,
132 sequence<float?> arg11, sequence<unrestricted float?> arg12,
133 sequence<double> arg13, sequence<unrestricted double> arg14,
134 sequence<double?> arg15, sequence<unrestricted double?> arg16);
136 undefined passLenientFloat(float arg1, unrestricted float arg2,
137 float? arg3, unrestricted float? arg4,
138 double arg5, unrestricted double arg6,
139 double? arg7, unrestricted double? arg8,
140 sequence<float> arg9,
141 sequence<unrestricted float> arg10,
142 sequence<float?> arg11,
143 sequence<unrestricted float?> arg12,
144 sequence<double> arg13,
145 sequence<unrestricted double> arg14,
146 sequence<double?> arg15,
147 sequence<unrestricted double?> arg16);
149 attribute float lenientFloatAttr;
151 attribute double lenientDoubleAttr;
153 // Castable interface types
154 // XXXbz add tests for throwing versions of all the castable interface stuff
155 TestJSImplInterface receiveSelf();
156 TestJSImplInterface? receiveNullableSelf();
158 TestJSImplInterface receiveWeakSelf();
159 TestJSImplInterface? receiveWeakNullableSelf();
161 // A version to test for casting to TestJSImplInterface&
162 undefined passSelf(TestJSImplInterface arg);
163 undefined passNullableSelf(TestJSImplInterface? arg);
164 attribute TestJSImplInterface nonNullSelf;
165 attribute TestJSImplInterface? nullableSelf;
166 // [Cached] is not supported in JS-implemented WebIDL.
168 //readonly attribute TestJSImplInterface cachedSelf;
169 // Optional arguments
170 undefined passOptionalSelf(optional TestJSImplInterface? arg);
171 undefined passOptionalNonNullSelf(optional TestJSImplInterface arg);
172 undefined passOptionalSelfWithDefault(optional TestJSImplInterface? arg = null);
174 // Non-wrapper-cache interface types
176 TestNonWrapperCacheInterface receiveNonWrapperCacheInterface();
178 TestNonWrapperCacheInterface? receiveNullableNonWrapperCacheInterface();
181 sequence<TestNonWrapperCacheInterface> receiveNonWrapperCacheInterfaceSequence();
183 sequence<TestNonWrapperCacheInterface?> receiveNullableNonWrapperCacheInterfaceSequence();
185 sequence<TestNonWrapperCacheInterface>? receiveNonWrapperCacheInterfaceNullableSequence();
187 sequence<TestNonWrapperCacheInterface?>? receiveNullableNonWrapperCacheInterfaceNullableSequence();
189 // External interface types
190 TestExternalInterface receiveExternal();
191 TestExternalInterface? receiveNullableExternal();
192 TestExternalInterface receiveWeakExternal();
193 TestExternalInterface? receiveWeakNullableExternal();
194 undefined passExternal(TestExternalInterface arg);
195 undefined passNullableExternal(TestExternalInterface? arg);
196 attribute TestExternalInterface nonNullExternal;
197 attribute TestExternalInterface? nullableExternal;
198 // Optional arguments
199 undefined passOptionalExternal(optional TestExternalInterface? arg);
200 undefined passOptionalNonNullExternal(optional TestExternalInterface arg);
201 undefined passOptionalExternalWithDefault(optional TestExternalInterface? arg = null);
203 // Callback interface types
204 TestCallbackInterface receiveCallbackInterface();
205 TestCallbackInterface? receiveNullableCallbackInterface();
206 TestCallbackInterface receiveWeakCallbackInterface();
207 TestCallbackInterface? receiveWeakNullableCallbackInterface();
208 undefined passCallbackInterface(TestCallbackInterface arg);
209 undefined passNullableCallbackInterface(TestCallbackInterface? arg);
210 attribute TestCallbackInterface nonNullCallbackInterface;
211 attribute TestCallbackInterface? nullableCallbackInterface;
212 // Optional arguments
213 undefined passOptionalCallbackInterface(optional TestCallbackInterface? arg);
214 undefined passOptionalNonNullCallbackInterface(optional TestCallbackInterface arg);
215 undefined passOptionalCallbackInterfaceWithDefault(optional TestCallbackInterface? arg = null);
218 // [Cached] is not supported in JS-implemented WebIDL.
220 //readonly attribute sequence<long> readonlySequence;
222 //readonly attribute sequence<Dict> readonlySequenceOfDictionaries;
224 //readonly attribute sequence<Dict>? readonlyNullableSequenceOfDictionaries;
225 //[Cached, Pure, Frozen]
226 //readonly attribute sequence<long> readonlyFrozenSequence;
227 //[Cached, Pure, Frozen]
228 //readonly attribute sequence<long>? readonlyFrozenNullableSequence;
229 sequence<long> receiveSequence();
230 sequence<long>? receiveNullableSequence();
231 sequence<long?> receiveSequenceOfNullableInts();
232 sequence<long?>? receiveNullableSequenceOfNullableInts();
233 undefined passSequence(sequence<long> arg);
234 undefined passNullableSequence(sequence<long>? arg);
235 undefined passSequenceOfNullableInts(sequence<long?> arg);
236 undefined passOptionalSequenceOfNullableInts(optional sequence<long?> arg);
237 undefined passOptionalNullableSequenceOfNullableInts(optional sequence<long?>? arg);
238 sequence<TestJSImplInterface> receiveCastableObjectSequence();
239 sequence<TestCallbackInterface> receiveCallbackObjectSequence();
240 sequence<TestJSImplInterface?> receiveNullableCastableObjectSequence();
241 sequence<TestCallbackInterface?> receiveNullableCallbackObjectSequence();
242 sequence<TestJSImplInterface>? receiveCastableObjectNullableSequence();
243 sequence<TestJSImplInterface?>? receiveNullableCastableObjectNullableSequence();
244 sequence<TestJSImplInterface> receiveWeakCastableObjectSequence();
245 sequence<TestJSImplInterface?> receiveWeakNullableCastableObjectSequence();
246 sequence<TestJSImplInterface>? receiveWeakCastableObjectNullableSequence();
247 sequence<TestJSImplInterface?>? receiveWeakNullableCastableObjectNullableSequence();
248 undefined passCastableObjectSequence(sequence<TestJSImplInterface> arg);
249 undefined passNullableCastableObjectSequence(sequence<TestJSImplInterface?> arg);
250 undefined passCastableObjectNullableSequence(sequence<TestJSImplInterface>? arg);
251 undefined passNullableCastableObjectNullableSequence(sequence<TestJSImplInterface?>? arg);
252 undefined passOptionalSequence(optional sequence<long> arg);
253 undefined passOptionalSequenceWithDefaultValue(optional sequence<long> arg = []);
254 undefined passOptionalNullableSequence(optional sequence<long>? arg);
255 undefined passOptionalNullableSequenceWithDefaultValue(optional sequence<long>? arg = null);
256 undefined passOptionalNullableSequenceWithDefaultValue2(optional sequence<long>? arg = []);
257 undefined passOptionalObjectSequence(optional sequence<TestJSImplInterface> arg);
258 undefined passExternalInterfaceSequence(sequence<TestExternalInterface> arg);
259 undefined passNullableExternalInterfaceSequence(sequence<TestExternalInterface?> arg);
261 sequence<DOMString> receiveStringSequence();
262 sequence<ByteString> receiveByteStringSequence();
263 sequence<UTF8String> receiveUTF8StringSequence();
264 // Callback interface problem. See bug 843261.
265 //undefined passStringSequence(sequence<DOMString> arg);
266 sequence<any> receiveAnySequence();
267 sequence<any>? receiveNullableAnySequence();
268 //XXXbz No support for sequence of sequence return values yet.
269 //sequence<sequence<any>> receiveAnySequenceSequence();
271 sequence<object> receiveObjectSequence();
272 sequence<object?> receiveNullableObjectSequence();
274 undefined passSequenceOfSequences(sequence<sequence<long>> arg);
275 undefined passSequenceOfSequencesOfSequences(sequence<sequence<sequence<long>>> arg);
276 //XXXbz No support for sequence of sequence return values yet.
277 //sequence<sequence<long>> receiveSequenceOfSequences();
280 undefined passRecord(record<DOMString, long> arg);
281 undefined passNullableRecord(record<DOMString, long>? arg);
282 undefined passRecordOfNullableInts(record<DOMString, long?> arg);
283 undefined passOptionalRecordOfNullableInts(optional record<DOMString, long?> arg);
284 undefined passOptionalNullableRecordOfNullableInts(optional record<DOMString, long?>? arg);
285 undefined passCastableObjectRecord(record<DOMString, TestInterface> arg);
286 undefined passNullableCastableObjectRecord(record<DOMString, TestInterface?> arg);
287 undefined passCastableObjectNullableRecord(record<DOMString, TestInterface>? arg);
288 undefined passNullableCastableObjectNullableRecord(record<DOMString, TestInterface?>? arg);
289 undefined passOptionalRecord(optional record<DOMString, long> arg);
290 undefined passOptionalNullableRecord(optional record<DOMString, long>? arg);
291 undefined passOptionalNullableRecordWithDefaultValue(optional record<DOMString, long>? arg = null);
292 undefined passOptionalObjectRecord(optional record<DOMString, TestInterface> arg);
293 undefined passExternalInterfaceRecord(record<DOMString, TestExternalInterface> arg);
294 undefined passNullableExternalInterfaceRecord(record<DOMString, TestExternalInterface?> arg);
295 undefined passStringRecord(record<DOMString, DOMString> arg);
296 undefined passByteStringRecord(record<DOMString, ByteString> arg);
297 undefined passUTF8StringRecord(record<DOMString, UTF8String> arg);
298 undefined passRecordOfRecords(record<DOMString, record<DOMString, long>> arg);
299 record<DOMString, long> receiveRecord();
300 record<DOMString, long>? receiveNullableRecord();
301 record<DOMString, long?> receiveRecordOfNullableInts();
302 record<DOMString, long?>? receiveNullableRecordOfNullableInts();
303 //XXXbz No support for record of records return values yet.
304 //record<DOMString, record<DOMString, long>> receiveRecordOfRecords();
305 record<DOMString, any> receiveAnyRecord();
308 undefined passArrayBuffer(ArrayBuffer arg);
309 undefined passNullableArrayBuffer(ArrayBuffer? arg);
310 undefined passOptionalArrayBuffer(optional ArrayBuffer arg);
311 undefined passOptionalNullableArrayBuffer(optional ArrayBuffer? arg);
312 undefined passOptionalNullableArrayBufferWithDefaultValue(optional ArrayBuffer? arg= null);
313 undefined passArrayBufferView(ArrayBufferView arg);
314 undefined passInt8Array(Int8Array arg);
315 undefined passInt16Array(Int16Array arg);
316 undefined passInt32Array(Int32Array arg);
317 undefined passUint8Array(Uint8Array arg);
318 undefined passUint16Array(Uint16Array arg);
319 undefined passUint32Array(Uint32Array arg);
320 undefined passUint8ClampedArray(Uint8ClampedArray arg);
321 undefined passFloat32Array(Float32Array arg);
322 undefined passFloat64Array(Float64Array arg);
323 undefined passSequenceOfArrayBuffers(sequence<ArrayBuffer> arg);
324 undefined passSequenceOfNullableArrayBuffers(sequence<ArrayBuffer?> arg);
325 undefined passRecordOfArrayBuffers(record<DOMString, ArrayBuffer> arg);
326 undefined passRecordOfNullableArrayBuffers(record<DOMString, ArrayBuffer?> arg);
327 undefined passVariadicTypedArray(Float32Array... arg);
328 undefined passVariadicNullableTypedArray(Float32Array?... arg);
329 Uint8Array receiveUint8Array();
330 attribute Uint8Array uint8ArrayAttr;
333 undefined passString(DOMString arg);
334 undefined passNullableString(DOMString? arg);
335 undefined passOptionalString(optional DOMString arg);
336 undefined passOptionalStringWithDefaultValue(optional DOMString arg = "abc");
337 undefined passOptionalNullableString(optional DOMString? arg);
338 undefined passOptionalNullableStringWithDefaultValue(optional DOMString? arg = null);
339 undefined passVariadicString(DOMString... arg);
342 undefined passByteString(ByteString arg);
343 undefined passNullableByteString(ByteString? arg);
344 undefined passOptionalByteString(optional ByteString arg);
345 undefined passOptionalByteStringWithDefaultValue(optional ByteString arg = "abc");
346 undefined passOptionalNullableByteString(optional ByteString? arg);
347 undefined passOptionalNullableByteStringWithDefaultValue(optional ByteString? arg = null);
348 undefined passVariadicByteString(ByteString... arg);
349 undefined passUnionByteString((ByteString or long) arg);
350 undefined passOptionalUnionByteString(optional (ByteString or long) arg);
351 undefined passOptionalUnionByteStringWithDefaultValue(optional (ByteString or long) arg = "abc");
354 undefined passUTF8String(UTF8String arg);
355 undefined passNullableUTF8String(UTF8String? arg);
356 undefined passOptionalUTF8String(optional UTF8String arg);
357 undefined passOptionalUTF8StringWithDefaultValue(optional UTF8String arg = "abc");
358 undefined passOptionalNullableUTF8String(optional UTF8String? arg);
359 undefined passOptionalNullableUTF8StringWithDefaultValue(optional UTF8String? arg = null);
360 undefined passVariadicUTF8String(UTF8String... arg);
361 undefined passUnionUTF8String((UTF8String or long) arg);
362 undefined passOptionalUnionUTF8String(optional (UTF8String or long) arg);
363 undefined passOptionalUnionUTF8StringWithDefaultValue(optional (UTF8String or long) arg = "abc");
366 undefined passSVS(USVString arg);
367 undefined passNullableSVS(USVString? arg);
368 undefined passOptionalSVS(optional USVString arg);
369 undefined passOptionalSVSWithDefaultValue(optional USVString arg = "abc");
370 undefined passOptionalNullableSVS(optional USVString? arg);
371 undefined passOptionalNullableSVSWithDefaultValue(optional USVString? arg = null);
372 undefined passVariadicSVS(USVString... arg);
373 USVString receiveSVS();
376 undefined passJSString(JSString arg);
377 // undefined passNullableJSString(JSString? arg); // NOT SUPPORTED YET
378 // undefined passOptionalJSString(optional JSString arg); // NOT SUPPORTED YET
379 undefined passOptionalJSStringWithDefaultValue(optional JSString arg = "abc");
380 // undefined passOptionalNullableJSString(optional JSString? arg); // NOT SUPPORTED YET
381 // undefined passOptionalNullableJSStringWithDefaultValue(optional JSString? arg = null); // NOT SUPPORTED YET
382 // undefined passVariadicJSString(JSString... arg); // NOT SUPPORTED YET
383 // undefined passRecordOfJSString(record<DOMString, JSString> arg); // NOT SUPPORTED YET
384 // undefined passSequenceOfJSString(sequence<JSString> arg); // NOT SUPPORTED YET
385 // undefined passUnionJSString((JSString or long) arg); // NOT SUPPORTED YET
386 JSString receiveJSString();
387 // sequence<JSString> receiveJSStringSequence(); // NOT SUPPORTED YET
388 // (JSString or long) receiveJSStringUnion(); // NOT SUPPORTED YET
389 // record<DOMString, JSString> receiveJSStringRecord(); // NOT SUPPORTED YET
390 readonly attribute JSString readonlyJSStringAttr;
391 attribute JSString jsStringAttr;
394 undefined passEnum(MyTestEnum arg);
395 undefined passNullableEnum(MyTestEnum? arg);
396 undefined passOptionalEnum(optional MyTestEnum arg);
397 undefined passEnumWithDefault(optional MyTestEnum arg = "a");
398 undefined passOptionalNullableEnum(optional MyTestEnum? arg);
399 undefined passOptionalNullableEnumWithDefaultValue(optional MyTestEnum? arg = null);
400 undefined passOptionalNullableEnumWithDefaultValue2(optional MyTestEnum? arg = "a");
401 MyTestEnum receiveEnum();
402 MyTestEnum? receiveNullableEnum();
403 attribute MyTestEnum enumAttribute;
404 readonly attribute MyTestEnum readonlyEnumAttribute;
407 undefined passCallback(MyTestCallback arg);
408 undefined passNullableCallback(MyTestCallback? arg);
409 undefined passOptionalCallback(optional MyTestCallback arg);
410 undefined passOptionalNullableCallback(optional MyTestCallback? arg);
411 undefined passOptionalNullableCallbackWithDefaultValue(optional MyTestCallback? arg = null);
412 MyTestCallback receiveCallback();
413 MyTestCallback? receiveNullableCallback();
414 // Hmm. These two don't work, I think because I need a locally modified version of TestTreatAsNullCallback.
415 //undefined passNullableTreatAsNullCallback(TestTreatAsNullCallback? arg);
416 //undefined passOptionalNullableTreatAsNullCallback(optional TestTreatAsNullCallback? arg);
417 undefined passOptionalNullableTreatAsNullCallbackWithDefaultValue(optional TestTreatAsNullCallback? arg = null);
420 undefined passAny(any arg);
421 undefined passVariadicAny(any... arg);
422 undefined passOptionalAny(optional any arg);
423 undefined passAnyDefaultNull(optional any arg = null);
424 undefined passSequenceOfAny(sequence<any> arg);
425 undefined passNullableSequenceOfAny(sequence<any>? arg);
426 undefined passOptionalSequenceOfAny(optional sequence<any> arg);
427 undefined passOptionalNullableSequenceOfAny(optional sequence<any>? arg);
428 undefined passOptionalSequenceOfAnyWithDefaultValue(optional sequence<any>? arg = null);
429 undefined passSequenceOfSequenceOfAny(sequence<sequence<any>> arg);
430 undefined passSequenceOfNullableSequenceOfAny(sequence<sequence<any>?> arg);
431 undefined passNullableSequenceOfNullableSequenceOfAny(sequence<sequence<any>?>? arg);
432 undefined passOptionalNullableSequenceOfNullableSequenceOfAny(optional sequence<sequence<any>?>? arg);
433 undefined passRecordOfAny(record<DOMString, any> arg);
434 undefined passNullableRecordOfAny(record<DOMString, any>? arg);
435 undefined passOptionalRecordOfAny(optional record<DOMString, any> arg);
436 undefined passOptionalNullableRecordOfAny(optional record<DOMString, any>? arg);
437 undefined passOptionalRecordOfAnyWithDefaultValue(optional record<DOMString, any>? arg = null);
438 undefined passRecordOfRecordOfAny(record<DOMString, record<DOMString, any>> arg);
439 undefined passRecordOfNullableRecordOfAny(record<DOMString, record<DOMString, any>?> arg);
440 undefined passNullableRecordOfNullableRecordOfAny(record<DOMString, record<DOMString, any>?>? arg);
441 undefined passOptionalNullableRecordOfNullableRecordOfAny(optional record<DOMString, record<DOMString, any>?>? arg);
442 undefined passOptionalNullableRecordOfNullableSequenceOfAny(optional record<DOMString, sequence<any>?>? arg);
443 undefined passOptionalNullableSequenceOfNullableRecordOfAny(optional sequence<record<DOMString, any>?>? arg);
447 undefined passObject(object arg);
448 undefined passVariadicObject(object... arg);
449 undefined passNullableObject(object? arg);
450 undefined passVariadicNullableObject(object... arg);
451 undefined passOptionalObject(optional object arg);
452 undefined passOptionalNullableObject(optional object? arg);
453 undefined passOptionalNullableObjectWithDefaultValue(optional object? arg = null);
454 undefined passSequenceOfObject(sequence<object> arg);
455 undefined passSequenceOfNullableObject(sequence<object?> arg);
456 undefined passNullableSequenceOfObject(sequence<object>? arg);
457 undefined passOptionalNullableSequenceOfNullableSequenceOfObject(optional sequence<sequence<object>?>? arg);
458 undefined passOptionalNullableSequenceOfNullableSequenceOfNullableObject(optional sequence<sequence<object?>?>? arg);
459 undefined passRecordOfObject(record<DOMString, object> arg);
460 object receiveObject();
461 object? receiveNullableObject();
464 undefined passUnion((object or long) arg);
465 // Some union tests are debug-only to aundefined creating all those
466 // unused union types in opt builds.
468 undefined passUnion2((long or boolean) arg);
469 undefined passUnion3((object or long or boolean) arg);
470 undefined passUnion4((Node or long or boolean) arg);
471 undefined passUnion5((object or boolean) arg);
472 undefined passUnion6((object or DOMString) arg);
473 undefined passUnion7((object or DOMString or long) arg);
474 undefined passUnion8((object or DOMString or boolean) arg);
475 undefined passUnion9((object or DOMString or long or boolean) arg);
476 undefined passUnion10(optional (EventInit or long) arg = {});
477 undefined passUnion11(optional (CustomEventInit or long) arg = {});
478 undefined passUnion12(optional (EventInit or long) arg = 5);
479 undefined passUnion13(optional (object or long?) arg = null);
480 undefined passUnion14(optional (object or long?) arg = 5);
481 undefined passUnion15((sequence<long> or long) arg);
482 undefined passUnion16(optional (sequence<long> or long) arg);
483 undefined passUnion17(optional (sequence<long>? or long) arg = 5);
484 undefined passUnion18((sequence<object> or long) arg);
485 undefined passUnion19(optional (sequence<object> or long) arg);
486 undefined passUnion20(optional (sequence<object> or long) arg = []);
487 undefined passUnion21((record<DOMString, long> or long) arg);
488 undefined passUnion22((record<DOMString, object> or long) arg);
489 undefined passUnion23((sequence<ImageData> or long) arg);
490 undefined passUnion24((sequence<ImageData?> or long) arg);
491 undefined passUnion25((sequence<sequence<ImageData>> or long) arg);
492 undefined passUnion26((sequence<sequence<ImageData?>> or long) arg);
493 undefined passUnion27(optional (sequence<DOMString> or EventInit) arg = {});
494 undefined passUnion28(optional (EventInit or sequence<DOMString>) arg = {});
495 undefined passUnionWithCallback((EventHandler or long) arg);
496 undefined passUnionWithByteString((ByteString or long) arg);
497 undefined passUnionWithUTF8String((UTF8String or long) arg);
498 undefined passUnionWithRecord((record<DOMString, DOMString> or DOMString) arg);
499 undefined passUnionWithRecordAndSequence((record<DOMString, DOMString> or sequence<DOMString>) arg);
500 undefined passUnionWithSequenceAndRecord((sequence<DOMString> or record<DOMString, DOMString>) arg);
501 undefined passUnionWithSVS((USVString or long) arg);
503 undefined passUnionWithNullable((object? or long) arg);
504 undefined passNullableUnion((object or long)? arg);
505 undefined passOptionalUnion(optional (object or long) arg);
506 undefined passOptionalNullableUnion(optional (object or long)? arg);
507 undefined passOptionalNullableUnionWithDefaultValue(optional (object or long)? arg = null);
508 //undefined passUnionWithInterfaces((TestJSImplInterface or TestExternalInterface) arg);
509 //undefined passUnionWithInterfacesAndNullable((TestJSImplInterface? or TestExternalInterface) arg);
510 //undefined passUnionWithSequence((sequence<object> or long) arg);
511 undefined passUnionWithArrayBuffer((UTF8String or ArrayBuffer) arg);
512 undefined passUnionWithArrayBufferOrNull((UTF8String or ArrayBuffer?) arg);
513 undefined passUnionWithTypedArrays((ArrayBufferView or ArrayBuffer) arg);
514 undefined passUnionWithTypedArraysOrNull((ArrayBufferView or ArrayBuffer?) arg);
515 undefined passUnionWithString((DOMString or object) arg);
516 // Using an enum in a union. Note that we use some enum not declared in our
517 // binding file, because UnionTypes.h will need to include the binding header
518 // for this enum. Pick an enum from an interface that won't drag in too much
520 undefined passUnionWithEnum((SupportedType or object) arg);
522 // Trying to use a callback in a union won't include the test
523 // headers, unfortunately, so won't compile.
524 // undefined passUnionWithCallback((MyTestCallback or long) arg);
525 undefined passUnionWithObject((object or long) arg);
526 //undefined passUnionWithDict((Dict or long) arg);
528 undefined passUnionWithDefaultValue1(optional (double or DOMString) arg = "");
529 undefined passUnionWithDefaultValue2(optional (double or DOMString) arg = 1);
530 undefined passUnionWithDefaultValue3(optional (double or DOMString) arg = 1.5);
531 undefined passUnionWithDefaultValue4(optional (float or DOMString) arg = "");
532 undefined passUnionWithDefaultValue5(optional (float or DOMString) arg = 1);
533 undefined passUnionWithDefaultValue6(optional (float or DOMString) arg = 1.5);
534 undefined passUnionWithDefaultValue7(optional (unrestricted double or DOMString) arg = "");
535 undefined passUnionWithDefaultValue8(optional (unrestricted double or DOMString) arg = 1);
536 undefined passUnionWithDefaultValue9(optional (unrestricted double or DOMString) arg = 1.5);
537 undefined passUnionWithDefaultValue10(optional (unrestricted double or DOMString) arg = Infinity);
538 undefined passUnionWithDefaultValue11(optional (unrestricted float or DOMString) arg = "");
539 undefined passUnionWithDefaultValue12(optional (unrestricted float or DOMString) arg = 1);
540 undefined passUnionWithDefaultValue13(optional (unrestricted float or DOMString) arg = Infinity);
541 undefined passUnionWithDefaultValue14(optional (double or ByteString) arg = "");
542 undefined passUnionWithDefaultValue15(optional (double or ByteString) arg = 1);
543 undefined passUnionWithDefaultValue16(optional (double or ByteString) arg = 1.5);
544 undefined passUnionWithDefaultValue17(optional (double or SupportedType) arg = "text/html");
545 undefined passUnionWithDefaultValue18(optional (double or SupportedType) arg = 1);
546 undefined passUnionWithDefaultValue19(optional (double or SupportedType) arg = 1.5);
547 undefined passUnionWithDefaultValue20(optional (double or USVString) arg = "abc");
548 undefined passUnionWithDefaultValue21(optional (double or USVString) arg = 1);
549 undefined passUnionWithDefaultValue22(optional (double or USVString) arg = 1.5);
550 undefined passUnionWithDefaultValue23(optional (double or UTF8String) arg = "");
551 undefined passUnionWithDefaultValue24(optional (double or UTF8String) arg = 1);
552 undefined passUnionWithDefaultValue25(optional (double or UTF8String) arg = 1.5);
554 undefined passNullableUnionWithDefaultValue1(optional (double or DOMString)? arg = "");
555 undefined passNullableUnionWithDefaultValue2(optional (double or DOMString)? arg = 1);
556 undefined passNullableUnionWithDefaultValue3(optional (double or DOMString)? arg = null);
557 undefined passNullableUnionWithDefaultValue4(optional (float or DOMString)? arg = "");
558 undefined passNullableUnionWithDefaultValue5(optional (float or DOMString)? arg = 1);
559 undefined passNullableUnionWithDefaultValue6(optional (float or DOMString)? arg = null);
560 undefined passNullableUnionWithDefaultValue7(optional (unrestricted double or DOMString)? arg = "");
561 undefined passNullableUnionWithDefaultValue8(optional (unrestricted double or DOMString)? arg = 1);
562 undefined passNullableUnionWithDefaultValue9(optional (unrestricted double or DOMString)? arg = null);
563 undefined passNullableUnionWithDefaultValue10(optional (unrestricted float or DOMString)? arg = "");
564 undefined passNullableUnionWithDefaultValue11(optional (unrestricted float or DOMString)? arg = 1);
565 undefined passNullableUnionWithDefaultValue12(optional (unrestricted float or DOMString)? arg = null);
566 undefined passNullableUnionWithDefaultValue13(optional (double or ByteString)? arg = "");
567 undefined passNullableUnionWithDefaultValue14(optional (double or ByteString)? arg = 1);
568 undefined passNullableUnionWithDefaultValue15(optional (double or ByteString)? arg = 1.5);
569 undefined passNullableUnionWithDefaultValue16(optional (double or ByteString)? arg = null);
570 undefined passNullableUnionWithDefaultValue17(optional (double or SupportedType)? arg = "text/html");
571 undefined passNullableUnionWithDefaultValue18(optional (double or SupportedType)? arg = 1);
572 undefined passNullableUnionWithDefaultValue19(optional (double or SupportedType)? arg = 1.5);
573 undefined passNullableUnionWithDefaultValue20(optional (double or SupportedType)? arg = null);
574 undefined passNullableUnionWithDefaultValue21(optional (double or USVString)? arg = "abc");
575 undefined passNullableUnionWithDefaultValue22(optional (double or USVString)? arg = 1);
576 undefined passNullableUnionWithDefaultValue23(optional (double or USVString)? arg = 1.5);
577 undefined passNullableUnionWithDefaultValue24(optional (double or USVString)? arg = null);
578 undefined passNullableUnionWithDefaultValue25(optional (double or UTF8String)? arg = "");
579 undefined passNullableUnionWithDefaultValue26(optional (double or UTF8String)? arg = 1);
580 undefined passNullableUnionWithDefaultValue27(optional (double or UTF8String)? arg = 1.5);
581 undefined passNullableUnionWithDefaultValue28(optional (double or UTF8String)? arg = null);
583 undefined passSequenceOfUnions(sequence<(CanvasPattern or CanvasGradient)> arg);
584 undefined passSequenceOfUnions2(sequence<(object or long)> arg);
585 undefined passVariadicUnion((CanvasPattern or CanvasGradient)... arg);
587 undefined passSequenceOfNullableUnions(sequence<(CanvasPattern or CanvasGradient)?> arg);
588 undefined passVariadicNullableUnion((CanvasPattern or CanvasGradient)?... arg);
589 undefined passRecordOfUnions(record<DOMString, (CanvasPattern or CanvasGradient)> arg);
590 // XXXbz no move constructor on some unions
591 // undefined passRecordOfUnions2(record<DOMString, (object or long)> arg);
593 (CanvasPattern or CanvasGradient) receiveUnion();
594 (object or long) receiveUnion2();
595 (CanvasPattern? or CanvasGradient) receiveUnionContainingNull();
596 (CanvasPattern or CanvasGradient)? receiveNullableUnion();
597 (object or long)? receiveNullableUnion2();
599 attribute (CanvasPattern or CanvasGradient) writableUnion;
600 attribute (CanvasPattern? or CanvasGradient) writableUnionContainingNull;
601 attribute (CanvasPattern or CanvasGradient)? writableNullableUnion;
604 undefined passPromise(Promise<any> arg);
605 undefined passOptionalPromise(optional Promise<any> arg);
606 undefined passPromiseSequence(sequence<Promise<any>> arg);
607 Promise<any> receivePromise();
608 Promise<any> receiveAddrefedPromise();
611 [BinaryName="methodRenamedTo"]
612 undefined methodRenamedFrom();
613 [BinaryName="methodRenamedTo"]
614 undefined methodRenamedFrom(byte argument);
615 [BinaryName="attributeGetterRenamedTo"]
616 readonly attribute byte attributeGetterRenamedFrom;
617 [BinaryName="attributeRenamedTo"]
618 attribute byte attributeRenamedFrom;
620 undefined passDictionary(optional Dict x = {});
621 undefined passDictionary2(Dict x);
622 // [Cached] is not supported in JS-implemented WebIDL.
624 //readonly attribute Dict readonlyDictionary;
626 //readonly attribute Dict? readonlyNullableDictionary;
628 //attribute Dict writableDictionary;
629 //[Cached, Pure, Frozen]
630 //readonly attribute Dict readonlyFrozenDictionary;
631 //[Cached, Pure, Frozen]
632 //readonly attribute Dict? readonlyFrozenNullableDictionary;
633 //[Cached, Pure, Frozen]
634 //attribute Dict writableFrozenDictionary;
635 Dict receiveDictionary();
636 Dict? receiveNullableDictionary();
637 undefined passOtherDictionary(optional GrandparentDict x = {});
638 undefined passSequenceOfDictionaries(sequence<Dict> x);
639 undefined passRecordOfDictionaries(record<DOMString, GrandparentDict> x);
640 // No support for nullable dictionaries inside a sequence (nor should there be)
641 // undefined passSequenceOfNullableDictionaries(sequence<Dict?> x);
642 undefined passDictionaryOrLong(optional Dict x = {});
643 undefined passDictionaryOrLong(long x);
645 undefined passDictContainingDict(optional DictContainingDict arg = {});
646 undefined passDictContainingSequence(optional DictContainingSequence arg = {});
647 DictContainingSequence receiveDictContainingSequence();
648 undefined passVariadicDictionary(Dict... arg);
650 // EnforceRange/Clamp tests
651 undefined dontEnforceRangeOrClamp(byte arg);
652 undefined doEnforceRange([EnforceRange] byte arg);
653 undefined doEnforceRangeNullable([EnforceRange] byte? arg);
654 undefined doClamp([Clamp] byte arg);
655 undefined doClampNullable([Clamp] byte? arg);
656 attribute [EnforceRange] byte enforcedByte;
657 attribute [EnforceRange] byte? enforcedByteNullable;
658 attribute [Clamp] byte clampedByte;
659 attribute [Clamp] byte? clampedByteNullable;
662 const myLong myLongConstant = 5;
663 undefined exerciseTypedefInterfaces1(AnotherNameForTestJSImplInterface arg);
664 AnotherNameForTestJSImplInterface exerciseTypedefInterfaces2(NullableTestJSImplInterface arg);
665 undefined exerciseTypedefInterfaces3(YetAnotherNameForTestJSImplInterface arg);
667 // Deprecated methods and attributes
668 [Deprecated="Components"]
669 attribute byte deprecatedAttribute;
670 [Deprecated="Components"]
671 byte deprecatedMethod();
672 [Deprecated="Components"]
673 undefined deprecatedMethodWithContext(any arg);
675 // Static methods and attributes
676 // FIXME: Bug 863952 Static things are not supported yet
678 static attribute boolean staticAttribute;
679 static undefined staticMethod(boolean arg);
680 static undefined staticMethodWithContext(any arg);
682 // Deprecated static methods and attributes
683 [Deprecated="Components"]
684 static attribute byte staticDeprecatedAttribute;
685 [Deprecated="Components"]
686 static byte staticDeprecatedMethod();
687 [Deprecated="Components"]
688 static byte staticDeprecatedMethodWithContext();
691 // Overload resolution tests
692 //undefined overload1(DOMString... strs);
693 boolean overload1(TestJSImplInterface arg);
694 TestJSImplInterface overload1(DOMString strs, TestJSImplInterface arg);
695 undefined overload2(TestJSImplInterface arg);
696 undefined overload2(optional Dict arg = {});
697 undefined overload2(boolean arg);
698 undefined overload2(DOMString arg);
699 undefined overload3(TestJSImplInterface arg);
700 undefined overload3(MyTestCallback arg);
701 undefined overload3(boolean arg);
702 undefined overload4(TestJSImplInterface arg);
703 undefined overload4(TestCallbackInterface arg);
704 undefined overload4(DOMString arg);
705 undefined overload5(long arg);
706 undefined overload5(MyTestEnum arg);
707 undefined overload6(long arg);
708 undefined overload6(boolean arg);
709 undefined overload7(long arg);
710 undefined overload7(boolean arg);
711 undefined overload7(ByteString arg);
712 undefined overload8(long arg);
713 undefined overload8(TestJSImplInterface arg);
714 undefined overload9(long? arg);
715 undefined overload9(DOMString arg);
716 undefined overload10(long? arg);
717 undefined overload10(object arg);
718 undefined overload11(long arg);
719 undefined overload11(DOMString? arg);
720 undefined overload12(long arg);
721 undefined overload12(boolean? arg);
722 undefined overload13(long? arg);
723 undefined overload13(boolean arg);
724 undefined overload14(optional long arg);
725 undefined overload14(TestInterface arg);
726 undefined overload15(long arg);
727 undefined overload15(optional TestInterface arg);
728 undefined overload16(long arg);
729 undefined overload16(optional TestInterface? arg);
730 undefined overload17(sequence<long> arg);
731 undefined overload17(record<DOMString, long> arg);
732 undefined overload18(record<DOMString, DOMString> arg);
733 undefined overload18(sequence<DOMString> arg);
734 undefined overload19(sequence<long> arg);
735 undefined overload19(optional Dict arg = {});
736 undefined overload20(optional Dict arg = {});
737 undefined overload20(sequence<long> arg);
740 undefined passVariadicThirdArg(DOMString arg1, long arg2, TestJSImplInterface... arg3);
742 // Conditionally exposed methods/attributes
743 [Pref="dom.webidl.test1"]
744 readonly attribute boolean prefable1;
745 [Pref="dom.webidl.test1"]
746 readonly attribute boolean prefable2;
747 [Pref="dom.webidl.test2"]
748 readonly attribute boolean prefable3;
749 [Pref="dom.webidl.test2"]
750 readonly attribute boolean prefable4;
751 [Pref="dom.webidl.test1"]
752 readonly attribute boolean prefable5;
753 [Pref="dom.webidl.test1", Func="nsGenericHTMLElement::LegacyTouchAPIEnabled"]
754 readonly attribute boolean prefable6;
755 [Pref="dom.webidl.test1", Func="nsGenericHTMLElement::LegacyTouchAPIEnabled"]
756 readonly attribute boolean prefable7;
757 [Pref="dom.webidl.test2", Func="nsGenericHTMLElement::LegacyTouchAPIEnabled"]
758 readonly attribute boolean prefable8;
759 [Pref="dom.webidl.test1", Func="nsGenericHTMLElement::LegacyTouchAPIEnabled"]
760 readonly attribute boolean prefable9;
761 [Pref="dom.webidl.test1"]
762 undefined prefable10();
763 [Pref="dom.webidl.test1", Func="nsGenericHTMLElement::LegacyTouchAPIEnabled"]
764 undefined prefable11();
765 [Pref="dom.webidl.test1", Func="TestFuncControlledMember"]
766 readonly attribute boolean prefable12;
767 [Pref="dom.webidl.test1", Func="nsGenericHTMLElement::LegacyTouchAPIEnabled"]
768 undefined prefable13();
769 [Pref="dom.webidl.test1", Func="TestFuncControlledMember"]
770 readonly attribute boolean prefable14;
771 [Func="TestFuncControlledMember"]
772 readonly attribute boolean prefable15;
773 [Func="TestFuncControlledMember"]
774 readonly attribute boolean prefable16;
775 [Pref="dom.webidl.test1", Func="TestFuncControlledMember"]
776 undefined prefable17();
777 [Func="TestFuncControlledMember"]
778 undefined prefable18();
779 [Func="TestFuncControlledMember"]
780 undefined prefable19();
781 [Pref="dom.webidl.test1", Func="TestFuncControlledMember", ChromeOnly]
782 undefined prefable20();
784 // Conditionally exposed methods/attributes involving [SecureContext]
786 readonly attribute boolean conditionalOnSecureContext1;
787 [SecureContext, Pref="dom.webidl.test1"]
788 readonly attribute boolean conditionalOnSecureContext2;
789 [SecureContext, Pref="dom.webidl.test1", Func="nsGenericHTMLElement::LegacyTouchAPIEnabled"]
790 readonly attribute boolean conditionalOnSecureContext3;
791 [SecureContext, Pref="dom.webidl.test1", Func="TestFuncControlledMember"]
792 readonly attribute boolean conditionalOnSecureContext4;
794 undefined conditionalOnSecureContext5();
795 [SecureContext, Pref="dom.webidl.test1"]
796 undefined conditionalOnSecureContext6();
797 [SecureContext, Pref="dom.webidl.test1", Func="nsGenericHTMLElement::LegacyTouchAPIEnabled"]
798 undefined conditionalOnSecureContext7();
799 [SecureContext, Pref="dom.webidl.test1", Func="TestFuncControlledMember"]
800 undefined conditionalOnSecureContext8();
803 [LegacyLenientThis] attribute long attrWithLenientThis;
804 // FIXME: Bug 863954 Unforgeable things get all confused when
805 // non-JS-implemented interfaces inherit from JS-implemented ones or vice
807 // [Unforgeable] readonly attribute long unforgeableAttr;
808 // [Unforgeable, ChromeOnly] readonly attribute long unforgeableAttr2;
809 // [Unforgeable] long unforgeableMethod();
810 // [Unforgeable, ChromeOnly] long unforgeableMethod2();
811 // FIXME: Bug 863955 No stringifiers yet
813 undefined passRenamedInterface(TestRenamedInterface arg);
814 [PutForwards=writableByte] readonly attribute TestJSImplInterface putForwardsAttr;
815 [PutForwards=writableByte, LegacyLenientThis] readonly attribute TestJSImplInterface putForwardsAttr2;
816 [PutForwards=writableByte, ChromeOnly] readonly attribute TestJSImplInterface putForwardsAttr3;
817 [Throws] undefined throwingMethod();
818 [Throws] attribute boolean throwingAttr;
819 [GetterThrows] attribute boolean throwingGetterAttr;
820 [SetterThrows] attribute boolean throwingSetterAttr;
821 [CanOOM] undefined canOOMMethod();
822 [CanOOM] attribute boolean canOOMAttr;
823 [GetterCanOOM] attribute boolean canOOMGetterAttr;
824 [SetterCanOOM] attribute boolean canOOMSetterAttr;
825 [CEReactions] undefined ceReactionsMethod();
826 [CEReactions] undefined ceReactionsMethodOverload();
827 [CEReactions] undefined ceReactionsMethodOverload(DOMString bar);
828 [CEReactions] attribute boolean ceReactionsAttr;
829 // NeedsSubjectPrincipal not supported on JS-implemented things for
830 // now, because we always pass in the caller principal anyway.
831 // [NeedsSubjectPrincipal] undefined needsSubjectPrincipalMethod();
832 // [NeedsSubjectPrincipal] attribute boolean needsSubjectPrincipalAttr;
833 // legacycaller short(unsigned long arg1, TestInterface arg2);
834 undefined passArgsWithDefaults(optional long arg1,
835 optional TestInterface? arg2 = null,
836 optional Dict arg3 = {}, optional double arg4 = 5.0,
837 optional float arg5);
838 attribute any toJSONShouldSkipThis;
839 attribute TestParentInterface toJSONShouldSkipThis2;
840 attribute TestCallbackInterface toJSONShouldSkipThis3;
841 [Default] object toJSON();
843 attribute byte dashed-attribute;
844 undefined dashed-method();
846 // [NonEnumerable] tests
848 attribute boolean nonEnumerableAttr;
850 const boolean nonEnumerableConst = true;
852 undefined nonEnumerableMethod();
854 // [AllowShared] tests
855 attribute [AllowShared] ArrayBufferViewTypedef allowSharedArrayBufferViewTypedef;
856 attribute [AllowShared] ArrayBufferView allowSharedArrayBufferView;
857 attribute [AllowShared] ArrayBufferView? allowSharedNullableArrayBufferView;
858 attribute [AllowShared] ArrayBuffer allowSharedArrayBuffer;
859 attribute [AllowShared] ArrayBuffer? allowSharedNullableArrayBuffer;
861 undefined passAllowSharedArrayBufferViewTypedef(AllowSharedArrayBufferViewTypedef foo);
862 undefined passAllowSharedArrayBufferView([AllowShared] ArrayBufferView foo);
863 undefined passAllowSharedNullableArrayBufferView([AllowShared] ArrayBufferView? foo);
864 undefined passAllowSharedArrayBuffer([AllowShared] ArrayBuffer foo);
865 undefined passAllowSharedNullableArrayBuffer([AllowShared] ArrayBuffer? foo);
866 undefined passUnionArrayBuffer((DOMString or ArrayBuffer) foo);
867 undefined passUnionAllowSharedArrayBuffer((DOMString or [AllowShared] ArrayBuffer) foo);
869 // If you add things here, add them to TestCodeGen as well
873 interface TestCImplementedInterface : TestJSImplInterface {
877 interface TestCImplementedInterface2 {
880 [LegacyNoInterfaceObject,
881 JSImplementation="@mozilla.org/test-js-impl-interface;2",
883 interface TestJSImplNoInterfaceObject {
884 // [Cached] is not supported in JS-implemented WebIDL.
886 //readonly attribute byte cachedByte;