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 "V8TestSupportTestInterface.h" |
| 23 |
| 24 #include "RuntimeEnabledFeatures.h" |
| 25 #include "V8Node.h" |
| 26 #include "V8TestObject.h" |
| 27 #include "bindings/tests/idls/testing/TestSupportTestPartialInterface.h" |
| 28 #include "bindings/v8/ExceptionState.h" |
| 29 #include "bindings/v8/ScriptController.h" |
| 30 #include "bindings/v8/V8Binding.h" |
| 31 #include "bindings/v8/V8DOMConfiguration.h" |
| 32 #include "bindings/v8/V8DOMWrapper.h" |
| 33 #include "core/dom/ContextFeatures.h" |
| 34 #include "core/dom/Document.h" |
| 35 #include "core/platform/chromium/TraceEvent.h" |
| 36 #include "wtf/GetPtr.h" |
| 37 #include "wtf/RefPtr.h" |
| 38 #include "wtf/UnusedParam.h" |
| 39 |
| 40 namespace WebCore { |
| 41 |
| 42 static void initializeScriptWrappableForInterface(TestSupportTestInterface* obje
ct) |
| 43 { |
| 44 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) |
| 45 ScriptWrappable::setTypeInfoInObject(object, &V8TestSupportTestInterface
::info); |
| 46 else |
| 47 ASSERT_NOT_REACHED(); |
| 48 } |
| 49 |
| 50 } // namespace WebCore |
| 51 |
| 52 // In ScriptWrappable::init, the use of a local function declaration has an issu
e on Windows: |
| 53 // the local declaration does not pick up the surrounding namespace. Therefore,
we provide this function |
| 54 // in the global namespace. |
| 55 // (More info on the MSVC bug here: http://connect.microsoft.com/VisualStudio/fe
edback/details/664619/the-namespace-of-local-function-declarations-in-c) |
| 56 void webCoreInitializeScriptWrappableForInterface(WebCore::TestSupportTestInterf
ace* object) |
| 57 { |
| 58 WebCore::initializeScriptWrappableForInterface(object); |
| 59 } |
| 60 |
| 61 namespace WebCore { |
| 62 WrapperTypeInfo V8TestSupportTestInterface::info = { V8TestSupportTestInterface:
:GetTemplate, V8TestSupportTestInterface::derefObject, 0, 0, 0, V8TestSupportTes
tInterface::installPerContextPrototypeProperties, 0, WrapperTypeObjectPrototype
}; |
| 63 |
| 64 namespace TestSupportTestInterfaceV8Internal { |
| 65 |
| 66 template <typename T> void V8_USE(T) { } |
| 67 |
| 68 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 69 |
| 70 static void supplementalStaticReadOnlyAttrAttributeGetter(v8::Local<v8::String>
name, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 71 { |
| 72 v8SetReturnValueInt(info, TestSupportTestPartialInterface::supplementalStati
cReadOnlyAttr()); |
| 73 return; |
| 74 } |
| 75 |
| 76 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 77 |
| 78 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 79 |
| 80 static void supplementalStaticReadOnlyAttrAttributeGetterCallback(v8::Local<v8::
String> name, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 81 { |
| 82 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
| 83 TestSupportTestInterfaceV8Internal::supplementalStaticReadOnlyAttrAttributeG
etter(name, info); |
| 84 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 85 } |
| 86 |
| 87 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 88 |
| 89 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 90 |
| 91 static void supplementalStaticAttrAttributeGetter(v8::Local<v8::String> name, co
nst v8::PropertyCallbackInfo<v8::Value>& info) |
| 92 { |
| 93 v8SetReturnValueString(info, TestSupportTestPartialInterface::supplementalSt
aticAttr(), info.GetIsolate()); |
| 94 return; |
| 95 } |
| 96 |
| 97 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 98 |
| 99 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 100 |
| 101 static void supplementalStaticAttrAttributeGetterCallback(v8::Local<v8::String>
name, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 102 { |
| 103 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
| 104 TestSupportTestInterfaceV8Internal::supplementalStaticAttrAttributeGetter(na
me, info); |
| 105 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 106 } |
| 107 |
| 108 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 109 |
| 110 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 111 |
| 112 static void supplementalStaticAttrAttributeSetter(v8::Local<v8::String> name, v8
::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) |
| 113 { |
| 114 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, v, value); |
| 115 TestSupportTestPartialInterface::setSupplementalStaticAttr(v); |
| 116 return; |
| 117 } |
| 118 |
| 119 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 120 |
| 121 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 122 |
| 123 static void supplementalStaticAttrAttributeSetterCallback(v8::Local<v8::String>
name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) |
| 124 { |
| 125 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); |
| 126 TestSupportTestInterfaceV8Internal::supplementalStaticAttrAttributeSetter(na
me, value, info); |
| 127 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 128 } |
| 129 |
| 130 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 131 |
| 132 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 133 |
| 134 static void supplementalStr1AttributeGetter(v8::Local<v8::String> name, const v8
::PropertyCallbackInfo<v8::Value>& info) |
| 135 { |
| 136 TestSupportTestInterface* imp = V8TestSupportTestInterface::toNative(info.Ho
lder()); |
| 137 v8SetReturnValueString(info, TestSupportTestPartialInterface::supplementalSt
r1(imp), info.GetIsolate()); |
| 138 return; |
| 139 } |
| 140 |
| 141 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 142 |
| 143 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 144 |
| 145 static void supplementalStr1AttributeGetterCallback(v8::Local<v8::String> name,
const v8::PropertyCallbackInfo<v8::Value>& info) |
| 146 { |
| 147 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
| 148 TestSupportTestInterfaceV8Internal::supplementalStr1AttributeGetter(name, in
fo); |
| 149 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 150 } |
| 151 |
| 152 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 153 |
| 154 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 155 |
| 156 static void supplementalStr2AttributeGetter(v8::Local<v8::String> name, const v8
::PropertyCallbackInfo<v8::Value>& info) |
| 157 { |
| 158 TestSupportTestInterface* imp = V8TestSupportTestInterface::toNative(info.Ho
lder()); |
| 159 v8SetReturnValueString(info, TestSupportTestPartialInterface::supplementalSt
r2(imp), info.GetIsolate()); |
| 160 return; |
| 161 } |
| 162 |
| 163 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 164 |
| 165 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 166 |
| 167 static void supplementalStr2AttributeGetterCallback(v8::Local<v8::String> name,
const v8::PropertyCallbackInfo<v8::Value>& info) |
| 168 { |
| 169 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
| 170 TestSupportTestInterfaceV8Internal::supplementalStr2AttributeGetter(name, in
fo); |
| 171 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 172 } |
| 173 |
| 174 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 175 |
| 176 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 177 |
| 178 static void supplementalStr2AttributeSetter(v8::Local<v8::String> name, v8::Loca
l<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) |
| 179 { |
| 180 TestSupportTestInterface* imp = V8TestSupportTestInterface::toNative(info.Ho
lder()); |
| 181 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, v, value); |
| 182 TestSupportTestPartialInterface::setSupplementalStr2(imp, v); |
| 183 return; |
| 184 } |
| 185 |
| 186 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 187 |
| 188 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 189 |
| 190 static void supplementalStr2AttributeSetterCallback(v8::Local<v8::String> name,
v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) |
| 191 { |
| 192 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); |
| 193 TestSupportTestInterfaceV8Internal::supplementalStr2AttributeSetter(name, va
lue, info); |
| 194 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 195 } |
| 196 |
| 197 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 198 |
| 199 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 200 |
| 201 static void supplementalStr3AttributeGetterCallback(v8::Local<v8::String> name,
const v8::PropertyCallbackInfo<v8::Value>& info) |
| 202 { |
| 203 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
| 204 V8TestSupportTestInterface::supplementalStr3AttributeGetterCustom(name, info
); |
| 205 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 206 } |
| 207 |
| 208 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 209 |
| 210 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 211 |
| 212 static void supplementalStr3AttributeSetterCallback(v8::Local<v8::String> name,
v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) |
| 213 { |
| 214 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); |
| 215 V8TestSupportTestInterface::supplementalStr3AttributeSetterCustom(name, valu
e, info); |
| 216 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 217 } |
| 218 |
| 219 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 220 |
| 221 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 222 |
| 223 static void supplementalNodeAttributeGetter(v8::Local<v8::String> name, const v8
::PropertyCallbackInfo<v8::Value>& info) |
| 224 { |
| 225 TestSupportTestInterface* imp = V8TestSupportTestInterface::toNative(info.Ho
lder()); |
| 226 v8SetReturnValueFast(info, TestSupportTestPartialInterface::supplementalNode
(imp), imp); |
| 227 return; |
| 228 } |
| 229 |
| 230 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 231 |
| 232 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 233 |
| 234 static void supplementalNodeAttributeGetterCallback(v8::Local<v8::String> name,
const v8::PropertyCallbackInfo<v8::Value>& info) |
| 235 { |
| 236 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
| 237 TestSupportTestInterfaceV8Internal::supplementalNodeAttributeGetter(name, in
fo); |
| 238 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 239 } |
| 240 |
| 241 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 242 |
| 243 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 244 |
| 245 static void supplementalNodeAttributeSetter(v8::Local<v8::String> name, v8::Loca
l<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) |
| 246 { |
| 247 TestSupportTestInterface* imp = V8TestSupportTestInterface::toNative(info.Ho
lder()); |
| 248 V8TRYCATCH_VOID(Node*, v, V8Node::HasInstance(value, info.GetIsolate(), worl
dType(info.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(value)
) : 0); |
| 249 TestSupportTestPartialInterface::setSupplementalNode(imp, WTF::getPtr(v)); |
| 250 return; |
| 251 } |
| 252 |
| 253 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 254 |
| 255 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 256 |
| 257 static void supplementalNodeAttributeSetterCallback(v8::Local<v8::String> name,
v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) |
| 258 { |
| 259 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); |
| 260 TestSupportTestInterfaceV8Internal::supplementalNodeAttributeSetter(name, va
lue, info); |
| 261 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 262 } |
| 263 |
| 264 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 265 |
| 266 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 267 |
| 268 static void Node13AttributeGetter(v8::Local<v8::String> name, const v8::Property
CallbackInfo<v8::Value>& info) |
| 269 { |
| 270 TestSupportTestInterface* imp = V8TestSupportTestInterface::toNative(info.Ho
lder()); |
| 271 v8SetReturnValueFast(info, TestSupportTestPartialInterface::node13(imp), imp
); |
| 272 return; |
| 273 } |
| 274 |
| 275 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 276 |
| 277 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 278 |
| 279 static void Node13AttributeGetterCallback(v8::Local<v8::String> name, const v8::
PropertyCallbackInfo<v8::Value>& info) |
| 280 { |
| 281 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
| 282 TestSupportTestInterfaceV8Internal::Node13AttributeGetter(name, info); |
| 283 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 284 } |
| 285 |
| 286 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 287 |
| 288 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 289 |
| 290 static void Node13AttributeSetter(v8::Local<v8::String> name, v8::Local<v8::Valu
e> value, const v8::PropertyCallbackInfo<void>& info) |
| 291 { |
| 292 TestSupportTestInterface* imp = V8TestSupportTestInterface::toNative(info.Ho
lder()); |
| 293 V8TRYCATCH_VOID(Node*, v, V8Node::HasInstance(value, info.GetIsolate(), worl
dType(info.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(value)
) : 0); |
| 294 TestSupportTestPartialInterface::setNode13(imp, WTF::getPtr(v)); |
| 295 return; |
| 296 } |
| 297 |
| 298 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 299 |
| 300 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 301 |
| 302 static void Node13AttributeSetterCallback(v8::Local<v8::String> name, v8::Local<
v8::Value> value, const v8::PropertyCallbackInfo<void>& info) |
| 303 { |
| 304 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); |
| 305 TestSupportTestInterfaceV8Internal::Node13AttributeSetter(name, value, info)
; |
| 306 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 307 } |
| 308 |
| 309 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 310 |
| 311 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 312 |
| 313 static void Node14AttributeGetter(v8::Local<v8::String> name, const v8::Property
CallbackInfo<v8::Value>& info) |
| 314 { |
| 315 TestSupportTestInterface* imp = V8TestSupportTestInterface::toNative(info.Ho
lder()); |
| 316 v8SetReturnValueFast(info, TestSupportTestPartialInterface::node14(imp), imp
); |
| 317 return; |
| 318 } |
| 319 |
| 320 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 321 |
| 322 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 323 |
| 324 static void Node14AttributeGetterCallback(v8::Local<v8::String> name, const v8::
PropertyCallbackInfo<v8::Value>& info) |
| 325 { |
| 326 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
| 327 TestSupportTestInterfaceV8Internal::Node14AttributeGetter(name, info); |
| 328 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 329 } |
| 330 |
| 331 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 332 |
| 333 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 334 |
| 335 static void Node14AttributeSetter(v8::Local<v8::String> name, v8::Local<v8::Valu
e> value, const v8::PropertyCallbackInfo<void>& info) |
| 336 { |
| 337 TestSupportTestInterface* imp = V8TestSupportTestInterface::toNative(info.Ho
lder()); |
| 338 V8TRYCATCH_VOID(Node*, v, V8Node::HasInstance(value, info.GetIsolate(), worl
dType(info.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(value)
) : 0); |
| 339 TestSupportTestPartialInterface::setNode14(imp, WTF::getPtr(v)); |
| 340 return; |
| 341 } |
| 342 |
| 343 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 344 |
| 345 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 346 |
| 347 static void Node14AttributeSetterCallback(v8::Local<v8::String> name, v8::Local<
v8::Value> value, const v8::PropertyCallbackInfo<void>& info) |
| 348 { |
| 349 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); |
| 350 TestSupportTestInterfaceV8Internal::Node14AttributeSetter(name, value, info)
; |
| 351 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 352 } |
| 353 |
| 354 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 355 |
| 356 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 357 |
| 358 static void Node15AttributeGetter(v8::Local<v8::String> name, const v8::Property
CallbackInfo<v8::Value>& info) |
| 359 { |
| 360 TestSupportTestInterface* imp = V8TestSupportTestInterface::toNative(info.Ho
lder()); |
| 361 v8SetReturnValueFast(info, TestSupportTestPartialInterface::node15(imp), imp
); |
| 362 return; |
| 363 } |
| 364 |
| 365 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 366 |
| 367 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 368 |
| 369 static void Node15AttributeGetterCallback(v8::Local<v8::String> name, const v8::
PropertyCallbackInfo<v8::Value>& info) |
| 370 { |
| 371 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
| 372 TestSupportTestInterfaceV8Internal::Node15AttributeGetter(name, info); |
| 373 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 374 } |
| 375 |
| 376 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 377 |
| 378 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 379 |
| 380 static void Node15AttributeSetter(v8::Local<v8::String> name, v8::Local<v8::Valu
e> value, const v8::PropertyCallbackInfo<void>& info) |
| 381 { |
| 382 TestSupportTestInterface* imp = V8TestSupportTestInterface::toNative(info.Ho
lder()); |
| 383 V8TRYCATCH_VOID(Node*, v, V8Node::HasInstance(value, info.GetIsolate(), worl
dType(info.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(value)
) : 0); |
| 384 TestSupportTestPartialInterface::setNode15(imp, WTF::getPtr(v)); |
| 385 return; |
| 386 } |
| 387 |
| 388 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 389 |
| 390 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 391 |
| 392 static void Node15AttributeSetterCallback(v8::Local<v8::String> name, v8::Local<
v8::Value> value, const v8::PropertyCallbackInfo<void>& info) |
| 393 { |
| 394 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); |
| 395 TestSupportTestInterfaceV8Internal::Node15AttributeSetter(name, value, info)
; |
| 396 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 397 } |
| 398 |
| 399 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 400 |
| 401 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 402 |
| 403 static void supplementalMethod1Method(const v8::FunctionCallbackInfo<v8::Value>&
args) |
| 404 { |
| 405 TestSupportTestInterface* imp = V8TestSupportTestInterface::toNative(args.Ho
lder()); |
| 406 TestSupportTestPartialInterface::supplementalMethod1(imp); |
| 407 |
| 408 return; |
| 409 } |
| 410 |
| 411 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 412 |
| 413 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 414 |
| 415 static void supplementalMethod1MethodCallback(const v8::FunctionCallbackInfo<v8:
:Value>& args) |
| 416 { |
| 417 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
| 418 TestSupportTestInterfaceV8Internal::supplementalMethod1Method(args); |
| 419 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 420 } |
| 421 |
| 422 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 423 |
| 424 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 425 |
| 426 static void supplementalMethod2Method(const v8::FunctionCallbackInfo<v8::Value>&
args) |
| 427 { |
| 428 if (UNLIKELY(args.Length() < 2)) { |
| 429 throwNotEnoughArgumentsError(args.GetIsolate()); |
| 430 return; |
| 431 } |
| 432 TestSupportTestInterface* imp = V8TestSupportTestInterface::toNative(args.Ho
lder()); |
| 433 ExceptionState es(args.GetIsolate()); |
| 434 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, args[0]); |
| 435 V8TRYCATCH_VOID(TestObj*, objArg, V8TestObject::HasInstance(args[1], args.Ge
tIsolate(), worldType(args.GetIsolate())) ? V8TestObject::toNative(v8::Handle<v8
::Object>::Cast(args[1])) : 0); |
| 436 ScriptExecutionContext* scriptContext = getScriptExecutionContext(); |
| 437 RefPtr<TestObj> result = TestSupportTestPartialInterface::supplementalMethod
2(scriptContext, imp, strArg, objArg, es); |
| 438 if (es.throwIfNeeded()) |
| 439 return; |
| 440 v8SetReturnValue(args, result.release(), args.Holder()); |
| 441 return; |
| 442 } |
| 443 |
| 444 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 445 |
| 446 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 447 |
| 448 static void supplementalMethod2MethodCallback(const v8::FunctionCallbackInfo<v8:
:Value>& args) |
| 449 { |
| 450 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
| 451 TestSupportTestInterfaceV8Internal::supplementalMethod2Method(args); |
| 452 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 453 } |
| 454 |
| 455 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 456 |
| 457 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 458 |
| 459 static void supplementalMethod3MethodCallback(const v8::FunctionCallbackInfo<v8:
:Value>& args) |
| 460 { |
| 461 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
| 462 V8TestSupportTestInterface::supplementalMethod3MethodCustom(args); |
| 463 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 464 } |
| 465 |
| 466 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 467 |
| 468 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 469 |
| 470 static void supplementalMethod4Method(const v8::FunctionCallbackInfo<v8::Value>&
args) |
| 471 { |
| 472 TestSupportTestPartialInterface::supplementalMethod4(); |
| 473 |
| 474 return; |
| 475 } |
| 476 |
| 477 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 478 |
| 479 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 480 |
| 481 static void supplementalMethod4MethodCallback(const v8::FunctionCallbackInfo<v8:
:Value>& args) |
| 482 { |
| 483 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
| 484 TestSupportTestInterfaceV8Internal::supplementalMethod4Method(args); |
| 485 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 486 } |
| 487 |
| 488 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 489 |
| 490 } // namespace TestSupportTestInterfaceV8Internal |
| 491 |
| 492 static const V8DOMConfiguration::AttributeConfiguration V8TestSupportTestInterfa
ceAttributes[] = { |
| 493 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 494 {"supplementalStaticReadOnlyAttr", TestSupportTestInterfaceV8Internal::suppl
ementalStaticReadOnlyAttrAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::Ac
cessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on
instance */}, |
| 495 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 496 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 497 {"supplementalStaticAttr", TestSupportTestInterfaceV8Internal::supplementalS
taticAttrAttributeGetterCallback, TestSupportTestInterfaceV8Internal::supplement
alStaticAttrAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8:
:DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, |
| 498 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 499 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 500 {"supplementalStr1", TestSupportTestInterfaceV8Internal::supplementalStr1Att
ributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), s
tatic_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, |
| 501 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 502 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 503 {"supplementalStr2", TestSupportTestInterfaceV8Internal::supplementalStr2Att
ributeGetterCallback, TestSupportTestInterfaceV8Internal::supplementalStr2Attrib
uteSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_
cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, |
| 504 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 505 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 506 {"supplementalStr3", TestSupportTestInterfaceV8Internal::supplementalStr3Att
ributeGetterCallback, TestSupportTestInterfaceV8Internal::supplementalStr3Attrib
uteSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_
cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, |
| 507 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 508 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 509 {"supplementalNode", TestSupportTestInterfaceV8Internal::supplementalNodeAtt
ributeGetterCallback, TestSupportTestInterfaceV8Internal::supplementalNodeAttrib
uteSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_
cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, |
| 510 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 511 }; |
| 512 |
| 513 static const V8DOMConfiguration::MethodConfiguration V8TestSupportTestInterfaceM
ethods[] = { |
| 514 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 515 {"supplementalMethod1", TestSupportTestInterfaceV8Internal::supplementalMeth
od1MethodCallback, 0, 0}, |
| 516 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 517 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 518 {"supplementalMethod3", TestSupportTestInterfaceV8Internal::supplementalMeth
od3MethodCallback, 0, 0}, |
| 519 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 520 }; |
| 521 |
| 522 static v8::Handle<v8::FunctionTemplate> ConfigureV8TestSupportTestInterfaceTempl
ate(v8::Handle<v8::FunctionTemplate> desc, v8::Isolate* isolate, WrapperWorldTyp
e currentWorldType) |
| 523 { |
| 524 desc->ReadOnlyPrototype(); |
| 525 |
| 526 v8::Local<v8::Signature> defaultSignature; |
| 527 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(desc, "TestSu
pportTestInterface", v8::Local<v8::FunctionTemplate>(), V8TestSupportTestInterfa
ce::internalFieldCount, |
| 528 V8TestSupportTestInterfaceAttributes, WTF_ARRAY_LENGTH(V8TestSupportTest
InterfaceAttributes), |
| 529 V8TestSupportTestInterfaceMethods, WTF_ARRAY_LENGTH(V8TestSupportTestInt
erfaceMethods), isolate, currentWorldType); |
| 530 UNUSED_PARAM(defaultSignature); |
| 531 v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate(); |
| 532 v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate(); |
| 533 UNUSED_PARAM(instance); |
| 534 UNUSED_PARAM(proto); |
| 535 |
| 536 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 537 if (RuntimeEnabledFeatures::condition13Enabled()) { |
| 538 static const V8DOMConfiguration::AttributeConfiguration attributeConfigu
ration =\ |
| 539 {"Node13", TestSupportTestInterfaceV8Internal::Node13AttributeGetterCall
back, TestSupportTestInterfaceV8Internal::Node13AttributeSetterCallback, 0, 0, 0
, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute
>(v8::None), 0 /* on instance */}; |
| 540 V8DOMConfiguration::installAttribute(instance, proto, attributeConfigura
tion, isolate, currentWorldType); |
| 541 } |
| 542 |
| 543 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 544 static const V8DOMConfiguration::ConstantConfiguration V8TestSupportTestInte
rfaceConstants[] = { |
| 545 {"SUPPLEMENTALCONSTANT1", 1}, |
| 546 {"SUPPLEMENTALCONSTANT2", 2}, |
| 547 }; |
| 548 V8DOMConfiguration::installConstants(desc, proto, V8TestSupportTestInterface
Constants, WTF_ARRAY_LENGTH(V8TestSupportTestInterfaceConstants), isolate); |
| 549 COMPILE_ASSERT(1 == TestSupportTestPartialInterface::SUPPLEMENTALCONSTANT1,
TheValueOfTestSupportTestInterface_SUPPLEMENTALCONSTANT1DoesntMatchWithImplement
ation); |
| 550 COMPILE_ASSERT(2 == TestSupportTestPartialInterface::CONST_IMPL, TheValueOfT
estSupportTestInterface_CONST_IMPLDoesntMatchWithImplementation); |
| 551 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 552 |
| 553 // Custom Signature 'supplementalMethod2' |
| 554 const int supplementalMethod2Argc = 2; |
| 555 v8::Handle<v8::FunctionTemplate> supplementalMethod2Argv[supplementalMethod2
Argc] = { v8::Handle<v8::FunctionTemplate>(), V8PerIsolateData::from(isolate)->r
awTemplate(&V8TestObject::info, currentWorldType) }; |
| 556 v8::Handle<v8::Signature> supplementalMethod2Signature = v8::Signature::New(
desc, supplementalMethod2Argc, supplementalMethod2Argv); |
| 557 proto->Set(v8::String::NewSymbol("supplementalMethod2"), v8::FunctionTemplat
e::New(TestSupportTestInterfaceV8Internal::supplementalMethod2MethodCallback, v8
Undefined(), supplementalMethod2Signature, 2)); |
| 558 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 559 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 560 desc->Set(v8::String::NewSymbol("supplementalMethod4"), v8::FunctionTemplate
::New(TestSupportTestInterfaceV8Internal::supplementalMethod4MethodCallback, v8U
ndefined(), v8::Local<v8::Signature>(), 0)); |
| 561 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 562 |
| 563 // Custom toString template |
| 564 desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->to
StringTemplate()); |
| 565 return desc; |
| 566 } |
| 567 |
| 568 v8::Handle<v8::FunctionTemplate> V8TestSupportTestInterface::GetTemplate(v8::Iso
late* isolate, WrapperWorldType currentWorldType) |
| 569 { |
| 570 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
| 571 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&info); |
| 572 if (result != data->templateMap(currentWorldType).end()) |
| 573 return result->value.newLocal(isolate); |
| 574 |
| 575 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); |
| 576 v8::HandleScope handleScope(isolate); |
| 577 v8::Handle<v8::FunctionTemplate> templ = |
| 578 ConfigureV8TestSupportTestInterfaceTemplate(data->rawTemplate(&info, cur
rentWorldType), isolate, currentWorldType); |
| 579 data->templateMap(currentWorldType).add(&info, UnsafePersistent<v8::Function
Template>(isolate, templ)); |
| 580 return handleScope.Close(templ); |
| 581 } |
| 582 |
| 583 bool V8TestSupportTestInterface::HasInstance(v8::Handle<v8::Value> value, v8::Is
olate* isolate, WrapperWorldType currentWorldType) |
| 584 { |
| 585 return V8PerIsolateData::from(isolate)->hasInstance(&info, value, currentWor
ldType); |
| 586 } |
| 587 |
| 588 bool V8TestSupportTestInterface::HasInstanceInAnyWorld(v8::Handle<v8::Value> val
ue, v8::Isolate* isolate) |
| 589 { |
| 590 return V8PerIsolateData::from(isolate)->hasInstance(&info, value, MainWorld) |
| 591 || V8PerIsolateData::from(isolate)->hasInstance(&info, value, IsolatedWo
rld) |
| 592 || V8PerIsolateData::from(isolate)->hasInstance(&info, value, WorkerWorl
d); |
| 593 } |
| 594 |
| 595 void V8TestSupportTestInterface::installPerContextProperties(v8::Handle<v8::Obje
ct> instance, TestSupportTestInterface* impl, v8::Isolate* isolate) |
| 596 { |
| 597 v8::Local<v8::Object> proto = v8::Local<v8::Object>::Cast(instance->GetProto
type()); |
| 598 |
| 599 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 600 if (ContextFeatures::condition14Enabled(impl->document())) { |
| 601 static const V8DOMConfiguration::AttributeConfiguration attributeConf
iguration =\ |
| 602 {"Node14", TestSupportTestInterfaceV8Internal::Node14AttributeGetterCall
back, TestSupportTestInterfaceV8Internal::Node14AttributeSetterCallback, 0, 0, 0
, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute
>(v8::None), 0 /* on instance */}; |
| 603 V8DOMConfiguration::installAttribute(instance, proto, attributeConfigura
tion, isolate); |
| 604 } |
| 605 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 606 |
| 607 #if ENABLE(Condition11) || ENABLE(Condition12) |
| 608 if (ContextFeatures::condition16Enabled(impl->document()) && RuntimeEnabledF
eatures::condition15Enabled()) { |
| 609 static const V8DOMConfiguration::AttributeConfiguration attributeConf
iguration =\ |
| 610 {"Node15", TestSupportTestInterfaceV8Internal::Node15AttributeGetterCall
back, TestSupportTestInterfaceV8Internal::Node15AttributeSetterCallback, 0, 0, 0
, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute
>(v8::None), 0 /* on instance */}; |
| 611 V8DOMConfiguration::installAttribute(instance, proto, attributeConfigura
tion, isolate); |
| 612 } |
| 613 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
| 614 } |
| 615 |
| 616 v8::Handle<v8::Object> V8TestSupportTestInterface::createWrapper(PassRefPtr<Test
SupportTestInterface> impl, v8::Handle<v8::Object> creationContext, v8::Isolate*
isolate) |
| 617 { |
| 618 ASSERT(impl.get()); |
| 619 ASSERT(!DOMDataStore::containsWrapper<V8TestSupportTestInterface>(impl.get()
, isolate)); |
| 620 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { |
| 621 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); |
| 622 // Might be a XXXConstructor::info instead of an XXX::info. These will b
oth have |
| 623 // the same object de-ref functions, though, so use that as the basis of
the check. |
| 624 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== info.derefObjectFunction); |
| 625 } |
| 626 |
| 627 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext
, &info, toInternalPointer(impl.get()), isolate); |
| 628 if (UNLIKELY(wrapper.IsEmpty())) |
| 629 return wrapper; |
| 630 |
| 631 installPerContextProperties(wrapper, impl.get(), isolate); |
| 632 V8DOMWrapper::associateObjectWithWrapper<V8TestSupportTestInterface>(impl, &
info, wrapper, isolate, WrapperConfiguration::Independent); |
| 633 return wrapper; |
| 634 } |
| 635 |
| 636 void V8TestSupportTestInterface::derefObject(void* object) |
| 637 { |
| 638 fromInternalPointer(object)->deref(); |
| 639 } |
| 640 |
| 641 } // namespace WebCore |
OLD | NEW |