| // Copyright 2014 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! |
| |
| #include "config.h" |
| #if ENABLE(CONDITION) |
| #include "V8TestInterface.h" |
| |
| #include "bindings/core/v8/ExceptionState.h" |
| #include "bindings/core/v8/PrivateScriptRunner.h" |
| #include "bindings/core/v8/ScriptPromise.h" |
| #include "bindings/core/v8/ScriptState.h" |
| #include "bindings/core/v8/ScriptValue.h" |
| #include "bindings/core/v8/V8AbstractEventListener.h" |
| #include "bindings/core/v8/V8DOMConfiguration.h" |
| #include "bindings/core/v8/V8Document.h" |
| #include "bindings/core/v8/V8EventListenerList.h" |
| #include "bindings/core/v8/V8HiddenValue.h" |
| #include "bindings/core/v8/V8Iterator.h" |
| #include "bindings/core/v8/V8Node.h" |
| #include "bindings/core/v8/V8ObjectConstructor.h" |
| #include "bindings/core/v8/V8TestInterface.h" |
| #include "bindings/core/v8/V8TestInterfaceEmpty.h" |
| #include "bindings/core/v8/V8Window.h" |
| #include "bindings/tests/idls/core/TestImplements2.h" |
| #include "bindings/tests/idls/core/TestImplements3Implementation.h" |
| #include "bindings/tests/idls/core/TestPartialInterface.h" |
| #include "bindings/tests/idls/core/TestPartialInterfaceImplementation.h" |
| #include "core/dom/ContextFeatures.h" |
| #include "core/dom/Document.h" |
| #include "core/frame/LocalFrame.h" |
| #include "platform/RuntimeEnabledFeatures.h" |
| #include "platform/ScriptForbiddenScope.h" |
| #include "platform/TraceEvent.h" |
| #include "wtf/GetPtr.h" |
| #include "wtf/RefPtr.h" |
| |
| namespace blink { |
| |
| WrapperTypeInfo V8TestInterface::wrapperTypeInfo = { gin::kEmbedderBlink, V8TestInterface::domTemplate, V8TestInterface::refObject, V8TestInterface::derefObject, V8TestInterface::trace, V8TestInterface::toActiveDOMObject, 0, V8TestInterface::visitDOMWrapper, V8TestInterface::installConditionallyEnabledMethods, V8TestInterface::installConditionallyEnabledProperties, &V8TestInterfaceEmpty::wrapperTypeInfo, WrapperTypeInfo::WrapperTypeObjectPrototype, WrapperTypeInfo::ObjectClassId, WrapperTypeInfo::Dependent, WrapperTypeInfo::RefCountedObject }; |
| |
| // This static member must be declared by DEFINE_WRAPPERTYPEINFO in TestInterfaceImplementation.h. |
| // For details, see the comment of DEFINE_WRAPPERTYPEINFO in |
| // bindings/core/v8/ScriptWrappable.h. |
| const WrapperTypeInfo& TestInterfaceImplementation::s_wrapperTypeInfo = V8TestInterface::wrapperTypeInfo; |
| |
| namespace TestInterfaceImplementationV8Internal { |
| static void (*voidMethodPartialOverloadMethodForPartialInterface)(const v8::FunctionCallbackInfo<v8::Value>&) = 0; |
| static void (*staticVoidMethodPartialOverloadMethodForPartialInterface)(const v8::FunctionCallbackInfo<v8::Value>&) = 0; |
| static void (*promiseMethodPartialOverloadMethodForPartialInterface)(const v8::FunctionCallbackInfo<v8::Value>&) = 0; |
| static void (*staticPromiseMethodPartialOverloadMethodForPartialInterface)(const v8::FunctionCallbackInfo<v8::Value>&) = 0; |
| static void (*partial2VoidMethodMethodForPartialInterface)(const v8::FunctionCallbackInfo<v8::Value>&) = 0; |
| static void (*partial2StaticVoidMethodMethodForPartialInterface)(const v8::FunctionCallbackInfo<v8::Value>&) = 0; |
| |
| static void testInterfaceAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| v8::Handle<v8::Object> holder = info.Holder(); |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder); |
| v8SetReturnValueFast(info, WTF::getPtr(impl->testInterfaceAttribute()), impl); |
| } |
| |
| static void testInterfaceAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); |
| TestInterfaceImplementationV8Internal::testInterfaceAttributeAttributeGetter(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void testInterfaceAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) |
| { |
| v8::Handle<v8::Object> holder = info.Holder(); |
| ExceptionState exceptionState(ExceptionState::SetterContext, "testInterfaceAttribute", "TestInterface", holder, info.GetIsolate()); |
| if (!V8TestInterface::hasInstance(v8Value, info.GetIsolate())) { |
| exceptionState.throwTypeError("The provided value is not of type 'TestInterface'."); |
| exceptionState.throwIfNeeded(); |
| return; |
| } |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder); |
| TestInterfaceImplementation* cppValue = V8TestInterface::toImpl(v8::Handle<v8::Object>::Cast(v8Value)); |
| impl->setTestInterfaceAttribute(WTF::getPtr(cppValue)); |
| } |
| |
| static void testInterfaceAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); |
| TestInterfaceImplementationV8Internal::testInterfaceAttributeAttributeSetter(v8Value, info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void doubleAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| v8::Handle<v8::Object> holder = info.Holder(); |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder); |
| v8SetReturnValue(info, impl->doubleAttribute()); |
| } |
| |
| static void doubleAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); |
| TestInterfaceImplementationV8Internal::doubleAttributeAttributeGetter(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void doubleAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) |
| { |
| v8::Handle<v8::Object> holder = info.Holder(); |
| ExceptionState exceptionState(ExceptionState::SetterContext, "doubleAttribute", "TestInterface", holder, info.GetIsolate()); |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder); |
| TONATIVE_VOID_EXCEPTIONSTATE(double, cppValue, toDouble(v8Value, exceptionState), exceptionState); |
| if (!std::isfinite(cppValue)) { |
| exceptionState.throwTypeError("The provided double value is non-finite."); |
| exceptionState.throwIfNeeded(); |
| return; |
| } |
| impl->setDoubleAttribute(cppValue); |
| } |
| |
| static void doubleAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); |
| TestInterfaceImplementationV8Internal::doubleAttributeAttributeSetter(v8Value, info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void floatAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| v8::Handle<v8::Object> holder = info.Holder(); |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder); |
| v8SetReturnValue(info, impl->floatAttribute()); |
| } |
| |
| static void floatAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); |
| TestInterfaceImplementationV8Internal::floatAttributeAttributeGetter(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void floatAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) |
| { |
| v8::Handle<v8::Object> holder = info.Holder(); |
| ExceptionState exceptionState(ExceptionState::SetterContext, "floatAttribute", "TestInterface", holder, info.GetIsolate()); |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder); |
| TONATIVE_VOID_EXCEPTIONSTATE(float, cppValue, toFloat(v8Value, exceptionState), exceptionState); |
| if (!std::isfinite(cppValue)) { |
| exceptionState.throwTypeError("The provided float value is non-finite."); |
| exceptionState.throwIfNeeded(); |
| return; |
| } |
| impl->setFloatAttribute(cppValue); |
| } |
| |
| static void floatAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); |
| TestInterfaceImplementationV8Internal::floatAttributeAttributeSetter(v8Value, info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void unrestrictedDoubleAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| v8::Handle<v8::Object> holder = info.Holder(); |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder); |
| v8SetReturnValue(info, impl->unrestrictedDoubleAttribute()); |
| } |
| |
| static void unrestrictedDoubleAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); |
| TestInterfaceImplementationV8Internal::unrestrictedDoubleAttributeAttributeGetter(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void unrestrictedDoubleAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) |
| { |
| v8::Handle<v8::Object> holder = info.Holder(); |
| ExceptionState exceptionState(ExceptionState::SetterContext, "unrestrictedDoubleAttribute", "TestInterface", holder, info.GetIsolate()); |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder); |
| TONATIVE_VOID_EXCEPTIONSTATE(double, cppValue, toDouble(v8Value, exceptionState), exceptionState); |
| impl->setUnrestrictedDoubleAttribute(cppValue); |
| } |
| |
| static void unrestrictedDoubleAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); |
| TestInterfaceImplementationV8Internal::unrestrictedDoubleAttributeAttributeSetter(v8Value, info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void unrestrictedFloatAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| v8::Handle<v8::Object> holder = info.Holder(); |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder); |
| v8SetReturnValue(info, impl->unrestrictedFloatAttribute()); |
| } |
| |
| static void unrestrictedFloatAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); |
| TestInterfaceImplementationV8Internal::unrestrictedFloatAttributeAttributeGetter(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void unrestrictedFloatAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) |
| { |
| v8::Handle<v8::Object> holder = info.Holder(); |
| ExceptionState exceptionState(ExceptionState::SetterContext, "unrestrictedFloatAttribute", "TestInterface", holder, info.GetIsolate()); |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder); |
| TONATIVE_VOID_EXCEPTIONSTATE(float, cppValue, toFloat(v8Value, exceptionState), exceptionState); |
| impl->setUnrestrictedFloatAttribute(cppValue); |
| } |
| |
| static void unrestrictedFloatAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); |
| TestInterfaceImplementationV8Internal::unrestrictedFloatAttributeAttributeSetter(v8Value, info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void staticStringAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| v8SetReturnValueString(info, TestInterfaceImplementation::staticStringAttribute(), info.GetIsolate()); |
| } |
| |
| static void staticStringAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); |
| TestInterfaceImplementationV8Internal::staticStringAttributeAttributeGetter(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void staticStringAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) |
| { |
| TOSTRING_VOID(V8StringResource<>, cppValue, v8Value); |
| TestInterfaceImplementation::setStaticStringAttribute(cppValue); |
| } |
| |
| static void staticStringAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); |
| TestInterfaceImplementationV8Internal::staticStringAttributeAttributeSetter(v8Value, info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void alwaysExposedAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| v8::Handle<v8::Object> holder = info.Holder(); |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder); |
| v8SetReturnValueInt(info, impl->alwaysExposedAttribute()); |
| } |
| |
| static void alwaysExposedAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); |
| TestInterfaceImplementationV8Internal::alwaysExposedAttributeAttributeGetter(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void alwaysExposedAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) |
| { |
| v8::Handle<v8::Object> holder = info.Holder(); |
| ExceptionState exceptionState(ExceptionState::SetterContext, "alwaysExposedAttribute", "TestInterface", holder, info.GetIsolate()); |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder); |
| TONATIVE_VOID_EXCEPTIONSTATE(int, cppValue, toInt32(v8Value, exceptionState), exceptionState); |
| impl->setAlwaysExposedAttribute(cppValue); |
| } |
| |
| static void alwaysExposedAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); |
| TestInterfaceImplementationV8Internal::alwaysExposedAttributeAttributeSetter(v8Value, info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void workerExposedAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| v8::Handle<v8::Object> holder = info.Holder(); |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder); |
| v8SetReturnValueInt(info, impl->workerExposedAttribute()); |
| } |
| |
| static void workerExposedAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); |
| TestInterfaceImplementationV8Internal::workerExposedAttributeAttributeGetter(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void workerExposedAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) |
| { |
| v8::Handle<v8::Object> holder = info.Holder(); |
| ExceptionState exceptionState(ExceptionState::SetterContext, "workerExposedAttribute", "TestInterface", holder, info.GetIsolate()); |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder); |
| TONATIVE_VOID_EXCEPTIONSTATE(int, cppValue, toInt32(v8Value, exceptionState), exceptionState); |
| impl->setWorkerExposedAttribute(cppValue); |
| } |
| |
| static void workerExposedAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); |
| TestInterfaceImplementationV8Internal::workerExposedAttributeAttributeSetter(v8Value, info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void windowExposedAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| v8::Handle<v8::Object> holder = info.Holder(); |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder); |
| v8SetReturnValueInt(info, impl->windowExposedAttribute()); |
| } |
| |
| static void windowExposedAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); |
| TestInterfaceImplementationV8Internal::windowExposedAttributeAttributeGetter(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void windowExposedAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) |
| { |
| v8::Handle<v8::Object> holder = info.Holder(); |
| ExceptionState exceptionState(ExceptionState::SetterContext, "windowExposedAttribute", "TestInterface", holder, info.GetIsolate()); |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder); |
| TONATIVE_VOID_EXCEPTIONSTATE(int, cppValue, toInt32(v8Value, exceptionState), exceptionState); |
| impl->setWindowExposedAttribute(cppValue); |
| } |
| |
| static void windowExposedAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); |
| TestInterfaceImplementationV8Internal::windowExposedAttributeAttributeSetter(v8Value, info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void implementsStaticReadOnlyLongAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| v8SetReturnValueInt(info, TestInterfaceImplementation::implementsStaticReadOnlyLongAttribute()); |
| } |
| |
| static void implementsStaticReadOnlyLongAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); |
| TestInterfaceImplementationV8Internal::implementsStaticReadOnlyLongAttributeAttributeGetter(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void implementsStaticStringAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| v8SetReturnValueString(info, TestInterfaceImplementation::implementsStaticStringAttribute(), info.GetIsolate()); |
| } |
| |
| static void implementsStaticStringAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); |
| TestInterfaceImplementationV8Internal::implementsStaticStringAttributeAttributeGetter(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void implementsStaticStringAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) |
| { |
| TOSTRING_VOID(V8StringResource<>, cppValue, v8Value); |
| TestInterfaceImplementation::setImplementsStaticStringAttribute(cppValue); |
| } |
| |
| static void implementsStaticStringAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); |
| TestInterfaceImplementationV8Internal::implementsStaticStringAttributeAttributeSetter(v8Value, info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void implementsReadonlyStringAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| v8::Handle<v8::Object> holder = info.Holder(); |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder); |
| v8SetReturnValueString(info, impl->implementsReadonlyStringAttribute(), info.GetIsolate()); |
| } |
| |
| static void implementsReadonlyStringAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); |
| TestInterfaceImplementationV8Internal::implementsReadonlyStringAttributeAttributeGetter(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void implementsStringAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| v8::Handle<v8::Object> holder = info.Holder(); |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder); |
| v8SetReturnValueString(info, impl->implementsStringAttribute(), info.GetIsolate()); |
| } |
| |
| static void implementsStringAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); |
| TestInterfaceImplementationV8Internal::implementsStringAttributeAttributeGetter(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void implementsStringAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) |
| { |
| v8::Handle<v8::Object> holder = info.Holder(); |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder); |
| TOSTRING_VOID(V8StringResource<>, cppValue, v8Value); |
| impl->setImplementsStringAttribute(cppValue); |
| } |
| |
| static void implementsStringAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); |
| TestInterfaceImplementationV8Internal::implementsStringAttributeAttributeSetter(v8Value, info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void implementsNodeAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| v8::Handle<v8::Object> holder = info.Holder(); |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder); |
| v8SetReturnValueFast(info, WTF::getPtr(impl->implementsNodeAttribute()), impl); |
| } |
| |
| static void implementsNodeAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); |
| TestInterfaceImplementationV8Internal::implementsNodeAttributeAttributeGetter(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void implementsNodeAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) |
| { |
| v8::Handle<v8::Object> holder = info.Holder(); |
| ExceptionState exceptionState(ExceptionState::SetterContext, "implementsNodeAttribute", "TestInterface", holder, info.GetIsolate()); |
| if (!V8Node::hasInstance(v8Value, info.GetIsolate())) { |
| exceptionState.throwTypeError("The provided value is not of type 'Node'."); |
| exceptionState.throwIfNeeded(); |
| return; |
| } |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder); |
| Node* cppValue = V8Node::toImpl(v8::Handle<v8::Object>::Cast(v8Value)); |
| impl->setImplementsNodeAttribute(WTF::getPtr(cppValue)); |
| } |
| |
| static void implementsNodeAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); |
| TestInterfaceImplementationV8Internal::implementsNodeAttributeAttributeSetter(v8Value, info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void implementsEventHandlerAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| v8::Handle<v8::Object> holder = info.Holder(); |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder); |
| EventListener* cppValue(impl->implementsEventHandlerAttribute()); |
| v8SetReturnValue(info, cppValue ? v8::Handle<v8::Value>(V8AbstractEventListener::cast(cppValue)->getListenerObject(impl->executionContext())) : v8::Handle<v8::Value>(v8::Null(info.GetIsolate()))); |
| } |
| |
| static void implementsEventHandlerAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); |
| TestInterfaceImplementationV8Internal::implementsEventHandlerAttributeAttributeGetter(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void implementsEventHandlerAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) |
| { |
| v8::Handle<v8::Object> holder = info.Holder(); |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder); |
| moveEventListenerToNewWrapper(info.GetIsolate(), holder, impl->implementsEventHandlerAttribute(), v8Value, V8TestInterface::eventListenerCacheIndex); |
| impl->setImplementsEventHandlerAttribute(V8EventListenerList::getEventListener(ScriptState::current(info.GetIsolate()), v8Value, true, ListenerFindOrCreate)); |
| } |
| |
| static void implementsEventHandlerAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); |
| TestInterfaceImplementationV8Internal::implementsEventHandlerAttributeAttributeSetter(v8Value, info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void implementsRuntimeEnabledNodeAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| v8::Handle<v8::Object> holder = info.Holder(); |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder); |
| v8SetReturnValueFast(info, WTF::getPtr(impl->implementsRuntimeEnabledNodeAttribute()), impl); |
| } |
| |
| static void implementsRuntimeEnabledNodeAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); |
| TestInterfaceImplementationV8Internal::implementsRuntimeEnabledNodeAttributeAttributeGetter(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void implementsRuntimeEnabledNodeAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) |
| { |
| v8::Handle<v8::Object> holder = info.Holder(); |
| ExceptionState exceptionState(ExceptionState::SetterContext, "implementsRuntimeEnabledNodeAttribute", "TestInterface", holder, info.GetIsolate()); |
| if (!V8Node::hasInstance(v8Value, info.GetIsolate())) { |
| exceptionState.throwTypeError("The provided value is not of type 'Node'."); |
| exceptionState.throwIfNeeded(); |
| return; |
| } |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder); |
| Node* cppValue = V8Node::toImpl(v8::Handle<v8::Object>::Cast(v8Value)); |
| impl->setImplementsRuntimeEnabledNodeAttribute(WTF::getPtr(cppValue)); |
| } |
| |
| static void implementsRuntimeEnabledNodeAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); |
| TestInterfaceImplementationV8Internal::implementsRuntimeEnabledNodeAttributeAttributeSetter(v8Value, info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void implementsPerContextEnabledNodeAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| v8::Handle<v8::Object> holder = info.Holder(); |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder); |
| v8SetReturnValueFast(info, WTF::getPtr(impl->implementsPerContextEnabledNodeAttribute()), impl); |
| } |
| |
| static void implementsPerContextEnabledNodeAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); |
| TestInterfaceImplementationV8Internal::implementsPerContextEnabledNodeAttributeAttributeGetter(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void implementsPerContextEnabledNodeAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) |
| { |
| v8::Handle<v8::Object> holder = info.Holder(); |
| ExceptionState exceptionState(ExceptionState::SetterContext, "implementsPerContextEnabledNodeAttribute", "TestInterface", holder, info.GetIsolate()); |
| if (!V8Node::hasInstance(v8Value, info.GetIsolate())) { |
| exceptionState.throwTypeError("The provided value is not of type 'Node'."); |
| exceptionState.throwIfNeeded(); |
| return; |
| } |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder); |
| Node* cppValue = V8Node::toImpl(v8::Handle<v8::Object>::Cast(v8Value)); |
| impl->setImplementsPerContextEnabledNodeAttribute(WTF::getPtr(cppValue)); |
| } |
| |
| static void implementsPerContextEnabledNodeAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); |
| TestInterfaceImplementationV8Internal::implementsPerContextEnabledNodeAttributeAttributeSetter(v8Value, info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void implements2StaticStringAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| v8SetReturnValueString(info, TestImplements2::implements2StaticStringAttribute(), info.GetIsolate()); |
| } |
| |
| static void implements2StaticStringAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); |
| TestInterfaceImplementationV8Internal::implements2StaticStringAttributeAttributeGetter(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void implements2StaticStringAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) |
| { |
| TOSTRING_VOID(V8StringResource<>, cppValue, v8Value); |
| TestImplements2::setImplements2StaticStringAttribute(cppValue); |
| } |
| |
| static void implements2StaticStringAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); |
| TestInterfaceImplementationV8Internal::implements2StaticStringAttributeAttributeSetter(v8Value, info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void implements2StringAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| v8::Handle<v8::Object> holder = info.Holder(); |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder); |
| v8SetReturnValueString(info, TestImplements2::implements2StringAttribute(*impl), info.GetIsolate()); |
| } |
| |
| static void implements2StringAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); |
| TestInterfaceImplementationV8Internal::implements2StringAttributeAttributeGetter(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void implements2StringAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) |
| { |
| v8::Handle<v8::Object> holder = info.Holder(); |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder); |
| TOSTRING_VOID(V8StringResource<>, cppValue, v8Value); |
| TestImplements2::setImplements2StringAttribute(*impl, cppValue); |
| } |
| |
| static void implements2StringAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); |
| TestInterfaceImplementationV8Internal::implements2StringAttributeAttributeSetter(v8Value, info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void implements3StringAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| v8::Handle<v8::Object> holder = info.Holder(); |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder); |
| v8SetReturnValueString(info, TestImplements3Implementation::implements3StringAttribute(*impl), info.GetIsolate()); |
| } |
| |
| static void implements3StringAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); |
| TestInterfaceImplementationV8Internal::implements3StringAttributeAttributeGetter(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void implements3StringAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) |
| { |
| v8::Handle<v8::Object> holder = info.Holder(); |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder); |
| TOSTRING_VOID(V8StringResource<>, cppValue, v8Value); |
| TestImplements3Implementation::setImplements3StringAttribute(*impl, cppValue); |
| } |
| |
| static void implements3StringAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); |
| TestInterfaceImplementationV8Internal::implements3StringAttributeAttributeSetter(v8Value, info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void implements3StaticStringAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| v8SetReturnValueString(info, TestImplements3Implementation::implements3StaticStringAttribute(), info.GetIsolate()); |
| } |
| |
| static void implements3StaticStringAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); |
| TestInterfaceImplementationV8Internal::implements3StaticStringAttributeAttributeGetter(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void implements3StaticStringAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) |
| { |
| TOSTRING_VOID(V8StringResource<>, cppValue, v8Value); |
| TestImplements3Implementation::setImplements3StaticStringAttribute(cppValue); |
| } |
| |
| static void implements3StaticStringAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); |
| TestInterfaceImplementationV8Internal::implements3StaticStringAttributeAttributeSetter(v8Value, info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| #if ENABLE(PARTIAL_CONDITION) |
| static void partialLongAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| v8::Handle<v8::Object> holder = info.Holder(); |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder); |
| v8SetReturnValueInt(info, TestPartialInterface::partialLongAttribute(*impl)); |
| } |
| #endif // ENABLE(PARTIAL_CONDITION) |
| |
| #if ENABLE(PARTIAL_CONDITION) |
| static void partialLongAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); |
| TestInterfaceImplementationV8Internal::partialLongAttributeAttributeGetter(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| #endif // ENABLE(PARTIAL_CONDITION) |
| |
| #if ENABLE(PARTIAL_CONDITION) |
| static void partialLongAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) |
| { |
| v8::Handle<v8::Object> holder = info.Holder(); |
| ExceptionState exceptionState(ExceptionState::SetterContext, "partialLongAttribute", "TestInterface", holder, info.GetIsolate()); |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder); |
| TONATIVE_VOID_EXCEPTIONSTATE(int, cppValue, toInt32(v8Value, exceptionState), exceptionState); |
| TestPartialInterface::setPartialLongAttribute(*impl, cppValue); |
| } |
| #endif // ENABLE(PARTIAL_CONDITION) |
| |
| #if ENABLE(PARTIAL_CONDITION) |
| static void partialLongAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); |
| TestInterfaceImplementationV8Internal::partialLongAttributeAttributeSetter(v8Value, info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| #endif // ENABLE(PARTIAL_CONDITION) |
| |
| #if ENABLE(PARTIAL_CONDITION) |
| static void partialStaticLongAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| v8SetReturnValueInt(info, TestPartialInterface::partialStaticLongAttribute()); |
| } |
| #endif // ENABLE(PARTIAL_CONDITION) |
| |
| #if ENABLE(PARTIAL_CONDITION) |
| static void partialStaticLongAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); |
| TestInterfaceImplementationV8Internal::partialStaticLongAttributeAttributeGetter(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| #endif // ENABLE(PARTIAL_CONDITION) |
| |
| #if ENABLE(PARTIAL_CONDITION) |
| static void partialStaticLongAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) |
| { |
| ExceptionState exceptionState(ExceptionState::SetterContext, "partialStaticLongAttribute", "TestInterface", holder, info.GetIsolate()); |
| TONATIVE_VOID_EXCEPTIONSTATE(int, cppValue, toInt32(v8Value, exceptionState), exceptionState); |
| TestPartialInterface::setPartialStaticLongAttribute(cppValue); |
| } |
| #endif // ENABLE(PARTIAL_CONDITION) |
| |
| #if ENABLE(PARTIAL_CONDITION) |
| static void partialStaticLongAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); |
| TestInterfaceImplementationV8Internal::partialStaticLongAttributeAttributeSetter(v8Value, info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| #endif // ENABLE(PARTIAL_CONDITION) |
| |
| #if ENABLE(PARTIAL_CONDITION) |
| static void partialCallWithExecutionContextLongAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| v8::Handle<v8::Object> holder = info.Holder(); |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder); |
| ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); |
| v8SetReturnValueInt(info, TestPartialInterface::partialCallWithExecutionContextLongAttribute(executionContext, *impl)); |
| } |
| #endif // ENABLE(PARTIAL_CONDITION) |
| |
| #if ENABLE(PARTIAL_CONDITION) |
| static void partialCallWithExecutionContextLongAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); |
| TestInterfaceImplementationV8Internal::partialCallWithExecutionContextLongAttributeAttributeGetter(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| #endif // ENABLE(PARTIAL_CONDITION) |
| |
| #if ENABLE(PARTIAL_CONDITION) |
| static void partialCallWithExecutionContextLongAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) |
| { |
| v8::Handle<v8::Object> holder = info.Holder(); |
| ExceptionState exceptionState(ExceptionState::SetterContext, "partialCallWithExecutionContextLongAttribute", "TestInterface", holder, info.GetIsolate()); |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder); |
| TONATIVE_VOID_EXCEPTIONSTATE(int, cppValue, toInt32(v8Value, exceptionState), exceptionState); |
| ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); |
| TestPartialInterface::setPartialCallWithExecutionContextLongAttribute(executionContext, *impl, cppValue); |
| } |
| #endif // ENABLE(PARTIAL_CONDITION) |
| |
| #if ENABLE(PARTIAL_CONDITION) |
| static void partialCallWithExecutionContextLongAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); |
| TestInterfaceImplementationV8Internal::partialCallWithExecutionContextLongAttributeAttributeSetter(v8Value, info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| #endif // ENABLE(PARTIAL_CONDITION) |
| |
| #if ENABLE(PARTIAL_CONDITION) |
| static void partialPartialEnumTypeAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| v8::Handle<v8::Object> holder = info.Holder(); |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder); |
| v8SetReturnValueString(info, TestPartialInterface::partialPartialEnumTypeAttribute(*impl), info.GetIsolate()); |
| } |
| #endif // ENABLE(PARTIAL_CONDITION) |
| |
| #if ENABLE(PARTIAL_CONDITION) |
| static void partialPartialEnumTypeAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); |
| TestInterfaceImplementationV8Internal::partialPartialEnumTypeAttributeAttributeGetter(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| #endif // ENABLE(PARTIAL_CONDITION) |
| |
| #if ENABLE(PARTIAL_CONDITION) |
| static void partialPartialEnumTypeAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) |
| { |
| v8::Handle<v8::Object> holder = info.Holder(); |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder); |
| TOSTRING_VOID(V8StringResource<>, cppValue, v8Value); |
| String string = cppValue; |
| if (!(string == "foo" || string == "bar")) |
| return; |
| TestPartialInterface::setPartialPartialEnumTypeAttribute(*impl, cppValue); |
| } |
| #endif // ENABLE(PARTIAL_CONDITION) |
| |
| #if ENABLE(PARTIAL_CONDITION) |
| static void partialPartialEnumTypeAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); |
| TestInterfaceImplementationV8Internal::partialPartialEnumTypeAttributeAttributeSetter(v8Value, info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| #endif // ENABLE(PARTIAL_CONDITION) |
| |
| #if ENABLE(PARTIAL_CONDITION) |
| static void stringAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| v8::Handle<v8::Object> holder = info.Holder(); |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder); |
| String result; |
| if (!V8TestInterface::PrivateScript::stringAttributeAttributeGetter(toFrameIfNotDetached(info.GetIsolate()->GetCurrentContext()), impl, &result)) |
| return; |
| v8SetReturnValueString(info, result, info.GetIsolate()); |
| } |
| #endif // ENABLE(PARTIAL_CONDITION) |
| |
| #if ENABLE(PARTIAL_CONDITION) |
| static void stringAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); |
| TestInterfaceImplementationV8Internal::stringAttributeAttributeGetter(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| #endif // ENABLE(PARTIAL_CONDITION) |
| |
| #if ENABLE(PARTIAL_CONDITION) |
| static void stringAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) |
| { |
| v8::Handle<v8::Object> holder = info.Holder(); |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder); |
| TOSTRING_VOID(V8StringResource<>, cppValue, v8Value); |
| V8TestInterface::PrivateScript::stringAttributeAttributeSetter(toFrameIfNotDetached(info.GetIsolate()->GetCurrentContext()), impl, cppValue); |
| } |
| #endif // ENABLE(PARTIAL_CONDITION) |
| |
| #if ENABLE(PARTIAL_CONDITION) |
| static void stringAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); |
| TestInterfaceImplementationV8Internal::stringAttributeAttributeSetter(v8Value, info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| #endif // ENABLE(PARTIAL_CONDITION) |
| |
| static void partial2LongAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| v8::Handle<v8::Object> holder = info.Holder(); |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder); |
| v8SetReturnValueInt(info, TestPartialInterfaceImplementation::partial2LongAttribute(*impl)); |
| } |
| |
| static void partial2LongAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); |
| TestInterfaceImplementationV8Internal::partial2LongAttributeAttributeGetter(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void partial2LongAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) |
| { |
| v8::Handle<v8::Object> holder = info.Holder(); |
| ExceptionState exceptionState(ExceptionState::SetterContext, "partial2LongAttribute", "TestInterface", holder, info.GetIsolate()); |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder); |
| TONATIVE_VOID_EXCEPTIONSTATE(int, cppValue, toInt32(v8Value, exceptionState), exceptionState); |
| TestPartialInterfaceImplementation::setPartial2LongAttribute(*impl, cppValue); |
| } |
| |
| static void partial2LongAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); |
| TestInterfaceImplementationV8Internal::partial2LongAttributeAttributeSetter(v8Value, info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void partial2StaticLongAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| v8SetReturnValueInt(info, TestPartialInterfaceImplementation::partial2StaticLongAttribute()); |
| } |
| |
| static void partial2StaticLongAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); |
| TestInterfaceImplementationV8Internal::partial2StaticLongAttributeAttributeGetter(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void partial2StaticLongAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) |
| { |
| ExceptionState exceptionState(ExceptionState::SetterContext, "partial2StaticLongAttribute", "TestInterface", holder, info.GetIsolate()); |
| TONATIVE_VOID_EXCEPTIONSTATE(int, cppValue, toInt32(v8Value, exceptionState), exceptionState); |
| TestPartialInterfaceImplementation::setPartial2StaticLongAttribute(cppValue); |
| } |
| |
| static void partial2StaticLongAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); |
| TestInterfaceImplementationV8Internal::partial2StaticLongAttributeAttributeSetter(v8Value, info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void TestInterfaceImplementationConstructorGetter(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| v8::Handle<v8::Value> data = info.Data(); |
| ASSERT(data->IsExternal()); |
| V8PerContextData* perContextData = V8PerContextData::from(info.Holder()->CreationContext()); |
| if (!perContextData) |
| return; |
| v8SetReturnValue(info, perContextData->constructorForType(WrapperTypeInfo::unwrap(data))); |
| } |
| |
| static void TestInterfaceImplementationForceSetAttributeOnThis(v8::Local<v8::String> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) |
| { |
| if (info.This()->IsObject()) |
| v8::Handle<v8::Object>::Cast(info.This())->ForceSet(name, v8Value); |
| } |
| |
| static void TestInterfaceImplementationForceSetAttributeOnThisCallback(v8::Local<v8::String> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) |
| { |
| TestInterfaceImplementationV8Internal::TestInterfaceImplementationForceSetAttributeOnThis(name, v8Value, info); |
| } |
| |
| static void voidMethodTestInterfaceEmptyArgMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| if (UNLIKELY(info.Length() < 1)) { |
| V8ThrowException::throwException(createMinimumArityTypeErrorForMethod(info.GetIsolate(), "voidMethodTestInterfaceEmptyArg", "TestInterface", 1, info.Length()), info.GetIsolate()); |
| return; |
| } |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder()); |
| TestInterfaceEmpty* testInterfaceEmptyArg; |
| { |
| if (info.Length() > 0 && !V8TestInterfaceEmpty::hasInstance(info[0], info.GetIsolate())) { |
| V8ThrowException::throwTypeError(ExceptionMessages::failedToExecute("voidMethodTestInterfaceEmptyArg", "TestInterface", "parameter 1 is not of type 'TestInterfaceEmpty'."), info.GetIsolate()); |
| return; |
| } |
| testInterfaceEmptyArg = V8TestInterfaceEmpty::toImpl(v8::Handle<v8::Object>::Cast(info[0])); |
| } |
| impl->voidMethodTestInterfaceEmptyArg(testInterfaceEmptyArg); |
| } |
| |
| static void voidMethodTestInterfaceEmptyArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| TestInterfaceImplementationV8Internal::voidMethodTestInterfaceEmptyArgMethod(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void voidMethodDoubleArgFloatArgMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| ExceptionState exceptionState(ExceptionState::ExecutionContext, "voidMethodDoubleArgFloatArg", "TestInterface", info.Holder(), info.GetIsolate()); |
| if (UNLIKELY(info.Length() < 2)) { |
| setMinimumArityTypeError(exceptionState, 2, info.Length()); |
| exceptionState.throwIfNeeded(); |
| return; |
| } |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder()); |
| double doubleArg; |
| float floatArg; |
| { |
| TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(doubleArg, toDouble(info[0], exceptionState), exceptionState); |
| if (!std::isfinite(doubleArg)) { |
| exceptionState.throwTypeError("double parameter 1 is non-finite."); |
| exceptionState.throwIfNeeded(); |
| return; |
| } |
| TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(floatArg, toFloat(info[1], exceptionState), exceptionState); |
| if (!std::isfinite(floatArg)) { |
| exceptionState.throwTypeError("float parameter 2 is non-finite."); |
| exceptionState.throwIfNeeded(); |
| return; |
| } |
| } |
| impl->voidMethodDoubleArgFloatArg(doubleArg, floatArg); |
| } |
| |
| static void voidMethodDoubleArgFloatArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| TestInterfaceImplementationV8Internal::voidMethodDoubleArgFloatArgMethod(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void voidMethodUnrestrictedDoubleArgUnrestrictedFloatArgMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| ExceptionState exceptionState(ExceptionState::ExecutionContext, "voidMethodUnrestrictedDoubleArgUnrestrictedFloatArg", "TestInterface", info.Holder(), info.GetIsolate()); |
| if (UNLIKELY(info.Length() < 2)) { |
| setMinimumArityTypeError(exceptionState, 2, info.Length()); |
| exceptionState.throwIfNeeded(); |
| return; |
| } |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder()); |
| double unrestrictedDoubleArg; |
| float unrestrictedFloatArg; |
| { |
| TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(unrestrictedDoubleArg, toDouble(info[0], exceptionState), exceptionState); |
| TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(unrestrictedFloatArg, toFloat(info[1], exceptionState), exceptionState); |
| } |
| impl->voidMethodUnrestrictedDoubleArgUnrestrictedFloatArg(unrestrictedDoubleArg, unrestrictedFloatArg); |
| } |
| |
| static void voidMethodUnrestrictedDoubleArgUnrestrictedFloatArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| TestInterfaceImplementationV8Internal::voidMethodUnrestrictedDoubleArgUnrestrictedFloatArgMethod(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void voidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder()); |
| impl->voidMethod(); |
| } |
| |
| static void voidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| TestInterfaceImplementationV8Internal::voidMethodMethod(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void voidMethodMethodForMainWorld(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder()); |
| impl->voidMethod(); |
| } |
| |
| static void voidMethodMethodCallbackForMainWorld(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| TestInterfaceImplementationV8Internal::voidMethodMethodForMainWorld(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void alwaysExposedMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder()); |
| impl->alwaysExposedMethod(); |
| } |
| |
| static void alwaysExposedMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| TestInterfaceImplementationV8Internal::alwaysExposedMethodMethod(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void workerExposedMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder()); |
| impl->workerExposedMethod(); |
| } |
| |
| static void workerExposedMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| TestInterfaceImplementationV8Internal::workerExposedMethodMethod(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void windowExposedMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder()); |
| impl->windowExposedMethod(); |
| } |
| |
| static void windowExposedMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| TestInterfaceImplementationV8Internal::windowExposedMethodMethod(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void alwaysExposedStaticMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TestInterfaceImplementation::alwaysExposedStaticMethod(); |
| } |
| |
| static void alwaysExposedStaticMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| TestInterfaceImplementationV8Internal::alwaysExposedStaticMethodMethod(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void workerExposedStaticMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TestInterfaceImplementation::workerExposedStaticMethod(); |
| } |
| |
| static void workerExposedStaticMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| TestInterfaceImplementationV8Internal::workerExposedStaticMethodMethod(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void windowExposedStaticMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TestInterfaceImplementation::windowExposedStaticMethod(); |
| } |
| |
| static void windowExposedStaticMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| TestInterfaceImplementationV8Internal::windowExposedStaticMethodMethod(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void windowAndServiceWorkerExposedMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder()); |
| impl->windowAndServiceWorkerExposedMethod(); |
| } |
| |
| static void windowAndServiceWorkerExposedMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| TestInterfaceImplementationV8Internal::windowAndServiceWorkerExposedMethodMethod(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void voidMethodPartialOverload1Method(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder()); |
| impl->voidMethodPartialOverload(); |
| } |
| |
| static void voidMethodPartialOverload2Method(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| ExceptionState exceptionState(ExceptionState::ExecutionContext, "voidMethodPartialOverload", "TestInterface", info.Holder(), info.GetIsolate()); |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder()); |
| double doubleArg; |
| { |
| TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(doubleArg, toDouble(info[0], exceptionState), exceptionState); |
| if (!std::isfinite(doubleArg)) { |
| exceptionState.throwTypeError("double parameter 1 is non-finite."); |
| exceptionState.throwIfNeeded(); |
| return; |
| } |
| } |
| impl->voidMethodPartialOverload(doubleArg); |
| } |
| |
| static void staticVoidMethodPartialOverload1Method(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TestInterfaceImplementation::staticVoidMethodPartialOverload(); |
| } |
| |
| static void promiseMethodPartialOverload1Method(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder()); |
| v8SetReturnValue(info, impl->promiseMethodPartialOverload().v8Value()); |
| } |
| |
| static void promiseMethodPartialOverload2Method(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder()); |
| LocalDOMWindow* window; |
| { |
| if (info.Length() > 0 && !V8Window::hasInstance(info[0], info.GetIsolate())) { |
| v8SetReturnValue(info, ScriptPromise::rejectRaw(info.GetIsolate(), V8ThrowException::createTypeError(info.GetIsolate(), ExceptionMessages::failedToExecute("promiseMethodPartialOverload", "TestInterface", "parameter 1 is not of type 'Window'.")))); |
| return; |
| } |
| window = toDOMWindow(info[0], info.GetIsolate()); |
| } |
| v8SetReturnValue(info, impl->promiseMethodPartialOverload(window).v8Value()); |
| } |
| |
| static void staticPromiseMethodPartialOverload1Method(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| v8SetReturnValue(info, TestInterfaceImplementation::staticPromiseMethodPartialOverload().v8Value()); |
| } |
| |
| static void implementsVoidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder()); |
| impl->implementsVoidMethod(); |
| } |
| |
| static void implementsVoidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| TestInterfaceImplementationV8Internal::implementsVoidMethodMethod(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void implementsComplexMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| ExceptionState exceptionState(ExceptionState::ExecutionContext, "implementsComplexMethod", "TestInterface", info.Holder(), info.GetIsolate()); |
| if (UNLIKELY(info.Length() < 2)) { |
| setMinimumArityTypeError(exceptionState, 2, info.Length()); |
| exceptionState.throwIfNeeded(); |
| return; |
| } |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder()); |
| V8StringResource<> strArg; |
| TestInterfaceEmpty* testInterfaceEmptyArg; |
| { |
| TOSTRING_VOID_INTERNAL(strArg, info[0]); |
| if (info.Length() > 1 && !V8TestInterfaceEmpty::hasInstance(info[1], info.GetIsolate())) { |
| exceptionState.throwTypeError("parameter 2 is not of type 'TestInterfaceEmpty'."); |
| exceptionState.throwIfNeeded(); |
| return; |
| } |
| testInterfaceEmptyArg = V8TestInterfaceEmpty::toImpl(v8::Handle<v8::Object>::Cast(info[1])); |
| } |
| ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); |
| RefPtr<TestInterfaceEmpty> result = impl->implementsComplexMethod(executionContext, strArg, testInterfaceEmptyArg, exceptionState); |
| if (exceptionState.hadException()) { |
| exceptionState.throwIfNeeded(); |
| return; |
| } |
| v8SetReturnValue(info, result.release()); |
| } |
| |
| static void implementsComplexMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| TestInterfaceImplementationV8Internal::implementsComplexMethodMethod(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void implementsCustomVoidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| V8TestInterface::implementsCustomVoidMethodMethodCustom(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void implementsStaticVoidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TestInterfaceImplementation::implementsStaticVoidMethod(); |
| } |
| |
| static void implementsStaticVoidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| TestInterfaceImplementationV8Internal::implementsStaticVoidMethodMethod(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void implements2VoidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder()); |
| TestImplements2::implements2VoidMethod(*impl); |
| } |
| |
| static void implements2VoidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| TestInterfaceImplementationV8Internal::implements2VoidMethodMethod(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void implements3VoidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder()); |
| TestImplements3Implementation::implements3VoidMethod(*impl); |
| } |
| |
| static void implements3VoidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| TestInterfaceImplementationV8Internal::implements3VoidMethodMethod(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void implements3StaticVoidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TestImplements3Implementation::implements3StaticVoidMethod(); |
| } |
| |
| static void implements3StaticVoidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| TestInterfaceImplementationV8Internal::implements3StaticVoidMethodMethod(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| #if ENABLE(PARTIAL_CONDITION) |
| static void partialVoidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder()); |
| TestPartialInterface::partialVoidMethod(*impl); |
| } |
| #endif // ENABLE(PARTIAL_CONDITION) |
| |
| #if ENABLE(PARTIAL_CONDITION) |
| static void partialVoidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| TestInterfaceImplementationV8Internal::partialVoidMethodMethod(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| #endif // ENABLE(PARTIAL_CONDITION) |
| |
| #if ENABLE(PARTIAL_CONDITION) |
| static void partialStaticVoidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TestPartialInterface::partialStaticVoidMethod(); |
| } |
| #endif // ENABLE(PARTIAL_CONDITION) |
| |
| #if ENABLE(PARTIAL_CONDITION) |
| static void partialStaticVoidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| TestInterfaceImplementationV8Internal::partialStaticVoidMethodMethod(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| #endif // ENABLE(PARTIAL_CONDITION) |
| |
| #if ENABLE(PARTIAL_CONDITION) |
| static void partialVoidMethodLongArgMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| ExceptionState exceptionState(ExceptionState::ExecutionContext, "partialVoidMethodLongArg", "TestInterface", info.Holder(), info.GetIsolate()); |
| if (UNLIKELY(info.Length() < 1)) { |
| setMinimumArityTypeError(exceptionState, 1, info.Length()); |
| exceptionState.throwIfNeeded(); |
| return; |
| } |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder()); |
| int longArg; |
| { |
| TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(longArg, toInt32(info[0], exceptionState), exceptionState); |
| } |
| TestPartialInterface::partialVoidMethodLongArg(*impl, longArg); |
| } |
| #endif // ENABLE(PARTIAL_CONDITION) |
| |
| #if ENABLE(PARTIAL_CONDITION) |
| static void partialVoidMethodLongArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| TestInterfaceImplementationV8Internal::partialVoidMethodLongArgMethod(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| #endif // ENABLE(PARTIAL_CONDITION) |
| |
| #if ENABLE(PARTIAL_CONDITION) |
| static void partialCallWithExecutionContextRaisesExceptionVoidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| ExceptionState exceptionState(ExceptionState::ExecutionContext, "partialCallWithExecutionContextRaisesExceptionVoidMethod", "TestInterface", info.Holder(), info.GetIsolate()); |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder()); |
| ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); |
| TestPartialInterface::partialCallWithExecutionContextRaisesExceptionVoidMethod(executionContext, *impl, exceptionState); |
| if (exceptionState.hadException()) { |
| exceptionState.throwIfNeeded(); |
| return; |
| } |
| } |
| #endif // ENABLE(PARTIAL_CONDITION) |
| |
| #if ENABLE(PARTIAL_CONDITION) |
| static void partialCallWithExecutionContextRaisesExceptionVoidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| TestInterfaceImplementationV8Internal::partialCallWithExecutionContextRaisesExceptionVoidMethodMethod(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| #endif // ENABLE(PARTIAL_CONDITION) |
| |
| #if ENABLE(PARTIAL_CONDITION) |
| static void partialVoidMethodPartialCallbackTypeArgMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| if (UNLIKELY(info.Length() < 1)) { |
| V8ThrowException::throwException(createMinimumArityTypeErrorForMethod(info.GetIsolate(), "partialVoidMethodPartialCallbackTypeArg", "TestInterface", 1, info.Length()), info.GetIsolate()); |
| return; |
| } |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder()); |
| ScriptValue partialCallbackTypeArg; |
| { |
| partialCallbackTypeArg = ScriptValue(ScriptState::current(info.GetIsolate()), info[0]); |
| } |
| TestPartialInterface::partialVoidMethodPartialCallbackTypeArg(*impl, partialCallbackTypeArg); |
| } |
| #endif // ENABLE(PARTIAL_CONDITION) |
| |
| #if ENABLE(PARTIAL_CONDITION) |
| static void partialVoidMethodPartialCallbackTypeArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| TestInterfaceImplementationV8Internal::partialVoidMethodPartialCallbackTypeArgMethod(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| #endif // ENABLE(PARTIAL_CONDITION) |
| |
| #if ENABLE(PARTIAL_CONDITION) |
| static void shortMethodWithShortArgumentImplementedInPrivateScriptMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| ExceptionState exceptionState(ExceptionState::ExecutionContext, "shortMethodWithShortArgumentImplementedInPrivateScript", "TestInterface", info.Holder(), info.GetIsolate()); |
| if (UNLIKELY(info.Length() < 1)) { |
| setMinimumArityTypeError(exceptionState, 1, info.Length()); |
| exceptionState.throwIfNeeded(); |
| return; |
| } |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder()); |
| int value; |
| { |
| TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(value, toInt16(info[0], exceptionState), exceptionState); |
| } |
| int result = 0; |
| if (!V8TestInterface::PrivateScript::shortMethodWithShortArgumentImplementedInPrivateScriptMethod(toFrameIfNotDetached(info.GetIsolate()->GetCurrentContext()), impl, value, &result)) |
| return; |
| v8SetReturnValueInt(info, result); |
| } |
| #endif // ENABLE(PARTIAL_CONDITION) |
| |
| #if ENABLE(PARTIAL_CONDITION) |
| static void shortMethodWithShortArgumentImplementedInPrivateScriptMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| TestInterfaceImplementationV8Internal::shortMethodWithShortArgumentImplementedInPrivateScriptMethod(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| #endif // ENABLE(PARTIAL_CONDITION) |
| |
| static void partial2VoidMethod1Method(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder()); |
| TestPartialInterfaceImplementation::partial2VoidMethod(*impl); |
| } |
| |
| static void partial2StaticVoidMethod1Method(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TestPartialInterfaceImplementation::partial2StaticVoidMethod(); |
| } |
| |
| static void voidMethodPartialOverloadMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| ExceptionState exceptionState(ExceptionState::ExecutionContext, "voidMethodPartialOverload", "TestInterface", info.Holder(), info.GetIsolate()); |
| switch (std::min(1, info.Length())) { |
| case 0: |
| if (true) { |
| voidMethodPartialOverload1Method(info); |
| return; |
| } |
| break; |
| case 1: |
| if (info[0]->IsNumber()) { |
| voidMethodPartialOverload2Method(info); |
| return; |
| } |
| if (true) { |
| voidMethodPartialOverload2Method(info); |
| return; |
| } |
| break; |
| } |
| ASSERT(voidMethodPartialOverloadMethodForPartialInterface); |
| (voidMethodPartialOverloadMethodForPartialInterface)(info); |
| } |
| |
| static void voidMethodPartialOverloadMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| TestInterfaceImplementationV8Internal::voidMethodPartialOverloadMethod(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void staticVoidMethodPartialOverloadMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| ExceptionState exceptionState(ExceptionState::ExecutionContext, "staticVoidMethodPartialOverload", "TestInterface", info.Holder(), info.GetIsolate()); |
| switch (std::min(1, info.Length())) { |
| case 0: |
| if (true) { |
| staticVoidMethodPartialOverload1Method(info); |
| return; |
| } |
| break; |
| case 1: |
| break; |
| } |
| ASSERT(staticVoidMethodPartialOverloadMethodForPartialInterface); |
| (staticVoidMethodPartialOverloadMethodForPartialInterface)(info); |
| } |
| |
| static void staticVoidMethodPartialOverloadMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| TestInterfaceImplementationV8Internal::staticVoidMethodPartialOverloadMethod(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void promiseMethodPartialOverloadMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| ExceptionState exceptionState(ExceptionState::ExecutionContext, "promiseMethodPartialOverload", "TestInterface", info.Holder(), info.GetIsolate()); |
| switch (std::min(1, info.Length())) { |
| case 0: |
| if (true) { |
| promiseMethodPartialOverload1Method(info); |
| return; |
| } |
| break; |
| case 1: |
| if (V8Window::hasInstance(info[0], info.GetIsolate())) { |
| promiseMethodPartialOverload2Method(info); |
| return; |
| } |
| break; |
| } |
| ASSERT(promiseMethodPartialOverloadMethodForPartialInterface); |
| (promiseMethodPartialOverloadMethodForPartialInterface)(info); |
| } |
| |
| static void promiseMethodPartialOverloadMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| TestInterfaceImplementationV8Internal::promiseMethodPartialOverloadMethod(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void staticPromiseMethodPartialOverloadMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| ExceptionState exceptionState(ExceptionState::ExecutionContext, "staticPromiseMethodPartialOverload", "TestInterface", info.Holder(), info.GetIsolate()); |
| switch (std::min(1, info.Length())) { |
| case 0: |
| if (true) { |
| staticPromiseMethodPartialOverload1Method(info); |
| return; |
| } |
| break; |
| case 1: |
| break; |
| } |
| ASSERT(staticPromiseMethodPartialOverloadMethodForPartialInterface); |
| (staticPromiseMethodPartialOverloadMethodForPartialInterface)(info); |
| } |
| |
| static void staticPromiseMethodPartialOverloadMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| TestInterfaceImplementationV8Internal::staticPromiseMethodPartialOverloadMethod(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void partial2VoidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| ExceptionState exceptionState(ExceptionState::ExecutionContext, "partial2VoidMethod", "TestInterface", info.Holder(), info.GetIsolate()); |
| switch (std::min(1, info.Length())) { |
| case 0: |
| if (true) { |
| partial2VoidMethod1Method(info); |
| return; |
| } |
| break; |
| case 1: |
| break; |
| } |
| ASSERT(partial2VoidMethodMethodForPartialInterface); |
| (partial2VoidMethodMethodForPartialInterface)(info); |
| } |
| |
| static void partial2VoidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| TestInterfaceImplementationV8Internal::partial2VoidMethodMethod(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void partial2StaticVoidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| ExceptionState exceptionState(ExceptionState::ExecutionContext, "partial2StaticVoidMethod", "TestInterface", info.Holder(), info.GetIsolate()); |
| switch (std::min(1, info.Length())) { |
| case 0: |
| if (true) { |
| partial2StaticVoidMethod1Method(info); |
| return; |
| } |
| break; |
| case 1: |
| break; |
| } |
| ASSERT(partial2StaticVoidMethodMethodForPartialInterface); |
| (partial2StaticVoidMethodMethodForPartialInterface)(info); |
| } |
| |
| static void partial2StaticVoidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| TestInterfaceImplementationV8Internal::partial2StaticVoidMethodMethod(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void toStringMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder()); |
| v8SetReturnValueString(info, impl->toString(), info.GetIsolate()); |
| } |
| |
| static void toStringMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| TestInterfaceImplementationV8Internal::toStringMethod(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void iteratorMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| ExceptionState exceptionState(ExceptionState::ExecutionContext, "iterator", "TestInterface", info.Holder(), info.GetIsolate()); |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder()); |
| ScriptState* scriptState = ScriptState::current(info.GetIsolate()); |
| RawPtr<Iterator> result = impl->iterator(scriptState, exceptionState); |
| if (exceptionState.hadException()) { |
| exceptionState.throwIfNeeded(); |
| return; |
| } |
| v8SetReturnValue(info, result.release()); |
| } |
| |
| static void iteratorMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| TestInterfaceImplementationV8Internal::iteratorMethod(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder()); |
| String result = impl->anonymousIndexedGetter(index); |
| if (result.isNull()) |
| return; |
| v8SetReturnValueString(info, result, info.GetIsolate()); |
| } |
| |
| static void indexedPropertyGetterCallback(uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMIndexedProperty"); |
| TestInterfaceImplementationV8Internal::indexedPropertyGetter(index, info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void indexedPropertySetter(uint32_t index, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder()); |
| TOSTRING_VOID(V8StringResource<>, propertyValue, v8Value); |
| bool result = impl->anonymousIndexedSetter(index, propertyValue); |
| if (!result) |
| return; |
| v8SetReturnValue(info, v8Value); |
| } |
| |
| static void indexedPropertySetterCallback(uint32_t index, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMIndexedProperty"); |
| TestInterfaceImplementationV8Internal::indexedPropertySetter(index, v8Value, info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void indexedPropertyDeleter(uint32_t index, const v8::PropertyCallbackInfo<v8::Boolean>& info) |
| { |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder()); |
| DeleteResult result = impl->anonymousIndexedDeleter(index); |
| if (result != DeleteUnknownProperty) |
| return v8SetReturnValueBool(info, result == DeleteSuccess); |
| } |
| |
| static void indexedPropertyDeleterCallback(uint32_t index, const v8::PropertyCallbackInfo<v8::Boolean>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMIndexedProperty"); |
| TestInterfaceImplementationV8Internal::indexedPropertyDeleter(index, info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void namedPropertyGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| if (info.Holder()->HasRealNamedProperty(name)) |
| return; |
| if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty()) |
| return; |
| |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder()); |
| AtomicString propertyName = toCoreAtomicString(name); |
| String result = impl->anonymousNamedGetter(propertyName); |
| if (result.isNull()) |
| return; |
| v8SetReturnValueString(info, result, info.GetIsolate()); |
| } |
| |
| static void namedPropertyGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty"); |
| TestInterfaceImplementationV8Internal::namedPropertyGetter(name, info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| if (info.Holder()->HasRealNamedProperty(name)) |
| return; |
| if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty()) |
| return; |
| |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder()); |
| TOSTRING_VOID(V8StringResource<>, propertyName, name); |
| TOSTRING_VOID(V8StringResource<>, propertyValue, v8Value); |
| bool result = impl->anonymousNamedSetter(propertyName, propertyValue); |
| if (!result) |
| return; |
| v8SetReturnValue(info, v8Value); |
| } |
| |
| static void namedPropertySetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty"); |
| TestInterfaceImplementationV8Internal::namedPropertySetter(name, v8Value, info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Integer>& info) |
| { |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder()); |
| AtomicString propertyName = toCoreAtomicString(name); |
| v8::String::Utf8Value namedProperty(name); |
| ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty, "TestInterface", info.Holder(), info.GetIsolate()); |
| bool result = impl->namedPropertyQuery(propertyName, exceptionState); |
| if (exceptionState.throwIfNeeded()) |
| return; |
| if (!result) |
| return; |
| v8SetReturnValueInt(info, v8::None); |
| } |
| |
| static void namedPropertyQueryCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Integer>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty"); |
| TestInterfaceImplementationV8Internal::namedPropertyQuery(name, info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void namedPropertyDeleter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Boolean>& info) |
| { |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder()); |
| AtomicString propertyName = toCoreAtomicString(name); |
| DeleteResult result = impl->anonymousNamedDeleter(propertyName); |
| if (result != DeleteUnknownProperty) |
| return v8SetReturnValueBool(info, result == DeleteSuccess); |
| } |
| |
| static void namedPropertyDeleterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Boolean>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty"); |
| TestInterfaceImplementationV8Internal::namedPropertyDeleter(name, info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& info) |
| { |
| TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder()); |
| Vector<String> names; |
| ExceptionState exceptionState(ExceptionState::EnumerationContext, "TestInterface", info.Holder(), info.GetIsolate()); |
| impl->namedPropertyEnumerator(names, exceptionState); |
| if (exceptionState.throwIfNeeded()) |
| return; |
| v8::Handle<v8::Array> v8names = v8::Array::New(info.GetIsolate(), names.size()); |
| for (size_t i = 0; i < names.size(); ++i) |
| v8names->Set(v8::Integer::New(info.GetIsolate(), i), v8String(info.GetIsolate(), names[i])); |
| v8SetReturnValue(info, v8names); |
| } |
| |
| static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::Array>& info) |
| { |
| TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty"); |
| TestInterfaceImplementationV8Internal::namedPropertyEnumerator(info); |
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| } |
| |
| } // namespace TestInterfaceImplementationV8Internal |
| |
| void V8TestInterface::visitDOMWrapper(v8::Isolate* isolate, ScriptWrappableBase* scriptWrappableBase, const v8::Persistent<v8::Object>& wrapper) |
| { |
| TestInterfaceImplementation* impl = scriptWrappableBase->toImpl<TestInterfaceImplementation>(); |
| v8::Local<v8::Object> creationContext = v8::Local<v8::Object>::New(isolate, wrapper); |
| V8WrapperInstantiationScope scope(creationContext, isolate); |
| TestInterfaceImplementation* referencedName = impl->referencedName(); |
| if (referencedName) { |
| if (!DOMDataStore::containsWrapper<V8TestInterface>(referencedName, isolate)) |
| referencedName->wrap(creationContext, isolate); |
| DOMDataStore::setWrapperReference<V8TestInterface>(wrapper, referencedName, isolate); |
| } |
| setObjectGroup(isolate, scriptWrappableBase, wrapper); |
| } |
| |
| static const V8DOMConfiguration::AttributeConfiguration V8TestInterfaceAttributes[] = { |
| {"testInterfaceAttribute", TestInterfaceImplementationV8Internal::testInterfaceAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::testInterfaceAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance}, |
| {"testInterfaceConstructorAttribute", TestInterfaceImplementationV8Internal::TestInterfaceImplementationConstructorGetter, TestInterfaceImplementationV8Internal::TestInterfaceImplementationForceSetAttributeOnThisCallback, 0, 0, const_cast<WrapperTypeInfo*>(&V8TestInterface::wrapperTypeInfo), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::DontEnum), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance}, |
| {"doubleAttribute", TestInterfaceImplementationV8Internal::doubleAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::doubleAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance}, |
| {"floatAttribute", TestInterfaceImplementationV8Internal::floatAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::floatAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance}, |
| {"unrestrictedDoubleAttribute", TestInterfaceImplementationV8Internal::unrestrictedDoubleAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::unrestrictedDoubleAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance}, |
| {"unrestrictedFloatAttribute", TestInterfaceImplementationV8Internal::unrestrictedFloatAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::unrestrictedFloatAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance}, |
| {"alwaysExposedAttribute", TestInterfaceImplementationV8Internal::alwaysExposedAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::alwaysExposedAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance}, |
| {"implementsReadonlyStringAttribute", TestInterfaceImplementationV8Internal::implementsReadonlyStringAttributeAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance}, |
| {"implementsStringAttribute", TestInterfaceImplementationV8Internal::implementsStringAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::implementsStringAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance}, |
| {"implementsNodeAttribute", TestInterfaceImplementationV8Internal::implementsNodeAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::implementsNodeAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance}, |
| {"implementsEventHandlerAttribute", TestInterfaceImplementationV8Internal::implementsEventHandlerAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::implementsEventHandlerAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance}, |
| {"implements3StringAttribute", TestInterfaceImplementationV8Internal::implements3StringAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::implements3StringAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance}, |
| }; |
| |
| static const V8DOMConfiguration::MethodConfiguration V8TestInterfaceMethods[] = { |
| {"voidMethodTestInterfaceEmptyArg", TestInterfaceImplementationV8Internal::voidMethodTestInterfaceEmptyArgMethodCallback, 0, 1, V8DOMConfiguration::ExposedToAllScripts}, |
| {"voidMethodDoubleArgFloatArg", TestInterfaceImplementationV8Internal::voidMethodDoubleArgFloatArgMethodCallback, 0, 2, V8DOMConfiguration::ExposedToAllScripts}, |
| {"voidMethodUnrestrictedDoubleArgUnrestrictedFloatArg", TestInterfaceImplementationV8Internal::voidMethodUnrestrictedDoubleArgUnrestrictedFloatArgMethodCallback, 0, 2, V8DOMConfiguration::ExposedToAllScripts}, |
| {"voidMethod", TestInterfaceImplementationV8Internal::voidMethodMethodCallback, TestInterfaceImplementationV8Internal::voidMethodMethodCallbackForMainWorld, 0, V8DOMConfiguration::ExposedToAllScripts}, |
| {"alwaysExposedMethod", TestInterfaceImplementationV8Internal::alwaysExposedMethodMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts}, |
| {"implementsVoidMethod", TestInterfaceImplementationV8Internal::implementsVoidMethodMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts}, |
| {"implementsComplexMethod", TestInterfaceImplementationV8Internal::implementsComplexMethodMethodCallback, 0, 2, V8DOMConfiguration::ExposedToAllScripts}, |
| {"implementsCustomVoidMethod", TestInterfaceImplementationV8Internal::implementsCustomVoidMethodMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts}, |
| {"implements3VoidMethod", TestInterfaceImplementationV8Internal::implements3VoidMethodMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts}, |
| {"voidMethodPartialOverload", TestInterfaceImplementationV8Internal::voidMethodPartialOverloadMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts}, |
| {"promiseMethodPartialOverload", TestInterfaceImplementationV8Internal::promiseMethodPartialOverloadMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts}, |
| {"partial2VoidMethod", TestInterfaceImplementationV8Internal::partial2VoidMethodMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts}, |
| }; |
| |
| void V8TestInterface::installV8TestInterfaceTemplate(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate) |
| { |
| functionTemplate->ReadOnlyPrototype(); |
| |
| v8::Local<v8::Signature> defaultSignature; |
| if (!RuntimeEnabledFeatures::featureNameEnabled()) |
| defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTemplate, "", V8TestInterfaceEmpty::domTemplate(isolate), V8TestInterface::internalFieldCount, 0, 0, 0, 0, 0, 0, isolate); |
| else |
| defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTemplate, "TestInterface", V8TestInterfaceEmpty::domTemplate(isolate), V8TestInterface::internalFieldCount, |
| V8TestInterfaceAttributes, WTF_ARRAY_LENGTH(V8TestInterfaceAttributes), |
| 0, 0, |
| V8TestInterfaceMethods, WTF_ARRAY_LENGTH(V8TestInterfaceMethods), |
| isolate); |
| v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceTemplate(); |
| ALLOW_UNUSED_LOCAL(instanceTemplate); |
| v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->PrototypeTemplate(); |
| ALLOW_UNUSED_LOCAL(prototypeTemplate); |
| if (RuntimeEnabledFeatures::implementsFeatureNameEnabled()) { |
| static const V8DOMConfiguration::AttributeConfiguration attributeConfiguration =\ |
| {"implementsRuntimeEnabledNodeAttribute", TestInterfaceImplementationV8Internal::implementsRuntimeEnabledNodeAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::implementsRuntimeEnabledNodeAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance}; |
| V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate, attributeConfiguration, isolate); |
| } |
| if (RuntimeEnabledFeatures::implements2FeatureNameEnabled()) { |
| static const V8DOMConfiguration::AttributeConfiguration attributeConfiguration =\ |
| {"implements2StringAttribute", TestInterfaceImplementationV8Internal::implements2StringAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::implements2StringAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance}; |
| V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate, attributeConfiguration, isolate); |
| } |
| #if ENABLE(PARTIAL_CONDITION) |
| if (RuntimeEnabledFeatures::partialFeatureNameEnabled()) { |
| static const V8DOMConfiguration::AttributeConfiguration attributeConfiguration =\ |
| {"partialLongAttribute", TestInterfaceImplementationV8Internal::partialLongAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::partialLongAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance}; |
| V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate, attributeConfiguration, isolate); |
| } |
| #endif // ENABLE(PARTIAL_CONDITION) |
| #if ENABLE(PARTIAL_CONDITION) |
| if (RuntimeEnabledFeatures::partialFeatureNameEnabled()) { |
| static const V8DOMConfiguration::AttributeConfiguration attributeConfiguration =\ |
| {"partialCallWithExecutionContextLongAttribute", TestInterfaceImplementationV8Internal::partialCallWithExecutionContextLongAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::partialCallWithExecutionContextLongAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance}; |
| V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate, attributeConfiguration, isolate); |
| } |
| #endif // ENABLE(PARTIAL_CONDITION) |
| #if ENABLE(PARTIAL_CONDITION) |
| if (RuntimeEnabledFeatures::partialFeatureNameEnabled()) { |
| static const V8DOMConfiguration::AttributeConfiguration attributeConfiguration =\ |
| {"partialPartialEnumTypeAttribute", TestInterfaceImplementationV8Internal::partialPartialEnumTypeAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::partialPartialEnumTypeAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance}; |
| V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate, attributeConfiguration, isolate); |
| } |
| #endif // ENABLE(PARTIAL_CONDITION) |
| #if ENABLE(PARTIAL_CONDITION) |
| if (RuntimeEnabledFeatures::partialFeatureNameEnabled()) { |
| static const V8DOMConfiguration::AttributeConfiguration attributeConfiguration =\ |
| {"stringAttribute", TestInterfaceImplementationV8Internal::stringAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::stringAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance}; |
| V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate, attributeConfiguration, isolate); |
| } |
| #endif // ENABLE(PARTIAL_CONDITION) |
| static const V8DOMConfiguration::ConstantConfiguration V8TestInterfaceConstants[] = { |
| {"UNSIGNED_LONG", 0, 0, 0, V8DOMConfiguration::ConstantTypeUnsignedLong}, |
| {"CONST_JAVASCRIPT", 1, 0, 0, V8DOMConfiguration::ConstantTypeShort}, |
| {"IMPLEMENTS_CONSTANT_1", 1, 0, 0, V8DOMConfiguration::ConstantTypeUnsignedShort}, |
| {"IMPLEMENTS_CONSTANT_2", 2, 0, 0, V8DOMConfiguration::ConstantTypeUnsignedShort}, |
| {"PARTIAL2_UNSIGNED_SHORT", 0, 0, 0, V8DOMConfiguration::ConstantTypeUnsignedShort}, |
| }; |
| V8DOMConfiguration::installConstants(functionTemplate, prototypeTemplate, V8TestInterfaceConstants, WTF_ARRAY_LENGTH(V8TestInterfaceConstants), isolate); |
| if (RuntimeEnabledFeatures::partialFeatureNameEnabled()) { |
| static const V8DOMConfiguration::ConstantConfiguration constantConfiguration = {"PARTIAL_UNSIGNED_SHORT", 0, 0, 0, V8DOMConfiguration::ConstantTypeUnsignedShort}; |
| V8DOMConfiguration::installConstants(functionTemplate, prototypeTemplate, &constantConfiguration, 1, isolate); |
| } |
| functionTemplate->InstanceTemplate()->SetIndexedPropertyHandler(TestInterfaceImplementationV8Internal::indexedPropertyGetterCallback, TestInterfaceImplementationV8Internal::indexedPropertySetterCallback, 0, TestInterfaceImplementationV8Internal::indexedPropertyDeleterCallback, indexedPropertyEnumerator<TestInterfaceImplementation>); |
| functionTemplate->InstanceTemplate()->SetNamedPropertyHandler(TestInterfaceImplementationV8Internal::namedPropertyGetterCallback, TestInterfaceImplementationV8Internal::namedPropertySetterCallback, TestInterfaceImplementationV8Internal::namedPropertyQueryCallback, TestInterfaceImplementationV8Internal::namedPropertyDeleterCallback, TestInterfaceImplementationV8Internal::namedPropertyEnumeratorCallback); |
| static const V8DOMConfiguration::SymbolKeyedMethodConfiguration symbolKeyedIteratorConfiguration = { v8::Symbol::GetIterator, TestInterfaceImplementationV8Internal::iteratorMethodCallback, 0, V8DOMConfiguration::ExposedToAllScripts }; |
| V8DOMConfiguration::installMethod(prototypeTemplate, defaultSignature, v8::DontDelete, symbolKeyedIteratorConfiguration, isolate); |
| functionTemplate->InstanceTemplate()->SetCallAsFunctionHandler(V8TestInterface::legacyCallCustom); |
| static const V8DOMConfiguration::MethodConfiguration alwaysExposedStaticMethodMethodConfiguration = { |
| "alwaysExposedStaticMethod", TestInterfaceImplementationV8Internal::alwaysExposedStaticMethodMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts, |
| }; |
| V8DOMConfiguration::installMethod(functionTemplate, v8::Local<v8::Signature>(), v8::None, alwaysExposedStaticMethodMethodConfiguration, isolate); |
| static const V8DOMConfiguration::MethodConfiguration implementsStaticVoidMethodMethodConfiguration = { |
| "implementsStaticVoidMethod", TestInterfaceImplementationV8Internal::implementsStaticVoidMethodMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts, |
| }; |
| V8DOMConfiguration::installMethod(functionTemplate, v8::Local<v8::Signature>(), v8::None, implementsStaticVoidMethodMethodConfiguration, isolate); |
| if (RuntimeEnabledFeatures::implements2FeatureNameEnabled()) { |
| static const V8DOMConfiguration::MethodConfiguration implements2VoidMethodMethodConfiguration = { |
| "implements2VoidMethod", TestInterfaceImplementationV8Internal::implements2VoidMethodMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts, |
| }; |
| V8DOMConfiguration::installMethod(prototypeTemplate, defaultSignature, v8::None, implements2VoidMethodMethodConfiguration, isolate); |
| } |
| static const V8DOMConfiguration::MethodConfiguration implements3StaticVoidMethodMethodConfiguration = { |
| "implements3StaticVoidMethod", TestInterfaceImplementationV8Internal::implements3StaticVoidMethodMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts, |
| }; |
| V8DOMConfiguration::installMethod(functionTemplate, v8::Local<v8::Signature>(), v8::None, implements3StaticVoidMethodMethodConfiguration, isolate); |
| #if ENABLE(PARTIAL_CONDITION) |
| if (RuntimeEnabledFeatures::partialFeatureNameEnabled()) { |
| static const V8DOMConfiguration::MethodConfiguration partialVoidMethodMethodConfiguration = { |
| "partialVoidMethod", TestInterfaceImplementationV8Internal::partialVoidMethodMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts, |
| }; |
| V8DOMConfiguration::installMethod(prototypeTemplate, defaultSignature, v8::None, partialVoidMethodMethodConfiguration, isolate); |
| } |
| #endif // ENABLE(PARTIAL_CONDITION) |
| #if ENABLE(PARTIAL_CONDITION) |
| if (RuntimeEnabledFeatures::partialFeatureNameEnabled()) { |
| static const V8DOMConfiguration::MethodConfiguration partialStaticVoidMethodMethodConfiguration = { |
| "partialStaticVoidMethod", TestInterfaceImplementationV8Internal::partialStaticVoidMethodMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts, |
| }; |
| V8DOMConfiguration::installMethod(functionTemplate, v8::Local<v8::Signature>(), v8::None, partialStaticVoidMethodMethodConfiguration, isolate); |
| } |
| #endif // ENABLE(PARTIAL_CONDITION) |
| #if ENABLE(PARTIAL_CONDITION) |
| if (RuntimeEnabledFeatures::partialFeatureNameEnabled()) { |
| static const V8DOMConfiguration::MethodConfiguration partialVoidMethodLongArgMethodConfiguration = { |
| "partialVoidMethodLongArg", TestInterfaceImplementationV8Internal::partialVoidMethodLongArgMethodCallback, 0, 1, V8DOMConfiguration::ExposedToAllScripts, |
| }; |
| V8DOMConfiguration::installMethod(prototypeTemplate, defaultSignature, v8::None, partialVoidMethodLongArgMethodConfiguration, isolate); |
| } |
| #endif // ENABLE(PARTIAL_CONDITION) |
| #if ENABLE(PARTIAL_CONDITION) |
| if (RuntimeEnabledFeatures::partialFeatureNameEnabled()) { |
| static const V8DOMConfiguration::MethodConfiguration partialCallWithExecutionContextRaisesExceptionVoidMethodMethodConfiguration = { |
| "partialCallWithExecutionContextRaisesExceptionVoidMethod", TestInterfaceImplementationV8Internal::partialCallWithExecutionContextRaisesExceptionVoidMethodMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts, |
| }; |
| V8DOMConfiguration::installMethod(prototypeTemplate, defaultSignature, v8::None, partialCallWithExecutionContextRaisesExceptionVoidMethodMethodConfiguration, isolate); |
| } |
| #endif // ENABLE(PARTIAL_CONDITION) |
| #if ENABLE(PARTIAL_CONDITION) |
| if (RuntimeEnabledFeatures::partialFeatureNameEnabled()) { |
| static const V8DOMConfiguration::MethodConfiguration partialVoidMethodPartialCallbackTypeArgMethodConfiguration = { |
| "partialVoidMethodPartialCallbackTypeArg", TestInterfaceImplementationV8Internal::partialVoidMethodPartialCallbackTypeArgMethodCallback, 0, 1, V8DOMConfiguration::ExposedToAllScripts, |
| }; |
| V8DOMConfiguration::installMethod(prototypeTemplate, defaultSignature, v8::None, partialVoidMethodPartialCallbackTypeArgMethodConfiguration, isolate); |
| } |
| #endif // ENABLE(PARTIAL_CONDITION) |
| #if ENABLE(PARTIAL_CONDITION) |
| if (RuntimeEnabledFeatures::partialFeatureNameEnabled()) { |
| static const V8DOMConfiguration::MethodConfiguration shortMethodWithShortArgumentImplementedInPrivateScriptMethodConfiguration = { |
| "shortMethodWithShortArgumentImplementedInPrivateScript", TestInterfaceImplementationV8Internal::shortMethodWithShortArgumentImplementedInPrivateScriptMethodCallback, 0, 1, V8DOMConfiguration::ExposedToAllScripts, |
| }; |
| V8DOMConfiguration::installMethod(prototypeTemplate, defaultSignature, v8::None, shortMethodWithShortArgumentImplementedInPrivateScriptMethodConfiguration, isolate); |
| } |
| #endif // ENABLE(PARTIAL_CONDITION) |
| static const V8DOMConfiguration::MethodConfiguration staticVoidMethodPartialOverloadMethodConfiguration = { |
| "staticVoidMethodPartialOverload", TestInterfaceImplementationV8Internal::staticVoidMethodPartialOverloadMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts, |
| }; |
| V8DOMConfiguration::installMethod(functionTemplate, v8::Local<v8::Signature>(), v8::None, staticVoidMethodPartialOverloadMethodConfiguration, isolate); |
| static const V8DOMConfiguration::MethodConfiguration staticPromiseMethodPartialOverloadMethodConfiguration = { |
| "staticPromiseMethodPartialOverload", TestInterfaceImplementationV8Internal::staticPromiseMethodPartialOverloadMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts, |
| }; |
| V8DOMConfiguration::installMethod(functionTemplate, v8::Local<v8::Signature>(), v8::None, staticPromiseMethodPartialOverloadMethodConfiguration, isolate); |
| static const V8DOMConfiguration::MethodConfiguration partial2StaticVoidMethodMethodConfiguration = { |
| "partial2StaticVoidMethod", TestInterfaceImplementationV8Internal::partial2StaticVoidMethodMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts, |
| }; |
| V8DOMConfiguration::installMethod(functionTemplate, v8::Local<v8::Signature>(), v8::None, partial2StaticVoidMethodMethodConfiguration, isolate); |
| static const V8DOMConfiguration::MethodConfiguration toStringMethodConfiguration = { |
| "toString", TestInterfaceImplementationV8Internal::toStringMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts, |
| }; |
| V8DOMConfiguration::installMethod(prototypeTemplate, defaultSignature, static_cast<v8::PropertyAttribute>(v8::DontDelete | v8::DontEnum), toStringMethodConfiguration, isolate); |
| functionTemplate->SetNativeDataProperty(v8AtomicString(isolate, "staticStringAttribute"), TestInterfaceImplementationV8Internal::staticStringAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::staticStringAttributeAttributeSetterCallback, v8::External::New(isolate, 0), static_cast<v8::PropertyAttribute>(v8::None), v8::Handle<v8::AccessorSignature>(), static_cast<v8::AccessControl>(v8::DEFAULT)); |
| functionTemplate->SetNativeDataProperty(v8AtomicString(isolate, "implementsStaticReadOnlyLongAttribute"), TestInterfaceImplementationV8Internal::implementsStaticReadOnlyLongAttributeAttributeGetterCallback, 0, v8::External::New(isolate, 0), static_cast<v8::PropertyAttribute>(v8::None), v8::Handle<v8::AccessorSignature>(), static_cast<v8::AccessControl>(v8::DEFAULT)); |
| functionTemplate->SetNativeDataProperty(v8AtomicString(isolate, "implementsStaticStringAttribute"), TestInterfaceImplementationV8Internal::implementsStaticStringAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::implementsStaticStringAttributeAttributeSetterCallback, v8::External::New(isolate, 0), static_cast<v8::PropertyAttribute>(v8::None), v8::Handle<v8::AccessorSignature>(), static_cast<v8::AccessControl>(v8::DEFAULT)); |
| functionTemplate->SetNativeDataProperty(v8AtomicString(isolate, "implements2StaticStringAttribute"), TestInterfaceImplementationV8Internal::implements2StaticStringAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::implements2StaticStringAttributeAttributeSetterCallback, v8::External::New(isolate, 0), static_cast<v8::PropertyAttribute>(v8::None), v8::Handle<v8::AccessorSignature>(), static_cast<v8::AccessControl>(v8::DEFAULT)); |
| functionTemplate->SetNativeDataProperty(v8AtomicString(isolate, "implements3StaticStringAttribute"), TestInterfaceImplementationV8Internal::implements3StaticStringAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::implements3StaticStringAttributeAttributeSetterCallback, v8::External::New(isolate, 0), static_cast<v8::PropertyAttribute>(v8::None), v8::Handle<v8::AccessorSignature>(), static_cast<v8::AccessControl>(v8::DEFAULT)); |
| #if ENABLE(PARTIAL_CONDITION) |
| functionTemplate->SetNativeDataProperty(v8AtomicString(isolate, "partialStaticLongAttribute"), TestInterfaceImplementationV8Internal::partialStaticLongAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::partialStaticLongAttributeAttributeSetterCallback, v8::External::New(isolate, 0), static_cast<v8::PropertyAttribute>(v8::None), v8::Handle<v8::AccessorSignature>(), static_cast<v8::AccessControl>(v8::DEFAULT)); |
| #endif // ENABLE(PARTIAL_CONDITION) |
| functionTemplate->SetNativeDataProperty(v8AtomicString(isolate, "partial2StaticLongAttribute"), TestInterfaceImplementationV8Internal::partial2StaticLongAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::partial2StaticLongAttributeAttributeSetterCallback, v8::External::New(isolate, 0), static_cast<v8::PropertyAttribute>(v8::None), v8::Handle<v8::AccessorSignature>(), static_cast<v8::AccessControl>(v8::DEFAULT)); |
| |
| // Custom toString template |
| functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData::from(isolate)->toStringTemplate()); |
| } |
| |
| v8::Handle<v8::FunctionTemplate> V8TestInterface::domTemplate(v8::Isolate* isolate) |
| { |
| ASSERT(V8TestInterface::installV8TestInterfaceTemplateFunction != V8TestInterface::installV8TestInterfaceTemplate); |
| return V8DOMConfiguration::domClassTemplate(isolate, const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), V8TestInterface::installV8TestInterfaceTemplateFunction); |
| } |
| |
| bool V8TestInterface::hasInstance(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate) |
| { |
| return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Value); |
| } |
| |
| v8::Handle<v8::Object> V8TestInterface::findInstanceInPrototypeChain(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate) |
| { |
| return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrapperTypeInfo, v8Value); |
| } |
| |
| TestInterfaceImplementation* V8TestInterface::toImplWithTypeCheck(v8::Isolate* isolate, v8::Handle<v8::Value> value) |
| { |
| return hasInstance(value, isolate) ? blink::toScriptWrappableBase(v8::Handle<v8::Object>::Cast(value))->toImpl<TestInterfaceImplementation>() : 0; |
| } |
| |
| void V8TestInterface::installConditionallyEnabledProperties(v8::Handle<v8::Object> instanceObject, v8::Isolate* isolate) |
| { |
| v8::Local<v8::Object> prototypeObject = v8::Local<v8::Object>::Cast(instanceObject->GetPrototype()); |
| ExecutionContext* context = toExecutionContext(prototypeObject->CreationContext()); |
| |
| if (context && (context->isWorkerGlobalScope())) { |
| static const V8DOMConfiguration::AttributeConfiguration attributeConfiguration =\ |
| {"workerExposedAttribute", TestInterfaceImplementationV8Internal::workerExposedAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::workerExposedAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance}; |
| V8DOMConfiguration::installAttribute(instanceObject, prototypeObject, attributeConfiguration, isolate); |
| } |
| if (context && (context->isDocument())) { |
| static const V8DOMConfiguration::AttributeConfiguration attributeConfiguration =\ |
| {"windowExposedAttribute", TestInterfaceImplementationV8Internal::windowExposedAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::windowExposedAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance}; |
| V8DOMConfiguration::installAttribute(instanceObject, prototypeObject, attributeConfiguration, isolate); |
| } |
| if (context && context->isDocument() && ContextFeatures::implementsContextNameEnabled(toDocument(context))) { |
| static const V8DOMConfiguration::AttributeConfiguration attributeConfiguration =\ |
| {"implementsPerContextEnabledNodeAttribute", TestInterfaceImplementationV8Internal::implementsPerContextEnabledNodeAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::implementsPerContextEnabledNodeAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance}; |
| V8DOMConfiguration::installAttribute(instanceObject, prototypeObject, attributeConfiguration, isolate); |
| } |
| if (context && context->isDocument() && ContextFeatures::partialContextNameEnabled(toDocument(context))) { |
| static const V8DOMConfiguration::AttributeConfiguration attributeConfiguration =\ |
| {"partial2LongAttribute", TestInterfaceImplementationV8Internal::partial2LongAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::partial2LongAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance}; |
| V8DOMConfiguration::installAttribute(instanceObject, prototypeObject, attributeConfiguration, isolate); |
| } |
| if (context && context->isDocument() && ContextFeatures::partialContextNameEnabled(toDocument(context))) { |
| static const V8DOMConfiguration::AttributeConfiguration attributeConfiguration =\ |
| {"partial2StaticLongAttribute", TestInterfaceImplementationV8Internal::partial2StaticLongAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::partial2StaticLongAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance}; |
| V8DOMConfiguration::installAttribute(instanceObject, prototypeObject, attributeConfiguration, isolate); |
| } |
| } |
| |
| void V8TestInterface::installConditionallyEnabledMethods(v8::Handle<v8::Object> prototypeObject, v8::Isolate* isolate) |
| { |
| v8::Local<v8::Signature> defaultSignature = v8::Signature::New(isolate, domTemplate(isolate)); |
| ExecutionContext* context = toExecutionContext(prototypeObject->CreationContext()); |
| ASSERT(context); |
| |
| if (context && (context->isWorkerGlobalScope())) { |
| prototypeObject->Set(v8AtomicString(isolate, "workerExposedMethod"), v8::FunctionTemplate::New(isolate, TestInterfaceImplementationV8Internal::workerExposedMethodMethodCallback, v8Undefined(), defaultSignature, 0)->GetFunction()); |
| } |
| if (context && (context->isDocument())) { |
| prototypeObject->Set(v8AtomicString(isolate, "windowExposedMethod"), v8::FunctionTemplate::New(isolate, TestInterfaceImplementationV8Internal::windowExposedMethodMethodCallback, v8Undefined(), defaultSignature, 0)->GetFunction()); |
| } |
| if (context && (context->isWorkerGlobalScope())) { |
| prototypeObject->Set(v8AtomicString(isolate, "workerExposedStaticMethod"), v8::FunctionTemplate::New(isolate, TestInterfaceImplementationV8Internal::workerExposedStaticMethodMethodCallback, v8Undefined(), defaultSignature, 0)->GetFunction()); |
| } |
| if (context && (context->isDocument())) { |
| prototypeObject->Set(v8AtomicString(isolate, "windowExposedStaticMethod"), v8::FunctionTemplate::New(isolate, TestInterfaceImplementationV8Internal::windowExposedStaticMethodMethodCallback, v8Undefined(), defaultSignature, 0)->GetFunction()); |
| } |
| if (context && (context->isDocument() || context->isServiceWorkerGlobalScope())) { |
| prototypeObject->Set(v8AtomicString(isolate, "windowAndServiceWorkerExposedMethod"), v8::FunctionTemplate::New(isolate, TestInterfaceImplementationV8Internal::windowAndServiceWorkerExposedMethodMethodCallback, v8Undefined(), defaultSignature, 0)->GetFunction()); |
| } |
| } |
| |
| ActiveDOMObject* V8TestInterface::toActiveDOMObject(v8::Handle<v8::Object> wrapper) |
| { |
| return toImpl(wrapper); |
| } |
| |
| void V8TestInterface::refObject(ScriptWrappableBase* scriptWrappableBase) |
| { |
| scriptWrappableBase->toImpl<TestInterfaceImplementation>()->ref(); |
| } |
| |
| void V8TestInterface::derefObject(ScriptWrappableBase* scriptWrappableBase) |
| { |
| scriptWrappableBase->toImpl<TestInterfaceImplementation>()->deref(); |
| } |
| |
| template<> |
| v8::Handle<v8::Value> toV8NoInline(TestInterfaceImplementation* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) |
| { |
| return toV8(impl, creationContext, isolate); |
| } |
| |
| bool V8TestInterface::PrivateScript::shortMethodWithShortArgumentImplementedInPrivateScriptMethod(LocalFrame* frame, TestInterface* holderImpl, int value, int* result) |
| { |
| if (!frame) |
| return false; |
| v8::HandleScope handleScope(toIsolate(frame)); |
| ScriptForbiddenScope::AllowUserAgentScript script; |
| v8::Handle<v8::Context> contextInPrivateScript = toV8Context(frame, DOMWrapperWorld::privateScriptIsolatedWorld()); |
| if (contextInPrivateScript.IsEmpty()) |
| return false; |
| ScriptState* scriptState = ScriptState::from(contextInPrivateScript); |
| ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame); |
| if (!scriptState->executionContext()) |
| return false; |
| |
| ScriptState::Scope scope(scriptState); |
| v8::Handle<v8::Value> holder = toV8(holderImpl, scriptState->context()->Global(), scriptState->isolate()); |
| |
| v8::Handle<v8::Value> valueHandle = v8::Integer::New(scriptState->isolate(), value); |
| v8::Handle<v8::Value> argv[] = { valueHandle }; |
| ExceptionState exceptionState(ExceptionState::ExecutionContext, "shortMethodWithShortArgumentImplementedInPrivateScript", "TestInterfaceImplementation", scriptState->context()->Global(), scriptState->isolate()); |
| v8::Handle<v8::Value> v8Value = PrivateScriptRunner::runDOMMethod(scriptState, scriptStateInUserScript, "TestInterfaceImplementation", "shortMethodWithShortArgumentImplementedInPrivateScript", holder, 1, argv); |
| if (v8Value.IsEmpty()) |
| return false; |
| TONATIVE_DEFAULT_EXCEPTIONSTATE(int, cppValue, toInt16(v8Value, exceptionState), exceptionState, false); |
| *result = cppValue; |
| RELEASE_ASSERT(!exceptionState.hadException()); |
| return true; |
| } |
| |
| bool V8TestInterface::PrivateScript::stringAttributeAttributeGetter(LocalFrame* frame, TestInterfaceImplementation* holderImpl, String* result) |
| { |
| if (!frame) |
| return false; |
| v8::HandleScope handleScope(toIsolate(frame)); |
| ScriptForbiddenScope::AllowUserAgentScript script; |
| v8::Handle<v8::Context> contextInPrivateScript = toV8Context(frame, DOMWrapperWorld::privateScriptIsolatedWorld()); |
| if (contextInPrivateScript.IsEmpty()) |
| return false; |
| ScriptState* scriptState = ScriptState::from(contextInPrivateScript); |
| ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame); |
| if (!scriptState->executionContext()) |
| return false; |
| |
| ScriptState::Scope scope(scriptState); |
| v8::Handle<v8::Value> holder = toV8(holderImpl, scriptState->context()->Global(), scriptState->isolate()); |
| |
| ExceptionState exceptionState(ExceptionState::GetterContext, "stringAttribute", "TestInterfaceImplementation", scriptState->context()->Global(), scriptState->isolate()); |
| v8::Handle<v8::Value> v8Value = PrivateScriptRunner::runDOMAttributeGetter(scriptState, scriptStateInUserScript, "TestInterfaceImplementation", "stringAttribute", holder); |
| if (v8Value.IsEmpty()) |
| return false; |
| TOSTRING_DEFAULT(V8StringResource<>, cppValue, v8Value, false); |
| RELEASE_ASSERT(!exceptionState.hadException()); |
| *result = cppValue; |
| return true; |
| } |
| |
| bool V8TestInterface::PrivateScript::stringAttributeAttributeSetter(LocalFrame* frame, TestInterfaceImplementation* holderImpl, String cppValue) |
| { |
| if (!frame) |
| return false; |
| v8::HandleScope handleScope(toIsolate(frame)); |
| ScriptForbiddenScope::AllowUserAgentScript script; |
| v8::Handle<v8::Context> contextInPrivateScript = toV8Context(frame, DOMWrapperWorld::privateScriptIsolatedWorld()); |
| if (contextInPrivateScript.IsEmpty()) |
| return false; |
| ScriptState* scriptState = ScriptState::from(contextInPrivateScript); |
| ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame); |
| if (!scriptState->executionContext()) |
| return false; |
| |
| ScriptState::Scope scope(scriptState); |
| v8::Handle<v8::Value> holder = toV8(holderImpl, scriptState->context()->Global(), scriptState->isolate()); |
| |
| ExceptionState exceptionState(ExceptionState::SetterContext, "stringAttribute", "TestInterfaceImplementation", scriptState->context()->Global(), scriptState->isolate()); |
| return PrivateScriptRunner::runDOMAttributeSetter(scriptState, scriptStateInUserScript, "TestInterfaceImplementation", "stringAttribute", holder, v8String(scriptState->isolate(), cppValue)); |
| } |
| |
| InstallTemplateFunction V8TestInterface::installV8TestInterfaceTemplateFunction = (InstallTemplateFunction)&V8TestInterface::installV8TestInterfaceTemplate; |
| |
| void V8TestInterface::updateWrapperTypeInfo(InstallTemplateFunction installTemplateFunction, InstallConditionallyEnabledMethodsFunction installConditionallyEnabledMethodsFunction) |
| { |
| V8TestInterface::installV8TestInterfaceTemplateFunction = installTemplateFunction; |
| if (installConditionallyEnabledMethodsFunction) |
| V8TestInterface::wrapperTypeInfo.installConditionallyEnabledMethodsFunction = installConditionallyEnabledMethodsFunction; |
| } |
| |
| void V8TestInterface::registerVoidMethodPartialOverloadMethodForPartialInterface(void (*method)(const v8::FunctionCallbackInfo<v8::Value>&)) |
| { |
| TestInterfaceImplementationV8Internal::voidMethodPartialOverloadMethodForPartialInterface = method; |
| } |
| void V8TestInterface::registerStaticVoidMethodPartialOverloadMethodForPartialInterface(void (*method)(const v8::FunctionCallbackInfo<v8::Value>&)) |
| { |
| TestInterfaceImplementationV8Internal::staticVoidMethodPartialOverloadMethodForPartialInterface = method; |
| } |
| void V8TestInterface::registerPromiseMethodPartialOverloadMethodForPartialInterface(void (*method)(const v8::FunctionCallbackInfo<v8::Value>&)) |
| { |
| TestInterfaceImplementationV8Internal::promiseMethodPartialOverloadMethodForPartialInterface = method; |
| } |
| void V8TestInterface::registerStaticPromiseMethodPartialOverloadMethodForPartialInterface(void (*method)(const v8::FunctionCallbackInfo<v8::Value>&)) |
| { |
| TestInterfaceImplementationV8Internal::staticPromiseMethodPartialOverloadMethodForPartialInterface = method; |
| } |
| void V8TestInterface::registerPartial2VoidMethodMethodForPartialInterface(void (*method)(const v8::FunctionCallbackInfo<v8::Value>&)) |
| { |
| TestInterfaceImplementationV8Internal::partial2VoidMethodMethodForPartialInterface = method; |
| } |
| void V8TestInterface::registerPartial2StaticVoidMethodMethodForPartialInterface(void (*method)(const v8::FunctionCallbackInfo<v8::Value>&)) |
| { |
| TestInterfaceImplementationV8Internal::partial2StaticVoidMethodMethodForPartialInterface = method; |
| } |
| } // namespace blink |
| #endif // ENABLE(CONDITION) |