void InspectorDOMStorageAgent::getValue(ErrorString* errorString, const RefPtr<JSONObject>& storageId, const String& key, TypeBuilder::OptOutput<WTF::String>* value)
{
    Frame* frame;
    OwnPtr<StorageArea> storageArea = findStorageArea(errorString, storageId, frame);
    if (!storageArea)
        return;

    TrackExceptionState es;
    bool keyPresent = storageArea->contains(key, es, frame);
    if (hadException(es, errorString) || !keyPresent)
        return;

    *value = storageArea->getItem(key, es, frame);
    hadException(es, errorString);
}
示例#2
0
void InspectorDOMStorageAgent::getDOMStorageItems(ErrorString* errorString, const RefPtr<InspectorObject>& storageId, RefPtr<TypeBuilder::Array<TypeBuilder::Array<String> > >& items)
{
    Frame* frame;
    RefPtr<StorageArea> storageArea = findStorageArea(errorString, storageId, frame);
    if (!storageArea)
        return;

    RefPtr<TypeBuilder::Array<TypeBuilder::Array<String> > > storageItems = TypeBuilder::Array<TypeBuilder::Array<String> >::create();

    ExceptionCode ec = 0;
    for (unsigned i = 0; i < storageArea->length(ec, frame); ++i) {
        String name(storageArea->key(i, ec, frame));
        if (hadException(ec, errorString))
            return;
        String value(storageArea->getItem(name, ec, frame));
        if (hadException(ec, errorString))
            return;
        RefPtr<TypeBuilder::Array<String> > entry = TypeBuilder::Array<String>::create();
        entry->addItem(name);
        entry->addItem(value);
        storageItems->addItem(entry);
    }
    items = storageItems.release();
}