Title: [149781] trunk/Source/WebKit2
Revision
149781
Author
[email protected]
Date
2013-05-08 17:20:46 -0700 (Wed, 08 May 2013)

Log Message

Handle incoming clear operations
https://bugs.webkit.org/show_bug.cgi?id=115829

Reviewed by Sam Weinig.

Handle clear by building up a new storage map with our pending changes.

* WebProcess/Storage/StorageAreaMap.cpp:
(WebKit::StorageAreaMap::applyChange):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (149780 => 149781)


--- trunk/Source/WebKit2/ChangeLog	2013-05-08 23:51:19 UTC (rev 149780)
+++ trunk/Source/WebKit2/ChangeLog	2013-05-09 00:20:46 UTC (rev 149781)
@@ -1,5 +1,17 @@
 2013-05-08  Anders Carlsson  <[email protected]>
 
+        Handle incoming clear operations
+        https://bugs.webkit.org/show_bug.cgi?id=115829
+
+        Reviewed by Sam Weinig.
+
+        Handle clear by building up a new storage map with our pending changes.
+
+        * WebProcess/Storage/StorageAreaMap.cpp:
+        (WebKit::StorageAreaMap::applyChange):
+
+2013-05-08  Anders Carlsson  <[email protected]>
+
         Don't apply changes while we're clearing the database
         https://bugs.webkit.org/show_bug.cgi?id=115826
 

Modified: trunk/Source/WebKit2/WebProcess/Storage/StorageAreaMap.cpp (149780 => 149781)


--- trunk/Source/WebKit2/WebProcess/Storage/StorageAreaMap.cpp	2013-05-08 23:51:19 UTC (rev 149780)
+++ trunk/Source/WebKit2/WebProcess/Storage/StorageAreaMap.cpp	2013-05-09 00:20:46 UTC (rev 149781)
@@ -230,9 +230,27 @@
     if (m_hasPendingClear)
         return;
 
-    // FIXME: Handle clear.
-    ASSERT(!key.isNull());
+    if (!key) {
+        // A null key means clear.
+        RefPtr<StorageMap> newStorageMap = StorageMap::create(m_quotaInBytes);
 
+        // Any changes that were made locally after the clear must still be kept around in the new map.
+        for (auto it = m_pendingValueChanges.begin().keys(), end = m_pendingValueChanges.end().keys(); it != end; ++it) {
+            const String& key = *it;
+
+            String value = m_storageMap->getItem(key);
+            if (!value) {
+                // This change must have been a pending remove, ignore it.
+                continue;
+            }
+
+            String oldValue;
+            newStorageMap->setItemIgnoringQuota(key, oldValue);
+        }
+
+        m_storageMap = newStorageMap.release();
+    }
+
     if (!shouldApplyChangeForKey(key))
         return;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to