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 "V8TestObject.h" 23 24 #include "HTMLNames.h" 25 #include "RuntimeEnabledFeatures.h" 26 #include "V8DOMStringList.h" 27 #include "V8Document.h" 28 #include "V8EventTarget.h" 29 #include "V8MessagePort.h" 30 #include "V8Node.h" 31 #include "V8SVGDocument.h" 32 #include "V8SVGPoint.h" 33 #include "V8TestCallback.h" 34 #include "V8TestInterface.h" 35 #include "V8TestNode.h" 36 #include "V8TestObjectectA.h" 37 #include "V8TestObjectectB.h" 38 #include "V8TestObjectectC.h" 39 #include "V8TestSubObj.h" 40 #include "bindings/v8/BindingSecurity.h" 41 #include "bindings/v8/Dictionary.h" 42 #include "bindings/v8/ExceptionState.h" 43 #include "bindings/v8/ScriptController.h" 44 #include "bindings/v8/ScriptValue.h" 45 #include "bindings/v8/SerializedScriptValue.h" 46 #include "bindings/v8/V8AbstractEventListener.h" 47 #include "bindings/v8/V8Binding.h" 48 #include "bindings/v8/V8DOMActivityLogger.h" 49 #include "bindings/v8/V8DOMConfiguration.h" 50 #include "bindings/v8/V8DOMWrapper.h" 51 #include "bindings/v8/V8EventListenerList.h" 52 #include "bindings/v8/V8HiddenPropertyName.h" 53 #include "bindings/v8/V8ObjectConstructor.h" 54 #include "bindings/v8/custom/V8Float32ArrayCustom.h" 55 #include "core/dom/ContextFeatures.h" 56 #include "core/dom/CustomElementCallbackDispatcher.h" 57 #include "core/dom/Document.h" 58 #include "core/page/DOMWindow.h" 59 #include "core/page/Frame.h" 60 #include "core/page/PageConsole.h" 61 #include "core/page/UseCounter.h" 62 #include "core/platform/chromium/TraceEvent.h" 63 #include "core/svg/properties/SVGPropertyTearOff.h" 64 #include "core/svg/properties/SVGStaticPropertyTearOff.h" 65 #include "wtf/GetPtr.h" 66 #include "wtf/RefPtr.h" 67 #include "wtf/UnusedParam.h" 68 #include "wtf/Vector.h" 69 70 namespace WebCore { 71 72 static void initializeScriptWrappableForInterface(TestObj* object) 73 { 74 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) 75 ScriptWrappable::setTypeInfoInObject(object, &V8TestObject::info); 76 else 77 ASSERT_NOT_REACHED(); 78 } 79 80 } // namespace WebCore 81 82 // In ScriptWrappable::init, the use of a local function declaration has an issue on Windows: 83 // the local declaration does not pick up the surrounding namespace. Therefore, we provide this function 84 // in the global namespace. 85 // (More info on the MSVC bug here: http://connect.microsoft.com/VisualStudio/feedback/details/664619/the-namespace-of-local-function-declarations-in-c) 86 void webCoreInitializeScriptWrappableForInterface(WebCore::TestObj* object) 87 { 88 WebCore::initializeScriptWrappableForInterface(object); 89 } 90 91 namespace WebCore { 92 WrapperTypeInfo V8TestObject::info = { V8TestObject::GetTemplate, V8TestObject::derefObject, 0, V8TestObject::toEventTarget, 0, V8TestObject::installPerContextPrototypeProperties, &V8EventTarget::info, WrapperTypeObjectPrototype }; 93 94 namespace TestObjV8Internal { 95 96 template <typename T> void V8_USE(T) { } 97 98 static void readOnlyLongAttrAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 99 { 100 TestObj* imp = V8TestObject::toNative(info.Holder()); 101 v8SetReturnValueInt(info, imp->readOnlyLongAttr()); 102 return; 103 } 104 105 static void readOnlyLongAttrAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 106 { 107 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 108 TestObjV8Internal::readOnlyLongAttrAttrGetter(name, info); 109 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 110 } 111 112 static void readOnlyStringAttrAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 113 { 114 TestObj* imp = V8TestObject::toNative(info.Holder()); 115 v8SetReturnValueString(info, imp->readOnlyStringAttr(), info.GetIsolate()); 116 return; 117 } 118 119 static void readOnlyStringAttrAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 120 { 121 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 122 TestObjV8Internal::readOnlyStringAttrAttrGetter(name, info); 123 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 124 } 125 126 static void readOnlyTestObjectAttrAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 127 { 128 TestObj* imp = V8TestObject::toNative(info.Holder()); 129 RefPtr<TestObj> result = imp->readOnlyTestObjectAttr(); 130 v8::Handle<v8::Value> wrapper = result.get() ? v8::Handle<v8::Value>(DOMDataStore::getWrapper<V8TestObject>(result.get(), info.GetIsolate())) : v8Undefined(); 131 if (wrapper.IsEmpty()) { 132 wrapper = toV8(result.get(), info.Holder(), info.GetIsolate()); 133 if (!wrapper.IsEmpty()) 134 V8HiddenPropertyName::setNamedHiddenReference(info.Holder(), "readOnlyTestObjectAttr", wrapper); 135 } 136 v8SetReturnValue(info, wrapper); 137 return; 138 } 139 140 static void readOnlyTestObjectAttrAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 141 { 142 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 143 TestObjV8Internal::readOnlyTestObjectAttrAttrGetter(name, info); 144 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 145 } 146 147 static void staticReadOnlyLongAttrAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 148 { 149 v8SetReturnValueInt(info, TestObj::staticReadOnlyLongAttr()); 150 return; 151 } 152 153 static void staticReadOnlyLongAttrAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 154 { 155 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 156 TestObjV8Internal::staticReadOnlyLongAttrAttrGetter(name, info); 157 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 158 } 159 160 static void staticStringAttrAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 161 { 162 v8SetReturnValueString(info, TestObj::staticStringAttr(), info.GetIsolate()); 163 return; 164 } 165 166 static void staticStringAttrAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 167 { 168 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 169 TestObjV8Internal::staticStringAttrAttrGetter(name, info); 170 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 171 } 172 173 static void staticStringAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 174 { 175 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, v, value); 176 TestObj::setStaticStringAttr(v); 177 return; 178 } 179 180 static void staticStringAttrAttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 181 { 182 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 183 TestObjV8Internal::staticStringAttrAttrSetter(name, value, info); 184 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 185 } 186 187 static void enumAttrAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 188 { 189 TestObj* imp = V8TestObject::toNative(info.Holder()); 190 v8SetReturnValueString(info, imp->enumAttr(), info.GetIsolate()); 191 return; 192 } 193 194 static void enumAttrAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 195 { 196 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 197 TestObjV8Internal::enumAttrAttrGetter(name, info); 198 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 199 } 200 201 static void enumAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 202 { 203 TestObj* imp = V8TestObject::toNative(info.Holder()); 204 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, v, value); 205 String string = v; 206 if (!(string == "" || string == "EnumValue1" || string == "EnumValue2" || string == "EnumValue3")) 207 return; 208 imp->setEnumAttr(v); 209 return; 210 } 211 212 static void enumAttrAttrSetterCallback(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 TestObjV8Internal::enumAttrAttrSetter(name, value, info); 216 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 217 } 218 219 static void readOnlyEnumAttrAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 220 { 221 TestObj* imp = V8TestObject::toNative(info.Holder()); 222 v8SetReturnValueString(info, imp->readOnlyEnumAttr(), info.GetIsolate()); 223 return; 224 } 225 226 static void readOnlyEnumAttrAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 227 { 228 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 229 TestObjV8Internal::readOnlyEnumAttrAttrGetter(name, info); 230 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 231 } 232 233 static void byteAttrAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 234 { 235 TestObj* imp = V8TestObject::toNative(info.Holder()); 236 v8SetReturnValueInt(info, imp->byteAttr()); 237 return; 238 } 239 240 static void byteAttrAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 241 { 242 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 243 TestObjV8Internal::byteAttrAttrGetter(name, info); 244 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 245 } 246 247 static void byteAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 248 { 249 TestObj* imp = V8TestObject::toNative(info.Holder()); 250 V8TRYCATCH_VOID(int, v, toInt8(value)); 251 imp->setByteAttr(v); 252 return; 253 } 254 255 static void byteAttrAttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 256 { 257 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 258 TestObjV8Internal::byteAttrAttrSetter(name, value, info); 259 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 260 } 261 262 static void octetAttrAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 263 { 264 TestObj* imp = V8TestObject::toNative(info.Holder()); 265 v8SetReturnValueUnsigned(info, imp->octetAttr()); 266 return; 267 } 268 269 static void octetAttrAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 270 { 271 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 272 TestObjV8Internal::octetAttrAttrGetter(name, info); 273 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 274 } 275 276 static void octetAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 277 { 278 TestObj* imp = V8TestObject::toNative(info.Holder()); 279 V8TRYCATCH_VOID(unsigned, v, toUInt8(value)); 280 imp->setOctetAttr(v); 281 return; 282 } 283 284 static void octetAttrAttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 285 { 286 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 287 TestObjV8Internal::octetAttrAttrSetter(name, value, info); 288 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 289 } 290 291 static void shortAttrAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 292 { 293 TestObj* imp = V8TestObject::toNative(info.Holder()); 294 v8SetReturnValueInt(info, imp->shortAttr()); 295 return; 296 } 297 298 static void shortAttrAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 299 { 300 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 301 TestObjV8Internal::shortAttrAttrGetter(name, info); 302 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 303 } 304 305 static void shortAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 306 { 307 TestObj* imp = V8TestObject::toNative(info.Holder()); 308 V8TRYCATCH_VOID(int, v, toInt32(value)); 309 imp->setShortAttr(v); 310 return; 311 } 312 313 static void shortAttrAttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 314 { 315 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 316 TestObjV8Internal::shortAttrAttrSetter(name, value, info); 317 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 318 } 319 320 static void unsignedShortAttrAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 321 { 322 TestObj* imp = V8TestObject::toNative(info.Holder()); 323 v8SetReturnValueUnsigned(info, imp->unsignedShortAttr()); 324 return; 325 } 326 327 static void unsignedShortAttrAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 328 { 329 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 330 TestObjV8Internal::unsignedShortAttrAttrGetter(name, info); 331 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 332 } 333 334 static void unsignedShortAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 335 { 336 TestObj* imp = V8TestObject::toNative(info.Holder()); 337 V8TRYCATCH_VOID(unsigned, v, toUInt32(value)); 338 imp->setUnsignedShortAttr(v); 339 return; 340 } 341 342 static void unsignedShortAttrAttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 343 { 344 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 345 TestObjV8Internal::unsignedShortAttrAttrSetter(name, value, info); 346 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 347 } 348 349 static void longAttrAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 350 { 351 TestObj* imp = V8TestObject::toNative(info.Holder()); 352 v8SetReturnValueInt(info, imp->longAttr()); 353 return; 354 } 355 356 static void longAttrAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 357 { 358 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 359 TestObjV8Internal::longAttrAttrGetter(name, info); 360 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 361 } 362 363 static void longAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 364 { 365 TestObj* imp = V8TestObject::toNative(info.Holder()); 366 V8TRYCATCH_VOID(int, v, toInt32(value)); 367 imp->setLongAttr(v); 368 return; 369 } 370 371 static void longAttrAttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 372 { 373 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 374 TestObjV8Internal::longAttrAttrSetter(name, value, info); 375 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 376 } 377 378 static void longLongAttrAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 379 { 380 TestObj* imp = V8TestObject::toNative(info.Holder()); 381 v8SetReturnValue(info, static_cast<double>(imp->longLongAttr())); 382 return; 383 } 384 385 static void longLongAttrAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 386 { 387 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 388 TestObjV8Internal::longLongAttrAttrGetter(name, info); 389 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 390 } 391 392 static void longLongAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 393 { 394 TestObj* imp = V8TestObject::toNative(info.Holder()); 395 V8TRYCATCH_VOID(long long, v, toInt64(value)); 396 imp->setLongLongAttr(v); 397 return; 398 } 399 400 static void longLongAttrAttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 401 { 402 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 403 TestObjV8Internal::longLongAttrAttrSetter(name, value, info); 404 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 405 } 406 407 static void unsignedLongLongAttrAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 408 { 409 TestObj* imp = V8TestObject::toNative(info.Holder()); 410 v8SetReturnValue(info, static_cast<double>(imp->unsignedLongLongAttr())); 411 return; 412 } 413 414 static void unsignedLongLongAttrAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 415 { 416 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 417 TestObjV8Internal::unsignedLongLongAttrAttrGetter(name, info); 418 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 419 } 420 421 static void unsignedLongLongAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 422 { 423 TestObj* imp = V8TestObject::toNative(info.Holder()); 424 V8TRYCATCH_VOID(unsigned long long, v, toUInt64(value)); 425 imp->setUnsignedLongLongAttr(v); 426 return; 427 } 428 429 static void unsignedLongLongAttrAttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 430 { 431 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 432 TestObjV8Internal::unsignedLongLongAttrAttrSetter(name, value, info); 433 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 434 } 435 436 static void stringAttrAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 437 { 438 TestObj* imp = V8TestObject::toNative(info.Holder()); 439 v8SetReturnValueString(info, imp->stringAttr(), info.GetIsolate()); 440 return; 441 } 442 443 static void stringAttrAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 444 { 445 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 446 TestObjV8Internal::stringAttrAttrGetter(name, info); 447 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 448 } 449 450 static void stringAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 451 { 452 TestObj* imp = V8TestObject::toNative(info.Holder()); 453 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, v, value); 454 imp->setStringAttr(v); 455 return; 456 } 457 458 static void stringAttrAttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 459 { 460 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 461 TestObjV8Internal::stringAttrAttrSetter(name, value, info); 462 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 463 } 464 465 static void eventHandlerAttrAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 466 { 467 TestObj* imp = V8TestObject::toNative(info.Holder()); 468 EventListener* listener = imp->eventHandlerAttr(isolatedWorldForIsolate(info.GetIsolate())); 469 v8SetReturnValue(info, listener ? v8::Handle<v8::Value>(V8AbstractEventListener::cast(listener)->getListenerObject(imp->scriptExecutionContext())) : v8::Handle<v8::Value>(v8::Null(info.GetIsolate()))); 470 return; 471 } 472 473 static void eventHandlerAttrAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 474 { 475 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 476 TestObjV8Internal::eventHandlerAttrAttrGetter(name, info); 477 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 478 } 479 480 static void eventHandlerAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 481 { 482 TestObj* imp = V8TestObject::toNative(info.Holder()); 483 if (!value->IsNull() && !value->IsFunction()) 484 value = v8::Null(info.GetIsolate()); 485 transferHiddenDependency(info.Holder(), imp->eventHandlerAttr(isolatedWorldForIsolate(info.GetIsolate())), value, V8TestObject::eventListenerCacheIndex, info.GetIsolate()); 486 imp->setEventHandlerAttr(V8EventListenerList::getEventListener(value, true, ListenerFindOrCreate), isolatedWorldForIsolate(info.GetIsolate())); 487 return; 488 } 489 490 static void eventHandlerAttrAttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 491 { 492 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 493 TestObjV8Internal::eventHandlerAttrAttrSetter(name, value, info); 494 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 495 } 496 497 static void testObjAttrAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 498 { 499 TestObj* imp = V8TestObject::toNative(info.Holder()); 500 v8SetReturnValue(info, toV8Fast(imp->testObjAttr(), info, imp)); 501 return; 502 } 503 504 static void testObjAttrAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 505 { 506 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 507 UseCounter::count(activeDOMWindow(), UseCounter::TestFeature); 508 TestObjV8Internal::testObjAttrAttrGetter(name, info); 509 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 510 } 511 512 static void testObjAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 513 { 514 TestObj* imp = V8TestObject::toNative(info.Holder()); 515 V8TRYCATCH_VOID(TestObj*, v, V8TestObject::HasInstance(value, info.GetIsolate(), worldType(info.GetIsolate())) ? V8TestObject::toNative(v8::Handle<v8::Object>::Cast(value)) : 0); 516 imp->setTestObjAttr(WTF::getPtr(v)); 517 return; 518 } 519 520 static void testObjAttrAttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 521 { 522 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 523 UseCounter::count(activeDOMWindow(), UseCounter::TestFeature); 524 TestObjV8Internal::testObjAttrAttrSetter(name, value, info); 525 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 526 } 527 528 static void XMLObjAttrAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 529 { 530 TestObj* imp = V8TestObject::toNative(info.Holder()); 531 v8SetReturnValue(info, toV8Fast(imp->xmlObjAttr(), info, imp)); 532 return; 533 } 534 535 static void XMLObjAttrAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 536 { 537 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 538 TestObjV8Internal::XMLObjAttrAttrGetter(name, info); 539 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 540 } 541 542 static void XMLObjAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 543 { 544 TestObj* imp = V8TestObject::toNative(info.Holder()); 545 V8TRYCATCH_VOID(TestObj*, v, V8TestObject::HasInstance(value, info.GetIsolate(), worldType(info.GetIsolate())) ? V8TestObject::toNative(v8::Handle<v8::Object>::Cast(value)) : 0); 546 imp->setXMLObjAttr(WTF::getPtr(v)); 547 return; 548 } 549 550 static void XMLObjAttrAttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 551 { 552 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 553 TestObjV8Internal::XMLObjAttrAttrSetter(name, value, info); 554 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 555 } 556 557 static void createAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 558 { 559 TestObj* imp = V8TestObject::toNative(info.Holder()); 560 v8SetReturnValueBool(info, imp->isCreate()); 561 return; 562 } 563 564 static void createAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 565 { 566 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 567 TestObjV8Internal::createAttrGetter(name, info); 568 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 569 } 570 571 static void createAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 572 { 573 TestObj* imp = V8TestObject::toNative(info.Holder()); 574 V8TRYCATCH_VOID(bool, v, value->BooleanValue()); 575 imp->setCreate(v); 576 return; 577 } 578 579 static void createAttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 580 { 581 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 582 TestObjV8Internal::createAttrSetter(name, value, info); 583 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 584 } 585 586 static void reflectedStringAttrAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 587 { 588 TestObj* imp = V8TestObject::toNative(info.Holder()); 589 v8SetReturnValueString(info, imp->fastGetAttribute(WebCore::HTMLNames::reflectedstringattrAttr), info.GetIsolate()); 590 return; 591 } 592 593 static void reflectedStringAttrAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 594 { 595 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 596 TestObjV8Internal::reflectedStringAttrAttrGetter(name, info); 597 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 598 } 599 600 static void reflectedStringAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 601 { 602 TestObj* imp = V8TestObject::toNative(info.Holder()); 603 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<WithNullCheck>, v, value); 604 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; 605 imp->setAttribute(WebCore::HTMLNames::reflectedstringattrAttr, v); 606 return; 607 } 608 609 static void reflectedStringAttrAttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 610 { 611 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 612 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; 613 TestObjV8Internal::reflectedStringAttrAttrSetter(name, value, info); 614 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 615 } 616 617 static void reflectedIntegralAttrAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 618 { 619 TestObj* imp = V8TestObject::toNative(info.Holder()); 620 v8SetReturnValueInt(info, imp->getIntegralAttribute(WebCore::HTMLNames::reflectedintegralattrAttr)); 621 return; 622 } 623 624 static void reflectedIntegralAttrAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 625 { 626 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 627 TestObjV8Internal::reflectedIntegralAttrAttrGetter(name, info); 628 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 629 } 630 631 static void reflectedIntegralAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 632 { 633 TestObj* imp = V8TestObject::toNative(info.Holder()); 634 V8TRYCATCH_VOID(int, v, toInt32(value)); 635 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; 636 imp->setIntegralAttribute(WebCore::HTMLNames::reflectedintegralattrAttr, v); 637 return; 638 } 639 640 static void reflectedIntegralAttrAttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 641 { 642 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 643 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; 644 TestObjV8Internal::reflectedIntegralAttrAttrSetter(name, value, info); 645 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 646 } 647 648 static void reflectedUnsignedIntegralAttrAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 649 { 650 TestObj* imp = V8TestObject::toNative(info.Holder()); 651 v8SetReturnValueUnsigned(info, std::max(0, imp->getIntegralAttribute(WebCore::HTMLNames::reflectedunsignedintegralattrAttr))); 652 return; 653 } 654 655 static void reflectedUnsignedIntegralAttrAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 656 { 657 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 658 TestObjV8Internal::reflectedUnsignedIntegralAttrAttrGetter(name, info); 659 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 660 } 661 662 static void reflectedUnsignedIntegralAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 663 { 664 TestObj* imp = V8TestObject::toNative(info.Holder()); 665 V8TRYCATCH_VOID(unsigned, v, toUInt32(value)); 666 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; 667 imp->setUnsignedIntegralAttribute(WebCore::HTMLNames::reflectedunsignedintegralattrAttr, v); 668 return; 669 } 670 671 static void reflectedUnsignedIntegralAttrAttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 672 { 673 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 674 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; 675 TestObjV8Internal::reflectedUnsignedIntegralAttrAttrSetter(name, value, info); 676 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 677 } 678 679 static void reflectedBooleanAttrAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 680 { 681 TestObj* imp = V8TestObject::toNative(info.Holder()); 682 v8SetReturnValueBool(info, imp->fastHasAttribute(WebCore::HTMLNames::reflectedbooleanattrAttr)); 683 return; 684 } 685 686 static void reflectedBooleanAttrAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 687 { 688 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 689 TestObjV8Internal::reflectedBooleanAttrAttrGetter(name, info); 690 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 691 } 692 693 static void reflectedBooleanAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 694 { 695 TestObj* imp = V8TestObject::toNative(info.Holder()); 696 V8TRYCATCH_VOID(bool, v, value->BooleanValue()); 697 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; 698 imp->setBooleanAttribute(WebCore::HTMLNames::reflectedbooleanattrAttr, v); 699 return; 700 } 701 702 static void reflectedBooleanAttrAttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 703 { 704 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 705 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; 706 TestObjV8Internal::reflectedBooleanAttrAttrSetter(name, value, info); 707 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 708 } 709 710 static void reflectedURLAttrAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 711 { 712 TestObj* imp = V8TestObject::toNative(info.Holder()); 713 v8SetReturnValueString(info, imp->getURLAttribute(WebCore::HTMLNames::reflectedurlattrAttr), info.GetIsolate()); 714 return; 715 } 716 717 static void reflectedURLAttrAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 718 { 719 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 720 TestObjV8Internal::reflectedURLAttrAttrGetter(name, info); 721 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 722 } 723 724 static void reflectedURLAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 725 { 726 TestObj* imp = V8TestObject::toNative(info.Holder()); 727 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<WithNullCheck>, v, value); 728 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; 729 imp->setAttribute(WebCore::HTMLNames::reflectedurlattrAttr, v); 730 return; 731 } 732 733 static void reflectedURLAttrAttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 734 { 735 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 736 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; 737 TestObjV8Internal::reflectedURLAttrAttrSetter(name, value, info); 738 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 739 } 740 741 static void reflectedStringAttrAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 742 { 743 TestObj* imp = V8TestObject::toNative(info.Holder()); 744 v8SetReturnValueString(info, imp->fastGetAttribute(WebCore::HTMLNames::customContentStringAttrAttr), info.GetIsolate()); 745 return; 746 } 747 748 static void reflectedStringAttrAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 749 { 750 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 751 TestObjV8Internal::reflectedStringAttrAttrGetter(name, info); 752 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 753 } 754 755 static void reflectedStringAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 756 { 757 TestObj* imp = V8TestObject::toNative(info.Holder()); 758 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<WithNullCheck>, v, value); 759 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; 760 imp->setAttribute(WebCore::HTMLNames::customContentStringAttrAttr, v); 761 return; 762 } 763 764 static void reflectedStringAttrAttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 765 { 766 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 767 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; 768 TestObjV8Internal::reflectedStringAttrAttrSetter(name, value, info); 769 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 770 } 771 772 static void reflectedCustomIntegralAttrAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 773 { 774 TestObj* imp = V8TestObject::toNative(info.Holder()); 775 v8SetReturnValueInt(info, imp->getIntegralAttribute(WebCore::HTMLNames::customContentIntegralAttrAttr)); 776 return; 777 } 778 779 static void reflectedCustomIntegralAttrAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 780 { 781 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 782 TestObjV8Internal::reflectedCustomIntegralAttrAttrGetter(name, info); 783 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 784 } 785 786 static void reflectedCustomIntegralAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 787 { 788 TestObj* imp = V8TestObject::toNative(info.Holder()); 789 V8TRYCATCH_VOID(int, v, toInt32(value)); 790 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; 791 imp->setIntegralAttribute(WebCore::HTMLNames::customContentIntegralAttrAttr, v); 792 return; 793 } 794 795 static void reflectedCustomIntegralAttrAttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 796 { 797 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 798 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; 799 TestObjV8Internal::reflectedCustomIntegralAttrAttrSetter(name, value, info); 800 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 801 } 802 803 static void reflectedCustomBooleanAttrAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 804 { 805 TestObj* imp = V8TestObject::toNative(info.Holder()); 806 v8SetReturnValueBool(info, imp->fastHasAttribute(WebCore::HTMLNames::customContentBooleanAttrAttr)); 807 return; 808 } 809 810 static void reflectedCustomBooleanAttrAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 811 { 812 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 813 TestObjV8Internal::reflectedCustomBooleanAttrAttrGetter(name, info); 814 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 815 } 816 817 static void reflectedCustomBooleanAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 818 { 819 TestObj* imp = V8TestObject::toNative(info.Holder()); 820 V8TRYCATCH_VOID(bool, v, value->BooleanValue()); 821 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; 822 imp->setBooleanAttribute(WebCore::HTMLNames::customContentBooleanAttrAttr, v); 823 return; 824 } 825 826 static void reflectedCustomBooleanAttrAttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 827 { 828 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 829 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; 830 TestObjV8Internal::reflectedCustomBooleanAttrAttrSetter(name, value, info); 831 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 832 } 833 834 static void reflectedCustomURLAttrAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 835 { 836 TestObj* imp = V8TestObject::toNative(info.Holder()); 837 v8SetReturnValueString(info, imp->getURLAttribute(WebCore::HTMLNames::customContentURLAttrAttr), info.GetIsolate()); 838 return; 839 } 840 841 static void reflectedCustomURLAttrAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 842 { 843 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 844 TestObjV8Internal::reflectedCustomURLAttrAttrGetter(name, info); 845 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 846 } 847 848 static void reflectedCustomURLAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 849 { 850 TestObj* imp = V8TestObject::toNative(info.Holder()); 851 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<WithNullCheck>, v, value); 852 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; 853 imp->setAttribute(WebCore::HTMLNames::customContentURLAttrAttr, v); 854 return; 855 } 856 857 static void reflectedCustomURLAttrAttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 858 { 859 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 860 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; 861 TestObjV8Internal::reflectedCustomURLAttrAttrSetter(name, value, info); 862 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 863 } 864 865 static void typedArrayAttrAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 866 { 867 TestObj* imp = V8TestObject::toNative(info.Holder()); 868 v8SetReturnValue(info, toV8Fast(imp->typedArrayAttr(), info, imp)); 869 return; 870 } 871 872 static void typedArrayAttrAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 873 { 874 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 875 TestObjV8Internal::typedArrayAttrAttrGetter(name, info); 876 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 877 } 878 879 static void typedArrayAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 880 { 881 TestObj* imp = V8TestObject::toNative(info.Holder()); 882 V8TRYCATCH_VOID(Float32Array*, v, value->IsFloat32Array() ? V8Float32Array::toNative(v8::Handle<v8::Float32Array>::Cast(value)) : 0); 883 imp->setTypedArrayAttr(WTF::getPtr(v)); 884 return; 885 } 886 887 static void typedArrayAttrAttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 888 { 889 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 890 TestObjV8Internal::typedArrayAttrAttrSetter(name, value, info); 891 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 892 } 893 894 static void attrWithGetterExceptionAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 895 { 896 TestObj* imp = V8TestObject::toNative(info.Holder()); 897 ExceptionState es(info.GetIsolate()); 898 int v = imp->attrWithGetterException(es); 899 if (UNLIKELY(es.throwIfNeeded())) 900 return; 901 v8SetReturnValueInt(info, v); 902 return; 903 } 904 905 static void attrWithGetterExceptionAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 906 { 907 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 908 TestObjV8Internal::attrWithGetterExceptionAttrGetter(name, info); 909 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 910 } 911 912 static void attrWithGetterExceptionAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 913 { 914 TestObj* imp = V8TestObject::toNative(info.Holder()); 915 V8TRYCATCH_VOID(int, v, toInt32(value)); 916 imp->setAttrWithGetterException(v); 917 return; 918 } 919 920 static void attrWithGetterExceptionAttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 921 { 922 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 923 TestObjV8Internal::attrWithGetterExceptionAttrSetter(name, value, info); 924 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 925 } 926 927 static void attrWithSetterExceptionAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 928 { 929 TestObj* imp = V8TestObject::toNative(info.Holder()); 930 v8SetReturnValueInt(info, imp->attrWithSetterException()); 931 return; 932 } 933 934 static void attrWithSetterExceptionAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 935 { 936 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 937 TestObjV8Internal::attrWithSetterExceptionAttrGetter(name, info); 938 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 939 } 940 941 static void attrWithSetterExceptionAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 942 { 943 TestObj* imp = V8TestObject::toNative(info.Holder()); 944 V8TRYCATCH_VOID(int, v, toInt32(value)); 945 ExceptionState es(info.GetIsolate()); 946 imp->setAttrWithSetterException(v, es); 947 es.throwIfNeeded(); 948 return; 949 } 950 951 static void attrWithSetterExceptionAttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 952 { 953 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 954 TestObjV8Internal::attrWithSetterExceptionAttrSetter(name, value, info); 955 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 956 } 957 958 static void stringAttrWithGetterExceptionAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 959 { 960 TestObj* imp = V8TestObject::toNative(info.Holder()); 961 ExceptionState es(info.GetIsolate()); 962 String v = imp->stringAttrWithGetterException(es); 963 if (UNLIKELY(es.throwIfNeeded())) 964 return; 965 v8SetReturnValueString(info, v, info.GetIsolate()); 966 return; 967 } 968 969 static void stringAttrWithGetterExceptionAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 970 { 971 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 972 TestObjV8Internal::stringAttrWithGetterExceptionAttrGetter(name, info); 973 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 974 } 975 976 static void stringAttrWithGetterExceptionAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 977 { 978 TestObj* imp = V8TestObject::toNative(info.Holder()); 979 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, v, value); 980 imp->setStringAttrWithGetterException(v); 981 return; 982 } 983 984 static void stringAttrWithGetterExceptionAttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 985 { 986 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 987 TestObjV8Internal::stringAttrWithGetterExceptionAttrSetter(name, value, info); 988 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 989 } 990 991 static void stringAttrWithSetterExceptionAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 992 { 993 TestObj* imp = V8TestObject::toNative(info.Holder()); 994 v8SetReturnValueString(info, imp->stringAttrWithSetterException(), info.GetIsolate()); 995 return; 996 } 997 998 static void stringAttrWithSetterExceptionAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 999 { 1000 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 1001 TestObjV8Internal::stringAttrWithSetterExceptionAttrGetter(name, info); 1002 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1003 } 1004 1005 static void stringAttrWithSetterExceptionAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 1006 { 1007 TestObj* imp = V8TestObject::toNative(info.Holder()); 1008 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, v, value); 1009 ExceptionState es(info.GetIsolate()); 1010 imp->setStringAttrWithSetterException(v, es); 1011 es.throwIfNeeded(); 1012 return; 1013 } 1014 1015 static void stringAttrWithSetterExceptionAttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 1016 { 1017 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 1018 TestObjV8Internal::stringAttrWithSetterExceptionAttrSetter(name, value, info); 1019 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1020 } 1021 1022 static void customAttrAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 1023 { 1024 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 1025 V8TestObject::customAttrAttrGetterCustom(name, info); 1026 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1027 } 1028 1029 static void customAttrAttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 1030 { 1031 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 1032 V8TestObject::customAttrAttrSetterCustom(name, value, info); 1033 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1034 } 1035 1036 static void withScriptStateAttributeAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 1037 { 1038 TestObj* imp = V8TestObject::toNative(info.Holder()); 1039 ScriptState* currentState = ScriptState::current(); 1040 if (!currentState) 1041 return v8Undefined(); 1042 ScriptState& state = *currentState; 1043 v8SetReturnValueInt(info, imp->withScriptStateAttribute(&state)); 1044 return; 1045 } 1046 1047 static void withScriptStateAttributeAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 1048 { 1049 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 1050 TestObjV8Internal::withScriptStateAttributeAttrGetter(name, info); 1051 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1052 } 1053 1054 static void withScriptStateAttributeAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 1055 { 1056 TestObj* imp = V8TestObject::toNative(info.Holder()); 1057 V8TRYCATCH_VOID(int, v, toInt32(value)); 1058 ScriptState* currentState = ScriptState::current(); 1059 if (!currentState) 1060 return; 1061 ScriptState& state = *currentState; 1062 imp->setWithScriptStateAttribute(&state, v); 1063 if (state.hadException()) 1064 throwError(state.exception()); 1065 return; 1066 } 1067 1068 static void withScriptStateAttributeAttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 1069 { 1070 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 1071 TestObjV8Internal::withScriptStateAttributeAttrSetter(name, value, info); 1072 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1073 } 1074 1075 static void withScriptExecutionContextAttributeAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 1076 { 1077 TestObj* imp = V8TestObject::toNative(info.Holder()); 1078 ScriptExecutionContext* scriptContext = getScriptExecutionContext(); 1079 v8SetReturnValue(info, toV8Fast(imp->withScriptExecutionContextAttribute(scriptContext), info, imp)); 1080 return; 1081 } 1082 1083 static void withScriptExecutionContextAttributeAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 1084 { 1085 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 1086 TestObjV8Internal::withScriptExecutionContextAttributeAttrGetter(name, info); 1087 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1088 } 1089 1090 static void withScriptExecutionContextAttributeAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 1091 { 1092 TestObj* imp = V8TestObject::toNative(info.Holder()); 1093 V8TRYCATCH_VOID(TestObj*, v, V8TestObject::HasInstance(value, info.GetIsolate(), worldType(info.GetIsolate())) ? V8TestObject::toNative(v8::Handle<v8::Object>::Cast(value)) : 0); 1094 ScriptExecutionContext* scriptContext = getScriptExecutionContext(); 1095 imp->setWithScriptExecutionContextAttribute(scriptContext, WTF::getPtr(v)); 1096 return; 1097 } 1098 1099 static void withScriptExecutionContextAttributeAttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 1100 { 1101 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 1102 TestObjV8Internal::withScriptExecutionContextAttributeAttrSetter(name, value, info); 1103 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1104 } 1105 1106 static void withActiveWindowAndFirstWindowAttributeAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 1107 { 1108 TestObj* imp = V8TestObject::toNative(info.Holder()); 1109 v8SetReturnValue(info, toV8Fast(imp->withActiveWindowAndFirstWindowAttribute(), info, imp)); 1110 return; 1111 } 1112 1113 static void withActiveWindowAndFirstWindowAttributeAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 1114 { 1115 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 1116 TestObjV8Internal::withActiveWindowAndFirstWindowAttributeAttrGetter(name, info); 1117 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1118 } 1119 1120 static void withActiveWindowAndFirstWindowAttributeAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 1121 { 1122 TestObj* imp = V8TestObject::toNative(info.Holder()); 1123 V8TRYCATCH_VOID(TestObj*, v, V8TestObject::HasInstance(value, info.GetIsolate(), worldType(info.GetIsolate())) ? V8TestObject::toNative(v8::Handle<v8::Object>::Cast(value)) : 0); 1124 imp->setWithActiveWindowAndFirstWindowAttribute(activeDOMWindow(), firstDOMWindow(), WTF::getPtr(v)); 1125 return; 1126 } 1127 1128 static void withActiveWindowAndFirstWindowAttributeAttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 1129 { 1130 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 1131 TestObjV8Internal::withActiveWindowAndFirstWindowAttributeAttrSetter(name, value, info); 1132 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1133 } 1134 1135 static void withScriptStateAttributeRaisesAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 1136 { 1137 TestObj* imp = V8TestObject::toNative(info.Holder()); 1138 ExceptionState es(info.GetIsolate()); 1139 ScriptState* currentState = ScriptState::current(); 1140 if (!currentState) 1141 return v8Undefined(); 1142 ScriptState& state = *currentState; 1143 RefPtr<TestObj> v = imp->withScriptStateAttributeRaises(&state, es); 1144 if (UNLIKELY(es.throwIfNeeded())) 1145 return; 1146 if (state.hadException()) { 1147 throwError(state.exception()); 1148 return; 1149 } 1150 v8SetReturnValue(info, toV8Fast(v.release(), info, imp)); 1151 return; 1152 } 1153 1154 static void withScriptStateAttributeRaisesAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 1155 { 1156 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 1157 TestObjV8Internal::withScriptStateAttributeRaisesAttrGetter(name, info); 1158 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1159 } 1160 1161 static void withScriptStateAttributeRaisesAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 1162 { 1163 TestObj* imp = V8TestObject::toNative(info.Holder()); 1164 V8TRYCATCH_VOID(TestObj*, v, V8TestObject::HasInstance(value, info.GetIsolate(), worldType(info.GetIsolate())) ? V8TestObject::toNative(v8::Handle<v8::Object>::Cast(value)) : 0); 1165 ScriptState* currentState = ScriptState::current(); 1166 if (!currentState) 1167 return; 1168 ScriptState& state = *currentState; 1169 imp->setWithScriptStateAttributeRaises(&state, WTF::getPtr(v)); 1170 if (state.hadException()) 1171 throwError(state.exception()); 1172 return; 1173 } 1174 1175 static void withScriptStateAttributeRaisesAttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 1176 { 1177 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 1178 TestObjV8Internal::withScriptStateAttributeRaisesAttrSetter(name, value, info); 1179 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1180 } 1181 1182 static void withScriptExecutionContextAttributeRaisesAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 1183 { 1184 TestObj* imp = V8TestObject::toNative(info.Holder()); 1185 ExceptionState es(info.GetIsolate()); 1186 ScriptExecutionContext* scriptContext = getScriptExecutionContext(); 1187 RefPtr<TestObj> v = imp->withScriptExecutionContextAttributeRaises(scriptContext, es); 1188 if (UNLIKELY(es.throwIfNeeded())) 1189 return; 1190 v8SetReturnValue(info, toV8Fast(v.release(), info, imp)); 1191 return; 1192 } 1193 1194 static void withScriptExecutionContextAttributeRaisesAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 1195 { 1196 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 1197 TestObjV8Internal::withScriptExecutionContextAttributeRaisesAttrGetter(name, info); 1198 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1199 } 1200 1201 static void withScriptExecutionContextAttributeRaisesAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 1202 { 1203 TestObj* imp = V8TestObject::toNative(info.Holder()); 1204 V8TRYCATCH_VOID(TestObj*, v, V8TestObject::HasInstance(value, info.GetIsolate(), worldType(info.GetIsolate())) ? V8TestObject::toNative(v8::Handle<v8::Object>::Cast(value)) : 0); 1205 ScriptExecutionContext* scriptContext = getScriptExecutionContext(); 1206 imp->setWithScriptExecutionContextAttributeRaises(scriptContext, WTF::getPtr(v)); 1207 return; 1208 } 1209 1210 static void withScriptExecutionContextAttributeRaisesAttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 1211 { 1212 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 1213 TestObjV8Internal::withScriptExecutionContextAttributeRaisesAttrSetter(name, value, info); 1214 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1215 } 1216 1217 static void withScriptExecutionContextAndScriptStateAttributeAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 1218 { 1219 TestObj* imp = V8TestObject::toNative(info.Holder()); 1220 ScriptState* currentState = ScriptState::current(); 1221 if (!currentState) 1222 return v8Undefined(); 1223 ScriptState& state = *currentState; 1224 ScriptExecutionContext* scriptContext = getScriptExecutionContext(); 1225 v8SetReturnValue(info, toV8Fast(imp->withScriptExecutionContextAndScriptStateAttribute(&state, scriptContext), info, imp)); 1226 return; 1227 } 1228 1229 static void withScriptExecutionContextAndScriptStateAttributeAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 1230 { 1231 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 1232 TestObjV8Internal::withScriptExecutionContextAndScriptStateAttributeAttrGetter(name, info); 1233 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1234 } 1235 1236 static void withScriptExecutionContextAndScriptStateAttributeAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 1237 { 1238 TestObj* imp = V8TestObject::toNative(info.Holder()); 1239 V8TRYCATCH_VOID(TestObj*, v, V8TestObject::HasInstance(value, info.GetIsolate(), worldType(info.GetIsolate())) ? V8TestObject::toNative(v8::Handle<v8::Object>::Cast(value)) : 0); 1240 ScriptState* currentState = ScriptState::current(); 1241 if (!currentState) 1242 return; 1243 ScriptState& state = *currentState; 1244 ScriptExecutionContext* scriptContext = getScriptExecutionContext(); 1245 imp->setWithScriptExecutionContextAndScriptStateAttribute(&state, scriptContext, WTF::getPtr(v)); 1246 if (state.hadException()) 1247 throwError(state.exception()); 1248 return; 1249 } 1250 1251 static void withScriptExecutionContextAndScriptStateAttributeAttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 1252 { 1253 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 1254 TestObjV8Internal::withScriptExecutionContextAndScriptStateAttributeAttrSetter(name, value, info); 1255 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1256 } 1257 1258 static void withScriptExecutionContextAndScriptStateAttributeRaisesAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 1259 { 1260 TestObj* imp = V8TestObject::toNative(info.Holder()); 1261 ExceptionState es(info.GetIsolate()); 1262 ScriptState* currentState = ScriptState::current(); 1263 if (!currentState) 1264 return v8Undefined(); 1265 ScriptState& state = *currentState; 1266 ScriptExecutionContext* scriptContext = getScriptExecutionContext(); 1267 RefPtr<TestObj> v = imp->withScriptExecutionContextAndScriptStateAttributeRaises(&state, scriptContext, es); 1268 if (UNLIKELY(es.throwIfNeeded())) 1269 return; 1270 if (state.hadException()) { 1271 throwError(state.exception()); 1272 return; 1273 } 1274 v8SetReturnValue(info, toV8Fast(v.release(), info, imp)); 1275 return; 1276 } 1277 1278 static void withScriptExecutionContextAndScriptStateAttributeRaisesAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 1279 { 1280 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 1281 TestObjV8Internal::withScriptExecutionContextAndScriptStateAttributeRaisesAttrGetter(name, info); 1282 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1283 } 1284 1285 static void withScriptExecutionContextAndScriptStateAttributeRaisesAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 1286 { 1287 TestObj* imp = V8TestObject::toNative(info.Holder()); 1288 V8TRYCATCH_VOID(TestObj*, v, V8TestObject::HasInstance(value, info.GetIsolate(), worldType(info.GetIsolate())) ? V8TestObject::toNative(v8::Handle<v8::Object>::Cast(value)) : 0); 1289 ScriptState* currentState = ScriptState::current(); 1290 if (!currentState) 1291 return; 1292 ScriptState& state = *currentState; 1293 ScriptExecutionContext* scriptContext = getScriptExecutionContext(); 1294 imp->setWithScriptExecutionContextAndScriptStateAttributeRaises(&state, scriptContext, WTF::getPtr(v)); 1295 if (state.hadException()) 1296 throwError(state.exception()); 1297 return; 1298 } 1299 1300 static void withScriptExecutionContextAndScriptStateAttributeRaisesAttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 1301 { 1302 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 1303 TestObjV8Internal::withScriptExecutionContextAndScriptStateAttributeRaisesAttrSetter(name, value, info); 1304 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1305 } 1306 1307 static void withScriptExecutionContextAndScriptStateWithSpacesAttributeAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 1308 { 1309 TestObj* imp = V8TestObject::toNative(info.Holder()); 1310 ScriptState* currentState = ScriptState::current(); 1311 if (!currentState) 1312 return v8Undefined(); 1313 ScriptState& state = *currentState; 1314 ScriptExecutionContext* scriptContext = getScriptExecutionContext(); 1315 v8SetReturnValue(info, toV8Fast(imp->withScriptExecutionContextAndScriptStateWithSpacesAttribute(&state, scriptContext), info, imp)); 1316 return; 1317 } 1318 1319 static void withScriptExecutionContextAndScriptStateWithSpacesAttributeAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 1320 { 1321 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 1322 TestObjV8Internal::withScriptExecutionContextAndScriptStateWithSpacesAttributeAttrGetter(name, info); 1323 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1324 } 1325 1326 static void withScriptExecutionContextAndScriptStateWithSpacesAttributeAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 1327 { 1328 TestObj* imp = V8TestObject::toNative(info.Holder()); 1329 V8TRYCATCH_VOID(TestObj*, v, V8TestObject::HasInstance(value, info.GetIsolate(), worldType(info.GetIsolate())) ? V8TestObject::toNative(v8::Handle<v8::Object>::Cast(value)) : 0); 1330 ScriptState* currentState = ScriptState::current(); 1331 if (!currentState) 1332 return; 1333 ScriptState& state = *currentState; 1334 ScriptExecutionContext* scriptContext = getScriptExecutionContext(); 1335 imp->setWithScriptExecutionContextAndScriptStateWithSpacesAttribute(&state, scriptContext, WTF::getPtr(v)); 1336 if (state.hadException()) 1337 throwError(state.exception()); 1338 return; 1339 } 1340 1341 static void withScriptExecutionContextAndScriptStateWithSpacesAttributeAttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 1342 { 1343 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 1344 TestObjV8Internal::withScriptExecutionContextAndScriptStateWithSpacesAttributeAttrSetter(name, value, info); 1345 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1346 } 1347 1348 static void enforcedRangeByteAttrAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 1349 { 1350 TestObj* imp = V8TestObject::toNative(info.Holder()); 1351 v8SetReturnValueInt(info, imp->enforcedRangeByteAttr()); 1352 return; 1353 } 1354 1355 static void enforcedRangeByteAttrAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 1356 { 1357 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 1358 TestObjV8Internal::enforcedRangeByteAttrAttrGetter(name, info); 1359 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1360 } 1361 1362 static void enforcedRangeByteAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 1363 { 1364 TestObj* imp = V8TestObject::toNative(info.Holder()); 1365 V8TRYCATCH_WITH_TYPECHECK_VOID(int, v, toInt8(value, EnforceRange, ok), info.GetIsolate()); 1366 imp->setEnforcedRangeByteAttr(v); 1367 return; 1368 } 1369 1370 static void enforcedRangeByteAttrAttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 1371 { 1372 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 1373 TestObjV8Internal::enforcedRangeByteAttrAttrSetter(name, value, info); 1374 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1375 } 1376 1377 static void enforcedRangeOctetAttrAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 1378 { 1379 TestObj* imp = V8TestObject::toNative(info.Holder()); 1380 v8SetReturnValueUnsigned(info, imp->enforcedRangeOctetAttr()); 1381 return; 1382 } 1383 1384 static void enforcedRangeOctetAttrAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 1385 { 1386 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 1387 TestObjV8Internal::enforcedRangeOctetAttrAttrGetter(name, info); 1388 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1389 } 1390 1391 static void enforcedRangeOctetAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 1392 { 1393 TestObj* imp = V8TestObject::toNative(info.Holder()); 1394 V8TRYCATCH_WITH_TYPECHECK_VOID(unsigned, v, toUInt8(value, EnforceRange, ok), info.GetIsolate()); 1395 imp->setEnforcedRangeOctetAttr(v); 1396 return; 1397 } 1398 1399 static void enforcedRangeOctetAttrAttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 1400 { 1401 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 1402 TestObjV8Internal::enforcedRangeOctetAttrAttrSetter(name, value, info); 1403 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1404 } 1405 1406 static void enforcedRangeLongAttrAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 1407 { 1408 TestObj* imp = V8TestObject::toNative(info.Holder()); 1409 v8SetReturnValueInt(info, imp->enforcedRangeLongAttr()); 1410 return; 1411 } 1412 1413 static void enforcedRangeLongAttrAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 1414 { 1415 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 1416 TestObjV8Internal::enforcedRangeLongAttrAttrGetter(name, info); 1417 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1418 } 1419 1420 static void enforcedRangeLongAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 1421 { 1422 TestObj* imp = V8TestObject::toNative(info.Holder()); 1423 V8TRYCATCH_WITH_TYPECHECK_VOID(int, v, toInt32(value, EnforceRange, ok), info.GetIsolate()); 1424 imp->setEnforcedRangeLongAttr(v); 1425 return; 1426 } 1427 1428 static void enforcedRangeLongAttrAttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 1429 { 1430 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 1431 TestObjV8Internal::enforcedRangeLongAttrAttrSetter(name, value, info); 1432 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1433 } 1434 1435 static void enforcedRangeUnsignedLongAttrAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 1436 { 1437 TestObj* imp = V8TestObject::toNative(info.Holder()); 1438 v8SetReturnValueUnsigned(info, imp->enforcedRangeUnsignedLongAttr()); 1439 return; 1440 } 1441 1442 static void enforcedRangeUnsignedLongAttrAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 1443 { 1444 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 1445 TestObjV8Internal::enforcedRangeUnsignedLongAttrAttrGetter(name, info); 1446 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1447 } 1448 1449 static void enforcedRangeUnsignedLongAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 1450 { 1451 TestObj* imp = V8TestObject::toNative(info.Holder()); 1452 V8TRYCATCH_WITH_TYPECHECK_VOID(unsigned, v, toUInt32(value, EnforceRange, ok), info.GetIsolate()); 1453 imp->setEnforcedRangeUnsignedLongAttr(v); 1454 return; 1455 } 1456 1457 static void enforcedRangeUnsignedLongAttrAttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 1458 { 1459 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 1460 TestObjV8Internal::enforcedRangeUnsignedLongAttrAttrSetter(name, value, info); 1461 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1462 } 1463 1464 static void enforcedRangeLongLongAttrAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 1465 { 1466 TestObj* imp = V8TestObject::toNative(info.Holder()); 1467 v8SetReturnValue(info, static_cast<double>(imp->enforcedRangeLongLongAttr())); 1468 return; 1469 } 1470 1471 static void enforcedRangeLongLongAttrAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 1472 { 1473 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 1474 TestObjV8Internal::enforcedRangeLongLongAttrAttrGetter(name, info); 1475 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1476 } 1477 1478 static void enforcedRangeLongLongAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 1479 { 1480 TestObj* imp = V8TestObject::toNative(info.Holder()); 1481 V8TRYCATCH_WITH_TYPECHECK_VOID(long long, v, toInt64(value, EnforceRange, ok), info.GetIsolate()); 1482 imp->setEnforcedRangeLongLongAttr(v); 1483 return; 1484 } 1485 1486 static void enforcedRangeLongLongAttrAttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 1487 { 1488 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 1489 TestObjV8Internal::enforcedRangeLongLongAttrAttrSetter(name, value, info); 1490 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1491 } 1492 1493 static void enforcedRangeUnsignedLongLongAttrAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 1494 { 1495 TestObj* imp = V8TestObject::toNative(info.Holder()); 1496 v8SetReturnValue(info, static_cast<double>(imp->enforcedRangeUnsignedLongLongAttr())); 1497 return; 1498 } 1499 1500 static void enforcedRangeUnsignedLongLongAttrAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 1501 { 1502 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 1503 TestObjV8Internal::enforcedRangeUnsignedLongLongAttrAttrGetter(name, info); 1504 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1505 } 1506 1507 static void enforcedRangeUnsignedLongLongAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 1508 { 1509 TestObj* imp = V8TestObject::toNative(info.Holder()); 1510 V8TRYCATCH_WITH_TYPECHECK_VOID(unsigned long long, v, toUInt64(value, EnforceRange, ok), info.GetIsolate()); 1511 imp->setEnforcedRangeUnsignedLongLongAttr(v); 1512 return; 1513 } 1514 1515 static void enforcedRangeUnsignedLongLongAttrAttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 1516 { 1517 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 1518 TestObjV8Internal::enforcedRangeUnsignedLongLongAttrAttrSetter(name, value, info); 1519 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1520 } 1521 1522 #if ENABLE(Condition1) 1523 1524 static void conditionalAttr1AttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 1525 { 1526 TestObj* imp = V8TestObject::toNative(info.Holder()); 1527 v8SetReturnValueInt(info, imp->conditionalAttr1()); 1528 return; 1529 } 1530 1531 #endif // ENABLE(Condition1) 1532 1533 #if ENABLE(Condition1) 1534 1535 static void conditionalAttr1AttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 1536 { 1537 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 1538 TestObjV8Internal::conditionalAttr1AttrGetter(name, info); 1539 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1540 } 1541 1542 #endif // ENABLE(Condition1) 1543 1544 #if ENABLE(Condition1) 1545 1546 static void conditionalAttr1AttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 1547 { 1548 TestObj* imp = V8TestObject::toNative(info.Holder()); 1549 V8TRYCATCH_VOID(int, v, toInt32(value)); 1550 imp->setConditionalAttr1(v); 1551 return; 1552 } 1553 1554 #endif // ENABLE(Condition1) 1555 1556 #if ENABLE(Condition1) 1557 1558 static void conditionalAttr1AttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 1559 { 1560 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 1561 TestObjV8Internal::conditionalAttr1AttrSetter(name, value, info); 1562 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1563 } 1564 1565 #endif // ENABLE(Condition1) 1566 1567 #if ENABLE(Condition1) && ENABLE(Condition2) 1568 1569 static void conditionalAttr2AttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 1570 { 1571 TestObj* imp = V8TestObject::toNative(info.Holder()); 1572 v8SetReturnValueInt(info, imp->conditionalAttr2()); 1573 return; 1574 } 1575 1576 #endif // ENABLE(Condition1) && ENABLE(Condition2) 1577 1578 #if ENABLE(Condition1) && ENABLE(Condition2) 1579 1580 static void conditionalAttr2AttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 1581 { 1582 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 1583 TestObjV8Internal::conditionalAttr2AttrGetter(name, info); 1584 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1585 } 1586 1587 #endif // ENABLE(Condition1) && ENABLE(Condition2) 1588 1589 #if ENABLE(Condition1) && ENABLE(Condition2) 1590 1591 static void conditionalAttr2AttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 1592 { 1593 TestObj* imp = V8TestObject::toNative(info.Holder()); 1594 V8TRYCATCH_VOID(int, v, toInt32(value)); 1595 imp->setConditionalAttr2(v); 1596 return; 1597 } 1598 1599 #endif // ENABLE(Condition1) && ENABLE(Condition2) 1600 1601 #if ENABLE(Condition1) && ENABLE(Condition2) 1602 1603 static void conditionalAttr2AttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 1604 { 1605 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 1606 TestObjV8Internal::conditionalAttr2AttrSetter(name, value, info); 1607 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1608 } 1609 1610 #endif // ENABLE(Condition1) && ENABLE(Condition2) 1611 1612 #if ENABLE(Condition1) || ENABLE(Condition2) 1613 1614 static void conditionalAttr3AttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 1615 { 1616 TestObj* imp = V8TestObject::toNative(info.Holder()); 1617 v8SetReturnValueInt(info, imp->conditionalAttr3()); 1618 return; 1619 } 1620 1621 #endif // ENABLE(Condition1) || ENABLE(Condition2) 1622 1623 #if ENABLE(Condition1) || ENABLE(Condition2) 1624 1625 static void conditionalAttr3AttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 1626 { 1627 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 1628 TestObjV8Internal::conditionalAttr3AttrGetter(name, info); 1629 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1630 } 1631 1632 #endif // ENABLE(Condition1) || ENABLE(Condition2) 1633 1634 #if ENABLE(Condition1) || ENABLE(Condition2) 1635 1636 static void conditionalAttr3AttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 1637 { 1638 TestObj* imp = V8TestObject::toNative(info.Holder()); 1639 V8TRYCATCH_VOID(int, v, toInt32(value)); 1640 imp->setConditionalAttr3(v); 1641 return; 1642 } 1643 1644 #endif // ENABLE(Condition1) || ENABLE(Condition2) 1645 1646 #if ENABLE(Condition1) || ENABLE(Condition2) 1647 1648 static void conditionalAttr3AttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 1649 { 1650 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 1651 TestObjV8Internal::conditionalAttr3AttrSetter(name, value, info); 1652 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1653 } 1654 1655 #endif // ENABLE(Condition1) || ENABLE(Condition2) 1656 1657 static void cachedAttribute1AttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 1658 { 1659 TestObj* imp = V8TestObject::toNative(info.Holder()); 1660 v8SetReturnValue(info, imp->cachedAttribute1().v8Value()); 1661 return; 1662 } 1663 1664 static void cachedAttribute1AttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 1665 { 1666 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 1667 TestObjV8Internal::cachedAttribute1AttrGetter(name, info); 1668 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1669 } 1670 1671 static void cachedAttribute2AttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 1672 { 1673 TestObj* imp = V8TestObject::toNative(info.Holder()); 1674 v8SetReturnValue(info, imp->cachedAttribute2().v8Value()); 1675 return; 1676 } 1677 1678 static void cachedAttribute2AttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 1679 { 1680 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 1681 TestObjV8Internal::cachedAttribute2AttrGetter(name, info); 1682 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1683 } 1684 1685 static void anyAttributeAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 1686 { 1687 TestObj* imp = V8TestObject::toNative(info.Holder()); 1688 v8SetReturnValue(info, imp->anyAttribute().v8Value()); 1689 return; 1690 } 1691 1692 static void anyAttributeAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 1693 { 1694 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 1695 TestObjV8Internal::anyAttributeAttrGetter(name, info); 1696 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1697 } 1698 1699 static void anyAttributeAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 1700 { 1701 TestObj* imp = V8TestObject::toNative(info.Holder()); 1702 V8TRYCATCH_VOID(ScriptValue, v, ScriptValue(value)); 1703 imp->setAnyAttribute(v); 1704 return; 1705 } 1706 1707 static void anyAttributeAttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 1708 { 1709 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 1710 TestObjV8Internal::anyAttributeAttrSetter(name, value, info); 1711 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1712 } 1713 1714 static void callbackFunctionAttributeAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 1715 { 1716 TestObj* imp = V8TestObject::toNative(info.Holder()); 1717 v8SetReturnValue(info, imp->callbackFunctionAttribute().v8Value()); 1718 return; 1719 } 1720 1721 static void callbackFunctionAttributeAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 1722 { 1723 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 1724 TestObjV8Internal::callbackFunctionAttributeAttrGetter(name, info); 1725 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1726 } 1727 1728 static void callbackFunctionAttributeAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 1729 { 1730 TestObj* imp = V8TestObject::toNative(info.Holder()); 1731 V8TRYCATCH_VOID(ScriptValue, v, ScriptValue(value)); 1732 imp->setCallbackFunctionAttribute(v); 1733 return; 1734 } 1735 1736 static void callbackFunctionAttributeAttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 1737 { 1738 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 1739 TestObjV8Internal::callbackFunctionAttributeAttrSetter(name, value, info); 1740 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1741 } 1742 1743 static void enabledAtRuntimeAttr1AttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 1744 { 1745 TestObj* imp = V8TestObject::toNative(info.Holder()); 1746 v8SetReturnValueInt(info, imp->enabledAtRuntimeAttr1()); 1747 return; 1748 } 1749 1750 static void enabledAtRuntimeAttr1AttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 1751 { 1752 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 1753 TestObjV8Internal::enabledAtRuntimeAttr1AttrGetter(name, info); 1754 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1755 } 1756 1757 static void enabledAtRuntimeAttr1AttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 1758 { 1759 TestObj* imp = V8TestObject::toNative(info.Holder()); 1760 V8TRYCATCH_VOID(int, v, toInt32(value)); 1761 imp->setEnabledAtRuntimeAttr1(v); 1762 return; 1763 } 1764 1765 static void enabledAtRuntimeAttr1AttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 1766 { 1767 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 1768 TestObjV8Internal::enabledAtRuntimeAttr1AttrSetter(name, value, info); 1769 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1770 } 1771 1772 static void enabledAtRuntimeAttr2AttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 1773 { 1774 TestObj* imp = V8TestObject::toNative(info.Holder()); 1775 v8SetReturnValueInt(info, imp->enabledAtRuntimeAttr2()); 1776 return; 1777 } 1778 1779 static void enabledAtRuntimeAttr2AttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 1780 { 1781 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 1782 TestObjV8Internal::enabledAtRuntimeAttr2AttrGetter(name, info); 1783 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1784 } 1785 1786 static void enabledAtRuntimeAttr2AttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 1787 { 1788 TestObj* imp = V8TestObject::toNative(info.Holder()); 1789 V8TRYCATCH_VOID(int, v, toInt32(value)); 1790 imp->setEnabledAtRuntimeAttr2(v); 1791 return; 1792 } 1793 1794 static void enabledAtRuntimeAttr2AttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 1795 { 1796 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 1797 TestObjV8Internal::enabledAtRuntimeAttr2AttrSetter(name, value, info); 1798 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1799 } 1800 1801 static void enabledPerContextAttr1AttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 1802 { 1803 TestObj* imp = V8TestObject::toNative(info.Holder()); 1804 v8SetReturnValueInt(info, imp->enabledPerContextAttr1()); 1805 return; 1806 } 1807 1808 static void enabledPerContextAttr1AttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 1809 { 1810 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 1811 TestObjV8Internal::enabledPerContextAttr1AttrGetter(name, info); 1812 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1813 } 1814 1815 static void enabledPerContextAttr1AttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 1816 { 1817 TestObj* imp = V8TestObject::toNative(info.Holder()); 1818 V8TRYCATCH_VOID(int, v, toInt32(value)); 1819 imp->setEnabledPerContextAttr1(v); 1820 return; 1821 } 1822 1823 static void enabledPerContextAttr1AttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 1824 { 1825 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 1826 TestObjV8Internal::enabledPerContextAttr1AttrSetter(name, value, info); 1827 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1828 } 1829 1830 static void enabledPerContextAttr2AttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 1831 { 1832 TestObj* imp = V8TestObject::toNative(info.Holder()); 1833 v8SetReturnValueInt(info, imp->enabledPerContextAttr2()); 1834 return; 1835 } 1836 1837 static void enabledPerContextAttr2AttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 1838 { 1839 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 1840 TestObjV8Internal::enabledPerContextAttr2AttrGetter(name, info); 1841 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1842 } 1843 1844 static void enabledPerContextAttr2AttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 1845 { 1846 TestObj* imp = V8TestObject::toNative(info.Holder()); 1847 V8TRYCATCH_VOID(int, v, toInt32(value)); 1848 imp->setEnabledPerContextAttr2(v); 1849 return; 1850 } 1851 1852 static void enabledPerContextAttr2AttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 1853 { 1854 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 1855 TestObjV8Internal::enabledPerContextAttr2AttrSetter(name, value, info); 1856 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1857 } 1858 1859 static void floatArrayAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 1860 { 1861 TestObj* imp = V8TestObject::toNative(info.Holder()); 1862 v8SetReturnValue(info, v8Array(imp->floatArray(), info.GetIsolate())); 1863 return; 1864 } 1865 1866 static void floatArrayAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 1867 { 1868 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 1869 TestObjV8Internal::floatArrayAttrGetter(name, info); 1870 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1871 } 1872 1873 static void floatArrayAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 1874 { 1875 TestObj* imp = V8TestObject::toNative(info.Holder()); 1876 V8TRYCATCH_VOID(Vector<float>, v, toNativeArray<float>(value, info.GetIsolate())); 1877 imp->setFloatArray(v); 1878 return; 1879 } 1880 1881 static void floatArrayAttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 1882 { 1883 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 1884 TestObjV8Internal::floatArrayAttrSetter(name, value, info); 1885 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1886 } 1887 1888 static void doubleArrayAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 1889 { 1890 TestObj* imp = V8TestObject::toNative(info.Holder()); 1891 v8SetReturnValue(info, v8Array(imp->doubleArray(), info.GetIsolate())); 1892 return; 1893 } 1894 1895 static void doubleArrayAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 1896 { 1897 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 1898 TestObjV8Internal::doubleArrayAttrGetter(name, info); 1899 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1900 } 1901 1902 static void doubleArrayAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 1903 { 1904 TestObj* imp = V8TestObject::toNative(info.Holder()); 1905 V8TRYCATCH_VOID(Vector<double>, v, toNativeArray<double>(value, info.GetIsolate())); 1906 imp->setDoubleArray(v); 1907 return; 1908 } 1909 1910 static void doubleArrayAttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 1911 { 1912 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 1913 TestObjV8Internal::doubleArrayAttrSetter(name, value, info); 1914 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1915 } 1916 1917 static void messagePortArrayAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 1918 { 1919 TestObj* imp = V8TestObject::toNative(info.Holder()); 1920 v8SetReturnValue(info, v8Array(imp->messagePortArray(), info.GetIsolate())); 1921 return; 1922 } 1923 1924 static void messagePortArrayAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 1925 { 1926 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 1927 TestObjV8Internal::messagePortArrayAttrGetter(name, info); 1928 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1929 } 1930 1931 static void messagePortArrayAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 1932 { 1933 TestObj* imp = V8TestObject::toNative(info.Holder()); 1934 V8TRYCATCH_VOID(Vector<RefPtr<MessagePort> >, v, (toRefPtrNativeArray<MessagePort, V8MessagePort>(value, info.GetIsolate()))); 1935 imp->setMessagePortArray(v); 1936 return; 1937 } 1938 1939 static void messagePortArrayAttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 1940 { 1941 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 1942 TestObjV8Internal::messagePortArrayAttrSetter(name, value, info); 1943 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1944 } 1945 1946 static void contentDocumentAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 1947 { 1948 TestObj* imp = V8TestObject::toNative(info.Holder()); 1949 if (!BindingSecurity::shouldAllowAccessToNode(imp->contentDocument())) { 1950 v8SetReturnValueNull(info); 1951 return; 1952 } 1953 v8SetReturnValue(info, toV8Fast(imp->contentDocument(), info, imp)); 1954 return; 1955 } 1956 1957 static void contentDocumentAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 1958 { 1959 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 1960 TestObjV8Internal::contentDocumentAttrGetter(name, info); 1961 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1962 } 1963 1964 static void mutablePointAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 1965 { 1966 TestObj* imp = V8TestObject::toNative(info.Holder()); 1967 v8SetReturnValue(info, toV8Fast(WTF::getPtr(SVGStaticPropertyTearOff<TestObj, SVGPoint>::create(imp, imp->mutablePoint(), &TestObj::updateMutablePoint)), info, imp)); 1968 return; 1969 } 1970 1971 static void mutablePointAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 1972 { 1973 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 1974 TestObjV8Internal::mutablePointAttrGetter(name, info); 1975 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1976 } 1977 1978 static void mutablePointAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 1979 { 1980 TestObj* imp = V8TestObject::toNative(info.Holder()); 1981 V8TRYCATCH_VOID(RefPtr<SVGPropertyTearOff<SVGPoint> >, v, V8SVGPoint::HasInstance(value, info.GetIsolate(), worldType(info.GetIsolate())) ? V8SVGPoint::toNative(v8::Handle<v8::Object>::Cast(value)) : 0); 1982 imp->setMutablePoint(WTF::getPtr(v)); 1983 return; 1984 } 1985 1986 static void mutablePointAttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 1987 { 1988 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 1989 TestObjV8Internal::mutablePointAttrSetter(name, value, info); 1990 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1991 } 1992 1993 static void immutablePointAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 1994 { 1995 TestObj* imp = V8TestObject::toNative(info.Holder()); 1996 v8SetReturnValue(info, toV8Fast(WTF::getPtr(SVGPropertyTearOff<SVGPoint>::create(imp->immutablePoint())), info, imp)); 1997 return; 1998 } 1999 2000 static void immutablePointAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2001 { 2002 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 2003 TestObjV8Internal::immutablePointAttrGetter(name, info); 2004 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2005 } 2006 2007 static void immutablePointAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 2008 { 2009 TestObj* imp = V8TestObject::toNative(info.Holder()); 2010 V8TRYCATCH_VOID(RefPtr<SVGPropertyTearOff<SVGPoint> >, v, V8SVGPoint::HasInstance(value, info.GetIsolate(), worldType(info.GetIsolate())) ? V8SVGPoint::toNative(v8::Handle<v8::Object>::Cast(value)) : 0); 2011 imp->setImmutablePoint(WTF::getPtr(v)); 2012 return; 2013 } 2014 2015 static void immutablePointAttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 2016 { 2017 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 2018 TestObjV8Internal::immutablePointAttrSetter(name, value, info); 2019 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2020 } 2021 2022 static void strawberryAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2023 { 2024 TestObj* imp = V8TestObject::toNative(info.Holder()); 2025 v8SetReturnValueInt(info, imp->blueberry()); 2026 return; 2027 } 2028 2029 static void strawberryAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2030 { 2031 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 2032 TestObjV8Internal::strawberryAttrGetter(name, info); 2033 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2034 } 2035 2036 static void strawberryAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 2037 { 2038 TestObj* imp = V8TestObject::toNative(info.Holder()); 2039 V8TRYCATCH_VOID(int, v, toInt32(value)); 2040 imp->setBlueberry(v); 2041 return; 2042 } 2043 2044 static void strawberryAttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 2045 { 2046 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 2047 TestObjV8Internal::strawberryAttrSetter(name, value, info); 2048 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2049 } 2050 2051 static void strictFloatAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2052 { 2053 TestObj* imp = V8TestObject::toNative(info.Holder()); 2054 v8SetReturnValue(info, imp->strictFloat()); 2055 return; 2056 } 2057 2058 static void strictFloatAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2059 { 2060 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 2061 TestObjV8Internal::strictFloatAttrGetter(name, info); 2062 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2063 } 2064 2065 static void strictFloatAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 2066 { 2067 TestObj* imp = V8TestObject::toNative(info.Holder()); 2068 V8TRYCATCH_VOID(float, v, static_cast<float>(value->NumberValue())); 2069 imp->setStrictFloat(v); 2070 return; 2071 } 2072 2073 static void strictFloatAttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 2074 { 2075 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 2076 TestObjV8Internal::strictFloatAttrSetter(name, value, info); 2077 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2078 } 2079 2080 static void descriptionAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2081 { 2082 TestObj* imp = V8TestObject::toNative(info.Holder()); 2083 v8SetReturnValueInt(info, imp->description()); 2084 return; 2085 } 2086 2087 static void descriptionAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2088 { 2089 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 2090 TestObjV8Internal::descriptionAttrGetter(name, info); 2091 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2092 } 2093 2094 static void idAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2095 { 2096 TestObj* imp = V8TestObject::toNative(info.Holder()); 2097 v8SetReturnValueInt(info, imp->id()); 2098 return; 2099 } 2100 2101 static void idAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2102 { 2103 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 2104 TestObjV8Internal::idAttrGetter(name, info); 2105 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2106 } 2107 2108 static void idAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 2109 { 2110 TestObj* imp = V8TestObject::toNative(info.Holder()); 2111 V8TRYCATCH_VOID(int, v, toInt32(value)); 2112 imp->setId(v); 2113 return; 2114 } 2115 2116 static void idAttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 2117 { 2118 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 2119 TestObjV8Internal::idAttrSetter(name, value, info); 2120 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2121 } 2122 2123 static void hashAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2124 { 2125 TestObj* imp = V8TestObject::toNative(info.Holder()); 2126 v8SetReturnValueString(info, imp->hash(), info.GetIsolate()); 2127 return; 2128 } 2129 2130 static void hashAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2131 { 2132 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 2133 TestObjV8Internal::hashAttrGetter(name, info); 2134 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2135 } 2136 2137 static void replaceableAttributeAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2138 { 2139 TestObj* imp = V8TestObject::toNative(info.Holder()); 2140 v8SetReturnValueInt(info, imp->replaceableAttribute()); 2141 return; 2142 } 2143 2144 static void replaceableAttributeAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2145 { 2146 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 2147 TestObjV8Internal::replaceableAttributeAttrGetter(name, info); 2148 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2149 } 2150 2151 static void nullableDoubleAttributeAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2152 { 2153 TestObj* imp = V8TestObject::toNative(info.Holder()); 2154 bool isNull = false; 2155 double v = imp->nullableDoubleAttribute(isNull); 2156 if (isNull) { 2157 v8SetReturnValueNull(info); 2158 return; 2159 } 2160 v8SetReturnValue(info, v); 2161 return; 2162 } 2163 2164 static void nullableDoubleAttributeAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2165 { 2166 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 2167 TestObjV8Internal::nullableDoubleAttributeAttrGetter(name, info); 2168 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2169 } 2170 2171 static void nullableLongAttributeAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2172 { 2173 TestObj* imp = V8TestObject::toNative(info.Holder()); 2174 bool isNull = false; 2175 int v = imp->nullableLongAttribute(isNull); 2176 if (isNull) { 2177 v8SetReturnValueNull(info); 2178 return; 2179 } 2180 v8SetReturnValueInt(info, v); 2181 return; 2182 } 2183 2184 static void nullableLongAttributeAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2185 { 2186 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 2187 TestObjV8Internal::nullableLongAttributeAttrGetter(name, info); 2188 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2189 } 2190 2191 static void nullableBooleanAttributeAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2192 { 2193 TestObj* imp = V8TestObject::toNative(info.Holder()); 2194 bool isNull = false; 2195 bool v = imp->nullableBooleanAttribute(isNull); 2196 if (isNull) { 2197 v8SetReturnValueNull(info); 2198 return; 2199 } 2200 v8SetReturnValueBool(info, v); 2201 return; 2202 } 2203 2204 static void nullableBooleanAttributeAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2205 { 2206 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 2207 TestObjV8Internal::nullableBooleanAttributeAttrGetter(name, info); 2208 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2209 } 2210 2211 static void nullableStringAttributeAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2212 { 2213 TestObj* imp = V8TestObject::toNative(info.Holder()); 2214 bool isNull = false; 2215 String v = imp->nullableStringAttribute(isNull); 2216 if (isNull) { 2217 v8SetReturnValueNull(info); 2218 return; 2219 } 2220 v8SetReturnValueString(info, v, info.GetIsolate()); 2221 return; 2222 } 2223 2224 static void nullableStringAttributeAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2225 { 2226 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 2227 TestObjV8Internal::nullableStringAttributeAttrGetter(name, info); 2228 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2229 } 2230 2231 static void nullableLongSettableAttributeAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2232 { 2233 TestObj* imp = V8TestObject::toNative(info.Holder()); 2234 bool isNull = false; 2235 int v = imp->nullableLongSettableAttribute(isNull); 2236 if (isNull) { 2237 v8SetReturnValueNull(info); 2238 return; 2239 } 2240 v8SetReturnValueInt(info, v); 2241 return; 2242 } 2243 2244 static void nullableLongSettableAttributeAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2245 { 2246 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 2247 TestObjV8Internal::nullableLongSettableAttributeAttrGetter(name, info); 2248 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2249 } 2250 2251 static void nullableLongSettableAttributeAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 2252 { 2253 TestObj* imp = V8TestObject::toNative(info.Holder()); 2254 V8TRYCATCH_VOID(int, v, toInt32(value)); 2255 imp->setNullableLongSettableAttribute(v); 2256 return; 2257 } 2258 2259 static void nullableLongSettableAttributeAttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 2260 { 2261 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 2262 TestObjV8Internal::nullableLongSettableAttributeAttrSetter(name, value, info); 2263 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2264 } 2265 2266 static void nullableStringValueAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2267 { 2268 TestObj* imp = V8TestObject::toNative(info.Holder()); 2269 ExceptionState es(info.GetIsolate()); 2270 bool isNull = false; 2271 int v = imp->nullableStringValue(isNull, es); 2272 if (isNull) { 2273 v8SetReturnValueNull(info); 2274 return; 2275 } 2276 if (UNLIKELY(es.throwIfNeeded())) 2277 return; 2278 v8SetReturnValueInt(info, v); 2279 return; 2280 } 2281 2282 static void nullableStringValueAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2283 { 2284 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 2285 TestObjV8Internal::nullableStringValueAttrGetter(name, info); 2286 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2287 } 2288 2289 static void nullableStringValueAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 2290 { 2291 TestObj* imp = V8TestObject::toNative(info.Holder()); 2292 V8TRYCATCH_VOID(int, v, toInt32(value)); 2293 imp->setNullableStringValue(v); 2294 return; 2295 } 2296 2297 static void nullableStringValueAttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 2298 { 2299 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 2300 TestObjV8Internal::nullableStringValueAttrSetter(name, value, info); 2301 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2302 } 2303 2304 static void perWorldReadOnlyAttributeAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2305 { 2306 TestObj* imp = V8TestObject::toNative(info.Holder()); 2307 RefPtr<TestObj> result = imp->perWorldReadOnlyAttribute(); 2308 v8::Handle<v8::Value> wrapper = result.get() ? v8::Handle<v8::Value>(DOMDataStore::getWrapper<V8TestObject>(result.get(), info.GetIsolate())) : v8Undefined(); 2309 if (wrapper.IsEmpty()) { 2310 wrapper = toV8(result.get(), info.Holder(), info.GetIsolate()); 2311 if (!wrapper.IsEmpty()) 2312 V8HiddenPropertyName::setNamedHiddenReference(info.Holder(), "perWorldReadOnlyAttribute", wrapper); 2313 } 2314 v8SetReturnValue(info, wrapper); 2315 return; 2316 } 2317 2318 static void perWorldReadOnlyAttributeAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2319 { 2320 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 2321 TestObjV8Internal::perWorldReadOnlyAttributeAttrGetter(name, info); 2322 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2323 } 2324 2325 static void perWorldReadOnlyAttributeAttrGetterForMainWorld(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2326 { 2327 TestObj* imp = V8TestObject::toNative(info.Holder()); 2328 RefPtr<TestObj> result = imp->perWorldReadOnlyAttribute(); 2329 v8::Handle<v8::Value> wrapper = result.get() ? v8::Handle<v8::Value>(DOMDataStore::getWrapperForMainWorld<V8TestObject>(result.get())) : v8Undefined(); 2330 if (wrapper.IsEmpty()) { 2331 wrapper = toV8(result.get(), info.Holder(), info.GetIsolate()); 2332 if (!wrapper.IsEmpty()) 2333 V8HiddenPropertyName::setNamedHiddenReference(info.Holder(), "perWorldReadOnlyAttribute", wrapper); 2334 } 2335 v8SetReturnValue(info, wrapper); 2336 return; 2337 } 2338 2339 static void perWorldReadOnlyAttributeAttrGetterCallbackForMainWorld(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2340 { 2341 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 2342 TestObjV8Internal::perWorldReadOnlyAttributeAttrGetterForMainWorld(name, info); 2343 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2344 } 2345 2346 static void perWorldAttributeAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2347 { 2348 TestObj* imp = V8TestObject::toNative(info.Holder()); 2349 v8SetReturnValue(info, toV8Fast(imp->perWorldAttribute(), info, imp)); 2350 return; 2351 } 2352 2353 static void perWorldAttributeAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2354 { 2355 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 2356 TestObjV8Internal::perWorldAttributeAttrGetter(name, info); 2357 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2358 } 2359 2360 static void perWorldAttributeAttrGetterForMainWorld(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2361 { 2362 TestObj* imp = V8TestObject::toNative(info.Holder()); 2363 v8SetReturnValue(info, toV8ForMainWorld(imp->perWorldAttribute(), info.Holder(), info.GetIsolate())); 2364 return; 2365 } 2366 2367 static void perWorldAttributeAttrGetterCallbackForMainWorld(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2368 { 2369 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 2370 TestObjV8Internal::perWorldAttributeAttrGetterForMainWorld(name, info); 2371 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2372 } 2373 2374 static void perWorldAttributeAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 2375 { 2376 TestObj* imp = V8TestObject::toNative(info.Holder()); 2377 V8TRYCATCH_VOID(TestObj*, v, V8TestObject::HasInstance(value, info.GetIsolate(), worldType(info.GetIsolate())) ? V8TestObject::toNative(v8::Handle<v8::Object>::Cast(value)) : 0); 2378 imp->setPerWorldAttribute(WTF::getPtr(v)); 2379 return; 2380 } 2381 2382 static void perWorldAttributeAttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 2383 { 2384 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 2385 TestObjV8Internal::perWorldAttributeAttrSetter(name, value, info); 2386 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2387 } 2388 2389 static void perWorldAttributeAttrSetterForMainWorld(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 2390 { 2391 TestObj* imp = V8TestObject::toNative(info.Holder()); 2392 V8TRYCATCH_VOID(TestObj*, v, V8TestObject::HasInstance(value, info.GetIsolate(), worldType(info.GetIsolate())) ? V8TestObject::toNative(v8::Handle<v8::Object>::Cast(value)) : 0); 2393 imp->setPerWorldAttribute(WTF::getPtr(v)); 2394 return; 2395 } 2396 2397 static void perWorldAttributeAttrSetterCallbackForMainWorld(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 2398 { 2399 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 2400 TestObjV8Internal::perWorldAttributeAttrSetterForMainWorld(name, value, info); 2401 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2402 } 2403 2404 static void activityLoggedAttr1AttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2405 { 2406 TestObj* imp = V8TestObject::toNative(info.Holder()); 2407 v8SetReturnValueInt(info, imp->activityLoggedAttr1()); 2408 return; 2409 } 2410 2411 static void activityLoggedAttr1AttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2412 { 2413 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 2414 V8PerContextData* contextData = V8PerContextData::from(info.GetIsolate()->GetCurrentContext()); 2415 if (contextData && contextData->activityLogger()) 2416 contextData->activityLogger()->log("TestObject.activityLoggedAttr1", 0, 0, "Getter"); 2417 TestObjV8Internal::activityLoggedAttr1AttrGetter(name, info); 2418 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2419 } 2420 2421 static void activityLoggedAttr1AttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 2422 { 2423 TestObj* imp = V8TestObject::toNative(info.Holder()); 2424 V8TRYCATCH_VOID(int, v, toInt32(value)); 2425 imp->setActivityLoggedAttr1(v); 2426 return; 2427 } 2428 2429 static void activityLoggedAttr1AttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 2430 { 2431 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 2432 V8PerContextData* contextData = V8PerContextData::from(info.GetIsolate()->GetCurrentContext()); 2433 if (contextData && contextData->activityLogger()) { 2434 v8::Handle<v8::Value> loggerArg[] = { value }; 2435 contextData->activityLogger()->log("TestObject.activityLoggedAttr1", 1, &loggerArg[0], "Setter"); 2436 } 2437 TestObjV8Internal::activityLoggedAttr1AttrSetter(name, value, info); 2438 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2439 } 2440 2441 static void activityLoggedAttr2AttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2442 { 2443 TestObj* imp = V8TestObject::toNative(info.Holder()); 2444 v8SetReturnValueInt(info, imp->activityLoggedAttr2()); 2445 return; 2446 } 2447 2448 static void activityLoggedAttr2AttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2449 { 2450 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 2451 V8PerContextData* contextData = V8PerContextData::from(info.GetIsolate()->GetCurrentContext()); 2452 if (contextData && contextData->activityLogger()) 2453 contextData->activityLogger()->log("TestObject.activityLoggedAttr2", 0, 0, "Getter"); 2454 TestObjV8Internal::activityLoggedAttr2AttrGetter(name, info); 2455 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2456 } 2457 2458 static void activityLoggedAttr2AttrGetterForMainWorld(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2459 { 2460 TestObj* imp = V8TestObject::toNative(info.Holder()); 2461 v8SetReturnValueInt(info, imp->activityLoggedAttr2()); 2462 return; 2463 } 2464 2465 static void activityLoggedAttr2AttrGetterCallbackForMainWorld(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2466 { 2467 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 2468 V8PerContextData* contextData = V8PerContextData::from(info.GetIsolate()->GetCurrentContext()); 2469 if (contextData && contextData->activityLogger()) 2470 contextData->activityLogger()->log("TestObject.activityLoggedAttr2", 0, 0, "Getter"); 2471 TestObjV8Internal::activityLoggedAttr2AttrGetterForMainWorld(name, info); 2472 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2473 } 2474 2475 static void activityLoggedAttr2AttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 2476 { 2477 TestObj* imp = V8TestObject::toNative(info.Holder()); 2478 V8TRYCATCH_VOID(int, v, toInt32(value)); 2479 imp->setActivityLoggedAttr2(v); 2480 return; 2481 } 2482 2483 static void activityLoggedAttr2AttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 2484 { 2485 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 2486 V8PerContextData* contextData = V8PerContextData::from(info.GetIsolate()->GetCurrentContext()); 2487 if (contextData && contextData->activityLogger()) { 2488 v8::Handle<v8::Value> loggerArg[] = { value }; 2489 contextData->activityLogger()->log("TestObject.activityLoggedAttr2", 1, &loggerArg[0], "Setter"); 2490 } 2491 TestObjV8Internal::activityLoggedAttr2AttrSetter(name, value, info); 2492 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2493 } 2494 2495 static void activityLoggedAttr2AttrSetterForMainWorld(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 2496 { 2497 TestObj* imp = V8TestObject::toNative(info.Holder()); 2498 V8TRYCATCH_VOID(int, v, toInt32(value)); 2499 imp->setActivityLoggedAttr2(v); 2500 return; 2501 } 2502 2503 static void activityLoggedAttr2AttrSetterCallbackForMainWorld(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 2504 { 2505 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 2506 V8PerContextData* contextData = V8PerContextData::from(info.GetIsolate()->GetCurrentContext()); 2507 if (contextData && contextData->activityLogger()) { 2508 v8::Handle<v8::Value> loggerArg[] = { value }; 2509 contextData->activityLogger()->log("TestObject.activityLoggedAttr2", 1, &loggerArg[0], "Setter"); 2510 } 2511 TestObjV8Internal::activityLoggedAttr2AttrSetterForMainWorld(name, value, info); 2512 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2513 } 2514 2515 static void activityLoggedInIsolatedWorldsAttrAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2516 { 2517 TestObj* imp = V8TestObject::toNative(info.Holder()); 2518 v8SetReturnValueInt(info, imp->activityLoggedInIsolatedWorldsAttr()); 2519 return; 2520 } 2521 2522 static void activityLoggedInIsolatedWorldsAttrAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2523 { 2524 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 2525 V8PerContextData* contextData = V8PerContextData::from(info.GetIsolate()->GetCurrentContext()); 2526 if (contextData && contextData->activityLogger()) 2527 contextData->activityLogger()->log("TestObject.activityLoggedInIsolatedWorldsAttr", 0, 0, "Getter"); 2528 TestObjV8Internal::activityLoggedInIsolatedWorldsAttrAttrGetter(name, info); 2529 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2530 } 2531 2532 static void activityLoggedInIsolatedWorldsAttrAttrGetterForMainWorld(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2533 { 2534 TestObj* imp = V8TestObject::toNative(info.Holder()); 2535 v8SetReturnValueInt(info, imp->activityLoggedInIsolatedWorldsAttr()); 2536 return; 2537 } 2538 2539 static void activityLoggedInIsolatedWorldsAttrAttrGetterCallbackForMainWorld(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2540 { 2541 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 2542 TestObjV8Internal::activityLoggedInIsolatedWorldsAttrAttrGetterForMainWorld(name, info); 2543 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2544 } 2545 2546 static void activityLoggedInIsolatedWorldsAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 2547 { 2548 TestObj* imp = V8TestObject::toNative(info.Holder()); 2549 V8TRYCATCH_VOID(int, v, toInt32(value)); 2550 imp->setActivityLoggedInIsolatedWorldsAttr(v); 2551 return; 2552 } 2553 2554 static void activityLoggedInIsolatedWorldsAttrAttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 2555 { 2556 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 2557 V8PerContextData* contextData = V8PerContextData::from(info.GetIsolate()->GetCurrentContext()); 2558 if (contextData && contextData->activityLogger()) { 2559 v8::Handle<v8::Value> loggerArg[] = { value }; 2560 contextData->activityLogger()->log("TestObject.activityLoggedInIsolatedWorldsAttr", 1, &loggerArg[0], "Setter"); 2561 } 2562 TestObjV8Internal::activityLoggedInIsolatedWorldsAttrAttrSetter(name, value, info); 2563 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2564 } 2565 2566 static void activityLoggedInIsolatedWorldsAttrAttrSetterForMainWorld(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 2567 { 2568 TestObj* imp = V8TestObject::toNative(info.Holder()); 2569 V8TRYCATCH_VOID(int, v, toInt32(value)); 2570 imp->setActivityLoggedInIsolatedWorldsAttr(v); 2571 return; 2572 } 2573 2574 static void activityLoggedInIsolatedWorldsAttrAttrSetterCallbackForMainWorld(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 2575 { 2576 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 2577 TestObjV8Internal::activityLoggedInIsolatedWorldsAttrAttrSetterForMainWorld(name, value, info); 2578 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2579 } 2580 2581 static void activityLoggedAttrSetter1AttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2582 { 2583 TestObj* imp = V8TestObject::toNative(info.Holder()); 2584 v8SetReturnValueInt(info, imp->activityLoggedAttrSetter1()); 2585 return; 2586 } 2587 2588 static void activityLoggedAttrSetter1AttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2589 { 2590 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 2591 TestObjV8Internal::activityLoggedAttrSetter1AttrGetter(name, info); 2592 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2593 } 2594 2595 static void activityLoggedAttrSetter1AttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 2596 { 2597 TestObj* imp = V8TestObject::toNative(info.Holder()); 2598 V8TRYCATCH_VOID(int, v, toInt32(value)); 2599 imp->setActivityLoggedAttrSetter1(v); 2600 return; 2601 } 2602 2603 static void activityLoggedAttrSetter1AttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 2604 { 2605 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 2606 V8PerContextData* contextData = V8PerContextData::from(info.GetIsolate()->GetCurrentContext()); 2607 if (contextData && contextData->activityLogger()) { 2608 v8::Handle<v8::Value> loggerArg[] = { value }; 2609 contextData->activityLogger()->log("TestObject.activityLoggedAttrSetter1", 1, &loggerArg[0], "Setter"); 2610 } 2611 TestObjV8Internal::activityLoggedAttrSetter1AttrSetter(name, value, info); 2612 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2613 } 2614 2615 static void activityLoggedAttrSetter2AttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2616 { 2617 TestObj* imp = V8TestObject::toNative(info.Holder()); 2618 v8SetReturnValueInt(info, imp->activityLoggedAttrSetter2()); 2619 return; 2620 } 2621 2622 static void activityLoggedAttrSetter2AttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2623 { 2624 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 2625 TestObjV8Internal::activityLoggedAttrSetter2AttrGetter(name, info); 2626 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2627 } 2628 2629 static void activityLoggedAttrSetter2AttrGetterForMainWorld(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2630 { 2631 TestObj* imp = V8TestObject::toNative(info.Holder()); 2632 v8SetReturnValueInt(info, imp->activityLoggedAttrSetter2()); 2633 return; 2634 } 2635 2636 static void activityLoggedAttrSetter2AttrGetterCallbackForMainWorld(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2637 { 2638 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 2639 TestObjV8Internal::activityLoggedAttrSetter2AttrGetterForMainWorld(name, info); 2640 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2641 } 2642 2643 static void activityLoggedAttrSetter2AttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 2644 { 2645 TestObj* imp = V8TestObject::toNative(info.Holder()); 2646 V8TRYCATCH_VOID(int, v, toInt32(value)); 2647 imp->setActivityLoggedAttrSetter2(v); 2648 return; 2649 } 2650 2651 static void activityLoggedAttrSetter2AttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 2652 { 2653 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 2654 V8PerContextData* contextData = V8PerContextData::from(info.GetIsolate()->GetCurrentContext()); 2655 if (contextData && contextData->activityLogger()) { 2656 v8::Handle<v8::Value> loggerArg[] = { value }; 2657 contextData->activityLogger()->log("TestObject.activityLoggedAttrSetter2", 1, &loggerArg[0], "Setter"); 2658 } 2659 TestObjV8Internal::activityLoggedAttrSetter2AttrSetter(name, value, info); 2660 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2661 } 2662 2663 static void activityLoggedAttrSetter2AttrSetterForMainWorld(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 2664 { 2665 TestObj* imp = V8TestObject::toNative(info.Holder()); 2666 V8TRYCATCH_VOID(int, v, toInt32(value)); 2667 imp->setActivityLoggedAttrSetter2(v); 2668 return; 2669 } 2670 2671 static void activityLoggedAttrSetter2AttrSetterCallbackForMainWorld(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 2672 { 2673 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 2674 V8PerContextData* contextData = V8PerContextData::from(info.GetIsolate()->GetCurrentContext()); 2675 if (contextData && contextData->activityLogger()) { 2676 v8::Handle<v8::Value> loggerArg[] = { value }; 2677 contextData->activityLogger()->log("TestObject.activityLoggedAttrSetter2", 1, &loggerArg[0], "Setter"); 2678 } 2679 TestObjV8Internal::activityLoggedAttrSetter2AttrSetterForMainWorld(name, value, info); 2680 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2681 } 2682 2683 static void activityLoggedInIsolatedWorldsAttrSetterAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2684 { 2685 TestObj* imp = V8TestObject::toNative(info.Holder()); 2686 v8SetReturnValueInt(info, imp->activityLoggedInIsolatedWorldsAttrSetter()); 2687 return; 2688 } 2689 2690 static void activityLoggedInIsolatedWorldsAttrSetterAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2691 { 2692 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 2693 TestObjV8Internal::activityLoggedInIsolatedWorldsAttrSetterAttrGetter(name, info); 2694 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2695 } 2696 2697 static void activityLoggedInIsolatedWorldsAttrSetterAttrGetterForMainWorld(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2698 { 2699 TestObj* imp = V8TestObject::toNative(info.Holder()); 2700 v8SetReturnValueInt(info, imp->activityLoggedInIsolatedWorldsAttrSetter()); 2701 return; 2702 } 2703 2704 static void activityLoggedInIsolatedWorldsAttrSetterAttrGetterCallbackForMainWorld(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2705 { 2706 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 2707 TestObjV8Internal::activityLoggedInIsolatedWorldsAttrSetterAttrGetterForMainWorld(name, info); 2708 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2709 } 2710 2711 static void activityLoggedInIsolatedWorldsAttrSetterAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 2712 { 2713 TestObj* imp = V8TestObject::toNative(info.Holder()); 2714 V8TRYCATCH_VOID(int, v, toInt32(value)); 2715 imp->setActivityLoggedInIsolatedWorldsAttrSetter(v); 2716 return; 2717 } 2718 2719 static void activityLoggedInIsolatedWorldsAttrSetterAttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 2720 { 2721 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 2722 V8PerContextData* contextData = V8PerContextData::from(info.GetIsolate()->GetCurrentContext()); 2723 if (contextData && contextData->activityLogger()) { 2724 v8::Handle<v8::Value> loggerArg[] = { value }; 2725 contextData->activityLogger()->log("TestObject.activityLoggedInIsolatedWorldsAttrSetter", 1, &loggerArg[0], "Setter"); 2726 } 2727 TestObjV8Internal::activityLoggedInIsolatedWorldsAttrSetterAttrSetter(name, value, info); 2728 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2729 } 2730 2731 static void activityLoggedInIsolatedWorldsAttrSetterAttrSetterForMainWorld(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 2732 { 2733 TestObj* imp = V8TestObject::toNative(info.Holder()); 2734 V8TRYCATCH_VOID(int, v, toInt32(value)); 2735 imp->setActivityLoggedInIsolatedWorldsAttrSetter(v); 2736 return; 2737 } 2738 2739 static void activityLoggedInIsolatedWorldsAttrSetterAttrSetterCallbackForMainWorld(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 2740 { 2741 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 2742 TestObjV8Internal::activityLoggedInIsolatedWorldsAttrSetterAttrSetterForMainWorld(name, value, info); 2743 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2744 } 2745 2746 static void activityLoggedAttrGetter1AttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2747 { 2748 TestObj* imp = V8TestObject::toNative(info.Holder()); 2749 v8SetReturnValueInt(info, imp->activityLoggedAttrGetter1()); 2750 return; 2751 } 2752 2753 static void activityLoggedAttrGetter1AttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2754 { 2755 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 2756 V8PerContextData* contextData = V8PerContextData::from(info.GetIsolate()->GetCurrentContext()); 2757 if (contextData && contextData->activityLogger()) 2758 contextData->activityLogger()->log("TestObject.activityLoggedAttrGetter1", 0, 0, "Getter"); 2759 TestObjV8Internal::activityLoggedAttrGetter1AttrGetter(name, info); 2760 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2761 } 2762 2763 static void activityLoggedAttrGetter1AttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 2764 { 2765 TestObj* imp = V8TestObject::toNative(info.Holder()); 2766 V8TRYCATCH_VOID(int, v, toInt32(value)); 2767 imp->setActivityLoggedAttrGetter1(v); 2768 return; 2769 } 2770 2771 static void activityLoggedAttrGetter1AttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 2772 { 2773 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 2774 TestObjV8Internal::activityLoggedAttrGetter1AttrSetter(name, value, info); 2775 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2776 } 2777 2778 static void activityLoggedAttrGetter2AttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2779 { 2780 TestObj* imp = V8TestObject::toNative(info.Holder()); 2781 v8SetReturnValueInt(info, imp->activityLoggedAttrGetter2()); 2782 return; 2783 } 2784 2785 static void activityLoggedAttrGetter2AttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2786 { 2787 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 2788 V8PerContextData* contextData = V8PerContextData::from(info.GetIsolate()->GetCurrentContext()); 2789 if (contextData && contextData->activityLogger()) 2790 contextData->activityLogger()->log("TestObject.activityLoggedAttrGetter2", 0, 0, "Getter"); 2791 TestObjV8Internal::activityLoggedAttrGetter2AttrGetter(name, info); 2792 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2793 } 2794 2795 static void activityLoggedAttrGetter2AttrGetterForMainWorld(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2796 { 2797 TestObj* imp = V8TestObject::toNative(info.Holder()); 2798 v8SetReturnValueInt(info, imp->activityLoggedAttrGetter2()); 2799 return; 2800 } 2801 2802 static void activityLoggedAttrGetter2AttrGetterCallbackForMainWorld(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2803 { 2804 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 2805 V8PerContextData* contextData = V8PerContextData::from(info.GetIsolate()->GetCurrentContext()); 2806 if (contextData && contextData->activityLogger()) 2807 contextData->activityLogger()->log("TestObject.activityLoggedAttrGetter2", 0, 0, "Getter"); 2808 TestObjV8Internal::activityLoggedAttrGetter2AttrGetterForMainWorld(name, info); 2809 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2810 } 2811 2812 static void activityLoggedAttrGetter2AttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 2813 { 2814 TestObj* imp = V8TestObject::toNative(info.Holder()); 2815 V8TRYCATCH_VOID(int, v, toInt32(value)); 2816 imp->setActivityLoggedAttrGetter2(v); 2817 return; 2818 } 2819 2820 static void activityLoggedAttrGetter2AttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 2821 { 2822 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 2823 TestObjV8Internal::activityLoggedAttrGetter2AttrSetter(name, value, info); 2824 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2825 } 2826 2827 static void activityLoggedAttrGetter2AttrSetterForMainWorld(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 2828 { 2829 TestObj* imp = V8TestObject::toNative(info.Holder()); 2830 V8TRYCATCH_VOID(int, v, toInt32(value)); 2831 imp->setActivityLoggedAttrGetter2(v); 2832 return; 2833 } 2834 2835 static void activityLoggedAttrGetter2AttrSetterCallbackForMainWorld(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 2836 { 2837 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 2838 TestObjV8Internal::activityLoggedAttrGetter2AttrSetterForMainWorld(name, value, info); 2839 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2840 } 2841 2842 static void activityLoggedInIsolatedWorldsAttrGetterAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2843 { 2844 TestObj* imp = V8TestObject::toNative(info.Holder()); 2845 v8SetReturnValueInt(info, imp->activityLoggedInIsolatedWorldsAttrGetter()); 2846 return; 2847 } 2848 2849 static void activityLoggedInIsolatedWorldsAttrGetterAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2850 { 2851 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 2852 V8PerContextData* contextData = V8PerContextData::from(info.GetIsolate()->GetCurrentContext()); 2853 if (contextData && contextData->activityLogger()) 2854 contextData->activityLogger()->log("TestObject.activityLoggedInIsolatedWorldsAttrGetter", 0, 0, "Getter"); 2855 TestObjV8Internal::activityLoggedInIsolatedWorldsAttrGetterAttrGetter(name, info); 2856 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2857 } 2858 2859 static void activityLoggedInIsolatedWorldsAttrGetterAttrGetterForMainWorld(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2860 { 2861 TestObj* imp = V8TestObject::toNative(info.Holder()); 2862 v8SetReturnValueInt(info, imp->activityLoggedInIsolatedWorldsAttrGetter()); 2863 return; 2864 } 2865 2866 static void activityLoggedInIsolatedWorldsAttrGetterAttrGetterCallbackForMainWorld(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2867 { 2868 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 2869 TestObjV8Internal::activityLoggedInIsolatedWorldsAttrGetterAttrGetterForMainWorld(name, info); 2870 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2871 } 2872 2873 static void activityLoggedInIsolatedWorldsAttrGetterAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 2874 { 2875 TestObj* imp = V8TestObject::toNative(info.Holder()); 2876 V8TRYCATCH_VOID(int, v, toInt32(value)); 2877 imp->setActivityLoggedInIsolatedWorldsAttrGetter(v); 2878 return; 2879 } 2880 2881 static void activityLoggedInIsolatedWorldsAttrGetterAttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 2882 { 2883 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 2884 TestObjV8Internal::activityLoggedInIsolatedWorldsAttrGetterAttrSetter(name, value, info); 2885 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2886 } 2887 2888 static void activityLoggedInIsolatedWorldsAttrGetterAttrSetterForMainWorld(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 2889 { 2890 TestObj* imp = V8TestObject::toNative(info.Holder()); 2891 V8TRYCATCH_VOID(int, v, toInt32(value)); 2892 imp->setActivityLoggedInIsolatedWorldsAttrGetter(v); 2893 return; 2894 } 2895 2896 static void activityLoggedInIsolatedWorldsAttrGetterAttrSetterCallbackForMainWorld(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 2897 { 2898 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 2899 TestObjV8Internal::activityLoggedInIsolatedWorldsAttrGetterAttrSetterForMainWorld(name, value, info); 2900 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2901 } 2902 2903 static void deprecatedStaticReadOnlyAttrAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2904 { 2905 v8SetReturnValueInt(info, TestObj::deprecatedStaticReadOnlyAttr()); 2906 return; 2907 } 2908 2909 static void deprecatedStaticReadOnlyAttrAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2910 { 2911 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 2912 UseCounter::countDeprecation(activeDOMWindow(), UseCounter::StaticReadonlyAttribute); 2913 TestObjV8Internal::deprecatedStaticReadOnlyAttrAttrGetter(name, info); 2914 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2915 } 2916 2917 static void deprecatedStaticAttrAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2918 { 2919 v8SetReturnValueInt(info, TestObj::deprecatedStaticAttr()); 2920 return; 2921 } 2922 2923 static void deprecatedStaticAttrAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2924 { 2925 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 2926 UseCounter::countDeprecation(activeDOMWindow(), UseCounter::StaticAttribute); 2927 TestObjV8Internal::deprecatedStaticAttrAttrGetter(name, info); 2928 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2929 } 2930 2931 static void deprecatedStaticAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 2932 { 2933 V8TRYCATCH_VOID(int, v, toInt32(value)); 2934 TestObj::setDeprecatedStaticAttr(v); 2935 return; 2936 } 2937 2938 static void deprecatedStaticAttrAttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 2939 { 2940 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 2941 UseCounter::countDeprecation(activeDOMWindow(), UseCounter::StaticAttribute); 2942 TestObjV8Internal::deprecatedStaticAttrAttrSetter(name, value, info); 2943 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2944 } 2945 2946 static void deprecatedReadonlyAttrAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2947 { 2948 TestObj* imp = V8TestObject::toNative(info.Holder()); 2949 v8SetReturnValueInt(info, imp->deprecatedReadonlyAttr()); 2950 return; 2951 } 2952 2953 static void deprecatedReadonlyAttrAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2954 { 2955 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 2956 UseCounter::countDeprecation(activeDOMWindow(), UseCounter::ReadonlyAttribute); 2957 TestObjV8Internal::deprecatedReadonlyAttrAttrGetter(name, info); 2958 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2959 } 2960 2961 static void deprecatedAttrAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2962 { 2963 TestObj* imp = V8TestObject::toNative(info.Holder()); 2964 v8SetReturnValueInt(info, imp->deprecatedAttr()); 2965 return; 2966 } 2967 2968 static void deprecatedAttrAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2969 { 2970 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 2971 UseCounter::countDeprecation(activeDOMWindow(), UseCounter::Attribute); 2972 TestObjV8Internal::deprecatedAttrAttrGetter(name, info); 2973 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2974 } 2975 2976 static void deprecatedAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 2977 { 2978 TestObj* imp = V8TestObject::toNative(info.Holder()); 2979 V8TRYCATCH_VOID(int, v, toInt32(value)); 2980 imp->setDeprecatedAttr(v); 2981 return; 2982 } 2983 2984 static void deprecatedAttrAttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 2985 { 2986 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 2987 UseCounter::countDeprecation(activeDOMWindow(), UseCounter::Attribute); 2988 TestObjV8Internal::deprecatedAttrAttrSetter(name, value, info); 2989 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2990 } 2991 2992 static void TestObjConstructorGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 2993 { 2994 v8::Handle<v8::Value> data = info.Data(); 2995 ASSERT(data->IsExternal()); 2996 V8PerContextData* perContextData = V8PerContextData::from(info.Holder()->CreationContext()); 2997 if (!perContextData) 2998 return; 2999 v8SetReturnValue(info, perContextData->constructorForType(WrapperTypeInfo::unwrap(data))); 3000 } 3001 static void TestObjReplaceableAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 3002 { 3003 info.This()->ForceSet(name, value); 3004 } 3005 3006 static void TestObjReplaceableAttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 3007 { 3008 TestObjV8Internal::TestObjReplaceableAttrSetter(name, value, info); 3009 } 3010 3011 static void voidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& args) 3012 { 3013 TestObj* imp = V8TestObject::toNative(args.Holder()); 3014 imp->voidMethod(); 3015 3016 return; 3017 } 3018 3019 static void voidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 3020 { 3021 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 3022 TestObjV8Internal::voidMethodMethod(args); 3023 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 3024 } 3025 3026 static void voidMethodWithArgsMethod(const v8::FunctionCallbackInfo<v8::Value>& args) 3027 { 3028 if (args.Length() < 3) { 3029 throwNotEnoughArgumentsError(args.GetIsolate()); 3030 return; 3031 } 3032 TestObj* imp = V8TestObject::toNative(args.Holder()); 3033 V8TRYCATCH_VOID(int, longArg, toInt32(args[0])); 3034 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, args[1]); 3035 V8TRYCATCH_VOID(TestObj*, objArg, V8TestObject::HasInstance(args[2], args.GetIsolate(), worldType(args.GetIsolate())) ? V8TestObject::toNative(v8::Handle<v8::Object>::Cast(args[2])) : 0); 3036 imp->voidMethodWithArgs(longArg, strArg, objArg); 3037 3038 return; 3039 } 3040 3041 static void voidMethodWithArgsMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 3042 { 3043 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 3044 TestObjV8Internal::voidMethodWithArgsMethod(args); 3045 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 3046 } 3047 3048 static void longMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& args) 3049 { 3050 TestObj* imp = V8TestObject::toNative(args.Holder()); 3051 v8SetReturnValueInt(args, imp->longMethod()); 3052 return; 3053 } 3054 3055 static void longMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 3056 { 3057 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 3058 TestObjV8Internal::longMethodMethod(args); 3059 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 3060 } 3061 3062 static void longMethodWithArgsMethod(const v8::FunctionCallbackInfo<v8::Value>& args) 3063 { 3064 if (args.Length() < 3) { 3065 throwNotEnoughArgumentsError(args.GetIsolate()); 3066 return; 3067 } 3068 TestObj* imp = V8TestObject::toNative(args.Holder()); 3069 V8TRYCATCH_VOID(int, longArg, toInt32(args[0])); 3070 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, args[1]); 3071 V8TRYCATCH_VOID(TestObj*, objArg, V8TestObject::HasInstance(args[2], args.GetIsolate(), worldType(args.GetIsolate())) ? V8TestObject::toNative(v8::Handle<v8::Object>::Cast(args[2])) : 0); 3072 v8SetReturnValueInt(args, imp->longMethodWithArgs(longArg, strArg, objArg)); 3073 return; 3074 } 3075 3076 static void longMethodWithArgsMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 3077 { 3078 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 3079 TestObjV8Internal::longMethodWithArgsMethod(args); 3080 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 3081 } 3082 3083 static void objMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& args) 3084 { 3085 TestObj* imp = V8TestObject::toNative(args.Holder()); 3086 v8SetReturnValue(args, toV8(imp->objMethod(), args.Holder(), args.GetIsolate())); 3087 return; 3088 } 3089 3090 static void objMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 3091 { 3092 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 3093 UseCounter::count(activeDOMWindow(), UseCounter::TestFeature); 3094 TestObjV8Internal::objMethodMethod(args); 3095 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 3096 } 3097 3098 static void objMethodWithArgsMethod(const v8::FunctionCallbackInfo<v8::Value>& args) 3099 { 3100 if (args.Length() < 3) { 3101 throwNotEnoughArgumentsError(args.GetIsolate()); 3102 return; 3103 } 3104 TestObj* imp = V8TestObject::toNative(args.Holder()); 3105 V8TRYCATCH_VOID(int, longArg, toInt32(args[0])); 3106 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, args[1]); 3107 V8TRYCATCH_VOID(TestObj*, objArg, V8TestObject::HasInstance(args[2], args.GetIsolate(), worldType(args.GetIsolate())) ? V8TestObject::toNative(v8::Handle<v8::Object>::Cast(args[2])) : 0); 3108 v8SetReturnValue(args, toV8(imp->objMethodWithArgs(longArg, strArg, objArg), args.Holder(), args.GetIsolate())); 3109 return; 3110 } 3111 3112 static void objMethodWithArgsMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 3113 { 3114 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 3115 TestObjV8Internal::objMethodWithArgsMethod(args); 3116 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 3117 } 3118 3119 static void methodWithSequenceArgMethod(const v8::FunctionCallbackInfo<v8::Value>& args) 3120 { 3121 if (args.Length() < 1) { 3122 throwNotEnoughArgumentsError(args.GetIsolate()); 3123 return; 3124 } 3125 TestObj* imp = V8TestObject::toNative(args.Holder()); 3126 V8TRYCATCH_VOID(Vector<RefPtr<TestInterface> >, sequenceArg, (toRefPtrNativeArray<TestInterface, V8TestInterface>(args[0], args.GetIsolate()))); 3127 imp->methodWithSequenceArg(sequenceArg); 3128 3129 return; 3130 } 3131 3132 static void methodWithSequenceArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 3133 { 3134 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 3135 TestObjV8Internal::methodWithSequenceArgMethod(args); 3136 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 3137 } 3138 3139 static void methodReturningSequenceMethod(const v8::FunctionCallbackInfo<v8::Value>& args) 3140 { 3141 if (args.Length() < 1) { 3142 throwNotEnoughArgumentsError(args.GetIsolate()); 3143 return; 3144 } 3145 TestObj* imp = V8TestObject::toNative(args.Holder()); 3146 V8TRYCATCH_VOID(int, longArg, toInt32(args[0])); 3147 v8SetReturnValue(args, v8Array(imp->methodReturningSequence(longArg), args.GetIsolate())); 3148 return; 3149 } 3150 3151 static void methodReturningSequenceMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 3152 { 3153 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 3154 TestObjV8Internal::methodReturningSequenceMethod(args); 3155 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 3156 } 3157 3158 static void methodWithEnumArgMethod(const v8::FunctionCallbackInfo<v8::Value>& args) 3159 { 3160 if (args.Length() < 1) { 3161 throwNotEnoughArgumentsError(args.GetIsolate()); 3162 return; 3163 } 3164 TestObj* imp = V8TestObject::toNative(args.Holder()); 3165 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, enumArg, args[0]); 3166 String string = enumArg; 3167 if (!(string == "" || string == "EnumValue1" || string == "EnumValue2" || string == "EnumValue3")) { 3168 throwTypeError(args.GetIsolate()); 3169 return; 3170 } 3171 imp->methodWithEnumArg(enumArg); 3172 3173 return; 3174 } 3175 3176 static void methodWithEnumArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 3177 { 3178 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 3179 TestObjV8Internal::methodWithEnumArgMethod(args); 3180 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 3181 } 3182 3183 static void methodThatRequiresAllArgsAndThrowsMethod(const v8::FunctionCallbackInfo<v8::Value>& args) 3184 { 3185 if (args.Length() < 2) { 3186 throwNotEnoughArgumentsError(args.GetIsolate()); 3187 return; 3188 } 3189 TestObj* imp = V8TestObject::toNative(args.Holder()); 3190 ExceptionState es(args.GetIsolate()); 3191 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, args[0]); 3192 V8TRYCATCH_VOID(TestObj*, objArg, V8TestObject::HasInstance(args[1], args.GetIsolate(), worldType(args.GetIsolate())) ? V8TestObject::toNative(v8::Handle<v8::Object>::Cast(args[1])) : 0); 3193 RefPtr<TestObj> result = imp->methodThatRequiresAllArgsAndThrows(strArg, objArg, es); 3194 if (es.throwIfNeeded()) 3195 return; 3196 v8SetReturnValue(args, toV8(result.release(), args.Holder(), args.GetIsolate())); 3197 return; 3198 } 3199 3200 static void methodThatRequiresAllArgsAndThrowsMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 3201 { 3202 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 3203 TestObjV8Internal::methodThatRequiresAllArgsAndThrowsMethod(args); 3204 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 3205 } 3206 3207 static void serializedValueMethod(const v8::FunctionCallbackInfo<v8::Value>& args) 3208 { 3209 if (args.Length() < 1) { 3210 throwNotEnoughArgumentsError(args.GetIsolate()); 3211 return; 3212 } 3213 TestObj* imp = V8TestObject::toNative(args.Holder()); 3214 bool serializedArgDidThrow = false; 3215 RefPtr<SerializedScriptValue> serializedArg = SerializedScriptValue::create(args[0], 0, 0, serializedArgDidThrow, args.GetIsolate()); 3216 if (serializedArgDidThrow) 3217 return; 3218 imp->serializedValue(serializedArg); 3219 3220 return; 3221 } 3222 3223 static void serializedValueMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 3224 { 3225 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 3226 TestObjV8Internal::serializedValueMethod(args); 3227 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 3228 } 3229 3230 static void optionsObjectMethod(const v8::FunctionCallbackInfo<v8::Value>& args) 3231 { 3232 if (args.Length() < 1) { 3233 throwNotEnoughArgumentsError(args.GetIsolate()); 3234 return; 3235 } 3236 TestObj* imp = V8TestObject::toNative(args.Holder()); 3237 V8TRYCATCH_VOID(Dictionary, oo, Dictionary(args[0], args.GetIsolate())); 3238 if (!oo.isUndefinedOrNull() && !oo.isObject()) { 3239 throwTypeError("Not an object.", args.GetIsolate()); 3240 return; 3241 } 3242 V8TRYCATCH_VOID(Dictionary, ooo, Dictionary(args[1], args.GetIsolate())); 3243 if (!ooo.isUndefinedOrNull() && !ooo.isObject()) { 3244 throwTypeError("Not an object.", args.GetIsolate()); 3245 return; 3246 } 3247 imp->optionsObject(oo, ooo); 3248 3249 return; 3250 } 3251 3252 static void optionsObjectMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 3253 { 3254 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 3255 TestObjV8Internal::optionsObjectMethod(args); 3256 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 3257 } 3258 3259 static void methodWithExceptionMethod(const v8::FunctionCallbackInfo<v8::Value>& args) 3260 { 3261 TestObj* imp = V8TestObject::toNative(args.Holder()); 3262 ExceptionState es(args.GetIsolate()); 3263 imp->methodWithException(es); 3264 if (es.throwIfNeeded()) 3265 return; 3266 3267 return; 3268 } 3269 3270 static void methodWithExceptionMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 3271 { 3272 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 3273 TestObjV8Internal::methodWithExceptionMethod(args); 3274 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 3275 } 3276 3277 static void customMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 3278 { 3279 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 3280 UseCounter::count(activeDOMWindow(), UseCounter::CustomTestFeature); 3281 V8TestObject::customMethodMethodCustom(args); 3282 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 3283 } 3284 3285 static void customMethodWithArgsMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 3286 { 3287 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 3288 V8TestObject::customMethodWithArgsMethodCustom(args); 3289 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 3290 } 3291 3292 static void addEventListenerMethod(const v8::FunctionCallbackInfo<v8::Value>& args) 3293 { 3294 EventTarget* impl = V8TestObject::toNative(args.Holder()); 3295 if (DOMWindow* window = impl->toDOMWindow()) { 3296 if (!BindingSecurity::shouldAllowAccessToFrame(window->frame())) 3297 return; 3298 3299 if (!window->document()) 3300 return; 3301 } 3302 3303 RefPtr<EventListener> listener = V8EventListenerList::getEventListener(args[1], false, ListenerFindOrCreate); 3304 if (listener) { 3305 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<WithNullCheck>, stringResource, args[0]); 3306 impl->addEventListener(stringResource, listener, args[2]->BooleanValue()); 3307 if (!impl->toNode()) 3308 createHiddenDependency(args.Holder(), args[1], V8TestObject::eventListenerCacheIndex, args.GetIsolate()); 3309 } 3310 } 3311 3312 static void addEventListenerMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 3313 { 3314 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 3315 TestObjV8Internal::addEventListenerMethod(args); 3316 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 3317 } 3318 3319 static void removeEventListenerMethod(const v8::FunctionCallbackInfo<v8::Value>& args) 3320 { 3321 EventTarget* impl = V8TestObject::toNative(args.Holder()); 3322 if (DOMWindow* window = impl->toDOMWindow()) { 3323 if (!BindingSecurity::shouldAllowAccessToFrame(window->frame())) 3324 return; 3325 3326 if (!window->document()) 3327 return; 3328 } 3329 3330 RefPtr<EventListener> listener = V8EventListenerList::getEventListener(args[1], false, ListenerFindOnly); 3331 if (listener) { 3332 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<WithNullCheck>, stringResource, args[0]); 3333 impl->removeEventListener(stringResource, listener.get(), args[2]->BooleanValue()); 3334 if (!impl->toNode()) 3335 removeHiddenDependency(args.Holder(), args[1], V8TestObject::eventListenerCacheIndex, args.GetIsolate()); 3336 } 3337 } 3338 3339 static void removeEventListenerMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 3340 { 3341 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 3342 TestObjV8Internal::removeEventListenerMethod(args); 3343 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 3344 } 3345 3346 static void withScriptStateVoidMethod(const v8::FunctionCallbackInfo<v8::Value>& args) 3347 { 3348 TestObj* imp = V8TestObject::toNative(args.Holder()); 3349 ScriptState* currentState = ScriptState::current(); 3350 if (!currentState) 3351 return; 3352 ScriptState& state = *currentState; 3353 imp->withScriptStateVoid(&state); 3354 if (state.hadException()) { 3355 v8::Local<v8::Value> exception = state.exception(); 3356 state.clearException(); 3357 throwError(exception); 3358 return; 3359 } 3360 3361 return; 3362 } 3363 3364 static void withScriptStateVoidMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 3365 { 3366 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 3367 TestObjV8Internal::withScriptStateVoidMethod(args); 3368 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 3369 } 3370 3371 static void withScriptStateObjMethod(const v8::FunctionCallbackInfo<v8::Value>& args) 3372 { 3373 TestObj* imp = V8TestObject::toNative(args.Holder()); 3374 ScriptState* currentState = ScriptState::current(); 3375 if (!currentState) 3376 return; 3377 ScriptState& state = *currentState; 3378 RefPtr<TestObj> result = imp->withScriptStateObj(&state); 3379 if (state.hadException()) { 3380 v8::Local<v8::Value> exception = state.exception(); 3381 state.clearException(); 3382 throwError(exception); 3383 return; 3384 } 3385 v8SetReturnValue(args, toV8(result.release(), args.Holder(), args.GetIsolate())); 3386 return; 3387 } 3388 3389 static void withScriptStateObjMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 3390 { 3391 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 3392 TestObjV8Internal::withScriptStateObjMethod(args); 3393 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 3394 } 3395 3396 static void withScriptStateVoidExceptionMethod(const v8::FunctionCallbackInfo<v8::Value>& args) 3397 { 3398 TestObj* imp = V8TestObject::toNative(args.Holder()); 3399 ExceptionState es(args.GetIsolate()); 3400 ScriptState* currentState = ScriptState::current(); 3401 if (!currentState) 3402 return; 3403 ScriptState& state = *currentState; 3404 imp->withScriptStateVoidException(&state, es); 3405 if (es.throwIfNeeded()) 3406 return; 3407 if (state.hadException()) { 3408 v8::Local<v8::Value> exception = state.exception(); 3409 state.clearException(); 3410 throwError(exception); 3411 return; 3412 } 3413 3414 return; 3415 } 3416 3417 static void withScriptStateVoidExceptionMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 3418 { 3419 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 3420 TestObjV8Internal::withScriptStateVoidExceptionMethod(args); 3421 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 3422 } 3423 3424 static void withScriptStateObjExceptionMethod(const v8::FunctionCallbackInfo<v8::Value>& args) 3425 { 3426 TestObj* imp = V8TestObject::toNative(args.Holder()); 3427 ExceptionState es(args.GetIsolate()); 3428 ScriptState* currentState = ScriptState::current(); 3429 if (!currentState) 3430 return; 3431 ScriptState& state = *currentState; 3432 RefPtr<TestObj> result = imp->withScriptStateObjException(&state, es); 3433 if (es.throwIfNeeded()) 3434 return; 3435 if (state.hadException()) { 3436 v8::Local<v8::Value> exception = state.exception(); 3437 state.clearException(); 3438 throwError(exception); 3439 return; 3440 } 3441 v8SetReturnValue(args, toV8(result.release(), args.Holder(), args.GetIsolate())); 3442 return; 3443 } 3444 3445 static void withScriptStateObjExceptionMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 3446 { 3447 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 3448 TestObjV8Internal::withScriptStateObjExceptionMethod(args); 3449 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 3450 } 3451 3452 static void withScriptExecutionContextMethod(const v8::FunctionCallbackInfo<v8::Value>& args) 3453 { 3454 TestObj* imp = V8TestObject::toNative(args.Holder()); 3455 ScriptExecutionContext* scriptContext = getScriptExecutionContext(); 3456 imp->withScriptExecutionContext(scriptContext); 3457 3458 return; 3459 } 3460 3461 static void withScriptExecutionContextMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 3462 { 3463 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 3464 TestObjV8Internal::withScriptExecutionContextMethod(args); 3465 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 3466 } 3467 3468 static void withScriptExecutionContextAndScriptStateMethod(const v8::FunctionCallbackInfo<v8::Value>& args) 3469 { 3470 TestObj* imp = V8TestObject::toNative(args.Holder()); 3471 ScriptState* currentState = ScriptState::current(); 3472 if (!currentState) 3473 return; 3474 ScriptState& state = *currentState; 3475 ScriptExecutionContext* scriptContext = getScriptExecutionContext(); 3476 imp->withScriptExecutionContextAndScriptState(&state, scriptContext); 3477 if (state.hadException()) { 3478 v8::Local<v8::Value> exception = state.exception(); 3479 state.clearException(); 3480 throwError(exception); 3481 return; 3482 } 3483 3484 return; 3485 } 3486 3487 static void withScriptExecutionContextAndScriptStateMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 3488 { 3489 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 3490 TestObjV8Internal::withScriptExecutionContextAndScriptStateMethod(args); 3491 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 3492 } 3493 3494 static void withScriptExecutionContextAndScriptStateObjExceptionMethod(const v8::FunctionCallbackInfo<v8::Value>& args) 3495 { 3496 TestObj* imp = V8TestObject::toNative(args.Holder()); 3497 ExceptionState es(args.GetIsolate()); 3498 ScriptState* currentState = ScriptState::current(); 3499 if (!currentState) 3500 return; 3501 ScriptState& state = *currentState; 3502 ScriptExecutionContext* scriptContext = getScriptExecutionContext(); 3503 RefPtr<TestObj> result = imp->withScriptExecutionContextAndScriptStateObjException(&state, scriptContext, es); 3504 if (es.throwIfNeeded()) 3505 return; 3506 if (state.hadException()) { 3507 v8::Local<v8::Value> exception = state.exception(); 3508 state.clearException(); 3509 throwError(exception); 3510 return; 3511 } 3512 v8SetReturnValue(args, toV8(result.release(), args.Holder(), args.GetIsolate())); 3513 return; 3514 } 3515 3516 static void withScriptExecutionContextAndScriptStateObjExceptionMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 3517 { 3518 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 3519 TestObjV8Internal::withScriptExecutionContextAndScriptStateObjExceptionMethod(args); 3520 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 3521 } 3522 3523 static void withScriptExecutionContextAndScriptStateWithSpacesMethod(const v8::FunctionCallbackInfo<v8::Value>& args) 3524 { 3525 TestObj* imp = V8TestObject::toNative(args.Holder()); 3526 ScriptState* currentState = ScriptState::current(); 3527 if (!currentState) 3528 return; 3529 ScriptState& state = *currentState; 3530 ScriptExecutionContext* scriptContext = getScriptExecutionContext(); 3531 RefPtr<TestObj> result = imp->withScriptExecutionContextAndScriptStateWithSpaces(&state, scriptContext); 3532 if (state.hadException()) { 3533 v8::Local<v8::Value> exception = state.exception(); 3534 state.clearException(); 3535 throwError(exception); 3536 return; 3537 } 3538 v8SetReturnValue(args, toV8(result.release(), args.Holder(), args.GetIsolate())); 3539 return; 3540 } 3541 3542 static void withScriptExecutionContextAndScriptStateWithSpacesMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 3543 { 3544 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 3545 TestObjV8Internal::withScriptExecutionContextAndScriptStateWithSpacesMethod(args); 3546 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 3547 } 3548 3549 static void withActiveWindowAndFirstWindowMethod(const v8::FunctionCallbackInfo<v8::Value>& args) 3550 { 3551 TestObj* imp = V8TestObject::toNative(args.Holder()); 3552 imp->withActiveWindowAndFirstWindow(activeDOMWindow(), firstDOMWindow()); 3553 3554 return; 3555 } 3556 3557 static void withActiveWindowAndFirstWindowMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 3558 { 3559 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 3560 TestObjV8Internal::withActiveWindowAndFirstWindowMethod(args); 3561 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 3562 } 3563 3564 static void methodWithOptionalArgMethod(const v8::FunctionCallbackInfo<v8::Value>& args) 3565 { 3566 TestObj* imp = V8TestObject::toNative(args.Holder()); 3567 if (args.Length() <= 0) { 3568 imp->methodWithOptionalArg(); 3569 3570 return; 3571 } 3572 V8TRYCATCH_VOID(int, opt, toInt32(args[0])); 3573 imp->methodWithOptionalArg(opt); 3574 3575 return; 3576 } 3577 3578 static void methodWithOptionalArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 3579 { 3580 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 3581 TestObjV8Internal::methodWithOptionalArgMethod(args); 3582 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 3583 } 3584 3585 static void methodWithNonOptionalArgAndOptionalArgMethod(const v8::FunctionCallbackInfo<v8::Value>& args) 3586 { 3587 if (args.Length() < 1) { 3588 throwNotEnoughArgumentsError(args.GetIsolate()); 3589 return; 3590 } 3591 TestObj* imp = V8TestObject::toNative(args.Holder()); 3592 V8TRYCATCH_VOID(int, nonOpt, toInt32(args[0])); 3593 if (args.Length() <= 1) { 3594 imp->methodWithNonOptionalArgAndOptionalArg(nonOpt); 3595 3596 return; 3597 } 3598 V8TRYCATCH_VOID(int, opt, toInt32(args[1])); 3599 imp->methodWithNonOptionalArgAndOptionalArg(nonOpt, opt); 3600 3601 return; 3602 } 3603 3604 static void methodWithNonOptionalArgAndOptionalArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 3605 { 3606 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 3607 TestObjV8Internal::methodWithNonOptionalArgAndOptionalArgMethod(args); 3608 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 3609 } 3610 3611 static void methodWithNonOptionalArgAndTwoOptionalArgsMethod(const v8::FunctionCallbackInfo<v8::Value>& args) 3612 { 3613 if (args.Length() < 1) { 3614 throwNotEnoughArgumentsError(args.GetIsolate()); 3615 return; 3616 } 3617 TestObj* imp = V8TestObject::toNative(args.Holder()); 3618 V8TRYCATCH_VOID(int, nonOpt, toInt32(args[0])); 3619 if (args.Length() <= 1) { 3620 imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt); 3621 3622 return; 3623 } 3624 V8TRYCATCH_VOID(int, opt1, toInt32(args[1])); 3625 if (args.Length() <= 2) { 3626 imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt, opt1); 3627 3628 return; 3629 } 3630 V8TRYCATCH_VOID(int, opt2, toInt32(args[2])); 3631 imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt, opt1, opt2); 3632 3633 return; 3634 } 3635 3636 static void methodWithNonOptionalArgAndTwoOptionalArgsMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 3637 { 3638 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 3639 TestObjV8Internal::methodWithNonOptionalArgAndTwoOptionalArgsMethod(args); 3640 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 3641 } 3642 3643 static void methodWithOptionalStringMethod(const v8::FunctionCallbackInfo<v8::Value>& args) 3644 { 3645 TestObj* imp = V8TestObject::toNative(args.Holder()); 3646 if (args.Length() <= 0) { 3647 imp->methodWithOptionalString(); 3648 3649 return; 3650 } 3651 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, str, args[0]); 3652 imp->methodWithOptionalString(str); 3653 3654 return; 3655 } 3656 3657 static void methodWithOptionalStringMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 3658 { 3659 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 3660 TestObjV8Internal::methodWithOptionalStringMethod(args); 3661 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 3662 } 3663 3664 static void methodWithOptionalStringIsUndefinedMethod(const v8::FunctionCallbackInfo<v8::Value>& args) 3665 { 3666 TestObj* imp = V8TestObject::toNative(args.Holder()); 3667 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, str, args[0]); 3668 imp->methodWithOptionalStringIsUndefined(str); 3669 3670 return; 3671 } 3672 3673 static void methodWithOptionalStringIsUndefinedMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 3674 { 3675 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 3676 TestObjV8Internal::methodWithOptionalStringIsUndefinedMethod(args); 3677 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 3678 } 3679 3680 static void methodWithOptionalStringIsNullStringMethod(const v8::FunctionCallbackInfo<v8::Value>& args) 3681 { 3682 TestObj* imp = V8TestObject::toNative(args.Holder()); 3683 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, str, argumentOrNull(args, 0)); 3684 imp->methodWithOptionalStringIsNullString(str); 3685 3686 return; 3687 } 3688 3689 static void methodWithOptionalStringIsNullStringMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 3690 { 3691 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 3692 TestObjV8Internal::methodWithOptionalStringIsNullStringMethod(args); 3693 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 3694 } 3695 3696 static void methodWithCallbackArgMethod(const v8::FunctionCallbackInfo<v8::Value>& args) 3697 { 3698 if (args.Length() < 1) { 3699 throwNotEnoughArgumentsError(args.GetIsolate()); 3700 return; 3701 } 3702 TestObj* imp = V8TestObject::toNative(args.Holder()); 3703 if (args.Length() <= 0 || !args[0]->IsFunction()) { 3704 throwTypeError(args.GetIsolate()); 3705 return; 3706 } 3707 RefPtr<TestCallback> callback = V8TestCallback::create(args[0], getScriptExecutionContext()); 3708 imp->methodWithCallbackArg(callback); 3709 3710 return; 3711 } 3712 3713 static void methodWithCallbackArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 3714 { 3715 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 3716 TestObjV8Internal::methodWithCallbackArgMethod(args); 3717 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 3718 } 3719 3720 static void methodWithNonCallbackArgAndCallbackArgMethod(const v8::FunctionCallbackInfo<v8::Value>& args) 3721 { 3722 if (args.Length() < 2) { 3723 throwNotEnoughArgumentsError(args.GetIsolate()); 3724 return; 3725 } 3726 TestObj* imp = V8TestObject::toNative(args.Holder()); 3727 V8TRYCATCH_VOID(int, nonCallback, toInt32(args[0])); 3728 if (args.Length() <= 1 || !args[1]->IsFunction()) { 3729 throwTypeError(args.GetIsolate()); 3730 return; 3731 } 3732 RefPtr<TestCallback> callback = V8TestCallback::create(args[1], getScriptExecutionContext()); 3733 imp->methodWithNonCallbackArgAndCallbackArg(nonCallback, callback); 3734 3735 return; 3736 } 3737 3738 static void methodWithNonCallbackArgAndCallbackArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 3739 { 3740 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 3741 TestObjV8Internal::methodWithNonCallbackArgAndCallbackArgMethod(args); 3742 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 3743 } 3744 3745 static void methodWithCallbackAndOptionalArgMethod(const v8::FunctionCallbackInfo<v8::Value>& args) 3746 { 3747 TestObj* imp = V8TestObject::toNative(args.Holder()); 3748 RefPtr<TestCallback> callback; 3749 if (args.Length() > 0 && !args[0]->IsNull() && !args[0]->IsUndefined()) { 3750 if (!args[0]->IsFunction()) { 3751 throwTypeError(args.GetIsolate()); 3752 return; 3753 } 3754 callback = V8TestCallback::create(args[0], getScriptExecutionContext()); 3755 } 3756 imp->methodWithCallbackAndOptionalArg(callback); 3757 3758 return; 3759 } 3760 3761 static void methodWithCallbackAndOptionalArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 3762 { 3763 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 3764 TestObjV8Internal::methodWithCallbackAndOptionalArgMethod(args); 3765 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 3766 } 3767 3768 static void methodWithNullableCallbackArgMethod(const v8::FunctionCallbackInfo<v8::Value>& args) 3769 { 3770 if (args.Length() < 1) { 3771 throwNotEnoughArgumentsError(args.GetIsolate()); 3772 return; 3773 } 3774 TestObj* imp = V8TestObject::toNative(args.Holder()); 3775 if (args.Length() <= 0 || !(args[0]->IsFunction() || args[0]->IsNull())) { 3776 throwTypeError(args.GetIsolate()); 3777 return; 3778 } 3779 RefPtr<TestCallback> callback = args[0]->IsNull() ? 0 : V8TestCallback::create(args[0], getScriptExecutionContext()); 3780 imp->methodWithNullableCallbackArg(callback); 3781 3782 return; 3783 } 3784 3785 static void methodWithNullableCallbackArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 3786 { 3787 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 3788 TestObjV8Internal::methodWithNullableCallbackArgMethod(args); 3789 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 3790 } 3791 3792 static void staticMethodWithCallbackAndOptionalArgMethod(const v8::FunctionCallbackInfo<v8::Value>& args) 3793 { 3794 RefPtr<TestCallback> callback; 3795 if (args.Length() > 0 && !args[0]->IsNull() && !args[0]->IsUndefined()) { 3796 if (!args[0]->IsFunction()) { 3797 throwTypeError(args.GetIsolate()); 3798 return; 3799 } 3800 callback = V8TestCallback::create(args[0], getScriptExecutionContext()); 3801 } 3802 TestObj::staticMethodWithCallbackAndOptionalArg(callback); 3803 3804 return; 3805 } 3806 3807 static void staticMethodWithCallbackAndOptionalArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 3808 { 3809 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 3810 TestObjV8Internal::staticMethodWithCallbackAndOptionalArgMethod(args); 3811 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 3812 } 3813 3814 static void staticMethodWithCallbackArgMethod(const v8::FunctionCallbackInfo<v8::Value>& args) 3815 { 3816 if (args.Length() < 1) { 3817 throwNotEnoughArgumentsError(args.GetIsolate()); 3818 return; 3819 } 3820 if (args.Length() <= 0 || !args[0]->IsFunction()) { 3821 throwTypeError(args.GetIsolate()); 3822 return; 3823 } 3824 RefPtr<TestCallback> callback = V8TestCallback::create(args[0], getScriptExecutionContext()); 3825 TestObj::staticMethodWithCallbackArg(callback); 3826 3827 return; 3828 } 3829 3830 static void staticMethodWithCallbackArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 3831 { 3832 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 3833 TestObjV8Internal::staticMethodWithCallbackArgMethod(args); 3834 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 3835 } 3836 3837 static void methodWithEnforceRangeInt8Method(const v8::FunctionCallbackInfo<v8::Value>& args) 3838 { 3839 if (args.Length() < 1) { 3840 throwNotEnoughArgumentsError(args.GetIsolate()); 3841 return; 3842 } 3843 TestObj* imp = V8TestObject::toNative(args.Holder()); 3844 V8TRYCATCH_WITH_TYPECHECK_VOID(int, value, toInt8(args[0], EnforceRange, ok), args.GetIsolate()); 3845 imp->methodWithEnforceRangeInt8(value); 3846 3847 return; 3848 } 3849 3850 static void methodWithEnforceRangeInt8MethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 3851 { 3852 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 3853 TestObjV8Internal::methodWithEnforceRangeInt8Method(args); 3854 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 3855 } 3856 3857 static void methodWithEnforceRangeUInt8Method(const v8::FunctionCallbackInfo<v8::Value>& args) 3858 { 3859 if (args.Length() < 1) { 3860 throwNotEnoughArgumentsError(args.GetIsolate()); 3861 return; 3862 } 3863 TestObj* imp = V8TestObject::toNative(args.Holder()); 3864 V8TRYCATCH_WITH_TYPECHECK_VOID(unsigned, value, toUInt8(args[0], EnforceRange, ok), args.GetIsolate()); 3865 imp->methodWithEnforceRangeUInt8(value); 3866 3867 return; 3868 } 3869 3870 static void methodWithEnforceRangeUInt8MethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 3871 { 3872 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 3873 TestObjV8Internal::methodWithEnforceRangeUInt8Method(args); 3874 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 3875 } 3876 3877 static void methodWithEnforceRangeInt32Method(const v8::FunctionCallbackInfo<v8::Value>& args) 3878 { 3879 if (args.Length() < 1) { 3880 throwNotEnoughArgumentsError(args.GetIsolate()); 3881 return; 3882 } 3883 TestObj* imp = V8TestObject::toNative(args.Holder()); 3884 V8TRYCATCH_WITH_TYPECHECK_VOID(int, value, toInt32(args[0], EnforceRange, ok), args.GetIsolate()); 3885 imp->methodWithEnforceRangeInt32(value); 3886 3887 return; 3888 } 3889 3890 static void methodWithEnforceRangeInt32MethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 3891 { 3892 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 3893 TestObjV8Internal::methodWithEnforceRangeInt32Method(args); 3894 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 3895 } 3896 3897 static void methodWithEnforceRangeUInt32Method(const v8::FunctionCallbackInfo<v8::Value>& args) 3898 { 3899 if (args.Length() < 1) { 3900 throwNotEnoughArgumentsError(args.GetIsolate()); 3901 return; 3902 } 3903 TestObj* imp = V8TestObject::toNative(args.Holder()); 3904 V8TRYCATCH_WITH_TYPECHECK_VOID(unsigned, value, toUInt32(args[0], EnforceRange, ok), args.GetIsolate()); 3905 imp->methodWithEnforceRangeUInt32(value); 3906 3907 return; 3908 } 3909 3910 static void methodWithEnforceRangeUInt32MethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 3911 { 3912 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 3913 TestObjV8Internal::methodWithEnforceRangeUInt32Method(args); 3914 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 3915 } 3916 3917 static void methodWithEnforceRangeInt64Method(const v8::FunctionCallbackInfo<v8::Value>& args) 3918 { 3919 if (args.Length() < 1) { 3920 throwNotEnoughArgumentsError(args.GetIsolate()); 3921 return; 3922 } 3923 TestObj* imp = V8TestObject::toNative(args.Holder()); 3924 V8TRYCATCH_WITH_TYPECHECK_VOID(long long, value, toInt64(args[0], EnforceRange, ok), args.GetIsolate()); 3925 imp->methodWithEnforceRangeInt64(value); 3926 3927 return; 3928 } 3929 3930 static void methodWithEnforceRangeInt64MethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 3931 { 3932 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 3933 TestObjV8Internal::methodWithEnforceRangeInt64Method(args); 3934 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 3935 } 3936 3937 static void methodWithEnforceRangeUInt64Method(const v8::FunctionCallbackInfo<v8::Value>& args) 3938 { 3939 if (args.Length() < 1) { 3940 throwNotEnoughArgumentsError(args.GetIsolate()); 3941 return; 3942 } 3943 TestObj* imp = V8TestObject::toNative(args.Holder()); 3944 V8TRYCATCH_WITH_TYPECHECK_VOID(unsigned long long, value, toUInt64(args[0], EnforceRange, ok), args.GetIsolate()); 3945 imp->methodWithEnforceRangeUInt64(value); 3946 3947 return; 3948 } 3949 3950 static void methodWithEnforceRangeUInt64MethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 3951 { 3952 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 3953 TestObjV8Internal::methodWithEnforceRangeUInt64Method(args); 3954 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 3955 } 3956 3957 #if ENABLE(Condition1) 3958 3959 static void conditionalMethod1Method(const v8::FunctionCallbackInfo<v8::Value>& args) 3960 { 3961 TestObj* imp = V8TestObject::toNative(args.Holder()); 3962 v8SetReturnValueString(args, imp->conditionalMethod1(), args.GetIsolate()); 3963 return; 3964 } 3965 3966 #endif // ENABLE(Condition1) 3967 3968 #if ENABLE(Condition1) 3969 3970 static void conditionalMethod1MethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 3971 { 3972 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 3973 TestObjV8Internal::conditionalMethod1Method(args); 3974 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 3975 } 3976 3977 #endif // ENABLE(Condition1) 3978 3979 #if ENABLE(Condition1) && ENABLE(Condition2) 3980 3981 static void conditionalMethod2Method(const v8::FunctionCallbackInfo<v8::Value>& args) 3982 { 3983 TestObj* imp = V8TestObject::toNative(args.Holder()); 3984 imp->conditionalMethod2(); 3985 3986 return; 3987 } 3988 3989 #endif // ENABLE(Condition1) && ENABLE(Condition2) 3990 3991 #if ENABLE(Condition1) && ENABLE(Condition2) 3992 3993 static void conditionalMethod2MethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 3994 { 3995 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 3996 TestObjV8Internal::conditionalMethod2Method(args); 3997 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 3998 } 3999 4000 #endif // ENABLE(Condition1) && ENABLE(Condition2) 4001 4002 #if ENABLE(Condition1) || ENABLE(Condition2) 4003 4004 static void conditionalMethod3Method(const v8::FunctionCallbackInfo<v8::Value>& args) 4005 { 4006 TestObj* imp = V8TestObject::toNative(args.Holder()); 4007 imp->conditionalMethod3(); 4008 4009 return; 4010 } 4011 4012 #endif // ENABLE(Condition1) || ENABLE(Condition2) 4013 4014 #if ENABLE(Condition1) || ENABLE(Condition2) 4015 4016 static void conditionalMethod3MethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 4017 { 4018 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 4019 TestObjV8Internal::conditionalMethod3Method(args); 4020 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 4021 } 4022 4023 #endif // ENABLE(Condition1) || ENABLE(Condition2) 4024 4025 static void callbackFunctionReturnValueMethod(const v8::FunctionCallbackInfo<v8::Value>& args) 4026 { 4027 TestObj* imp = V8TestObject::toNative(args.Holder()); 4028 v8SetReturnValue(args, imp->callbackFunctionReturnValue().v8Value()); 4029 return; 4030 } 4031 4032 static void callbackFunctionReturnValueMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 4033 { 4034 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 4035 TestObjV8Internal::callbackFunctionReturnValueMethod(args); 4036 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 4037 } 4038 4039 static void callbackFunctionArgumentMethod(const v8::FunctionCallbackInfo<v8::Value>& args) 4040 { 4041 if (args.Length() < 1) { 4042 throwNotEnoughArgumentsError(args.GetIsolate()); 4043 return; 4044 } 4045 TestObj* imp = V8TestObject::toNative(args.Holder()); 4046 V8TRYCATCH_VOID(ScriptValue, function, ScriptValue(args[0])); 4047 imp->callbackFunctionArgument(function); 4048 4049 return; 4050 } 4051 4052 static void callbackFunctionArgumentMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 4053 { 4054 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 4055 TestObjV8Internal::callbackFunctionArgumentMethod(args); 4056 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 4057 } 4058 4059 static void overloadedMethod1Method(const v8::FunctionCallbackInfo<v8::Value>& args) 4060 { 4061 if (args.Length() < 2) { 4062 throwNotEnoughArgumentsError(args.GetIsolate()); 4063 return; 4064 } 4065 TestObj* imp = V8TestObject::toNative(args.Holder()); 4066 V8TRYCATCH_VOID(TestObj*, objArg, V8TestObject::HasInstance(args[0], args.GetIsolate(), worldType(args.GetIsolate())) ? V8TestObject::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0); 4067 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, args[1]); 4068 imp->overloadedMethod(objArg, strArg); 4069 4070 return; 4071 } 4072 4073 static void overloadedMethod2Method(const v8::FunctionCallbackInfo<v8::Value>& args) 4074 { 4075 if (args.Length() < 1) { 4076 throwNotEnoughArgumentsError(args.GetIsolate()); 4077 return; 4078 } 4079 TestObj* imp = V8TestObject::toNative(args.Holder()); 4080 V8TRYCATCH_VOID(TestObj*, objArg, V8TestObject::HasInstance(args[0], args.GetIsolate(), worldType(args.GetIsolate())) ? V8TestObject::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0); 4081 if (args.Length() <= 1) { 4082 imp->overloadedMethod(objArg); 4083 4084 return; 4085 } 4086 V8TRYCATCH_VOID(int, longArg, toInt32(args[1])); 4087 imp->overloadedMethod(objArg, longArg); 4088 4089 return; 4090 } 4091 4092 static void overloadedMethod3Method(const v8::FunctionCallbackInfo<v8::Value>& args) 4093 { 4094 if (args.Length() < 1) { 4095 throwNotEnoughArgumentsError(args.GetIsolate()); 4096 return; 4097 } 4098 TestObj* imp = V8TestObject::toNative(args.Holder()); 4099 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, args[0]); 4100 imp->overloadedMethod(strArg); 4101 4102 return; 4103 } 4104 4105 static void overloadedMethod4Method(const v8::FunctionCallbackInfo<v8::Value>& args) 4106 { 4107 if (args.Length() < 1) { 4108 throwNotEnoughArgumentsError(args.GetIsolate()); 4109 return; 4110 } 4111 TestObj* imp = V8TestObject::toNative(args.Holder()); 4112 V8TRYCATCH_VOID(int, longArg, toInt32(args[0])); 4113 imp->overloadedMethod(longArg); 4114 4115 return; 4116 } 4117 4118 static void overloadedMethod5Method(const v8::FunctionCallbackInfo<v8::Value>& args) 4119 { 4120 if (args.Length() < 1) { 4121 throwNotEnoughArgumentsError(args.GetIsolate()); 4122 return; 4123 } 4124 TestObj* imp = V8TestObject::toNative(args.Holder()); 4125 if (args.Length() <= 0 || !args[0]->IsFunction()) { 4126 throwTypeError(args.GetIsolate()); 4127 return; 4128 } 4129 RefPtr<TestCallback> callback = V8TestCallback::create(args[0], getScriptExecutionContext()); 4130 imp->overloadedMethod(callback); 4131 4132 return; 4133 } 4134 4135 static void overloadedMethod6Method(const v8::FunctionCallbackInfo<v8::Value>& args) 4136 { 4137 if (args.Length() < 1) { 4138 throwNotEnoughArgumentsError(args.GetIsolate()); 4139 return; 4140 } 4141 TestObj* imp = V8TestObject::toNative(args.Holder()); 4142 V8TRYCATCH_VOID(RefPtr<DOMStringList>, listArg, toDOMStringList(args[0], args.GetIsolate())); 4143 imp->overloadedMethod(listArg); 4144 4145 return; 4146 } 4147 4148 static void overloadedMethod7Method(const v8::FunctionCallbackInfo<v8::Value>& args) 4149 { 4150 if (args.Length() < 1) { 4151 throwNotEnoughArgumentsError(args.GetIsolate()); 4152 return; 4153 } 4154 TestObj* imp = V8TestObject::toNative(args.Holder()); 4155 V8TRYCATCH_VOID(Vector<String>, arrayArg, toNativeArray<String>(args[0], args.GetIsolate())); 4156 imp->overloadedMethod(arrayArg); 4157 4158 return; 4159 } 4160 4161 static void overloadedMethod8Method(const v8::FunctionCallbackInfo<v8::Value>& args) 4162 { 4163 if (args.Length() < 1) { 4164 throwNotEnoughArgumentsError(args.GetIsolate()); 4165 return; 4166 } 4167 TestObj* imp = V8TestObject::toNative(args.Holder()); 4168 V8TRYCATCH_VOID(TestObj*, objArg, V8TestObject::HasInstance(args[0], args.GetIsolate(), worldType(args.GetIsolate())) ? V8TestObject::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0); 4169 imp->overloadedMethod(objArg); 4170 4171 return; 4172 } 4173 4174 static void overloadedMethod9Method(const v8::FunctionCallbackInfo<v8::Value>& args) 4175 { 4176 if (args.Length() < 1) { 4177 throwNotEnoughArgumentsError(args.GetIsolate()); 4178 return; 4179 } 4180 TestObj* imp = V8TestObject::toNative(args.Holder()); 4181 V8TRYCATCH_VOID(Vector<String>, arrayArg, toNativeArray<String>(args[0], args.GetIsolate())); 4182 imp->overloadedMethod(arrayArg); 4183 4184 return; 4185 } 4186 4187 static void overloadedMethod10Method(const v8::FunctionCallbackInfo<v8::Value>& args) 4188 { 4189 if (args.Length() < 1) { 4190 throwNotEnoughArgumentsError(args.GetIsolate()); 4191 return; 4192 } 4193 TestObj* imp = V8TestObject::toNative(args.Holder()); 4194 V8TRYCATCH_VOID(Vector<unsigned>, arrayArg, toNativeArray<unsigned>(args[0], args.GetIsolate())); 4195 imp->overloadedMethod(arrayArg); 4196 4197 return; 4198 } 4199 4200 static void overloadedMethod11Method(const v8::FunctionCallbackInfo<v8::Value>& args) 4201 { 4202 if (args.Length() < 1) { 4203 throwNotEnoughArgumentsError(args.GetIsolate()); 4204 return; 4205 } 4206 TestObj* imp = V8TestObject::toNative(args.Holder()); 4207 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, args[0]); 4208 imp->overloadedMethod(strArg); 4209 4210 return; 4211 } 4212 4213 static void overloadedMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& args) 4214 { 4215 if ((args.Length() == 2 && (args[0]->IsNull() || V8TestObject::HasInstance(args[0], args.GetIsolate(), worldType(args.GetIsolate()))) && (args[1]->IsNull() || args[1]->IsUndefined() || args[1]->IsString() || args[1]->IsObject()))) { 4216 overloadedMethod1Method(args); 4217 return; 4218 } 4219 if ((args.Length() == 1 && (args[0]->IsNull() || V8TestObject::HasInstance(args[0], args.GetIsolate(), worldType(args.GetIsolate())))) || (args.Length() == 2 && (args[0]->IsNull() || V8TestObject::HasInstance(args[0], args.GetIsolate(), worldType(args.GetIsolate()))))) { 4220 overloadedMethod2Method(args); 4221 return; 4222 } 4223 if ((args.Length() == 1 && (args[0]->IsNull() || args[0]->IsUndefined() || args[0]->IsString() || args[0]->IsObject()))) { 4224 overloadedMethod3Method(args); 4225 return; 4226 } 4227 if (args.Length() == 1) { 4228 overloadedMethod4Method(args); 4229 return; 4230 } 4231 if ((args.Length() == 1 && (args[0]->IsNull() || args[0]->IsFunction()))) { 4232 overloadedMethod5Method(args); 4233 return; 4234 } 4235 if ((args.Length() == 1 && (args[0]->IsNull() || V8DOMStringList::HasInstance(args[0], args.GetIsolate(), worldType(args.GetIsolate()))))) { 4236 overloadedMethod6Method(args); 4237 return; 4238 } 4239 if ((args.Length() == 1 && (args[0]->IsNull() || args[0]->IsArray()))) { 4240 overloadedMethod7Method(args); 4241 return; 4242 } 4243 if ((args.Length() == 1 && (V8TestObject::HasInstance(args[0], args.GetIsolate(), worldType(args.GetIsolate()))))) { 4244 overloadedMethod8Method(args); 4245 return; 4246 } 4247 if ((args.Length() == 1 && (args[0]->IsArray()))) { 4248 overloadedMethod9Method(args); 4249 return; 4250 } 4251 if ((args.Length() == 1 && (args[0]->IsArray()))) { 4252 overloadedMethod10Method(args); 4253 return; 4254 } 4255 if (args.Length() == 1) { 4256 overloadedMethod11Method(args); 4257 return; 4258 } 4259 if (args.Length() < 1) { 4260 throwNotEnoughArgumentsError(args.GetIsolate()); 4261 return; 4262 } 4263 throwTypeError(args.GetIsolate()); 4264 } 4265 4266 static void overloadedMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 4267 { 4268 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 4269 TestObjV8Internal::overloadedMethodMethod(args); 4270 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 4271 } 4272 4273 static void classMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& args) 4274 { 4275 TestObj::classMethod(); 4276 4277 return; 4278 } 4279 4280 static void classMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 4281 { 4282 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 4283 TestObjV8Internal::classMethodMethod(args); 4284 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 4285 } 4286 4287 static void classMethodWithOptionalMethod(const v8::FunctionCallbackInfo<v8::Value>& args) 4288 { 4289 if (args.Length() <= 0) { 4290 v8SetReturnValueInt(args, TestObj::classMethodWithOptional()); 4291 return; 4292 } 4293 V8TRYCATCH_VOID(int, arg, toInt32(args[0])); 4294 v8SetReturnValueInt(args, TestObj::classMethodWithOptional(arg)); 4295 return; 4296 } 4297 4298 static void classMethodWithOptionalMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 4299 { 4300 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 4301 TestObjV8Internal::classMethodWithOptionalMethod(args); 4302 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 4303 } 4304 4305 static void classMethod2MethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 4306 { 4307 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 4308 V8TestObject::classMethod2MethodCustom(args); 4309 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 4310 } 4311 4312 #if ENABLE(Condition1) 4313 4314 static void overloadedMethod11Method(const v8::FunctionCallbackInfo<v8::Value>& args) 4315 { 4316 if (args.Length() < 1) { 4317 throwNotEnoughArgumentsError(args.GetIsolate()); 4318 return; 4319 } 4320 V8TRYCATCH_VOID(int, arg, toInt32(args[0])); 4321 TestObj::overloadedMethod1(arg); 4322 4323 return; 4324 } 4325 4326 #endif // ENABLE(Condition1) 4327 4328 #if ENABLE(Condition1) 4329 4330 static void overloadedMethod12Method(const v8::FunctionCallbackInfo<v8::Value>& args) 4331 { 4332 if (args.Length() < 1) { 4333 throwNotEnoughArgumentsError(args.GetIsolate()); 4334 return; 4335 } 4336 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, type, args[0]); 4337 TestObj::overloadedMethod1(type); 4338 4339 return; 4340 } 4341 4342 #endif // ENABLE(Condition1) 4343 4344 #if ENABLE(Condition1) 4345 4346 static void overloadedMethod1Method(const v8::FunctionCallbackInfo<v8::Value>& args) 4347 { 4348 if (args.Length() == 1) { 4349 overloadedMethod11Method(args); 4350 return; 4351 } 4352 if ((args.Length() == 1 && (args[0]->IsNull() || args[0]->IsUndefined() || args[0]->IsString() || args[0]->IsObject()))) { 4353 overloadedMethod12Method(args); 4354 return; 4355 } 4356 if (args.Length() < 1) { 4357 throwNotEnoughArgumentsError(args.GetIsolate()); 4358 return; 4359 } 4360 throwTypeError(args.GetIsolate()); 4361 } 4362 4363 #endif // ENABLE(Condition1) 4364 4365 #if ENABLE(Condition1) 4366 4367 static void overloadedMethod1MethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 4368 { 4369 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 4370 TestObjV8Internal::overloadedMethod1Method(args); 4371 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 4372 } 4373 4374 #endif // ENABLE(Condition1) 4375 4376 static void classMethodWithClampMethod(const v8::FunctionCallbackInfo<v8::Value>& args) 4377 { 4378 if (args.Length() < 2) { 4379 throwNotEnoughArgumentsError(args.GetIsolate()); 4380 return; 4381 } 4382 TestObj* imp = V8TestObject::toNative(args.Holder()); 4383 unsigned short objArgsShort = 0; 4384 V8TRYCATCH_VOID(double, objArgsShortNativeValue, args[0]->NumberValue()); 4385 if (!std::isnan(objArgsShortNativeValue)) 4386 objArgsShort = clampTo<unsigned short>(objArgsShortNativeValue); 4387 unsigned long objArgsLong = 0; 4388 V8TRYCATCH_VOID(double, objArgsLongNativeValue, args[1]->NumberValue()); 4389 if (!std::isnan(objArgsLongNativeValue)) 4390 objArgsLong = clampTo<unsigned long>(objArgsLongNativeValue); 4391 imp->classMethodWithClamp(objArgsShort, objArgsLong); 4392 4393 return; 4394 } 4395 4396 static void classMethodWithClampMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 4397 { 4398 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 4399 TestObjV8Internal::classMethodWithClampMethod(args); 4400 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 4401 } 4402 4403 static void enabledAtRuntimeMethod1Method(const v8::FunctionCallbackInfo<v8::Value>& args) 4404 { 4405 if (args.Length() < 1) { 4406 throwNotEnoughArgumentsError(args.GetIsolate()); 4407 return; 4408 } 4409 TestObj* imp = V8TestObject::toNative(args.Holder()); 4410 V8TRYCATCH_VOID(int, longArg, toInt32(args[0])); 4411 imp->enabledAtRuntimeMethod1(longArg); 4412 4413 return; 4414 } 4415 4416 static void enabledAtRuntimeMethod1MethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 4417 { 4418 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 4419 TestObjV8Internal::enabledAtRuntimeMethod1Method(args); 4420 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 4421 } 4422 4423 static void enabledAtRuntimeMethod2Method(const v8::FunctionCallbackInfo<v8::Value>& args) 4424 { 4425 if (args.Length() < 1) { 4426 throwNotEnoughArgumentsError(args.GetIsolate()); 4427 return; 4428 } 4429 TestObj* imp = V8TestObject::toNative(args.Holder()); 4430 V8TRYCATCH_VOID(int, longArg, toInt32(args[0])); 4431 imp->enabledAtRuntimeMethod2(longArg); 4432 4433 return; 4434 } 4435 4436 static void enabledAtRuntimeMethod2MethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 4437 { 4438 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 4439 TestObjV8Internal::enabledAtRuntimeMethod2Method(args); 4440 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 4441 } 4442 4443 static void enabledPerContextMethod1Method(const v8::FunctionCallbackInfo<v8::Value>& args) 4444 { 4445 if (args.Length() < 1) { 4446 throwNotEnoughArgumentsError(args.GetIsolate()); 4447 return; 4448 } 4449 TestObj* imp = V8TestObject::toNative(args.Holder()); 4450 V8TRYCATCH_VOID(int, longArg, toInt32(args[0])); 4451 imp->enabledPerContextMethod1(longArg); 4452 4453 return; 4454 } 4455 4456 static void enabledPerContextMethod1MethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 4457 { 4458 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 4459 TestObjV8Internal::enabledPerContextMethod1Method(args); 4460 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 4461 } 4462 4463 static void enabledPerContextMethod2Method(const v8::FunctionCallbackInfo<v8::Value>& args) 4464 { 4465 if (args.Length() < 1) { 4466 throwNotEnoughArgumentsError(args.GetIsolate()); 4467 return; 4468 } 4469 TestObj* imp = V8TestObject::toNative(args.Holder()); 4470 V8TRYCATCH_VOID(int, longArg, toInt32(args[0])); 4471 imp->enabledPerContextMethod2(longArg); 4472 4473 return; 4474 } 4475 4476 static void enabledPerContextMethod2MethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 4477 { 4478 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 4479 TestObjV8Internal::enabledPerContextMethod2Method(args); 4480 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 4481 } 4482 4483 static void methodWithUnsignedLongSequenceMethod(const v8::FunctionCallbackInfo<v8::Value>& args) 4484 { 4485 if (args.Length() < 1) { 4486 throwNotEnoughArgumentsError(args.GetIsolate()); 4487 return; 4488 } 4489 TestObj* imp = V8TestObject::toNative(args.Holder()); 4490 V8TRYCATCH_VOID(Vector<unsigned>, unsignedLongSequence, toNativeArray<unsigned>(args[0], args.GetIsolate())); 4491 imp->methodWithUnsignedLongSequence(unsignedLongSequence); 4492 4493 return; 4494 } 4495 4496 static void methodWithUnsignedLongSequenceMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 4497 { 4498 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 4499 TestObjV8Internal::methodWithUnsignedLongSequenceMethod(args); 4500 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 4501 } 4502 4503 static void stringArrayFunctionMethod(const v8::FunctionCallbackInfo<v8::Value>& args) 4504 { 4505 if (args.Length() < 1) { 4506 throwNotEnoughArgumentsError(args.GetIsolate()); 4507 return; 4508 } 4509 TestObj* imp = V8TestObject::toNative(args.Holder()); 4510 ExceptionState es(args.GetIsolate()); 4511 V8TRYCATCH_VOID(Vector<String>, values, toNativeArray<String>(args[0], args.GetIsolate())); 4512 Vector<String> result = imp->stringArrayFunction(values, es); 4513 if (es.throwIfNeeded()) 4514 return; 4515 v8SetReturnValue(args, v8Array(result, args.GetIsolate())); 4516 return; 4517 } 4518 4519 static void stringArrayFunctionMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 4520 { 4521 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 4522 TestObjV8Internal::stringArrayFunctionMethod(args); 4523 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 4524 } 4525 4526 static void domStringListFunctionMethod(const v8::FunctionCallbackInfo<v8::Value>& args) 4527 { 4528 if (args.Length() < 1) { 4529 throwNotEnoughArgumentsError(args.GetIsolate()); 4530 return; 4531 } 4532 TestObj* imp = V8TestObject::toNative(args.Holder()); 4533 ExceptionState es(args.GetIsolate()); 4534 V8TRYCATCH_VOID(RefPtr<DOMStringList>, values, toDOMStringList(args[0], args.GetIsolate())); 4535 RefPtr<DOMStringList> result = imp->domStringListFunction(values, es); 4536 if (es.throwIfNeeded()) 4537 return; 4538 v8SetReturnValue(args, toV8(result.release(), args.Holder(), args.GetIsolate())); 4539 return; 4540 } 4541 4542 static void domStringListFunctionMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 4543 { 4544 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 4545 TestObjV8Internal::domStringListFunctionMethod(args); 4546 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 4547 } 4548 4549 static void getSVGDocumentMethod(const v8::FunctionCallbackInfo<v8::Value>& args) 4550 { 4551 TestObj* imp = V8TestObject::toNative(args.Holder()); 4552 ExceptionState es(args.GetIsolate()); 4553 if (!BindingSecurity::shouldAllowAccessToNode(imp->getSVGDocument(es))) { 4554 v8SetReturnValueNull(args); 4555 return; 4556 } 4557 RefPtr<SVGDocument> result = imp->getSVGDocument(es); 4558 if (es.throwIfNeeded()) 4559 return; 4560 v8SetReturnValue(args, toV8(result.release(), args.Holder(), args.GetIsolate())); 4561 return; 4562 } 4563 4564 static void getSVGDocumentMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 4565 { 4566 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 4567 TestObjV8Internal::getSVGDocumentMethod(args); 4568 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 4569 } 4570 4571 static void convert1Method(const v8::FunctionCallbackInfo<v8::Value>& args) 4572 { 4573 if (args.Length() < 1) { 4574 throwNotEnoughArgumentsError(args.GetIsolate()); 4575 return; 4576 } 4577 TestObj* imp = V8TestObject::toNative(args.Holder()); 4578 V8TRYCATCH_VOID(TestNode*, value, V8TestNode::HasInstance(args[0], args.GetIsolate(), worldType(args.GetIsolate())) ? V8TestNode::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0); 4579 imp->convert1(value); 4580 4581 return; 4582 } 4583 4584 static void convert1MethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 4585 { 4586 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 4587 TestObjV8Internal::convert1Method(args); 4588 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 4589 } 4590 4591 static void convert2Method(const v8::FunctionCallbackInfo<v8::Value>& args) 4592 { 4593 if (args.Length() < 1) { 4594 throwNotEnoughArgumentsError(args.GetIsolate()); 4595 return; 4596 } 4597 TestObj* imp = V8TestObject::toNative(args.Holder()); 4598 V8TRYCATCH_VOID(TestNode*, value, V8TestNode::HasInstance(args[0], args.GetIsolate(), worldType(args.GetIsolate())) ? V8TestNode::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0); 4599 imp->convert2(value); 4600 4601 return; 4602 } 4603 4604 static void convert2MethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 4605 { 4606 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 4607 TestObjV8Internal::convert2Method(args); 4608 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 4609 } 4610 4611 static void convert4Method(const v8::FunctionCallbackInfo<v8::Value>& args) 4612 { 4613 if (args.Length() < 1) { 4614 throwNotEnoughArgumentsError(args.GetIsolate()); 4615 return; 4616 } 4617 TestObj* imp = V8TestObject::toNative(args.Holder()); 4618 V8TRYCATCH_VOID(TestNode*, value, V8TestNode::HasInstance(args[0], args.GetIsolate(), worldType(args.GetIsolate())) ? V8TestNode::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0); 4619 imp->convert4(value); 4620 4621 return; 4622 } 4623 4624 static void convert4MethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 4625 { 4626 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 4627 TestObjV8Internal::convert4Method(args); 4628 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 4629 } 4630 4631 static void convert5Method(const v8::FunctionCallbackInfo<v8::Value>& args) 4632 { 4633 if (args.Length() < 1) { 4634 throwNotEnoughArgumentsError(args.GetIsolate()); 4635 return; 4636 } 4637 TestObj* imp = V8TestObject::toNative(args.Holder()); 4638 V8TRYCATCH_VOID(TestNode*, value, V8TestNode::HasInstance(args[0], args.GetIsolate(), worldType(args.GetIsolate())) ? V8TestNode::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0); 4639 imp->convert5(value); 4640 4641 return; 4642 } 4643 4644 static void convert5MethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 4645 { 4646 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 4647 TestObjV8Internal::convert5Method(args); 4648 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 4649 } 4650 4651 static void mutablePointFunctionMethod(const v8::FunctionCallbackInfo<v8::Value>& args) 4652 { 4653 TestObj* imp = V8TestObject::toNative(args.Holder()); 4654 v8SetReturnValue(args, toV8(WTF::getPtr(SVGPropertyTearOff<SVGPoint>::create(imp->mutablePointFunction())), args.Holder(), args.GetIsolate())); 4655 return; 4656 } 4657 4658 static void mutablePointFunctionMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 4659 { 4660 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 4661 TestObjV8Internal::mutablePointFunctionMethod(args); 4662 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 4663 } 4664 4665 static void immutablePointFunctionMethod(const v8::FunctionCallbackInfo<v8::Value>& args) 4666 { 4667 TestObj* imp = V8TestObject::toNative(args.Holder()); 4668 v8SetReturnValue(args, toV8(WTF::getPtr(SVGPropertyTearOff<SVGPoint>::create(imp->immutablePointFunction())), args.Holder(), args.GetIsolate())); 4669 return; 4670 } 4671 4672 static void immutablePointFunctionMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 4673 { 4674 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 4675 TestObjV8Internal::immutablePointFunctionMethod(args); 4676 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 4677 } 4678 4679 static void orangeMethod(const v8::FunctionCallbackInfo<v8::Value>& args) 4680 { 4681 TestObj* imp = V8TestObject::toNative(args.Holder()); 4682 imp->banana(); 4683 4684 return; 4685 } 4686 4687 static void orangeMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 4688 { 4689 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 4690 TestObjV8Internal::orangeMethod(args); 4691 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 4692 } 4693 4694 static void strictFunctionMethod(const v8::FunctionCallbackInfo<v8::Value>& args) 4695 { 4696 if (args.Length() < 3) { 4697 throwNotEnoughArgumentsError(args.GetIsolate()); 4698 return; 4699 } 4700 TestObj* imp = V8TestObject::toNative(args.Holder()); 4701 ExceptionState es(args.GetIsolate()); 4702 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, str, args[0]); 4703 V8TRYCATCH_VOID(float, a, static_cast<float>(args[1]->NumberValue())); 4704 V8TRYCATCH_VOID(int, b, toInt32(args[2])); 4705 bool result = imp->strictFunction(str, a, b, es); 4706 if (es.throwIfNeeded()) 4707 return; 4708 v8SetReturnValueBool(args, result); 4709 return; 4710 } 4711 4712 static void strictFunctionMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 4713 { 4714 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 4715 TestObjV8Internal::strictFunctionMethod(args); 4716 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 4717 } 4718 4719 static void variadicStringMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& args) 4720 { 4721 if (args.Length() < 1) { 4722 throwNotEnoughArgumentsError(args.GetIsolate()); 4723 return; 4724 } 4725 TestObj* imp = V8TestObject::toNative(args.Holder()); 4726 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, head, args[0]); 4727 V8TRYCATCH_VOID(Vector<String>, tail, toNativeArguments<String>(args, 1)); 4728 imp->variadicStringMethod(head, tail); 4729 4730 return; 4731 } 4732 4733 static void variadicStringMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 4734 { 4735 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 4736 TestObjV8Internal::variadicStringMethodMethod(args); 4737 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 4738 } 4739 4740 static void variadicDoubleMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& args) 4741 { 4742 if (args.Length() < 1) { 4743 throwNotEnoughArgumentsError(args.GetIsolate()); 4744 return; 4745 } 4746 TestObj* imp = V8TestObject::toNative(args.Holder()); 4747 V8TRYCATCH_VOID(double, head, static_cast<double>(args[0]->NumberValue())); 4748 V8TRYCATCH_VOID(Vector<double>, tail, toNativeArguments<double>(args, 1)); 4749 imp->variadicDoubleMethod(head, tail); 4750 4751 return; 4752 } 4753 4754 static void variadicDoubleMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 4755 { 4756 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 4757 TestObjV8Internal::variadicDoubleMethodMethod(args); 4758 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 4759 } 4760 4761 static void variadicNodeMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& args) 4762 { 4763 if (args.Length() < 1) { 4764 throwNotEnoughArgumentsError(args.GetIsolate()); 4765 return; 4766 } 4767 TestObj* imp = V8TestObject::toNative(args.Holder()); 4768 V8TRYCATCH_VOID(Node*, head, V8Node::HasInstance(args[0], args.GetIsolate(), worldType(args.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0); 4769 Vector<RefPtr<Node> > tail; 4770 for (int i = 1; i < args.Length(); ++i) { 4771 if (!V8Node::HasInstance(args[i], args.GetIsolate(), worldType(args.GetIsolate()))) { 4772 throwTypeError(args.GetIsolate()); 4773 return; 4774 } 4775 tail.append(V8Node::toNative(v8::Handle<v8::Object>::Cast(args[i]))); 4776 } 4777 imp->variadicNodeMethod(head, tail); 4778 4779 return; 4780 } 4781 4782 static void variadicNodeMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 4783 { 4784 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 4785 TestObjV8Internal::variadicNodeMethodMethod(args); 4786 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 4787 } 4788 4789 static void perWorldMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& args) 4790 { 4791 TestObj* imp = V8TestObject::toNative(args.Holder()); 4792 imp->perWorldMethod(); 4793 4794 return; 4795 } 4796 4797 static void perWorldMethodMethodForMainWorld(const v8::FunctionCallbackInfo<v8::Value>& args) 4798 { 4799 TestObj* imp = V8TestObject::toNative(args.Holder()); 4800 imp->perWorldMethod(); 4801 4802 return; 4803 } 4804 4805 static void perWorldMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 4806 { 4807 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 4808 TestObjV8Internal::perWorldMethodMethod(args); 4809 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 4810 } 4811 4812 static void perWorldMethodMethodCallbackForMainWorld(const v8::FunctionCallbackInfo<v8::Value>& args) 4813 { 4814 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 4815 TestObjV8Internal::perWorldMethodMethodForMainWorld(args); 4816 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 4817 } 4818 4819 static void overloadedPerWorldMethod1Method(const v8::FunctionCallbackInfo<v8::Value>& args) 4820 { 4821 if (args.Length() < 1) { 4822 throwNotEnoughArgumentsError(args.GetIsolate()); 4823 return; 4824 } 4825 TestObj* imp = V8TestObject::toNative(args.Holder()); 4826 V8TRYCATCH_VOID(int, longArg, toInt32(args[0])); 4827 imp->overloadedPerWorldMethod(longArg); 4828 4829 return; 4830 } 4831 4832 static void overloadedPerWorldMethod1MethodForMainWorld(const v8::FunctionCallbackInfo<v8::Value>& args) 4833 { 4834 if (args.Length() < 1) { 4835 throwNotEnoughArgumentsError(args.GetIsolate()); 4836 return; 4837 } 4838 TestObj* imp = V8TestObject::toNative(args.Holder()); 4839 V8TRYCATCH_VOID(int, longArg, toInt32(args[0])); 4840 imp->overloadedPerWorldMethod(longArg); 4841 4842 return; 4843 } 4844 4845 static void overloadedPerWorldMethod2Method(const v8::FunctionCallbackInfo<v8::Value>& args) 4846 { 4847 if (args.Length() < 2) { 4848 throwNotEnoughArgumentsError(args.GetIsolate()); 4849 return; 4850 } 4851 TestObj* imp = V8TestObject::toNative(args.Holder()); 4852 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, args[0]); 4853 V8TRYCATCH_VOID(int, longArg, toInt32(args[1])); 4854 imp->overloadedPerWorldMethod(strArg, longArg); 4855 4856 return; 4857 } 4858 4859 static void overloadedPerWorldMethod2MethodForMainWorld(const v8::FunctionCallbackInfo<v8::Value>& args) 4860 { 4861 if (args.Length() < 2) { 4862 throwNotEnoughArgumentsError(args.GetIsolate()); 4863 return; 4864 } 4865 TestObj* imp = V8TestObject::toNative(args.Holder()); 4866 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, args[0]); 4867 V8TRYCATCH_VOID(int, longArg, toInt32(args[1])); 4868 imp->overloadedPerWorldMethod(strArg, longArg); 4869 4870 return; 4871 } 4872 4873 static void overloadedPerWorldMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& args) 4874 { 4875 if (args.Length() == 1) { 4876 overloadedPerWorldMethod1Method(args); 4877 return; 4878 } 4879 if (args.Length() == 2) { 4880 overloadedPerWorldMethod2Method(args); 4881 return; 4882 } 4883 if (args.Length() < 1) { 4884 throwNotEnoughArgumentsError(args.GetIsolate()); 4885 return; 4886 } 4887 throwTypeError(args.GetIsolate()); 4888 } 4889 4890 static void overloadedPerWorldMethodMethodForMainWorld(const v8::FunctionCallbackInfo<v8::Value>& args) 4891 { 4892 if (args.Length() == 1) { 4893 overloadedPerWorldMethod1MethodForMainWorld(args); 4894 return; 4895 } 4896 if (args.Length() == 2) { 4897 overloadedPerWorldMethod2MethodForMainWorld(args); 4898 return; 4899 } 4900 if (args.Length() < 1) { 4901 throwNotEnoughArgumentsError(args.GetIsolate()); 4902 return; 4903 } 4904 throwTypeError(args.GetIsolate()); 4905 } 4906 4907 static void overloadedPerWorldMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 4908 { 4909 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 4910 TestObjV8Internal::overloadedPerWorldMethodMethod(args); 4911 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 4912 } 4913 4914 static void overloadedPerWorldMethodMethodCallbackForMainWorld(const v8::FunctionCallbackInfo<v8::Value>& args) 4915 { 4916 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 4917 TestObjV8Internal::overloadedPerWorldMethodMethodForMainWorld(args); 4918 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 4919 } 4920 4921 static void activityLoggedMethod1Method(const v8::FunctionCallbackInfo<v8::Value>& args) 4922 { 4923 if (args.Length() < 1) { 4924 throwNotEnoughArgumentsError(args.GetIsolate()); 4925 return; 4926 } 4927 TestObj* imp = V8TestObject::toNative(args.Holder()); 4928 V8TRYCATCH_VOID(int, longArg, toInt32(args[0])); 4929 imp->activityLoggedMethod1(longArg); 4930 4931 return; 4932 } 4933 4934 static void activityLoggedMethod1MethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 4935 { 4936 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 4937 V8PerContextData* contextData = V8PerContextData::from(args.GetIsolate()->GetCurrentContext()); 4938 if (contextData && contextData->activityLogger()) { 4939 Vector<v8::Handle<v8::Value> > loggerArgs = toVectorOfArguments(args); 4940 contextData->activityLogger()->log("TestObject.activityLoggedMethod1", args.Length(), loggerArgs.data(), "Method"); 4941 } 4942 TestObjV8Internal::activityLoggedMethod1Method(args); 4943 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 4944 } 4945 4946 static void activityLoggedMethod2Method(const v8::FunctionCallbackInfo<v8::Value>& args) 4947 { 4948 if (args.Length() < 1) { 4949 throwNotEnoughArgumentsError(args.GetIsolate()); 4950 return; 4951 } 4952 TestObj* imp = V8TestObject::toNative(args.Holder()); 4953 V8TRYCATCH_VOID(int, longArg, toInt32(args[0])); 4954 imp->activityLoggedMethod2(longArg); 4955 4956 return; 4957 } 4958 4959 static void activityLoggedMethod2MethodForMainWorld(const v8::FunctionCallbackInfo<v8::Value>& args) 4960 { 4961 if (args.Length() < 1) { 4962 throwNotEnoughArgumentsError(args.GetIsolate()); 4963 return; 4964 } 4965 TestObj* imp = V8TestObject::toNative(args.Holder()); 4966 V8TRYCATCH_VOID(int, longArg, toInt32(args[0])); 4967 imp->activityLoggedMethod2(longArg); 4968 4969 return; 4970 } 4971 4972 static void activityLoggedMethod2MethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 4973 { 4974 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 4975 V8PerContextData* contextData = V8PerContextData::from(args.GetIsolate()->GetCurrentContext()); 4976 if (contextData && contextData->activityLogger()) { 4977 Vector<v8::Handle<v8::Value> > loggerArgs = toVectorOfArguments(args); 4978 contextData->activityLogger()->log("TestObject.activityLoggedMethod2", args.Length(), loggerArgs.data(), "Method"); 4979 } 4980 TestObjV8Internal::activityLoggedMethod2Method(args); 4981 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 4982 } 4983 4984 static void activityLoggedMethod2MethodCallbackForMainWorld(const v8::FunctionCallbackInfo<v8::Value>& args) 4985 { 4986 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 4987 V8PerContextData* contextData = V8PerContextData::from(args.GetIsolate()->GetCurrentContext()); 4988 if (contextData && contextData->activityLogger()) { 4989 Vector<v8::Handle<v8::Value> > loggerArgs = toVectorOfArguments(args); 4990 contextData->activityLogger()->log("TestObject.activityLoggedMethod2", args.Length(), loggerArgs.data(), "Method"); 4991 } 4992 TestObjV8Internal::activityLoggedMethod2MethodForMainWorld(args); 4993 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 4994 } 4995 4996 static void activityLoggedInIsolatedWorldMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& args) 4997 { 4998 if (args.Length() < 1) { 4999 throwNotEnoughArgumentsError(args.GetIsolate()); 5000 return; 5001 } 5002 TestObj* imp = V8TestObject::toNative(args.Holder()); 5003 V8TRYCATCH_VOID(int, longArg, toInt32(args[0])); 5004 imp->activityLoggedInIsolatedWorldMethod(longArg); 5005 5006 return; 5007 } 5008 5009 static void activityLoggedInIsolatedWorldMethodMethodForMainWorld(const v8::FunctionCallbackInfo<v8::Value>& args) 5010 { 5011 if (args.Length() < 1) { 5012 throwNotEnoughArgumentsError(args.GetIsolate()); 5013 return; 5014 } 5015 TestObj* imp = V8TestObject::toNative(args.Holder()); 5016 V8TRYCATCH_VOID(int, longArg, toInt32(args[0])); 5017 imp->activityLoggedInIsolatedWorldMethod(longArg); 5018 5019 return; 5020 } 5021 5022 static void activityLoggedInIsolatedWorldMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 5023 { 5024 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 5025 V8PerContextData* contextData = V8PerContextData::from(args.GetIsolate()->GetCurrentContext()); 5026 if (contextData && contextData->activityLogger()) { 5027 Vector<v8::Handle<v8::Value> > loggerArgs = toVectorOfArguments(args); 5028 contextData->activityLogger()->log("TestObject.activityLoggedInIsolatedWorldMethod", args.Length(), loggerArgs.data(), "Method"); 5029 } 5030 TestObjV8Internal::activityLoggedInIsolatedWorldMethodMethod(args); 5031 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 5032 } 5033 5034 static void activityLoggedInIsolatedWorldMethodMethodCallbackForMainWorld(const v8::FunctionCallbackInfo<v8::Value>& args) 5035 { 5036 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 5037 TestObjV8Internal::activityLoggedInIsolatedWorldMethodMethodForMainWorld(args); 5038 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 5039 } 5040 5041 static void overloadedActivityLoggedMethod1Method(const v8::FunctionCallbackInfo<v8::Value>& args) 5042 { 5043 if (args.Length() < 1) { 5044 throwNotEnoughArgumentsError(args.GetIsolate()); 5045 return; 5046 } 5047 TestObj* imp = V8TestObject::toNative(args.Holder()); 5048 V8TRYCATCH_VOID(int, longArg, toInt32(args[0])); 5049 imp->overloadedActivityLoggedMethod(longArg); 5050 5051 return; 5052 } 5053 5054 static void overloadedActivityLoggedMethod1MethodForMainWorld(const v8::FunctionCallbackInfo<v8::Value>& args) 5055 { 5056 if (args.Length() < 1) { 5057 throwNotEnoughArgumentsError(args.GetIsolate()); 5058 return; 5059 } 5060 TestObj* imp = V8TestObject::toNative(args.Holder()); 5061 V8TRYCATCH_VOID(int, longArg, toInt32(args[0])); 5062 imp->overloadedActivityLoggedMethod(longArg); 5063 5064 return; 5065 } 5066 5067 static void overloadedActivityLoggedMethod2Method(const v8::FunctionCallbackInfo<v8::Value>& args) 5068 { 5069 if (args.Length() < 2) { 5070 throwNotEnoughArgumentsError(args.GetIsolate()); 5071 return; 5072 } 5073 TestObj* imp = V8TestObject::toNative(args.Holder()); 5074 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, args[0]); 5075 V8TRYCATCH_VOID(int, longArg, toInt32(args[1])); 5076 imp->overloadedActivityLoggedMethod(strArg, longArg); 5077 5078 return; 5079 } 5080 5081 static void overloadedActivityLoggedMethod2MethodForMainWorld(const v8::FunctionCallbackInfo<v8::Value>& args) 5082 { 5083 if (args.Length() < 2) { 5084 throwNotEnoughArgumentsError(args.GetIsolate()); 5085 return; 5086 } 5087 TestObj* imp = V8TestObject::toNative(args.Holder()); 5088 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, args[0]); 5089 V8TRYCATCH_VOID(int, longArg, toInt32(args[1])); 5090 imp->overloadedActivityLoggedMethod(strArg, longArg); 5091 5092 return; 5093 } 5094 5095 static void overloadedActivityLoggedMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& args) 5096 { 5097 if (args.Length() == 1) { 5098 overloadedActivityLoggedMethod1Method(args); 5099 return; 5100 } 5101 if (args.Length() == 2) { 5102 overloadedActivityLoggedMethod2Method(args); 5103 return; 5104 } 5105 if (args.Length() < 1) { 5106 throwNotEnoughArgumentsError(args.GetIsolate()); 5107 return; 5108 } 5109 throwTypeError(args.GetIsolate()); 5110 } 5111 5112 static void overloadedActivityLoggedMethodMethodForMainWorld(const v8::FunctionCallbackInfo<v8::Value>& args) 5113 { 5114 if (args.Length() == 1) { 5115 overloadedActivityLoggedMethod1MethodForMainWorld(args); 5116 return; 5117 } 5118 if (args.Length() == 2) { 5119 overloadedActivityLoggedMethod2MethodForMainWorld(args); 5120 return; 5121 } 5122 if (args.Length() < 1) { 5123 throwNotEnoughArgumentsError(args.GetIsolate()); 5124 return; 5125 } 5126 throwTypeError(args.GetIsolate()); 5127 } 5128 5129 static void overloadedActivityLoggedMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 5130 { 5131 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 5132 V8PerContextData* contextData = V8PerContextData::from(args.GetIsolate()->GetCurrentContext()); 5133 if (contextData && contextData->activityLogger()) { 5134 Vector<v8::Handle<v8::Value> > loggerArgs = toVectorOfArguments(args); 5135 contextData->activityLogger()->log("TestObject.overloadedActivityLoggedMethod", args.Length(), loggerArgs.data(), "Method"); 5136 } 5137 TestObjV8Internal::overloadedActivityLoggedMethodMethod(args); 5138 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 5139 } 5140 5141 static void overloadedActivityLoggedMethodMethodCallbackForMainWorld(const v8::FunctionCallbackInfo<v8::Value>& args) 5142 { 5143 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 5144 V8PerContextData* contextData = V8PerContextData::from(args.GetIsolate()->GetCurrentContext()); 5145 if (contextData && contextData->activityLogger()) { 5146 Vector<v8::Handle<v8::Value> > loggerArgs = toVectorOfArguments(args); 5147 contextData->activityLogger()->log("TestObject.overloadedActivityLoggedMethod", args.Length(), loggerArgs.data(), "Method"); 5148 } 5149 TestObjV8Internal::overloadedActivityLoggedMethodMethodForMainWorld(args); 5150 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 5151 } 5152 5153 static void deprecatedMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& args) 5154 { 5155 TestObj* imp = V8TestObject::toNative(args.Holder()); 5156 imp->deprecatedMethod(); 5157 5158 return; 5159 } 5160 5161 static void deprecatedMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 5162 { 5163 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 5164 UseCounter::countDeprecation(activeDOMWindow(), UseCounter::Method); 5165 TestObjV8Internal::deprecatedMethodMethod(args); 5166 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 5167 } 5168 5169 static void deprecatedStaticMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& args) 5170 { 5171 TestObj::deprecatedStaticMethod(); 5172 5173 return; 5174 } 5175 5176 static void deprecatedStaticMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 5177 { 5178 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 5179 UseCounter::countDeprecation(activeDOMWindow(), UseCounter::StaticMethod); 5180 TestObjV8Internal::deprecatedStaticMethodMethod(args); 5181 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 5182 } 5183 5184 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& args) 5185 { 5186 if (args.Length() < 1) { 5187 throwNotEnoughArgumentsError(args.GetIsolate()); 5188 return; 5189 } 5190 if (args.Length() <= 0 || !args[0]->IsFunction()) { 5191 throwTypeError(args.GetIsolate()); 5192 return; 5193 } 5194 RefPtr<TestCallback> testCallback = V8TestCallback::create(args[0], getScriptExecutionContext()); 5195 5196 RefPtr<TestObj> impl = TestObj::create(testCallback); 5197 v8::Handle<v8::Object> wrapper = args.Holder(); 5198 5199 V8DOMWrapper::associateObjectWithWrapper<V8TestObject>(impl.release(), &V8TestObject::info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent); 5200 args.GetReturnValue().Set(wrapper); 5201 } 5202 5203 static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& info) 5204 { 5205 ASSERT(V8DOMWrapper::maybeDOMWrapper(info.Holder())); 5206 TestObj* collection = V8TestObject::toNative(info.Holder()); 5207 RefPtr<Node> element = collection->item(index); 5208 if (!element) 5209 return; 5210 v8SetReturnValue(info, toV8Fast(element.release(), info, collection)); 5211 } 5212 5213 static void indexedPropertyGetterCallback(uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& info) 5214 { 5215 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty"); 5216 TestObjV8Internal::indexedPropertyGetter(index, info); 5217 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 5218 } 5219 5220 static void namedPropertyGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 5221 { 5222 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty()) 5223 return; 5224 if (info.Holder()->HasRealNamedCallbackProperty(name)) 5225 return; 5226 if (info.Holder()->HasRealNamedProperty(name)) 5227 return; 5228 5229 ASSERT(V8DOMWrapper::maybeDOMWrapper(info.Holder())); 5230 TestObj* collection = V8TestObject::toNative(info.Holder()); 5231 AtomicString propertyName = toWebCoreAtomicString(name); 5232 String element = collection->namedItem(propertyName); 5233 if (element.isNull()) 5234 return; 5235 v8SetReturnValueString(info, element, info.GetIsolate()); 5236 } 5237 5238 static void namedPropertyGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 5239 { 5240 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); 5241 TestObjV8Internal::namedPropertyGetter(name, info); 5242 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 5243 } 5244 5245 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& info) 5246 { 5247 ExceptionState es(info.GetIsolate()); 5248 TestObj* collection = V8TestObject::toNative(info.Holder()); 5249 Vector<String> names; 5250 collection->namedPropertyEnumerator(names, es); 5251 if (es.throwIfNeeded()) 5252 return; 5253 v8::Handle<v8::Array> v8names = v8::Array::New(names.size()); 5254 for (size_t i = 0; i < names.size(); ++i) 5255 v8names->Set(v8::Integer::New(i, info.GetIsolate()), v8String(names[i], info.GetIsolate())); 5256 v8SetReturnValue(info, v8names); 5257 } 5258 5259 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Integer>& info) 5260 { 5261 TestObj* collection = V8TestObject::toNative(info.Holder()); 5262 AtomicString propertyName = toWebCoreAtomicString(name); 5263 ExceptionState es(info.GetIsolate()); 5264 bool result = collection->namedPropertyQuery(propertyName, es); 5265 if (es.throwIfNeeded()) 5266 return; 5267 if (!result) 5268 return; 5269 v8SetReturnValueInt(info, v8::None); 5270 } 5271 5272 static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::Array>& info) 5273 { 5274 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); 5275 TestObjV8Internal::namedPropertyEnumerator(info); 5276 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 5277 } 5278 5279 static void namedPropertyQueryCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Integer>& info) 5280 { 5281 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); 5282 TestObjV8Internal::namedPropertyQuery(name, info); 5283 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 5284 } 5285 5286 } // namespace TestObjV8Internal 5287 5288 static const V8DOMConfiguration::BatchedAttribute V8TestObjectAttrs[] = { 5289 // Attribute 'readOnlyLongAttr' 5290 {"readOnlyLongAttr", TestObjV8Internal::readOnlyLongAttrAttrGetterCallback, 0, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5291 // Attribute 'readOnlyStringAttr' 5292 {"readOnlyStringAttr", TestObjV8Internal::readOnlyStringAttrAttrGetterCallback, 0, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5293 // Attribute 'readOnlyTestObjectAttr' 5294 {"readOnlyTestObjectAttr", TestObjV8Internal::readOnlyTestObjectAttrAttrGetterCallback, 0, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5295 // Attribute 'staticReadOnlyLongAttr' 5296 {"staticReadOnlyLongAttr", TestObjV8Internal::staticReadOnlyLongAttrAttrGetterCallback, 0, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5297 // Attribute 'staticStringAttr' 5298 {"staticStringAttr", TestObjV8Internal::staticStringAttrAttrGetterCallback, TestObjV8Internal::staticStringAttrAttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5299 // Attribute 'TestSubObj' 5300 {"TestSubObj", TestObjV8Internal::TestObjConstructorGetter, 0, 0, 0, &V8TestSubObj::info, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None | v8::DontEnum), 0 /* on instance */}, 5301 // Attribute 'enumAttr' 5302 {"enumAttr", TestObjV8Internal::enumAttrAttrGetterCallback, TestObjV8Internal::enumAttrAttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5303 // Attribute 'readOnlyEnumAttr' 5304 {"readOnlyEnumAttr", TestObjV8Internal::readOnlyEnumAttrAttrGetterCallback, 0, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5305 // Attribute 'byteAttr' 5306 {"byteAttr", TestObjV8Internal::byteAttrAttrGetterCallback, TestObjV8Internal::byteAttrAttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5307 // Attribute 'octetAttr' 5308 {"octetAttr", TestObjV8Internal::octetAttrAttrGetterCallback, TestObjV8Internal::octetAttrAttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5309 // Attribute 'shortAttr' 5310 {"shortAttr", TestObjV8Internal::shortAttrAttrGetterCallback, TestObjV8Internal::shortAttrAttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5311 // Attribute 'unsignedShortAttr' 5312 {"unsignedShortAttr", TestObjV8Internal::unsignedShortAttrAttrGetterCallback, TestObjV8Internal::unsignedShortAttrAttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5313 // Attribute 'longAttr' 5314 {"longAttr", TestObjV8Internal::longAttrAttrGetterCallback, TestObjV8Internal::longAttrAttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5315 // Attribute 'longLongAttr' 5316 {"longLongAttr", TestObjV8Internal::longLongAttrAttrGetterCallback, TestObjV8Internal::longLongAttrAttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5317 // Attribute 'unsignedLongLongAttr' 5318 {"unsignedLongLongAttr", TestObjV8Internal::unsignedLongLongAttrAttrGetterCallback, TestObjV8Internal::unsignedLongLongAttrAttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5319 // Attribute 'stringAttr' 5320 {"stringAttr", TestObjV8Internal::stringAttrAttrGetterCallback, TestObjV8Internal::stringAttrAttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5321 // Attribute 'eventHandlerAttr' 5322 {"eventHandlerAttr", TestObjV8Internal::eventHandlerAttrAttrGetterCallback, TestObjV8Internal::eventHandlerAttrAttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5323 // Attribute 'testObjAttr' 5324 {"testObjAttr", TestObjV8Internal::testObjAttrAttrGetterCallback, TestObjV8Internal::testObjAttrAttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5325 // Attribute 'XMLObjAttr' 5326 {"XMLObjAttr", TestObjV8Internal::XMLObjAttrAttrGetterCallback, TestObjV8Internal::XMLObjAttrAttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5327 // Attribute 'create' 5328 {"create", TestObjV8Internal::createAttrGetterCallback, TestObjV8Internal::createAttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5329 // Attribute 'reflectedStringAttr' 5330 {"reflectedStringAttr", TestObjV8Internal::reflectedStringAttrAttrGetterCallback, TestObjV8Internal::reflectedStringAttrAttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5331 // Attribute 'reflectedIntegralAttr' 5332 {"reflectedIntegralAttr", TestObjV8Internal::reflectedIntegralAttrAttrGetterCallback, TestObjV8Internal::reflectedIntegralAttrAttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5333 // Attribute 'reflectedUnsignedIntegralAttr' 5334 {"reflectedUnsignedIntegralAttr", TestObjV8Internal::reflectedUnsignedIntegralAttrAttrGetterCallback, TestObjV8Internal::reflectedUnsignedIntegralAttrAttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5335 // Attribute 'reflectedBooleanAttr' 5336 {"reflectedBooleanAttr", TestObjV8Internal::reflectedBooleanAttrAttrGetterCallback, TestObjV8Internal::reflectedBooleanAttrAttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5337 // Attribute 'reflectedURLAttr' 5338 {"reflectedURLAttr", TestObjV8Internal::reflectedURLAttrAttrGetterCallback, TestObjV8Internal::reflectedURLAttrAttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5339 // Attribute 'reflectedStringAttr' 5340 {"reflectedStringAttr", TestObjV8Internal::reflectedStringAttrAttrGetterCallback, TestObjV8Internal::reflectedStringAttrAttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5341 // Attribute 'reflectedCustomIntegralAttr' 5342 {"reflectedCustomIntegralAttr", TestObjV8Internal::reflectedCustomIntegralAttrAttrGetterCallback, TestObjV8Internal::reflectedCustomIntegralAttrAttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5343 // Attribute 'reflectedCustomBooleanAttr' 5344 {"reflectedCustomBooleanAttr", TestObjV8Internal::reflectedCustomBooleanAttrAttrGetterCallback, TestObjV8Internal::reflectedCustomBooleanAttrAttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5345 // Attribute 'reflectedCustomURLAttr' 5346 {"reflectedCustomURLAttr", TestObjV8Internal::reflectedCustomURLAttrAttrGetterCallback, TestObjV8Internal::reflectedCustomURLAttrAttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5347 // Attribute 'typedArrayAttr' 5348 {"typedArrayAttr", TestObjV8Internal::typedArrayAttrAttrGetterCallback, TestObjV8Internal::typedArrayAttrAttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5349 // Attribute 'attrWithGetterException' 5350 {"attrWithGetterException", TestObjV8Internal::attrWithGetterExceptionAttrGetterCallback, TestObjV8Internal::attrWithGetterExceptionAttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5351 // Attribute 'attrWithSetterException' 5352 {"attrWithSetterException", TestObjV8Internal::attrWithSetterExceptionAttrGetterCallback, TestObjV8Internal::attrWithSetterExceptionAttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5353 // Attribute 'stringAttrWithGetterException' 5354 {"stringAttrWithGetterException", TestObjV8Internal::stringAttrWithGetterExceptionAttrGetterCallback, TestObjV8Internal::stringAttrWithGetterExceptionAttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5355 // Attribute 'stringAttrWithSetterException' 5356 {"stringAttrWithSetterException", TestObjV8Internal::stringAttrWithSetterExceptionAttrGetterCallback, TestObjV8Internal::stringAttrWithSetterExceptionAttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5357 // Attribute 'customAttr' 5358 {"customAttr", TestObjV8Internal::customAttrAttrGetterCallback, TestObjV8Internal::customAttrAttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5359 // Attribute 'withScriptStateAttribute' 5360 {"withScriptStateAttribute", TestObjV8Internal::withScriptStateAttributeAttrGetterCallback, TestObjV8Internal::withScriptStateAttributeAttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5361 // Attribute 'withScriptExecutionContextAttribute' 5362 {"withScriptExecutionContextAttribute", TestObjV8Internal::withScriptExecutionContextAttributeAttrGetterCallback, TestObjV8Internal::withScriptExecutionContextAttributeAttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5363 // Attribute 'withActiveWindowAndFirstWindowAttribute' 5364 {"withActiveWindowAndFirstWindowAttribute", TestObjV8Internal::withActiveWindowAndFirstWindowAttributeAttrGetterCallback, TestObjV8Internal::withActiveWindowAndFirstWindowAttributeAttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5365 // Attribute 'withScriptStateAttributeRaises' 5366 {"withScriptStateAttributeRaises", TestObjV8Internal::withScriptStateAttributeRaisesAttrGetterCallback, TestObjV8Internal::withScriptStateAttributeRaisesAttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5367 // Attribute 'withScriptExecutionContextAttributeRaises' 5368 {"withScriptExecutionContextAttributeRaises", TestObjV8Internal::withScriptExecutionContextAttributeRaisesAttrGetterCallback, TestObjV8Internal::withScriptExecutionContextAttributeRaisesAttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5369 // Attribute 'withScriptExecutionContextAndScriptStateAttribute' 5370 {"withScriptExecutionContextAndScriptStateAttribute", TestObjV8Internal::withScriptExecutionContextAndScriptStateAttributeAttrGetterCallback, TestObjV8Internal::withScriptExecutionContextAndScriptStateAttributeAttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5371 // Attribute 'withScriptExecutionContextAndScriptStateAttributeRaises' 5372 {"withScriptExecutionContextAndScriptStateAttributeRaises", TestObjV8Internal::withScriptExecutionContextAndScriptStateAttributeRaisesAttrGetterCallback, TestObjV8Internal::withScriptExecutionContextAndScriptStateAttributeRaisesAttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5373 // Attribute 'withScriptExecutionContextAndScriptStateWithSpacesAttribute' 5374 {"withScriptExecutionContextAndScriptStateWithSpacesAttribute", TestObjV8Internal::withScriptExecutionContextAndScriptStateWithSpacesAttributeAttrGetterCallback, TestObjV8Internal::withScriptExecutionContextAndScriptStateWithSpacesAttributeAttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5375 // Attribute 'enforcedRangeByteAttr' 5376 {"enforcedRangeByteAttr", TestObjV8Internal::enforcedRangeByteAttrAttrGetterCallback, TestObjV8Internal::enforcedRangeByteAttrAttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5377 // Attribute 'enforcedRangeOctetAttr' 5378 {"enforcedRangeOctetAttr", TestObjV8Internal::enforcedRangeOctetAttrAttrGetterCallback, TestObjV8Internal::enforcedRangeOctetAttrAttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5379 // Attribute 'enforcedRangeLongAttr' 5380 {"enforcedRangeLongAttr", TestObjV8Internal::enforcedRangeLongAttrAttrGetterCallback, TestObjV8Internal::enforcedRangeLongAttrAttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5381 // Attribute 'enforcedRangeUnsignedLongAttr' 5382 {"enforcedRangeUnsignedLongAttr", TestObjV8Internal::enforcedRangeUnsignedLongAttrAttrGetterCallback, TestObjV8Internal::enforcedRangeUnsignedLongAttrAttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5383 // Attribute 'enforcedRangeLongLongAttr' 5384 {"enforcedRangeLongLongAttr", TestObjV8Internal::enforcedRangeLongLongAttrAttrGetterCallback, TestObjV8Internal::enforcedRangeLongLongAttrAttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5385 // Attribute 'enforcedRangeUnsignedLongLongAttr' 5386 {"enforcedRangeUnsignedLongLongAttr", TestObjV8Internal::enforcedRangeUnsignedLongLongAttrAttrGetterCallback, TestObjV8Internal::enforcedRangeUnsignedLongLongAttrAttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5387 #if ENABLE(Condition1) 5388 // Attribute 'conditionalAttr1' 5389 {"conditionalAttr1", TestObjV8Internal::conditionalAttr1AttrGetterCallback, TestObjV8Internal::conditionalAttr1AttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5390 #endif // ENABLE(Condition1) 5391 #if ENABLE(Condition1) && ENABLE(Condition2) 5392 // Attribute 'conditionalAttr2' 5393 {"conditionalAttr2", TestObjV8Internal::conditionalAttr2AttrGetterCallback, TestObjV8Internal::conditionalAttr2AttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5394 #endif // ENABLE(Condition1) && ENABLE(Condition2) 5395 #if ENABLE(Condition1) || ENABLE(Condition2) 5396 // Attribute 'conditionalAttr3' 5397 {"conditionalAttr3", TestObjV8Internal::conditionalAttr3AttrGetterCallback, TestObjV8Internal::conditionalAttr3AttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5398 #endif // ENABLE(Condition1) || ENABLE(Condition2) 5399 #if ENABLE(Condition1) 5400 // Attribute 'conditionalAttr4' 5401 {"conditionalAttr4", TestObjV8Internal::TestObjConstructorGetter, TestObjV8Internal::TestObjReplaceableAttrSetterCallback, 0, 0, &V8TestObjectectA::info, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None | v8::DontEnum), 0 /* on instance */}, 5402 #endif // ENABLE(Condition1) 5403 #if ENABLE(Condition1) && ENABLE(Condition2) 5404 // Attribute 'conditionalAttr5' 5405 {"conditionalAttr5", TestObjV8Internal::TestObjConstructorGetter, TestObjV8Internal::TestObjReplaceableAttrSetterCallback, 0, 0, &V8TestObjectectB::info, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None | v8::DontEnum), 0 /* on instance */}, 5406 #endif // ENABLE(Condition1) && ENABLE(Condition2) 5407 #if ENABLE(Condition1) || ENABLE(Condition2) 5408 // Attribute 'conditionalAttr6' 5409 {"conditionalAttr6", TestObjV8Internal::TestObjConstructorGetter, TestObjV8Internal::TestObjReplaceableAttrSetterCallback, 0, 0, &V8TestObjectectC::info, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None | v8::DontEnum), 0 /* on instance */}, 5410 #endif // ENABLE(Condition1) || ENABLE(Condition2) 5411 // Attribute 'cachedAttribute1' 5412 {"cachedAttribute1", TestObjV8Internal::cachedAttribute1AttrGetterCallback, 0, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5413 // Attribute 'cachedAttribute2' 5414 {"cachedAttribute2", TestObjV8Internal::cachedAttribute2AttrGetterCallback, 0, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5415 // Attribute 'anyAttribute' 5416 {"anyAttribute", TestObjV8Internal::anyAttributeAttrGetterCallback, TestObjV8Internal::anyAttributeAttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5417 // Attribute 'callbackFunctionAttribute' 5418 {"callbackFunctionAttribute", TestObjV8Internal::callbackFunctionAttributeAttrGetterCallback, TestObjV8Internal::callbackFunctionAttributeAttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5419 // Attribute 'floatArray' 5420 {"floatArray", TestObjV8Internal::floatArrayAttrGetterCallback, TestObjV8Internal::floatArrayAttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5421 // Attribute 'doubleArray' 5422 {"doubleArray", TestObjV8Internal::doubleArrayAttrGetterCallback, TestObjV8Internal::doubleArrayAttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5423 // Attribute 'messagePortArray' 5424 {"messagePortArray", TestObjV8Internal::messagePortArrayAttrGetterCallback, TestObjV8Internal::messagePortArrayAttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5425 // Attribute 'contentDocument' 5426 {"contentDocument", TestObjV8Internal::contentDocumentAttrGetterCallback, 0, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5427 // Attribute 'mutablePoint' 5428 {"mutablePoint", TestObjV8Internal::mutablePointAttrGetterCallback, TestObjV8Internal::mutablePointAttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5429 // Attribute 'immutablePoint' 5430 {"immutablePoint", TestObjV8Internal::immutablePointAttrGetterCallback, TestObjV8Internal::immutablePointAttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5431 // Attribute 'strawberry' 5432 {"strawberry", TestObjV8Internal::strawberryAttrGetterCallback, TestObjV8Internal::strawberryAttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5433 // Attribute 'strictFloat' 5434 {"strictFloat", TestObjV8Internal::strictFloatAttrGetterCallback, TestObjV8Internal::strictFloatAttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5435 // Attribute 'description' 5436 {"description", TestObjV8Internal::descriptionAttrGetterCallback, 0, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5437 // Attribute 'id' 5438 {"id", TestObjV8Internal::idAttrGetterCallback, TestObjV8Internal::idAttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5439 // Attribute 'hash' 5440 {"hash", TestObjV8Internal::hashAttrGetterCallback, 0, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5441 // Attribute 'replaceableAttribute' 5442 {"replaceableAttribute", TestObjV8Internal::replaceableAttributeAttrGetterCallback, TestObjV8Internal::TestObjReplaceableAttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5443 // Attribute 'nullableDoubleAttribute' 5444 {"nullableDoubleAttribute", TestObjV8Internal::nullableDoubleAttributeAttrGetterCallback, 0, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5445 // Attribute 'nullableLongAttribute' 5446 {"nullableLongAttribute", TestObjV8Internal::nullableLongAttributeAttrGetterCallback, 0, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5447 // Attribute 'nullableBooleanAttribute' 5448 {"nullableBooleanAttribute", TestObjV8Internal::nullableBooleanAttributeAttrGetterCallback, 0, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5449 // Attribute 'nullableStringAttribute' 5450 {"nullableStringAttribute", TestObjV8Internal::nullableStringAttributeAttrGetterCallback, 0, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5451 // Attribute 'nullableLongSettableAttribute' 5452 {"nullableLongSettableAttribute", TestObjV8Internal::nullableLongSettableAttributeAttrGetterCallback, TestObjV8Internal::nullableLongSettableAttributeAttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5453 // Attribute 'nullableStringValue' 5454 {"nullableStringValue", TestObjV8Internal::nullableStringValueAttrGetterCallback, TestObjV8Internal::nullableStringValueAttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5455 // Attribute 'perWorldReadOnlyAttribute' 5456 {"perWorldReadOnlyAttribute", TestObjV8Internal::perWorldReadOnlyAttributeAttrGetterCallback, 0, TestObjV8Internal::perWorldReadOnlyAttributeAttrGetterCallbackForMainWorld, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5457 // Attribute 'perWorldAttribute' 5458 {"perWorldAttribute", TestObjV8Internal::perWorldAttributeAttrGetterCallback, TestObjV8Internal::perWorldAttributeAttrSetterCallback, TestObjV8Internal::perWorldAttributeAttrGetterCallbackForMainWorld, TestObjV8Internal::perWorldAttributeAttrSetterCallbackForMainWorld, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5459 // Attribute 'activityLoggedAttr1' 5460 {"activityLoggedAttr1", TestObjV8Internal::activityLoggedAttr1AttrGetterCallback, TestObjV8Internal::activityLoggedAttr1AttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5461 // Attribute 'activityLoggedAttr2' 5462 {"activityLoggedAttr2", TestObjV8Internal::activityLoggedAttr2AttrGetterCallback, TestObjV8Internal::activityLoggedAttr2AttrSetterCallback, TestObjV8Internal::activityLoggedAttr2AttrGetterCallbackForMainWorld, TestObjV8Internal::activityLoggedAttr2AttrSetterCallbackForMainWorld, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5463 // Attribute 'activityLoggedInIsolatedWorldsAttr' 5464 {"activityLoggedInIsolatedWorldsAttr", TestObjV8Internal::activityLoggedInIsolatedWorldsAttrAttrGetterCallback, TestObjV8Internal::activityLoggedInIsolatedWorldsAttrAttrSetterCallback, TestObjV8Internal::activityLoggedInIsolatedWorldsAttrAttrGetterCallbackForMainWorld, TestObjV8Internal::activityLoggedInIsolatedWorldsAttrAttrSetterCallbackForMainWorld, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5465 // Attribute 'activityLoggedAttrSetter1' 5466 {"activityLoggedAttrSetter1", TestObjV8Internal::activityLoggedAttrSetter1AttrGetterCallback, TestObjV8Internal::activityLoggedAttrSetter1AttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5467 // Attribute 'activityLoggedAttrSetter2' 5468 {"activityLoggedAttrSetter2", TestObjV8Internal::activityLoggedAttrSetter2AttrGetterCallback, TestObjV8Internal::activityLoggedAttrSetter2AttrSetterCallback, TestObjV8Internal::activityLoggedAttrSetter2AttrGetterCallbackForMainWorld, TestObjV8Internal::activityLoggedAttrSetter2AttrSetterCallbackForMainWorld, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5469 // Attribute 'activityLoggedInIsolatedWorldsAttrSetter' 5470 {"activityLoggedInIsolatedWorldsAttrSetter", TestObjV8Internal::activityLoggedInIsolatedWorldsAttrSetterAttrGetterCallback, TestObjV8Internal::activityLoggedInIsolatedWorldsAttrSetterAttrSetterCallback, TestObjV8Internal::activityLoggedInIsolatedWorldsAttrSetterAttrGetterCallbackForMainWorld, TestObjV8Internal::activityLoggedInIsolatedWorldsAttrSetterAttrSetterCallbackForMainWorld, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5471 // Attribute 'activityLoggedAttrGetter1' 5472 {"activityLoggedAttrGetter1", TestObjV8Internal::activityLoggedAttrGetter1AttrGetterCallback, TestObjV8Internal::activityLoggedAttrGetter1AttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5473 // Attribute 'activityLoggedAttrGetter2' 5474 {"activityLoggedAttrGetter2", TestObjV8Internal::activityLoggedAttrGetter2AttrGetterCallback, TestObjV8Internal::activityLoggedAttrGetter2AttrSetterCallback, TestObjV8Internal::activityLoggedAttrGetter2AttrGetterCallbackForMainWorld, TestObjV8Internal::activityLoggedAttrGetter2AttrSetterCallbackForMainWorld, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5475 // Attribute 'activityLoggedInIsolatedWorldsAttrGetter' 5476 {"activityLoggedInIsolatedWorldsAttrGetter", TestObjV8Internal::activityLoggedInIsolatedWorldsAttrGetterAttrGetterCallback, TestObjV8Internal::activityLoggedInIsolatedWorldsAttrGetterAttrSetterCallback, TestObjV8Internal::activityLoggedInIsolatedWorldsAttrGetterAttrGetterCallbackForMainWorld, TestObjV8Internal::activityLoggedInIsolatedWorldsAttrGetterAttrSetterCallbackForMainWorld, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5477 // Attribute 'deprecatedStaticReadOnlyAttr' 5478 {"deprecatedStaticReadOnlyAttr", TestObjV8Internal::deprecatedStaticReadOnlyAttrAttrGetterCallback, 0, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5479 // Attribute 'deprecatedStaticAttr' 5480 {"deprecatedStaticAttr", TestObjV8Internal::deprecatedStaticAttrAttrGetterCallback, TestObjV8Internal::deprecatedStaticAttrAttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5481 // Attribute 'deprecatedReadonlyAttr' 5482 {"deprecatedReadonlyAttr", TestObjV8Internal::deprecatedReadonlyAttrAttrGetterCallback, 0, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5483 // Attribute 'deprecatedAttr' 5484 {"deprecatedAttr", TestObjV8Internal::deprecatedAttrAttrGetterCallback, TestObjV8Internal::deprecatedAttrAttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 5485 }; 5486 5487 static const V8DOMConfiguration::BatchedMethod V8TestObjectMethods[] = { 5488 {"voidMethod", TestObjV8Internal::voidMethodMethodCallback, 0, 0}, 5489 {"longMethod", TestObjV8Internal::longMethodMethodCallback, 0, 0}, 5490 {"objMethod", TestObjV8Internal::objMethodMethodCallback, 0, 0}, 5491 {"methodWithSequenceArg", TestObjV8Internal::methodWithSequenceArgMethodCallback, 0, 1}, 5492 {"methodReturningSequence", TestObjV8Internal::methodReturningSequenceMethodCallback, 0, 1}, 5493 {"methodWithEnumArg", TestObjV8Internal::methodWithEnumArgMethodCallback, 0, 1}, 5494 {"serializedValue", TestObjV8Internal::serializedValueMethodCallback, 0, 1}, 5495 {"optionsObject", TestObjV8Internal::optionsObjectMethodCallback, 0, 1}, 5496 {"methodWithException", TestObjV8Internal::methodWithExceptionMethodCallback, 0, 0}, 5497 {"customMethod", TestObjV8Internal::customMethodMethodCallback, 0, 0}, 5498 {"customMethodWithArgs", TestObjV8Internal::customMethodWithArgsMethodCallback, 0, 3}, 5499 {"addEventListener", TestObjV8Internal::addEventListenerMethodCallback, 0, 2}, 5500 {"removeEventListener", TestObjV8Internal::removeEventListenerMethodCallback, 0, 2}, 5501 {"withScriptStateVoid", TestObjV8Internal::withScriptStateVoidMethodCallback, 0, 0}, 5502 {"withScriptStateObj", TestObjV8Internal::withScriptStateObjMethodCallback, 0, 0}, 5503 {"withScriptStateVoidException", TestObjV8Internal::withScriptStateVoidExceptionMethodCallback, 0, 0}, 5504 {"withScriptStateObjException", TestObjV8Internal::withScriptStateObjExceptionMethodCallback, 0, 0}, 5505 {"withScriptExecutionContext", TestObjV8Internal::withScriptExecutionContextMethodCallback, 0, 0}, 5506 {"withScriptExecutionContextAndScriptState", TestObjV8Internal::withScriptExecutionContextAndScriptStateMethodCallback, 0, 0}, 5507 {"withScriptExecutionContextAndScriptStateObjException", TestObjV8Internal::withScriptExecutionContextAndScriptStateObjExceptionMethodCallback, 0, 0}, 5508 {"withScriptExecutionContextAndScriptStateWithSpaces", TestObjV8Internal::withScriptExecutionContextAndScriptStateWithSpacesMethodCallback, 0, 0}, 5509 {"withActiveWindowAndFirstWindow", TestObjV8Internal::withActiveWindowAndFirstWindowMethodCallback, 0, 0}, 5510 {"methodWithOptionalArg", TestObjV8Internal::methodWithOptionalArgMethodCallback, 0, 0}, 5511 {"methodWithNonOptionalArgAndOptionalArg", TestObjV8Internal::methodWithNonOptionalArgAndOptionalArgMethodCallback, 0, 1}, 5512 {"methodWithNonOptionalArgAndTwoOptionalArgs", TestObjV8Internal::methodWithNonOptionalArgAndTwoOptionalArgsMethodCallback, 0, 1}, 5513 {"methodWithOptionalString", TestObjV8Internal::methodWithOptionalStringMethodCallback, 0, 0}, 5514 {"methodWithOptionalStringIsUndefined", TestObjV8Internal::methodWithOptionalStringIsUndefinedMethodCallback, 0, 0}, 5515 {"methodWithOptionalStringIsNullString", TestObjV8Internal::methodWithOptionalStringIsNullStringMethodCallback, 0, 0}, 5516 {"methodWithCallbackArg", TestObjV8Internal::methodWithCallbackArgMethodCallback, 0, 1}, 5517 {"methodWithNonCallbackArgAndCallbackArg", TestObjV8Internal::methodWithNonCallbackArgAndCallbackArgMethodCallback, 0, 2}, 5518 {"methodWithCallbackAndOptionalArg", TestObjV8Internal::methodWithCallbackAndOptionalArgMethodCallback, 0, 0}, 5519 {"methodWithNullableCallbackArg", TestObjV8Internal::methodWithNullableCallbackArgMethodCallback, 0, 1}, 5520 {"methodWithEnforceRangeInt8", TestObjV8Internal::methodWithEnforceRangeInt8MethodCallback, 0, 1}, 5521 {"methodWithEnforceRangeUInt8", TestObjV8Internal::methodWithEnforceRangeUInt8MethodCallback, 0, 1}, 5522 {"methodWithEnforceRangeInt32", TestObjV8Internal::methodWithEnforceRangeInt32MethodCallback, 0, 1}, 5523 {"methodWithEnforceRangeUInt32", TestObjV8Internal::methodWithEnforceRangeUInt32MethodCallback, 0, 1}, 5524 {"methodWithEnforceRangeInt64", TestObjV8Internal::methodWithEnforceRangeInt64MethodCallback, 0, 1}, 5525 {"methodWithEnforceRangeUInt64", TestObjV8Internal::methodWithEnforceRangeUInt64MethodCallback, 0, 1}, 5526 #if ENABLE(Condition1) 5527 {"conditionalMethod1", TestObjV8Internal::conditionalMethod1MethodCallback, 0, 0}, 5528 #endif // ENABLE(Condition1) 5529 #if ENABLE(Condition1) && ENABLE(Condition2) 5530 {"conditionalMethod2", TestObjV8Internal::conditionalMethod2MethodCallback, 0, 0}, 5531 #endif // ENABLE(Condition1) && ENABLE(Condition2) 5532 #if ENABLE(Condition1) || ENABLE(Condition2) 5533 {"conditionalMethod3", TestObjV8Internal::conditionalMethod3MethodCallback, 0, 0}, 5534 #endif // ENABLE(Condition1) || ENABLE(Condition2) 5535 {"callbackFunctionReturnValue", TestObjV8Internal::callbackFunctionReturnValueMethodCallback, 0, 0}, 5536 {"callbackFunctionArgument", TestObjV8Internal::callbackFunctionArgumentMethodCallback, 0, 1}, 5537 {"overloadedMethod", TestObjV8Internal::overloadedMethodMethodCallback, 0, 2}, 5538 {"classMethodWithClamp", TestObjV8Internal::classMethodWithClampMethodCallback, 0, 2}, 5539 {"methodWithUnsignedLongSequence", TestObjV8Internal::methodWithUnsignedLongSequenceMethodCallback, 0, 1}, 5540 {"stringArrayFunction", TestObjV8Internal::stringArrayFunctionMethodCallback, 0, 1}, 5541 {"getSVGDocument", TestObjV8Internal::getSVGDocumentMethodCallback, 0, 0}, 5542 {"mutablePointFunction", TestObjV8Internal::mutablePointFunctionMethodCallback, 0, 0}, 5543 {"immutablePointFunction", TestObjV8Internal::immutablePointFunctionMethodCallback, 0, 0}, 5544 {"orange", TestObjV8Internal::orangeMethodCallback, 0, 0}, 5545 {"strictFunction", TestObjV8Internal::strictFunctionMethodCallback, 0, 3}, 5546 {"variadicStringMethod", TestObjV8Internal::variadicStringMethodMethodCallback, 0, 2}, 5547 {"variadicDoubleMethod", TestObjV8Internal::variadicDoubleMethodMethodCallback, 0, 2}, 5548 {"perWorldMethod", TestObjV8Internal::perWorldMethodMethodCallback, TestObjV8Internal::perWorldMethodMethodCallbackForMainWorld, 0}, 5549 {"overloadedPerWorldMethod", TestObjV8Internal::overloadedPerWorldMethodMethodCallback, TestObjV8Internal::overloadedPerWorldMethodMethodCallbackForMainWorld, 1}, 5550 {"activityLoggedMethod1", TestObjV8Internal::activityLoggedMethod1MethodCallback, 0, 1}, 5551 {"activityLoggedMethod2", TestObjV8Internal::activityLoggedMethod2MethodCallback, TestObjV8Internal::activityLoggedMethod2MethodCallbackForMainWorld, 1}, 5552 {"activityLoggedInIsolatedWorldMethod", TestObjV8Internal::activityLoggedInIsolatedWorldMethodMethodCallback, TestObjV8Internal::activityLoggedInIsolatedWorldMethodMethodCallbackForMainWorld, 1}, 5553 {"overloadedActivityLoggedMethod", TestObjV8Internal::overloadedActivityLoggedMethodMethodCallback, TestObjV8Internal::overloadedActivityLoggedMethodMethodCallbackForMainWorld, 1}, 5554 {"deprecatedMethod", TestObjV8Internal::deprecatedMethodMethodCallback, 0, 0}, 5555 }; 5556 5557 static const V8DOMConfiguration::BatchedConstant V8TestObjectConsts[] = { 5558 #if ENABLE(Condition1) 5559 {"CONDITIONAL_CONST", 0}, 5560 #endif 5561 {"CONST_VALUE_0", 0}, 5562 {"CONST_VALUE_1", 1}, 5563 {"CONST_VALUE_2", 2}, 5564 {"CONST_VALUE_4", 4}, 5565 {"CONST_VALUE_8", 8}, 5566 {"CONST_VALUE_9", -1}, 5567 {"CONST_VALUE_10", "my constant string"}, 5568 {"CONST_VALUE_11", -1}, 5569 {"CONST_VALUE_12", 1}, 5570 {"CONST_VALUE_13", 0X20}, 5571 {"CONST_VALUE_14", 6844}, 5572 {"CONST_JAVASCRIPT", 15}, 5573 {"DEPRECATED_CONSTANT", 1}, 5574 }; 5575 5576 5577 #if ENABLE(Condition1) 5578 COMPILE_ASSERT(0 == TestObj::CONDITIONAL_CONST, TestObjEnumCONDITIONAL_CONSTIsWrongUseDoNotCheckConstants); 5579 #endif 5580 COMPILE_ASSERT(0 == TestObj::CONST_VALUE_0, TestObjEnumCONST_VALUE_0IsWrongUseDoNotCheckConstants); 5581 COMPILE_ASSERT(1 == TestObj::CONST_VALUE_1, TestObjEnumCONST_VALUE_1IsWrongUseDoNotCheckConstants); 5582 COMPILE_ASSERT(2 == TestObj::CONST_VALUE_2, TestObjEnumCONST_VALUE_2IsWrongUseDoNotCheckConstants); 5583 COMPILE_ASSERT(4 == TestObj::CONST_VALUE_4, TestObjEnumCONST_VALUE_4IsWrongUseDoNotCheckConstants); 5584 COMPILE_ASSERT(8 == TestObj::CONST_VALUE_8, TestObjEnumCONST_VALUE_8IsWrongUseDoNotCheckConstants); 5585 COMPILE_ASSERT(-1 == TestObj::CONST_VALUE_9, TestObjEnumCONST_VALUE_9IsWrongUseDoNotCheckConstants); 5586 COMPILE_ASSERT("my constant string" == TestObj::CONST_VALUE_10, TestObjEnumCONST_VALUE_10IsWrongUseDoNotCheckConstants); 5587 COMPILE_ASSERT(0xffffffff == TestObj::CONST_VALUE_11, TestObjEnumCONST_VALUE_11IsWrongUseDoNotCheckConstants); 5588 COMPILE_ASSERT(0x01 == TestObj::CONST_VALUE_12, TestObjEnumCONST_VALUE_12IsWrongUseDoNotCheckConstants); 5589 COMPILE_ASSERT(0X20 == TestObj::CONST_VALUE_13, TestObjEnumCONST_VALUE_13IsWrongUseDoNotCheckConstants); 5590 COMPILE_ASSERT(0x1abc == TestObj::CONST_VALUE_14, TestObjEnumCONST_VALUE_14IsWrongUseDoNotCheckConstants); 5591 COMPILE_ASSERT(15 == TestObj::CONST_IMPL, TestObjEnumCONST_IMPLIsWrongUseDoNotCheckConstants); 5592 COMPILE_ASSERT(1 == TestObj::DEPRECATED_CONSTANT, TestObjEnumDEPRECATED_CONSTANTIsWrongUseDoNotCheckConstants); 5593 5594 void V8TestObject::constructorCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 5595 { 5596 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "DOMConstructor"); 5597 if (!args.IsConstructCall()) { 5598 throwTypeError("DOM object constructor cannot be called as a function.", args.GetIsolate()); 5599 return; 5600 } 5601 5602 if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) { 5603 args.GetReturnValue().Set(args.Holder()); 5604 return; 5605 } 5606 5607 TestObjV8Internal::constructor(args); 5608 } 5609 5610 static v8::Handle<v8::FunctionTemplate> ConfigureV8TestObjectTemplate(v8::Handle<v8::FunctionTemplate> desc, v8::Isolate* isolate, WrapperWorldType currentWorldType) 5611 { 5612 desc->ReadOnlyPrototype(); 5613 5614 v8::Local<v8::Signature> defaultSignature; 5615 defaultSignature = V8DOMConfiguration::configureTemplate(desc, "TestObject", V8EventTarget::GetTemplate(isolate, currentWorldType), V8TestObject::internalFieldCount, 5616 V8TestObjectAttrs, WTF_ARRAY_LENGTH(V8TestObjectAttrs), 5617 V8TestObjectMethods, WTF_ARRAY_LENGTH(V8TestObjectMethods), isolate, currentWorldType); 5618 UNUSED_PARAM(defaultSignature); // In some cases, it will not be used. 5619 desc->SetCallHandler(V8TestObject::constructorCallback); 5620 desc->SetLength(1); 5621 v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate(); 5622 v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate(); 5623 UNUSED_PARAM(instance); // In some cases, it will not be used. 5624 UNUSED_PARAM(proto); // In some cases, it will not be used. 5625 if (RuntimeEnabledFeatures::enabledAtRuntimeAttr1Enabled()) { 5626 static const V8DOMConfiguration::BatchedAttribute attrData =\ 5627 // Attribute 'enabledAtRuntimeAttr1' 5628 {"enabledAtRuntimeAttr1", TestObjV8Internal::enabledAtRuntimeAttr1AttrGetterCallback, TestObjV8Internal::enabledAtRuntimeAttr1AttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}; 5629 V8DOMConfiguration::configureAttribute(instance, proto, attrData, isolate, currentWorldType); 5630 } 5631 if (RuntimeEnabledFeatures::featureNameEnabled()) { 5632 static const V8DOMConfiguration::BatchedAttribute attrData =\ 5633 // Attribute 'enabledAtRuntimeAttr2' 5634 {"enabledAtRuntimeAttr2", TestObjV8Internal::enabledAtRuntimeAttr2AttrGetterCallback, TestObjV8Internal::enabledAtRuntimeAttr2AttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}; 5635 V8DOMConfiguration::configureAttribute(instance, proto, attrData, isolate, currentWorldType); 5636 } 5637 desc->InstanceTemplate()->SetIndexedPropertyHandler(TestObjV8Internal::indexedPropertyGetterCallback, 0, 0, 0, indexedPropertyEnumerator<TestObj>); 5638 desc->InstanceTemplate()->SetNamedPropertyHandler(TestObjV8Internal::namedPropertyGetterCallback, 0, TestObjV8Internal::namedPropertyQueryCallback, 0, TestObjV8Internal::namedPropertyEnumeratorCallback); 5639 5640 // Custom Signature 'voidMethodWithArgs' 5641 const int voidMethodWithArgsArgc = 3; 5642 v8::Handle<v8::FunctionTemplate> voidMethodWithArgsArgv[voidMethodWithArgsArgc] = { v8::Handle<v8::FunctionTemplate>(), v8::Handle<v8::FunctionTemplate>(), V8PerIsolateData::from(isolate)->rawTemplate(&V8TestObject::info, currentWorldType) }; 5643 v8::Handle<v8::Signature> voidMethodWithArgsSignature = v8::Signature::New(desc, voidMethodWithArgsArgc, voidMethodWithArgsArgv); 5644 proto->Set(v8::String::NewSymbol("voidMethodWithArgs"), v8::FunctionTemplate::New(TestObjV8Internal::voidMethodWithArgsMethodCallback, v8Undefined(), voidMethodWithArgsSignature, 3)); 5645 5646 // Custom Signature 'longMethodWithArgs' 5647 const int longMethodWithArgsArgc = 3; 5648 v8::Handle<v8::FunctionTemplate> longMethodWithArgsArgv[longMethodWithArgsArgc] = { v8::Handle<v8::FunctionTemplate>(), v8::Handle<v8::FunctionTemplate>(), V8PerIsolateData::from(isolate)->rawTemplate(&V8TestObject::info, currentWorldType) }; 5649 v8::Handle<v8::Signature> longMethodWithArgsSignature = v8::Signature::New(desc, longMethodWithArgsArgc, longMethodWithArgsArgv); 5650 proto->Set(v8::String::NewSymbol("longMethodWithArgs"), v8::FunctionTemplate::New(TestObjV8Internal::longMethodWithArgsMethodCallback, v8Undefined(), longMethodWithArgsSignature, 3)); 5651 5652 // Custom Signature 'objMethodWithArgs' 5653 const int objMethodWithArgsArgc = 3; 5654 v8::Handle<v8::FunctionTemplate> objMethodWithArgsArgv[objMethodWithArgsArgc] = { v8::Handle<v8::FunctionTemplate>(), v8::Handle<v8::FunctionTemplate>(), V8PerIsolateData::from(isolate)->rawTemplate(&V8TestObject::info, currentWorldType) }; 5655 v8::Handle<v8::Signature> objMethodWithArgsSignature = v8::Signature::New(desc, objMethodWithArgsArgc, objMethodWithArgsArgv); 5656 proto->Set(v8::String::NewSymbol("objMethodWithArgs"), v8::FunctionTemplate::New(TestObjV8Internal::objMethodWithArgsMethodCallback, v8Undefined(), objMethodWithArgsSignature, 3)); 5657 5658 // Custom Signature 'methodThatRequiresAllArgsAndThrows' 5659 const int methodThatRequiresAllArgsAndThrowsArgc = 2; 5660 v8::Handle<v8::FunctionTemplate> methodThatRequiresAllArgsAndThrowsArgv[methodThatRequiresAllArgsAndThrowsArgc] = { v8::Handle<v8::FunctionTemplate>(), V8PerIsolateData::from(isolate)->rawTemplate(&V8TestObject::info, currentWorldType) }; 5661 v8::Handle<v8::Signature> methodThatRequiresAllArgsAndThrowsSignature = v8::Signature::New(desc, methodThatRequiresAllArgsAndThrowsArgc, methodThatRequiresAllArgsAndThrowsArgv); 5662 proto->Set(v8::String::NewSymbol("methodThatRequiresAllArgsAndThrows"), v8::FunctionTemplate::New(TestObjV8Internal::methodThatRequiresAllArgsAndThrowsMethodCallback, v8Undefined(), methodThatRequiresAllArgsAndThrowsSignature, 2)); 5663 desc->Set(v8::String::NewSymbol("staticMethodWithCallbackAndOptionalArg"), v8::FunctionTemplate::New(TestObjV8Internal::staticMethodWithCallbackAndOptionalArgMethodCallback, v8Undefined(), v8::Local<v8::Signature>(), 0)); 5664 desc->Set(v8::String::NewSymbol("staticMethodWithCallbackArg"), v8::FunctionTemplate::New(TestObjV8Internal::staticMethodWithCallbackArgMethodCallback, v8Undefined(), v8::Local<v8::Signature>(), 1)); 5665 desc->Set(v8::String::NewSymbol("classMethod"), v8::FunctionTemplate::New(TestObjV8Internal::classMethodMethodCallback, v8Undefined(), v8::Local<v8::Signature>(), 0)); 5666 desc->Set(v8::String::NewSymbol("classMethodWithOptional"), v8::FunctionTemplate::New(TestObjV8Internal::classMethodWithOptionalMethodCallback, v8Undefined(), v8::Local<v8::Signature>(), 0)); 5667 desc->Set(v8::String::NewSymbol("classMethod2"), v8::FunctionTemplate::New(TestObjV8Internal::classMethod2MethodCallback, v8Undefined(), v8::Local<v8::Signature>(), 1)); 5668 #if ENABLE(Condition1) 5669 desc->Set(v8::String::NewSymbol("overloadedMethod1"), v8::FunctionTemplate::New(TestObjV8Internal::overloadedMethod1MethodCallback, v8Undefined(), v8::Local<v8::Signature>(), 1)); 5670 #endif // ENABLE(Condition1) 5671 if (RuntimeEnabledFeatures::enabledAtRuntimeMethod1Enabled()) 5672 proto->Set(v8::String::NewSymbol("enabledAtRuntimeMethod1"), v8::FunctionTemplate::New(TestObjV8Internal::enabledAtRuntimeMethod1MethodCallback, v8Undefined(), defaultSignature, 1)); 5673 if (RuntimeEnabledFeatures::featureNameEnabled()) 5674 proto->Set(v8::String::NewSymbol("enabledAtRuntimeMethod2"), v8::FunctionTemplate::New(TestObjV8Internal::enabledAtRuntimeMethod2MethodCallback, v8Undefined(), defaultSignature, 1)); 5675 5676 // Custom Signature 'domStringListFunction' 5677 const int domStringListFunctionArgc = 1; 5678 v8::Handle<v8::FunctionTemplate> domStringListFunctionArgv[domStringListFunctionArgc] = { V8PerIsolateData::from(isolate)->rawTemplate(&V8DOMStringList::info, currentWorldType) }; 5679 v8::Handle<v8::Signature> domStringListFunctionSignature = v8::Signature::New(desc, domStringListFunctionArgc, domStringListFunctionArgv); 5680 proto->Set(v8::String::NewSymbol("domStringListFunction"), v8::FunctionTemplate::New(TestObjV8Internal::domStringListFunctionMethodCallback, v8Undefined(), domStringListFunctionSignature, 1)); 5681 5682 // Custom Signature 'convert1' 5683 const int convert1Argc = 1; 5684 v8::Handle<v8::FunctionTemplate> convert1Argv[convert1Argc] = { V8PerIsolateData::from(isolate)->rawTemplate(&V8TestNode::info, currentWorldType) }; 5685 v8::Handle<v8::Signature> convert1Signature = v8::Signature::New(desc, convert1Argc, convert1Argv); 5686 proto->Set(v8::String::NewSymbol("convert1"), v8::FunctionTemplate::New(TestObjV8Internal::convert1MethodCallback, v8Undefined(), convert1Signature, 1)); 5687 5688 // Custom Signature 'convert2' 5689 const int convert2Argc = 1; 5690 v8::Handle<v8::FunctionTemplate> convert2Argv[convert2Argc] = { V8PerIsolateData::from(isolate)->rawTemplate(&V8TestNode::info, currentWorldType) }; 5691 v8::Handle<v8::Signature> convert2Signature = v8::Signature::New(desc, convert2Argc, convert2Argv); 5692 proto->Set(v8::String::NewSymbol("convert2"), v8::FunctionTemplate::New(TestObjV8Internal::convert2MethodCallback, v8Undefined(), convert2Signature, 1)); 5693 5694 // Custom Signature 'convert4' 5695 const int convert4Argc = 1; 5696 v8::Handle<v8::FunctionTemplate> convert4Argv[convert4Argc] = { V8PerIsolateData::from(isolate)->rawTemplate(&V8TestNode::info, currentWorldType) }; 5697 v8::Handle<v8::Signature> convert4Signature = v8::Signature::New(desc, convert4Argc, convert4Argv); 5698 proto->Set(v8::String::NewSymbol("convert4"), v8::FunctionTemplate::New(TestObjV8Internal::convert4MethodCallback, v8Undefined(), convert4Signature, 1)); 5699 5700 // Custom Signature 'convert5' 5701 const int convert5Argc = 1; 5702 v8::Handle<v8::FunctionTemplate> convert5Argv[convert5Argc] = { V8PerIsolateData::from(isolate)->rawTemplate(&V8TestNode::info, currentWorldType) }; 5703 v8::Handle<v8::Signature> convert5Signature = v8::Signature::New(desc, convert5Argc, convert5Argv); 5704 proto->Set(v8::String::NewSymbol("convert5"), v8::FunctionTemplate::New(TestObjV8Internal::convert5MethodCallback, v8Undefined(), convert5Signature, 1)); 5705 5706 // Custom Signature 'variadicNodeMethod' 5707 const int variadicNodeMethodArgc = 2; 5708 v8::Handle<v8::FunctionTemplate> variadicNodeMethodArgv[variadicNodeMethodArgc] = { V8PerIsolateData::from(isolate)->rawTemplate(&V8Node::info, currentWorldType), V8PerIsolateData::from(isolate)->rawTemplate(&V8Node::info, currentWorldType) }; 5709 v8::Handle<v8::Signature> variadicNodeMethodSignature = v8::Signature::New(desc, variadicNodeMethodArgc, variadicNodeMethodArgv); 5710 proto->Set(v8::String::NewSymbol("variadicNodeMethod"), v8::FunctionTemplate::New(TestObjV8Internal::variadicNodeMethodMethodCallback, v8Undefined(), variadicNodeMethodSignature, 2)); 5711 desc->Set(v8::String::NewSymbol("deprecatedStaticMethod"), v8::FunctionTemplate::New(TestObjV8Internal::deprecatedStaticMethodMethodCallback, v8Undefined(), v8::Local<v8::Signature>(), 0)); 5712 V8DOMConfiguration::batchConfigureConstants(desc, proto, V8TestObjectConsts, WTF_ARRAY_LENGTH(V8TestObjectConsts), isolate); 5713 5714 // Custom toString template 5715 desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->toStringTemplate()); 5716 return desc; 5717 } 5718 5719 v8::Handle<v8::FunctionTemplate> V8TestObject::GetTemplate(v8::Isolate* isolate, WrapperWorldType currentWorldType) 5720 { 5721 V8PerIsolateData* data = V8PerIsolateData::from(isolate); 5722 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWorldType).find(&info); 5723 if (result != data->templateMap(currentWorldType).end()) 5724 return result->value.newLocal(isolate); 5725 5726 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); 5727 v8::HandleScope handleScope(isolate); 5728 v8::Handle<v8::FunctionTemplate> templ = 5729 ConfigureV8TestObjectTemplate(data->rawTemplate(&info, currentWorldType), isolate, currentWorldType); 5730 data->templateMap(currentWorldType).add(&info, UnsafePersistent<v8::FunctionTemplate>(isolate, templ)); 5731 return handleScope.Close(templ); 5732 } 5733 5734 bool V8TestObject::HasInstance(v8::Handle<v8::Value> value, v8::Isolate* isolate, WrapperWorldType currentWorldType) 5735 { 5736 return V8PerIsolateData::from(isolate)->hasInstance(&info, value, currentWorldType); 5737 } 5738 5739 bool V8TestObject::HasInstanceInAnyWorld(v8::Handle<v8::Value> value, v8::Isolate* isolate) 5740 { 5741 return V8PerIsolateData::from(isolate)->hasInstance(&info, value, MainWorld) 5742 || V8PerIsolateData::from(isolate)->hasInstance(&info, value, IsolatedWorld) 5743 || V8PerIsolateData::from(isolate)->hasInstance(&info, value, WorkerWorld); 5744 } 5745 5746 void V8TestObject::installPerContextProperties(v8::Handle<v8::Object> instance, TestObj* impl, v8::Isolate* isolate) 5747 { 5748 v8::Local<v8::Object> proto = v8::Local<v8::Object>::Cast(instance->GetPrototype()); 5749 if (ContextFeatures::enabledPerContextAttr1Enabled(impl->document())) { 5750 static const V8DOMConfiguration::BatchedAttribute attrData =\ 5751 // Attribute 'enabledPerContextAttr1' 5752 {"enabledPerContextAttr1", TestObjV8Internal::enabledPerContextAttr1AttrGetterCallback, TestObjV8Internal::enabledPerContextAttr1AttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}; 5753 V8DOMConfiguration::configureAttribute(instance, proto, attrData, isolate); 5754 } 5755 if (ContextFeatures::featureNameEnabled(impl->document())) { 5756 static const V8DOMConfiguration::BatchedAttribute attrData =\ 5757 // Attribute 'enabledPerContextAttr2' 5758 {"enabledPerContextAttr2", TestObjV8Internal::enabledPerContextAttr2AttrGetterCallback, TestObjV8Internal::enabledPerContextAttr2AttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}; 5759 V8DOMConfiguration::configureAttribute(instance, proto, attrData, isolate); 5760 } 5761 } 5762 5763 void V8TestObject::installPerContextPrototypeProperties(v8::Handle<v8::Object> proto, v8::Isolate* isolate) 5764 { 5765 UNUSED_PARAM(proto); 5766 v8::Local<v8::Signature> defaultSignature = v8::Signature::New(GetTemplate(isolate, worldType(isolate))); 5767 UNUSED_PARAM(defaultSignature); // In some cases, it will not be used. 5768 5769 ScriptExecutionContext* context = toScriptExecutionContext(proto->CreationContext()); 5770 if (context && context->isDocument() && ContextFeatures::enabledPerContextMethod1Enabled(toDocument(context))) 5771 proto->Set(v8::String::NewSymbol("enabledPerContextMethod1"), v8::FunctionTemplate::New(TestObjV8Internal::enabledPerContextMethod1MethodCallback, v8Undefined(), defaultSignature, 1)->GetFunction()); 5772 if (context && context->isDocument() && ContextFeatures::featureNameEnabled(toDocument(context))) 5773 proto->Set(v8::String::NewSymbol("enabledPerContextMethod2"), v8::FunctionTemplate::New(TestObjV8Internal::enabledPerContextMethod2MethodCallback, v8Undefined(), defaultSignature, 1)->GetFunction()); 5774 } 5775 5776 EventTarget* V8TestObject::toEventTarget(v8::Handle<v8::Object> object) 5777 { 5778 return toNative(object); 5779 } 5780 5781 5782 v8::Handle<v8::Object> V8TestObject::createWrapper(PassRefPtr<TestObj> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) 5783 { 5784 ASSERT(impl.get()); 5785 ASSERT(DOMDataStore::getWrapper<V8TestObject>(impl.get(), isolate).IsEmpty()); 5786 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { 5787 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObject(impl.get()); 5788 // Might be a XXXConstructor::info instead of an XXX::info. These will both have 5789 // the same object de-ref functions, though, so use that as the basis of the check. 5790 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction == info.derefObjectFunction); 5791 } 5792 5793 5794 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, &info, toInternalPointer(impl.get()), isolate); 5795 if (UNLIKELY(wrapper.IsEmpty())) 5796 return wrapper; 5797 installPerContextProperties(wrapper, impl.get(), isolate); 5798 V8DOMWrapper::associateObjectWithWrapper<V8TestObject>(impl, &info, wrapper, isolate, WrapperConfiguration::Independent); 5799 return wrapper; 5800 } 5801 void V8TestObject::derefObject(void* object) 5802 { 5803 fromInternalPointer(object)->deref(); 5804 } 5805 5806 } // namespace WebCore 5807