Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(422)

Side by Side Diff: Source/bindings/tests/results/V8TestInterface.cpp

Issue 14070022: add back TestPartialInterface bindings test (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 This file is part of the WebKit open source project. 2 This file is part of the WebKit open source project.
3 This file has been generated by generate-bindings.pl. DO NOT MODIFY! 3 This file has been generated by generate-bindings.pl. DO NOT MODIFY!
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public 6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either 7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version. 8 version 2 of the License, or (at your option) any later version.
9 9
10 This library is distributed in the hope that it will be useful, 10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details. 13 Library General Public License for more details.
14 14
15 You should have received a copy of the GNU Library General Public License 15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19 */ 19 */
20 20
21 #include "config.h" 21 #include "config.h"
22 #if ENABLE(Condition11) || ENABLE(Condition12) 22 #if ENABLE(Condition1) || ENABLE(Condition2)
23 #include "V8TestInterface.h" 23 #include "V8TestInterface.h"
24 24
25 #include "BindingState.h" 25 #include "BindingState.h"
26 #include "ContextFeatures.h" 26 #include "ContextFeatures.h"
27 #include "ExceptionCode.h" 27 #include "ExceptionCode.h"
28 #include "ScriptController.h" 28 #include "ScriptController.h"
29 #include "TestPartialInterface.h"
29 #include "V8Binding.h" 30 #include "V8Binding.h"
30 #include "V8DOMWrapper.h" 31 #include "V8DOMWrapper.h"
31 #include "V8Node.h" 32 #include "V8Node.h"
32 #include "V8TestObj.h" 33 #include "V8TestObj.h"
33 #include "core/page/Frame.h" 34 #include "core/page/Frame.h"
34 #include "core/page/RuntimeEnabledFeatures.h" 35 #include "core/page/RuntimeEnabledFeatures.h"
35 #include <wtf/GetPtr.h> 36 #include <wtf/GetPtr.h>
36 #include <wtf/RefCounted.h> 37 #include <wtf/RefCounted.h>
37 #include <wtf/RefPtr.h> 38 #include <wtf/RefPtr.h>
38 #include <wtf/UnusedParam.h> 39 #include <wtf/UnusedParam.h>
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 using WebCore::TestInterface; 81 using WebCore::TestInterface;
81 #endif 82 #endif
82 void initializeScriptWrappableForInterface(TestInterface* object) 83 void initializeScriptWrappableForInterface(TestInterface* object)
83 { 84 {
84 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) 85 if (ScriptWrappable::wrapperCanBeStoredInObject(object))
85 ScriptWrappable::setTypeInfoInObject(object, &V8TestInterface::info); 86 ScriptWrappable::setTypeInfoInObject(object, &V8TestInterface::info);
86 } 87 }
87 #if defined(OS_WIN) 88 #if defined(OS_WIN)
88 namespace WebCore { 89 namespace WebCore {
89 #endif 90 #endif
90 WrapperTypeInfo V8TestInterface::info = { V8TestInterface::GetTemplate, V8TestIn terface::derefObject, 0, 0, 0, V8TestInterface::installPerContextPrototypeProper ties, 0, WrapperTypeObjectPrototype }; 91 WrapperTypeInfo V8TestInterface::info = { V8TestInterface::GetTemplate, V8TestIn terface::derefObject, V8TestInterface::toActiveDOMObject, 0, 0, V8TestInterface: :installPerContextPrototypeProperties, 0, WrapperTypeObjectPrototype };
91 92
92 namespace TestInterfaceV8Internal { 93 namespace TestInterfaceV8Internal {
93 94
94 template <typename T> void V8_USE(T) { } 95 template <typename T> void V8_USE(T) { }
95 96
97 #if ENABLE(Condition11) || ENABLE(Condition12)
98
96 static v8::Handle<v8::Value> supplementalStaticReadOnlyAttrAttrGetter(v8::Local< v8::String> name, const v8::AccessorInfo& info) 99 static v8::Handle<v8::Value> supplementalStaticReadOnlyAttrAttrGetter(v8::Local< v8::String> name, const v8::AccessorInfo& info)
97 { 100 {
98 return v8Integer(TestInterface::supplementalStaticReadOnlyAttr(), info.GetIs olate()); 101 return v8Integer(TestPartialInterface::supplementalStaticReadOnlyAttr(), inf o.GetIsolate());
99 } 102 }
103
104 #endif // ENABLE(Condition11) || ENABLE(Condition12)
105
106 #if ENABLE(Condition11) || ENABLE(Condition12)
100 107
101 static v8::Handle<v8::Value> supplementalStaticReadOnlyAttrAttrGetterCallback(v8 ::Local<v8::String> name, const v8::AccessorInfo& info) 108 static v8::Handle<v8::Value> supplementalStaticReadOnlyAttrAttrGetterCallback(v8 ::Local<v8::String> name, const v8::AccessorInfo& info)
102 { 109 {
103 return TestInterfaceV8Internal::supplementalStaticReadOnlyAttrAttrGetter(nam e, info); 110 return TestInterfaceV8Internal::supplementalStaticReadOnlyAttrAttrGetter(nam e, info);
104 } 111 }
105 112
113 #endif // ENABLE(Condition11) || ENABLE(Condition12)
114
115 #if ENABLE(Condition11) || ENABLE(Condition12)
116
106 static v8::Handle<v8::Value> supplementalStaticAttrAttrGetter(v8::Local<v8::Stri ng> name, const v8::AccessorInfo& info) 117 static v8::Handle<v8::Value> supplementalStaticAttrAttrGetter(v8::Local<v8::Stri ng> name, const v8::AccessorInfo& info)
107 { 118 {
108 return v8String(TestInterface::supplementalStaticAttr(), info.GetIsolate(), ReturnUnsafeHandle); 119 return v8String(TestPartialInterface::supplementalStaticAttr(), info.GetIsol ate(), ReturnUnsafeHandle);
109 } 120 }
121
122 #endif // ENABLE(Condition11) || ENABLE(Condition12)
123
124 #if ENABLE(Condition11) || ENABLE(Condition12)
110 125
111 static v8::Handle<v8::Value> supplementalStaticAttrAttrGetterCallback(v8::Local< v8::String> name, const v8::AccessorInfo& info) 126 static v8::Handle<v8::Value> supplementalStaticAttrAttrGetterCallback(v8::Local< v8::String> name, const v8::AccessorInfo& info)
112 { 127 {
113 return TestInterfaceV8Internal::supplementalStaticAttrAttrGetter(name, info) ; 128 return TestInterfaceV8Internal::supplementalStaticAttrAttrGetter(name, info) ;
114 } 129 }
115 130
131 #endif // ENABLE(Condition11) || ENABLE(Condition12)
132
133 #if ENABLE(Condition11) || ENABLE(Condition12)
134
116 static void supplementalStaticAttrAttrSetter(v8::Local<v8::String> name, v8::Loc al<v8::Value> value, const v8::AccessorInfo& info) 135 static void supplementalStaticAttrAttrSetter(v8::Local<v8::String> name, v8::Loc al<v8::Value> value, const v8::AccessorInfo& info)
117 { 136 {
118 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, v, value); 137 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, v, value);
119 TestInterface::setSupplementalStaticAttr(v); 138 TestPartialInterface::setSupplementalStaticAttr(v);
120 return; 139 return;
121 } 140 }
122 141
142 #endif // ENABLE(Condition11) || ENABLE(Condition12)
143
144 #if ENABLE(Condition11) || ENABLE(Condition12)
145
123 static void supplementalStaticAttrAttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) 146 static void supplementalStaticAttrAttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
124 { 147 {
125 TestInterfaceV8Internal::supplementalStaticAttrAttrSetter(name, value, info) ; 148 TestInterfaceV8Internal::supplementalStaticAttrAttrSetter(name, value, info) ;
126 } 149 }
127 150
151 #endif // ENABLE(Condition11) || ENABLE(Condition12)
152
153 #if ENABLE(Condition11) || ENABLE(Condition12)
154
128 static v8::Handle<v8::Value> supplementalStr1AttrGetter(v8::Local<v8::String> na me, const v8::AccessorInfo& info) 155 static v8::Handle<v8::Value> supplementalStr1AttrGetter(v8::Local<v8::String> na me, const v8::AccessorInfo& info)
129 { 156 {
130 TestInterface* imp = V8TestInterface::toNative(info.Holder()); 157 TestInterface* imp = V8TestInterface::toNative(info.Holder());
131 return v8String(imp->supplementalStr1(), info.GetIsolate(), ReturnUnsafeHand le); 158 return v8String(TestPartialInterface::supplementalStr1(imp), info.GetIsolate (), ReturnUnsafeHandle);
132 } 159 }
160
161 #endif // ENABLE(Condition11) || ENABLE(Condition12)
162
163 #if ENABLE(Condition11) || ENABLE(Condition12)
133 164
134 static v8::Handle<v8::Value> supplementalStr1AttrGetterCallback(v8::Local<v8::St ring> name, const v8::AccessorInfo& info) 165 static v8::Handle<v8::Value> supplementalStr1AttrGetterCallback(v8::Local<v8::St ring> name, const v8::AccessorInfo& info)
135 { 166 {
136 return TestInterfaceV8Internal::supplementalStr1AttrGetter(name, info); 167 return TestInterfaceV8Internal::supplementalStr1AttrGetter(name, info);
137 } 168 }
138 169
170 #endif // ENABLE(Condition11) || ENABLE(Condition12)
171
172 #if ENABLE(Condition11) || ENABLE(Condition12)
173
139 static v8::Handle<v8::Value> supplementalStr2AttrGetter(v8::Local<v8::String> na me, const v8::AccessorInfo& info) 174 static v8::Handle<v8::Value> supplementalStr2AttrGetter(v8::Local<v8::String> na me, const v8::AccessorInfo& info)
140 { 175 {
141 TestInterface* imp = V8TestInterface::toNative(info.Holder()); 176 TestInterface* imp = V8TestInterface::toNative(info.Holder());
142 return v8String(imp->supplementalStr2(), info.GetIsolate(), ReturnUnsafeHand le); 177 return v8String(TestPartialInterface::supplementalStr2(imp), info.GetIsolate (), ReturnUnsafeHandle);
143 } 178 }
179
180 #endif // ENABLE(Condition11) || ENABLE(Condition12)
181
182 #if ENABLE(Condition11) || ENABLE(Condition12)
144 183
145 static v8::Handle<v8::Value> supplementalStr2AttrGetterCallback(v8::Local<v8::St ring> name, const v8::AccessorInfo& info) 184 static v8::Handle<v8::Value> supplementalStr2AttrGetterCallback(v8::Local<v8::St ring> name, const v8::AccessorInfo& info)
146 { 185 {
147 return TestInterfaceV8Internal::supplementalStr2AttrGetter(name, info); 186 return TestInterfaceV8Internal::supplementalStr2AttrGetter(name, info);
148 } 187 }
149 188
189 #endif // ENABLE(Condition11) || ENABLE(Condition12)
190
191 #if ENABLE(Condition11) || ENABLE(Condition12)
192
150 static void supplementalStr2AttrSetter(v8::Local<v8::String> name, v8::Local<v8: :Value> value, const v8::AccessorInfo& info) 193 static void supplementalStr2AttrSetter(v8::Local<v8::String> name, v8::Local<v8: :Value> value, const v8::AccessorInfo& info)
151 { 194 {
152 TestInterface* imp = V8TestInterface::toNative(info.Holder()); 195 TestInterface* imp = V8TestInterface::toNative(info.Holder());
153 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, v, value); 196 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, v, value);
154 imp->setSupplementalStr2(v); 197 TestPartialInterface::setSupplementalStr2(imp, v);
155 return; 198 return;
156 } 199 }
157 200
201 #endif // ENABLE(Condition11) || ENABLE(Condition12)
202
203 #if ENABLE(Condition11) || ENABLE(Condition12)
204
158 static void supplementalStr2AttrSetterCallback(v8::Local<v8::String> name, v8::L ocal<v8::Value> value, const v8::AccessorInfo& info) 205 static void supplementalStr2AttrSetterCallback(v8::Local<v8::String> name, v8::L ocal<v8::Value> value, const v8::AccessorInfo& info)
159 { 206 {
160 TestInterfaceV8Internal::supplementalStr2AttrSetter(name, value, info); 207 TestInterfaceV8Internal::supplementalStr2AttrSetter(name, value, info);
161 } 208 }
162 209
210 #endif // ENABLE(Condition11) || ENABLE(Condition12)
211
212 #if ENABLE(Condition11) || ENABLE(Condition12)
213
163 static v8::Handle<v8::Value> supplementalStr3AttrGetterCallback(v8::Local<v8::St ring> name, const v8::AccessorInfo& info) 214 static v8::Handle<v8::Value> supplementalStr3AttrGetterCallback(v8::Local<v8::St ring> name, const v8::AccessorInfo& info)
164 { 215 {
165 return V8TestInterface::supplementalStr3AttrGetterCustom(name, info); 216 return V8TestInterface::supplementalStr3AttrGetterCustom(name, info);
166 } 217 }
167 218
219 #endif // ENABLE(Condition11) || ENABLE(Condition12)
220
221 #if ENABLE(Condition11) || ENABLE(Condition12)
222
168 static void supplementalStr3AttrSetterCallback(v8::Local<v8::String> name, v8::L ocal<v8::Value> value, const v8::AccessorInfo& info) 223 static void supplementalStr3AttrSetterCallback(v8::Local<v8::String> name, v8::L ocal<v8::Value> value, const v8::AccessorInfo& info)
169 { 224 {
170 V8TestInterface::supplementalStr3AttrSetterCustom(name, value, info); 225 V8TestInterface::supplementalStr3AttrSetterCustom(name, value, info);
171 } 226 }
172 227
228 #endif // ENABLE(Condition11) || ENABLE(Condition12)
229
230 #if ENABLE(Condition11) || ENABLE(Condition12)
231
173 static v8::Handle<v8::Value> supplementalNodeAttrGetter(v8::Local<v8::String> na me, const v8::AccessorInfo& info) 232 static v8::Handle<v8::Value> supplementalNodeAttrGetter(v8::Local<v8::String> na me, const v8::AccessorInfo& info)
174 { 233 {
175 TestInterface* imp = V8TestInterface::toNative(info.Holder()); 234 TestInterface* imp = V8TestInterface::toNative(info.Holder());
176 return toV8Fast(imp->supplementalNode(), info, imp); 235 return toV8Fast(TestPartialInterface::supplementalNode(imp), info, imp);
177 } 236 }
237
238 #endif // ENABLE(Condition11) || ENABLE(Condition12)
239
240 #if ENABLE(Condition11) || ENABLE(Condition12)
178 241
179 static v8::Handle<v8::Value> supplementalNodeAttrGetterCallback(v8::Local<v8::St ring> name, const v8::AccessorInfo& info) 242 static v8::Handle<v8::Value> supplementalNodeAttrGetterCallback(v8::Local<v8::St ring> name, const v8::AccessorInfo& info)
180 { 243 {
181 return TestInterfaceV8Internal::supplementalNodeAttrGetter(name, info); 244 return TestInterfaceV8Internal::supplementalNodeAttrGetter(name, info);
182 } 245 }
183 246
247 #endif // ENABLE(Condition11) || ENABLE(Condition12)
248
249 #if ENABLE(Condition11) || ENABLE(Condition12)
250
184 static void supplementalNodeAttrSetter(v8::Local<v8::String> name, v8::Local<v8: :Value> value, const v8::AccessorInfo& info) 251 static void supplementalNodeAttrSetter(v8::Local<v8::String> name, v8::Local<v8: :Value> value, const v8::AccessorInfo& info)
185 { 252 {
186 TestInterface* imp = V8TestInterface::toNative(info.Holder()); 253 TestInterface* imp = V8TestInterface::toNative(info.Holder());
187 V8TRYCATCH_VOID(Node*, v, V8Node::HasInstance(value, info.GetIsolate(), worl dType(info.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(value) ) : 0); 254 V8TRYCATCH_VOID(Node*, v, V8Node::HasInstance(value, info.GetIsolate(), worl dType(info.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(value) ) : 0);
188 imp->setSupplementalNode(WTF::getPtr(v)); 255 TestPartialInterface::setSupplementalNode(imp, WTF::getPtr(v));
189 return; 256 return;
190 } 257 }
191 258
259 #endif // ENABLE(Condition11) || ENABLE(Condition12)
260
261 #if ENABLE(Condition11) || ENABLE(Condition12)
262
192 static void supplementalNodeAttrSetterCallback(v8::Local<v8::String> name, v8::L ocal<v8::Value> value, const v8::AccessorInfo& info) 263 static void supplementalNodeAttrSetterCallback(v8::Local<v8::String> name, v8::L ocal<v8::Value> value, const v8::AccessorInfo& info)
193 { 264 {
194 TestInterfaceV8Internal::supplementalNodeAttrSetter(name, value, info); 265 TestInterfaceV8Internal::supplementalNodeAttrSetter(name, value, info);
195 } 266 }
196 267
268 #endif // ENABLE(Condition11) || ENABLE(Condition12)
269
270 #if ENABLE(Condition11) || ENABLE(Condition12)
271
197 static v8::Handle<v8::Value> supplementalMethod1Method(const v8::Arguments& args ) 272 static v8::Handle<v8::Value> supplementalMethod1Method(const v8::Arguments& args )
198 { 273 {
199 TestInterface* imp = V8TestInterface::toNative(args.Holder()); 274 TestInterface* imp = V8TestInterface::toNative(args.Holder());
200 imp->supplementalMethod1(); 275 TestPartialInterface::supplementalMethod1(imp);
201 return v8Undefined(); 276 return v8Undefined();
202 } 277 }
203 278
279 #endif // ENABLE(Condition11) || ENABLE(Condition12)
280
281 #if ENABLE(Condition11) || ENABLE(Condition12)
282
204 static v8::Handle<v8::Value> supplementalMethod1MethodCallback(const v8::Argumen ts& args) 283 static v8::Handle<v8::Value> supplementalMethod1MethodCallback(const v8::Argumen ts& args)
205 { 284 {
206 return TestInterfaceV8Internal::supplementalMethod1Method(args); 285 return TestInterfaceV8Internal::supplementalMethod1Method(args);
207 } 286 }
208 287
288 #endif // ENABLE(Condition11) || ENABLE(Condition12)
289
290 #if ENABLE(Condition11) || ENABLE(Condition12)
291
209 static v8::Handle<v8::Value> supplementalMethod2Method(const v8::Arguments& args ) 292 static v8::Handle<v8::Value> supplementalMethod2Method(const v8::Arguments& args )
210 { 293 {
211 if (args.Length() < 2) 294 if (args.Length() < 2)
212 return throwNotEnoughArgumentsError(args.GetIsolate()); 295 return throwNotEnoughArgumentsError(args.GetIsolate());
213 TestInterface* imp = V8TestInterface::toNative(args.Holder()); 296 TestInterface* imp = V8TestInterface::toNative(args.Holder());
214 ExceptionCode ec = 0; 297 ExceptionCode ec = 0;
215 { 298 {
216 V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<>, strArg, args[0]); 299 V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<>, strArg, args[0]);
217 V8TRYCATCH(TestObj*, objArg, V8TestObj::HasInstance(args[1], args.GetIsolate (), worldType(args.GetIsolate())) ? V8TestObj::toNative(v8::Handle<v8::Object>:: Cast(args[1])) : 0); 300 V8TRYCATCH(TestObj*, objArg, V8TestObj::HasInstance(args[1], args.GetIsolate (), worldType(args.GetIsolate())) ? V8TestObj::toNative(v8::Handle<v8::Object>:: Cast(args[1])) : 0);
218 ScriptExecutionContext* scriptContext = getScriptExecutionContext(); 301 ScriptExecutionContext* scriptContext = getScriptExecutionContext();
219 RefPtr<TestObj> result = imp->supplementalMethod2(scriptContext, strArg, obj Arg, ec); 302 RefPtr<TestObj> result = TestPartialInterface::supplementalMethod2(scriptCon text, imp, strArg, objArg, ec);
220 if (UNLIKELY(ec)) 303 if (UNLIKELY(ec))
221 goto fail; 304 goto fail;
222 return toV8(result.release(), args.Holder(), args.GetIsolate()); 305 return toV8(result.release(), args.Holder(), args.GetIsolate());
223 } 306 }
224 fail: 307 fail:
225 return setDOMException(ec, args.GetIsolate()); 308 return setDOMException(ec, args.GetIsolate());
226 } 309 }
227 310
311 #endif // ENABLE(Condition11) || ENABLE(Condition12)
312
313 #if ENABLE(Condition11) || ENABLE(Condition12)
314
228 static v8::Handle<v8::Value> supplementalMethod2MethodCallback(const v8::Argumen ts& args) 315 static v8::Handle<v8::Value> supplementalMethod2MethodCallback(const v8::Argumen ts& args)
229 { 316 {
230 return TestInterfaceV8Internal::supplementalMethod2Method(args); 317 return TestInterfaceV8Internal::supplementalMethod2Method(args);
231 } 318 }
232 319
320 #endif // ENABLE(Condition11) || ENABLE(Condition12)
321
322 #if ENABLE(Condition11) || ENABLE(Condition12)
323
233 static v8::Handle<v8::Value> supplementalMethod3MethodCallback(const v8::Argumen ts& args) 324 static v8::Handle<v8::Value> supplementalMethod3MethodCallback(const v8::Argumen ts& args)
234 { 325 {
235 return V8TestInterface::supplementalMethod3MethodCustom(args); 326 return V8TestInterface::supplementalMethod3MethodCustom(args);
236 } 327 }
237 328
329 #endif // ENABLE(Condition11) || ENABLE(Condition12)
330
331 #if ENABLE(Condition11) || ENABLE(Condition12)
332
238 static v8::Handle<v8::Value> supplementalMethod4Method(const v8::Arguments& args ) 333 static v8::Handle<v8::Value> supplementalMethod4Method(const v8::Arguments& args )
239 { 334 {
240 TestInterface::supplementalMethod4(); 335 TestPartialInterface::supplementalMethod4();
241 return v8Undefined(); 336 return v8Undefined();
242 } 337 }
243 338
339 #endif // ENABLE(Condition11) || ENABLE(Condition12)
340
341 #if ENABLE(Condition11) || ENABLE(Condition12)
342
244 static v8::Handle<v8::Value> supplementalMethod4MethodCallback(const v8::Argumen ts& args) 343 static v8::Handle<v8::Value> supplementalMethod4MethodCallback(const v8::Argumen ts& args)
245 { 344 {
246 return TestInterfaceV8Internal::supplementalMethod4Method(args); 345 return TestInterfaceV8Internal::supplementalMethod4Method(args);
247 } 346 }
248 347
348 #endif // ENABLE(Condition11) || ENABLE(Condition12)
349
350 static v8::Handle<v8::Value> constructor(const v8::Arguments& args)
351 {
352 if (args.Length() < 1)
353 return throwNotEnoughArgumentsError(args.GetIsolate());
354
355 ExceptionCode ec = 0;
356 V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<>, str1, args[0]);
357 V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<>, str2, args[1]);
358
359 ScriptExecutionContext* context = getScriptExecutionContext();
360
361 RefPtr<TestInterface> impl = TestInterface::create(context, str1, str2, ec);
362 v8::Handle<v8::Object> wrapper = args.Holder();
363 if (ec)
364 goto fail;
365
366 V8DOMWrapper::associateObjectWithWrapper(impl.release(), &V8TestInterface::i nfo, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent);
367 return wrapper;
368 fail:
369 return setDOMException(ec, args.GetIsolate());
370 }
371
249 } // namespace TestInterfaceV8Internal 372 } // namespace TestInterfaceV8Internal
250 373
251 static const V8DOMConfiguration::BatchedAttribute V8TestInterfaceAttrs[] = { 374 static const V8DOMConfiguration::BatchedAttribute V8TestInterfaceAttrs[] = {
252 // Attribute 'supplementalStaticReadOnlyAttr' (Type: 'readonly attribute' Ex tAttr: '') 375 #if ENABLE(Condition11) || ENABLE(Condition12)
376 // Attribute 'supplementalStaticReadOnlyAttr' (Type: 'readonly attribute' Ex tAttr: 'Conditional ImplementedBy')
253 {"supplementalStaticReadOnlyAttr", TestInterfaceV8Internal::supplementalStat icReadOnlyAttrAttrGetterCallback, 0, 0, 0, 0 /* no data */, static_cast<v8::Acce ssControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on i nstance */}, 377 {"supplementalStaticReadOnlyAttr", TestInterfaceV8Internal::supplementalStat icReadOnlyAttrAttrGetterCallback, 0, 0, 0, 0 /* no data */, static_cast<v8::Acce ssControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on i nstance */},
254 // Attribute 'supplementalStaticAttr' (Type: 'attribute' ExtAttr: '') 378 #endif // ENABLE(Condition11) || ENABLE(Condition12)
379 #if ENABLE(Condition11) || ENABLE(Condition12)
380 // Attribute 'supplementalStaticAttr' (Type: 'attribute' ExtAttr: 'Condition al ImplementedBy')
255 {"supplementalStaticAttr", TestInterfaceV8Internal::supplementalStaticAttrAt trGetterCallback, TestInterfaceV8Internal::supplementalStaticAttrAttrSetterCallb ack, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_ cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 381 {"supplementalStaticAttr", TestInterfaceV8Internal::supplementalStaticAttrAt trGetterCallback, TestInterfaceV8Internal::supplementalStaticAttrAttrSetterCallb ack, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_ cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
256 // Attribute 'supplementalStr1' (Type: 'readonly attribute' ExtAttr: '') 382 #endif // ENABLE(Condition11) || ENABLE(Condition12)
383 #if ENABLE(Condition11) || ENABLE(Condition12)
384 // Attribute 'supplementalStr1' (Type: 'readonly attribute' ExtAttr: 'Condit ional ImplementedBy')
257 {"supplementalStr1", TestInterfaceV8Internal::supplementalStr1AttrGetterCall back, 0, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), sta tic_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 385 {"supplementalStr1", TestInterfaceV8Internal::supplementalStr1AttrGetterCall back, 0, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), sta tic_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
258 // Attribute 'supplementalStr2' (Type: 'attribute' ExtAttr: '') 386 #endif // ENABLE(Condition11) || ENABLE(Condition12)
387 #if ENABLE(Condition11) || ENABLE(Condition12)
388 // Attribute 'supplementalStr2' (Type: 'attribute' ExtAttr: 'Conditional Imp lementedBy')
259 {"supplementalStr2", TestInterfaceV8Internal::supplementalStr2AttrGetterCall back, TestInterfaceV8Internal::supplementalStr2AttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyA ttribute>(v8::None), 0 /* on instance */}, 389 {"supplementalStr2", TestInterfaceV8Internal::supplementalStr2AttrGetterCall back, TestInterfaceV8Internal::supplementalStr2AttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyA ttribute>(v8::None), 0 /* on instance */},
260 // Attribute 'supplementalStr3' (Type: 'attribute' ExtAttr: 'CustomSetter Cu stomGetter') 390 #endif // ENABLE(Condition11) || ENABLE(Condition12)
391 #if ENABLE(Condition11) || ENABLE(Condition12)
392 // Attribute 'supplementalStr3' (Type: 'attribute' ExtAttr: 'CustomSetter Cu stomGetter Conditional ImplementedBy')
261 {"supplementalStr3", TestInterfaceV8Internal::supplementalStr3AttrGetterCall back, TestInterfaceV8Internal::supplementalStr3AttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyA ttribute>(v8::None), 0 /* on instance */}, 393 {"supplementalStr3", TestInterfaceV8Internal::supplementalStr3AttrGetterCall back, TestInterfaceV8Internal::supplementalStr3AttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyA ttribute>(v8::None), 0 /* on instance */},
262 // Attribute 'supplementalNode' (Type: 'attribute' ExtAttr: '') 394 #endif // ENABLE(Condition11) || ENABLE(Condition12)
395 #if ENABLE(Condition11) || ENABLE(Condition12)
396 // Attribute 'supplementalNode' (Type: 'attribute' ExtAttr: 'Conditional Imp lementedBy')
263 {"supplementalNode", TestInterfaceV8Internal::supplementalNodeAttrGetterCall back, TestInterfaceV8Internal::supplementalNodeAttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyA ttribute>(v8::None), 0 /* on instance */}, 397 {"supplementalNode", TestInterfaceV8Internal::supplementalNodeAttrGetterCall back, TestInterfaceV8Internal::supplementalNodeAttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyA ttribute>(v8::None), 0 /* on instance */},
398 #endif // ENABLE(Condition11) || ENABLE(Condition12)
264 }; 399 };
265 400
266 static const V8DOMConfiguration::BatchedMethod V8TestInterfaceMethods[] = { 401 static const V8DOMConfiguration::BatchedMethod V8TestInterfaceMethods[] = {
402 #if ENABLE(Condition11) || ENABLE(Condition12)
267 {"supplementalMethod1", TestInterfaceV8Internal::supplementalMethod1MethodCa llback, 0, 0}, 403 {"supplementalMethod1", TestInterfaceV8Internal::supplementalMethod1MethodCa llback, 0, 0},
404 #endif
405 #if ENABLE(Condition11) || ENABLE(Condition12)
268 {"supplementalMethod3", TestInterfaceV8Internal::supplementalMethod3MethodCa llback, 0, 0}, 406 {"supplementalMethod3", TestInterfaceV8Internal::supplementalMethod3MethodCa llback, 0, 0},
407 #endif
269 }; 408 };
270 409
271 static const V8DOMConfiguration::BatchedConstant V8TestInterfaceConsts[] = { 410 static const V8DOMConfiguration::BatchedConstant V8TestInterfaceConsts[] = {
411 #if ENABLE(Condition11) || ENABLE(Condition12)
272 {"SUPPLEMENTALCONSTANT1", 1}, 412 {"SUPPLEMENTALCONSTANT1", 1},
413 #endif
414 #if ENABLE(Condition11) || ENABLE(Condition12)
273 {"SUPPLEMENTALCONSTANT2", 2}, 415 {"SUPPLEMENTALCONSTANT2", 2},
416 #endif
274 }; 417 };
275 418
276 419
277 COMPILE_ASSERT(1 == TestInterface::SUPPLEMENTALCONSTANT1, TestInterfaceEnumSUPPL EMENTALCONSTANT1IsWrongUseDoNotCheckConstants); 420 #if ENABLE(Condition11) || ENABLE(Condition12)
278 COMPILE_ASSERT(2 == TestInterface::CONST_IMPL, TestInterfaceEnumCONST_IMPLIsWron gUseDoNotCheckConstants); 421 COMPILE_ASSERT(1 == TestPartialInterface::SUPPLEMENTALCONSTANT1, TestInterfaceEn umSUPPLEMENTALCONSTANT1IsWrongUseDoNotCheckConstants);
422 #endif
423 #if ENABLE(Condition11) || ENABLE(Condition12)
424 COMPILE_ASSERT(2 == TestPartialInterface::CONST_IMPL, TestInterfaceEnumCONST_IMP LIsWrongUseDoNotCheckConstants);
425 #endif
426
427 v8::Handle<v8::Value> V8TestInterface::constructorCallback(const v8::Arguments& args)
428 {
429 if (!args.IsConstructCall())
430 return throwTypeError("DOM object constructor cannot be called as a func tion.", args.GetIsolate());
431
432 if (ConstructorMode::current() == ConstructorMode::WrapExistingObject)
433 return args.Holder();
434
435 return TestInterfaceV8Internal::constructor(args);
436 }
279 437
280 static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestInterfaceTemplate(v8: :Persistent<v8::FunctionTemplate> desc, v8::Isolate* isolate, WrapperWorldType c urrentWorldType) 438 static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestInterfaceTemplate(v8: :Persistent<v8::FunctionTemplate> desc, v8::Isolate* isolate, WrapperWorldType c urrentWorldType)
281 { 439 {
282 desc->ReadOnlyPrototype(); 440 desc->ReadOnlyPrototype();
283 441
284 v8::Local<v8::Signature> defaultSignature; 442 v8::Local<v8::Signature> defaultSignature;
285 defaultSignature = V8DOMConfiguration::configureTemplate(desc, "TestInterfac e", v8::Persistent<v8::FunctionTemplate>(), V8TestInterface::internalFieldCount, 443 defaultSignature = V8DOMConfiguration::configureTemplate(desc, "TestInterfac e", v8::Persistent<v8::FunctionTemplate>(), V8TestInterface::internalFieldCount,
286 V8TestInterfaceAttrs, WTF_ARRAY_LENGTH(V8TestInterfaceAttrs), 444 V8TestInterfaceAttrs, WTF_ARRAY_LENGTH(V8TestInterfaceAttrs),
287 V8TestInterfaceMethods, WTF_ARRAY_LENGTH(V8TestInterfaceMethods), isolat e, currentWorldType); 445 V8TestInterfaceMethods, WTF_ARRAY_LENGTH(V8TestInterfaceMethods), isolat e, currentWorldType);
288 UNUSED_PARAM(defaultSignature); // In some cases, it will not be used. 446 UNUSED_PARAM(defaultSignature); // In some cases, it will not be used.
447 desc->SetCallHandler(V8TestInterface::constructorCallback);
448 desc->SetLength(1);
289 v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate(); 449 v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
290 v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate(); 450 v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();
291 UNUSED_PARAM(instance); // In some cases, it will not be used. 451 UNUSED_PARAM(instance); // In some cases, it will not be used.
292 UNUSED_PARAM(proto); // In some cases, it will not be used. 452 UNUSED_PARAM(proto); // In some cases, it will not be used.
293 453
294 // Custom Signature 'supplementalMethod2' 454 // Custom Signature 'supplementalMethod2'
295 const int supplementalMethod2Argc = 2; 455 const int supplementalMethod2Argc = 2;
296 v8::Handle<v8::FunctionTemplate> supplementalMethod2Argv[supplementalMethod2 Argc] = { v8::Handle<v8::FunctionTemplate>(), V8PerIsolateData::from(isolate)->r awTemplate(&V8TestObj::info, currentWorldType) }; 456 v8::Handle<v8::FunctionTemplate> supplementalMethod2Argv[supplementalMethod2 Argc] = { v8::Handle<v8::FunctionTemplate>(), V8PerIsolateData::from(isolate)->r awTemplate(&V8TestObj::info, currentWorldType) };
297 v8::Handle<v8::Signature> supplementalMethod2Signature = v8::Signature::New( desc, supplementalMethod2Argc, supplementalMethod2Argv); 457 v8::Handle<v8::Signature> supplementalMethod2Signature = v8::Signature::New( desc, supplementalMethod2Argc, supplementalMethod2Argv);
458 #if ENABLE(Condition11) || ENABLE(Condition12)
298 proto->Set(v8::String::NewSymbol("supplementalMethod2"), v8::FunctionTemplat e::New(TestInterfaceV8Internal::supplementalMethod2MethodCallback, v8Undefined() , supplementalMethod2Signature, 2)); 459 proto->Set(v8::String::NewSymbol("supplementalMethod2"), v8::FunctionTemplat e::New(TestInterfaceV8Internal::supplementalMethod2MethodCallback, v8Undefined() , supplementalMethod2Signature, 2));
460 #endif // ENABLE(Condition11) || ENABLE(Condition12)
461 #if ENABLE(Condition11) || ENABLE(Condition12)
299 desc->Set(v8::String::NewSymbol("supplementalMethod4"), v8::FunctionTemplate ::New(TestInterfaceV8Internal::supplementalMethod4MethodCallback, v8Undefined(), v8::Local<v8::Signature>(), 0)); 462 desc->Set(v8::String::NewSymbol("supplementalMethod4"), v8::FunctionTemplate ::New(TestInterfaceV8Internal::supplementalMethod4MethodCallback, v8Undefined(), v8::Local<v8::Signature>(), 0));
463 #endif // ENABLE(Condition11) || ENABLE(Condition12)
300 V8DOMConfiguration::batchConfigureConstants(desc, proto, V8TestInterfaceCons ts, WTF_ARRAY_LENGTH(V8TestInterfaceConsts), isolate); 464 V8DOMConfiguration::batchConfigureConstants(desc, proto, V8TestInterfaceCons ts, WTF_ARRAY_LENGTH(V8TestInterfaceConsts), isolate);
301 465
302 // Custom toString template 466 // Custom toString template
303 desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->to StringTemplate()); 467 desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->to StringTemplate());
304 return desc; 468 return desc;
305 } 469 }
306 470
307 v8::Persistent<v8::FunctionTemplate> V8TestInterface::GetTemplate(v8::Isolate* i solate, WrapperWorldType currentWorldType) 471 v8::Persistent<v8::FunctionTemplate> V8TestInterface::GetTemplate(v8::Isolate* i solate, WrapperWorldType currentWorldType)
308 { 472 {
309 V8PerIsolateData* data = V8PerIsolateData::from(isolate); 473 V8PerIsolateData* data = V8PerIsolateData::from(isolate);
(...skipping 13 matching lines...) Expand all
323 return V8PerIsolateData::from(isolate)->hasInstance(&info, value, currentWor ldType); 487 return V8PerIsolateData::from(isolate)->hasInstance(&info, value, currentWor ldType);
324 } 488 }
325 489
326 bool V8TestInterface::HasInstanceInAnyWorld(v8::Handle<v8::Value> value, v8::Iso late* isolate) 490 bool V8TestInterface::HasInstanceInAnyWorld(v8::Handle<v8::Value> value, v8::Iso late* isolate)
327 { 491 {
328 return V8PerIsolateData::from(isolate)->hasInstance(&info, value, MainWorld) 492 return V8PerIsolateData::from(isolate)->hasInstance(&info, value, MainWorld)
329 || V8PerIsolateData::from(isolate)->hasInstance(&info, value, IsolatedWo rld) 493 || V8PerIsolateData::from(isolate)->hasInstance(&info, value, IsolatedWo rld)
330 || V8PerIsolateData::from(isolate)->hasInstance(&info, value, WorkerWorl d); 494 || V8PerIsolateData::from(isolate)->hasInstance(&info, value, WorkerWorl d);
331 } 495 }
332 496
497 ActiveDOMObject* V8TestInterface::toActiveDOMObject(v8::Handle<v8::Object> objec t)
498 {
499 return toNative(object);
500 }
501
333 502
334 v8::Handle<v8::Object> V8TestInterface::createWrapper(PassRefPtr<TestInterface> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) 503 v8::Handle<v8::Object> V8TestInterface::createWrapper(PassRefPtr<TestInterface> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
335 { 504 {
336 ASSERT(impl.get()); 505 ASSERT(impl.get());
337 ASSERT(DOMDataStore::getWrapper(impl.get(), isolate).IsEmpty()); 506 ASSERT(DOMDataStore::getWrapper(impl.get(), isolate).IsEmpty());
338 507
339 #if ENABLE(BINDING_INTEGRITY) 508 #if ENABLE(BINDING_INTEGRITY)
340 checkTypeOrDieTrying(impl.get()); 509 checkTypeOrDieTrying(impl.get());
341 #endif 510 #endif
342 511
343 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext , &info, impl.get(), isolate); 512 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext , &info, impl.get(), isolate);
344 if (UNLIKELY(wrapper.IsEmpty())) 513 if (UNLIKELY(wrapper.IsEmpty()))
345 return wrapper; 514 return wrapper;
346 515
347 installPerContextProperties(wrapper, impl.get(), isolate); 516 installPerContextProperties(wrapper, impl.get(), isolate);
348 V8DOMWrapper::associateObjectWithWrapper(impl, &info, wrapper, isolate, hasD ependentLifetime ? WrapperConfiguration::Dependent : WrapperConfiguration::Indep endent); 517 V8DOMWrapper::associateObjectWithWrapper(impl, &info, wrapper, isolate, hasD ependentLifetime ? WrapperConfiguration::Dependent : WrapperConfiguration::Indep endent);
349 return wrapper; 518 return wrapper;
350 } 519 }
351 void V8TestInterface::derefObject(void* object) 520 void V8TestInterface::derefObject(void* object)
352 { 521 {
353 static_cast<TestInterface*>(object)->deref(); 522 static_cast<TestInterface*>(object)->deref();
354 } 523 }
355 524
356 } // namespace WebCore 525 } // namespace WebCore
357 526
358 #endif // ENABLE(Condition11) || ENABLE(Condition12) 527 #endif // ENABLE(Condition1) || ENABLE(Condition2)
OLDNEW
« no previous file with comments | « Source/bindings/tests/results/V8TestInterface.h ('k') | Source/bindings/tests/results/V8TestObj.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698