OLD | NEW |
(Empty) | |
| 1 /* |
| 2 This file is part of the Blink open source project. |
| 3 This file has been auto-generated by CodeGeneratorV8.pm. DO NOT MODIFY! |
| 4 |
| 5 This library is free software; you can redistribute it and/or |
| 6 modify it under the terms of the GNU Library General Public |
| 7 License as published by the Free Software Foundation; either |
| 8 version 2 of the License, or (at your option) any later version. |
| 9 |
| 10 This library is distributed in the hope that it will be useful, |
| 11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 Library General Public License for more details. |
| 14 |
| 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 |
| 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
| 18 Boston, MA 02111-1307, USA. |
| 19 */ |
| 20 |
| 21 #include "config.h" |
| 22 #include "V8SupportTestInterface.h" |
| 23 |
| 24 #include "RuntimeEnabledFeatures.h" |
| 25 #include "V8Node.h" |
| 26 #include "V8TestObject.h" |
| 27 #include "bindings/tests/idls/testing/SupportTestPartialInterface.h" |
| 28 #include "bindings/v8/ExceptionMessages.h" |
| 29 #include "bindings/v8/ExceptionState.h" |
| 30 #include "bindings/v8/ScriptController.h" |
| 31 #include "bindings/v8/V8Binding.h" |
| 32 #include "bindings/v8/V8DOMConfiguration.h" |
| 33 #include "bindings/v8/V8DOMWrapper.h" |
| 34 #include "core/dom/ContextFeatures.h" |
| 35 #include "core/dom/Document.h" |
| 36 #include "platform/TraceEvent.h" |
| 37 #include "wtf/GetPtr.h" |
| 38 #include "wtf/RefPtr.h" |
| 39 #include "wtf/UnusedParam.h" |
| 40 |
| 41 namespace WebCore { |
| 42 |
| 43 static void initializeScriptWrappableForInterface(SupportTestInterface* object) |
| 44 { |
| 45 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) |
| 46 ScriptWrappable::setTypeInfoInObject(object, &V8SupportTestInterface::in
fo); |
| 47 else |
| 48 ASSERT_NOT_REACHED(); |
| 49 } |
| 50 |
| 51 } // namespace WebCore |
| 52 |
| 53 // In ScriptWrappable::init, the use of a local function declaration has an issu
e on Windows: |
| 54 // the local declaration does not pick up the surrounding namespace. Therefore,
we provide this function |
| 55 // in the global namespace. |
| 56 // (More info on the MSVC bug here: http://connect.microsoft.com/VisualStudio/fe
edback/details/664619/the-namespace-of-local-function-declarations-in-c) |
| 57 void webCoreInitializeScriptWrappableForInterface(WebCore::SupportTestInterface*
object) |
| 58 { |
| 59 WebCore::initializeScriptWrappableForInterface(object); |
| 60 } |
| 61 |
| 62 namespace WebCore { |
| 63 WrapperTypeInfo V8SupportTestInterface::info = { V8SupportTestInterface::GetTemp
late, V8SupportTestInterface::derefObject, 0, 0, 0, V8SupportTestInterface::inst
allPerContextPrototypeProperties, 0, WrapperTypeObjectPrototype }; |
| 64 |
| 65 namespace SupportTestInterfaceV8Internal { |
| 66 |
| 67 template <typename T> void V8_USE(T) { } |
| 68 |
| 69 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 70 static void supplementalStaticReadOnlyAttrAttributeGetter(v8::Local<v8::String>
name, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 71 { |
| 72 v8SetReturnValueInt(info, SupportTestPartialInterface::supplementalStaticRea
dOnlyAttr()); |
| 73 } |
| 74 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 75 |
| 76 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 77 static void supplementalStaticReadOnlyAttrAttributeGetterCallback(v8::Local<v8::
String> name, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 78 { |
| 79 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
| 80 SupportTestInterfaceV8Internal::supplementalStaticReadOnlyAttrAttributeGette
r(name, info); |
| 81 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 82 } |
| 83 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 84 |
| 85 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 86 static void supplementalStaticAttrAttributeGetter(v8::Local<v8::String> name, co
nst v8::PropertyCallbackInfo<v8::Value>& info) |
| 87 { |
| 88 v8SetReturnValueString(info, SupportTestPartialInterface::supplementalStatic
Attr(), info.GetIsolate()); |
| 89 } |
| 90 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 91 |
| 92 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 93 static void supplementalStaticAttrAttributeGetterCallback(v8::Local<v8::String>
name, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 94 { |
| 95 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
| 96 SupportTestInterfaceV8Internal::supplementalStaticAttrAttributeGetter(name,
info); |
| 97 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 98 } |
| 99 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 100 |
| 101 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 102 |
| 103 static void supplementalStaticAttrAttributeSetter(v8::Local<v8::String> name, v8
::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) |
| 104 { |
| 105 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, v, value); |
| 106 SupportTestPartialInterface::setSupplementalStaticAttr(v); |
| 107 } |
| 108 |
| 109 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 110 |
| 111 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 112 |
| 113 static void supplementalStaticAttrAttributeSetterCallback(v8::Local<v8::String>
name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) |
| 114 { |
| 115 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); |
| 116 SupportTestInterfaceV8Internal::supplementalStaticAttrAttributeSetter(name,
value, info); |
| 117 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 118 } |
| 119 |
| 120 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 121 |
| 122 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 123 static void supplementalStr1AttributeGetter(v8::Local<v8::String> name, const v8
::PropertyCallbackInfo<v8::Value>& info) |
| 124 { |
| 125 SupportTestInterface* imp = V8SupportTestInterface::toNative(info.Holder()); |
| 126 v8SetReturnValueString(info, SupportTestPartialInterface::supplementalStr1(i
mp), info.GetIsolate()); |
| 127 } |
| 128 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 129 |
| 130 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 131 static void supplementalStr1AttributeGetterCallback(v8::Local<v8::String> name,
const v8::PropertyCallbackInfo<v8::Value>& info) |
| 132 { |
| 133 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
| 134 SupportTestInterfaceV8Internal::supplementalStr1AttributeGetter(name, info); |
| 135 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 136 } |
| 137 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 138 |
| 139 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 140 static void supplementalStr2AttributeGetter(v8::Local<v8::String> name, const v8
::PropertyCallbackInfo<v8::Value>& info) |
| 141 { |
| 142 SupportTestInterface* imp = V8SupportTestInterface::toNative(info.Holder()); |
| 143 v8SetReturnValueString(info, SupportTestPartialInterface::supplementalStr2(i
mp), info.GetIsolate()); |
| 144 } |
| 145 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 146 |
| 147 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 148 static void supplementalStr2AttributeGetterCallback(v8::Local<v8::String> name,
const v8::PropertyCallbackInfo<v8::Value>& info) |
| 149 { |
| 150 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
| 151 SupportTestInterfaceV8Internal::supplementalStr2AttributeGetter(name, info); |
| 152 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 153 } |
| 154 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 155 |
| 156 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 157 |
| 158 static void supplementalStr2AttributeSetter(v8::Local<v8::String> name, v8::Loca
l<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) |
| 159 { |
| 160 SupportTestInterface* imp = V8SupportTestInterface::toNative(info.Holder()); |
| 161 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, v, value); |
| 162 SupportTestPartialInterface::setSupplementalStr2(imp, v); |
| 163 } |
| 164 |
| 165 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 166 |
| 167 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 168 |
| 169 static void supplementalStr2AttributeSetterCallback(v8::Local<v8::String> name,
v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) |
| 170 { |
| 171 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); |
| 172 SupportTestInterfaceV8Internal::supplementalStr2AttributeSetter(name, value,
info); |
| 173 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 174 } |
| 175 |
| 176 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 177 |
| 178 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 179 static void supplementalStr3AttributeGetterCallback(v8::Local<v8::String> name,
const v8::PropertyCallbackInfo<v8::Value>& info) |
| 180 { |
| 181 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
| 182 V8SupportTestInterface::supplementalStr3AttributeGetterCustom(name, info); |
| 183 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 184 } |
| 185 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 186 |
| 187 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 188 |
| 189 static void supplementalStr3AttributeSetterCallback(v8::Local<v8::String> name,
v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) |
| 190 { |
| 191 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); |
| 192 V8SupportTestInterface::supplementalStr3AttributeSetterCustom(name, value, i
nfo); |
| 193 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 194 } |
| 195 |
| 196 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 197 |
| 198 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 199 static void supplementalNodeAttributeGetter(v8::Local<v8::String> name, const v8
::PropertyCallbackInfo<v8::Value>& info) |
| 200 { |
| 201 SupportTestInterface* imp = V8SupportTestInterface::toNative(info.Holder()); |
| 202 v8SetReturnValueFast(info, SupportTestPartialInterface::supplementalNode(imp
), imp); |
| 203 } |
| 204 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 205 |
| 206 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 207 static void supplementalNodeAttributeGetterCallback(v8::Local<v8::String> name,
const v8::PropertyCallbackInfo<v8::Value>& info) |
| 208 { |
| 209 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
| 210 SupportTestInterfaceV8Internal::supplementalNodeAttributeGetter(name, info); |
| 211 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 212 } |
| 213 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 214 |
| 215 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 216 |
| 217 static void supplementalNodeAttributeSetter(v8::Local<v8::String> name, v8::Loca
l<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) |
| 218 { |
| 219 SupportTestInterface* imp = V8SupportTestInterface::toNative(info.Holder()); |
| 220 V8TRYCATCH_VOID(Node*, v, V8Node::HasInstance(value, info.GetIsolate(), worl
dType(info.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(value)
) : 0); |
| 221 SupportTestPartialInterface::setSupplementalNode(imp, WTF::getPtr(v)); |
| 222 } |
| 223 |
| 224 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 225 |
| 226 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 227 |
| 228 static void supplementalNodeAttributeSetterCallback(v8::Local<v8::String> name,
v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) |
| 229 { |
| 230 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); |
| 231 SupportTestInterfaceV8Internal::supplementalNodeAttributeSetter(name, value,
info); |
| 232 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 233 } |
| 234 |
| 235 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 236 |
| 237 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 238 static void Node13AttributeGetter(v8::Local<v8::String> name, const v8::Property
CallbackInfo<v8::Value>& info) |
| 239 { |
| 240 SupportTestInterface* imp = V8SupportTestInterface::toNative(info.Holder()); |
| 241 v8SetReturnValueFast(info, SupportTestPartialInterface::node13(imp), imp); |
| 242 } |
| 243 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 244 |
| 245 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 246 static void Node13AttributeGetterCallback(v8::Local<v8::String> name, const v8::
PropertyCallbackInfo<v8::Value>& info) |
| 247 { |
| 248 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
| 249 SupportTestInterfaceV8Internal::Node13AttributeGetter(name, info); |
| 250 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 251 } |
| 252 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 253 |
| 254 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 255 |
| 256 static void Node13AttributeSetter(v8::Local<v8::String> name, v8::Local<v8::Valu
e> value, const v8::PropertyCallbackInfo<void>& info) |
| 257 { |
| 258 SupportTestInterface* imp = V8SupportTestInterface::toNative(info.Holder()); |
| 259 V8TRYCATCH_VOID(Node*, v, V8Node::HasInstance(value, info.GetIsolate(), worl
dType(info.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(value)
) : 0); |
| 260 SupportTestPartialInterface::setNode13(imp, WTF::getPtr(v)); |
| 261 } |
| 262 |
| 263 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 264 |
| 265 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 266 |
| 267 static void Node13AttributeSetterCallback(v8::Local<v8::String> name, v8::Local<
v8::Value> value, const v8::PropertyCallbackInfo<void>& info) |
| 268 { |
| 269 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); |
| 270 SupportTestInterfaceV8Internal::Node13AttributeSetter(name, value, info); |
| 271 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 272 } |
| 273 |
| 274 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 275 |
| 276 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 277 static void Node14AttributeGetter(v8::Local<v8::String> name, const v8::Property
CallbackInfo<v8::Value>& info) |
| 278 { |
| 279 SupportTestInterface* imp = V8SupportTestInterface::toNative(info.Holder()); |
| 280 v8SetReturnValueFast(info, SupportTestPartialInterface::node14(imp), imp); |
| 281 } |
| 282 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 283 |
| 284 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 285 static void Node14AttributeGetterCallback(v8::Local<v8::String> name, const v8::
PropertyCallbackInfo<v8::Value>& info) |
| 286 { |
| 287 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
| 288 SupportTestInterfaceV8Internal::Node14AttributeGetter(name, info); |
| 289 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 290 } |
| 291 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 292 |
| 293 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 294 |
| 295 static void Node14AttributeSetter(v8::Local<v8::String> name, v8::Local<v8::Valu
e> value, const v8::PropertyCallbackInfo<void>& info) |
| 296 { |
| 297 SupportTestInterface* imp = V8SupportTestInterface::toNative(info.Holder()); |
| 298 V8TRYCATCH_VOID(Node*, v, V8Node::HasInstance(value, info.GetIsolate(), worl
dType(info.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(value)
) : 0); |
| 299 SupportTestPartialInterface::setNode14(imp, WTF::getPtr(v)); |
| 300 } |
| 301 |
| 302 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 303 |
| 304 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 305 |
| 306 static void Node14AttributeSetterCallback(v8::Local<v8::String> name, v8::Local<
v8::Value> value, const v8::PropertyCallbackInfo<void>& info) |
| 307 { |
| 308 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); |
| 309 SupportTestInterfaceV8Internal::Node14AttributeSetter(name, value, info); |
| 310 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 311 } |
| 312 |
| 313 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 314 |
| 315 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 316 static void Node15AttributeGetter(v8::Local<v8::String> name, const v8::Property
CallbackInfo<v8::Value>& info) |
| 317 { |
| 318 SupportTestInterface* imp = V8SupportTestInterface::toNative(info.Holder()); |
| 319 v8SetReturnValueFast(info, SupportTestPartialInterface::node15(imp), imp); |
| 320 } |
| 321 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 322 |
| 323 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 324 static void Node15AttributeGetterCallback(v8::Local<v8::String> name, const v8::
PropertyCallbackInfo<v8::Value>& info) |
| 325 { |
| 326 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
| 327 SupportTestInterfaceV8Internal::Node15AttributeGetter(name, info); |
| 328 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 329 } |
| 330 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 331 |
| 332 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 333 |
| 334 static void Node15AttributeSetter(v8::Local<v8::String> name, v8::Local<v8::Valu
e> value, const v8::PropertyCallbackInfo<void>& info) |
| 335 { |
| 336 SupportTestInterface* imp = V8SupportTestInterface::toNative(info.Holder()); |
| 337 V8TRYCATCH_VOID(Node*, v, V8Node::HasInstance(value, info.GetIsolate(), worl
dType(info.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(value)
) : 0); |
| 338 SupportTestPartialInterface::setNode15(imp, WTF::getPtr(v)); |
| 339 } |
| 340 |
| 341 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 342 |
| 343 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 344 |
| 345 static void Node15AttributeSetterCallback(v8::Local<v8::String> name, v8::Local<
v8::Value> value, const v8::PropertyCallbackInfo<void>& info) |
| 346 { |
| 347 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); |
| 348 SupportTestInterfaceV8Internal::Node15AttributeSetter(name, value, info); |
| 349 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 350 } |
| 351 |
| 352 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 353 |
| 354 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 355 |
| 356 static void supplementalMethod1Method(const v8::FunctionCallbackInfo<v8::Value>&
args) |
| 357 { |
| 358 SupportTestInterface* imp = V8SupportTestInterface::toNative(args.Holder()); |
| 359 SupportTestPartialInterface::supplementalMethod1(imp); |
| 360 |
| 361 return; |
| 362 } |
| 363 |
| 364 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 365 |
| 366 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 367 |
| 368 static void supplementalMethod1MethodCallback(const v8::FunctionCallbackInfo<v8:
:Value>& args) |
| 369 { |
| 370 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
| 371 SupportTestInterfaceV8Internal::supplementalMethod1Method(args); |
| 372 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 373 } |
| 374 |
| 375 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 376 |
| 377 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 378 |
| 379 static void supplementalMethod2Method(const v8::FunctionCallbackInfo<v8::Value>&
args) |
| 380 { |
| 381 if (UNLIKELY(args.Length() < 2)) { |
| 382 throwTypeError(ExceptionMessages::failedToExecute("supplementalMethod2",
"SupportTestInterface", ExceptionMessages::notEnoughArguments(2, args.Length())
), args.GetIsolate()); |
| 383 return; |
| 384 } |
| 385 SupportTestInterface* imp = V8SupportTestInterface::toNative(args.Holder()); |
| 386 ExceptionState es(args.GetIsolate()); |
| 387 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, args[0]); |
| 388 V8TRYCATCH_VOID(TestObj*, objArg, V8TestObject::HasInstance(args[1], args.Ge
tIsolate(), worldType(args.GetIsolate())) ? V8TestObject::toNative(v8::Handle<v8
::Object>::Cast(args[1])) : 0); |
| 389 ScriptExecutionContext* scriptContext = getScriptExecutionContext(); |
| 390 RefPtr<TestObj> result = SupportTestPartialInterface::supplementalMethod2(sc
riptContext, imp, strArg, objArg, es); |
| 391 if (es.throwIfNeeded()) |
| 392 return; |
| 393 v8SetReturnValue(args, result.release(), args.Holder()); |
| 394 return; |
| 395 } |
| 396 |
| 397 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 398 |
| 399 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 400 |
| 401 static void supplementalMethod2MethodCallback(const v8::FunctionCallbackInfo<v8:
:Value>& args) |
| 402 { |
| 403 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
| 404 SupportTestInterfaceV8Internal::supplementalMethod2Method(args); |
| 405 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 406 } |
| 407 |
| 408 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 409 |
| 410 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 411 |
| 412 static void supplementalMethod3MethodCallback(const v8::FunctionCallbackInfo<v8:
:Value>& args) |
| 413 { |
| 414 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
| 415 V8SupportTestInterface::supplementalMethod3MethodCustom(args); |
| 416 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 417 } |
| 418 |
| 419 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 420 |
| 421 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 422 |
| 423 static void supplementalMethod4Method(const v8::FunctionCallbackInfo<v8::Value>&
args) |
| 424 { |
| 425 SupportTestPartialInterface::supplementalMethod4(); |
| 426 |
| 427 return; |
| 428 } |
| 429 |
| 430 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 431 |
| 432 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 433 |
| 434 static void supplementalMethod4MethodCallback(const v8::FunctionCallbackInfo<v8:
:Value>& args) |
| 435 { |
| 436 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
| 437 SupportTestInterfaceV8Internal::supplementalMethod4Method(args); |
| 438 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 439 } |
| 440 |
| 441 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 442 |
| 443 } // namespace SupportTestInterfaceV8Internal |
| 444 |
| 445 static const V8DOMConfiguration::AttributeConfiguration V8SupportTestInterfaceAt
tributes[] = { |
| 446 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 447 {"supplementalStr1", SupportTestInterfaceV8Internal::supplementalStr1Attribu
teGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), stati
c_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, |
| 448 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 449 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 450 {"supplementalStr2", SupportTestInterfaceV8Internal::supplementalStr2Attribu
teGetterCallback, SupportTestInterfaceV8Internal::supplementalStr2AttributeSette
rCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8:
:PropertyAttribute>(v8::None), 0 /* on instance */}, |
| 451 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 452 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 453 {"supplementalStr3", SupportTestInterfaceV8Internal::supplementalStr3Attribu
teGetterCallback, SupportTestInterfaceV8Internal::supplementalStr3AttributeSette
rCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8:
:PropertyAttribute>(v8::None), 0 /* on instance */}, |
| 454 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 455 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 456 {"supplementalNode", SupportTestInterfaceV8Internal::supplementalNodeAttribu
teGetterCallback, SupportTestInterfaceV8Internal::supplementalNodeAttributeSette
rCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8:
:PropertyAttribute>(v8::None), 0 /* on instance */}, |
| 457 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 458 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 459 {"Node13", SupportTestInterfaceV8Internal::Node13AttributeGetterCallback, Su
pportTestInterfaceV8Internal::Node13AttributeSetterCallback, 0, 0, 0, static_cas
t<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None),
0 /* on instance */}, |
| 460 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 461 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 462 {"Node14", SupportTestInterfaceV8Internal::Node14AttributeGetterCallback, Su
pportTestInterfaceV8Internal::Node14AttributeSetterCallback, 0, 0, 0, static_cas
t<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None),
0 /* on instance */}, |
| 463 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 464 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 465 {"Node15", SupportTestInterfaceV8Internal::Node15AttributeGetterCallback, Su
pportTestInterfaceV8Internal::Node15AttributeSetterCallback, 0, 0, 0, static_cas
t<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None),
0 /* on instance */}, |
| 466 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 467 }; |
| 468 |
| 469 static const V8DOMConfiguration::MethodConfiguration V8SupportTestInterfaceMetho
ds[] = { |
| 470 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 471 {"supplementalMethod1", SupportTestInterfaceV8Internal::supplementalMethod1M
ethodCallback, 0, 0}, |
| 472 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 473 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 474 {"supplementalMethod3", SupportTestInterfaceV8Internal::supplementalMethod3M
ethodCallback, 0, 0}, |
| 475 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 476 }; |
| 477 |
| 478 static v8::Handle<v8::FunctionTemplate> ConfigureV8SupportTestInterfaceTemplate(
v8::Handle<v8::FunctionTemplate> desc, v8::Isolate* isolate, WrapperWorldType cu
rrentWorldType) |
| 479 { |
| 480 desc->ReadOnlyPrototype(); |
| 481 |
| 482 v8::Local<v8::Signature> defaultSignature; |
| 483 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(desc, "Suppor
tTestInterface", v8::Local<v8::FunctionTemplate>(), V8SupportTestInterface::inte
rnalFieldCount, |
| 484 V8SupportTestInterfaceAttributes, WTF_ARRAY_LENGTH(V8SupportTestInterfac
eAttributes), |
| 485 V8SupportTestInterfaceMethods, WTF_ARRAY_LENGTH(V8SupportTestInterfaceMe
thods), isolate, currentWorldType); |
| 486 UNUSED_PARAM(defaultSignature); |
| 487 v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate(); |
| 488 v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate(); |
| 489 UNUSED_PARAM(instance); |
| 490 UNUSED_PARAM(proto); |
| 491 static const V8DOMConfiguration::ConstantConfiguration V8SupportTestInterfac
eConstants[] = { |
| 492 {"SUPPLEMENTALCONSTANT1", 1}, |
| 493 {"SUPPLEMENTALCONSTANT2", 2}, |
| 494 }; |
| 495 V8DOMConfiguration::installConstants(desc, proto, V8SupportTestInterfaceCons
tants, WTF_ARRAY_LENGTH(V8SupportTestInterfaceConstants), isolate); |
| 496 COMPILE_ASSERT(1 == SupportTestPartialInterface::SUPPLEMENTALCONSTANT1, TheV
alueOfSupportTestInterface_SUPPLEMENTALCONSTANT1DoesntMatchWithImplementation); |
| 497 COMPILE_ASSERT(2 == SupportTestPartialInterface::CONST_IMPL, TheValueOfSuppo
rtTestInterface_CONST_IMPLDoesntMatchWithImplementation); |
| 498 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 499 |
| 500 // Custom Signature 'supplementalMethod2' |
| 501 const int supplementalMethod2Argc = 2; |
| 502 v8::Handle<v8::FunctionTemplate> supplementalMethod2Argv[supplementalMethod2
Argc] = { v8::Handle<v8::FunctionTemplate>(), V8PerIsolateData::from(isolate)->r
awTemplate(&V8TestObject::info, currentWorldType) }; |
| 503 v8::Handle<v8::Signature> supplementalMethod2Signature = v8::Signature::New(
desc, supplementalMethod2Argc, supplementalMethod2Argv); |
| 504 proto->Set(v8::String::NewSymbol("supplementalMethod2"), v8::FunctionTemplat
e::New(SupportTestInterfaceV8Internal::supplementalMethod2MethodCallback, v8Unde
fined(), supplementalMethod2Signature, 2)); |
| 505 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 506 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 507 desc->Set(v8::String::NewSymbol("supplementalMethod4"), v8::FunctionTemplate
::New(SupportTestInterfaceV8Internal::supplementalMethod4MethodCallback, v8Undef
ined(), v8::Local<v8::Signature>(), 0)); |
| 508 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 509 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 510 desc->SetNativeDataProperty(v8::String::NewSymbol("supplementalStaticReadOnl
yAttr"), SupportTestInterfaceV8Internal::supplementalStaticReadOnlyAttrAttribute
GetterCallback, 0, v8::External::New(0), static_cast<v8::PropertyAttribute>(v8::
None), v8::Handle<v8::AccessorSignature>(), static_cast<v8::AccessControl>(v8::D
EFAULT)); |
| 511 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 512 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 513 desc->SetNativeDataProperty(v8::String::NewSymbol("supplementalStaticAttr"),
SupportTestInterfaceV8Internal::supplementalStaticAttrAttributeGetterCallback,
SupportTestInterfaceV8Internal::supplementalStaticAttrAttributeSetterCallback, v
8::External::New(0), static_cast<v8::PropertyAttribute>(v8::None), v8::Handle<v8
::AccessorSignature>(), static_cast<v8::AccessControl>(v8::DEFAULT)); |
| 514 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 515 |
| 516 // Custom toString template |
| 517 desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->to
StringTemplate()); |
| 518 return desc; |
| 519 } |
| 520 |
| 521 v8::Handle<v8::FunctionTemplate> V8SupportTestInterface::GetTemplate(v8::Isolate
* isolate, WrapperWorldType currentWorldType) |
| 522 { |
| 523 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
| 524 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&info); |
| 525 if (result != data->templateMap(currentWorldType).end()) |
| 526 return result->value.newLocal(isolate); |
| 527 |
| 528 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); |
| 529 v8::HandleScope handleScope(isolate); |
| 530 v8::Handle<v8::FunctionTemplate> templ = |
| 531 ConfigureV8SupportTestInterfaceTemplate(data->rawTemplate(&info, current
WorldType), isolate, currentWorldType); |
| 532 data->templateMap(currentWorldType).add(&info, UnsafePersistent<v8::Function
Template>(isolate, templ)); |
| 533 return handleScope.Close(templ); |
| 534 } |
| 535 |
| 536 bool V8SupportTestInterface::HasInstance(v8::Handle<v8::Value> value, v8::Isolat
e* isolate, WrapperWorldType currentWorldType) |
| 537 { |
| 538 return V8PerIsolateData::from(isolate)->hasInstance(&info, value, currentWor
ldType); |
| 539 } |
| 540 |
| 541 bool V8SupportTestInterface::HasInstanceInAnyWorld(v8::Handle<v8::Value> value,
v8::Isolate* isolate) |
| 542 { |
| 543 return V8PerIsolateData::from(isolate)->hasInstance(&info, value, MainWorld) |
| 544 || V8PerIsolateData::from(isolate)->hasInstance(&info, value, IsolatedWo
rld) |
| 545 || V8PerIsolateData::from(isolate)->hasInstance(&info, value, WorkerWorl
d); |
| 546 } |
| 547 |
| 548 v8::Handle<v8::Object> V8SupportTestInterface::createWrapper(PassRefPtr<SupportT
estInterface> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate
) |
| 549 { |
| 550 ASSERT(impl); |
| 551 ASSERT(!DOMDataStore::containsWrapper<V8SupportTestInterface>(impl.get(), is
olate)); |
| 552 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { |
| 553 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); |
| 554 // Might be a XXXConstructor::info instead of an XXX::info. These will b
oth have |
| 555 // the same object de-ref functions, though, so use that as the basis of
the check. |
| 556 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== info.derefObjectFunction); |
| 557 } |
| 558 |
| 559 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext
, &info, toInternalPointer(impl.get()), isolate); |
| 560 if (UNLIKELY(wrapper.IsEmpty())) |
| 561 return wrapper; |
| 562 |
| 563 installPerContextProperties(wrapper, impl.get(), isolate); |
| 564 V8DOMWrapper::associateObjectWithWrapper<V8SupportTestInterface>(impl, &info
, wrapper, isolate, WrapperConfiguration::Independent); |
| 565 return wrapper; |
| 566 } |
| 567 |
| 568 void V8SupportTestInterface::derefObject(void* object) |
| 569 { |
| 570 fromInternalPointer(object)->deref(); |
| 571 } |
| 572 |
| 573 } // namespace WebCore |
OLD | NEW |