本文整理汇总了C++中JSStorage类的典型用法代码示例。如果您正苦于以下问题:C++ JSStorage类的具体用法?C++ JSStorage怎么用?C++ JSStorage使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JSStorage类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: nameGetter
JSValue JSStorage::nameGetter(ExecState* exec, JSValue slotBase, const Identifier& propertyName)
{
JSStorage* thisObj = jsCast<JSStorage*>(asObject(slotBase));
JSValue prototype = asObject(slotBase)->prototype();
if (prototype.isObject() && asObject(prototype)->hasProperty(exec, propertyName))
return asObject(prototype)->get(exec, propertyName);
return jsStringOrNull(exec, thisObj->impl()->getItem(identifierToString(propertyName)));
}
示例2: jsStoragePrototypeFunctionClear
JSValue JSC_HOST_CALL jsStoragePrototypeFunctionClear(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
UNUSED_PARAM(args);
if (!thisValue.inherits(&JSStorage::s_info))
return throwError(exec, TypeError);
JSStorage* castedThisObj = static_cast<JSStorage*>(asObject(thisValue));
Storage* imp = static_cast<Storage*>(castedThisObj->impl());
imp->clear();
return jsUndefined();
}
示例3: jsStoragePrototypeFunctionRemoveItem
JSValue JSC_HOST_CALL jsStoragePrototypeFunctionRemoveItem(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
UNUSED_PARAM(args);
if (!thisValue.inherits(&JSStorage::s_info))
return throwError(exec, TypeError);
JSStorage* castedThisObj = static_cast<JSStorage*>(asObject(thisValue));
Storage* imp = static_cast<Storage*>(castedThisObj->impl());
const UString& key = args.at(0).toString(exec);
imp->removeItem(key);
return jsUndefined();
}
示例4: nameGetter
JSValue JSStorage::nameGetter(ExecState* exec, JSValue slotBase, PropertyName propertyName)
{
JSStorage* thisObj = jsCast<JSStorage*>(asObject(slotBase));
JSValue prototype = asObject(slotBase)->prototype();
if (prototype.isObject() && asObject(prototype)->hasProperty(exec, propertyName))
return asObject(prototype)->get(exec, propertyName);
ExceptionCode ec = 0;
JSValue result = jsStringOrNull(exec, thisObj->impl()->getItem(propertyNameToString(propertyName), ec));
setDOMException(exec, ec);
return result;
}
示例5: nameGetter
EncodedJSValue JSStorage::nameGetter(ExecState* exec, JSObject* slotBase, EncodedJSValue, PropertyName propertyName)
{
JSStorage* thisObject = jsCast<JSStorage*>(slotBase);
JSValue prototype = thisObject->prototype();
PropertySlot slot(thisObject);
if (prototype.isObject() && asObject(prototype)->getPropertySlot(exec, propertyName, slot))
return JSValue::encode(slot.getValue(exec, propertyName));
ExceptionCode ec = 0;
JSValue result = jsStringOrNull(exec, thisObject->impl().getItem(propertyNameToString(propertyName), ec));
setDOMException(exec, ec);
return JSValue::encode(result);
}
示例6: getOwnPropertyNames
void JSStorage::getOwnPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
{
JSStorage* thisObject = jsCast<JSStorage*>(object);
ExceptionCode ec = 0;
unsigned length = thisObject->wrapped().length(ec);
setDOMException(exec, ec);
if (exec->hadException())
return;
for (unsigned i = 0; i < length; ++i) {
propertyNames.add(Identifier::fromString(exec, thisObject->wrapped().key(i, ec)));
setDOMException(exec, ec);
if (exec->hadException())
return;
}
Base::getOwnPropertyNames(thisObject, exec, propertyNames, mode);
}
示例7: deleteProperty
bool JSStorage::deleteProperty(JSCell* cell, ExecState* exec, const Identifier& propertyName)
{
JSStorage* thisObject = jsCast<JSStorage*>(cell);
// Only perform the custom delete if the object doesn't have a native property by this name.
// Since hasProperty() would end up calling canGetItemsForName() and be fooled, we need to check
// the native property slots manually.
PropertySlot slot;
if (getStaticValueSlot<JSStorage, Base>(exec, s_info.propHashTable(exec), thisObject, propertyName, slot))
return false;
JSValue prototype = thisObject->prototype();
if (prototype.isObject() && asObject(prototype)->hasProperty(exec, propertyName))
return false;
thisObject->m_impl->removeItem(identifierToString(propertyName));
return true;
}
示例8: slot
bool JSStorage::deleteProperty(JSCell* cell, ExecState* exec, PropertyName propertyName)
{
JSStorage* thisObject = jsCast<JSStorage*>(cell);
// Only perform the custom delete if the object doesn't have a native property by this name.
// Since hasProperty() would end up calling canGetItemsForName() and be fooled, we need to check
// the native property slots manually.
PropertySlot slot(thisObject);
if (getStaticValueSlot<JSStorage, Base>(exec, *s_info.staticPropHashTable, thisObject, propertyName, slot))
return false;
JSValue prototype = thisObject->prototype();
if (prototype.isObject() && asObject(prototype)->getPropertySlot(exec, propertyName, slot))
return false;
ExceptionCode ec = 0;
thisObject->m_impl->removeItem(propertyNameToString(propertyName), ec);
setDOMException(exec, ec);
return true;
}
示例9: deleteProperty
bool JSStorage::deleteProperty(JSCell* cell, ExecState* exec, PropertyName propertyName)
{
JSStorage* thisObject = jsCast<JSStorage*>(cell);
// Only perform the custom delete if the object doesn't have a native property by this name.
// Since hasProperty() would end up calling canGetItemsForName() and be fooled, we need to check
// the native property slots manually.
PropertySlot slot(thisObject, PropertySlot::InternalMethodType::GetOwnProperty);
static_assert(!hasStaticPropertyTable, "This function does not handle static instance properties");
JSValue prototype = thisObject->getPrototypeDirect();
if (prototype.isObject() && asObject(prototype)->getPropertySlot(exec, propertyName, slot))
return Base::deleteProperty(thisObject, exec, propertyName);
if (propertyName.isSymbol())
return Base::deleteProperty(thisObject, exec, propertyName);
ExceptionCode ec = 0;
thisObject->wrapped().removeItem(propertyNameToString(propertyName), ec);
setDOMException(exec, ec);
return true;
}
示例10: nameGetter
JSValue JSStorage::nameGetter(ExecState* exec, JSValue slotBase, const Identifier& propertyName)
{
JSStorage* thisObj = static_cast<JSStorage*>(asObject(slotBase));
return jsStringOrNull(exec, thisObj->impl()->getItem(identifierToString(propertyName)));
}
示例11: nameGetter
JSValue* JSStorage::nameGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot)
{
JSStorage* thisObj = static_cast<JSStorage*>(slot.slotBase());
return jsStringOrNull(exec, thisObj->impl()->getItem(propertyName));
}