Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(314)

Unified Diff: Source/WebCore/storage/StorageAreaImpl.cpp

Issue 10377148: Revert 116712 - Source/WebCore: [chromium] DomStorage events handling needs TLC (2) (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1137/
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/WebCore/storage/StorageAreaImpl.h ('k') | Source/WebKit/chromium/WebKit.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/storage/StorageAreaImpl.cpp
===================================================================
--- Source/WebCore/storage/StorageAreaImpl.cpp (revision 117067)
+++ Source/WebCore/storage/StorageAreaImpl.cpp (working copy)
@@ -102,6 +102,13 @@
bool StorageAreaImpl::disabledByPrivateBrowsingInFrame(const Frame* frame) const
{
+#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
+ // implemented differently in Chromium, so it'd never return true anyway.
+ ASSERT(!frame);
+ return false;
+#else
if (!frame->page())
return true;
if (!frame->page()->settings()->privateBrowsingEnabled())
@@ -109,6 +116,7 @@
if (m_storageType != LocalStorage)
return true;
return !SchemeRegistry::allowsLocalStorageAccessInPrivateBrowsing(frame->document()->securityOrigin()->protocol());
+#endif
}
unsigned StorageAreaImpl::length(Frame*) const
@@ -135,7 +143,7 @@
return m_storageMap->getItem(key);
}
-void StorageAreaImpl::setItem(const String& key, const String& value, ExceptionCode& ec, Frame* frame)
+String StorageAreaImpl::setItem(const String& key, const String& value, ExceptionCode& ec, Frame* frame)
{
ASSERT(!m_isShutdown);
ASSERT(!value.isNull());
@@ -143,7 +151,7 @@
if (disabledByPrivateBrowsingInFrame(frame)) {
ec = QUOTA_EXCEEDED_ERR;
- return;
+ return String();
}
String oldValue;
@@ -154,24 +162,25 @@
if (quotaException) {
ec = QUOTA_EXCEEDED_ERR;
- return;
+ return oldValue;
}
if (oldValue == value)
- return;
+ return oldValue;
if (m_storageAreaSync)
m_storageAreaSync->scheduleItemForSync(key, value);
StorageEventDispatcher::dispatch(key, oldValue, value, m_storageType, m_securityOrigin.get(), frame);
+ return oldValue;
}
-void StorageAreaImpl::removeItem(const String& key, Frame* frame)
+String StorageAreaImpl::removeItem(const String& key, Frame* frame)
{
ASSERT(!m_isShutdown);
blockUntilImportComplete();
if (disabledByPrivateBrowsingInFrame(frame))
- return;
+ return String();
String oldValue;
RefPtr<StorageMap> newMap = m_storageMap->removeItem(key, oldValue);
@@ -179,23 +188,24 @@
m_storageMap = newMap.release();
if (oldValue.isNull())
- return;
+ return oldValue;
if (m_storageAreaSync)
m_storageAreaSync->scheduleItemForSync(key, String());
StorageEventDispatcher::dispatch(key, oldValue, String(), m_storageType, m_securityOrigin.get(), frame);
+ return oldValue;
}
-void StorageAreaImpl::clear(Frame* frame)
+bool StorageAreaImpl::clear(Frame* frame)
{
ASSERT(!m_isShutdown);
blockUntilImportComplete();
if (disabledByPrivateBrowsingInFrame(frame))
- return;
+ return false;
if (!m_storageMap->length())
- return;
+ return false;
unsigned quota = m_storageMap->quota();
m_storageMap = StorageMap::create(quota);
@@ -203,6 +213,7 @@
if (m_storageAreaSync)
m_storageAreaSync->scheduleClear();
StorageEventDispatcher::dispatch(String(), String(), String(), m_storageType, m_securityOrigin.get(), frame);
+ return true;
}
bool StorageAreaImpl::contains(const String& key, Frame*) const
« no previous file with comments | « Source/WebCore/storage/StorageAreaImpl.h ('k') | Source/WebKit/chromium/WebKit.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698