diff options
author | Ben Murdoch <benm@google.com> | 2011-03-04 10:24:10 +0000 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2011-03-09 20:36:47 +0000 |
commit | 1d7cc17ccbeabb654e416c598e2631ff691166ca (patch) | |
tree | c6e3636a1799ccede01c9aebb0ca777e0fba09ab /WebCore/storage | |
parent | 12db9a6492824cedb54ec0cd640e686a7af09e91 (diff) | |
download | external_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')
-rw-r--r-- | WebCore/storage/StorageAreaImpl.cpp | 4 | ||||
-rw-r--r-- | WebCore/storage/StorageEventDispatcher.cpp | 4 | ||||
-rw-r--r-- | WebCore/storage/StorageNamespace.h | 4 | ||||
-rw-r--r-- | WebCore/storage/StorageNamespaceImpl.cpp | 23 | ||||
-rw-r--r-- | WebCore/storage/StorageNamespaceImpl.h | 8 |
5 files changed, 42 insertions, 1 deletions
diff --git a/WebCore/storage/StorageAreaImpl.cpp b/WebCore/storage/StorageAreaImpl.cpp index dc25e54..54df135 100644 --- a/WebCore/storage/StorageAreaImpl.cpp +++ b/WebCore/storage/StorageAreaImpl.cpp @@ -95,6 +95,10 @@ StorageAreaImpl::StorageAreaImpl(StorageAreaImpl* area) static bool privateBrowsingEnabled(Frame* frame) { +#if PLATFORM(ANDROID) + if (!frame) + return false; +#endif #if PLATFORM(CHROMIUM) // The frame pointer can be NULL in Chromium since this call is made in a different // process from where the Frame object exists. Luckily, private browseing is diff --git a/WebCore/storage/StorageEventDispatcher.cpp b/WebCore/storage/StorageEventDispatcher.cpp index 5833c59..027e090 100644 --- a/WebCore/storage/StorageEventDispatcher.cpp +++ b/WebCore/storage/StorageEventDispatcher.cpp @@ -40,6 +40,10 @@ namespace WebCore { void StorageEventDispatcher::dispatch(const String& key, const String& oldValue, const String& newValue, StorageType storageType, SecurityOrigin* securityOrigin, Frame* sourceFrame) { +#ifdef ANDROID + if (!sourceFrame) + return; +#endif Page* page = sourceFrame->page(); if (!page) return; diff --git a/WebCore/storage/StorageNamespace.h b/WebCore/storage/StorageNamespace.h index 8f09b1a..f7dad1e 100644 --- a/WebCore/storage/StorageNamespace.h +++ b/WebCore/storage/StorageNamespace.h @@ -50,6 +50,10 @@ public: virtual PassRefPtr<StorageNamespace> copy() = 0; virtual void close() = 0; virtual void unlock() = 0; + +#ifdef ANDROID + virtual void clear(Page*) = 0; +#endif }; } // namespace WebCore 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. diff --git a/WebCore/storage/StorageNamespaceImpl.h b/WebCore/storage/StorageNamespaceImpl.h index 5221add..c2361fa 100644 --- a/WebCore/storage/StorageNamespaceImpl.h +++ b/WebCore/storage/StorageNamespaceImpl.h @@ -37,7 +37,9 @@ #include <wtf/RefPtr.h> namespace WebCore { - +#ifdef ANDROID + class Page; +#endif class StorageAreaImpl; class StorageNamespaceImpl : public StorageNamespace { @@ -51,6 +53,10 @@ namespace WebCore { virtual void close(); virtual void unlock(); +#ifdef ANDROID + virtual void clear(Page*); +#endif + private: StorageNamespaceImpl(StorageType, const String& path, unsigned quota); |