Response InspectorDOMStorageAgent::getDOMStorageItems( std::unique_ptr<protocol::DOMStorage::StorageId> storageId, std::unique_ptr<protocol::Array<protocol::Array<String>>>* items) { LocalFrame* frame = nullptr; StorageArea* storageArea = nullptr; Response response = findStorageArea(std::move(storageId), frame, storageArea); if (!response.isSuccess()) return response; std::unique_ptr<protocol::Array<protocol::Array<String>>> storageItems = protocol::Array<protocol::Array<String>>::create(); TrackExceptionState exceptionState; for (unsigned i = 0; i < storageArea->length(exceptionState, frame); ++i) { String name(storageArea->key(i, exceptionState, frame)); response = toResponse(exceptionState); if (!response.isSuccess()) return response; String value(storageArea->getItem(name, exceptionState, frame)); response = toResponse(exceptionState); if (!response.isSuccess()) return response; std::unique_ptr<protocol::Array<String>> entry = protocol::Array<String>::create(); entry->addItem(name); entry->addItem(value); storageItems->addItem(std::move(entry)); } *items = std::move(storageItems); return Response::OK(); }
void InspectorDOMStorageAgent::removeDOMStorageItem(ErrorString* errorString, const RefPtr<InspectorObject>& storageId, const String& key) { Frame* frame; RefPtr<StorageArea> storageArea = findStorageArea(nullptr, storageId, frame); if (!storageArea) { *errorString = "Storage not found"; return; } storageArea->removeItem(frame, key); }
void InspectorDOMStorageAgent::removeDOMStorageItem(ErrorString* errorString, const RefPtr<InspectorObject>& storageId, const String& key) { Frame* frame; RefPtr<StorageArea> storageArea = findStorageArea(0, storageId, frame); if (!storageArea) { *errorString = "Storage not found"; return; } ExceptionCode exception = 0; storageArea->removeItem(key, exception, frame); *errorString = toErrorString(exception); }
void InspectorDOMStorageAgent::removeDOMStorageItem(ErrorString* errorString, const RefPtr<JSONObject>& storageId, const String& key) { LocalFrame* frame; OwnPtrWillBeRawPtr<StorageArea> storageArea = findStorageArea(0, storageId, frame); if (!storageArea) { *errorString = "Storage not found"; return; } TrackExceptionState exceptionState; storageArea->removeItem(key, exceptionState, frame); *errorString = toErrorString(exceptionState); }
void InspectorDOMStorageAgent::setDOMStorageItem(ErrorString* errorString, const RefPtr<JSONObject>& storageId, const String& key, const String& value) { Frame* frame; OwnPtr<StorageArea> storageArea = findStorageArea(0, storageId, frame); if (!storageArea) { *errorString = "Storage not found"; return; } TrackExceptionState es; storageArea->setItem(key, value, es, frame); *errorString = toErrorString(es); }
Response InspectorDOMStorageAgent::removeDOMStorageItem( std::unique_ptr<protocol::DOMStorage::StorageId> storageId, const String& key) { LocalFrame* frame = nullptr; StorageArea* storageArea = nullptr; Response response = findStorageArea(std::move(storageId), frame, storageArea); if (!response.isSuccess()) return response; TrackExceptionState exceptionState; storageArea->removeItem(key, exceptionState, frame); return toResponse(exceptionState); }
void InspectorDOMStorageAgent::setDOMStorageItem(ErrorString* errorString, const RefPtr<InspectorObject>& storageId, const String& key, const String& value) { Frame* frame; RefPtr<StorageArea> storageArea = findStorageArea(nullptr, storageId, frame); if (!storageArea) { *errorString = "Storage not found"; return; } bool quotaException = false; storageArea->setItem(frame, key, value, quotaException); if (quotaException) *errorString = ExceptionCodeDescription(QUOTA_EXCEEDED_ERR).name; }
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); }
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(); }
void InspectorDOMStorageAgent::getDOMStorageItems(ErrorString* errorString, const RefPtr<InspectorObject>& storageId, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Array<String>>>& items) { Frame* frame; RefPtr<StorageArea> storageArea = findStorageArea(errorString, storageId, frame); if (!storageArea) { if (errorString) *errorString = "No StorageArea for given storageId"; return; } RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Array<String>>> storageItems = Inspector::Protocol::Array<Inspector::Protocol::Array<String>>::create(); for (unsigned i = 0; i < storageArea->length(); ++i) { String key = storageArea->key(i); String value = storageArea->item(key); RefPtr<Inspector::Protocol::Array<String>> entry = Inspector::Protocol::Array<String>::create(); entry->addItem(key); entry->addItem(value); storageItems->addItem(entry.release()); } items = storageItems.release(); }