Modern IDB: storage/indexeddb/index-multientry.html fails under GuardMalloc/ASAN.
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 11 Jan 2016 23:44:03 +0000 (23:44 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 11 Jan 2016 23:44:03 +0000 (23:44 +0000)
https://bugs.webkit.org/show_bug.cgi?id=152990

Reviewed by Alex Christensen.

Source/WebCore:

No new tests (Covered by re-enabling existing test).

* Modules/indexeddb/client/IDBRequestImpl.cpp:
(WebCore::IDBClient::IDBRequest::dispatchEvent): Use String::utf8() instead of AtomicString::characters8() for
  the format string, as the latter fails under ASAN.

* Modules/indexeddb/server/IndexValueStore.cpp:
(WebCore::IDBServer::IndexValueStore::removeEntriesWithValueKey): We can't save off pointers to IDBKeyDatas
  used as keys in the map, because the moment we start mutating the map the keys can be rehashed, invalidating
  our pointers. Save off the IDBKeyDatas by value instead.

LayoutTests:

* platform/mac-wk1/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@194872 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/platform/mac-wk1/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/Modules/indexeddb/client/IDBRequestImpl.cpp
Source/WebCore/Modules/indexeddb/server/IndexValueStore.cpp

index ce4afba..5b15aaf 100644 (file)
@@ -1,3 +1,12 @@
+2016-01-11  Brady Eidson  <beidson@apple.com>
+
+        Modern IDB: storage/indexeddb/index-multientry.html fails under GuardMalloc/ASAN.
+        https://bugs.webkit.org/show_bug.cgi?id=152990
+
+        Reviewed by Alex Christensen.
+
+        * platform/mac-wk1/TestExpectations:
+
 2016-01-11  Joseph Pecoraro  <pecoraro@apple.com>
 
         Web Inspector: Migrate Page Timeline recording to ScriptProfiler
index 270c1c6..8666d68 100644 (file)
@@ -76,9 +76,6 @@ imported/w3c/indexeddb/idbindex_getKey7.htm [ Failure ]
 imported/w3c/indexeddb/idbindex_openCursor2.htm [ Failure ]
 imported/w3c/indexeddb/idbindex_openKeyCursor3.htm [ Failure ]
 
-# Crashes with GuardMalloc or ASan
-storage/indexeddb/index-multientry.html [ Skip ]
-
 # Times out for unexplored reasons                                                             
 storage/indexeddb/database-quota.html [ Skip ]
 
index 54c7a2c..e061518 100644 (file)
@@ -1,3 +1,21 @@
+2016-01-11  Brady Eidson  <beidson@apple.com>
+
+        Modern IDB: storage/indexeddb/index-multientry.html fails under GuardMalloc/ASAN.
+        https://bugs.webkit.org/show_bug.cgi?id=152990
+
+        Reviewed by Alex Christensen.
+
+        No new tests (Covered by re-enabling existing test).
+
+        * Modules/indexeddb/client/IDBRequestImpl.cpp:
+        (WebCore::IDBClient::IDBRequest::dispatchEvent): Use String::utf8() instead of AtomicString::characters8() for
+          the format string, as the latter fails under ASAN.
+          
+        * Modules/indexeddb/server/IndexValueStore.cpp:
+        (WebCore::IDBServer::IndexValueStore::removeEntriesWithValueKey): We can't save off pointers to IDBKeyDatas
+          used as keys in the map, because the moment we start mutating the map the keys can be rehashed, invalidating
+          our pointers. Save off the IDBKeyDatas by value instead.
+
 2016-01-11  Joseph Pecoraro  <pecoraro@apple.com>
 
         Web Inspector: Migrate Page Timeline recording to ScriptProfiler
index c9060a1..b9d1fb2 100644 (file)
@@ -263,7 +263,7 @@ void IDBRequest::enqueueEvent(Ref<Event>&& event)
 
 bool IDBRequest::dispatchEvent(Event& event)
 {
-    LOG(IndexedDB, "IDBRequest::dispatchEvent - %s (%p)", event.type().characters8(), this);
+    LOG(IndexedDB, "IDBRequest::dispatchEvent - %s (%p)", event.type().string().utf8().data(), this);
 
     ASSERT(m_hasPendingActivity);
     ASSERT(!m_contextStopped);
index 16dee89..981d699 100644 (file)
@@ -98,18 +98,19 @@ void IndexValueStore::removeRecord(const IDBKeyData& indexKey, const IDBKeyData&
 
 void IndexValueStore::removeEntriesWithValueKey(MemoryIndex& index, const IDBKeyData& valueKey)
 {
-    HashSet<IDBKeyData*> entryKeysToRemove;
+    Vector<IDBKeyData> entryKeysToRemove;
+    entryKeysToRemove.reserveInitialCapacity(m_records.size());
 
     for (auto& entry : m_records) {
         if (entry.value->removeKey(valueKey))
             index.notifyCursorsOfValueChange(entry.key, valueKey);
         if (!entry.value->getCount())
-            entryKeysToRemove.add(&entry.key);
+            entryKeysToRemove.uncheckedAppend(entry.key);
     }
 
-    for (auto* entry : entryKeysToRemove) {
-        m_orderedKeys.erase(*entry);
-        m_records.remove(*entry);
+    for (auto& entry : entryKeysToRemove) {
+        m_orderedKeys.erase(entry);
+        m_records.remove(entry);
     }
 }