JSTestTypedefs.cpp [plain text]
#include "config.h"
#include "JSTestTypedefs.h"
#include "DOMStringList.h"
#include "ExceptionCode.h"
#include "JSDOMBinding.h"
#include "JSDOMConstructor.h"
#include "JSDOMConvert.h"
#include "JSDOMStringList.h"
#include "JSSVGPoint.h"
#include "JSSerializedScriptValue.h"
#include "JSTestCallback.h"
#include "JSTestEventTarget.h"
#include "JSTestSubObj.h"
#include "SVGPoint.h"
#include "SerializedScriptValue.h"
#include "URL.h"
#include <runtime/Error.h>
#include <runtime/FunctionPrototype.h>
#include <runtime/JSArray.h>
#include <runtime/JSString.h>
#include <wtf/GetPtr.h>
using namespace JSC;
namespace WebCore {
JSC::EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionFunc(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionSetShadow(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionMethodWithSequenceArg(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionNullableArrayArg(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionFuncWithClamp(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionImmutablePointFunction(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionStringArrayFunction(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionStringArrayFunction2(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionCallWithSequenceThatRequiresInclude(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionMethodWithException(JSC::ExecState*);
JSC::EncodedJSValue jsTestTypedefsUnsignedLongLongAttr(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSTestTypedefsUnsignedLongLongAttr(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
JSC::EncodedJSValue jsTestTypedefsImmutableSerializedScriptValue(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSTestTypedefsImmutableSerializedScriptValue(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
JSC::EncodedJSValue jsTestTypedefsConstructorTestSubObj(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
JSC::EncodedJSValue jsTestTypedefsAttrWithGetterException(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSTestTypedefsAttrWithGetterException(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
JSC::EncodedJSValue jsTestTypedefsAttrWithSetterException(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSTestTypedefsAttrWithSetterException(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
JSC::EncodedJSValue jsTestTypedefsStringAttrWithGetterException(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSTestTypedefsStringAttrWithGetterException(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
JSC::EncodedJSValue jsTestTypedefsStringAttrWithSetterException(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSTestTypedefsStringAttrWithSetterException(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
JSC::EncodedJSValue jsTestTypedefsConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSTestTypedefsConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
class JSTestTypedefsPrototype : public JSC::JSNonFinalObject {
public:
typedef JSC::JSNonFinalObject Base;
static JSTestTypedefsPrototype* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure)
{
JSTestTypedefsPrototype* ptr = new (NotNull, JSC::allocateCell<JSTestTypedefsPrototype>(vm.heap)) JSTestTypedefsPrototype(vm, globalObject, structure);
ptr->finishCreation(vm);
return ptr;
}
DECLARE_INFO;
static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
{
return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
}
private:
JSTestTypedefsPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
: JSC::JSNonFinalObject(vm, structure)
{
}
void finishCreation(JSC::VM&);
};
typedef JSDOMConstructor<JSTestTypedefs> JSTestTypedefsConstructor;
static const struct CompactHashIndex JSTestTypedefsTableIndex[2] = {
{ -1, -1 },
{ -1, -1 },
};
static const HashTableValue JSTestTypedefsTableValues[] =
{
{ 0, 0, NoIntrinsic, { 0, 0 } }
};
static const HashTable JSTestTypedefsTable = { 0, 1, false, JSTestTypedefsTableValues, JSTestTypedefsTableIndex };
static const HashTableValue JSTestTypedefsConstructorTableValues[] =
{
{ "TestSubObj", DontDelete | ReadOnly, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestTypedefsConstructorTestSubObj), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
};
template<> EncodedJSValue JSC_HOST_CALL JSTestTypedefsConstructor::construct(ExecState* state)
{
auto* castedThis = jsCast<JSTestTypedefsConstructor*>(state->callee());
if (UNLIKELY(state->argumentCount() < 2))
return throwVMError(state, createNotEnoughArgumentsError(state));
auto hello = state->argument(0).toWTFString(state);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
if (UNLIKELY(!state->argument(1).isObject()))
return throwArgumentMustBeFunctionError(*state, 1, "testCallback", "TestTypedefs", nullptr);
auto testCallback = JSTestCallback::create(asObject(state->uncheckedArgument(1)), castedThis->globalObject());
auto object = TestTypedefs::create(hello, *testCallback);
return JSValue::encode(asObject(toJSNewlyCreated(state, castedThis->globalObject(), WTFMove(object))));
}
template<> JSValue JSTestTypedefsConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
{
UNUSED_PARAM(vm);
return globalObject.functionPrototype();
}
template<> void JSTestTypedefsConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
{
putDirect(vm, vm.propertyNames->prototype, JSTestTypedefs::prototype(vm, &globalObject), DontDelete | ReadOnly | DontEnum);
putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral("TestTypedefs"))), ReadOnly | DontEnum);
putDirect(vm, vm.propertyNames->length, jsNumber(2), ReadOnly | DontEnum);
reifyStaticProperties(vm, JSTestTypedefsConstructorTableValues, *this);
}
template<> const ClassInfo JSTestTypedefsConstructor::s_info = { "TestTypedefs", &Base::s_info, 0, CREATE_METHOD_TABLE(JSTestTypedefsConstructor) };
static const HashTableValue JSTestTypedefsPrototypeTableValues[] =
{
{ "constructor", DontEnum, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestTypedefsConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestTypedefsConstructor) } },
{ "unsignedLongLongAttr", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestTypedefsUnsignedLongLongAttr), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestTypedefsUnsignedLongLongAttr) } },
{ "immutableSerializedScriptValue", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestTypedefsImmutableSerializedScriptValue), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestTypedefsImmutableSerializedScriptValue) } },
{ "attrWithGetterException", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestTypedefsAttrWithGetterException), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestTypedefsAttrWithGetterException) } },
{ "attrWithSetterException", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestTypedefsAttrWithSetterException), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestTypedefsAttrWithSetterException) } },
{ "stringAttrWithGetterException", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestTypedefsStringAttrWithGetterException), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestTypedefsStringAttrWithGetterException) } },
{ "stringAttrWithSetterException", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestTypedefsStringAttrWithSetterException), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestTypedefsStringAttrWithSetterException) } },
{ "func", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestTypedefsPrototypeFunctionFunc), (intptr_t) (0) } },
{ "setShadow", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestTypedefsPrototypeFunctionSetShadow), (intptr_t) (3) } },
{ "methodWithSequenceArg", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestTypedefsPrototypeFunctionMethodWithSequenceArg), (intptr_t) (1) } },
{ "nullableArrayArg", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestTypedefsPrototypeFunctionNullableArrayArg), (intptr_t) (1) } },
{ "funcWithClamp", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestTypedefsPrototypeFunctionFuncWithClamp), (intptr_t) (1) } },
{ "immutablePointFunction", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestTypedefsPrototypeFunctionImmutablePointFunction), (intptr_t) (0) } },
{ "stringArrayFunction", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestTypedefsPrototypeFunctionStringArrayFunction), (intptr_t) (1) } },
{ "stringArrayFunction2", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestTypedefsPrototypeFunctionStringArrayFunction2), (intptr_t) (1) } },
{ "callWithSequenceThatRequiresInclude", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestTypedefsPrototypeFunctionCallWithSequenceThatRequiresInclude), (intptr_t) (1) } },
{ "methodWithException", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestTypedefsPrototypeFunctionMethodWithException), (intptr_t) (0) } },
};
const ClassInfo JSTestTypedefsPrototype::s_info = { "TestTypedefsPrototype", &Base::s_info, 0, CREATE_METHOD_TABLE(JSTestTypedefsPrototype) };
void JSTestTypedefsPrototype::finishCreation(VM& vm)
{
Base::finishCreation(vm);
reifyStaticProperties(vm, JSTestTypedefsPrototypeTableValues, *this);
}
const ClassInfo JSTestTypedefs::s_info = { "TestTypedefs", &Base::s_info, &JSTestTypedefsTable, CREATE_METHOD_TABLE(JSTestTypedefs) };
JSTestTypedefs::JSTestTypedefs(Structure* structure, JSDOMGlobalObject& globalObject, Ref<TestTypedefs>&& impl)
: JSDOMWrapper<TestTypedefs>(structure, globalObject, WTFMove(impl))
{
}
JSObject* JSTestTypedefs::createPrototype(VM& vm, JSGlobalObject* globalObject)
{
return JSTestTypedefsPrototype::create(vm, globalObject, JSTestTypedefsPrototype::createStructure(vm, globalObject, globalObject->objectPrototype()));
}
JSObject* JSTestTypedefs::prototype(VM& vm, JSGlobalObject* globalObject)
{
return getDOMPrototype<JSTestTypedefs>(vm, globalObject);
}
void JSTestTypedefs::destroy(JSC::JSCell* cell)
{
JSTestTypedefs* thisObject = static_cast<JSTestTypedefs*>(cell);
thisObject->JSTestTypedefs::~JSTestTypedefs();
}
EncodedJSValue jsTestTypedefsUnsignedLongLongAttr(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
UNUSED_PARAM(state);
UNUSED_PARAM(thisValue);
JSValue decodedThisValue = JSValue::decode(thisValue);
auto* castedThis = jsDynamicCast<JSTestTypedefs*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, "TestTypedefs", "unsignedLongLongAttr");
}
auto& impl = castedThis->wrapped();
JSValue result = jsNumber(impl.unsignedLongLongAttr());
return JSValue::encode(result);
}
EncodedJSValue jsTestTypedefsImmutableSerializedScriptValue(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
UNUSED_PARAM(state);
UNUSED_PARAM(thisValue);
JSValue decodedThisValue = JSValue::decode(thisValue);
auto* castedThis = jsDynamicCast<JSTestTypedefs*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, "TestTypedefs", "immutableSerializedScriptValue");
}
auto& impl = castedThis->wrapped();
JSValue result = impl.immutableSerializedScriptValue() ? impl.immutableSerializedScriptValue()->deserialize(state, castedThis->globalObject(), 0) : jsNull();
return JSValue::encode(result);
}
EncodedJSValue jsTestTypedefsConstructorTestSubObj(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
UNUSED_PARAM(state);
UNUSED_PARAM(thisValue);
JSValue decodedThisValue = JSValue::decode(thisValue);
auto* castedThis = jsDynamicCast<JSTestTypedefs*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, "TestTypedefs", "TestSubObj");
}
return JSValue::encode(JSTestSubObj::getConstructor(state->vm(), castedThis->globalObject()));
}
EncodedJSValue jsTestTypedefsAttrWithGetterException(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
UNUSED_PARAM(state);
UNUSED_PARAM(thisValue);
JSValue decodedThisValue = JSValue::decode(thisValue);
auto* castedThis = jsDynamicCast<JSTestTypedefs*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, "TestTypedefs", "attrWithGetterException");
}
ExceptionCode ec = 0;
auto& impl = castedThis->wrapped();
JSValue result = jsNumber(impl.attrWithGetterException(ec));
setDOMException(state, ec);
return JSValue::encode(result);
}
EncodedJSValue jsTestTypedefsAttrWithSetterException(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
UNUSED_PARAM(state);
UNUSED_PARAM(thisValue);
JSValue decodedThisValue = JSValue::decode(thisValue);
auto* castedThis = jsDynamicCast<JSTestTypedefs*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, "TestTypedefs", "attrWithSetterException");
}
auto& impl = castedThis->wrapped();
JSValue result = jsNumber(impl.attrWithSetterException());
return JSValue::encode(result);
}
EncodedJSValue jsTestTypedefsStringAttrWithGetterException(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
UNUSED_PARAM(state);
UNUSED_PARAM(thisValue);
JSValue decodedThisValue = JSValue::decode(thisValue);
auto* castedThis = jsDynamicCast<JSTestTypedefs*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, "TestTypedefs", "stringAttrWithGetterException");
}
ExceptionCode ec = 0;
auto& impl = castedThis->wrapped();
JSValue result = jsStringWithCache(state, impl.stringAttrWithGetterException(ec));
setDOMException(state, ec);
return JSValue::encode(result);
}
EncodedJSValue jsTestTypedefsStringAttrWithSetterException(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
UNUSED_PARAM(state);
UNUSED_PARAM(thisValue);
JSValue decodedThisValue = JSValue::decode(thisValue);
auto* castedThis = jsDynamicCast<JSTestTypedefs*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, "TestTypedefs", "stringAttrWithSetterException");
}
auto& impl = castedThis->wrapped();
JSValue result = jsStringWithCache(state, impl.stringAttrWithSetterException());
return JSValue::encode(result);
}
EncodedJSValue jsTestTypedefsConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
JSTestTypedefsPrototype* domObject = jsDynamicCast<JSTestTypedefsPrototype*>(JSValue::decode(thisValue));
if (UNLIKELY(!domObject))
return throwVMTypeError(state);
return JSValue::encode(JSTestTypedefs::getConstructor(state->vm(), domObject->globalObject()));
}
bool setJSTestTypedefsConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
{
JSValue value = JSValue::decode(encodedValue);
JSTestTypedefsPrototype* domObject = jsDynamicCast<JSTestTypedefsPrototype*>(JSValue::decode(thisValue));
if (UNLIKELY(!domObject)) {
throwVMTypeError(state);
return false;
}
return domObject->putDirect(state->vm(), state->propertyNames().constructor, value);
}
bool setJSTestTypedefsUnsignedLongLongAttr(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
{
JSValue value = JSValue::decode(encodedValue);
UNUSED_PARAM(thisValue);
JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(JSValue::decode(thisValue));
if (UNLIKELY(!castedThis)) {
return throwSetterTypeError(*state, "TestTypedefs", "unsignedLongLongAttr");
}
auto& impl = castedThis->wrapped();
auto nativeValue = convert<uint64_t>(*state, value, NormalConversion);
if (UNLIKELY(state->hadException()))
return false;
impl.setUnsignedLongLongAttr(WTFMove(nativeValue));
return true;
}
bool setJSTestTypedefsImmutableSerializedScriptValue(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
{
JSValue value = JSValue::decode(encodedValue);
UNUSED_PARAM(thisValue);
JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(JSValue::decode(thisValue));
if (UNLIKELY(!castedThis)) {
return throwSetterTypeError(*state, "TestTypedefs", "immutableSerializedScriptValue");
}
auto& impl = castedThis->wrapped();
auto nativeValue = SerializedScriptValue::create(state, value, 0, 0);
if (UNLIKELY(state->hadException()))
return false;
impl.setImmutableSerializedScriptValue(WTFMove(nativeValue));
return true;
}
bool setJSTestTypedefsAttrWithGetterException(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
{
JSValue value = JSValue::decode(encodedValue);
UNUSED_PARAM(thisValue);
JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(JSValue::decode(thisValue));
if (UNLIKELY(!castedThis)) {
return throwSetterTypeError(*state, "TestTypedefs", "attrWithGetterException");
}
auto& impl = castedThis->wrapped();
auto nativeValue = convert<int32_t>(*state, value, NormalConversion);
if (UNLIKELY(state->hadException()))
return false;
impl.setAttrWithGetterException(WTFMove(nativeValue));
return true;
}
bool setJSTestTypedefsAttrWithSetterException(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
{
JSValue value = JSValue::decode(encodedValue);
UNUSED_PARAM(thisValue);
JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(JSValue::decode(thisValue));
if (UNLIKELY(!castedThis)) {
return throwSetterTypeError(*state, "TestTypedefs", "attrWithSetterException");
}
auto& impl = castedThis->wrapped();
ExceptionCode ec = 0;
auto nativeValue = convert<int32_t>(*state, value, NormalConversion);
if (UNLIKELY(state->hadException()))
return false;
impl.setAttrWithSetterException(WTFMove(nativeValue), ec);
setDOMException(state, ec);
return true;
}
bool setJSTestTypedefsStringAttrWithGetterException(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
{
JSValue value = JSValue::decode(encodedValue);
UNUSED_PARAM(thisValue);
JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(JSValue::decode(thisValue));
if (UNLIKELY(!castedThis)) {
return throwSetterTypeError(*state, "TestTypedefs", "stringAttrWithGetterException");
}
auto& impl = castedThis->wrapped();
auto nativeValue = value.toWTFString(state);
if (UNLIKELY(state->hadException()))
return false;
impl.setStringAttrWithGetterException(WTFMove(nativeValue));
return true;
}
bool setJSTestTypedefsStringAttrWithSetterException(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
{
JSValue value = JSValue::decode(encodedValue);
UNUSED_PARAM(thisValue);
JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(JSValue::decode(thisValue));
if (UNLIKELY(!castedThis)) {
return throwSetterTypeError(*state, "TestTypedefs", "stringAttrWithSetterException");
}
auto& impl = castedThis->wrapped();
ExceptionCode ec = 0;
auto nativeValue = value.toWTFString(state);
if (UNLIKELY(state->hadException()))
return false;
impl.setStringAttrWithSetterException(WTFMove(nativeValue), ec);
setDOMException(state, ec);
return true;
}
JSValue JSTestTypedefs::getConstructor(VM& vm, const JSGlobalObject* globalObject)
{
return getDOMConstructor<JSTestTypedefsConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
}
EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionFunc(ExecState* state)
{
JSValue thisValue = state->thisValue();
auto castedThis = jsDynamicCast<JSTestTypedefs*>(thisValue);
if (UNLIKELY(!castedThis))
return throwThisTypeError(*state, "TestTypedefs", "func");
ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestTypedefs::info());
auto& impl = castedThis->wrapped();
auto x = toNativeArray<int32_t>(*state, state->argument(0));
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
impl.func(WTFMove(x));
return JSValue::encode(jsUndefined());
}
EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionSetShadow(ExecState* state)
{
JSValue thisValue = state->thisValue();
auto castedThis = jsDynamicCast<JSTestTypedefs*>(thisValue);
if (UNLIKELY(!castedThis))
return throwThisTypeError(*state, "TestTypedefs", "setShadow");
ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestTypedefs::info());
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 3))
return throwVMError(state, createNotEnoughArgumentsError(state));
auto width = convert<float>(*state, state->argument(0), ShouldAllowNonFinite::Yes);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
auto height = convert<float>(*state, state->argument(1), ShouldAllowNonFinite::Yes);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
auto blur = convert<float>(*state, state->argument(2), ShouldAllowNonFinite::Yes);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
auto color = state->argument(3).isUndefined() ? String() : state->uncheckedArgument(3).toWTFString(state);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
auto alpha = state->argument(4).isUndefined() ? Optional<float>() : convert<float>(*state, state->uncheckedArgument(4), ShouldAllowNonFinite::Yes);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
impl.setShadow(WTFMove(width), WTFMove(height), WTFMove(blur), WTFMove(color), WTFMove(alpha));
return JSValue::encode(jsUndefined());
}
EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionMethodWithSequenceArg(ExecState* state)
{
JSValue thisValue = state->thisValue();
auto castedThis = jsDynamicCast<JSTestTypedefs*>(thisValue);
if (UNLIKELY(!castedThis))
return throwThisTypeError(*state, "TestTypedefs", "methodWithSequenceArg");
ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestTypedefs::info());
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, createNotEnoughArgumentsError(state));
auto sequenceArg = (toRefPtrNativeArray<SerializedScriptValue, JSSerializedScriptValue>(state, state->argument(0), &JSSerializedScriptValue::toWrapped));
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
JSValue result = jsNumber(impl.methodWithSequenceArg(WTFMove(sequenceArg)));
return JSValue::encode(result);
}
EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionNullableArrayArg(ExecState* state)
{
JSValue thisValue = state->thisValue();
auto castedThis = jsDynamicCast<JSTestTypedefs*>(thisValue);
if (UNLIKELY(!castedThis))
return throwThisTypeError(*state, "TestTypedefs", "nullableArrayArg");
ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestTypedefs::info());
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, createNotEnoughArgumentsError(state));
auto arrayArg = toNativeArray<String>(*state, state->argument(0));
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
impl.nullableArrayArg(WTFMove(arrayArg));
return JSValue::encode(jsUndefined());
}
EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionFuncWithClamp(ExecState* state)
{
JSValue thisValue = state->thisValue();
auto castedThis = jsDynamicCast<JSTestTypedefs*>(thisValue);
if (UNLIKELY(!castedThis))
return throwThisTypeError(*state, "TestTypedefs", "funcWithClamp");
ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestTypedefs::info());
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, createNotEnoughArgumentsError(state));
auto arg1 = convert<uint64_t>(*state, state->argument(0), Clamp);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
auto arg2 = state->argument(1).isUndefined() ? Optional<uint64_t>() : convert<uint64_t>(*state, state->uncheckedArgument(1), Clamp);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
impl.funcWithClamp(WTFMove(arg1), WTFMove(arg2));
return JSValue::encode(jsUndefined());
}
EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionImmutablePointFunction(ExecState* state)
{
JSValue thisValue = state->thisValue();
auto castedThis = jsDynamicCast<JSTestTypedefs*>(thisValue);
if (UNLIKELY(!castedThis))
return throwThisTypeError(*state, "TestTypedefs", "immutablePointFunction");
ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestTypedefs::info());
auto& impl = castedThis->wrapped();
JSValue result = toJS(state, castedThis->globalObject(), SVGPropertyTearOff<SVGPoint>::create(impl.immutablePointFunction()));
return JSValue::encode(result);
}
EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionStringArrayFunction(ExecState* state)
{
JSValue thisValue = state->thisValue();
auto castedThis = jsDynamicCast<JSTestTypedefs*>(thisValue);
if (UNLIKELY(!castedThis))
return throwThisTypeError(*state, "TestTypedefs", "stringArrayFunction");
ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestTypedefs::info());
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, createNotEnoughArgumentsError(state));
ExceptionCode ec = 0;
auto values = toNativeArray<String>(*state, state->argument(0));
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
JSValue result = jsArray(state, castedThis->globalObject(), impl.stringArrayFunction(WTFMove(values), ec));
setDOMException(state, ec);
return JSValue::encode(result);
}
EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionStringArrayFunction2(ExecState* state)
{
JSValue thisValue = state->thisValue();
auto castedThis = jsDynamicCast<JSTestTypedefs*>(thisValue);
if (UNLIKELY(!castedThis))
return throwThisTypeError(*state, "TestTypedefs", "stringArrayFunction2");
ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestTypedefs::info());
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, createNotEnoughArgumentsError(state));
ExceptionCode ec = 0;
auto values = toNativeArray<String>(*state, state->argument(0));
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
JSValue result = jsArray(state, castedThis->globalObject(), impl.stringArrayFunction2(WTFMove(values), ec));
setDOMException(state, ec);
return JSValue::encode(result);
}
EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionCallWithSequenceThatRequiresInclude(ExecState* state)
{
JSValue thisValue = state->thisValue();
auto castedThis = jsDynamicCast<JSTestTypedefs*>(thisValue);
if (UNLIKELY(!castedThis))
return throwThisTypeError(*state, "TestTypedefs", "callWithSequenceThatRequiresInclude");
ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestTypedefs::info());
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, createNotEnoughArgumentsError(state));
auto sequenceArg = (toRefPtrNativeArray<TestEventTarget, JSTestEventTarget>(state, state->argument(0), &JSTestEventTarget::toWrapped));
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
JSValue result = jsBoolean(impl.callWithSequenceThatRequiresInclude(WTFMove(sequenceArg)));
return JSValue::encode(result);
}
EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionMethodWithException(ExecState* state)
{
JSValue thisValue = state->thisValue();
auto castedThis = jsDynamicCast<JSTestTypedefs*>(thisValue);
if (UNLIKELY(!castedThis))
return throwThisTypeError(*state, "TestTypedefs", "methodWithException");
ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestTypedefs::info());
auto& impl = castedThis->wrapped();
ExceptionCode ec = 0;
impl.methodWithException(ec);
setDOMException(state, ec);
return JSValue::encode(jsUndefined());
}
bool JSTestTypedefsOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
{
UNUSED_PARAM(handle);
UNUSED_PARAM(visitor);
return false;
}
void JSTestTypedefsOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
{
auto* jsTestTypedefs = jsCast<JSTestTypedefs*>(handle.slot()->asCell());
auto& world = *static_cast<DOMWrapperWorld*>(context);
uncacheWrapper(world, &jsTestTypedefs->wrapped(), jsTestTypedefs);
}
#if ENABLE(BINDING_INTEGRITY)
#if PLATFORM(WIN)
#pragma warning(disable: 4483)
extern "C" { extern void (*const __identifier("??_7TestTypedefs@WebCore@@6B@")[])(); }
#else
extern "C" { extern void* _ZTVN7WebCore12TestTypedefsE[]; }
#endif
#endif
JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<TestTypedefs>&& impl)
{
#if ENABLE(BINDING_INTEGRITY)
void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
#if PLATFORM(WIN)
void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7TestTypedefs@WebCore@@6B@"));
#else
void* expectedVTablePointer = &_ZTVN7WebCore12TestTypedefsE[2];
#if COMPILER(CLANG)
static_assert(__is_polymorphic(TestTypedefs), "TestTypedefs is not polymorphic");
#endif
#endif
RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
#endif
return createWrapper<JSTestTypedefs, TestTypedefs>(globalObject, WTFMove(impl));
}
JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestTypedefs& impl)
{
return wrap(state, globalObject, impl);
}
TestTypedefs* JSTestTypedefs::toWrapped(JSC::JSValue value)
{
if (auto* wrapper = jsDynamicCast<JSTestTypedefs*>(value))
return &wrapper->wrapped();
return nullptr;
}
}