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; }
EncodedJSValue JSC_HOST_CALL jsTestInterfacePrototypeFunctionImplementsMethod2(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(JSTestInterface::info())) return throwVMTypeError(exec); JSTestInterface* castedThis = jsCast<JSTestInterface*>(asObject(thisValue)); ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestInterface::info()); TestInterface* impl = static_cast<TestInterface*>(castedThis->impl()); if (exec->argumentCount() < 2) return throwVMError(exec, createNotEnoughArgumentsError(exec)); ExceptionCode ec = 0; ScriptExecutionContext* scriptContext = jsCast<JSDOMGlobalObject*>(exec->lexicalGlobalObject())->scriptExecutionContext(); if (!scriptContext) return JSValue::encode(jsUndefined()); const String& strArg(exec->argument(0).isEmpty() ? String() : exec->argument(0).toString(exec)->value(exec)); if (exec->hadException()) return JSValue::encode(jsUndefined()); TestObj* objArg(toTestObj(exec->argument(1))); if (exec->hadException()) return JSValue::encode(jsUndefined()); JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl->implementsMethod2(scriptContext, strArg, objArg, ec))); setDOMException(exec, ec); return JSValue::encode(result); }
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); }
JSValue jsTestInterfaceImplementsNode(ExecState* exec, JSValue slotBase, PropertyName) { JSTestInterface* castedThis = jsCast<JSTestInterface*>(asObject(slotBase)); UNUSED_PARAM(exec); TestInterface* impl = static_cast<TestInterface*>(castedThis->impl()); JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl->implementsNode())); return result; }
JSValue jsTestInterfaceImplementsStr2(ExecState* exec, JSValue slotBase, PropertyName) { JSTestInterface* castedThis = jsCast<JSTestInterface*>(asObject(slotBase)); UNUSED_PARAM(exec); TestInterface* impl = static_cast<TestInterface*>(castedThis->impl()); JSValue result = jsStringWithCache(exec, impl->implementsStr2()); return result; }
void setJSTestInterfaceImplementsNode(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); JSTestInterface* castedThis = jsCast<JSTestInterface*>(thisObject); TestInterface* impl = static_cast<TestInterface*>(castedThis->impl()); Node* nativeValue(toNode(value)); if (exec->hadException()) return; impl->setImplementsNode(nativeValue); }
void setJSTestInterfaceImplementsStr2(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); JSTestInterface* castedThis = jsCast<JSTestInterface*>(thisObject); TestInterface* impl = static_cast<TestInterface*>(castedThis->impl()); const String& nativeValue(value.isEmpty() ? String() : value.toString(exec)->value(exec)); if (exec->hadException()) return; impl->setImplementsStr2(nativeValue); }
EncodedJSValue JSC_HOST_CALL jsTestInterfacePrototypeFunctionImplementsMethod1(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(JSTestInterface::info())) return throwVMTypeError(exec); JSTestInterface* castedThis = jsCast<JSTestInterface*>(asObject(thisValue)); ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestInterface::info()); TestInterface* impl = static_cast<TestInterface*>(castedThis->impl()); impl->implementsMethod1(); return JSValue::encode(jsUndefined()); }
static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Integer>& info) { TestInterface* collection = V8TestInterface::toNative(info.Holder()); AtomicString propertyName = toCoreAtomicString(name); ExceptionState exceptionState(info.Holder(), info.GetIsolate()); bool result = collection->namedPropertyQuery(propertyName, exceptionState); if (exceptionState.throwIfNeeded()) return; if (!result) return; v8SetReturnValueInt(info, v8::None); }
static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& info) { ExceptionState exceptionState(info.Holder(), info.GetIsolate()); TestInterface* collection = V8TestInterface::toNative(info.Holder()); Vector<String> names; collection->namedPropertyEnumerator(names, exceptionState); if (exceptionState.throwIfNeeded()) return; v8::Handle<v8::Array> v8names = v8::Array::New(info.GetIsolate(), names.size()); for (size_t i = 0; i < names.size(); ++i) v8names->Set(v8::Integer::New(info.GetIsolate(), i), v8String(info.GetIsolate(), names[i])); v8SetReturnValue(info, v8names); }
static void implementsEventHandlerAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info) { v8::Handle<v8::Object> holder = info.Holder(); TestInterface* impl = V8TestInterface::toNative(holder); ASSERT(impl); EventListener* v8Value = TestImplements::implementsEventHandlerAttribute(*impl); v8SetReturnValue(info, v8Value ? v8::Handle<v8::Value>(V8AbstractEventListener::cast(v8Value)->getListenerObject(impl->executionContext())) : v8::Handle<v8::Value>(v8::Null(info.GetIsolate()))); }
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); }
static void implementsEventHandlerAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info) { TestInterface* imp = V8TestInterface::toNative(info.Holder()); EventListener* jsValue = TestImplements::implementsEventHandlerAttribute(imp, isolatedWorldForIsolate(info.GetIsolate())); v8SetReturnValue(info, jsValue ? v8::Handle<v8::Value>(V8AbstractEventListener::cast(jsValue)->getListenerObject(imp->executionContext())) : v8::Handle<v8::Value>(v8::Null(info.GetIsolate()))); }