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 namedPropertyGetter(const AtomicString& name, const v8::PropertyCallbackInfo<v8::Value>& info) { TestSpecialOperations* impl = V8TestSpecialOperations::toImpl(info.Holder()); NodeOrNodeList result; impl->getItem(name, result); if (result.isNull()) return; v8SetReturnValue(info, result); }
static void namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) { TestSpecialOperations* impl = V8TestSpecialOperations::toNative(info.Holder()); TOSTRING_VOID(V8StringResource<>, propertyName, name); TONATIVE_VOID(Node*, propertyValue, V8Node::toNativeWithTypeCheck(info.GetIsolate(), v8Value)); bool result = impl->anonymousNamedSetter(propertyName, propertyValue); if (!result) return; v8SetReturnValue(info, v8Value); }
static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& info) { ExceptionState exceptionState(info.GetIsolate(), ExceptionState::EnumerationContext, "TestSpecialOperations"); TestSpecialOperations* impl = V8TestSpecialOperations::toImpl(info.Holder()); Vector<String> names; impl->namedPropertyEnumerator(names, exceptionState); if (exceptionState.hadException()) return; v8SetReturnValue(info, toV8(names, info.Holder(), info.GetIsolate()).As<v8::Array>()); }
static void namedPropertyQuery(const AtomicString& name, const v8::PropertyCallbackInfo<v8::Integer>& info) { const CString& nameInUtf8 = name.utf8(); ExceptionState exceptionState(info.GetIsolate(), ExceptionState::GetterContext, "TestSpecialOperations", nameInUtf8.data()); TestSpecialOperations* impl = V8TestSpecialOperations::toImpl(info.Holder()); bool result = impl->namedPropertyQuery(name, exceptionState); if (!result) return; v8SetReturnValueInt(info, v8::None); }
static void namedPropertySetter(const AtomicString& name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) { TestSpecialOperations* impl = V8TestSpecialOperations::toImpl(info.Holder()); Node* propertyValue = V8Node::toImplWithTypeCheck(info.GetIsolate(), v8Value); if (!propertyValue && !isUndefinedOrNull(v8Value)) { exceptionState.throwTypeError("The provided value is not of type 'Node'."); return; } bool result = impl->anonymousNamedSetter(name, propertyValue); if (!result) return; v8SetReturnValue(info, v8Value); }
static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Integer>& info) { TestSpecialOperations* impl = V8TestSpecialOperations::toNative(info.Holder()); AtomicString propertyName = toCoreAtomicString(name); v8::String::Utf8Value namedProperty(name); ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty, "TestSpecialOperations", info.Holder(), info.GetIsolate()); bool result = impl->namedPropertyQuery(propertyName, exceptionState); if (exceptionState.throwIfNeeded()) return; if (!result) return; v8SetReturnValueInt(info, v8::None); }
static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& info) { TestSpecialOperations* impl = V8TestSpecialOperations::toNative(info.Holder()); v8::Isolate* isolate = info.GetIsolate(); Vector<String> names; ExceptionState exceptionState(ExceptionState::EnumerationContext, "TestSpecialOperations", info.Holder(), isolate); impl->namedPropertyEnumerator(names, exceptionState); if (exceptionState.throwIfNeeded()) return; v8::Handle<v8::Array> v8names = v8::Array::New(isolate, names.size()); for (size_t i = 0; i < names.size(); ++i) v8names->Set(v8::Integer::New(isolate, i), v8String(isolate, names[i])); v8SetReturnValue(info, v8names); }
static void namedPropertyGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) { TestSpecialOperations* impl = V8TestSpecialOperations::toNative(info.Holder()); AtomicString propertyName = toCoreAtomicString(name); bool result0Enabled = false; RefPtrWillBeRawPtr<Node> result0; bool result1Enabled = false; RefPtrWillBeRawPtr<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); }