summaryrefslogtreecommitdiffstats
path: root/WebCore/storage/StorageNamespaceImpl.cpp
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2011-04-11 20:08:03 +0100
committerBen Murdoch <benm@google.com>2011-04-11 20:35:41 +0100
commit622d72beb96a024bb18591feb39d4b21d0a34bd7 (patch)
tree9a8e5353390326dc19931af1079ebe466f97987f /WebCore/storage/StorageNamespaceImpl.cpp
parent68c221808cf7a4776ba8feae02611d3c78e9f857 (diff)
downloadexternal_webkit-622d72beb96a024bb18591feb39d4b21d0a34bd7.zip
external_webkit-622d72beb96a024bb18591feb39d4b21d0a34bd7.tar.gz
external_webkit-622d72beb96a024bb18591feb39d4b21d0a34bd7.tar.bz2
Clear DOM storage when clearing other cached data. Do not merge.
Empty out DOM local and session storage in addition to HTML5 database and app cache when we get a request from java to delete cached data. Cherry pick of I5b6ee075d2a8fb44ee373ad4462a33623c9c2460 Bug: 4267038 Change-Id: Id2dece1963d443c3758710e9c3e871054991ae32
Diffstat (limited to 'WebCore/storage/StorageNamespaceImpl.cpp')
-rw-r--r--WebCore/storage/StorageNamespaceImpl.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/WebCore/storage/StorageNamespaceImpl.cpp b/WebCore/storage/StorageNamespaceImpl.cpp
index 19ff6b4..47b2958 100644
--- a/WebCore/storage/StorageNamespaceImpl.cpp
+++ b/WebCore/storage/StorageNamespaceImpl.cpp
@@ -35,6 +35,10 @@
#include "StorageSyncManager.h"
#include <wtf/StdLibExtras.h>
+#ifdef ANDROID
+#include "Page.h"
+#endif
+
namespace WebCore {
typedef HashMap<String, StorageNamespace*> LocalStorageNamespaceMap;
@@ -137,6 +141,25 @@ void StorageNamespaceImpl::close()
m_isShutdown = true;
}
+#ifdef ANDROID
+void StorageNamespaceImpl::clear(Page* page)
+{
+ ASSERT(isMainThread());
+ if (m_isShutdown)
+ return;
+
+ // Clear all the keys for each of the storage areas.
+ StorageAreaMap::iterator end = m_storageAreaMap.end();
+ for (StorageAreaMap::iterator it = m_storageAreaMap.begin(); it != end; ++it) {
+ // if there is no page provided, then the user tried to clear storage
+ // with only pages in private browsing mode open. So we do not need to
+ // provide a Frame* here (as the frame is only used to dispatch storage events
+ // and private browsing pages won't be using them).
+ it->second->clear(page ? page->mainFrame() : 0);
+ }
+}
+#endif
+
void StorageNamespaceImpl::unlock()
{
// Because there's a single event loop per-process, this is a no-op.