示例#1
0
static void namedPropertyGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
{
    if (info.Holder()->HasRealNamedProperty(name))
        return;
    if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty())
        return;

    TestInterface* impl = V8TestInterface::toNative(info.Holder());
    AtomicString propertyName = toCoreAtomicString(name);
    bool result0Enabled = false;
    RefPtr<Node> result0;
    bool result1Enabled = false;
    RefPtr<NodeList> result1;
    impl->getItem(propertyName, result0Enabled, result0, result1Enabled, result1);
    if (!result0Enabled && !result1Enabled)
        return;
    if (result0Enabled) {
        v8SetReturnValueFast(info, WTF::getPtr(result0.release()), impl);
        return;
    }
    if (result1Enabled) {
        v8SetReturnValueFast(info, WTF::getPtr(result1.release()), impl);
        return;
    }
    v8SetReturnValueNull(info);
}
示例#2
0
static void namedPropertyGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
{
    if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty())
        return;
    if (info.Holder()->HasRealNamedCallbackProperty(name))
        return;
    if (info.Holder()->HasRealNamedProperty(name))
        return;

    TestInterface* collection = V8TestInterface::toNative(info.Holder());
    AtomicString propertyName = toCoreAtomicString(name);
    bool element0Enabled = false;
    RefPtr<Node> element0;
    bool element1Enabled = false;
    RefPtr<NodeList> element1;
    collection->getItem(propertyName, element0Enabled, element0, element1Enabled, element1);
    if (element0Enabled) {
        v8SetReturnValueFast(info, element0.release(), collection);
        return;
    }

    if (element1Enabled) {
        v8SetReturnValueFast(info, element1.release(), collection);
        return;
    }

    return;
}
示例#3
0
static void namedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
{
    if (UNLIKELY(info.Length() < 1)) {
        throwTypeError(ExceptionMessages::failedToExecute("namedItem", "TestInterface", ExceptionMessages::notEnoughArguments(1, info.Length())), info.GetIsolate());
        return;
    }
    TestInterface* impl = V8TestInterface::toNative(info.Holder());
    V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, name, info[0]);
    bool result0Enabled = false;
    RefPtr<Node> result0;
    bool result1Enabled = false;
    RefPtr<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);
}