blob: 70693ce2b7ea6303f1d36613f95791b7a4780daa [file] [log] [blame]
// 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 "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/UnionTypesCore.h"
#include "bindings/core/v8/V8AbstractEventListener.h"
#include "bindings/core/v8/V8DOMConfiguration.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/V8TestInterface2.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/Document.h"
#include "core/frame/LocalFrame.h"
#include "core/frame/UseCounter.h"
#include "core/inspector/ConsoleMessage.h"
#include "platform/RuntimeEnabledFeatures.h"
#include "platform/ScriptForbiddenScope.h"
#include "wtf/GetPtr.h"
#include "wtf/RefPtr.h"
namespace blink {
// Suppress warning: global constructors, because struct WrapperTypeInfo is trivial
// and does not depend on another global objects.
#if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wglobal-constructors"
#endif
WrapperTypeInfo V8TestInterface::wrapperTypeInfo = { gin::kEmbedderBlink, V8TestInterface::domTemplate, V8TestInterface::trace, V8TestInterface::toActiveScriptWrappable, V8TestInterface::visitDOMWrapper, V8TestInterface::preparePrototypeAndInterfaceObject, nullptr, "TestInterface", &V8TestInterfaceEmpty::wrapperTypeInfo, WrapperTypeInfo::WrapperTypeObjectPrototype, WrapperTypeInfo::ObjectClassId, WrapperTypeInfo::NotInheritFromEventTarget, WrapperTypeInfo::Dependent };
#if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG)
#pragma clang diagnostic pop
#endif
// 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::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
v8SetReturnValueFast(info, WTF::getPtr(impl->testInterfaceAttribute()), impl);
}
static void testInterfaceAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
UseCounter::countIfNotPrivateScript(info.GetIsolate(), currentExecutionContext(info.GetIsolate()), UseCounter::V8TestInterface_TestInterfaceAttribute_AttributeGetter);
TestInterfaceImplementationV8Internal::testInterfaceAttributeAttributeGetter(info);
}
static void testInterfaceAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
ExceptionState exceptionState(ExceptionState::SetterContext, "testInterfaceAttribute", "TestInterface", holder, info.GetIsolate());
TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
TestInterfaceImplementation* cppValue = V8TestInterface::toImplWithTypeCheck(info.GetIsolate(), v8Value);
if (!cppValue) {
exceptionState.throwTypeError("The provided value is not of type 'TestInterface'.");
exceptionState.throwIfNeeded();
return;
}
impl->setTestInterfaceAttribute(cppValue);
}
static void testInterfaceAttributeAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Value> v8Value = info[0];
UseCounter::countIfNotPrivateScript(info.GetIsolate(), currentExecutionContext(info.GetIsolate()), UseCounter::V8TestInterface_TestInterfaceAttribute_AttributeSetter);
TestInterfaceImplementationV8Internal::testInterfaceAttributeAttributeSetter(v8Value, info);
}
static void doubleAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
v8SetReturnValue(info, impl->doubleAttribute());
}
static void doubleAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementationV8Internal::doubleAttributeAttributeGetter(info);
}
static void doubleAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
ExceptionState exceptionState(ExceptionState::SetterContext, "doubleAttribute", "TestInterface", holder, info.GetIsolate());
TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
double cppValue = toRestrictedDouble(info.GetIsolate(), v8Value, exceptionState);
if (exceptionState.throwIfNeeded())
return;
impl->setDoubleAttribute(cppValue);
}
static void doubleAttributeAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Value> v8Value = info[0];
TestInterfaceImplementationV8Internal::doubleAttributeAttributeSetter(v8Value, info);
}
static void floatAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
v8SetReturnValue(info, impl->floatAttribute());
}
static void floatAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementationV8Internal::floatAttributeAttributeGetter(info);
}
static void floatAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
ExceptionState exceptionState(ExceptionState::SetterContext, "floatAttribute", "TestInterface", holder, info.GetIsolate());
TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
float cppValue = toRestrictedFloat(info.GetIsolate(), v8Value, exceptionState);
if (exceptionState.throwIfNeeded())
return;
impl->setFloatAttribute(cppValue);
}
static void floatAttributeAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Value> v8Value = info[0];
TestInterfaceImplementationV8Internal::floatAttributeAttributeSetter(v8Value, info);
}
static void unrestrictedDoubleAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
v8SetReturnValue(info, impl->unrestrictedDoubleAttribute());
}
static void unrestrictedDoubleAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementationV8Internal::unrestrictedDoubleAttributeAttributeGetter(info);
}
static void unrestrictedDoubleAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
ExceptionState exceptionState(ExceptionState::SetterContext, "unrestrictedDoubleAttribute", "TestInterface", holder, info.GetIsolate());
TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
double cppValue = toDouble(info.GetIsolate(), v8Value, exceptionState);
if (exceptionState.throwIfNeeded())
return;
impl->setUnrestrictedDoubleAttribute(cppValue);
}
static void unrestrictedDoubleAttributeAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Value> v8Value = info[0];
TestInterfaceImplementationV8Internal::unrestrictedDoubleAttributeAttributeSetter(v8Value, info);
}
static void unrestrictedFloatAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
v8SetReturnValue(info, impl->unrestrictedFloatAttribute());
}
static void unrestrictedFloatAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementationV8Internal::unrestrictedFloatAttributeAttributeGetter(info);
}
static void unrestrictedFloatAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
ExceptionState exceptionState(ExceptionState::SetterContext, "unrestrictedFloatAttribute", "TestInterface", holder, info.GetIsolate());
TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
float cppValue = toFloat(info.GetIsolate(), v8Value, exceptionState);
if (exceptionState.throwIfNeeded())
return;
impl->setUnrestrictedFloatAttribute(cppValue);
}
static void unrestrictedFloatAttributeAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Value> v8Value = info[0];
TestInterfaceImplementationV8Internal::unrestrictedFloatAttributeAttributeSetter(v8Value, info);
}
static void testEnumAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
v8SetReturnValueString(info, impl->testEnumAttribute(), info.GetIsolate());
}
static void testEnumAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementationV8Internal::testEnumAttributeAttributeGetter(info);
}
static void testEnumAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
ExceptionState exceptionState(ExceptionState::SetterContext, "testEnumAttribute", "TestInterface", holder, info.GetIsolate());
TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
V8StringResource<> cppValue = v8Value;
if (!cppValue.prepare())
return;
const char* validValues[] = {
"",
"EnumValue1",
"EnumValue2",
"EnumValue3",
};
if (!isValidEnum(cppValue, validValues, WTF_ARRAY_LENGTH(validValues), "TestEnum", exceptionState)) {
currentExecutionContext(info.GetIsolate())->addConsoleMessage(ConsoleMessage::create(JSMessageSource, WarningMessageLevel, exceptionState.message()));
return;
}
impl->setTestEnumAttribute(cppValue);
}
static void testEnumAttributeAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Value> v8Value = info[0];
TestInterfaceImplementationV8Internal::testEnumAttributeAttributeSetter(v8Value, info);
}
static void stringOrDoubleAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
StringOrDouble result;
impl->stringOrDoubleAttribute(result);
v8SetReturnValue(info, result);
}
static void stringOrDoubleAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementationV8Internal::stringOrDoubleAttributeAttributeGetter(info);
}
static void stringOrDoubleAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
ExceptionState exceptionState(ExceptionState::SetterContext, "stringOrDoubleAttribute", "TestInterface", holder, info.GetIsolate());
TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
StringOrDouble cppValue;
V8StringOrDouble::toImpl(info.GetIsolate(), v8Value, cppValue, UnionTypeConversionMode::NotNullable, exceptionState);
if (exceptionState.throwIfNeeded())
return;
impl->setStringOrDoubleAttribute(cppValue);
}
static void stringOrDoubleAttributeAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Value> v8Value = info[0];
TestInterfaceImplementationV8Internal::stringOrDoubleAttributeAttributeSetter(v8Value, info);
}
static void conditionalLongAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
v8SetReturnValueInt(info, impl->conditionalLongAttribute());
}
static void conditionalLongAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementationV8Internal::conditionalLongAttributeAttributeGetter(info);
}
static void conditionalLongAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
ExceptionState exceptionState(ExceptionState::SetterContext, "conditionalLongAttribute", "TestInterface", holder, info.GetIsolate());
TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
int cppValue = toInt32(info.GetIsolate(), v8Value, NormalConversion, exceptionState);
if (exceptionState.throwIfNeeded())
return;
impl->setConditionalLongAttribute(cppValue);
}
static void conditionalLongAttributeAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Value> v8Value = info[0];
TestInterfaceImplementationV8Internal::conditionalLongAttributeAttributeSetter(v8Value, info);
}
static void conditionalReadOnlyLongAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
v8SetReturnValueInt(info, impl->conditionalReadOnlyLongAttribute());
}
static void conditionalReadOnlyLongAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementationV8Internal::conditionalReadOnlyLongAttributeAttributeGetter(info);
}
static void staticStringAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8SetReturnValueString(info, TestInterfaceImplementation::staticStringAttribute(), info.GetIsolate());
}
static void staticStringAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementationV8Internal::staticStringAttributeAttributeGetter(info);
}
static void staticStringAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info)
{
V8StringResource<> cppValue = v8Value;
if (!cppValue.prepare())
return;
TestInterfaceImplementation::setStaticStringAttribute(cppValue);
}
static void staticStringAttributeAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Value> v8Value = info[0];
TestInterfaceImplementationV8Internal::staticStringAttributeAttributeSetter(v8Value, info);
}
static void staticReturnDOMWrapperAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8SetReturnValue(info, WTF::getPtr(TestInterfaceImplementation::staticReturnDOMWrapperAttribute()), info.GetIsolate()->GetCurrentContext()->Global());
}
static void staticReturnDOMWrapperAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementationV8Internal::staticReturnDOMWrapperAttributeAttributeGetter(info);
}
static void staticReturnDOMWrapperAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
ExceptionState exceptionState(ExceptionState::SetterContext, "staticReturnDOMWrapperAttribute", "TestInterface", holder, info.GetIsolate());
TestInterfaceImplementation* cppValue = V8TestInterface::toImplWithTypeCheck(info.GetIsolate(), v8Value);
if (!cppValue) {
exceptionState.throwTypeError("The provided value is not of type 'TestInterface'.");
exceptionState.throwIfNeeded();
return;
}
TestInterfaceImplementation::setStaticReturnDOMWrapperAttribute(cppValue);
}
static void staticReturnDOMWrapperAttributeAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Value> v8Value = info[0];
TestInterfaceImplementationV8Internal::staticReturnDOMWrapperAttributeAttributeSetter(v8Value, info);
}
static void staticReadOnlyStringAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8SetReturnValueString(info, TestInterfaceImplementation::staticReadOnlyStringAttribute(), info.GetIsolate());
}
static void staticReadOnlyStringAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementationV8Internal::staticReadOnlyStringAttributeAttributeGetter(info);
}
static void staticReadOnlyReturnDOMWrapperAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementation* cppValue(WTF::getPtr(TestInterfaceImplementation::staticReadOnlyReturnDOMWrapperAttribute()));
if (cppValue && DOMDataStore::setReturnValue(info.GetReturnValue(), cppValue))
return;
v8::Local<v8::Value> v8Value(toV8(cppValue, holder, info.GetIsolate()));
if (!v8Value.IsEmpty()) {
V8HiddenValue::setHiddenValue(ScriptState::current(info.GetIsolate()), holder, v8AtomicString(info.GetIsolate(), "staticReadOnlyReturnDOMWrapperAttribute"), v8Value);
v8SetReturnValue(info, v8Value);
}
}
static void staticReadOnlyReturnDOMWrapperAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementationV8Internal::staticReadOnlyReturnDOMWrapperAttributeAttributeGetter(info);
}
static void staticConditionalReadOnlyLongAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8SetReturnValueInt(info, TestInterfaceImplementation::staticConditionalReadOnlyLongAttribute());
}
static void staticConditionalReadOnlyLongAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementationV8Internal::staticConditionalReadOnlyLongAttributeAttributeGetter(info);
}
static void legacyInterfaceTypeCheckingAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
v8SetReturnValueFast(info, WTF::getPtr(impl->legacyInterfaceTypeCheckingAttribute()), impl);
}
static void legacyInterfaceTypeCheckingAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementationV8Internal::legacyInterfaceTypeCheckingAttributeAttributeGetter(info);
}
static void legacyInterfaceTypeCheckingAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
TestInterfaceEmpty* cppValue = V8TestInterfaceEmpty::toImplWithTypeCheck(info.GetIsolate(), v8Value);
impl->setLegacyInterfaceTypeCheckingAttribute(cppValue);
}
static void legacyInterfaceTypeCheckingAttributeAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Value> v8Value = info[0];
TestInterfaceImplementationV8Internal::legacyInterfaceTypeCheckingAttributeAttributeSetter(v8Value, info);
}
static void alwaysExposedAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
v8SetReturnValueInt(info, impl->alwaysExposedAttribute());
}
static void alwaysExposedAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementationV8Internal::alwaysExposedAttributeAttributeGetter(info);
}
static void alwaysExposedAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
ExceptionState exceptionState(ExceptionState::SetterContext, "alwaysExposedAttribute", "TestInterface", holder, info.GetIsolate());
TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
int cppValue = toInt32(info.GetIsolate(), v8Value, NormalConversion, exceptionState);
if (exceptionState.throwIfNeeded())
return;
impl->setAlwaysExposedAttribute(cppValue);
}
static void alwaysExposedAttributeAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Value> v8Value = info[0];
TestInterfaceImplementationV8Internal::alwaysExposedAttributeAttributeSetter(v8Value, info);
}
static void workerExposedAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
v8SetReturnValueInt(info, impl->workerExposedAttribute());
}
static void workerExposedAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementationV8Internal::workerExposedAttributeAttributeGetter(info);
}
static void workerExposedAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
ExceptionState exceptionState(ExceptionState::SetterContext, "workerExposedAttribute", "TestInterface", holder, info.GetIsolate());
TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
int cppValue = toInt32(info.GetIsolate(), v8Value, NormalConversion, exceptionState);
if (exceptionState.throwIfNeeded())
return;
impl->setWorkerExposedAttribute(cppValue);
}
static void workerExposedAttributeAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Value> v8Value = info[0];
TestInterfaceImplementationV8Internal::workerExposedAttributeAttributeSetter(v8Value, info);
}
static void windowExposedAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
v8SetReturnValueInt(info, impl->windowExposedAttribute());
}
static void windowExposedAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementationV8Internal::windowExposedAttributeAttributeGetter(info);
}
static void windowExposedAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
ExceptionState exceptionState(ExceptionState::SetterContext, "windowExposedAttribute", "TestInterface", holder, info.GetIsolate());
TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
int cppValue = toInt32(info.GetIsolate(), v8Value, NormalConversion, exceptionState);
if (exceptionState.throwIfNeeded())
return;
impl->setWindowExposedAttribute(cppValue);
}
static void windowExposedAttributeAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Value> v8Value = info[0];
TestInterfaceImplementationV8Internal::windowExposedAttributeAttributeSetter(v8Value, info);
}
static void lenientThisAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = V8TestInterface::findInstanceInPrototypeChain(info.This(), info.GetIsolate());
if (holder.IsEmpty())
return; // Return silently because of [LenientThis].
TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
v8SetReturnValue(info, impl->lenientThisAttribute().v8Value());
}
static void lenientThisAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementationV8Internal::lenientThisAttributeAttributeGetter(info);
}
static void lenientThisAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = V8TestInterface::findInstanceInPrototypeChain(info.This(), info.GetIsolate());
if (holder.IsEmpty())
return; // Return silently because of [LenientThis].
TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
ScriptValue cppValue = ScriptValue(ScriptState::current(info.GetIsolate()), v8Value);
impl->setLenientThisAttribute(cppValue);
}
static void lenientThisAttributeAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Value> v8Value = info[0];
TestInterfaceImplementationV8Internal::lenientThisAttributeAttributeSetter(v8Value, info);
}
static void implementsStaticReadOnlyLongAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8SetReturnValueInt(info, TestInterfaceImplementation::implementsStaticReadOnlyLongAttribute());
}
static void implementsStaticReadOnlyLongAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementationV8Internal::implementsStaticReadOnlyLongAttributeAttributeGetter(info);
}
static void implementsStaticStringAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8SetReturnValueString(info, TestInterfaceImplementation::implementsStaticStringAttribute(), info.GetIsolate());
}
static void implementsStaticStringAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementationV8Internal::implementsStaticStringAttributeAttributeGetter(info);
}
static void implementsStaticStringAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info)
{
V8StringResource<> cppValue = v8Value;
if (!cppValue.prepare())
return;
TestInterfaceImplementation::setImplementsStaticStringAttribute(cppValue);
}
static void implementsStaticStringAttributeAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Value> v8Value = info[0];
TestInterfaceImplementationV8Internal::implementsStaticStringAttributeAttributeSetter(v8Value, info);
}
static void implementsReadonlyStringAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
v8SetReturnValueString(info, impl->implementsReadonlyStringAttribute(), info.GetIsolate());
}
static void implementsReadonlyStringAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementationV8Internal::implementsReadonlyStringAttributeAttributeGetter(info);
}
static void implementsStringAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
v8SetReturnValueString(info, impl->implementsStringAttribute(), info.GetIsolate());
}
static void implementsStringAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementationV8Internal::implementsStringAttributeAttributeGetter(info);
}
static void implementsStringAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
V8StringResource<> cppValue = v8Value;
if (!cppValue.prepare())
return;
impl->setImplementsStringAttribute(cppValue);
}
static void implementsStringAttributeAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Value> v8Value = info[0];
TestInterfaceImplementationV8Internal::implementsStringAttributeAttributeSetter(v8Value, info);
}
static void implementsNodeAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
v8SetReturnValueFast(info, WTF::getPtr(impl->implementsNodeAttribute()), impl);
}
static void implementsNodeAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementationV8Internal::implementsNodeAttributeAttributeGetter(info);
}
static void implementsNodeAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
ExceptionState exceptionState(ExceptionState::SetterContext, "implementsNodeAttribute", "TestInterface", holder, info.GetIsolate());
TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
Node* cppValue = V8Node::toImplWithTypeCheck(info.GetIsolate(), v8Value);
if (!cppValue) {
exceptionState.throwTypeError("The provided value is not of type 'Node'.");
exceptionState.throwIfNeeded();
return;
}
impl->setImplementsNodeAttribute(cppValue);
}
static void implementsNodeAttributeAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Value> v8Value = info[0];
TestInterfaceImplementationV8Internal::implementsNodeAttributeAttributeSetter(v8Value, info);
}
static void implementsEventHandlerAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
EventListener* cppValue(WTF::getPtr(impl->implementsEventHandlerAttribute()));
v8SetReturnValue(info, cppValue ? v8::Local<v8::Value>(V8AbstractEventListener::cast(cppValue)->getListenerObject(impl->getExecutionContext())) : v8::Local<v8::Value>(v8::Null(info.GetIsolate())));
}
static void implementsEventHandlerAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementationV8Internal::implementsEventHandlerAttributeAttributeGetter(info);
}
static void implementsEventHandlerAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<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(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Value> v8Value = info[0];
TestInterfaceImplementationV8Internal::implementsEventHandlerAttributeAttributeSetter(v8Value, info);
}
static void implementsRuntimeEnabledNodeAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
v8SetReturnValueFast(info, WTF::getPtr(impl->implementsRuntimeEnabledNodeAttribute()), impl);
}
static void implementsRuntimeEnabledNodeAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementationV8Internal::implementsRuntimeEnabledNodeAttributeAttributeGetter(info);
}
static void implementsRuntimeEnabledNodeAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
ExceptionState exceptionState(ExceptionState::SetterContext, "implementsRuntimeEnabledNodeAttribute", "TestInterface", holder, info.GetIsolate());
TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
Node* cppValue = V8Node::toImplWithTypeCheck(info.GetIsolate(), v8Value);
if (!cppValue) {
exceptionState.throwTypeError("The provided value is not of type 'Node'.");
exceptionState.throwIfNeeded();
return;
}
impl->setImplementsRuntimeEnabledNodeAttribute(cppValue);
}
static void implementsRuntimeEnabledNodeAttributeAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Value> v8Value = info[0];
TestInterfaceImplementationV8Internal::implementsRuntimeEnabledNodeAttributeAttributeSetter(v8Value, info);
}
static void implements2StaticStringAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8SetReturnValueString(info, TestImplements2::implements2StaticStringAttribute(), info.GetIsolate());
}
static void implements2StaticStringAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementationV8Internal::implements2StaticStringAttributeAttributeGetter(info);
}
static void implements2StaticStringAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info)
{
V8StringResource<> cppValue = v8Value;
if (!cppValue.prepare())
return;
TestImplements2::setImplements2StaticStringAttribute(cppValue);
}
static void implements2StaticStringAttributeAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Value> v8Value = info[0];
TestInterfaceImplementationV8Internal::implements2StaticStringAttributeAttributeSetter(v8Value, info);
}
static void implements2StringAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
v8SetReturnValueString(info, TestImplements2::implements2StringAttribute(*impl), info.GetIsolate());
}
static void implements2StringAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementationV8Internal::implements2StringAttributeAttributeGetter(info);
}
static void implements2StringAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
V8StringResource<> cppValue = v8Value;
if (!cppValue.prepare())
return;
TestImplements2::setImplements2StringAttribute(*impl, cppValue);
}
static void implements2StringAttributeAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Value> v8Value = info[0];
TestInterfaceImplementationV8Internal::implements2StringAttributeAttributeSetter(v8Value, info);
}
static void implements3StringAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
v8SetReturnValueString(info, TestImplements3Implementation::implements3StringAttribute(*impl), info.GetIsolate());
}
static void implements3StringAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementationV8Internal::implements3StringAttributeAttributeGetter(info);
}
static void implements3StringAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
V8StringResource<> cppValue = v8Value;
if (!cppValue.prepare())
return;
TestImplements3Implementation::setImplements3StringAttribute(*impl, cppValue);
}
static void implements3StringAttributeAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Value> v8Value = info[0];
TestInterfaceImplementationV8Internal::implements3StringAttributeAttributeSetter(v8Value, info);
}
static void implements3StaticStringAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8SetReturnValueString(info, TestImplements3Implementation::implements3StaticStringAttribute(), info.GetIsolate());
}
static void implements3StaticStringAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementationV8Internal::implements3StaticStringAttributeAttributeGetter(info);
}
static void implements3StaticStringAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info)
{
V8StringResource<> cppValue = v8Value;
if (!cppValue.prepare())
return;
TestImplements3Implementation::setImplements3StaticStringAttribute(cppValue);
}
static void implements3StaticStringAttributeAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Value> v8Value = info[0];
TestInterfaceImplementationV8Internal::implements3StaticStringAttributeAttributeSetter(v8Value, info);
}
static void partialLongAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
v8SetReturnValueInt(info, TestPartialInterface::partialLongAttribute(*impl));
}
static void partialLongAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementationV8Internal::partialLongAttributeAttributeGetter(info);
}
static void partialLongAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
ExceptionState exceptionState(ExceptionState::SetterContext, "partialLongAttribute", "TestInterface", holder, info.GetIsolate());
TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
int cppValue = toInt32(info.GetIsolate(), v8Value, NormalConversion, exceptionState);
if (exceptionState.throwIfNeeded())
return;
TestPartialInterface::setPartialLongAttribute(*impl, cppValue);
}
static void partialLongAttributeAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Value> v8Value = info[0];
TestInterfaceImplementationV8Internal::partialLongAttributeAttributeSetter(v8Value, info);
}
static void partialStaticLongAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8SetReturnValueInt(info, TestPartialInterface::partialStaticLongAttribute());
}
static void partialStaticLongAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementationV8Internal::partialStaticLongAttributeAttributeGetter(info);
}
static void partialStaticLongAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
ExceptionState exceptionState(ExceptionState::SetterContext, "partialStaticLongAttribute", "TestInterface", holder, info.GetIsolate());
int cppValue = toInt32(info.GetIsolate(), v8Value, NormalConversion, exceptionState);
if (exceptionState.throwIfNeeded())
return;
TestPartialInterface::setPartialStaticLongAttribute(cppValue);
}
static void partialStaticLongAttributeAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Value> v8Value = info[0];
TestInterfaceImplementationV8Internal::partialStaticLongAttributeAttributeSetter(v8Value, info);
}
static void partialCallWithExecutionContextLongAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate());
v8SetReturnValueInt(info, TestPartialInterface::partialCallWithExecutionContextLongAttribute(executionContext, *impl));
}
static void partialCallWithExecutionContextLongAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementationV8Internal::partialCallWithExecutionContextLongAttributeAttributeGetter(info);
}
static void partialCallWithExecutionContextLongAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
ExceptionState exceptionState(ExceptionState::SetterContext, "partialCallWithExecutionContextLongAttribute", "TestInterface", holder, info.GetIsolate());
TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
int cppValue = toInt32(info.GetIsolate(), v8Value, NormalConversion, exceptionState);
if (exceptionState.throwIfNeeded())
return;
ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate());
TestPartialInterface::setPartialCallWithExecutionContextLongAttribute(executionContext, *impl, cppValue);
}
static void partialCallWithExecutionContextLongAttributeAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Value> v8Value = info[0];
TestInterfaceImplementationV8Internal::partialCallWithExecutionContextLongAttributeAttributeSetter(v8Value, info);
}
static void partialPartialEnumTypeAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
v8SetReturnValueString(info, TestPartialInterface::partialPartialEnumTypeAttribute(*impl), info.GetIsolate());
}
static void partialPartialEnumTypeAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementationV8Internal::partialPartialEnumTypeAttributeAttributeGetter(info);
}
static void partialPartialEnumTypeAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
ExceptionState exceptionState(ExceptionState::SetterContext, "partialPartialEnumTypeAttribute", "TestInterface", holder, info.GetIsolate());
TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
V8StringResource<> cppValue = v8Value;
if (!cppValue.prepare())
return;
const char* validValues[] = {
"foo",
"bar",
};
if (!isValidEnum(cppValue, validValues, WTF_ARRAY_LENGTH(validValues), "PartialEnumType", exceptionState)) {
currentExecutionContext(info.GetIsolate())->addConsoleMessage(ConsoleMessage::create(JSMessageSource, WarningMessageLevel, exceptionState.message()));
return;
}
TestPartialInterface::setPartialPartialEnumTypeAttribute(*impl, cppValue);
}
static void partialPartialEnumTypeAttributeAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Value> v8Value = info[0];
TestInterfaceImplementationV8Internal::partialPartialEnumTypeAttributeAttributeSetter(v8Value, info);
}
static void stringAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
String result;
if (!V8TestInterface::PrivateScript::stringAttributeAttributeGetter(toLocalFrame(toFrameIfNotDetached(info.GetIsolate()->GetCurrentContext())), impl, &result))
return;
v8SetReturnValueString(info, result, info.GetIsolate());
}
static void stringAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementationV8Internal::stringAttributeAttributeGetter(info);
}
static void stringAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
V8StringResource<> cppValue = v8Value;
if (!cppValue.prepare())
return;
V8TestInterface::PrivateScript::stringAttributeAttributeSetter(toLocalFrame(toFrameIfNotDetached(info.GetIsolate()->GetCurrentContext())), impl, cppValue);
}
static void stringAttributeAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Value> v8Value = info[0];
TestInterfaceImplementationV8Internal::stringAttributeAttributeSetter(v8Value, info);
}
static void partial2LongAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
v8SetReturnValueInt(info, TestPartialInterfaceImplementation::partial2LongAttribute(*impl));
}
static void partial2LongAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementationV8Internal::partial2LongAttributeAttributeGetter(info);
}
static void partial2LongAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
ExceptionState exceptionState(ExceptionState::SetterContext, "partial2LongAttribute", "TestInterface", holder, info.GetIsolate());
TestInterfaceImplementation* impl = V8TestInterface::toImpl(holder);
int cppValue = toInt32(info.GetIsolate(), v8Value, NormalConversion, exceptionState);
if (exceptionState.throwIfNeeded())
return;
TestPartialInterfaceImplementation::setPartial2LongAttribute(*impl, cppValue);
}
static void partial2LongAttributeAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Value> v8Value = info[0];
TestInterfaceImplementationV8Internal::partial2LongAttributeAttributeSetter(v8Value, info);
}
static void partial2StaticLongAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8SetReturnValueInt(info, TestPartialInterfaceImplementation::partial2StaticLongAttribute());
}
static void partial2StaticLongAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementationV8Internal::partial2StaticLongAttributeAttributeGetter(info);
}
static void partial2StaticLongAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
ExceptionState exceptionState(ExceptionState::SetterContext, "partial2StaticLongAttribute", "TestInterface", holder, info.GetIsolate());
int cppValue = toInt32(info.GetIsolate(), v8Value, NormalConversion, exceptionState);
if (exceptionState.throwIfNeeded())
return;
TestPartialInterfaceImplementation::setPartial2StaticLongAttribute(cppValue);
}
static void partial2StaticLongAttributeAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Value> v8Value = info[0];
TestInterfaceImplementationV8Internal::partial2StaticLongAttributeAttributeSetter(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;
{
testInterfaceEmptyArg = V8TestInterfaceEmpty::toImplWithTypeCheck(info.GetIsolate(), info[0]);
if (!testInterfaceEmptyArg) {
V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::failedToExecute("voidMethodTestInterfaceEmptyArg", "TestInterface", "parameter 1 is not of type 'TestInterfaceEmpty'."));
return;
}
}
impl->voidMethodTestInterfaceEmptyArg(testInterfaceEmptyArg);
}
static void voidMethodTestInterfaceEmptyArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementationV8Internal::voidMethodTestInterfaceEmptyArgMethod(info);
}
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;
{
doubleArg = toRestrictedDouble(info.GetIsolate(), info[0], exceptionState);
if (exceptionState.throwIfNeeded())
return;
floatArg = toRestrictedFloat(info.GetIsolate(), info[1], exceptionState);
if (exceptionState.throwIfNeeded())
return;
}
impl->voidMethodDoubleArgFloatArg(doubleArg, floatArg);
}
static void voidMethodDoubleArgFloatArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementationV8Internal::voidMethodDoubleArgFloatArgMethod(info);
}
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;
{
unrestrictedDoubleArg = toDouble(info.GetIsolate(), info[0], exceptionState);
if (exceptionState.throwIfNeeded())
return;
unrestrictedFloatArg = toFloat(info.GetIsolate(), info[1], exceptionState);
if (exceptionState.throwIfNeeded())
return;
}
impl->voidMethodUnrestrictedDoubleArgUnrestrictedFloatArg(unrestrictedDoubleArg, unrestrictedFloatArg);
}
static void voidMethodUnrestrictedDoubleArgUnrestrictedFloatArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementationV8Internal::voidMethodUnrestrictedDoubleArgUnrestrictedFloatArgMethod(info);
}
static void voidMethodTestEnumArgMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
{
ExceptionState exceptionState(ExceptionState::ExecutionContext, "voidMethodTestEnumArg", "TestInterface", info.Holder(), info.GetIsolate());
if (UNLIKELY(info.Length() < 1)) {
setMinimumArityTypeError(exceptionState, 1, info.Length());
exceptionState.throwIfNeeded();
return;
}
TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder());
V8StringResource<> testEnumArg;
{
testEnumArg = info[0];
if (!testEnumArg.prepare())
return;
const char* validValues[] = {
"",
"EnumValue1",
"EnumValue2",
"EnumValue3",
};
if (!isValidEnum(testEnumArg, validValues, WTF_ARRAY_LENGTH(validValues), "TestEnum", exceptionState)) {
exceptionState.throwIfNeeded();
return;
}
}
impl->voidMethodTestEnumArg(testEnumArg);
}
static void voidMethodTestEnumArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementationV8Internal::voidMethodTestEnumArgMethod(info);
}
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)
{
TestInterfaceImplementationV8Internal::voidMethodMethod(info);
}
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)
{
TestInterfaceImplementationV8Internal::voidMethodMethodForMainWorld(info);
}
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)
{
TestInterfaceImplementationV8Internal::alwaysExposedMethodMethod(info);
}
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)
{
TestInterfaceImplementationV8Internal::workerExposedMethodMethod(info);
}
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)
{
TestInterfaceImplementationV8Internal::windowExposedMethodMethod(info);
}
static void alwaysExposedStaticMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementation::alwaysExposedStaticMethod();
}
static void alwaysExposedStaticMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementationV8Internal::alwaysExposedStaticMethodMethod(info);
}
static void workerExposedStaticMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementation::workerExposedStaticMethod();
}
static void workerExposedStaticMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementationV8Internal::workerExposedStaticMethodMethod(info);
}
static void windowExposedStaticMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementation::windowExposedStaticMethod();
}
static void windowExposedStaticMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementationV8Internal::windowExposedStaticMethodMethod(info);
}
static void staticReturnDOMWrapperMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8SetReturnValue(info, TestInterfaceImplementation::staticReturnDOMWrapperMethod(), info.GetIsolate()->GetCurrentContext()->Global());
}
static void staticReturnDOMWrapperMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementationV8Internal::staticReturnDOMWrapperMethodMethod(info);
}
static void methodWithExposedAndRuntimeEnabledFlagMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder());
impl->methodWithExposedAndRuntimeEnabledFlag();
}
static void methodWithExposedAndRuntimeEnabledFlagMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementationV8Internal::methodWithExposedAndRuntimeEnabledFlagMethod(info);
}
static void overloadMethodWithExposedAndRuntimeEnabledFlag1Method(const v8::FunctionCallbackInfo<v8::Value>& info)
{
ExceptionState exceptionState(ExceptionState::ExecutionContext, "overloadMethodWithExposedAndRuntimeEnabledFlag", "TestInterface", info.Holder(), info.GetIsolate());
TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder());
int longArg;
{
longArg = toInt32(info.GetIsolate(), info[0], NormalConversion, exceptionState);
if (exceptionState.throwIfNeeded())
return;
}
impl->overloadMethodWithExposedAndRuntimeEnabledFlag(longArg);
}
static void overloadMethodWithExposedAndRuntimeEnabledFlag2Method(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder());
V8StringResource<> string;
{
string = info[0];
if (!string.prepare())
return;
}
impl->overloadMethodWithExposedAndRuntimeEnabledFlag(string);
}
static void overloadMethodWithExposedAndRuntimeEnabledFlag3Method(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder());
DOMWindow* window;
{
window = toDOMWindow(info.GetIsolate(), info[0]);
if (!window) {
V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::failedToExecute("overloadMethodWithExposedAndRuntimeEnabledFlag", "TestInterface", "parameter 1 is not of type 'Window'."));
return;
}
}
impl->overloadMethodWithExposedAndRuntimeEnabledFlag(window);
}
static void overloadMethodWithExposedAndRuntimeEnabledFlagMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
{
ExceptionState exceptionState(ExceptionState::ExecutionContext, "overloadMethodWithExposedAndRuntimeEnabledFlag", "TestInterface", info.Holder(), info.GetIsolate());
switch (std::min(1, info.Length())) {
case 1:
if (RuntimeEnabledFeatures::featureName2Enabled()) {
if (V8Window::hasInstance(info[0], info.GetIsolate())) {
overloadMethodWithExposedAndRuntimeEnabledFlag3Method(info);
return;
}
}
if (info[0]->IsNumber()) {
overloadMethodWithExposedAndRuntimeEnabledFlag1Method(info);
return;
}
if (RuntimeEnabledFeatures::featureNameEnabled()) {
if (true) {
overloadMethodWithExposedAndRuntimeEnabledFlag2Method(info);
return;
}
}
if (true) {
overloadMethodWithExposedAndRuntimeEnabledFlag1Method(info);
return;
}
break;
default:
break;
}
if (info.Length() < 1) {
exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, info.Length()));
exceptionState.throwIfNeeded();
return;
}
exceptionState.throwTypeError("No function was found that matched the signature provided.");
exceptionState.throwIfNeeded();
return;
}
static void overloadMethodWithExposedAndRuntimeEnabledFlagMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementationV8Internal::overloadMethodWithExposedAndRuntimeEnabledFlagMethod(info);
}
static void methodWithExposedHavingRuntimeEnabldFlagMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder());
impl->methodWithExposedHavingRuntimeEnabldFlag();
}
static void methodWithExposedHavingRuntimeEnabldFlagMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementationV8Internal::methodWithExposedHavingRuntimeEnabldFlagMethod(info);
}
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)
{
TestInterfaceImplementationV8Internal::windowAndServiceWorkerExposedMethodMethod(info);
}
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;
{
doubleArg = toRestrictedDouble(info.GetIsolate(), info[0], exceptionState);
if (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());
DOMWindow* window;
{
window = toDOMWindow(info.GetIsolate(), info[0]);
if (!window) {
v8SetReturnValue(info, ScriptPromise::rejectRaw(ScriptState::current(info.GetIsolate()), V8ThrowException::createTypeError(info.GetIsolate(), ExceptionMessages::failedToExecute("promiseMethodPartialOverload", "TestInterface", "parameter 1 is not of type 'Window'."))));
return;
}
}
v8SetReturnValue(info, impl->promiseMethodPartialOverload(window).v8Value());
}
static void staticPromiseMethodPartialOverload1Method(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8SetReturnValue(info, TestInterfaceImplementation::staticPromiseMethodPartialOverload().v8Value());
}
static void legacyInterfaceTypeCheckingMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
{
if (UNLIKELY(info.Length() < 1)) {
V8ThrowException::throwException(createMinimumArityTypeErrorForMethod(info.GetIsolate(), "legacyInterfaceTypeCheckingMethod", "TestInterface", 1, info.Length()), info.GetIsolate());
return;
}
TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder());
TestInterfaceEmpty* testInterfaceEmptyArg;
{
testInterfaceEmptyArg = V8TestInterfaceEmpty::toImplWithTypeCheck(info.GetIsolate(), info[0]);
}
impl->legacyInterfaceTypeCheckingMethod(testInterfaceEmptyArg);
}
static void legacyInterfaceTypeCheckingMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementationV8Internal::legacyInterfaceTypeCheckingMethodMethod(info);
}
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)
{
TestInterfaceImplementationV8Internal::implementsVoidMethodMethod(info);
}
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;
{
strArg = info[0];
if (!strArg.prepare())
return;
testInterfaceEmptyArg = V8TestInterfaceEmpty::toImplWithTypeCheck(info.GetIsolate(), info[1]);
if (!testInterfaceEmptyArg) {
exceptionState.throwTypeError("parameter 2 is not of type 'TestInterfaceEmpty'.");
exceptionState.throwIfNeeded();
return;
}
}
ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate());
TestInterfaceEmpty* result = impl->implementsComplexMethod(executionContext, strArg, testInterfaceEmptyArg, exceptionState);
if (exceptionState.hadException()) {
exceptionState.throwIfNeeded();
return;
}
v8SetReturnValue(info, result);
}
static void implementsComplexMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementationV8Internal::implementsComplexMethodMethod(info);
}
static void implementsCustomVoidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
V8TestInterface::implementsCustomVoidMethodMethodCustom(info);
}
static void implementsStaticVoidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementation::implementsStaticVoidMethod();
}
static void implementsStaticVoidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementationV8Internal::implementsStaticVoidMethodMethod(info);
}
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)
{
TestInterfaceImplementationV8Internal::implements2VoidMethodMethod(info);
}
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)
{
TestInterfaceImplementationV8Internal::implements3VoidMethodMethod(info);
}
static void implements3StaticVoidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestImplements3Implementation::implements3StaticVoidMethod();
}
static void implements3StaticVoidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementationV8Internal::implements3StaticVoidMethodMethod(info);
}
static void partialVoidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder());
TestPartialInterface::partialVoidMethod(*impl);
}
static void partialVoidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementationV8Internal::partialVoidMethodMethod(info);
}
static void partialStaticVoidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestPartialInterface::partialStaticVoidMethod();
}
static void partialStaticVoidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementationV8Internal::partialStaticVoidMethodMethod(info);
}
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;
{
longArg = toInt32(info.GetIsolate(), info[0], NormalConversion, exceptionState);
if (exceptionState.throwIfNeeded())
return;
}
TestPartialInterface::partialVoidMethodLongArg(*impl, longArg);
}
static void partialVoidMethodLongArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementationV8Internal::partialVoidMethodLongArgMethod(info);
}
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;
}
}
static void partialCallWithExecutionContextRaisesExceptionVoidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementationV8Internal::partialCallWithExecutionContextRaisesExceptionVoidMethodMethod(info);
}
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;
{
if (!info[0]->IsFunction()) {
V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::failedToExecute("partialVoidMethodPartialCallbackTypeArg", "TestInterface", "The callback provided as parameter 1 is not a function."));
return;
}
partialCallbackTypeArg = ScriptValue(ScriptState::current(info.GetIsolate()), info[0]);
}
TestPartialInterface::partialVoidMethodPartialCallbackTypeArg(*impl, partialCallbackTypeArg);
}
static void partialVoidMethodPartialCallbackTypeArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementationV8Internal::partialVoidMethodPartialCallbackTypeArgMethod(info);
}
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;
{
value = toInt16(info.GetIsolate(), info[0], NormalConversion, exceptionState);
if (exceptionState.throwIfNeeded())
return;
}
int result = 0;
if (!V8TestInterface::PrivateScript::shortMethodWithShortArgumentImplementedInPrivateScriptMethod(toLocalFrame(toFrameIfNotDetached(info.GetIsolate()->GetCurrentContext())), impl, value, &result))
return;
v8SetReturnValueInt(info, result);
}
static void shortMethodWithShortArgumentImplementedInPrivateScriptMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementationV8Internal::shortMethodWithShortArgumentImplementedInPrivateScriptMethod(info);
}
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)
{
TestInterfaceImplementationV8Internal::voidMethodPartialOverloadMethod(info);
}
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)
{
TestInterfaceImplementationV8Internal::staticVoidMethodPartialOverloadMethod(info);
}
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)
{
TestInterfaceImplementationV8Internal::promiseMethodPartialOverloadMethod(info);
}
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)
{
TestInterfaceImplementationV8Internal::staticPromiseMethodPartialOverloadMethod(info);
}
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)
{
TestInterfaceImplementationV8Internal::partial2VoidMethodMethod(info);
}
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)
{
TestInterfaceImplementationV8Internal::partial2StaticVoidMethodMethod(info);
}
static void toJSONMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
{
ExceptionState exceptionState(ExceptionState::ExecutionContext, "toJSON", "TestInterface", info.Holder(), info.GetIsolate());
TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder());
ScriptState* scriptState = ScriptState::current(info.GetIsolate());
ScriptValue result = impl->toJSONForBinding(scriptState, exceptionState);
if (exceptionState.hadException()) {
exceptionState.throwIfNeeded();
return;
}
v8SetReturnValue(info, result.v8Value());
}
static void toJSONMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementationV8Internal::toJSONMethod(info);
}
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)
{
TestInterfaceImplementationV8Internal::toStringMethod(info);
}
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());
Iterator* result = impl->iterator(scriptState, exceptionState);
if (exceptionState.hadException()) {
exceptionState.throwIfNeeded();
return;
}
v8SetReturnValue(info, result);
}
static void iteratorMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementationV8Internal::iteratorMethod(info);
}
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)
{
TestInterfaceImplementationV8Internal::indexedPropertyGetter(index, info);
}
static void indexedPropertySetter(uint32_t index, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder());
V8StringResource<> propertyValue = v8Value;
if (!propertyValue.prepare())
return;
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)
{
TestInterfaceImplementationV8Internal::indexedPropertySetter(index, v8Value, info);
}
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)
{
TestInterfaceImplementationV8Internal::indexedPropertyDeleter(index, info);
}
static void namedPropertyGetter(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Value>& info)
{
auto nameString = name.As<v8::String>();
TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder());
AtomicString propertyName = toCoreAtomicString(nameString);
String result = impl->anonymousNamedGetter(propertyName);
if (result.isNull())
return;
v8SetReturnValueString(info, result, info.GetIsolate());
}
static void namedPropertyGetterCallback(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementationV8Internal::namedPropertyGetter(name, info);
}
static void namedPropertySetter(v8::Local<v8::Name> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
{
auto nameString = name.As<v8::String>();
TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder());
V8StringResource<> propertyName(nameString);
if (!propertyName.prepare())
return;
V8StringResource<> propertyValue = v8Value;
if (!propertyValue.prepare())
return;
bool result = impl->anonymousNamedSetter(propertyName, propertyValue);
if (!result)
return;
v8SetReturnValue(info, v8Value);
}
static void namedPropertySetterCallback(v8::Local<v8::Name> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementationV8Internal::namedPropertySetter(name, v8Value, info);
}
static void namedPropertyQuery(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Integer>& info)
{
TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder());
AtomicString propertyName = toCoreAtomicString(name.As<v8::String>());
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::Name> name, const v8::PropertyCallbackInfo<v8::Integer>& info)
{
TestInterfaceImplementationV8Internal::namedPropertyQuery(name, info);
}
static void namedPropertyDeleter(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Boolean>& info)
{
TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder());
AtomicString propertyName = toCoreAtomicString(name.As<v8::String>());
DeleteResult result = impl->anonymousNamedDeleter(propertyName);
if (result != DeleteUnknownProperty)
return v8SetReturnValueBool(info, result == DeleteSuccess);
}
static void namedPropertyDeleterCallback(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Boolean>& info)
{
TestInterfaceImplementationV8Internal::namedPropertyDeleter(name, info);
}
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::Local<v8::Array> v8names = v8::Array::New(info.GetIsolate(), names.size());
for (size_t i = 0; i < names.size(); ++i) {
if (!v8CallBoolean(v8names->Set(info.GetIsolate()->GetCurrentContext(), v8::Integer::New(info.GetIsolate(), i), v8String(info.GetIsolate(), names[i]))))
return;
}
v8SetReturnValue(info, v8names);
}
static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::Array>& info)
{
TestInterfaceImplementationV8Internal::namedPropertyEnumerator(info);
}
} // namespace TestInterfaceImplementationV8Internal
void V8TestInterface::visitDOMWrapper(v8::Isolate* isolate, ScriptWrappable* scriptWrappable, const v8::Persistent<v8::Object>& wrapper)
{
TestInterfaceImplementation* impl = scriptWrappable->toImpl<TestInterfaceImplementation>();
v8::Local<v8::Object> context = v8::Local<v8::Object>::New(isolate, wrapper);
v8::Context::Scope scope(context->CreationContext());
TestInterfaceImplementation* referencedName = impl->referencedName();
if (referencedName) {
if (DOMDataStore::containsWrapper(referencedName, isolate))
DOMDataStore::setWrapperReference(wrapper, referencedName, isolate);
}
}
// Suppress warning: global constructors, because AttributeConfiguration is trivial
// and does not depend on another global objects.
#if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wglobal-constructors"
#endif
const V8DOMConfiguration::AttributeConfiguration V8TestInterfaceAttributes[] = {
{"testInterfaceConstructorAttribute", v8ConstructorAttributeGetter, 0, 0, 0, const_cast<WrapperTypeInfo*>(&V8TestInterface::wrapperTypeInfo), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::DontEnum), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance, V8DOMConfiguration::CheckHolder},
{"TestInterface", v8ConstructorAttributeGetter, 0, 0, 0, const_cast<WrapperTypeInfo*>(&V8TestInterface::wrapperTypeInfo), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::DontEnum), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance, V8DOMConfiguration::CheckHolder},
{"TestInterface2", v8ConstructorAttributeGetter, 0, 0, 0, const_cast<WrapperTypeInfo*>(&V8TestInterface2::wrapperTypeInfo), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::DontEnum), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance, V8DOMConfiguration::CheckHolder},
};
#if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG)
#pragma clang diagnostic pop
#endif
const V8DOMConfiguration::AccessorConfiguration V8TestInterfaceAccessors[] = {
{"testInterfaceAttribute", TestInterfaceImplementationV8Internal::testInterfaceAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::testInterfaceAttributeAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder},
{"doubleAttribute", TestInterfaceImplementationV8Internal::doubleAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::doubleAttributeAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder},
{"floatAttribute", TestInterfaceImplementationV8Internal::floatAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::floatAttributeAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder},
{"unrestrictedDoubleAttribute", TestInterfaceImplementationV8Internal::unrestrictedDoubleAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::unrestrictedDoubleAttributeAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder},
{"unrestrictedFloatAttribute", TestInterfaceImplementationV8Internal::unrestrictedFloatAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::unrestrictedFloatAttributeAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder},
{"testEnumAttribute", TestInterfaceImplementationV8Internal::testEnumAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::testEnumAttributeAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder},
{"stringOrDoubleAttribute", TestInterfaceImplementationV8Internal::stringOrDoubleAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::stringOrDoubleAttributeAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder},
{"staticStringAttribute", TestInterfaceImplementationV8Internal::staticStringAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::staticStringAttributeAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInterface, V8DOMConfiguration::CheckHolder},
{"staticReturnDOMWrapperAttribute", TestInterfaceImplementationV8Internal::staticReturnDOMWrapperAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::staticReturnDOMWrapperAttributeAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInterface, V8DOMConfiguration::CheckHolder},
{"staticReadOnlyStringAttribute", TestInterfaceImplementationV8Internal::staticReadOnlyStringAttributeAttributeGetterCallback, 0, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::ReadOnly), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInterface, V8DOMConfiguration::CheckHolder},
{"staticReadOnlyReturnDOMWrapperAttribute", TestInterfaceImplementationV8Internal::staticReadOnlyReturnDOMWrapperAttributeAttributeGetterCallback, 0, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::ReadOnly), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInterface, V8DOMConfiguration::CheckHolder},
{"legacyInterfaceTypeCheckingAttribute", TestInterfaceImplementationV8Internal::legacyInterfaceTypeCheckingAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::legacyInterfaceTypeCheckingAttributeAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder},
{"alwaysExposedAttribute", TestInterfaceImplementationV8Internal::alwaysExposedAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::alwaysExposedAttributeAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder},
{"lenientThisAttribute", TestInterfaceImplementationV8Internal::lenientThisAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::lenientThisAttributeAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::DoNotCheckHolder},
{"implementsStaticReadOnlyLongAttribute", TestInterfaceImplementationV8Internal::implementsStaticReadOnlyLongAttributeAttributeGetterCallback, 0, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::ReadOnly), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInterface, V8DOMConfiguration::CheckHolder},
{"implementsStaticStringAttribute", TestInterfaceImplementationV8Internal::implementsStaticStringAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::implementsStaticStringAttributeAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInterface, V8DOMConfiguration::CheckHolder},
{"implementsReadonlyStringAttribute", TestInterfaceImplementationV8Internal::implementsReadonlyStringAttributeAttributeGetterCallback, 0, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::ReadOnly), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder},
{"implementsStringAttribute", TestInterfaceImplementationV8Internal::implementsStringAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::implementsStringAttributeAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder},
{"implementsNodeAttribute", TestInterfaceImplementationV8Internal::implementsNodeAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::implementsNodeAttributeAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder},
{"implementsEventHandlerAttribute", TestInterfaceImplementationV8Internal::implementsEventHandlerAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::implementsEventHandlerAttributeAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder},
{"implements3StringAttribute", TestInterfaceImplementationV8Internal::implements3StringAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::implements3StringAttributeAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder},
{"implements3StaticStringAttribute", TestInterfaceImplementationV8Internal::implements3StaticStringAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::implements3StaticStringAttributeAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInterface, V8DOMConfiguration::CheckHolder},
{"partial2LongAttribute", TestInterfaceImplementationV8Internal::partial2LongAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::partial2LongAttributeAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder},
{"partial2StaticLongAttribute", TestInterfaceImplementationV8Internal::partial2StaticLongAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::partial2StaticLongAttributeAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInterface, V8DOMConfiguration::CheckHolder},
};
const V8DOMConfiguration::MethodConfiguration V8TestInterfaceMethods[] = {
{"voidMethodTestInterfaceEmptyArg", TestInterfaceImplementationV8Internal::voidMethodTestInterfaceEmptyArgMethodCallback, 0, 1, v8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype},
{"voidMethodDoubleArgFloatArg", TestInterfaceImplementationV8Internal::voidMethodDoubleArgFloatArgMethodCallback, 0, 2, v8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype},
{"voidMethodUnrestrictedDoubleArgUnrestrictedFloatArg", TestInterfaceImplementationV8Internal::voidMethodUnrestrictedDoubleArgUnrestrictedFloatArgMethodCallback, 0, 2, v8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype},
{"voidMethodTestEnumArg", TestInterfaceImplementationV8Internal::voidMethodTestEnumArgMethodCallback, 0, 1, v8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype},
{"voidMethod", TestInterfaceImplementationV8Internal::voidMethodMethodCallback, TestInterfaceImplementationV8Internal::voidMethodMethodCallbackForMainWorld, 0, v8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype},
{"alwaysExposedMethod", TestInterfaceImplementationV8Internal::alwaysExposedMethodMethodCallback, 0, 0, v8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype},
{"alwaysExposedStaticMethod", TestInterfaceImplementationV8Internal::alwaysExposedStaticMethodMethodCallback, 0, 0, v8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInterface},
{"staticReturnDOMWrapperMethod", TestInterfaceImplementationV8Internal::staticReturnDOMWrapperMethodMethodCallback, 0, 0, v8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInterface},
{"legacyInterfaceTypeCheckingMethod", TestInterfaceImplementationV8Internal::legacyInterfaceTypeCheckingMethodMethodCallback, 0, 1, v8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype},
{"implementsVoidMethod", TestInterfaceImplementationV8Internal::implementsVoidMethodMethodCallback, 0, 0, v8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype},
{"implementsComplexMethod", TestInterfaceImplementationV8Internal::implementsComplexMethodMethodCallback, 0, 2, v8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype},
{"implementsCustomVoidMethod", TestInterfaceImplementationV8Internal::implementsCustomVoidMethodMethodCallback, 0, 0, v8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype},
{"implementsStaticVoidMethod", TestInterfaceImplementationV8Internal::implementsStaticVoidMethodMethodCallback, 0, 0, v8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInterface},
{"implements3VoidMethod", TestInterfaceImplementationV8Internal::implements3VoidMethodMethodCallback, 0, 0, v8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype},
{"implements3StaticVoidMethod", TestInterfaceImplementationV8Internal::implements3StaticVoidMethodMethodCallback, 0, 0, v8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInterface},
{"voidMethodPartialOverload", TestInterfaceImplementationV8Internal::voidMethodPartialOverloadMethodCallback, 0, 0, v8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype},
{"staticVoidMethodPartialOverload", TestInterfaceImplementationV8Internal::staticVoidMethodPartialOverloadMethodCallback, 0, 0, v8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInterface},
{"promiseMethodPartialOverload", TestInterfaceImplementationV8Internal::promiseMethodPartialOverloadMethodCallback, 0, 0, v8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype},
{"staticPromiseMethodPartialOverload", TestInterfaceImplementationV8Internal::staticPromiseMethodPartialOverloadMethodCallback, 0, 0, v8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInterface},
{"partial2VoidMethod", TestInterfaceImplementationV8Internal::partial2VoidMethodMethodCallback, 0, 0, v8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype},
{"partial2StaticVoidMethod", TestInterfaceImplementationV8Internal::partial2StaticVoidMethodMethodCallback, 0, 0, v8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInterface},
{"toJSON", TestInterfaceImplementationV8Internal::toJSONMethodCallback, 0, 0, static_cast<v8::PropertyAttribute>(v8::DontEnum), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype},
{"toString", TestInterfaceImplementationV8Internal::toStringMethodCallback, 0, 0, static_cast<v8::PropertyAttribute>(v8::DontEnum), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype},
};
void V8TestInterface::installV8TestInterfaceTemplate(v8::Isolate* isolate, const DOMWrapperWorld& world, v8::Local<v8::FunctionTemplate> interfaceTemplate)
{
// Initialize the interface object's template.
V8DOMConfiguration::initializeDOMInterfaceTemplate(isolate, interfaceTemplate, V8TestInterface::wrapperTypeInfo.interfaceName, V8TestInterfaceEmpty::domTemplate(isolate, world), V8TestInterface::internalFieldCount);
v8::Local<v8::Signature> signature = v8::Signature::New(isolate, interfaceTemplate);
ALLOW_UNUSED_LOCAL(signature);
v8::Local<v8::ObjectTemplate> instanceTemplate = interfaceTemplate->InstanceTemplate();
ALLOW_UNUSED_LOCAL(instanceTemplate);
v8::Local<v8::ObjectTemplate> prototypeTemplate = interfaceTemplate->PrototypeTemplate();
ALLOW_UNUSED_LOCAL(prototypeTemplate);
// Register DOM constants, attributes and operations.
if (RuntimeEnabledFeatures::featureNameEnabled()) {
const V8DOMConfiguration::ConstantConfiguration V8TestInterfaceConstants[] = {
{"UNSIGNED_LONG", 0, 0, V8DOMConfiguration::ConstantTypeUnsignedLong},
{"CONST_JAVASCRIPT", 1, 0, V8DOMConfiguration::ConstantTypeShort},
{"IMPLEMENTS_CONSTANT_1", 1, 0, V8DOMConfiguration::ConstantTypeUnsignedShort},
{"IMPLEMENTS_CONSTANT_2", 2, 0, V8DOMConfiguration::ConstantTypeUnsignedShort},
{"PARTIAL2_UNSIGNED_SHORT", 0, 0, V8DOMConfiguration::ConstantTypeUnsignedShort},
};
V8DOMConfiguration::installConstants(isolate, interfaceTemplate, prototypeTemplate, V8TestInterfaceConstants, WTF_ARRAY_LENGTH(V8TestInterfaceConstants));
if (RuntimeEnabledFeatures::partialFeatureNameEnabled()) {
const V8DOMConfiguration::ConstantConfiguration constantPartialUnsignedShortConfiguration = {"PARTIAL_UNSIGNED_SHORT", 0, 0, V8DOMConfiguration::ConstantTypeUnsignedShort};
V8DOMConfiguration::installConstant(isolate, interfaceTemplate, prototypeTemplate, constantPartialUnsignedShortConfiguration);
const V8DOMConfiguration::ConstantConfiguration constantPartialDoubleConfiguration = {"PARTIAL_DOUBLE", 0, 3.14, V8DOMConfiguration::ConstantTypeDouble};
V8DOMConfiguration::installConstant(isolate, interfaceTemplate, prototypeTemplate, constantPartialDoubleConfiguration);
}
V8DOMConfiguration::installAttributes(isolate, world, instanceTemplate, prototypeTemplate, V8TestInterfaceAttributes, WTF_ARRAY_LENGTH(V8TestInterfaceAttributes));
V8DOMConfiguration::installAccessors(isolate, world, instanceTemplate, prototypeTemplate, interfaceTemplate, signature, V8TestInterfaceAccessors, WTF_ARRAY_LENGTH(V8TestInterfaceAccessors));
V8DOMConfiguration::installMethods(isolate, world, instanceTemplate, prototypeTemplate, interfaceTemplate, signature, V8TestInterfaceMethods, WTF_ARRAY_LENGTH(V8TestInterfaceMethods));
} // if (RuntimeEnabledFeatures::featureNameEnabled())
if (RuntimeEnabledFeatures::featureNameEnabled()) {
const V8DOMConfiguration::AccessorConfiguration accessorconditionalReadOnlyLongAttributeConfiguration = \
{"conditionalReadOnlyLongAttribute", TestInterfaceImplementationV8Internal::conditionalReadOnlyLongAttributeAttributeGetterCallback, 0, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::ReadOnly), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder};
V8DOMConfiguration::installAccessor(isolate, world, instanceTemplate, prototypeTemplate, interfaceTemplate, signature, accessorconditionalReadOnlyLongAttributeConfiguration);
const V8DOMConfiguration::AccessorConfiguration accessorstaticConditionalReadOnlyLongAttributeConfiguration = \
{"staticConditionalReadOnlyLongAttribute", TestInterfaceImplementationV8Internal::staticConditionalReadOnlyLongAttributeAttributeGetterCallback, 0, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::ReadOnly), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInterface, V8DOMConfiguration::CheckHolder};
V8DOMConfiguration::installAccessor(isolate, world, instanceTemplate, prototypeTemplate, interfaceTemplate, signature, accessorstaticConditionalReadOnlyLongAttributeConfiguration);
const V8DOMConfiguration::AccessorConfiguration accessorconditionalLongAttributeConfiguration = \
{"conditionalLongAttribute", TestInterfaceImplementationV8Internal::conditionalLongAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::conditionalLongAttributeAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder};
V8DOMConfiguration::installAccessor(isolate, world, instanceTemplate, prototypeTemplate, interfaceTemplate, signature, accessorconditionalLongAttributeConfiguration);
}
if (RuntimeEnabledFeatures::implements2FeatureNameEnabled()) {
const V8DOMConfiguration::AccessorConfiguration accessorimplements2StaticStringAttributeConfiguration = \
{"implements2StaticStringAttribute", TestInterfaceImplementationV8Internal::implements2StaticStringAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::implements2StaticStringAttributeAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInterface, V8DOMConfiguration::CheckHolder};
V8DOMConfiguration::installAccessor(isolate, world, instanceTemplate, prototypeTemplate, interfaceTemplate, signature, accessorimplements2StaticStringAttributeConfiguration);
const V8DOMConfiguration::AccessorConfiguration accessorimplements2StringAttributeConfiguration = \
{"implements2StringAttribute", TestInterfaceImplementationV8Internal::implements2StringAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::implements2StringAttributeAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder};
V8DOMConfiguration::installAccessor(isolate, world, instanceTemplate, prototypeTemplate, interfaceTemplate, signature, accessorimplements2StringAttributeConfiguration);
}
if (RuntimeEnabledFeatures::implementsFeatureNameEnabled()) {
const V8DOMConfiguration::AccessorConfiguration accessorimplementsRuntimeEnabledNodeAttributeConfiguration = \
{"implementsRuntimeEnabledNodeAttribute", TestInterfaceImplementationV8Internal::implementsRuntimeEnabledNodeAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::implementsRuntimeEnabledNodeAttributeAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder};
V8DOMConfiguration::installAccessor(isolate, world, instanceTemplate, prototypeTemplate, interfaceTemplate, signature, accessorimplementsRuntimeEnabledNodeAttributeConfiguration);
}
if (RuntimeEnabledFeatures::partialFeatureNameEnabled()) {
const V8DOMConfiguration::AccessorConfiguration accessorpartialPartialEnumTypeAttributeConfiguration = \
{"partialPartialEnumTypeAttribute", TestInterfaceImplementationV8Internal::partialPartialEnumTypeAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::partialPartialEnumTypeAttributeAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder};
V8DOMConfiguration::installAccessor(isolate, world, instanceTemplate, prototypeTemplate, interfaceTemplate, signature, accessorpartialPartialEnumTypeAttributeConfiguration);
const V8DOMConfiguration::AccessorConfiguration accessorpartialCallWithExecutionContextLongAttributeConfiguration = \
{"partialCallWithExecutionContextLongAttribute", TestInterfaceImplementationV8Internal::partialCallWithExecutionContextLongAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::partialCallWithExecutionContextLongAttributeAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder};
V8DOMConfiguration::installAccessor(isolate, world, instanceTemplate, prototypeTemplate, interfaceTemplate, signature, accessorpartialCallWithExecutionContextLongAttributeConfiguration);
const V8DOMConfiguration::AccessorConfiguration accessorpartialLongAttributeConfiguration = \
{"partialLongAttribute", TestInterfaceImplementationV8Internal::partialLongAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::partialLongAttributeAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder};
V8DOMConfiguration::installAccessor(isolate, world, instanceTemplate, prototypeTemplate, interfaceTemplate, signature, accessorpartialLongAttributeConfiguration);
const V8DOMConfiguration::AccessorConfiguration accessorpartialStaticLongAttributeConfiguration = \
{"partialStaticLongAttribute", TestInterfaceImplementationV8Internal::partialStaticLongAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::partialStaticLongAttributeAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInterface, V8DOMConfiguration::CheckHolder};
V8DOMConfiguration::installAccessor(isolate, world, instanceTemplate, prototypeTemplate, interfaceTemplate, signature, accessorpartialStaticLongAttributeConfiguration);
const V8DOMConfiguration::AccessorConfiguration accessorstringAttributeConfiguration = \
{"stringAttribute", TestInterfaceImplementationV8Internal::stringAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::stringAttributeAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder};
V8DOMConfiguration::installAccessor(isolate, world, instanceTemplate, prototypeTemplate, interfaceTemplate, signature, accessorstringAttributeConfiguration);
}
// Indexed properties
v8::IndexedPropertyHandlerConfiguration indexedPropertyHandlerConfig(TestInterfaceImplementationV8Internal::indexedPropertyGetterCallback, TestInterfaceImplementationV8Internal::indexedPropertySetterCallback, 0, TestInterfaceImplementationV8Internal::indexedPropertyDeleterCallback, indexedPropertyEnumerator<TestInterfaceImplementation>, v8::Local<v8::Value>(), v8::PropertyHandlerFlags::kAllCanRead);
instanceTemplate->SetHandler(indexedPropertyHandlerConfig);
// Named properties
v8::NamedPropertyHandlerConfiguration namedPropertyHandlerConfig(TestInterfaceImplementationV8Internal::namedPropertyGetterCallback, TestInterfaceImplementationV8Internal::namedPropertySetterCallback, TestInterfaceImplementationV8Internal::namedPropertyQueryCallback, TestInterfaceImplementationV8Internal::namedPropertyDeleterCallback, TestInterfaceImplementationV8Internal::namedPropertyEnumeratorCallback, v8::Local<v8::Value>(), static_cast<v8::PropertyHandlerFlags>(int(v8::PropertyHandlerFlags::kOnlyInterceptStrings) | int(v8::PropertyHandlerFlags::kAllCanRead) | int(v8::PropertyHandlerFlags::kNonMasking)));
instanceTemplate->SetHandler(namedPropertyHandlerConfig);
// Iterator (@@iterator)
const V8DOMConfiguration::SymbolKeyedMethodConfiguration symbolKeyedIteratorConfiguration = { v8::Symbol::GetIterator, TestInterfaceImplementationV8Internal::iteratorMethodCallback, 0, v8::DontDelete, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype };
V8DOMConfiguration::installMethod(isolate, world, prototypeTemplate, signature, symbolKeyedIteratorConfiguration);
instanceTemplate->SetCallAsFunctionHandler(V8TestInterface::legacyCallCustom);
if (RuntimeEnabledFeatures::implements2FeatureNameEnabled()) {
const V8DOMConfiguration::MethodConfiguration implements2VoidMethodMethodConfiguration = {"implements2VoidMethod", TestInterfaceImplementationV8Internal::implements2VoidMethodMethodCallback, 0, 0, v8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype};
V8DOMConfiguration::installMethod(isolate, world, instanceTemplate, prototypeTemplate, interfaceTemplate, signature, implements2VoidMethodMethodConfiguration);
}
if (RuntimeEnabledFeatures::partialFeatureNameEnabled()) {
const V8DOMConfiguration::MethodConfiguration partialVoidMethodMethodConfiguration = {"partialVoidMethod", TestInterfaceImplementationV8Internal::partialVoidMethodMethodCallback, 0, 0, v8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype};
V8DOMConfiguration::installMethod(isolate, world, instanceTemplate, prototypeTemplate, interfaceTemplate, signature, partialVoidMethodMethodConfiguration);
}
if (RuntimeEnabledFeatures::partialFeatureNameEnabled()) {
const V8DOMConfiguration::MethodConfiguration partialStaticVoidMethodMethodConfiguration = {"partialStaticVoidMethod", TestInterfaceImplementationV8Internal::partialStaticVoidMethodMethodCallback, 0, 0, v8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInterface};
V8DOMConfiguration::installMethod(isolate, world, instanceTemplate, prototypeTemplate, interfaceTemplate, signature, partialStaticVoidMethodMethodConfiguration);
}
if (RuntimeEnabledFeatures::partialFeatureNameEnabled()) {
const V8DOMConfiguration::MethodConfiguration partialVoidMethodLongArgMethodConfiguration = {"partialVoidMethodLongArg", TestInterfaceImplementationV8Internal::partialVoidMethodLongArgMethodCallback, 0, 1, v8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype};
V8DOMConfiguration::installMethod(isolate, world, instanceTemplate, prototypeTemplate, interfaceTemplate, signature, partialVoidMethodLongArgMethodConfiguration);
}
if (RuntimeEnabledFeatures::partialFeatureNameEnabled()) {
const V8DOMConfiguration::MethodConfiguration partialCallWithExecutionContextRaisesExceptionVoidMethodMethodConfiguration = {"partialCallWithExecutionContextRaisesExceptionVoidMethod", TestInterfaceImplementationV8Internal::partialCallWithExecutionContextRaisesExceptionVoidMethodMethodCallback, 0, 0, v8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype};
V8DOMConfiguration::installMethod(isolate, world, instanceTemplate, prototypeTemplate, interfaceTemplate, signature, partialCallWithExecutionContextRaisesExceptionVoidMethodMethodConfiguration);
}
if (RuntimeEnabledFeatures::partialFeatureNameEnabled()) {
const V8DOMConfiguration::MethodConfiguration partialVoidMethodPartialCallbackTypeArgMethodConfiguration = {"partialVoidMethodPartialCallbackTypeArg", TestInterfaceImplementationV8Internal::partialVoidMethodPartialCallbackTypeArgMethodCallback, 0, 1, v8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype};
V8DOMConfiguration::installMethod(isolate, world, instanceTemplate, prototypeTemplate, interfaceTemplate, signature, partialVoidMethodPartialCallbackTypeArgMethodConfiguration);
}
if (RuntimeEnabledFeatures::partialFeatureNameEnabled()) {
const V8DOMConfiguration::MethodConfiguration shortMethodWithShortArgumentImplementedInPrivateScriptMethodConfiguration = {"shortMethodWithShortArgumentImplementedInPrivateScript", TestInterfaceImplementationV8Internal::shortMethodWithShortArgumentImplementedInPrivateScriptMethodCallback, 0, 1, v8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype};
V8DOMConfiguration::installMethod(isolate, world, instanceTemplate, prototypeTemplate, interfaceTemplate, signature, shortMethodWithShortArgumentImplementedInPrivateScriptMethodConfiguration);
}
}
v8::Local<v8::FunctionTemplate> V8TestInterface::domTemplate(v8::Isolate* isolate, const DOMWrapperWorld& world)
{
return V8DOMConfiguration::domClassTemplate(isolate, world, const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), V8TestInterface::installV8TestInterfaceTemplateFunction);
}
bool V8TestInterface::hasInstance(v8::Local<v8::Value> v8Value, v8::Isolate* isolate)
{
return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Value);
}
v8::Local<v8::Object> V8TestInterface::findInstanceInPrototypeChain(v8::Local<v8::Value> v8Value, v8::Isolate* isolate)
{
return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrapperTypeInfo, v8Value);
}
TestInterfaceImplementation* V8TestInterface::toImplWithTypeCheck(v8::Isolate* isolate, v8::Local<v8::Value> value)
{
return hasInstance(value, isolate) ? toImpl(v8::Local<v8::Object>::Cast(value)) : 0;
}
void V8TestInterface::preparePrototypeAndInterfaceObject(v8::Local<v8::Context> context, const DOMWrapperWorld& world, v8::Local<v8::Object> prototypeObject, v8::Local<v8::Function> interfaceObject, v8::Local<v8::FunctionTemplate> interfaceTemplate)
{
v8::Isolate* isolate = context->GetIsolate();
ExecutionContext* executionContext = toExecutionContext(context);
v8::Local<v8::Signature> signature = v8::Signature::New(isolate, interfaceTemplate);
if (executionContext && (executionContext->isWorkerGlobalScope())) {
const V8DOMConfiguration::AccessorConfiguration accessorConfiguration = {"workerExposedAttribute", TestInterfaceImplementationV8Internal::workerExposedAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::workerExposedAttributeAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder};
V8DOMConfiguration::installAccessor(isolate, world, v8::Local<v8::Object>(), prototypeObject, interfaceObject, signature, accessorConfiguration);
}
if (executionContext && (executionContext->isDocument())) {
const V8DOMConfiguration::AccessorConfiguration accessorConfiguration = {"windowExposedAttribute", TestInterfaceImplementationV8Internal::windowExposedAttributeAttributeGetterCallback, TestInterfaceImplementationV8Internal::windowExposedAttributeAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder};
V8DOMConfiguration::installAccessor(isolate, world, v8::Local<v8::Object>(), prototypeObject, interfaceObject, signature, accessorConfiguration);
}
v8::Local<v8::Signature> signature = v8::Signature::New(isolate, interfaceTemplate);
ExecutionContext* executionContext = toExecutionContext(prototypeObject->CreationContext());
ASSERT(executionContext);
if (executionContext && (executionContext->isWorkerGlobalScope())) {
const V8DOMConfiguration::MethodConfiguration workerExposedMethodMethodConfiguration = {"workerExposedMethod", TestInterfaceImplementationV8Internal::workerExposedMethodMethodCallback, 0, 0, v8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype};
V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(), prototypeObject, interfaceObject, signature, workerExposedMethodMethodConfiguration);
}
if (executionContext && (executionContext->isDocument())) {
const V8DOMConfiguration::MethodConfiguration windowExposedMethodMethodConfiguration = {"windowExposedMethod", TestInterfaceImplementationV8Internal::windowExposedMethodMethodCallback, 0, 0, v8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype};
V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(), prototypeObject, interfaceObject, signature, windowExposedMethodMethodConfiguration);
}
if (executionContext && (executionContext->isWorkerGlobalScope())) {
const V8DOMConfiguration::MethodConfiguration workerExposedStaticMethodMethodConfiguration = {"workerExposedStaticMethod", TestInterfaceImplementationV8Internal::workerExposedStaticMethodMethodCallback, 0, 0, v8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInterface};
V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(), prototypeObject, interfaceObject, signature, workerExposedStaticMethodMethodConfiguration);
}
if (executionContext && (executionContext->isDocument())) {
const V8DOMConfiguration::MethodConfiguration windowExposedStaticMethodMethodConfiguration = {"windowExposedStaticMethod", TestInterfaceImplementationV8Internal::windowExposedStaticMethodMethodCallback, 0, 0, v8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInterface};
V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(), prototypeObject, interfaceObject, signature, windowExposedStaticMethodMethodConfiguration);
}
if (executionContext && (executionContext->isDocument())) {
if (RuntimeEnabledFeatures::featureNameEnabled()) {
const V8DOMConfiguration::MethodConfiguration methodWithExposedAndRuntimeEnabledFlagMethodConfiguration = {"methodWithExposedAndRuntimeEnabledFlag", TestInterfaceImplementationV8Internal::methodWithExposedAndRuntimeEnabledFlagMethodCallback, 0, 0, v8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype};
V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(), prototypeObject, interfaceObject, signature, methodWithExposedAndRuntimeEnabledFlagMethodConfiguration);
}
}
if (executionContext && (executionContext->isDocument())) {
const V8DOMConfiguration::MethodConfiguration overloadMethodWithExposedAndRuntimeEnabledFlagMethodConfiguration = {"overloadMethodWithExposedAndRuntimeEnabledFlag", TestInterfaceImplementationV8Internal::overloadMethodWithExposedAndRuntimeEnabledFlagMethodCallback, 0, 1, v8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype};
V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(), prototypeObject, interfaceObject, signature, overloadMethodWithExposedAndRuntimeEnabledFlagMethodConfiguration);
}
if (executionContext && ((executionContext->isDocument() && RuntimeEnabledFeatures::featureNameEnabled()) || (executionContext->isWorkerGlobalScope() && RuntimeEnabledFeatures::featureName2Enabled()))) {
const V8DOMConfiguration::MethodConfiguration methodWithExposedHavingRuntimeEnabldFlagMethodConfiguration = {"methodWithExposedHavingRuntimeEnabldFlag", TestInterfaceImplementationV8Internal::methodWithExposedHavingRuntimeEnabldFlagMethodCallback, 0, 0, v8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype};
V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(), prototypeObject, interfaceObject, signature, methodWithExposedHavingRuntimeEnabldFlagMethodConfiguration);
}
if (executionContext && (executionContext->isDocument() || executionContext->isServiceWorkerGlobalScope())) {
const V8DOMConfiguration::MethodConfiguration windowAndServiceWorkerExposedMethodMethodConfiguration = {"windowAndServiceWorkerExposedMethod", TestInterfaceImplementationV8Internal::windowAndServiceWorkerExposedMethodMethodCallback, 0, 0, v8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype};
V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(), prototypeObject, interfaceObject, signature, windowAndServiceWorkerExposedMethodMethodConfiguration);
}
}
ActiveScriptWrappable* V8TestInterface::toActiveScriptWrappable(v8::Local<v8::Object> wrapper)
{
return toImpl(wrapper);
}
bool V8TestInterface::PrivateScript::shortMethodWithShortArgumentImplementedInPrivateScriptMethod(LocalFrame* frame, TestInterface* holderImpl, int value, int* result)
{
if (!frame)
return false;
v8::HandleScope handleScope(toIsolate(frame));
ScriptForbiddenScope::AllowUserAgentScript script;
ScriptState* scriptState = ScriptState::forWorld(frame, DOMWrapperWorld::privateScriptIsolatedWorld());
if (!scriptState)
return false;
ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame);
if (!scriptStateInUserScript)
return false;
ScriptState::Scope scope(scriptState);
v8::Local<v8::Value> holder = toV8(holderImpl, scriptState->context()->Global(), scriptState->isolate());
if (holder.IsEmpty())
return false;
v8::Local<v8::Value> valueHandle = v8::Integer::New(scriptState->isolate(), value);
v8::Local<v8::Value> argv[] = { valueHandle };
ExceptionState exceptionState(ExceptionState::ExecutionContext, "shortMethodWithShortArgumentImplementedInPrivateScript", "TestInterfaceImplementation", scriptState->context()->Global(), scriptState->isolate());
v8::Local<v8::Value> v8Value = PrivateScriptRunner::runDOMMethod(scriptState, scriptStateInUserScript, "TestInterfaceImplementation", "shortMethodWithShortArgumentImplementedInPrivateScript", holder, 1, argv);
if (v8Value.IsEmpty())
return false;
int cppValue = toInt16(scriptState->isolate(), v8Value, NormalConversion, exceptionState);
if (exceptionState.throwIfNeeded())
return 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;
ScriptState* scriptState = ScriptState::forWorld(frame, DOMWrapperWorld::privateScriptIsolatedWorld());
if (!scriptState)
return false;
ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame);
if (!scriptStateInUserScript)
return false;
ScriptState::Scope scope(scriptState);
v8::Local<v8::Value> holder = toV8(holderImpl, scriptState->context()->Global(), scriptState->isolate());
if (holder.IsEmpty())
return false;
ExceptionState exceptionState(ExceptionState::GetterContext, "stringAttribute", "TestInterfaceImplementation", scriptState->context()->Global(), scriptState->isolate());
v8::Local<v8::Value> v8Value = PrivateScriptRunner::runDOMAttributeGetter(scriptState, scriptStateInUserScript, "TestInterfaceImplementation", "stringAttribute", holder);
if (v8Value.IsEmpty())
return false;
V8StringResource<> cppValue = v8Value;
if (!cppValue.prepare())
return 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;
ScriptState* scriptState = ScriptState::forWorld(frame, DOMWrapperWorld::privateScriptIsolatedWorld());
if (!scriptState)
return false;
ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame);
if (!scriptStateInUserScript)
return false;
ScriptState::Scope scope(scriptState);
v8::Local<v8::Value> holder = toV8(holderImpl, scriptState->context()->Global(), scriptState->isolate());
if (holder.IsEmpty())
return false;
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, PreparePrototypeAndInterfaceObjectFunction preparePrototypeAndInterfaceObjectFunction)
{
V8TestInterface::installV8TestInterfaceTemplateFunction = installTemplateFunction;
if (preparePrototypeAndInterfaceObjectFunction)
V8TestInterface::wrapperTypeInfo.preparePrototypeAndInterfaceObjectFunction = preparePrototypeAndInterfaceObjectFunction;
}
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