JSValue JSStyleSheetList::nameGetter(ExecState* exec, JSValue slotBase, const Identifier& propertyName)
{
    JSStyleSheetList* thisObj = static_cast<JSStyleSheetList*>(asObject(slotBase));
    HTMLStyleElement* element = thisObj->impl()->getNamedItem(identifierToString(propertyName));
    ASSERT(element);
    return toJS(exec, thisObj->globalObject(), element->sheet());
}
Example #2
0
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)));
}
bool JSDOMStringMap::putDelegate(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot&)
{
    String stringValue = ustringToString(value.toString(exec)->value(exec));
    if (exec->hadException())
        return false;
    ExceptionCode ec = 0;
    impl()->setItem(identifierToString(propertyName), stringValue, ec);
    setDOMException(exec, ec);
    return !ec;
}
static JSValue namedItemGetter(ExecState* exec, JSValue slotBase, const Identifier& propertyName)
{
    JSDOMWindowBase* thisObj = static_cast<JSDOMWindow*>(asObject(slotBase));
    Document* document = thisObj->impl()->frame()->document();

    ASSERT(thisObj->allowsAccessFrom(exec));
    ASSERT(document);
    ASSERT(document->isHTMLDocument());

    RefPtr<HTMLCollection> collection = document->windowNamedItems(identifierToString(propertyName));
    if (collection->length() == 1)
        return toJS(exec, collection->firstItem());
    return toJS(exec, collection.get());
}
bool JSStorage::deleteProperty(ExecState* exec, const Identifier& propertyName)
{
    // 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), this, propertyName, slot))
        return false;
        
    JSValue prototype = this->prototype();
    if (prototype.isObject() && asObject(prototype)->hasProperty(exec, propertyName))
        return false;

    m_impl->removeItem(identifierToString(propertyName));
    return true;
}
int
main(int argc, const char * argv[])
{
    char * str;
    void * decoded;
    int    decoded_len;
    uint8_t type;

    if (argc != 2) {
	fprintf(stderr, "useage: %s identifier\n", *argv);
	exit(1);
    }
    decoded = identifierFromString(argv[1], &type, &decoded_len);
    if (decoded == NULL) {
	printf("decode failed\n");
	exit(2);
    }
    printf("%s is decoded into type %x and a buf with length %d\n",
	   argv[1], type, decoded_len);
    printData(decoded, decoded_len);

    str = identifierToString(type, decoded, decoded_len);
    if (str == 0) {
	printf("encode failed\n");
	exit(1);
    }
    printf("%s is encoded as %s, len %d\n", argv[1], str, (int)strlen(str));
    if (strcmp(argv[1], str) == 0) {
	printf("test passed\n");
    }
    else {
	printf("they are not equal - test failed\n");
    }

    free(decoded);
    free(str);

    exit(0);
}
bool JSStorage::putDelegate(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot&)
{
    // Only perform the custom put 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), this, propertyName, slot))
        return false;
        
    JSValue prototype = this->prototype();
    if (prototype.isObject() && asObject(prototype)->hasProperty(exec, propertyName))
        return false;
    
    String stringValue = ustringToString(value.toString(exec)->value(exec));
    if (exec->hadException())
        return true;
    
    ExceptionCode ec = 0;
    impl()->setItem(identifierToString(propertyName), stringValue, ec);
    setDOMException(exec, ec);

    return true;
}
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)));
}
bool JSStorage::canGetItemsForName(ExecState*, Storage* impl, const Identifier& propertyName)
{
    return impl->contains(identifierToString(propertyName));
}
Example #10
0
JSValue JSNamedNodeMap::nameGetter(ExecState* exec, JSValue slotBase, const Identifier& propertyName)
{
    JSNamedNodeMap* thisObj = static_cast<JSNamedNodeMap*>(asObject(slotBase));
    return toJS(exec, thisObj->globalObject(), thisObj->impl()->getNamedItem(identifierToString(propertyName)));
}
Example #11
0
bool JSNamedNodeMap::canGetItemsForName(ExecState*, NamedNodeMap* impl, const Identifier& propertyName)
{
    return impl->getNamedItem(identifierToString(propertyName));
}
QString ComicProviderKross::firstStripIdentifier() const
{
    return identifierToString(m_wrapper.firstIdentifierVariant());
}
QString ComicProviderKross::previousIdentifier() const
{
    return  identifierToString(m_wrapper.previousIdentifierVariant());
}
QString ComicProviderKross::nextIdentifier() const
{
    return identifierToString(m_wrapper.nextIdentifierVariant());
}
QString ComicProviderKross::identifier() const
{
    return pluginName() + QLatin1Char(':') + identifierToString(m_wrapper.identifierVariant());
}
bool JSStyleSheetList::canGetItemsForName(ExecState*, StyleSheetList* styleSheetList, const Identifier& propertyName)
{
    return styleSheetList->getNamedItem(identifierToString(propertyName));
}