bool JSDOMPlugin::getOwnPropertySlotByIndex(JSObject* object, ExecState* exec, unsigned index, PropertySlot& slot) { JSDOMPlugin* thisObject = jsCast<JSDOMPlugin*>(object); ASSERT_GC_OBJECT_INHERITS(thisObject, info()); if (index < thisObject->impl().length()) { unsigned attributes = DontDelete | ReadOnly; slot.setCustomIndex(thisObject, attributes, index, thisObject->indexGetter); return true; } PropertyName propertyName = Identifier::from(exec, index); if (canGetItemsForName(exec, &thisObject->impl(), propertyName)) { slot.setCustom(thisObject, ReadOnly | DontDelete | DontEnum, thisObject->nameGetter); return true; } return Base::getOwnPropertySlotByIndex(thisObject, exec, index, slot); }
void JSDOMPluginOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) { JSDOMPlugin* jsDOMPlugin = jsCast<JSDOMPlugin*>(handle.get().asCell()); DOMWrapperWorld& world = *static_cast<DOMWrapperWorld*>(context); uncacheWrapper(world, &jsDOMPlugin->impl(), jsDOMPlugin); jsDOMPlugin->releaseImpl(); }
void JSDOMPlugin::getOwnPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode) { JSDOMPlugin* thisObject = jsCast<JSDOMPlugin*>(object); ASSERT_GC_OBJECT_INHERITS(thisObject, info()); for (unsigned i = 0, count = thisObject->impl().length(); i < count; ++i) propertyNames.add(Identifier::from(exec, i)); Base::getOwnPropertyNames(thisObject, exec, propertyNames, mode); }
EncodedJSValue jsDOMPluginLength(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue thisValue, PropertyName) { JSDOMPlugin* castedThis = jsDynamicCast<JSDOMPlugin*>(JSValue::decode(thisValue)); UNUSED_PARAM(slotBase); if (!castedThis) return throwVMTypeError(exec); UNUSED_PARAM(exec); DOMPlugin& impl = castedThis->impl(); JSValue result = jsNumber(impl.length()); return JSValue::encode(result); }
EncodedJSValue jsDOMPluginDescription(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue thisValue, PropertyName) { JSDOMPlugin* castedThis = jsDynamicCast<JSDOMPlugin*>(JSValue::decode(thisValue)); UNUSED_PARAM(slotBase); if (!castedThis) return throwVMTypeError(exec); UNUSED_PARAM(exec); DOMPlugin& impl = castedThis->impl(); JSValue result = jsStringWithCache(exec, impl.description()); return JSValue::encode(result); }
bool JSDOMPlugin::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot) { JSDOMPlugin* thisObject = jsCast<JSDOMPlugin*>(object); ASSERT_GC_OBJECT_INHERITS(thisObject, info()); const HashEntry* entry = getStaticValueSlotEntryWithoutCaching<JSDOMPlugin>(exec, propertyName); if (entry) { slot.setCustom(thisObject, entry->attributes(), entry->propertyGetter()); return true; } unsigned index = propertyName.asIndex(); if (index != PropertyName::NotAnIndex && index < thisObject->impl().length()) { unsigned attributes = DontDelete | ReadOnly; slot.setCustomIndex(thisObject, attributes, index, indexGetter); return true; } if (canGetItemsForName(exec, &thisObject->impl(), propertyName)) { slot.setCustom(thisObject, ReadOnly | DontDelete | DontEnum, thisObject->nameGetter); return true; } return getStaticValueSlot<JSDOMPlugin, Base>(exec, JSDOMPluginTable, thisObject, propertyName, slot); }
EncodedJSValue JSC_HOST_CALL jsDOMPluginPrototypeFunctionNamedItem(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); JSDOMPlugin* castedThis = jsDynamicCast<JSDOMPlugin*>(thisValue); if (!castedThis) return throwVMTypeError(exec); ASSERT_GC_OBJECT_INHERITS(castedThis, JSDOMPlugin::info()); DOMPlugin& impl = castedThis->impl(); const String& name(exec->argument(0).isEmpty() ? String() : exec->argument(0).toString(exec)->value(exec)); if (exec->hadException()) return JSValue::encode(jsUndefined()); JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl.namedItem(name))); return JSValue::encode(result); }
EncodedJSValue JSC_HOST_CALL jsDOMPluginPrototypeFunctionItem(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); JSDOMPlugin* castedThis = jsDynamicCast<JSDOMPlugin*>(thisValue); if (!castedThis) return throwVMTypeError(exec); ASSERT_GC_OBJECT_INHERITS(castedThis, JSDOMPlugin::info()); DOMPlugin& impl = castedThis->impl(); unsigned index(toUInt32(exec, exec->argument(0), NormalConversion)); if (exec->hadException()) return JSValue::encode(jsUndefined()); JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl.item(index))); return JSValue::encode(result); }
JSValue JSDOMPlugin::nameGetter(ExecState* exec, JSValue slotBase, const Identifier& propertyName) { JSDOMPlugin* thisObj = static_cast<JSDOMPlugin*>(asObject(slotBase)); return toJS(exec, thisObj->impl()->namedItem(identifierToAtomicString(propertyName))); }
EncodedJSValue JSDOMPlugin::nameGetter(ExecState* exec, JSObject* slotBase, EncodedJSValue, PropertyName propertyName) { JSDOMPlugin* thisObj = jsCast<JSDOMPlugin*>(slotBase); return JSValue::encode(toJS(exec, thisObj->globalObject(), thisObj->impl().namedItem(propertyNameToAtomicString(propertyName)))); }
EncodedJSValue JSDOMPlugin::indexGetter(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, unsigned index) { JSDOMPlugin* thisObj = jsCast<JSDOMPlugin*>(JSValue::decode(slotBase)); ASSERT_GC_OBJECT_INHERITS(thisObj, info()); return JSValue::encode(toJS(exec, thisObj->globalObject(), thisObj->impl().item(index))); }