summaryrefslogtreecommitdiffstats
path: root/WebCore/storage/StorageNamespaceImpl.cpp
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2011-03-04 10:24:10 +0000
committerBen Murdoch <benm@google.com>2011-03-09 20:36:47 +0000
commit1d7cc17ccbeabb654e416c598e2631ff691166ca (patch)
treec6e3636a1799ccede01c9aebb0ca777e0fba09ab /WebCore/storage/StorageNamespaceImpl.cpp
parent12db9a6492824cedb54ec0cd640e686a7af09e91 (diff)
downloadexternal_webkit-1d7cc17ccbeabb654e416c598e2631ff691166ca.zip
external_webkit-1d7cc17ccbeabb654e416c598e2631ff691166ca.tar.gz
external_webkit-1d7cc17ccbeabb654e416c598e2631ff691166ca.tar.bz2
Clear DOM storage when clearing other cached data.
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. Bug: 2117649 Change-Id: I5b6ee075d2a8fb44ee373ad4462a33623c9c2460
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 3a21489..68508a7 100644
--- a/WebCore/storage/StorageNamespaceImpl.cpp
+++ b/WebCore/storage/StorageNamespaceImpl.cpp
@@ -35,6 +35,10 @@
#include <wtf/StdLibExtras.h>
#include <wtf/text/StringHash.h>
+#ifdef ANDROID
+#include "Page.h"
+#endif
+
namespace WebCore {
typedef HashMap<String, StorageNamespace*> LocalStorageNamespaceMap;
@@ -139,6 +143,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.