Ejemplo n.º 1
0
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);
}
Ejemplo n.º 2
0
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;
}
Ejemplo n.º 3
0
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;
}