Exemplo n.º 1
0
static void hasMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
{
    ExceptionState exceptionState(ExceptionState::ExecutionContext, "has", "TestInterface2", info.Holder(), info.GetIsolate());
    if (UNLIKELY(info.Length() < 1)) {
        setMinimumArityTypeError(exceptionState, 1, info.Length());
        exceptionState.throwIfNeeded();
        return;
    }
    TestInterface2* impl = V8TestInterface2::toImpl(info.Holder());
    TestInterfaceEmpty* value;
    {
        value = V8TestInterfaceEmpty::toImplWithTypeCheck(info.GetIsolate(), info[0]);
        if (!value) {
            exceptionState.throwTypeError("parameter 1 is not of type 'TestInterfaceEmpty'.");
            exceptionState.throwIfNeeded();
            return;
        }
    }
    ScriptState* scriptState = ScriptState::current(info.GetIsolate());
    bool result = impl->hasForBinding(scriptState, value, exceptionState);
    if (exceptionState.hadException()) {
        exceptionState.throwIfNeeded();
        return;
    }
    v8SetReturnValueBool(info, result);
}
Exemplo n.º 2
0
static void hasMethod(const v8::FunctionCallbackInfo<v8::Value>& info) {
  ExceptionState exceptionState(info.GetIsolate(), ExceptionState::ExecutionContext, "TestInterface2", "has");

  TestInterface2* impl = V8TestInterface2::toImpl(info.Holder());

  ScriptState* scriptState = ScriptState::forReceiverObject(info);

  if (UNLIKELY(info.Length() < 1)) {
    exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, info.Length()));
    return;
  }

  TestInterfaceEmpty* value;
  value = V8TestInterfaceEmpty::toImplWithTypeCheck(info.GetIsolate(), info[0]);
  if (!value) {
    exceptionState.throwTypeError("parameter 1 is not of type 'TestInterfaceEmpty'.");

    return;
  }

  bool result = impl->hasForBinding(scriptState, value, exceptionState);
  if (exceptionState.hadException()) {
    return;
  }
  v8SetReturnValueBool(info, result);
}