Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! | |
| 6 | |
| 7 #include "config.h" | |
| 8 #if ENABLE(CONDITION) | |
| 9 #include "V8TestInterface5.h" | |
| 10 | |
| 11 #include "bindings/core/v8/ExceptionState.h" | |
| 12 #include "bindings/core/v8/ScriptState.h" | |
| 13 #include "bindings/core/v8/V8DOMConfiguration.h" | |
| 14 #include "bindings/core/v8/V8HiddenValue.h" | |
| 15 #include "bindings/core/v8/V8ObjectConstructor.h" | |
| 16 #include "bindings/tests/v8/V8Iterator.h" | |
|
tasak
2014/09/10 05:55:52
I think, this should be "bindings/tests/core/v8/V8
| |
| 17 #include "bindings/tests/v8/V8TestInterface5.h" | |
|
tasak
2014/09/10 05:55:52
"bindings/tests/modules/v8/V8TestInterface5.h"
| |
| 18 #include "bindings/tests/v8/V8TestInterfaceEmpty.h" | |
|
tasak
2014/09/10 05:55:52
"bindings/tests/core/v8/V8TestInterfaceEmpty.h"
| |
| 19 #include "core/dom/ContextFeatures.h" | |
| 20 #include "core/dom/Document.h" | |
| 21 #include "platform/RuntimeEnabledFeatures.h" | |
| 22 #include "platform/TraceEvent.h" | |
| 23 #include "wtf/GetPtr.h" | |
| 24 #include "wtf/RefPtr.h" | |
| 25 | |
| 26 namespace blink { | |
| 27 | |
| 28 const WrapperTypeInfo V8TestInterface5::wrapperTypeInfo = { gin::kEmbedderBlink, V8TestInterface5::domTemplate, V8TestInterface5::refObject, V8TestInterface5::d erefObject, V8TestInterface5::createPersistentHandle, V8TestInterface5::toActive DOMObject, 0, V8TestInterface5::visitDOMWrapper, V8TestInterface5::installCondit ionallyEnabledMethods, V8TestInterface5::installConditionallyEnabledProperties, &V8TestInterfaceEmpty::wrapperTypeInfo, WrapperTypeInfo::WrapperTypeObjectProtot ype, WrapperTypeInfo::ObjectClassId, WrapperTypeInfo::Dependent, WrapperTypeInfo ::RefCountedObject }; | |
| 29 | |
| 30 // This static member must be declared by DEFINE_WRAPPERTYPEINFO in TestInterfac e5Implementation.h. | |
| 31 // For details, see the comment of DEFINE_WRAPPERTYPEINFO in | |
| 32 // bindings/core/v8/ScriptWrappable.h. | |
| 33 const WrapperTypeInfo& TestInterface5Implementation::s_wrapperTypeInfo = V8TestI nterface5::wrapperTypeInfo; | |
| 34 | |
| 35 namespace TestInterface5ImplementationV8Internal { | |
| 36 | |
| 37 template <typename T> void V8_USE(T) { } | |
| 38 | |
| 39 static void testInterfaceAttributeAttributeGetter(const v8::PropertyCallbackInfo <v8::Value>& info) | |
| 40 { | |
| 41 v8::Handle<v8::Object> holder = info.Holder(); | |
| 42 TestInterface5Implementation* impl = V8TestInterface5::toImpl(holder); | |
| 43 v8SetReturnValueFast(info, WTF::getPtr(impl->testInterfaceAttribute()), impl ); | |
| 44 } | |
| 45 | |
| 46 static void testInterfaceAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) | |
| 47 { | |
| 48 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); | |
| 49 TestInterface5ImplementationV8Internal::testInterfaceAttributeAttributeGette r(info); | |
| 50 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 51 } | |
| 52 | |
| 53 static void testInterfaceAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) | |
| 54 { | |
| 55 v8::Handle<v8::Object> holder = info.Holder(); | |
| 56 ExceptionState exceptionState(ExceptionState::SetterContext, "testInterfaceA ttribute", "TestInterface5", holder, info.GetIsolate()); | |
| 57 if (!V8TestInterface5::hasInstance(v8Value, info.GetIsolate())) { | |
| 58 exceptionState.throwTypeError("The provided value is not of type 'TestIn terface5'."); | |
| 59 exceptionState.throwIfNeeded(); | |
| 60 return; | |
| 61 } | |
| 62 TestInterface5Implementation* impl = V8TestInterface5::toImpl(holder); | |
| 63 TONATIVE_VOID(TestInterface5Implementation*, cppValue, V8TestInterface5::toI mplWithTypeCheck(info.GetIsolate(), v8Value)); | |
| 64 impl->setTestInterfaceAttribute(WTF::getPtr(cppValue)); | |
| 65 } | |
| 66 | |
| 67 static void testInterfaceAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) | |
| 68 { | |
| 69 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); | |
| 70 TestInterface5ImplementationV8Internal::testInterfaceAttributeAttributeSette r(v8Value, info); | |
| 71 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 72 } | |
| 73 | |
| 74 static void doubleAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Va lue>& info) | |
| 75 { | |
| 76 v8::Handle<v8::Object> holder = info.Holder(); | |
| 77 TestInterface5Implementation* impl = V8TestInterface5::toImpl(holder); | |
| 78 v8SetReturnValue(info, impl->doubleAttribute()); | |
| 79 } | |
| 80 | |
| 81 static void doubleAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) | |
| 82 { | |
| 83 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); | |
| 84 TestInterface5ImplementationV8Internal::doubleAttributeAttributeGetter(info) ; | |
| 85 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 86 } | |
| 87 | |
| 88 static void doubleAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v 8::PropertyCallbackInfo<void>& info) | |
| 89 { | |
| 90 v8::Handle<v8::Object> holder = info.Holder(); | |
| 91 ExceptionState exceptionState(ExceptionState::SetterContext, "doubleAttribut e", "TestInterface5", holder, info.GetIsolate()); | |
| 92 TestInterface5Implementation* impl = V8TestInterface5::toImpl(holder); | |
| 93 TONATIVE_VOID(double, cppValue, static_cast<double>(v8Value->NumberValue())) ; | |
| 94 if (!std::isfinite(cppValue)) { | |
| 95 exceptionState.throwTypeError("The provided double value is non-finite." ); | |
| 96 exceptionState.throwIfNeeded(); | |
| 97 return; | |
| 98 } | |
| 99 impl->setDoubleAttribute(cppValue); | |
| 100 } | |
| 101 | |
| 102 static void doubleAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Lo cal<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) | |
| 103 { | |
| 104 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); | |
| 105 TestInterface5ImplementationV8Internal::doubleAttributeAttributeSetter(v8Val ue, info); | |
| 106 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 107 } | |
| 108 | |
| 109 static void floatAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Val ue>& info) | |
| 110 { | |
| 111 v8::Handle<v8::Object> holder = info.Holder(); | |
| 112 TestInterface5Implementation* impl = V8TestInterface5::toImpl(holder); | |
| 113 v8SetReturnValue(info, impl->floatAttribute()); | |
| 114 } | |
| 115 | |
| 116 static void floatAttributeAttributeGetterCallback(v8::Local<v8::String>, const v 8::PropertyCallbackInfo<v8::Value>& info) | |
| 117 { | |
| 118 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); | |
| 119 TestInterface5ImplementationV8Internal::floatAttributeAttributeGetter(info); | |
| 120 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 121 } | |
| 122 | |
| 123 static void floatAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8 ::PropertyCallbackInfo<void>& info) | |
| 124 { | |
| 125 v8::Handle<v8::Object> holder = info.Holder(); | |
| 126 ExceptionState exceptionState(ExceptionState::SetterContext, "floatAttribute ", "TestInterface5", holder, info.GetIsolate()); | |
| 127 TestInterface5Implementation* impl = V8TestInterface5::toImpl(holder); | |
| 128 TONATIVE_VOID(float, cppValue, static_cast<float>(v8Value->NumberValue())); | |
| 129 if (!std::isfinite(cppValue)) { | |
| 130 exceptionState.throwTypeError("The provided float value is non-finite.") ; | |
| 131 exceptionState.throwIfNeeded(); | |
| 132 return; | |
| 133 } | |
| 134 impl->setFloatAttribute(cppValue); | |
| 135 } | |
| 136 | |
| 137 static void floatAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Loc al<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) | |
| 138 { | |
| 139 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); | |
| 140 TestInterface5ImplementationV8Internal::floatAttributeAttributeSetter(v8Valu e, info); | |
| 141 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 142 } | |
| 143 | |
| 144 static void unrestrictedDoubleAttributeAttributeGetter(const v8::PropertyCallbac kInfo<v8::Value>& info) | |
| 145 { | |
| 146 v8::Handle<v8::Object> holder = info.Holder(); | |
| 147 TestInterface5Implementation* impl = V8TestInterface5::toImpl(holder); | |
| 148 v8SetReturnValue(info, impl->unrestrictedDoubleAttribute()); | |
| 149 } | |
| 150 | |
| 151 static void unrestrictedDoubleAttributeAttributeGetterCallback(v8::Local<v8::Str ing>, const v8::PropertyCallbackInfo<v8::Value>& info) | |
| 152 { | |
| 153 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); | |
| 154 TestInterface5ImplementationV8Internal::unrestrictedDoubleAttributeAttribute Getter(info); | |
| 155 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 156 } | |
| 157 | |
| 158 static void unrestrictedDoubleAttributeAttributeSetter(v8::Local<v8::Value> v8Va lue, const v8::PropertyCallbackInfo<void>& info) | |
| 159 { | |
| 160 v8::Handle<v8::Object> holder = info.Holder(); | |
| 161 TestInterface5Implementation* impl = V8TestInterface5::toImpl(holder); | |
| 162 TONATIVE_VOID(double, cppValue, static_cast<double>(v8Value->NumberValue())) ; | |
| 163 impl->setUnrestrictedDoubleAttribute(cppValue); | |
| 164 } | |
| 165 | |
| 166 static void unrestrictedDoubleAttributeAttributeSetterCallback(v8::Local<v8::Str ing>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) | |
| 167 { | |
| 168 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); | |
| 169 TestInterface5ImplementationV8Internal::unrestrictedDoubleAttributeAttribute Setter(v8Value, info); | |
| 170 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 171 } | |
| 172 | |
| 173 static void unrestrictedFloatAttributeAttributeGetter(const v8::PropertyCallback Info<v8::Value>& info) | |
| 174 { | |
| 175 v8::Handle<v8::Object> holder = info.Holder(); | |
| 176 TestInterface5Implementation* impl = V8TestInterface5::toImpl(holder); | |
| 177 v8SetReturnValue(info, impl->unrestrictedFloatAttribute()); | |
| 178 } | |
| 179 | |
| 180 static void unrestrictedFloatAttributeAttributeGetterCallback(v8::Local<v8::Stri ng>, const v8::PropertyCallbackInfo<v8::Value>& info) | |
| 181 { | |
| 182 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); | |
| 183 TestInterface5ImplementationV8Internal::unrestrictedFloatAttributeAttributeG etter(info); | |
| 184 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 185 } | |
| 186 | |
| 187 static void unrestrictedFloatAttributeAttributeSetter(v8::Local<v8::Value> v8Val ue, const v8::PropertyCallbackInfo<void>& info) | |
| 188 { | |
| 189 v8::Handle<v8::Object> holder = info.Holder(); | |
| 190 TestInterface5Implementation* impl = V8TestInterface5::toImpl(holder); | |
| 191 TONATIVE_VOID(float, cppValue, static_cast<float>(v8Value->NumberValue())); | |
| 192 impl->setUnrestrictedFloatAttribute(cppValue); | |
| 193 } | |
| 194 | |
| 195 static void unrestrictedFloatAttributeAttributeSetterCallback(v8::Local<v8::Stri ng>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) | |
| 196 { | |
| 197 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); | |
| 198 TestInterface5ImplementationV8Internal::unrestrictedFloatAttributeAttributeS etter(v8Value, info); | |
| 199 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 200 } | |
| 201 | |
| 202 static void staticStringAttributeAttributeGetter(const v8::PropertyCallbackInfo< v8::Value>& info) | |
| 203 { | |
| 204 v8SetReturnValueString(info, TestInterface5Implementation::staticStringAttri bute(), info.GetIsolate()); | |
| 205 } | |
| 206 | |
| 207 static void staticStringAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) | |
| 208 { | |
| 209 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); | |
| 210 TestInterface5ImplementationV8Internal::staticStringAttributeAttributeGetter (info); | |
| 211 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 212 } | |
| 213 | |
| 214 static void staticStringAttributeAttributeSetter(v8::Local<v8::Value> v8Value, c onst v8::PropertyCallbackInfo<void>& info) | |
| 215 { | |
| 216 TOSTRING_VOID(V8StringResource<>, cppValue, v8Value); | |
| 217 TestInterface5Implementation::setStaticStringAttribute(cppValue); | |
| 218 } | |
| 219 | |
| 220 static void staticStringAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) | |
| 221 { | |
| 222 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); | |
| 223 TestInterface5ImplementationV8Internal::staticStringAttributeAttributeSetter (v8Value, info); | |
| 224 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 225 } | |
| 226 | |
| 227 static void alwaysExposedAttributeAttributeGetter(const v8::PropertyCallbackInfo <v8::Value>& info) | |
| 228 { | |
| 229 v8::Handle<v8::Object> holder = info.Holder(); | |
| 230 TestInterface5Implementation* impl = V8TestInterface5::toImpl(holder); | |
| 231 v8SetReturnValueInt(info, impl->alwaysExposedAttribute()); | |
| 232 } | |
| 233 | |
| 234 static void alwaysExposedAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) | |
| 235 { | |
| 236 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); | |
| 237 TestInterface5ImplementationV8Internal::alwaysExposedAttributeAttributeGette r(info); | |
| 238 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 239 } | |
| 240 | |
| 241 static void alwaysExposedAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) | |
| 242 { | |
| 243 v8::Handle<v8::Object> holder = info.Holder(); | |
| 244 ExceptionState exceptionState(ExceptionState::SetterContext, "alwaysExposedA ttribute", "TestInterface5", holder, info.GetIsolate()); | |
| 245 TestInterface5Implementation* impl = V8TestInterface5::toImpl(holder); | |
| 246 TONATIVE_VOID_EXCEPTIONSTATE(int, cppValue, toInt32(v8Value, exceptionState) , exceptionState); | |
| 247 impl->setAlwaysExposedAttribute(cppValue); | |
| 248 } | |
| 249 | |
| 250 static void alwaysExposedAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) | |
| 251 { | |
| 252 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); | |
| 253 TestInterface5ImplementationV8Internal::alwaysExposedAttributeAttributeSette r(v8Value, info); | |
| 254 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 255 } | |
| 256 | |
| 257 static void workerExposedAttributeAttributeGetter(const v8::PropertyCallbackInfo <v8::Value>& info) | |
| 258 { | |
| 259 v8::Handle<v8::Object> holder = info.Holder(); | |
| 260 TestInterface5Implementation* impl = V8TestInterface5::toImpl(holder); | |
| 261 v8SetReturnValueInt(info, impl->workerExposedAttribute()); | |
| 262 } | |
| 263 | |
| 264 static void workerExposedAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) | |
| 265 { | |
| 266 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); | |
| 267 TestInterface5ImplementationV8Internal::workerExposedAttributeAttributeGette r(info); | |
| 268 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 269 } | |
| 270 | |
| 271 static void workerExposedAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) | |
| 272 { | |
| 273 v8::Handle<v8::Object> holder = info.Holder(); | |
| 274 ExceptionState exceptionState(ExceptionState::SetterContext, "workerExposedA ttribute", "TestInterface5", holder, info.GetIsolate()); | |
| 275 TestInterface5Implementation* impl = V8TestInterface5::toImpl(holder); | |
| 276 TONATIVE_VOID_EXCEPTIONSTATE(int, cppValue, toInt32(v8Value, exceptionState) , exceptionState); | |
| 277 impl->setWorkerExposedAttribute(cppValue); | |
| 278 } | |
| 279 | |
| 280 static void workerExposedAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) | |
| 281 { | |
| 282 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); | |
| 283 TestInterface5ImplementationV8Internal::workerExposedAttributeAttributeSette r(v8Value, info); | |
| 284 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 285 } | |
| 286 | |
| 287 static void windowExposedAttributeAttributeGetter(const v8::PropertyCallbackInfo <v8::Value>& info) | |
| 288 { | |
| 289 v8::Handle<v8::Object> holder = info.Holder(); | |
| 290 TestInterface5Implementation* impl = V8TestInterface5::toImpl(holder); | |
| 291 v8SetReturnValueInt(info, impl->windowExposedAttribute()); | |
| 292 } | |
| 293 | |
| 294 static void windowExposedAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) | |
| 295 { | |
| 296 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); | |
| 297 TestInterface5ImplementationV8Internal::windowExposedAttributeAttributeGette r(info); | |
| 298 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 299 } | |
| 300 | |
| 301 static void windowExposedAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) | |
| 302 { | |
| 303 v8::Handle<v8::Object> holder = info.Holder(); | |
| 304 ExceptionState exceptionState(ExceptionState::SetterContext, "windowExposedA ttribute", "TestInterface5", holder, info.GetIsolate()); | |
| 305 TestInterface5Implementation* impl = V8TestInterface5::toImpl(holder); | |
| 306 TONATIVE_VOID_EXCEPTIONSTATE(int, cppValue, toInt32(v8Value, exceptionState) , exceptionState); | |
| 307 impl->setWindowExposedAttribute(cppValue); | |
| 308 } | |
| 309 | |
| 310 static void windowExposedAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) | |
| 311 { | |
| 312 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); | |
| 313 TestInterface5ImplementationV8Internal::windowExposedAttributeAttributeSette r(v8Value, info); | |
| 314 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 315 } | |
| 316 | |
| 317 static void TestInterface5ImplementationConstructorGetter(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) | |
| 318 { | |
| 319 v8::Handle<v8::Value> data = info.Data(); | |
| 320 ASSERT(data->IsExternal()); | |
| 321 V8PerContextData* perContextData = V8PerContextData::from(info.Holder()->Cre ationContext()); | |
| 322 if (!perContextData) | |
| 323 return; | |
| 324 v8SetReturnValue(info, perContextData->constructorForType(WrapperTypeInfo::u nwrap(data))); | |
| 325 } | |
| 326 | |
| 327 static void TestInterface5ImplementationForceSetAttributeOnThis(v8::Local<v8::St ring> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) | |
| 328 { | |
| 329 if (info.This()->IsObject()) | |
| 330 v8::Handle<v8::Object>::Cast(info.This())->ForceSet(name, v8Value); | |
| 331 } | |
| 332 | |
| 333 static void TestInterface5ImplementationForceSetAttributeOnThisCallback(v8::Loca l<v8::String> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo <void>& info) | |
| 334 { | |
| 335 TestInterface5ImplementationV8Internal::TestInterface5ImplementationForceSet AttributeOnThis(name, v8Value, info); | |
| 336 } | |
| 337 | |
| 338 static void voidMethodTestInterfaceEmptyArgMethod(const v8::FunctionCallbackInfo <v8::Value>& info) | |
| 339 { | |
| 340 if (UNLIKELY(info.Length() < 1)) { | |
| 341 V8ThrowException::throwException(createMinimumArityTypeErrorForMethod("v oidMethodTestInterfaceEmptyArg", "TestInterface5", 1, info.Length(), info.GetIso late()), info.GetIsolate()); | |
| 342 return; | |
| 343 } | |
| 344 TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder()) ; | |
| 345 TestInterfaceEmpty* testInterfaceEmptyArg; | |
| 346 { | |
| 347 v8::TryCatch block; | |
| 348 V8RethrowTryCatchScope rethrow(block); | |
| 349 if (info.Length() > 0 && !V8TestInterfaceEmpty::hasInstance(info[0], inf o.GetIsolate())) { | |
| 350 V8ThrowException::throwTypeError(ExceptionMessages::failedToExecute( "voidMethodTestInterfaceEmptyArg", "TestInterface5", "parameter 1 is not of type 'TestInterfaceEmpty'."), info.GetIsolate()); | |
| 351 return; | |
| 352 } | |
| 353 TONATIVE_VOID_INTERNAL(testInterfaceEmptyArg, V8TestInterfaceEmpty::toIm plWithTypeCheck(info.GetIsolate(), info[0])); | |
| 354 } | |
| 355 impl->voidMethodTestInterfaceEmptyArg(testInterfaceEmptyArg); | |
| 356 } | |
| 357 | |
| 358 static void voidMethodTestInterfaceEmptyArgMethodCallback(const v8::FunctionCall backInfo<v8::Value>& info) | |
| 359 { | |
| 360 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); | |
| 361 TestInterface5ImplementationV8Internal::voidMethodTestInterfaceEmptyArgMetho d(info); | |
| 362 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 363 } | |
| 364 | |
| 365 static void voidMethodDoubleArgFloatArgMethod(const v8::FunctionCallbackInfo<v8: :Value>& info) | |
| 366 { | |
| 367 if (UNLIKELY(info.Length() < 2)) { | |
| 368 V8ThrowException::throwException(createMinimumArityTypeErrorForMethod("v oidMethodDoubleArgFloatArg", "TestInterface5", 2, info.Length(), info.GetIsolate ()), info.GetIsolate()); | |
| 369 return; | |
| 370 } | |
| 371 TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder()) ; | |
| 372 double doubleArg; | |
| 373 float floatArg; | |
| 374 { | |
| 375 v8::TryCatch block; | |
| 376 V8RethrowTryCatchScope rethrow(block); | |
| 377 TONATIVE_VOID_INTERNAL(doubleArg, static_cast<double>(info[0]->NumberVal ue())); | |
| 378 if (!std::isfinite(doubleArg)) { | |
| 379 V8ThrowException::throwTypeError(ExceptionMessages::failedToExecute( "voidMethodDoubleArgFloatArg", "TestInterface5", "double parameter 1 is non-fini te."), info.GetIsolate()); | |
| 380 return; | |
| 381 } | |
| 382 TONATIVE_VOID_INTERNAL(floatArg, static_cast<float>(info[1]->NumberValue ())); | |
| 383 if (!std::isfinite(floatArg)) { | |
| 384 V8ThrowException::throwTypeError(ExceptionMessages::failedToExecute( "voidMethodDoubleArgFloatArg", "TestInterface5", "float parameter 2 is non-finit e."), info.GetIsolate()); | |
| 385 return; | |
| 386 } | |
| 387 } | |
| 388 impl->voidMethodDoubleArgFloatArg(doubleArg, floatArg); | |
| 389 } | |
| 390 | |
| 391 static void voidMethodDoubleArgFloatArgMethodCallback(const v8::FunctionCallback Info<v8::Value>& info) | |
| 392 { | |
| 393 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); | |
| 394 TestInterface5ImplementationV8Internal::voidMethodDoubleArgFloatArgMethod(in fo); | |
| 395 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 396 } | |
| 397 | |
| 398 static void voidMethodUnrestrictedDoubleArgUnrestrictedFloatArgMethod(const v8:: FunctionCallbackInfo<v8::Value>& info) | |
| 399 { | |
| 400 if (UNLIKELY(info.Length() < 2)) { | |
| 401 V8ThrowException::throwException(createMinimumArityTypeErrorForMethod("v oidMethodUnrestrictedDoubleArgUnrestrictedFloatArg", "TestInterface5", 2, info.L ength(), info.GetIsolate()), info.GetIsolate()); | |
| 402 return; | |
| 403 } | |
| 404 TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder()) ; | |
| 405 double unrestrictedDoubleArg; | |
| 406 float unrestrictedFloatArg; | |
| 407 { | |
| 408 v8::TryCatch block; | |
| 409 V8RethrowTryCatchScope rethrow(block); | |
| 410 TONATIVE_VOID_INTERNAL(unrestrictedDoubleArg, static_cast<double>(info[0 ]->NumberValue())); | |
| 411 TONATIVE_VOID_INTERNAL(unrestrictedFloatArg, static_cast<float>(info[1]- >NumberValue())); | |
| 412 } | |
| 413 impl->voidMethodUnrestrictedDoubleArgUnrestrictedFloatArg(unrestrictedDouble Arg, unrestrictedFloatArg); | |
| 414 } | |
| 415 | |
| 416 static void voidMethodUnrestrictedDoubleArgUnrestrictedFloatArgMethodCallback(co nst v8::FunctionCallbackInfo<v8::Value>& info) | |
| 417 { | |
| 418 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); | |
| 419 TestInterface5ImplementationV8Internal::voidMethodUnrestrictedDoubleArgUnres trictedFloatArgMethod(info); | |
| 420 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 421 } | |
| 422 | |
| 423 static void voidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info) | |
| 424 { | |
| 425 TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder()) ; | |
| 426 impl->voidMethod(); | |
| 427 } | |
| 428 | |
| 429 static void voidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) | |
| 430 { | |
| 431 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); | |
| 432 TestInterface5ImplementationV8Internal::voidMethodMethod(info); | |
| 433 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 434 } | |
| 435 | |
| 436 static void voidMethodMethodForMainWorld(const v8::FunctionCallbackInfo<v8::Valu e>& info) | |
| 437 { | |
| 438 TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder()) ; | |
| 439 impl->voidMethod(); | |
| 440 } | |
| 441 | |
| 442 static void voidMethodMethodCallbackForMainWorld(const v8::FunctionCallbackInfo< v8::Value>& info) | |
| 443 { | |
| 444 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); | |
| 445 TestInterface5ImplementationV8Internal::voidMethodMethodForMainWorld(info); | |
| 446 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 447 } | |
| 448 | |
| 449 static void alwaysExposedMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info) | |
| 450 { | |
| 451 TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder()) ; | |
| 452 impl->alwaysExposedMethod(); | |
| 453 } | |
| 454 | |
| 455 static void alwaysExposedMethodMethodCallback(const v8::FunctionCallbackInfo<v8: :Value>& info) | |
| 456 { | |
| 457 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); | |
| 458 TestInterface5ImplementationV8Internal::alwaysExposedMethodMethod(info); | |
| 459 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 460 } | |
| 461 | |
| 462 static void workerExposedMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info) | |
| 463 { | |
| 464 TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder()) ; | |
| 465 impl->workerExposedMethod(); | |
| 466 } | |
| 467 | |
| 468 static void workerExposedMethodMethodCallback(const v8::FunctionCallbackInfo<v8: :Value>& info) | |
| 469 { | |
| 470 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); | |
| 471 TestInterface5ImplementationV8Internal::workerExposedMethodMethod(info); | |
| 472 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 473 } | |
| 474 | |
| 475 static void windowExposedMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info) | |
| 476 { | |
| 477 TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder()) ; | |
| 478 impl->windowExposedMethod(); | |
| 479 } | |
| 480 | |
| 481 static void windowExposedMethodMethodCallback(const v8::FunctionCallbackInfo<v8: :Value>& info) | |
| 482 { | |
| 483 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); | |
| 484 TestInterface5ImplementationV8Internal::windowExposedMethodMethod(info); | |
| 485 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 486 } | |
| 487 | |
| 488 static void alwaysExposedStaticMethodMethod(const v8::FunctionCallbackInfo<v8::V alue>& info) | |
| 489 { | |
| 490 TestInterface5Implementation::alwaysExposedStaticMethod(); | |
| 491 } | |
| 492 | |
| 493 static void alwaysExposedStaticMethodMethodCallback(const v8::FunctionCallbackIn fo<v8::Value>& info) | |
| 494 { | |
| 495 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); | |
| 496 TestInterface5ImplementationV8Internal::alwaysExposedStaticMethodMethod(info ); | |
| 497 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 498 } | |
| 499 | |
| 500 static void workerExposedStaticMethodMethod(const v8::FunctionCallbackInfo<v8::V alue>& info) | |
| 501 { | |
| 502 TestInterface5Implementation::workerExposedStaticMethod(); | |
| 503 } | |
| 504 | |
| 505 static void workerExposedStaticMethodMethodCallback(const v8::FunctionCallbackIn fo<v8::Value>& info) | |
| 506 { | |
| 507 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); | |
| 508 TestInterface5ImplementationV8Internal::workerExposedStaticMethodMethod(info ); | |
| 509 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 510 } | |
| 511 | |
| 512 static void windowExposedStaticMethodMethod(const v8::FunctionCallbackInfo<v8::V alue>& info) | |
| 513 { | |
| 514 TestInterface5Implementation::windowExposedStaticMethod(); | |
| 515 } | |
| 516 | |
| 517 static void windowExposedStaticMethodMethodCallback(const v8::FunctionCallbackIn fo<v8::Value>& info) | |
| 518 { | |
| 519 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); | |
| 520 TestInterface5ImplementationV8Internal::windowExposedStaticMethodMethod(info ); | |
| 521 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 522 } | |
| 523 | |
| 524 static void windowAndServiceWorkerExposedMethodMethod(const v8::FunctionCallback Info<v8::Value>& info) | |
| 525 { | |
| 526 TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder()) ; | |
| 527 impl->windowAndServiceWorkerExposedMethod(); | |
| 528 } | |
| 529 | |
| 530 static void windowAndServiceWorkerExposedMethodMethodCallback(const v8::Function CallbackInfo<v8::Value>& info) | |
| 531 { | |
| 532 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); | |
| 533 TestInterface5ImplementationV8Internal::windowAndServiceWorkerExposedMethodM ethod(info); | |
| 534 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 535 } | |
| 536 | |
| 537 static void toStringMethod(const v8::FunctionCallbackInfo<v8::Value>& info) | |
| 538 { | |
| 539 TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder()) ; | |
| 540 v8SetReturnValueString(info, impl->toString(), info.GetIsolate()); | |
| 541 } | |
| 542 | |
| 543 static void toStringMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& in fo) | |
| 544 { | |
| 545 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); | |
| 546 TestInterface5ImplementationV8Internal::toStringMethod(info); | |
| 547 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 548 } | |
| 549 | |
| 550 static void iteratorMethod(const v8::FunctionCallbackInfo<v8::Value>& info) | |
| 551 { | |
| 552 ExceptionState exceptionState(ExceptionState::ExecutionContext, "iterator", "TestInterface5", info.Holder(), info.GetIsolate()); | |
| 553 TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder()) ; | |
| 554 ScriptState* scriptState = ScriptState::current(info.GetIsolate()); | |
| 555 RawPtr<Iterator> result = impl->iterator(scriptState, exceptionState); | |
| 556 if (exceptionState.hadException()) { | |
| 557 exceptionState.throwIfNeeded(); | |
| 558 return; | |
| 559 } | |
| 560 v8SetReturnValue(info, result.release()); | |
| 561 } | |
| 562 | |
| 563 static void iteratorMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& in fo) | |
| 564 { | |
| 565 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); | |
| 566 TestInterface5ImplementationV8Internal::iteratorMethod(info); | |
| 567 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 568 } | |
| 569 | |
| 570 static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo <v8::Value>& info) | |
| 571 { | |
| 572 TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder()) ; | |
| 573 String result = impl->anonymousIndexedGetter(index); | |
| 574 if (result.isNull()) | |
| 575 return; | |
| 576 v8SetReturnValueString(info, result, info.GetIsolate()); | |
| 577 } | |
| 578 | |
| 579 static void indexedPropertyGetterCallback(uint32_t index, const v8::PropertyCall backInfo<v8::Value>& info) | |
| 580 { | |
| 581 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMIndexedProperty"); | |
| 582 TestInterface5ImplementationV8Internal::indexedPropertyGetter(index, info); | |
| 583 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 584 } | |
| 585 | |
| 586 static void indexedPropertySetter(uint32_t index, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) | |
| 587 { | |
| 588 TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder()) ; | |
| 589 TOSTRING_VOID(V8StringResource<>, propertyValue, v8Value); | |
| 590 bool result = impl->anonymousIndexedSetter(index, propertyValue); | |
| 591 if (!result) | |
| 592 return; | |
| 593 v8SetReturnValue(info, v8Value); | |
| 594 } | |
| 595 | |
| 596 static void indexedPropertySetterCallback(uint32_t index, v8::Local<v8::Value> v 8Value, const v8::PropertyCallbackInfo<v8::Value>& info) | |
| 597 { | |
| 598 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMIndexedProperty"); | |
| 599 TestInterface5ImplementationV8Internal::indexedPropertySetter(index, v8Value , info); | |
| 600 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 601 } | |
| 602 | |
| 603 static void indexedPropertyDeleter(uint32_t index, const v8::PropertyCallbackInf o<v8::Boolean>& info) | |
| 604 { | |
| 605 TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder()) ; | |
| 606 DeleteResult result = impl->anonymousIndexedDeleter(index); | |
| 607 if (result != DeleteUnknownProperty) | |
| 608 return v8SetReturnValueBool(info, result == DeleteSuccess); | |
| 609 } | |
| 610 | |
| 611 static void indexedPropertyDeleterCallback(uint32_t index, const v8::PropertyCal lbackInfo<v8::Boolean>& info) | |
| 612 { | |
| 613 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMIndexedProperty"); | |
| 614 TestInterface5ImplementationV8Internal::indexedPropertyDeleter(index, info); | |
| 615 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 616 } | |
| 617 | |
| 618 static void namedPropertyGetter(v8::Local<v8::String> name, const v8::PropertyCa llbackInfo<v8::Value>& info) | |
| 619 { | |
| 620 if (info.Holder()->HasRealNamedProperty(name)) | |
| 621 return; | |
| 622 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty()) | |
| 623 return; | |
| 624 | |
| 625 TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder()) ; | |
| 626 AtomicString propertyName = toCoreAtomicString(name); | |
| 627 String result = impl->anonymousNamedGetter(propertyName); | |
| 628 if (result.isNull()) | |
| 629 return; | |
| 630 v8SetReturnValueString(info, result, info.GetIsolate()); | |
| 631 } | |
| 632 | |
| 633 static void namedPropertyGetterCallback(v8::Local<v8::String> name, const v8::Pr opertyCallbackInfo<v8::Value>& info) | |
| 634 { | |
| 635 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty"); | |
| 636 TestInterface5ImplementationV8Internal::namedPropertyGetter(name, info); | |
| 637 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 638 } | |
| 639 | |
| 640 static void namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) | |
| 641 { | |
| 642 if (info.Holder()->HasRealNamedProperty(name)) | |
| 643 return; | |
| 644 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty()) | |
| 645 return; | |
| 646 | |
| 647 TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder()) ; | |
| 648 TOSTRING_VOID(V8StringResource<>, propertyName, name); | |
| 649 TOSTRING_VOID(V8StringResource<>, propertyValue, v8Value); | |
| 650 bool result = impl->anonymousNamedSetter(propertyName, propertyValue); | |
| 651 if (!result) | |
| 652 return; | |
| 653 v8SetReturnValue(info, v8Value); | |
| 654 } | |
| 655 | |
| 656 static void namedPropertySetterCallback(v8::Local<v8::String> name, v8::Local<v8 ::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) | |
| 657 { | |
| 658 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty"); | |
| 659 TestInterface5ImplementationV8Internal::namedPropertySetter(name, v8Value, i nfo); | |
| 660 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 661 } | |
| 662 | |
| 663 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal lbackInfo<v8::Integer>& info) | |
| 664 { | |
| 665 TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder()) ; | |
| 666 AtomicString propertyName = toCoreAtomicString(name); | |
| 667 v8::String::Utf8Value namedProperty(name); | |
| 668 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty, "TestInterface5", info.Holder(), info.GetIsolate()); | |
| 669 bool result = impl->namedPropertyQuery(propertyName, exceptionState); | |
| 670 if (exceptionState.throwIfNeeded()) | |
| 671 return; | |
| 672 if (!result) | |
| 673 return; | |
| 674 v8SetReturnValueInt(info, v8::None); | |
| 675 } | |
| 676 | |
| 677 static void namedPropertyQueryCallback(v8::Local<v8::String> name, const v8::Pro pertyCallbackInfo<v8::Integer>& info) | |
| 678 { | |
| 679 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty"); | |
| 680 TestInterface5ImplementationV8Internal::namedPropertyQuery(name, info); | |
| 681 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 682 } | |
| 683 | |
| 684 static void namedPropertyDeleter(v8::Local<v8::String> name, const v8::PropertyC allbackInfo<v8::Boolean>& info) | |
| 685 { | |
| 686 TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder()) ; | |
| 687 AtomicString propertyName = toCoreAtomicString(name); | |
| 688 DeleteResult result = impl->anonymousNamedDeleter(propertyName); | |
| 689 if (result != DeleteUnknownProperty) | |
| 690 return v8SetReturnValueBool(info, result == DeleteSuccess); | |
| 691 } | |
| 692 | |
| 693 static void namedPropertyDeleterCallback(v8::Local<v8::String> name, const v8::P ropertyCallbackInfo<v8::Boolean>& info) | |
| 694 { | |
| 695 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty"); | |
| 696 TestInterface5ImplementationV8Internal::namedPropertyDeleter(name, info); | |
| 697 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 698 } | |
| 699 | |
| 700 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i nfo) | |
| 701 { | |
| 702 TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder()) ; | |
| 703 Vector<String> names; | |
| 704 ExceptionState exceptionState(ExceptionState::EnumerationContext, "TestInter face5", info.Holder(), info.GetIsolate()); | |
| 705 impl->namedPropertyEnumerator(names, exceptionState); | |
| 706 if (exceptionState.throwIfNeeded()) | |
| 707 return; | |
| 708 v8::Handle<v8::Array> v8names = v8::Array::New(info.GetIsolate(), names.size ()); | |
| 709 for (size_t i = 0; i < names.size(); ++i) | |
| 710 v8names->Set(v8::Integer::New(info.GetIsolate(), i), v8String(info.GetIs olate(), names[i])); | |
| 711 v8SetReturnValue(info, v8names); | |
| 712 } | |
| 713 | |
| 714 static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::A rray>& info) | |
| 715 { | |
| 716 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty"); | |
| 717 TestInterface5ImplementationV8Internal::namedPropertyEnumerator(info); | |
| 718 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 719 } | |
| 720 | |
| 721 } // namespace TestInterface5ImplementationV8Internal | |
| 722 | |
| 723 void V8TestInterface5::visitDOMWrapper(ScriptWrappableBase* internalPointer, con st v8::Persistent<v8::Object>& wrapper, v8::Isolate* isolate) | |
| 724 { | |
| 725 TestInterface5Implementation* impl = internalPointer->toImpl<TestInterface5I mplementation>(); | |
| 726 v8::Local<v8::Object> creationContext = v8::Local<v8::Object>::New(isolate, wrapper); | |
| 727 V8WrapperInstantiationScope scope(creationContext, isolate); | |
| 728 TestInterface5Implementation* referencedName = impl->referencedName(); | |
| 729 if (referencedName) { | |
| 730 if (!DOMDataStore::containsWrapper<V8TestInterface5>(referencedName, iso late)) | |
| 731 wrap(referencedName, creationContext, isolate); | |
| 732 DOMDataStore::setWrapperReference<V8TestInterface5>(wrapper, referencedN ame, isolate); | |
| 733 } | |
| 734 setObjectGroup(internalPointer, wrapper, isolate); | |
| 735 } | |
| 736 | |
| 737 static const V8DOMConfiguration::AttributeConfiguration V8TestInterface5Attribut es[] = { | |
| 738 {"testInterfaceAttribute", TestInterface5ImplementationV8Internal::testInter faceAttributeAttributeGetterCallback, TestInterface5ImplementationV8Internal::te stInterfaceAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessCont rol>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfigurat ion::ExposedToAllScripts, V8DOMConfiguration::OnInstance}, | |
| 739 {"testInterfaceConstructorAttribute", TestInterface5ImplementationV8Internal ::TestInterface5ImplementationConstructorGetter, TestInterface5ImplementationV8I nternal::TestInterface5ImplementationForceSetAttributeOnThisCallback, 0, 0, cons t_cast<WrapperTypeInfo*>(&V8TestInterface5::wrapperTypeInfo), static_cast<v8::Ac cessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::DontEnum), V8D OMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance}, | |
| 740 {"doubleAttribute", TestInterface5ImplementationV8Internal::doubleAttributeA ttributeGetterCallback, TestInterface5ImplementationV8Internal::doubleAttributeA ttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), st atic_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScri pts, V8DOMConfiguration::OnInstance}, | |
| 741 {"floatAttribute", TestInterface5ImplementationV8Internal::floatAttributeAtt ributeGetterCallback, TestInterface5ImplementationV8Internal::floatAttributeAttr ibuteSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), stati c_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts , V8DOMConfiguration::OnInstance}, | |
| 742 {"unrestrictedDoubleAttribute", TestInterface5ImplementationV8Internal::unre strictedDoubleAttributeAttributeGetterCallback, TestInterface5ImplementationV8In ternal::unrestrictedDoubleAttributeAttributeSetterCallback, 0, 0, 0, static_cast <v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance}, | |
| 743 {"unrestrictedFloatAttribute", TestInterface5ImplementationV8Internal::unres trictedFloatAttributeAttributeGetterCallback, TestInterface5ImplementationV8Inte rnal::unrestrictedFloatAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8 ::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8D OMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance}, | |
| 744 {"alwaysExposedAttribute", TestInterface5ImplementationV8Internal::alwaysExp osedAttributeAttributeGetterCallback, TestInterface5ImplementationV8Internal::al waysExposedAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessCont rol>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfigurat ion::ExposedToAllScripts, V8DOMConfiguration::OnInstance}, | |
| 745 }; | |
| 746 | |
| 747 static const V8DOMConfiguration::MethodConfiguration V8TestInterface5Methods[] = { | |
| 748 {"voidMethodTestInterfaceEmptyArg", TestInterface5ImplementationV8Internal:: voidMethodTestInterfaceEmptyArgMethodCallback, 0, 1, V8DOMConfiguration::Exposed ToAllScripts}, | |
| 749 {"voidMethodDoubleArgFloatArg", TestInterface5ImplementationV8Internal::void MethodDoubleArgFloatArgMethodCallback, 0, 2, V8DOMConfiguration::ExposedToAllScr ipts}, | |
| 750 {"voidMethodUnrestrictedDoubleArgUnrestrictedFloatArg", TestInterface5Implem entationV8Internal::voidMethodUnrestrictedDoubleArgUnrestrictedFloatArgMethodCal lback, 0, 2, V8DOMConfiguration::ExposedToAllScripts}, | |
| 751 {"voidMethod", TestInterface5ImplementationV8Internal::voidMethodMethodCallb ack, TestInterface5ImplementationV8Internal::voidMethodMethodCallbackForMainWorl d, 0, V8DOMConfiguration::ExposedToAllScripts}, | |
| 752 {"alwaysExposedMethod", TestInterface5ImplementationV8Internal::alwaysExpose dMethodMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts}, | |
| 753 }; | |
| 754 | |
| 755 static void installV8TestInterface5Template(v8::Handle<v8::FunctionTemplate> fun ctionTemplate, v8::Isolate* isolate) | |
| 756 { | |
| 757 functionTemplate->ReadOnlyPrototype(); | |
| 758 | |
| 759 v8::Local<v8::Signature> defaultSignature; | |
| 760 if (!RuntimeEnabledFeatures::featureNameEnabled()) | |
| 761 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionT emplate, "", V8TestInterfaceEmpty::domTemplate(isolate), V8TestInterface5::inter nalFieldCount, 0, 0, 0, 0, 0, 0, isolate); | |
| 762 else | |
| 763 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionT emplate, "TestInterface5", V8TestInterfaceEmpty::domTemplate(isolate), V8TestInt erface5::internalFieldCount, | |
| 764 V8TestInterface5Attributes, WTF_ARRAY_LENGTH(V8TestInterface5Attribu tes), | |
| 765 0, 0, | |
| 766 V8TestInterface5Methods, WTF_ARRAY_LENGTH(V8TestInterface5Methods), | |
| 767 isolate); | |
| 768 v8::Local<v8::ObjectTemplate> instanceTemplate ALLOW_UNUSED = functionTempla te->InstanceTemplate(); | |
| 769 v8::Local<v8::ObjectTemplate> prototypeTemplate ALLOW_UNUSED = functionTempl ate->PrototypeTemplate(); | |
| 770 static const V8DOMConfiguration::ConstantConfiguration V8TestInterface5Const ants[] = { | |
| 771 {"UNSIGNED_LONG", 0, 0, 0, V8DOMConfiguration::ConstantTypeUnsignedLong} , | |
| 772 {"CONST_JAVASCRIPT", 1, 0, 0, V8DOMConfiguration::ConstantTypeShort}, | |
| 773 }; | |
| 774 V8DOMConfiguration::installConstants(functionTemplate, prototypeTemplate, V8 TestInterface5Constants, WTF_ARRAY_LENGTH(V8TestInterface5Constants), isolate); | |
| 775 functionTemplate->InstanceTemplate()->SetIndexedPropertyHandler(TestInterfac e5ImplementationV8Internal::indexedPropertyGetterCallback, TestInterface5Impleme ntationV8Internal::indexedPropertySetterCallback, 0, TestInterface5Implementatio nV8Internal::indexedPropertyDeleterCallback, indexedPropertyEnumerator<TestInter face5Implementation>); | |
| 776 functionTemplate->InstanceTemplate()->SetNamedPropertyHandler(TestInterface5 ImplementationV8Internal::namedPropertyGetterCallback, TestInterface5Implementat ionV8Internal::namedPropertySetterCallback, TestInterface5ImplementationV8Intern al::namedPropertyQueryCallback, TestInterface5ImplementationV8Internal::namedPro pertyDeleterCallback, TestInterface5ImplementationV8Internal::namedPropertyEnume ratorCallback); | |
| 777 static const V8DOMConfiguration::SymbolKeyedMethodConfiguration symbolKeyedI teratorConfiguration = { v8::Symbol::GetIterator, TestInterface5ImplementationV8 Internal::iteratorMethodCallback, 0, V8DOMConfiguration::ExposedToAllScripts }; | |
| 778 V8DOMConfiguration::installMethod(prototypeTemplate, defaultSignature, v8::D ontDelete, symbolKeyedIteratorConfiguration, isolate); | |
| 779 functionTemplate->InstanceTemplate()->SetCallAsFunctionHandler(V8TestInterfa ce5::legacyCallCustom); | |
| 780 static const V8DOMConfiguration::MethodConfiguration alwaysExposedStaticMeth odMethodConfiguration = { | |
| 781 "alwaysExposedStaticMethod", TestInterface5ImplementationV8Internal::alw aysExposedStaticMethodMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScri pts, | |
| 782 }; | |
| 783 V8DOMConfiguration::installMethod(functionTemplate, v8::Local<v8::Signature> (), v8::None, alwaysExposedStaticMethodMethodConfiguration, isolate); | |
| 784 static const V8DOMConfiguration::MethodConfiguration toStringMethodConfigura tion = { | |
| 785 "toString", TestInterface5ImplementationV8Internal::toStringMethodCallba ck, 0, 0, V8DOMConfiguration::ExposedToAllScripts, | |
| 786 }; | |
| 787 V8DOMConfiguration::installMethod(prototypeTemplate, defaultSignature, stati c_cast<v8::PropertyAttribute>(v8::DontDelete | v8::DontEnum), toStringMethodConf iguration, isolate); | |
| 788 functionTemplate->SetNativeDataProperty(v8AtomicString(isolate, "staticStrin gAttribute"), TestInterface5ImplementationV8Internal::staticStringAttributeAttri buteGetterCallback, TestInterface5ImplementationV8Internal::staticStringAttribut eAttributeSetterCallback, v8::External::New(isolate, 0), static_cast<v8::Propert yAttribute>(v8::None), v8::Handle<v8::AccessorSignature>(), static_cast<v8::Acce ssControl>(v8::DEFAULT)); | |
| 789 | |
| 790 // Custom toString template | |
| 791 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData: :from(isolate)->toStringTemplate()); | |
| 792 } | |
| 793 | |
| 794 v8::Handle<v8::FunctionTemplate> V8TestInterface5::domTemplate(v8::Isolate* isol ate) | |
| 795 { | |
| 796 return V8DOMConfiguration::domClassTemplate(isolate, const_cast<WrapperTypeI nfo*>(&wrapperTypeInfo), installV8TestInterface5Template); | |
| 797 } | |
| 798 | |
| 799 bool V8TestInterface5::hasInstance(v8::Handle<v8::Value> v8Value, v8::Isolate* i solate) | |
| 800 { | |
| 801 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Valu e); | |
| 802 } | |
| 803 | |
| 804 v8::Handle<v8::Object> V8TestInterface5::findInstanceInPrototypeChain(v8::Handle <v8::Value> v8Value, v8::Isolate* isolate) | |
| 805 { | |
| 806 return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrappe rTypeInfo, v8Value); | |
| 807 } | |
| 808 | |
| 809 TestInterface5Implementation* V8TestInterface5::toImplWithTypeCheck(v8::Isolate* isolate, v8::Handle<v8::Value> value) | |
| 810 { | |
| 811 return hasInstance(value, isolate) ? blink::toScriptWrappableBase(v8::Handle <v8::Object>::Cast(value))->toImpl<TestInterface5Implementation>() : 0; | |
| 812 } | |
| 813 | |
| 814 void V8TestInterface5::installConditionallyEnabledProperties(v8::Handle<v8::Obje ct> instanceObject, v8::Isolate* isolate) | |
| 815 { | |
| 816 v8::Local<v8::Object> prototypeObject = v8::Local<v8::Object>::Cast(instance Object->GetPrototype()); | |
| 817 ExecutionContext* context = toExecutionContext(prototypeObject->CreationCont ext()); | |
| 818 | |
| 819 if (context && (context->isWorkerGlobalScope())) { | |
| 820 static const V8DOMConfiguration::AttributeConfiguration attributeConfigu ration =\ | |
| 821 {"workerExposedAttribute", TestInterface5ImplementationV8Internal::worke rExposedAttributeAttributeGetterCallback, TestInterface5ImplementationV8Internal ::workerExposedAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::Access Control>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfig uration::ExposedToAllScripts, V8DOMConfiguration::OnInstance}; | |
| 822 V8DOMConfiguration::installAttribute(instanceObject, prototypeObject, at tributeConfiguration, isolate); | |
| 823 } | |
| 824 if (context && (context->isDocument())) { | |
| 825 static const V8DOMConfiguration::AttributeConfiguration attributeConfigu ration =\ | |
| 826 {"windowExposedAttribute", TestInterface5ImplementationV8Internal::windo wExposedAttributeAttributeGetterCallback, TestInterface5ImplementationV8Internal ::windowExposedAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::Access Control>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfig uration::ExposedToAllScripts, V8DOMConfiguration::OnInstance}; | |
| 827 V8DOMConfiguration::installAttribute(instanceObject, prototypeObject, at tributeConfiguration, isolate); | |
| 828 } | |
| 829 } | |
| 830 | |
| 831 void V8TestInterface5::installConditionallyEnabledMethods(v8::Handle<v8::Object> prototypeObject, v8::Isolate* isolate) | |
| 832 { | |
| 833 v8::Local<v8::Signature> defaultSignature = v8::Signature::New(isolate, domT emplate(isolate)); | |
| 834 ExecutionContext* context = toExecutionContext(prototypeObject->CreationCont ext()); | |
| 835 ASSERT(context); | |
| 836 | |
| 837 if (context && (context->isWorkerGlobalScope())) { | |
| 838 prototypeObject->Set(v8AtomicString(isolate, "workerExposedMethod"), v8: :FunctionTemplate::New(isolate, TestInterface5ImplementationV8Internal::workerEx posedMethodMethodCallback, v8Undefined(), defaultSignature, 0)->GetFunction()); | |
| 839 } | |
| 840 if (context && (context->isDocument())) { | |
| 841 prototypeObject->Set(v8AtomicString(isolate, "windowExposedMethod"), v8: :FunctionTemplate::New(isolate, TestInterface5ImplementationV8Internal::windowEx posedMethodMethodCallback, v8Undefined(), defaultSignature, 0)->GetFunction()); | |
| 842 } | |
| 843 if (context && (context->isWorkerGlobalScope())) { | |
| 844 prototypeObject->Set(v8AtomicString(isolate, "workerExposedStaticMethod" ), v8::FunctionTemplate::New(isolate, TestInterface5ImplementationV8Internal::wo rkerExposedStaticMethodMethodCallback, v8Undefined(), defaultSignature, 0)->GetF unction()); | |
| 845 } | |
| 846 if (context && (context->isDocument())) { | |
| 847 prototypeObject->Set(v8AtomicString(isolate, "windowExposedStaticMethod" ), v8::FunctionTemplate::New(isolate, TestInterface5ImplementationV8Internal::wi ndowExposedStaticMethodMethodCallback, v8Undefined(), defaultSignature, 0)->GetF unction()); | |
| 848 } | |
| 849 if (context && (context->isDocument() || context->isServiceWorkerGlobalScope ())) { | |
| 850 prototypeObject->Set(v8AtomicString(isolate, "windowAndServiceWorkerExpo sedMethod"), v8::FunctionTemplate::New(isolate, TestInterface5ImplementationV8In ternal::windowAndServiceWorkerExposedMethodMethodCallback, v8Undefined(), defaul tSignature, 0)->GetFunction()); | |
| 851 } | |
| 852 } | |
| 853 | |
| 854 ActiveDOMObject* V8TestInterface5::toActiveDOMObject(v8::Handle<v8::Object> wrap per) | |
| 855 { | |
| 856 return toImpl(wrapper); | |
| 857 } | |
| 858 | |
| 859 | |
| 860 void V8TestInterface5::refObject(ScriptWrappableBase* internalPointer) | |
| 861 { | |
| 862 internalPointer->toImpl<TestInterface5Implementation>()->ref(); | |
| 863 } | |
| 864 | |
| 865 void V8TestInterface5::derefObject(ScriptWrappableBase* internalPointer) | |
| 866 { | |
| 867 internalPointer->toImpl<TestInterface5Implementation>()->deref(); | |
| 868 } | |
| 869 | |
| 870 WrapperPersistentNode* V8TestInterface5::createPersistentHandle(ScriptWrappableB ase* internalPointer) | |
| 871 { | |
| 872 ASSERT_NOT_REACHED(); | |
| 873 return 0; | |
| 874 } | |
| 875 | |
| 876 template<> | |
| 877 v8::Handle<v8::Value> toV8NoInline(TestInterface5Implementation* impl, v8::Handl e<v8::Object> creationContext, v8::Isolate* isolate) | |
| 878 { | |
| 879 return toV8(impl, creationContext, isolate); | |
| 880 } | |
| 881 | |
| 882 } // namespace blink | |
| 883 #endif // ENABLE(CONDITION) | |
| OLD | NEW |