static void constructor3(const v8::FunctionCallbackInfo<v8::Value>& info) { ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestInterfaceConstructor", info.Holder(), info.GetIsolate()); V8StringResource<> arg; V8StringResource<> optArg; { TOSTRING_VOID_INTERNAL(arg, info[0]); if (UNLIKELY(info.Length() <= 1)) { ScriptState* scriptState = ScriptState::current(info.GetIsolate()); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); Document& document = *toDocument(currentExecutionContext(info.GetIsolate())); RefPtr<TestInterfaceConstructor> impl = TestInterfaceConstructor::create(scriptState, executionContext, document, arg, exceptionState); if (exceptionState.hadException()) { exceptionState.throwIfNeeded(); return; } v8::Local<v8::Object> wrapper = info.Holder(); impl->associateWithWrapper(info.GetIsolate(), &V8TestInterfaceConstructor::wrapperTypeInfo, wrapper); v8SetReturnValue(info, wrapper); return; } TOSTRING_VOID_INTERNAL(optArg, info[1]); } ScriptState* scriptState = ScriptState::current(info.GetIsolate()); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); Document& document = *toDocument(currentExecutionContext(info.GetIsolate())); RefPtr<TestInterfaceConstructor> impl = TestInterfaceConstructor::create(scriptState, executionContext, document, arg, optArg, exceptionState); if (exceptionState.hadException()) { exceptionState.throwIfNeeded(); return; } v8::Local<v8::Object> wrapper = info.Holder(); impl->associateWithWrapper(info.GetIsolate(), &V8TestInterfaceConstructor::wrapperTypeInfo, wrapper); v8SetReturnValue(info, wrapper); }
static void V8TestInterfaceConstructorConstructorCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { if (!info.IsConstructCall()) { V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::constructorNotCallableAsFunction("Audio")); return; } if (ConstructorMode::current(info.GetIsolate()) == ConstructorMode::WrapExistingObject) { v8SetReturnValue(info, info.Holder()); return; } ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestInterfaceConstructor", info.Holder(), info.GetIsolate()); if (UNLIKELY(info.Length() < 1)) { setMinimumArityTypeError(exceptionState, 1, info.Length()); exceptionState.throwIfNeeded(); return; } V8StringResource<> arg; V8StringResource<> optArg; { TOSTRING_VOID_INTERNAL(arg, info[0]); if (UNLIKELY(info.Length() <= 1)) { ScriptState* scriptState = ScriptState::current(info.GetIsolate()); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); Document& document = *toDocument(currentExecutionContext(info.GetIsolate())); RefPtr<TestInterfaceConstructor> impl = TestInterfaceConstructor::createForJSConstructor(scriptState, executionContext, document, arg, exceptionState); if (exceptionState.hadException()) { exceptionState.throwIfNeeded(); return; } v8::Local<v8::Object> wrapper = info.Holder(); impl->associateWithWrapper(info.GetIsolate(), &V8TestInterfaceConstructorConstructor::wrapperTypeInfo, wrapper); v8SetReturnValue(info, wrapper); return; } TOSTRING_VOID_INTERNAL(optArg, info[1]); } ScriptState* scriptState = ScriptState::current(info.GetIsolate()); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); Document& document = *toDocument(currentExecutionContext(info.GetIsolate())); RefPtr<TestInterfaceConstructor> impl = TestInterfaceConstructor::createForJSConstructor(scriptState, executionContext, document, arg, optArg, exceptionState); if (exceptionState.hadException()) { exceptionState.throwIfNeeded(); return; } v8::Local<v8::Object> wrapper = info.Holder(); impl->associateWithWrapper(info.GetIsolate(), &V8TestInterfaceConstructorConstructor::wrapperTypeInfo, wrapper); v8SetReturnValue(info, wrapper); }
static void namedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info) { if (UNLIKELY(info.Length() < 1)) { throwMinimumArityTypeErrorForMethod("namedItem", "TestSpecialOperations", 1, info.Length(), info.GetIsolate()); return; } TestSpecialOperations* impl = V8TestSpecialOperations::toNative(info.Holder()); V8StringResource<> name; { TOSTRING_VOID_INTERNAL(name, info[0]); } bool result0Enabled = false; RefPtrWillBeRawPtr<Node> result0; bool result1Enabled = false; RefPtrWillBeRawPtr<NodeList> result1; impl->getItem(name, result0Enabled, result0, result1Enabled, result1); if (result0Enabled) { v8SetReturnValue(info, result0.release()); return; } if (result1Enabled) { v8SetReturnValue(info, result1.release()); return; } v8SetReturnValueNull(info); }
static void constructor1(const v8::FunctionCallbackInfo<v8::Value>& info) { V8StringResource<> stringArg; { TOSTRING_VOID_INTERNAL(stringArg, info[0]); } RefPtr<TestInterfaceConstructor2> impl = TestInterfaceConstructor2::create(stringArg); v8::Handle<v8::Object> wrapper = info.Holder(); impl->associateWithWrapper(&V8TestInterfaceConstructor2::wrapperTypeInfo, wrapper, info.GetIsolate()); v8SetReturnValue(info, wrapper); }
static void constructor4(const v8::FunctionCallbackInfo<v8::Value>& info) { ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestInterfaceConstructor2", info.Holder(), info.GetIsolate()); TestInterfaceEmpty* testInterfaceEmptyArg; int longArg; V8StringResource<> defaultUndefinedOptionalStringArg; V8StringResource<> defaultNullStringOptionalStringArg; Dictionary defaultUndefinedOptionalDictionaryArg; V8StringResource<> optionalStringArg; { testInterfaceEmptyArg = V8TestInterfaceEmpty::toImplWithTypeCheck(info.GetIsolate(), info[0]); TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(longArg, toInt32(info[1], exceptionState), exceptionState); TOSTRING_VOID_INTERNAL(defaultUndefinedOptionalStringArg, info[2]); if (!info[3]->IsUndefined()) { TOSTRING_VOID_INTERNAL(defaultNullStringOptionalStringArg, info[3]); } else { defaultNullStringOptionalStringArg = nullptr; } if (!isUndefinedOrNull(info[4]) && !info[4]->IsObject()) { exceptionState.throwTypeError("parameter 5 ('defaultUndefinedOptionalDictionaryArg') is not an object."); exceptionState.throwIfNeeded(); return; } defaultUndefinedOptionalDictionaryArg = Dictionary(info[4], info.GetIsolate()); if (UNLIKELY(info.Length() <= 5)) { RefPtr<TestInterfaceConstructor2> impl = TestInterfaceConstructor2::create(testInterfaceEmptyArg, longArg, defaultUndefinedOptionalStringArg, defaultNullStringOptionalStringArg, defaultUndefinedOptionalDictionaryArg); v8::Handle<v8::Object> wrapper = info.Holder(); impl->associateWithWrapper(&V8TestInterfaceConstructor2::wrapperTypeInfo, wrapper, info.GetIsolate()); v8SetReturnValue(info, wrapper); return; } TOSTRING_VOID_INTERNAL(optionalStringArg, info[5]); } RefPtr<TestInterfaceConstructor2> impl = TestInterfaceConstructor2::create(testInterfaceEmptyArg, longArg, defaultUndefinedOptionalStringArg, defaultNullStringOptionalStringArg, defaultUndefinedOptionalDictionaryArg, optionalStringArg); v8::Handle<v8::Object> wrapper = info.Holder(); impl->associateWithWrapper(&V8TestInterfaceConstructor2::wrapperTypeInfo, wrapper, info.GetIsolate()); v8SetReturnValue(info, wrapper); }
static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) { if (UNLIKELY(info.Length() < 1)) { V8ThrowException::throwException(createMinimumArityTypeErrorForConstructor("TestInterfaceGarbageCollected", 1, info.Length(), info.GetIsolate()), info.GetIsolate()); return; } V8StringResource<> str; { TOSTRING_VOID_INTERNAL(str, info[0]); } RawPtr<TestInterfaceGarbageCollected> impl = TestInterfaceGarbageCollected::create(str); v8::Handle<v8::Object> wrapper = info.Holder(); impl->associateWithWrapper(&V8TestInterfaceGarbageCollected::wrapperTypeInfo, wrapper, info.GetIsolate()); v8SetReturnValue(info, wrapper); }
static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) { v8::Isolate* isolate = info.GetIsolate(); if (UNLIKELY(info.Length() < 1)) { throwMinimumArityTypeErrorForConstructor("TestTypedefs", 1, info.Length(), info.GetIsolate()); return; } V8StringResource<> stringArg; { TOSTRING_VOID_INTERNAL(stringArg, info[0]); } RefPtr<TestTypedefs> impl = TestTypedefs::create(stringArg); v8::Handle<v8::Object> wrapper = info.Holder(); V8DOMWrapper::associateObjectWithWrapper<V8TestTypedefs>(impl.release(), &V8TestTypedefs::wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Independent); v8SetReturnValue(info, wrapper); }
static void voidMethodFloatArgStringArgMethod(const v8::FunctionCallbackInfo<v8::Value>& info) { if (UNLIKELY(info.Length() < 2)) { throwMinimumArityTypeErrorForMethod("voidMethodFloatArgStringArg", "TestTypedefs", 2, info.Length(), info.GetIsolate()); return; } TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder()); float floatArg; V8StringResource<> stringArg; { v8::TryCatch block; V8RethrowTryCatchScope rethrow(block); TONATIVE_VOID_INTERNAL(floatArg, static_cast<float>(info[0]->NumberValue())); TOSTRING_VOID_INTERNAL(stringArg, info[1]); } impl->voidMethodFloatArgStringArg(floatArg, stringArg); }
static void constructor2(const v8::FunctionCallbackInfo<v8::Value>& info) { ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestInterfaceConstructor", info.Holder(), info.GetIsolate()); double doubleArg; V8StringResource<> stringArg; TestInterfaceEmpty* testInterfaceEmptyArg; Dictionary dictionaryArg; Vector<String> sequenceStringArg; Vector<Dictionary> sequenceDictionaryArg; Dictionary optionalDictionaryArg; TestInterfaceEmpty* optionalTestInterfaceEmptyArg; { TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(doubleArg, toDouble(info[0], exceptionState), exceptionState); TOSTRING_VOID_INTERNAL(stringArg, info[1]); testInterfaceEmptyArg = V8TestInterfaceEmpty::toImplWithTypeCheck(info.GetIsolate(), info[2]); if (!isUndefinedOrNull(info[3]) && !info[3]->IsObject()) { exceptionState.throwTypeError("parameter 4 ('dictionaryArg') is not an object."); exceptionState.throwIfNeeded(); return; } TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(dictionaryArg, Dictionary(info[3], info.GetIsolate(), exceptionState), exceptionState); TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(sequenceStringArg, toImplArray<String>(info[4], 5, info.GetIsolate(), exceptionState), exceptionState); TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(sequenceDictionaryArg, toImplArray<Dictionary>(info[5], 6, info.GetIsolate(), exceptionState), exceptionState); if (!isUndefinedOrNull(info[6]) && !info[6]->IsObject()) { exceptionState.throwTypeError("parameter 7 ('optionalDictionaryArg') is not an object."); exceptionState.throwIfNeeded(); return; } TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(optionalDictionaryArg, Dictionary(info[6], info.GetIsolate(), exceptionState), exceptionState); optionalTestInterfaceEmptyArg = V8TestInterfaceEmpty::toImplWithTypeCheck(info.GetIsolate(), info[7]); } ScriptState* scriptState = ScriptState::current(info.GetIsolate()); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); Document& document = *toDocument(currentExecutionContext(info.GetIsolate())); RefPtr<TestInterfaceConstructor> impl = TestInterfaceConstructor::create(scriptState, executionContext, document, doubleArg, stringArg, testInterfaceEmptyArg, dictionaryArg, sequenceStringArg, sequenceDictionaryArg, optionalDictionaryArg, optionalTestInterfaceEmptyArg, exceptionState); if (exceptionState.hadException()) { exceptionState.throwIfNeeded(); return; } v8::Local<v8::Object> wrapper = info.Holder(); impl->associateWithWrapper(info.GetIsolate(), &V8TestInterfaceConstructor::wrapperTypeInfo, wrapper); v8SetReturnValue(info, wrapper); }
static void V8TestInterfaceWillBeGarbageCollectedConstructorCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { if (!info.IsConstructCall()) { V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::constructorNotCallableAsFunction("TestInterface")); return; } if (ConstructorMode::current(info.GetIsolate()) == ConstructorMode::WrapExistingObject) { v8SetReturnValue(info, info.Holder()); return; } if (UNLIKELY(info.Length() < 1)) { V8ThrowException::throwException(createMinimumArityTypeErrorForConstructor(info.GetIsolate(), "TestInterfaceWillBeGarbageCollected", 1, info.Length()), info.GetIsolate()); return; } V8StringResource<> str; { TOSTRING_VOID_INTERNAL(str, info[0]); } RefPtrWillBeRawPtr<TestInterfaceWillBeGarbageCollected> impl = TestInterfaceWillBeGarbageCollected::createForJSConstructor(str); v8::Local<v8::Object> wrapper = info.Holder(); impl->associateWithWrapper(info.GetIsolate(), &V8TestInterfaceWillBeGarbageCollectedConstructor::wrapperTypeInfo, wrapper); v8SetReturnValue(info, wrapper); }