static void forEachMethod(const v8::FunctionCallbackInfo<v8::Value>& info) { ExceptionState exceptionState(ExceptionState::ExecutionContext, "forEach", "TestInterfaceGarbageCollected", info.Holder(), info.GetIsolate()); if (UNLIKELY(info.Length() < 1)) { setMinimumArityTypeError(exceptionState, 1, info.Length()); exceptionState.throwIfNeeded(); return; } TestInterfaceGarbageCollected* impl = V8TestInterfaceGarbageCollected::toImpl(info.Holder()); ScriptValue callback; ScriptValue thisArg; { if (!info[0]->IsFunction()) { exceptionState.throwTypeError("The callback provided as parameter 1 is not a function."); exceptionState.throwIfNeeded(); return; } callback = ScriptValue(ScriptState::current(info.GetIsolate()), info[0]); thisArg = ScriptValue(ScriptState::current(info.GetIsolate()), info[1]); } ScriptState* scriptState = ScriptState::current(info.GetIsolate()); impl->forEachForBinding(scriptState, ScriptValue(scriptState, info.This()), callback, thisArg, exceptionState); if (exceptionState.hadException()) { exceptionState.throwIfNeeded(); return; } }
static void attr1AttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) { v8::Handle<v8::Object> holder = info.Holder(); TestInterfaceGarbageCollected* impl = V8TestInterfaceGarbageCollected::toImpl(holder); TestInterfaceGarbageCollected* cppValue = V8TestInterfaceGarbageCollected::toImplWithTypeCheck(info.GetIsolate(), v8Value); impl->setAttr1(WTF::getPtr(cppValue)); }
static void clearMethod(const v8::FunctionCallbackInfo<v8::Value>& info) { ExceptionState exceptionState(ExceptionState::ExecutionContext, "clear", "TestInterfaceGarbageCollected", info.Holder(), info.GetIsolate()); TestInterfaceGarbageCollected* impl = V8TestInterfaceGarbageCollected::toImpl(info.Holder()); ScriptState* scriptState = ScriptState::current(info.GetIsolate()); impl->clearForBinding(scriptState, exceptionState); if (exceptionState.hadException()) { exceptionState.throwIfNeeded(); return; } }
static void iteratorMethod(const v8::FunctionCallbackInfo<v8::Value>& info) { ExceptionState exceptionState(ExceptionState::ExecutionContext, "iterator", "TestInterfaceGarbageCollected", info.Holder(), info.GetIsolate()); TestInterfaceGarbageCollected* impl = V8TestInterfaceGarbageCollected::toImpl(info.Holder()); ScriptState* scriptState = ScriptState::current(info.GetIsolate()); RawPtr<Iterator> result = impl->iterator(scriptState, exceptionState); if (exceptionState.hadException()) { exceptionState.throwIfNeeded(); return; } v8SetReturnValue(info, result.release()); }
static void attr1AttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info) { v8::Local<v8::Object> holder = info.Holder(); ExceptionState exceptionState(ExceptionState::SetterContext, "attr1", "TestInterfaceGarbageCollected", holder, info.GetIsolate()); TestInterfaceGarbageCollected* impl = V8TestInterfaceGarbageCollected::toImpl(holder); TestInterfaceGarbageCollected* cppValue = V8TestInterfaceGarbageCollected::toImplWithTypeCheck(info.GetIsolate(), v8Value); if (!cppValue) { exceptionState.throwTypeError("The provided value is not of type 'TestInterfaceGarbageCollected'."); exceptionState.throwIfNeeded(); return; } impl->setAttr1(WTF::getPtr(cppValue)); }
static void funcMethod(const v8::FunctionCallbackInfo<v8::Value>& info) { if (UNLIKELY(info.Length() < 1)) { V8ThrowException::throwException(createMinimumArityTypeErrorForMethod("func", "TestInterfaceGarbageCollected", 1, info.Length(), info.GetIsolate()), info.GetIsolate()); return; } TestInterfaceGarbageCollected* impl = V8TestInterfaceGarbageCollected::toImpl(info.Holder()); TestInterfaceGarbageCollected* arg; { arg = V8TestInterfaceGarbageCollected::toImplWithTypeCheck(info.GetIsolate(), info[0]); } impl->func(arg); }
static void funcMethod(const v8::FunctionCallbackInfo<v8::Value>& info) { if (UNLIKELY(info.Length() < 1)) { throwMinimumArityTypeErrorForMethod("func", "TestInterfaceGarbageCollected", 1, info.Length(), info.GetIsolate()); return; } TestInterfaceGarbageCollected* impl = V8TestInterfaceGarbageCollected::toNative(info.Holder()); TestInterfaceGarbageCollected* arg; { v8::TryCatch block; TONATIVE_VOID_INTERNAL(arg, V8TestInterfaceGarbageCollected::toNativeWithTypeCheck(info.GetIsolate(), info[0])); } impl->func(arg); }
static void funcMethod(const v8::FunctionCallbackInfo<v8::Value>& info) { if (UNLIKELY(info.Length() < 1)) { V8ThrowException::throwException(createMinimumArityTypeErrorForMethod(info.GetIsolate(), "func", "TestInterfaceGarbageCollected", 1, info.Length()), info.GetIsolate()); return; } TestInterfaceGarbageCollected* impl = V8TestInterfaceGarbageCollected::toImpl(info.Holder()); TestInterfaceGarbageCollected* arg; { arg = V8TestInterfaceGarbageCollected::toImplWithTypeCheck(info.GetIsolate(), info[0]); if (!arg) { V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::failedToExecute("func", "TestInterfaceGarbageCollected", "parameter 1 is not of type 'TestInterfaceGarbageCollected'.")); return; } } impl->func(arg); }
static void deleteMethod(const v8::FunctionCallbackInfo<v8::Value>& info) { ExceptionState exceptionState(ExceptionState::ExecutionContext, "delete", "TestInterfaceGarbageCollected", info.Holder(), info.GetIsolate()); if (UNLIKELY(info.Length() < 1)) { setMinimumArityTypeError(exceptionState, 1, info.Length()); exceptionState.throwIfNeeded(); return; } TestInterfaceGarbageCollected* impl = V8TestInterfaceGarbageCollected::toImpl(info.Holder()); V8StringResource<> value; { value = info[0]; if (!value.prepare()) return; } ScriptState* scriptState = ScriptState::current(info.GetIsolate()); bool result = impl->deleteForBinding(scriptState, value, exceptionState); if (exceptionState.hadException()) { exceptionState.throwIfNeeded(); return; } v8SetReturnValueBool(info, result); }
static void attr1AttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) { v8::Local<v8::Object> holder = info.Holder(); TestInterfaceGarbageCollected* impl = V8TestInterfaceGarbageCollected::toImpl(holder); v8SetReturnValueFast(info, WTF::getPtr(impl->attr1()), impl); }
static void attr1AttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info) { v8::Handle<v8::Object> holder = info.Holder(); TestInterfaceGarbageCollected* impl = V8TestInterfaceGarbageCollected::toNative(holder); v8SetReturnValueFast(info, WTF::getPtr(impl->attr1()), impl); }