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 module test { |
| 33 interface [ |
| 34 Constructor(in [Callback] TestCallback testCallback), |
| 35 InterfaceName=TestObject |
| 36 ] TestObj { |
| 37 // Attributes |
| 38 readonly attribute long readOnlyIntAttr; |
| 39 readonly attribute DOMString readOnlyStringAttr; |
| 40 readonly attribute TestObj readOnlyTestObjAttr; |
| 41 attribute short shortAttr; |
| 42 attribute unsigned short unsignedShortAttr; |
| 43 attribute long intAttr; |
| 44 attribute long long longLongAttr; |
| 45 attribute unsigned long long unsignedLongLongAttr; |
| 46 attribute DOMString stringAttr; |
| 47 attribute TestObj testObjAttr; |
| 48 attribute sequence<ScriptProfile> sequenceAttr; |
| 49 |
| 50 JS, V8 |
| 51 // WK_ucfirst, WK_lcfirst exceptional cases. |
| 52 attribute TestObj XMLObjAttr; |
| 53 attribute boolean create; |
| 54 |
| 55 // Reflected DOM attributes |
| 56 attribute [Reflect] DOMString reflectedStringAttr; |
| 57 attribute [Reflect] long reflectedIntegralAttr; |
| 58 attribute [Reflect] unsigned long reflectedUnsignedIntegralAttr; |
| 59 attribute [Reflect] boolean reflectedBooleanAttr; |
| 60 attribute [Reflect, URL] DOMString reflectedURLAttr; |
| 61 attribute [Reflect=customContentStringAttr] DOMString reflectedStringAtt
r; |
| 62 attribute [Reflect=customContentIntegralAttr] long reflectedCustomIntegr
alAttr; |
| 63 attribute [Reflect=customContentBooleanAttr] boolean reflectedCustomBool
eanAttr; |
| 64 attribute [Reflect=customContentURLAttr, URL] DOMString reflectedCustomU
RLAttr; |
| 65 |
| 66 // Methods |
| 67 void voidMethod(); |
| 68 void voidMethodWithArgs(in long intArg, in DOMString strArg, in TestO
bj objArg); |
| 69 long intMethod(); |
| 70 long intMethodWithArgs(in long intArg, in DOMString strArg, in TestOb
j objArg); |
| 71 TestObj objMethod(); |
| 72 TestObj objMethodWithArgs(in long intArg, in DOMString strArg, in TestOb
j objArg); |
| 73 |
| 74 void methodWithSequenceArg(in sequence<ScriptProfile> sequenceArg); |
| 75 sequence<ScriptProfile> methodReturningSequence(in long intArg); |
| 76 |
| 77 TestObj methodThatRequiresAllArgsAndThrows(in DOMString strArg, in TestO
bj objArg) |
| 78 raises(DOMException); |
| 79 |
| 80 void serializedValue(in SerializedScriptValue serializedArg); |
| 81 void idbKey(in IDBKey key); |
| 82 void optionsObject(in Dictionary oo, in [Optional] Dictionary ooo); |
| 83 |
| 84 // Exceptions |
| 85 void methodWithException() raises(DOMException); |
| 86 attribute long attrWithGetterException getter raises(DOMException); |
| 87 attribute long attrWithSetterException setter raises(DOMException); |
| 88 attribute DOMString stringAttrWithGetterException getter raises(DOMExcep
tion); |
| 89 attribute DOMString stringAttrWithSetterException setter raises(DOMExcep
tion); |
| 90 |
| 91 // 'Custom' extended attribute |
| 92 attribute [Custom] long customAttr; |
| 93 [Custom] void customMethod(); |
| 94 [Custom] void customMethodWithArgs(in long intArg, in DOMString strArg,
in TestObj objArg); |
| 95 |
| 96 void addEventListener(in DOMString type, |
| 97 in EventListener listener, |
| 98 in [Optional] boolean useCapture); |
| 99 void removeEventListener(in DOMString type, |
| 100 in EventListener listener, |
| 101 in [Optional] boolean useCapture); |
| 102 |
| 103 // 'CallWith' extended attribute |
| 104 [CallWith=ScriptState] void withScriptStateVoid(); |
| 105 [CallWith=ScriptState] TestObj withScriptStateObj(); |
| 106 [CallWith=ScriptState] void withScriptStateVoidException() |
| 107 raises(DOMException); |
| 108 [CallWith=ScriptState] TestObj withScriptStateObjException() |
| 109 raises(DOMException); |
| 110 [CallWith=ScriptExecutionContext] void withScriptExecutionContext(); |
| 111 [CallWith=ScriptExecutionContext|ScriptState] void withScriptExecutionCo
ntextAndScriptState(); |
| 112 [CallWith=ScriptExecutionContext|ScriptState] TestObj withScriptExecutio
nContextAndScriptStateObjException() |
| 113 raises(DOMException); |
| 114 [CallWith= ScriptExecutionContext | ScriptState ] TestObj withScript
ExecutionContextAndScriptStateWithSpaces(); |
| 115 [CallWith=ScriptArguments|CallStack] void withScriptArgumentsAndCallStac
k(); |
| 116 |
| 117 attribute [CallWith=ScriptState] long withScriptStateAttribute; |
| 118 attribute [CallWith=ScriptExecutionContext] TestObj withScriptExecutionC
ontextAttribute; |
| 119 attribute [CallWith=ScriptState] TestObj withScriptStateAttributeRaises |
| 120 getter raises(DOMException); |
| 121 attribute [CallWith=ScriptExecutionContext] TestObj withScriptExecutionC
ontextAttributeRaises |
| 122 getter raises(DOMException); |
| 123 attribute [CallWith=ScriptExecutionContext|ScriptState] TestObj withScri
ptExecutionContextAndScriptStateAttribute; |
| 124 attribute [CallWith=ScriptExecutionContext|ScriptState] TestObj withScri
ptExecutionContextAndScriptStateAttributeRaises |
| 125 getter raises(DOMException); |
| 126 attribute [CallWith= ScriptExecutionContext | ScriptState ] TestObj
withScriptExecutionContextAndScriptStateWithSpacesAttribute; |
| 127 attribute [CallWith=ScriptArguments|CallStack] TestObj withScriptArgumen
tsAndCallStackAttribute; |
| 128 |
| 129 // 'Optional' extended attribute |
| 130 void methodWithOptionalArg(in [Optional] long opt); |
| 131 void methodWithNonOptionalArgAndOptionalArg(in long nonOpt, in [Optio
nal] long opt); |
| 132 void methodWithNonOptionalArgAndTwoOptionalArgs(in long nonOpt, in [O
ptional] long opt1, in [Optional] long opt2); |
| 133 void methodWithOptionalString(in [Optional] DOMString str); |
| 134 void methodWithOptionalStringIsUndefined(in [Optional=DefaultIsUndefi
ned] DOMString str); |
| 135 void methodWithOptionalStringIsNullString(in [Optional=DefaultIsNullS
tring] DOMString str); |
| 136 |
| 137 #if defined(TESTING_V8) || defined(TESTING_JS) |
| 138 // 'Callback' extended attribute |
| 139 void methodWithCallbackArg(in [Callback] TestCallback callback); |
| 140 void methodWithNonCallbackArgAndCallbackArg(in long nonCallback, in [
Callback] TestCallback callback); |
| 141 void methodWithCallbackAndOptionalArg(in [Callback, Optional] TestCal
lback callback); |
| 142 #endif |
| 143 |
| 144 // 'Conditional' extended attribute |
| 145 attribute [Conditional=Condition1] long conditionalAttr1; |
| 146 attribute [Conditional=Condition1&Condition2] long conditionalAttr2; |
| 147 attribute [Conditional=Condition1|Condition2] long conditionalAttr3; |
| 148 |
| 149 // 'Conditional' extended method |
| 150 [Conditional=Condition1] DOMString conditionalMethod1(); |
| 151 [Conditional=Condition1&Condition2] void conditionalMethod2(); |
| 152 [Conditional=Condition1|Condition2] void conditionalMethod3(); |
| 153 |
| 154 attribute [Conditional=Condition1] TestObjectAConstructor conditionalAtt
r4; |
| 155 attribute [Conditional=Condition1&Condition2] TestObjectBConstructor con
ditionalAttr5; |
| 156 attribute [Conditional=Condition1|Condition2] TestObjectCConstructor con
ditionalAttr6; |
| 157 |
| 158 [Conditional=Condition1] const unsigned short CONDITIONAL_CONST = 0; |
| 159 |
| 160 #if defined(TESTING_V8) || defined(TESTING_JS) |
| 161 readonly attribute [CachedAttribute] any cachedAttribute1; |
| 162 readonly attribute [CachedAttribute] any cachedAttribute2; |
| 163 #endif |
| 164 |
| 165 #if defined(TESTING_V8) || defined(TESTING_JS) |
| 166 // Overloads |
| 167 void overloadedMethod(in TestObj objArg, in DOMString strArg); |
| 168 void overloadedMethod(in TestObj objArg, in [Optional] long intArg); |
| 169 void overloadedMethod(in DOMString strArg); |
| 170 void overloadedMethod(in long intArg); |
| 171 void overloadedMethod(in [Callback] TestCallback callback); |
| 172 void overloadedMethod(in DOMStringList listArg); |
| 173 void overloadedMethod(in DOMString[] arrayArg); |
| 174 #endif |
| 175 |
| 176 // Class methods within JavaScript (like what's used for IDBKeyRange). |
| 177 static void classMethod(); |
| 178 static long classMethodWithOptional(in [Optional] long arg); |
| 179 [Custom] static void classMethod2(in long arg); |
| 180 |
| 181 // Static method with conditional on overloaded methods |
| 182 [Conditional=Condition1] static void overloadedMethod1(in long arg); |
| 183 [Conditional=Condition1] static void overloadedMethod1(in DOMString type
); |
| 184 |
| 185 #if defined(TESTING_V8) |
| 186 // 'V8EnabledAtRuntime' methods and attributes. |
| 187 [V8EnabledAtRuntime] void enabledAtRuntimeMethod1(in int intArg); |
| 188 [V8EnabledAtRuntime=FeatureName] void enabledAtRuntimeMethod2(in int int
Arg); |
| 189 attribute [V8EnabledAtRuntime] long enabledAtRuntimeAttr1; |
| 190 attribute [V8EnabledAtRuntime=FeatureName] long enabledAtRuntimeAttr2; |
| 191 #endif |
| 192 |
| 193 |
| 194 #if defined(TESTING_V8) |
| 195 attribute float[] floatArray; |
| 196 attribute double[] doubleArray; |
| 197 #endif |
| 198 |
| 199 #if defined(TESTING_JS) |
| 200 void methodWithUnsignedLongArray(in unsigned long[] unsignedLongArray); |
| 201 #endif |
| 202 |
| 203 readonly attribute [CheckSecurityForNode] Document contentDocument; |
| 204 [CheckSecurityForNode] SVGDocument getSVGDocument() |
| 205 raises(DOMException); |
| 206 |
| 207 void convert1(in [TreatReturnedNullStringAs=Null] a); |
| 208 void convert2(in [TreatReturnedNullStringAs=Undefined] b); |
| 209 void convert3(in [TreatReturnedNullStringAs=False] c); |
| 210 void convert4(in [TreatNullAs=NullString] d); |
| 211 void convert5(in [TreatNullAs=NullString, TreatUndefinedAs=NullString] e
); |
| 212 |
| 213 attribute SVGPoint mutablePoint; |
| 214 attribute [Immutable] SVGPoint immutablePoint; |
| 215 SVGPoint mutablePointFunction(); |
| 216 [Immutable] SVGPoint immutablePointFunction(); |
| 217 |
| 218 [ImplementedAs=banana] void orange(); |
| 219 attribute [ImplementedAs=blueberry] int strawberry; |
| 220 |
| 221 attribute [StrictTypeChecking] float strictFloat; |
| 222 [StrictTypeChecking] bool strictFunction(in DOMString str, in float a, i
n int b) |
| 223 raises(DOMException); |
| 224 |
| 225 // ObjectiveC reserved words. |
| 226 readonly attribute long description; |
| 227 attribute long id; |
| 228 readonly attribute DOMString hash; |
| 229 |
| 230 // Check constants and enums. |
| 231 const unsigned short CONST_VALUE_0 = 0; |
| 232 const unsigned short CONST_VALUE_1 = 1; |
| 233 const unsigned short CONST_VALUE_2 = 2; |
| 234 const unsigned short CONST_VALUE_4 = 4; |
| 235 const unsigned short CONST_VALUE_8 = 8; |
| 236 const short CONST_VALUE_9 = -1; |
| 237 const DOMString CONST_VALUE_10 = "my constant string"; |
| 238 const unsigned short CONST_VALUE_11 = 0xffffffff; |
| 239 const unsigned short CONST_VALUE_12 = 0x01; |
| 240 const unsigned short CONST_VALUE_13 = 0X20; |
| 241 const unsigned short CONST_VALUE_14 = 0x1abc; |
| 242 [Reflect=CONST_IMPL] const unsigned short CONST_JAVASCRIPT = 15; |
| 243 }; |
| 244 } |
OLD | NEW |