2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * Copyright (C) 2010 Apple Inc. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
15 * its contributors may be used to endorse or promote products derived
16 * from this software without specific prior written permission.
18 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
19 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
22 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 // This IDL file is for testing the bindings code generator and for tracking
31 // changes in its ouput.
33 enum TestEnumType { "", "EnumValue1", "EnumValue2", "EnumValue3" };
35 callback TestCallbackFunction = void (TestEnumType formal1, TestObject formal2);
37 // No extended attributes on the interface; those go in TestInterface.idl
38 interface TestObject : EventTarget {
40 readonly attribute long readOnlyLongAttr;
41 readonly attribute DOMString readOnlyStringAttr;
42 readonly attribute TestObject readOnlyTestObjectAttr;
43 static readonly attribute long staticReadOnlyLongAttr;
44 static attribute DOMString staticStringAttr;
45 attribute TestSubObjConstructor TestSubObj;
46 attribute TestEnumType enumAttr;
47 readonly attribute TestEnumType readOnlyEnumAttr;
48 attribute byte byteAttr;
49 attribute octet octetAttr;
50 attribute short shortAttr;
51 attribute unsigned short unsignedShortAttr;
52 attribute long longAttr;
53 attribute long long longLongAttr;
54 attribute unsigned long long unsignedLongLongAttr;
55 attribute DOMString stringAttr;
56 [TreatNullAs=NullString] attribute DOMString treatNullAsNullStringStringAttr;
57 [TreatNullAs=NullString, TreatUndefinedAs=NullString] attribute DOMString treatNullAsNullStringTreatUndefinedAsNullStringStringAttr;
58 attribute EventHandler eventHandlerAttr;
59 [MeasureAs=TestFeature] attribute TestObject testObjAttr;
60 [ExposeJSAccessors] attribute DOMString attrWithJSGetterAndSetter;
61 [MeasureAs=TestFeature] attribute TestSubObjConstructor TestSubObjMeasured;
63 // Name starting with an acronym
64 attribute TestObject XMLObjAttr;
66 // Reflected DOM attributes
67 [Reflect] attribute DOMString reflectedStringAttr;
68 [Reflect, TreatNullAs=NullString] attribute DOMString reflectedTreatNullAsNullStringStringAttr;
69 [Reflect, TreatNullAs=NullString, TreatUndefinedAs=NullString] attribute DOMString reflectedTreatNullAsNullStringTreatUndefinedAsNullStringStringAttr;
70 [Reflect] attribute long reflectedIntegralAttr;
71 [Reflect] attribute unsigned long reflectedUnsignedIntegralAttr;
72 [Reflect] attribute boolean reflectedBooleanAttr;
73 [Reflect, URL] attribute DOMString reflectedURLAttr;
74 [Reflect, TreatNullAs=NullString, URL] attribute DOMString reflectedTreatNullAsNullStringURLAttr;
75 [Reflect, TreatNullAs=NullString, TreatUndefinedAs=NullString, URL] attribute DOMString reflectedTreatNullAsNullStringTreatUndefinedAsNullStringURLAttr;
76 [Reflect=customContentStringAttr] attribute DOMString reflectedCustomStringAttr;
77 [Reflect=customContentStringAttr, TreatNullAs=NullString] attribute DOMString reflectedTreatNullAsNullStringCustomStringAttr;
78 [Reflect=customContentStringAttr, TreatNullAs=NullString, TreatUndefinedAs=NullString] attribute DOMString reflectedTreatNullAsNullStringTreatUndefinedAsNullStringCustomStringAttr;
79 [Reflect=customContentIntegralAttr] attribute long reflectedCustomIntegralAttr;
80 [Reflect=customContentBooleanAttr] attribute boolean reflectedCustomBooleanAttr;
81 [Reflect=customContentURLAttr, URL] attribute DOMString reflectedCustomURLAttr;
82 [Reflect=customContentURLAttr, TreatNullAs=NullString, URL] attribute DOMString reflectedTreatNullAsNullStringCustomURLAttr;
83 [Reflect=customContentURLAttr, TreatNullAs=NullString, TreatUndefinedAs=NullString, URL] attribute DOMString reflectedTreatNullAsNullStringTreatUndefinedAsNullStringCustomURLAttr;
84 [Reflect, ReflectOnly="unique"] attribute DOMString limitedToOnlyOneAttribute;
85 [Reflect, ReflectOnly="Per"|"Paal"|"Espen"] attribute DOMString limitedToOnlyAttribute;
86 [Reflect=Other, ReflectOnly="Value1"|"Value2" ] attribute DOMString limitedToOnlyOtherAttribute;
87 [Reflect, ReflectOnly="rsa" | "dsa", ReflectMissing="rsa"] attribute DOMString limitedWithMissingDefaultAttribute;
88 [Reflect, ReflectOnly="ltr" | "rtl" | "auto", ReflectMissing="auto", ReflectInvalid="ltr"] attribute DOMString limitedWithInvalidMissingDefaultAttribute;
89 [Reflect, ReflectOnly="left" | "right", ReflectMissing="left", ReflectInvalid="left"] attribute DOMString limitedWithInvalidAndMissingDefaultAttribute;
90 [Reflect, ReflectOnly="anonymous"|"use-credentials", ReflectEmpty="anonymous", ReflectInvalid="anonymous"] readonly attribute DOMString corsSettingAttribute;
91 [Reflect, ReflectOnly="empty"|"missing"|"invalid"|"a-normal", ReflectEmpty="empty", ReflectMissing="missing", ReflectInvalid="invalid"] readonly attribute DOMString limitedWithEmptyMissingInvalidAttribute;
93 // TypedArray attribute
94 attribute Float32Array typedArrayAttr;
98 void voidMethodWithArgs(long longArg, DOMString strArg, TestObject objArg);
100 long longMethodWithArgs(long longArg, DOMString strArg, TestObject objArg);
101 [MeasureAs=TestFeature] TestObject objMethod();
102 TestObject objMethodWithArgs(long longArg, DOMString strArg, TestObject objArg);
104 void methodWithSequenceArg(sequence<TestInterface> sequenceArg);
105 sequence<TestInterface> methodReturningSequence(long longArg);
107 void methodWithEnumArg(TestEnumType enumArg);
108 [RaisesException] TestObject methodThatRequiresAllArgsAndThrows(DOMString strArg, TestObject objArg);
110 void methodQueryListListener(MediaQueryListListener listener);
111 void serializedValue(SerializedScriptValue serializedArg);
112 void optionsObject(Dictionary oo, optional Dictionary ooo);
113 void optionsObjectList(sequence<Dictionary> list);
115 // Indexed/named properties
116 getter Node (unsigned long index);
117 getter DOMString (DOMString name);
120 [RaisesException] void methodWithException();
121 [RaisesException=Getter] attribute long attrWithGetterException;
122 [RaisesException=Setter] attribute long attrWithSetterException;
123 [RaisesException=Getter] attribute DOMString stringAttrWithGetterException;
124 [RaisesException=Setter] attribute DOMString stringAttrWithSetterException;
125 void overloadedMethodJ(long longArg);
126 void overloadedMethodJ([Default=Null] TestInterfaceEmpty? testInterfaceEmptyNullableArg);
128 // 'Custom' extended attribute
129 [Custom] attribute long customAttr;
130 [Custom, MeasureAs=CustomTestFeature] void customMethod();
131 [Custom] void customMethodWithArgs(long longArg, DOMString strArg, TestObject objArg);
133 // 'CallWith' extended attribute
134 [CallWith=ScriptState] void withScriptStateVoid();
135 [CallWith=ScriptState] TestObject withScriptStateObj();
136 [CallWith=ScriptState, RaisesException] void withScriptStateVoidException();
137 [CallWith=ScriptState, RaisesException] TestObject withScriptStateObjException();
138 [CallWith=ExecutionContext] void withExecutionContext();
139 [CallWith=ExecutionContext&ScriptState] void withExecutionContextAndScriptState();
140 [CallWith=ExecutionContext&ScriptState, RaisesException] TestObject withExecutionContextAndScriptStateObjException();
141 [CallWith= ExecutionContext & ScriptState ] TestObject withExecutionContextAndScriptStateWithSpaces();
142 [CallWith=ActiveWindow&FirstWindow] void withActiveWindowAndFirstWindow();
144 [CallWith=ExecutionContext] attribute TestObject withExecutionContextAttribute;
145 [SetterCallWith=ActiveWindow&FirstWindow] attribute TestObject withActiveWindowAndFirstWindowAttribute;
146 [RaisesException=Getter] attribute TestObject withScriptStateAttributeRaises;
148 // optional parameters
149 void methodWithOptionalArg(optional long opt);
150 void methodWithNonOptionalArgAndOptionalArg(long nonOpt, optional long opt);
151 void methodWithNonOptionalArgAndTwoOptionalArgs(long nonOpt, optional long opt1, optional long opt2);
152 void methodWithOptionalString(optional DOMString str);
153 void methodWithOptionalStringIsUndefined([Default=Undefined] optional DOMString str);
154 void methodWithOptionalStringIsNullString([Default=NullString] optional DOMString str);
156 // Callback interface parameters
157 void methodWithCallbackInterfaceArg(TestCallbackInterface callbackInterface);
158 void methodWithNonCallbackArgAndCallbackInterfaceArg(long nonCallback, TestCallbackInterface callbackInterface);
159 void methodWithCallbackInterfaceAndOptionalArg(optional TestCallbackInterface callbackInterface);
160 void methodWithNullableCallbackInterfaceArg(TestCallbackInterface? callbackInterface);
161 // static methods with callback interface parameter
162 static void staticMethodWithCallbackAndOptionalArg(optional TestCallbackInterface callbackInterface);
163 static void staticMethodWithCallbackArg(TestCallbackInterface callbackInterface);
165 // 'EnforceRange' extended attribute
166 void methodWithEnforceRangeInt8([EnforceRange] byte value);
167 void methodWithEnforceRangeUInt8([EnforceRange] octet value);
168 void methodWithEnforceRangeInt16([EnforceRange] short value);
169 void methodWithEnforceRangeUInt16([EnforceRange] unsigned short value);
170 void methodWithEnforceRangeInt32([EnforceRange] long value);
171 void methodWithEnforceRangeUInt32([EnforceRange] unsigned long value);
172 void methodWithEnforceRangeInt64([EnforceRange] long long value);
173 void methodWithEnforceRangeUInt64([EnforceRange] unsigned long long value);
175 [EnforceRange] attribute byte enforcedRangeByteAttr;
176 [EnforceRange] attribute octet enforcedRangeOctetAttr;
177 [EnforceRange] attribute short enforcedRangeShortAttr;
178 [EnforceRange] attribute unsigned short enforcedRangeUnsignedShortAttr;
179 [EnforceRange] attribute long enforcedRangeLongAttr;
180 [EnforceRange] attribute unsigned long enforcedRangeUnsignedLongAttr;
181 [EnforceRange] attribute long long enforcedRangeLongLongAttr;
182 [EnforceRange] attribute unsigned long long enforcedRangeUnsignedLongLongAttr;
184 // 'Conditional' extended attribute
185 [Conditional=Condition1] attribute long conditionalAttr1;
186 [Conditional=Condition1&Condition2] attribute long conditionalAttr2;
187 [Conditional=Condition1|Condition2|Condition3] attribute long conditionalAttr3;
189 // 'Conditional' extended method
190 [Conditional=Condition1] DOMString conditionalMethod1();
191 [Conditional=Condition1&Condition2] void conditionalMethod2();
192 [Conditional=Condition1|Condition2] void conditionalMethod3();
194 [Conditional=Condition1] attribute TestObjectectAConstructor conditionalAttr4;
195 [Conditional=Condition1&Condition2] attribute TestObjectectBConstructor conditionalAttr5;
196 [Conditional=Condition1|Condition2] attribute TestObjectectCConstructor conditionalAttr6;
198 readonly attribute any cachedAttribute1;
199 readonly attribute any cachedAttribute2;
200 [CachedAttribute=isValueDirty] readonly attribute any cachedDirtyableAttribute;
201 [RaisesException=Getter, CachedAttribute=isValueDirty] readonly attribute any cachedDirtyableAttributeRaises;
203 attribute any anyAttribute;
205 attribute TestCallbackFunction callbackFunctionAttribute;
206 TestCallbackFunction callbackFunctionReturnValue();
207 void callbackFunctionArgument(TestCallbackFunction function);
210 void overloadedMethod(long longArg);
211 void overloadedMethod(TestCallbackInterface callbackInterfaceArg);
212 void overloadedMethod(TestObject objArg);
213 void overloadedMethod(DOMString[] arrayArg);
214 void overloadedMethod(sequence<unsigned long> sequenceArg);
215 void overloadedMethodA(TestObject? objArg, optional long longArg);
216 void overloadedMethodA(TestObject? objArg, DOMString strArg);
217 void overloadedMethodB(DOMString strArg);
218 void overloadedMethodB([StrictTypeChecking] DOMString strArg);
219 void overloadedMethodC(Dictionary dictionaryArg); // Non-wrapper type
220 void overloadedMethodC(double doubleArg);
222 // Class methods within JavaScript (like what's used for IDBKeyRange).
223 static void classMethod();
224 static long classMethodWithOptional(optional long arg);
225 [Custom] static void classMethod2(long arg);
227 void classMethodWithClamp([Clamp] unsigned short objArgsShort, [Clamp] unsigned long objArgsLong);
229 // [RuntimeEnabled] methods and attributes.
230 [RuntimeEnabled=FeatureName] void enabledAtRuntimeMethod(long longArg);
231 [RuntimeEnabled=FeatureName] attribute long enabledAtRuntimeAttr;
232 // [PerContextEnabled] methods and attributes.
233 [PerContextEnabled=FeatureName] void enabledPerContextMethod(long longArg);
234 [PerContextEnabled=FeatureName] attribute long enabledPerContextAttr;
236 attribute float[] floatArray;
237 attribute double[] doubleArray;
238 attribute MessagePort[] messagePortArray;
240 void methodWithUnsignedLongSequence(sequence<unsigned long> unsignedLongSequence);
241 [RaisesException] DOMString[] stringArrayFunction(DOMString[] values);
242 [RaisesException] DOMStringList domStringListFunction(DOMStringList values);
244 [CheckSecurity=Node] readonly attribute Document contentDocument;
246 void convert1([TreatNullAs=NullString] TestNode value);
247 void convert2([TreatNullAs=NullString, TreatUndefinedAs=NullString] TestNode value);
249 [ImplementedAs=banana] void orange();
250 [ImplementedAs=blueberry] attribute long strawberry;
252 [StrictTypeChecking] attribute float strictFloat;
253 [StrictTypeChecking, RaisesException] boolean strictFunction(DOMString str, float a, long b);
255 [Replaceable] readonly attribute long replaceableAttribute;
257 void variadicStringMethod(DOMString head, DOMString... tail);
258 void variadicDoubleMethod(double head, double... tail);
259 void variadicNodeMethod(Node head, Node... tail);
261 // Nullable attributes.
262 readonly attribute double? nullableDoubleAttribute;
263 readonly attribute long? nullableLongAttribute;
264 readonly attribute boolean? nullableBooleanAttribute;
265 readonly attribute DOMString? nullableStringAttribute;
266 attribute long? nullableLongSettableAttribute;
268 [PerWorldBindings] readonly attribute TestObject perWorldReadOnlyAttribute;
269 [PerWorldBindings] attribute TestObject perWorldAttribute;
270 [PerWorldBindings] void perWorldMethod();
271 [PerWorldBindings] void overloadedPerWorldMethod(long longArg);
272 [PerWorldBindings] void overloadedPerWorldMethod(DOMString strArg, long longArg);
274 [ActivityLogging=ForAllWorlds] void activityLoggedMethod1(long longArg);
275 [PerWorldBindings, ActivityLogging=ForAllWorlds] void activityLoggedMethod2(long longArg);
276 [PerWorldBindings, ActivityLogging=ForIsolatedWorlds] void activityLoggedInIsolatedWorldMethod(long longArg);
277 [PerWorldBindings, ActivityLogging=ForAllWorlds] void overloadedActivityLoggedMethod(long longArg);
278 [PerWorldBindings, ActivityLogging=ForAllWorlds] void overloadedActivityLoggedMethod(DOMString strArg, long longArg);
279 [ActivityLogging=ForAllWorlds] attribute long activityLoggedAttr1;
280 [PerWorldBindings, ActivityLogging=ForAllWorlds] attribute long activityLoggedAttr2;
281 [PerWorldBindings, ActivityLogging=ForIsolatedWorlds] attribute long activityLoggedInIsolatedWorldsAttr;
282 [ActivityLogging=SetterForAllWorlds] attribute long activityLoggedAttrSetter1;
283 [PerWorldBindings, ActivityLogging=SetterForAllWorlds] attribute long activityLoggedAttrSetter2;
284 [PerWorldBindings, ActivityLogging=SetterForIsolatedWorlds] attribute long activityLoggedInIsolatedWorldsAttrSetter;
285 [ActivityLogging=GetterForAllWorlds] attribute long activityLoggedAttrGetter1;
286 [PerWorldBindings, ActivityLogging=GetterForAllWorlds] attribute long activityLoggedAttrGetter2;
287 [PerWorldBindings, ActivityLogging=GetterForIsolatedWorlds] attribute long activityLoggedInIsolatedWorldsAttrGetter;
290 [DeprecateAs=StaticReadonlyAttribute] static readonly attribute long deprecatedStaticReadOnlyAttr;
291 [DeprecateAs=StaticAttribute] static attribute long deprecatedStaticAttr;
292 [DeprecateAs=ReadonlyAttribute] readonly attribute long deprecatedReadonlyAttr;
293 [DeprecateAs=Attribute] attribute long deprecatedAttr;
295 [DeprecateAs=Method] void deprecatedMethod();
296 [DeprecateAs=StaticMethod] static void deprecatedStaticMethod();
297 [DeprecateAs=ConstructorAttribute] attribute TestSubObjConstructor deprecatedConstructor;
299 [DeprecateAs=Constant] const unsigned short DEPRECATED_CONSTANT = 1;
302 [PutForwards=href] readonly attribute TestNode location;
303 [PutForwards=hrefThrows] readonly attribute TestNode locationWithException;
306 // The following comment should not generate any code
307 // TestObject implements TestImplements;