Skip to content

Instantly share code, notes, and snippets.

@vivekgalatage
Created March 12, 2013 11:50
Show Gist options
  • Save vivekgalatage/5142312 to your computer and use it in GitHub Desktop.
Save vivekgalatage/5142312 to your computer and use it in GitHub Desktop.
InspectorHistory* InspectorDOMStorageAgent::findStorageHistory(ErrorString* errorString, const RefPtr<InspectorObject>& storageId, RefPtr<StorageArea>& storageArea, Frame*& targetFrame)
{
storageArea = findStorageArea(0, storageId, targetFrame);
if (!storageArea) {
*errorString = "Storage not found";
return 0;
}
String historyMapKey;
bool isLocalStorage = false;
bool success = storageId->getString("securityOrigin", &historyMapKey);
if (success)
success = storageId->getBoolean("isLocalStorage", &isLocalStorage);
if (!success) {
if (errorString)
*errorString = "Invalid storageId format";
return 0;
}
historyMapKey.append(isLocalStorage ? "@localStorage" : "@sessionStorage");
StorageIdToHistoryMap::iterator it = m_storageHistoryMap.find(historyMapKey);
if (it == m_storageHistoryMap.end())
it = m_storageHistoryMap.set(historyMapKey, adoptPtr(new InspectorHistory())).iterator;
ASSERT(it != m_storageHistoryMap.end());
return it->value.get();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment