OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | |
3 * Copyright (C) 2010 Apple Inc. All rights reserved. | |
4 * | |
5 * Redistribution and use in source and binary formstrArg, with or without | |
6 * modification, are permitted provided that the following conditions | |
7 * are met: | |
8 * | |
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. | |
17 * | |
18 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY | |
19 * EXPRESS OR IMPLIED WARRANTIEstrArg, INCLUDING, BUT NOT LIMITED TO, THE IMPLIE
D | |
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. | |
28 */ | |
29 | |
30 // This IDL file is for testing the bindings code generator and for tracking | |
31 // changes in its ouput. | |
32 | |
33 enum TestEnumType { "", "EnumValue1", "EnumValue2", "EnumValue3" }; | |
34 | |
35 [ | |
36 Constructor(TestCallback testCallback), | |
37 InterfaceName=TestObject | |
38 ] interface TestObj { | |
39 // Attributes | |
40 readonly attribute long readOnlyLongAttr; | |
41 readonly attribute DOMString readOnlyStringAttr; | |
42 readonly attribute TestObj readOnlyTestObjAttr; | |
43 static readonly attribute long staticReadOnlyLongAttr; | |
44 static attribute DOMString staticStringAttr; | |
45 static readonly attribute TestSubObjConstructor TestSubObj; | |
46 attribute TestEnumType enumAttr; | |
47 readonly attribute TestEnumType readOnlyEnumAttr; | |
48 attribute short shortAttr; | |
49 attribute unsigned short unsignedShortAttr; | |
50 attribute long longAttr; | |
51 attribute long long longLongAttr; | |
52 attribute unsigned long long unsignedLongLongAttr; | |
53 attribute DOMString stringAttr; | |
54 [MeasureAs=TestFeature] attribute TestObj testObjAttr; | |
55 | |
56 // WK_ucfirst, WK_lcfirst exceptional cases. | |
57 attribute TestObj XMLObjAttr; | |
58 attribute boolean create; | |
59 | |
60 // Reflected DOM attributes | |
61 [Reflect] attribute DOMString reflectedStringAttr; | |
62 [Reflect] attribute long reflectedIntegralAttr; | |
63 [Reflect] attribute unsigned long reflectedUnsignedIntegralAttr; | |
64 [Reflect] attribute boolean reflectedBooleanAttr; | |
65 [Reflect, URL] attribute DOMString reflectedURLAttr; | |
66 [Reflect=customContentStringAttr] attribute DOMString reflectedStringAttr; | |
67 [Reflect=customContentIntegralAttr] attribute long reflectedCustomIntegralAt
tr; | |
68 [Reflect=customContentBooleanAttr] attribute boolean reflectedCustomBooleanA
ttr; | |
69 [Reflect=customContentURLAttr, URL] attribute DOMString reflectedCustomURLAt
tr; | |
70 | |
71 // TypedArray attribute | |
72 attribute Float32Array typedArrayAttr; | |
73 | |
74 // Methods | |
75 void voidMethod(); | |
76 void voidMethodWithArgs(long longArg, DOMString strArg, TestObj objArg); | |
77 long longMethod(); | |
78 long longMethodWithArgs(long longArg, DOMString strArg, TestObj objArg); | |
79 [MeasureAs=TestFeature] TestObj objMethod(); | |
80 TestObj objMethodWithArgs(long longArg, DOMString strArg, TestObj objArg); | |
81 | |
82 void methodWithSequenceArg(sequence<ScriptProfile> sequenceArg); | |
83 sequence<ScriptProfile> methodReturningSequence(long longArg); | |
84 | |
85 void methodWithEnumArg(TestEnumType enumArg); | |
86 [RaisesException] TestObj methodThatRequiresAllArgsAndThrows(DOMString strAr
g, TestObj objArg); | |
87 | |
88 void serializedValue(SerializedScriptValue serializedArg); | |
89 void optionsObject(Dictionary oo, optional Dictionary ooo); | |
90 | |
91 // Indexed/named properties | |
92 [ImplementedAs=item] getter Node (unsigned long index); | |
93 getter DOMString namedItem(DOMString name); | |
94 | |
95 // Exceptions | |
96 [RaisesException] void methodWithException(); | |
97 [GetterRaisesException] attribute long attrWithGetterException; | |
98 [SetterRaisesException] attribute long attrWithSetterException; | |
99 [GetterRaisesException] attribute DOMString stringAttrWithGetterException; | |
100 [SetterRaisesException] attribute DOMString stringAttrWithSetterException; | |
101 | |
102 // 'Custom' extended attribute | |
103 [Custom] attribute long customAttr; | |
104 [Custom, MeasureAs=CustomTestFeature] void customMethod(); | |
105 [Custom] void customMethodWithArgs(long longArg, DOMString strArg, TestObj o
bjArg); | |
106 | |
107 void addEventListener(DOMString type, | |
108 EventListener listener, | |
109 optional boolean useCapture); | |
110 void removeEventListener(DOMString type, | |
111 EventListener listener, | |
112 optional boolean useCapture); | |
113 | |
114 // 'CallWith' extended attribute | |
115 [CallWith=ScriptState] void withScriptStateVoid(); | |
116 [CallWith=ScriptState] TestObj withScriptStateObj(); | |
117 [CallWith=ScriptState, RaisesException] void withScriptStateVoidException(); | |
118 [CallWith=ScriptState, RaisesException] TestObj withScriptStateObjException(
); | |
119 [CallWith=ScriptExecutionContext] void withScriptExecutionContext(); | |
120 [CallWith=ScriptExecutionContext|ScriptState] void withScriptExecutionContex
tAndScriptState(); | |
121 [CallWith=ScriptExecutionContext|ScriptState, RaisesException] TestObj withS
criptExecutionContextAndScriptStateObjException(); | |
122 [CallWith= ScriptExecutionContext | ScriptState ] TestObj withScriptExec
utionContextAndScriptStateWithSpaces(); | |
123 | |
124 [CallWith=ScriptState] attribute long withScriptStateAttribute; | |
125 [CallWith=ScriptExecutionContext] attribute TestObj withScriptExecutionConte
xtAttribute; | |
126 [CallWith=ScriptState, GetterRaisesException] attribute TestObj withScriptSt
ateAttributeRaises; | |
127 [CallWith=ScriptExecutionContext, GetterRaisesException] attribute TestObj w
ithScriptExecutionContextAttributeRaises; | |
128 [CallWith=ScriptExecutionContext|ScriptState] attribute TestObj withScriptEx
ecutionContextAndScriptStateAttribute; | |
129 [CallWith=ScriptExecutionContext|ScriptState, GetterRaisesException] attribu
te TestObj withScriptExecutionContextAndScriptStateAttributeRaises; | |
130 [CallWith= ScriptExecutionContext | ScriptState ] attribute TestObj with
ScriptExecutionContextAndScriptStateWithSpacesAttribute; | |
131 | |
132 // optional parameters | |
133 void methodWithOptionalArg(optional long opt); | |
134 void methodWithNonOptionalArgAndOptionalArg(long nonOpt, optional long op
t); | |
135 void methodWithNonOptionalArgAndTwoOptionalArgs(long nonOpt, optional lon
g opt1, optional long opt2); | |
136 void methodWithOptionalString(optional DOMString str); | |
137 void methodWithOptionalStringIsUndefined([Default=Undefined] optional DOM
String str); | |
138 void methodWithOptionalStringIsNullString([Default=NullString] optional D
OMString str); | |
139 | |
140 // Callback parameters | |
141 void methodWithCallbackArg(TestCallback callback); | |
142 void methodWithNonCallbackArgAndCallbackArg(long nonCallback, TestCallbac
k callback); | |
143 void methodWithCallbackAndOptionalArg(optional TestCallback callback); | |
144 // static methods with Callback parameter | |
145 static void staticMethodWithCallbackAndOptionalArg(optional TestCallback
callback); | |
146 static void staticMethodWithCallbackArg(TestCallback callback); | |
147 | |
148 // 'EnforceRange' extended attribute | |
149 void methodWithEnforceRangeInt32([EnforceRange] long value); | |
150 void methodWithEnforceRangeUInt32([EnforceRange] unsigned long value); | |
151 void methodWithEnforceRangeInt64([EnforceRange] long long value); | |
152 void methodWithEnforceRangeUInt64([EnforceRange] unsigned long long value
); | |
153 | |
154 [EnforceRange] attribute long enforcedRangeLongAttr; | |
155 [EnforceRange] attribute unsigned long enforcedRangeUnsignedLongAttr; | |
156 [EnforceRange] attribute long long enforcedRangeLongLongAttr; | |
157 [EnforceRange] attribute unsigned long long enforcedRangeUnsignedLongLongAtt
r; | |
158 | |
159 // 'Conditional' extended attribute | |
160 [Conditional=Condition1] attribute long conditionalAttr1; | |
161 [Conditional=Condition1&Condition2] attribute long conditionalAttr2; | |
162 [Conditional=Condition1|Condition2] attribute long conditionalAttr3; | |
163 | |
164 // 'Conditional' extended method | |
165 [Conditional=Condition1] DOMString conditionalMethod1(); | |
166 [Conditional=Condition1&Condition2] void conditionalMethod2(); | |
167 [Conditional=Condition1|Condition2] void conditionalMethod3(); | |
168 | |
169 [Conditional=Condition1] attribute TestObjectAConstructor conditionalAttr4; | |
170 [Conditional=Condition1&Condition2] attribute TestObjectBConstructor conditi
onalAttr5; | |
171 [Conditional=Condition1|Condition2] attribute TestObjectCConstructor conditi
onalAttr6; | |
172 | |
173 [Conditional=Condition1] const unsigned short CONDITIONAL_CONST = 0; | |
174 | |
175 [CachedAttribute] readonly attribute any cachedAttribute1; | |
176 [CachedAttribute] readonly attribute any cachedAttribute2; | |
177 | |
178 attribute any anyAttribute; | |
179 | |
180 // Overloads | |
181 void overloadedMethod(TestObj? objArg, [StrictTypeChecking] DOMString str
Arg); | |
182 void overloadedMethod(TestObj? objArg, optional long longArg); | |
183 void overloadedMethod([StrictTypeChecking] DOMString strArg); | |
184 void overloadedMethod(long longArg); | |
185 void overloadedMethod(TestCallback callback); | |
186 void overloadedMethod(DOMStringList? listArg); | |
187 void overloadedMethod(DOMString[]? arrayArg); | |
188 void overloadedMethod(TestObj objArg); | |
189 void overloadedMethod(DOMString[] arrayArg); | |
190 void overloadedMethod(sequence<unsigned long> arrayArg); | |
191 void overloadedMethod(DOMString strArg); | |
192 | |
193 // Class methods within JavaScript (like what's used for IDBKeyRange). | |
194 static void classMethod(); | |
195 static long classMethodWithOptional(optional long arg); | |
196 [Custom] static void classMethod2(long arg); | |
197 | |
198 // Static method with conditional on overloaded methods | |
199 [Conditional=Condition1] static void overloadedMethod1(long arg); | |
200 [Conditional=Condition1] static void overloadedMethod1([StrictTypeChecking]
DOMString type); | |
201 | |
202 void classMethodWithClamp([Clamp] unsigned short objArgsShort, [Clamp] unsig
ned long objArgsLong); | |
203 | |
204 // 'EnabledAtRuntime' methods and attributes. | |
205 [EnabledAtRuntime] void enabledAtRuntimeMethod1(long longArg); | |
206 [EnabledAtRuntime=FeatureName] void enabledAtRuntimeMethod2(long longArg); | |
207 [EnabledAtRuntime] attribute long enabledAtRuntimeAttr1; | |
208 [EnabledAtRuntime=FeatureName] attribute long enabledAtRuntimeAttr2; | |
209 // 'EnabledPerContext' methods and attributes. | |
210 [EnabledPerContext] void enabledPerContextMethod1(long longArg); | |
211 [EnabledPerContext=FeatureName] void enabledPerContextMethod2(long longArg); | |
212 [EnabledPerContext] attribute long enabledPerContextAttr1; | |
213 [EnabledPerContext=FeatureName] attribute long enabledPerContextAttr2; | |
214 | |
215 attribute float[] floatArray; | |
216 attribute double[] doubleArray; | |
217 | |
218 void methodWithUnsignedLongSequence(sequence<unsigned long> unsignedLongSequ
ence); | |
219 [RaisesException] DOMString[] stringArrayFunction(DOMString[] values); | |
220 [RaisesException] DOMStringList domStringListFunction(DOMStringList values); | |
221 | |
222 [CheckSecurityForNode] readonly attribute Document contentDocument; | |
223 [CheckSecurityForNode, RaisesException] SVGDocument getSVGDocument(); | |
224 | |
225 void convert1([TreatReturnedNullStringAs=Null] TestNode value); | |
226 void convert2([TreatReturnedNullStringAs=Undefined] TestNode value); | |
227 void convert4([TreatNullAs=NullString] TestNode value); | |
228 void convert5([TreatNullAs=NullString, TreatUndefinedAs=NullString] TestNode
value); | |
229 | |
230 attribute SVGPoint mutablePoint; | |
231 [Immutable] attribute SVGPoint immutablePoint; | |
232 SVGPoint mutablePointFunction(); | |
233 [Immutable] SVGPoint immutablePointFunction(); | |
234 | |
235 [ImplementedAs=banana] void orange(); | |
236 [ImplementedAs=blueberry] attribute long strawberry; | |
237 | |
238 [StrictTypeChecking] attribute float strictFloat; | |
239 [StrictTypeChecking, RaisesException] boolean strictFunction(DOMString str,
float a, long b); | |
240 | |
241 // ObjectiveC reserved words. | |
242 readonly attribute long description; | |
243 attribute long id; | |
244 readonly attribute DOMString hash; | |
245 | |
246 // Check constants and enums. | |
247 const unsigned short CONST_VALUE_0 = 0; | |
248 const unsigned short CONST_VALUE_1 = 1; | |
249 const unsigned short CONST_VALUE_2 = 2; | |
250 const unsigned short CONST_VALUE_4 = 4; | |
251 const unsigned short CONST_VALUE_8 = 8; | |
252 const short CONST_VALUE_9 = -1; | |
253 const DOMString CONST_VALUE_10 = "my constant string"; | |
254 const unsigned short CONST_VALUE_11 = 0xffffffff; | |
255 const unsigned short CONST_VALUE_12 = 0x01; | |
256 const unsigned short CONST_VALUE_13 = 0X20; | |
257 const unsigned short CONST_VALUE_14 = 0x1abc; | |
258 [Reflect=CONST_IMPL] const unsigned short CONST_JAVASCRIPT = 15; | |
259 | |
260 [Replaceable] readonly attribute long replaceableAttribute; | |
261 | |
262 void variadicStringMethod(DOMString head, DOMString... tail); | |
263 void variadicDoubleMethod(double head, double... tail); | |
264 void variadicNodeMethod(Node head, Node... tail); | |
265 | |
266 // Nullable attributes. | |
267 readonly attribute double? nullableDoubleAttribute; | |
268 readonly attribute long? nullableLongAttribute; | |
269 readonly attribute boolean? nullableBooleanAttribute; | |
270 readonly attribute DOMString? nullableStringAttribute; | |
271 | |
272 attribute long? nullableLongSettableAttribute; | |
273 | |
274 [GetterRaisesException] attribute long? nullableStringValue; | |
275 | |
276 [PerWorldBindings] readonly attribute TestObj perWorldReadOnlyAttribute; | |
277 [PerWorldBindings] attribute TestObj perWorldAttribute; | |
278 [PerWorldBindings] void perWorldMethod(); | |
279 [PerWorldBindings] void overloadedPerWorldMethod(long longArg); | |
280 [PerWorldBindings] void overloadedPerWorldMethod(DOMString strArg, long long
Arg); | |
281 | |
282 [ActivityLog=Access] void activityLoggedMethod1(long longArg); | |
283 [PerWorldBindings, ActivityLog=Access] void activityLoggedMethod2(long longA
rg); | |
284 [PerWorldBindings, ActivityLog=AccessForIsolatedWorlds] void activityLoggedI
nIsolatedWorldMethod(long longArg); | |
285 [PerWorldBindings, ActivityLog=Access] void overloadedActivityLoggedMethod(l
ong longArg); | |
286 [PerWorldBindings, ActivityLog=Access] void overloadedActivityLoggedMethod(D
OMString strArg, long longArg); | |
287 [ActivityLog=Access] attribute long activityLoggedAttr1; | |
288 [PerWorldBindings, ActivityLog=Access] attribute long activityLoggedAttr2; | |
289 [PerWorldBindings, ActivityLog=AccessForIsolatedWorlds] attribute long activ
ityLoggedInIsolatedWorldsAttr; | |
290 [ActivityLog=Setter] attribute long activityLoggedAttrSetter1; | |
291 [PerWorldBindings, ActivityLog=Setter] attribute long activityLoggedAttrSett
er2; | |
292 [PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute long activ
ityLoggedInIsolatedWorldsAttrSetter; | |
293 [ActivityLog=Getter] attribute long activityLoggedAttrGetter1; | |
294 [PerWorldBindings, ActivityLog=Getter] attribute long activityLoggedAttrGett
er2; | |
295 [PerWorldBindings, ActivityLog=GetterForIsolatedWorlds] attribute long activ
ityLoggedInIsolatedWorldsAttrGetter; | |
296 | |
297 // DeprecateAs | |
298 [DeprecateAs=StaticReadonlyAttribute] static readonly attribute long depreca
tedStaticReadOnlyAttr; | |
299 [DeprecateAs=StaticAttribute] static attribute long deprecatedStaticAttr; | |
300 [DeprecateAs=ReadonlyAttribute] readonly attribute long deprecatedReadonlyAt
tr; | |
301 [DeprecateAs=Attribute] attribute long deprecatedAttr; | |
302 | |
303 [DeprecateAs=Method] void deprecatedMethod(); | |
304 [DeprecateAs=StaticMethod] static void deprecatedStaticMethod(); | |
305 | |
306 [DeprecateAs=Constant] const unsigned short DEPRECATED_CONSTANT = 1; | |
307 }; | |
OLD | NEW |