static void forEachMethod(const v8::FunctionCallbackInfo<v8::Value>& info) { ExceptionState exceptionState(ExceptionState::ExecutionContext, "forEach", "TestInterface2", info.Holder(), info.GetIsolate()); if (UNLIKELY(info.Length() < 1)) { setMinimumArityTypeError(exceptionState, 1, info.Length()); exceptionState.throwIfNeeded(); return; } TestInterface2* impl = V8TestInterface2::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 forEachMethod(const v8::FunctionCallbackInfo<v8::Value>& info) { ExceptionState exceptionState(info.GetIsolate(), ExceptionState::ExecutionContext, "TestInterface2", "forEach"); TestInterface2* impl = V8TestInterface2::toImpl(info.Holder()); ScriptState* scriptState = ScriptState::forReceiverObject(info); if (UNLIKELY(info.Length() < 1)) { exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, info.Length())); return; } ScriptValue callback; ScriptValue thisArg; if (!info[0]->IsFunction()) { exceptionState.throwTypeError("The callback provided as parameter 1 is not a function."); return; } callback = ScriptValue(ScriptState::current(info.GetIsolate()), info[0]); thisArg = ScriptValue(ScriptState::current(info.GetIsolate()), info[1]); impl->forEachForBinding(scriptState, ScriptValue(scriptState, info.Holder()), callback, thisArg, exceptionState); if (exceptionState.hadException()) { return; } }