void InspectorDOMStorageAgent::getDOMStorageEntries(ErrorString*, const String& storageId, RefPtr<TypeBuilder::Array<TypeBuilder::Array<String> > >& entries)
{
    // FIXME: consider initializing this array after 2 checks below. The checks should return error messages in this case.
    entries = TypeBuilder::Array<TypeBuilder::Array<String> >::create();

    InspectorDOMStorageResource* storageResource = getDOMStorageResourceForId(storageId);
    if (!storageResource)
        return;
    Frame* frame = storageResource->frame();
    if (!frame)
        return;

    // FIXME: Exceptions are not reported here.
    ExceptionCode ec = 0;
    StorageArea* storageArea = storageResource->storageArea();
    for (unsigned i = 0; i < storageArea->length(ec, frame); ++i) {
        String name(storageArea->key(i, ec, frame));
        if (ec)
            return;
        String value(storageArea->getItem(name, ec, frame));
        if (ec)
            return;
        RefPtr<TypeBuilder::Array<String> > entry = TypeBuilder::Array<String>::create();
        entry->addItem(name);
        entry->addItem(value);
        entries->addItem(entry);
    }
}
Example #2
0
void InspectorDOMStorageAgent::removeDOMStorageItem(ErrorString*, int storageId, const String& key, bool* success)
{
    InspectorDOMStorageResource* storageResource = getDOMStorageResourceForId(storageId);
    if (storageResource) {
        storageResource->storageArea()->removeItem(key, storageResource->frame());
        *success = true;
    }
}
Example #3
0
void InspectorDOMStorageAgent::setDOMStorageItem(ErrorString*, int storageId, const String& key, const String& value, bool* success)
{
    InspectorDOMStorageResource* storageResource = getDOMStorageResourceForId(storageId);
    if (storageResource) {
        ExceptionCode exception = 0;
        storageResource->storageArea()->setItem(key, value, exception, storageResource->frame());
        *success = !exception;
    }
}
void InspectorDOMStorageAgent::removeDOMStorageItem(ErrorString*, const String& storageId, const String& key, bool* success)
{
    InspectorDOMStorageResource* storageResource = getDOMStorageResourceForId(storageId);
    if (storageResource) {
        ExceptionCode exception = 0;
        storageResource->storageArea()->removeItem(key, exception, storageResource->frame());
        *success = !exception;
    } else
        *success = false;
}
void InspectorDOMStorageAgent::getDOMStorageEntries(ErrorString*, int storageId, RefPtr<InspectorArray>* entries)
{
    InspectorDOMStorageResource* storageResource = getDOMStorageResourceForId(storageId);
    if (storageResource) {
        storageResource->startReportingChangesToFrontend();
        Storage* domStorage = storageResource->domStorage();
        for (unsigned i = 0; i < domStorage->length(); ++i) {
            String name(domStorage->key(i));
            String value(domStorage->getItem(name));
            RefPtr<InspectorArray> entry = InspectorArray::create();
            entry->pushString(name);
            entry->pushString(value);
            (*entries)->pushArray(entry);
        }
    }
}
Example #6
0
void InspectorDOMStorageAgent::getDOMStorageEntries(ErrorString*, int storageId, RefPtr<InspectorArray>& entries)
{
    InspectorDOMStorageResource* storageResource = getDOMStorageResourceForId(storageId);
    if (!storageResource)
        return;
    Frame* frame = storageResource->frame();
    if (!frame)
        return;
        
    storageResource->startReportingChangesToFrontend();
    StorageArea* storageArea = storageResource->storageArea();
    for (unsigned i = 0; i < storageArea->length(frame); ++i) {
        String name(storageArea->key(i, frame));
        String value(storageArea->getItem(name, frame));
        RefPtr<InspectorArray> entry = InspectorArray::create();
        entry->pushString(name);
        entry->pushString(value);
        entries->pushArray(entry);
    }
}