Diff
Modified: trunk/Source/WebCore/ChangeLog (148244 => 148245)
--- trunk/Source/WebCore/ChangeLog 2013-04-11 23:25:50 UTC (rev 148244)
+++ trunk/Source/WebCore/ChangeLog 2013-04-11 23:26:58 UTC (rev 148245)
@@ -1,3 +1,14 @@
+2013-04-11 Anders Carlsson <[email protected]>
+
+ Implement removing storage area items
+ https://bugs.webkit.org/show_bug.cgi?id=114472
+
+ Reviewed by Beth Dakin.
+
+ Export StorageMap::removeItem.
+
+ * WebCore.exp.in:
+
2013-04-11 Brendan Long <[email protected]>
TextTrackList's .onremovetrack is missing from IDL
Modified: trunk/Source/WebCore/WebCore.exp.in (148244 => 148245)
--- trunk/Source/WebCore/WebCore.exp.in 2013-04-11 23:25:50 UTC (rev 148244)
+++ trunk/Source/WebCore/WebCore.exp.in 2013-04-11 23:26:58 UTC (rev 148245)
@@ -84,6 +84,7 @@
__ZN7WebCore10ScrollView23setScrollbarsSuppressedEbb
__ZN7WebCore10ScrollView24windowResizerRectChangedEv
__ZN7WebCore10ScrollView8addChildEN3WTF10PassRefPtrINS_6WidgetEEE
+__ZN7WebCore10StorageMap10removeItemERKN3WTF6StringERS2_
__ZN7WebCore10StorageMap11importItemsERKN3WTF7HashMapINS1_6StringES3_NS1_10StringHashENS1_10HashTraitsIS3_EES6_EE
__ZN7WebCore10StorageMap20setItemIgnoringQuotaERKN3WTF6StringES4_
__ZN7WebCore10StorageMap3keyEj
Modified: trunk/Source/WebKit2/ChangeLog (148244 => 148245)
--- trunk/Source/WebKit2/ChangeLog 2013-04-11 23:25:50 UTC (rev 148244)
+++ trunk/Source/WebKit2/ChangeLog 2013-04-11 23:26:58 UTC (rev 148245)
@@ -1,3 +1,38 @@
+2013-04-11 Anders Carlsson <[email protected]>
+
+ Implement removing storage area items
+ https://bugs.webkit.org/show_bug.cgi?id=114472
+
+ Reviewed by Beth Dakin.
+
+ * UIProcess/Storage/StorageManager.cpp:
+ (StorageManager::StorageArea):
+ (WebKit::StorageManager::StorageArea::setItem):
+ Rename connection to sourceConnection.
+
+ (WebKit::StorageManager::StorageArea::removeItem):
+ Remove the item from the map and dispatch events if needed.
+
+ (WebKit::StorageManager::removeItem):
+ Find the right storage area, remove the item and send back a DidRemoveItem message.
+
+ * UIProcess/Storage/StorageManager.messages.in:
+ Add RemoveItem message.
+
+ * WebProcess/Storage/StorageAreaImpl.cpp:
+ (WebKit::StorageAreaImpl::removeItem):
+ Call StorageAreaMap::removeItem.
+
+ * WebProcess/Storage/StorageAreaMap.cpp:
+ (WebKit::StorageAreaMap::removeItem):
+ Send a RemoveItem message to the storage manager.
+
+ (WebKit::StorageAreaMap::didRemoveItem):
+ Add empty stub.
+
+ * WebProcess/Storage/StorageAreaMap.messages.in:
+ Add DidRemoveItem message.
+
2013-04-11 Tim Horton <[email protected]>
InjectedBundleNodeHandle::imageForRect doesn't respect device scale factor or highlighting option
Modified: trunk/Source/WebKit2/UIProcess/Storage/StorageManager.cpp (148244 => 148245)
--- trunk/Source/WebKit2/UIProcess/Storage/StorageManager.cpp 2013-04-11 23:25:50 UTC (rev 148244)
+++ trunk/Source/WebKit2/UIProcess/Storage/StorageManager.cpp 2013-04-11 23:26:58 UTC (rev 148245)
@@ -46,7 +46,9 @@
void addListener(CoreIPC::Connection*, uint64_t storageMapID);
void removeListener(CoreIPC::Connection*, uint64_t storageMapID);
- void setItem(CoreIPC::Connection*, uint64_t sourceStorageAreaID, const String& key, const String& value, const String& urlString, bool& quotaException);
+ void setItem(CoreIPC::Connection* sourceConnection, uint64_t sourceStorageAreaID, const String& key, const String& value, const String& urlString, bool& quotaException);
+ void removeItem(CoreIPC::Connection* sourceConnection, uint64_t sourceStorageAreaID, const String& key, const String& urlString);
+
const HashMap<String, String>& items() const { return m_storageMap->items(); }
private:
@@ -85,7 +87,7 @@
m_eventListeners.remove(std::make_pair(connection, storageMapID));
}
-void StorageManager::StorageArea::setItem(CoreIPC::Connection* connection, uint64_t sourceStorageAreaID, const String& key, const String& value, const String& urlString, bool& quotaException)
+void StorageManager::StorageArea::setItem(CoreIPC::Connection* sourceConnection, uint64_t sourceStorageAreaID, const String& key, const String& value, const String& urlString, bool& quotaException)
{
ASSERT(m_storageMap->hasOneRef());
@@ -93,9 +95,20 @@
m_storageMap->setItem(key, value, oldValue, quotaException);
if (!quotaException)
- dispatchEvents(connection, sourceStorageAreaID, key, oldValue, value, urlString);
+ dispatchEvents(sourceConnection, sourceStorageAreaID, key, oldValue, value, urlString);
}
+void StorageManager::StorageArea::removeItem(CoreIPC::Connection* sourceConnection, uint64_t sourceStorageAreaID, const String& key, const String& urlString)
+{
+ String oldValue;
+ m_storageMap->removeItem(key, oldValue);
+
+ if (oldValue.isNull())
+ return;
+
+ dispatchEvents(sourceConnection, sourceStorageAreaID, key, oldValue, String(), urlString);
+}
+
void StorageManager::StorageArea::dispatchEvents(CoreIPC::Connection* sourceConnection, uint64_t sourceStorageAreaID, const String& key, const String& oldValue, const String& newValue, const String& urlString) const
{
for (HashSet<std::pair<RefPtr<CoreIPC::Connection>, uint64_t> >::const_iterator it = m_eventListeners.begin(), end = m_eventListeners.end(); it != end; ++it) {
@@ -279,6 +292,17 @@
connection->send(Messages::StorageAreaMap::DidSetItem(key, quotaError), storageMapID);
}
+void StorageManager::removeItem(CoreIPC::Connection* connection, uint64_t storageMapID, uint64_t sourceStorageAreaID, const String& key, const String& urlString)
+{
+ StorageArea* storageArea = findStorageArea(connection, storageMapID);
+
+ // FIXME: This should be a message check.
+ ASSERT(storageArea);
+
+ storageArea->removeItem(connection, sourceStorageAreaID, key, urlString);
+ connection->send(Messages::StorageAreaMap::DidRemoveItem(key), storageMapID);
+}
+
void StorageManager::createSessionStorageNamespaceInternal(uint64_t storageNamespaceID, CoreIPC::Connection* allowedConnection, unsigned quotaInBytes)
{
ASSERT(!m_sessionStorageNamespaces.contains(storageNamespaceID));
Modified: trunk/Source/WebKit2/UIProcess/Storage/StorageManager.h (148244 => 148245)
--- trunk/Source/WebKit2/UIProcess/Storage/StorageManager.h 2013-04-11 23:25:50 UTC (rev 148244)
+++ trunk/Source/WebKit2/UIProcess/Storage/StorageManager.h 2013-04-11 23:26:58 UTC (rev 148245)
@@ -63,6 +63,7 @@
void destroyStorageMap(CoreIPC::Connection*, uint64_t storageMapID);
void getValues(CoreIPC::Connection*, uint64_t storageMapID, HashMap<String, String>& values);
void setItem(CoreIPC::Connection*, uint64_t storageAreaID, uint64_t sourceStorageAreaID, const String& key, const String& value, const String& urlString);
+ void removeItem(CoreIPC::Connection*, uint64_t storageMapID, uint64_t sourceStorageAreaID, const String& key, const String& urlString);
void createSessionStorageNamespaceInternal(uint64_t storageNamespaceID, CoreIPC::Connection* allowedConnection, unsigned quotaInBytes);
void destroySessionStorageNamespaceInternal(uint64_t storageNamespaceID);
Modified: trunk/Source/WebKit2/UIProcess/Storage/StorageManager.messages.in (148244 => 148245)
--- trunk/Source/WebKit2/UIProcess/Storage/StorageManager.messages.in 2013-04-11 23:25:50 UTC (rev 148244)
+++ trunk/Source/WebKit2/UIProcess/Storage/StorageManager.messages.in 2013-04-11 23:26:58 UTC (rev 148245)
@@ -27,4 +27,5 @@
GetValues(uint64_t storageMapID) -> (WTF::HashMap<WTF::String, WTF::String> values) WantsConnection
SetItem(uint64_t storageMapID, uint64_t sourceStorageAreaID, WTF::String key, WTF::String value, WTF::String urlString) WantsConnection
+ RemoveItem(uint64_t storageMapID, uint64_t sourceStorageAreaID, WTF::String key, WTF::String urlString) WantsConnection
}
Modified: trunk/Source/WebKit2/WebProcess/Storage/StorageAreaImpl.cpp (148244 => 148245)
--- trunk/Source/WebKit2/WebProcess/Storage/StorageAreaImpl.cpp 2013-04-11 23:25:50 UTC (rev 148244)
+++ trunk/Source/WebKit2/WebProcess/Storage/StorageAreaImpl.cpp 2013-04-11 23:26:58 UTC (rev 148245)
@@ -127,12 +127,18 @@
ec = QUOTA_EXCEEDED_ERR;
}
-void StorageAreaImpl::removeItem(const String& key, ExceptionCode&, Frame* sourceFrame)
+void StorageAreaImpl::removeItem(const String& key, ExceptionCode& ec, Frame* sourceFrame)
{
- // FIXME: Implement this.
- ASSERT_NOT_REACHED();
- UNUSED_PARAM(key);
- UNUSED_PARAM(sourceFrame);
+ ec = 0;
+ if (!canAccessStorage(sourceFrame)) {
+ ec = SECURITY_ERR;
+ return;
+ }
+
+ if (disabledByPrivateBrowsingInFrame(sourceFrame))
+ return;
+
+ m_storageAreaMap->removeItem(sourceFrame, this, key);
}
void StorageAreaImpl::clear(ExceptionCode&, Frame* sourceFrame)
Modified: trunk/Source/WebKit2/WebProcess/Storage/StorageAreaMap.cpp (148244 => 148245)
--- trunk/Source/WebKit2/WebProcess/Storage/StorageAreaMap.cpp 2013-04-11 23:25:50 UTC (rev 148244)
+++ trunk/Source/WebKit2/WebProcess/Storage/StorageAreaMap.cpp 2013-04-11 23:26:58 UTC (rev 148245)
@@ -120,6 +120,22 @@
WebProcess::shared().connection()->send(Messages::StorageManager::SetItem(m_storageMapID, sourceArea->storageAreaID(), key, value, sourceFrame->document()->url()), 0);
}
+void StorageAreaMap::removeItem(WebCore::Frame* sourceFrame, StorageAreaImpl* sourceArea, const String& key)
+{
+ loadValuesIfNeeded();
+ ASSERT(m_storageMap->hasOneRef());
+
+ String oldValue;
+ m_storageMap->removeItem(key, oldValue);
+
+ if (oldValue.isNull())
+ return;
+
+ m_pendingValueChanges.add(key);
+
+ WebProcess::shared().connection()->send(Messages::StorageManager::RemoveItem(m_storageMapID, sourceArea->storageAreaID(), key, sourceFrame->document()->url()), 0);
+}
+
bool StorageAreaMap::contains(const String& key)
{
loadValuesIfNeeded();
@@ -147,6 +163,11 @@
// FIXME: Implement.
}
+void StorageAreaMap::didRemoveItem(const String& key)
+{
+ // FIXME: Implement.
+}
+
void StorageAreaMap::dispatchStorageEvent(uint64_t sourceStorageAreaID, const String& key, const String& oldValue, const String& newValue, const String& urlString)
{
if (storageType() == SessionStorage)
Modified: trunk/Source/WebKit2/WebProcess/Storage/StorageAreaMap.h (148244 => 148245)
--- trunk/Source/WebKit2/WebProcess/Storage/StorageAreaMap.h 2013-04-11 23:25:50 UTC (rev 148244)
+++ trunk/Source/WebKit2/WebProcess/Storage/StorageAreaMap.h 2013-04-11 23:26:58 UTC (rev 148245)
@@ -55,6 +55,7 @@
String key(unsigned index);
String item(const String& key);
void setItem(WebCore::Frame* sourceFrame, StorageAreaImpl* sourceArea, const String& key, const String& value, bool& quotaException);
+ void removeItem(WebCore::Frame* sourceFrame, StorageAreaImpl* sourceArea, const String& key);
bool contains(const String& key);
private:
@@ -64,6 +65,8 @@
virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageDecoder&) OVERRIDE;
void didSetItem(const String& key, bool quotaError);
+ void didRemoveItem(const String& key);
+
void dispatchStorageEvent(uint64_t sourceStorageAreaID, const String& key, const String& oldValue, const String& newValue, const String& urlString);
void loadValuesIfNeeded();
Modified: trunk/Source/WebKit2/WebProcess/Storage/StorageAreaMap.messages.in (148244 => 148245)
--- trunk/Source/WebKit2/WebProcess/Storage/StorageAreaMap.messages.in 2013-04-11 23:25:50 UTC (rev 148244)
+++ trunk/Source/WebKit2/WebProcess/Storage/StorageAreaMap.messages.in 2013-04-11 23:26:58 UTC (rev 148245)
@@ -22,6 +22,7 @@
messages -> StorageAreaMap {
DidSetItem(WTF::String key, bool quotaException)
+ DidRemoveItem(WTF::String key)
DispatchStorageEvent(uint64_t sourceStorageAreaID, WTF::String key, WTF::String oldValue, WTF::String newValue, WTF::String urlString)
}