Title: [191645] trunk
Revision
191645
Author
beid...@apple.com
Date
2015-10-27 17:12:00 -0700 (Tue, 27 Oct 2015)

Log Message

Modern IDB: IDBTransaction.objectStore() support.
https://bugs.webkit.org/show_bug.cgi?id=150607

Reviewed by Alex Christensen.

Source/WebCore:

Tests: storage/indexeddb/modern/aborted-put.html
       storage/indexeddb/modern/idbtransaction-objectstore-failures.html

* Modules/indexeddb/client/IDBObjectStoreImpl.cpp:
(WebCore::IDBClient::IDBObjectStore::put):

* Modules/indexeddb/client/IDBTransactionImpl.cpp:
(WebCore::IDBClient::IDBTransaction::objectStore):
(WebCore::IDBClient::IDBTransaction::createObjectStoreOnServer):
* Modules/indexeddb/client/IDBTransactionImpl.h:

* Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp:
(WebCore::IDBServer::MemoryBackingStoreTransaction::addExistingObjectStore):
* Modules/indexeddb/server/MemoryBackingStoreTransaction.h:

* Modules/indexeddb/server/MemoryIDBBackingStore.cpp:
(WebCore::IDBServer::MemoryIDBBackingStore::beginTransaction):

* Modules/indexeddb/shared/IDBDatabaseInfo.cpp:
(WebCore::IDBDatabaseInfo::infoForExistingObjectStore):
* Modules/indexeddb/shared/IDBDatabaseInfo.h:

* Modules/indexeddb/shared/IDBTransactionInfo.h:
(WebCore::IDBTransactionInfo::objectStores):

LayoutTests:

* storage/indexeddb/modern/aborted-put-expected.txt: Added.
* storage/indexeddb/modern/aborted-put.html: Added.
* storage/indexeddb/modern/idbtransaction-objectstore-failures-expected.txt: Added.
* storage/indexeddb/modern/idbtransaction-objectstore-failures.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (191644 => 191645)


--- trunk/LayoutTests/ChangeLog	2015-10-27 23:34:54 UTC (rev 191644)
+++ trunk/LayoutTests/ChangeLog	2015-10-28 00:12:00 UTC (rev 191645)
@@ -1,3 +1,15 @@
+2015-10-27  Brady Eidson  <beid...@apple.com>
+
+        Modern IDB: IDBTransaction.objectStore() support.
+        https://bugs.webkit.org/show_bug.cgi?id=150607
+
+        Reviewed by Alex Christensen.
+
+        * storage/indexeddb/modern/aborted-put-expected.txt: Added.
+        * storage/indexeddb/modern/aborted-put.html: Added.
+        * storage/indexeddb/modern/idbtransaction-objectstore-failures-expected.txt: Added.
+        * storage/indexeddb/modern/idbtransaction-objectstore-failures.html: Added.
+
 2015-10-27  Wenson Hsieh  <wenson_hs...@apple.com>
 
         Implement viewport-width-based fast-click heuristic

Added: trunk/LayoutTests/storage/indexeddb/modern/aborted-put-expected.txt (0 => 191645)


--- trunk/LayoutTests/storage/indexeddb/modern/aborted-put-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/modern/aborted-put-expected.txt	2015-10-28 00:12:00 UTC (rev 191645)
@@ -0,0 +1,24 @@
+ALERT: First upgrade needed: Old version - 0 New version - 1
+ALERT: [object IDBTransaction] - versionchange
+ALERT: [object IDBDatabase]
+ALERT: put succeeded - key was 'foo'
+ALERT: get 'foo' succeeded - value was 'bar'
+ALERT: get 'far' succeeded - value was 'undefined'
+ALERT: First version change transaction completed
+ALERT: Second upgrade needed: Old version - 1 New version - 2
+ALERT: [object IDBTransaction] - versionchange
+ALERT: [object IDBDatabase]
+ALERT: get1 'foo' succeeded - value was 'baz'
+ALERT: get2 'far' succeeded - value was 'boo'
+ALERT: Second version change transaction abort
+ALERT: Third upgrade needed: Old version - 1 New version - 2
+ALERT: [object IDBTransaction] - versionchange
+ALERT: [object IDBDatabase]
+ALERT: get1 'foo' succeeded - value was 'bar'
+ALERT: get2 'far' succeeded - value was 'undefined'
+ALERT: Third version change transaction complete
+ALERT: Done
+This test creates some object stores, putting some values in them, committing the transaction.
+In a new transaction, it then overwrites those values, but then aborts the transaction.
+Finally it verifies everything is set up from the first transaction, and nothing from the aborted one committed.
+

Added: trunk/LayoutTests/storage/indexeddb/modern/aborted-put.html (0 => 191645)


--- trunk/LayoutTests/storage/indexeddb/modern/aborted-put.html	                        (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/modern/aborted-put.html	2015-10-28 00:12:00 UTC (rev 191645)
@@ -0,0 +1,204 @@
+This test creates some object stores, putting some values in them, committing the transaction.<br>
+In a new transaction, it then overwrites those values, but then aborts the transaction.<br>
+Finally it verifies everything is set up from the first transaction, and nothing from the aborted one committed.<br>
+<script>
+
+if (window.testRunner) {
+    testRunner.waitUntilDone();
+    testRunner.dumpAsText();
+}
+
+var request = window.indexedDB.open("AbortedPutTestDatabase");
+
+function done()
+{
+    alert("Done");
+    if (window.testRunner)
+        testRunner.notifyDone();
+}
+
+request._onupgradeneeded_ = function(event)
+{
+    alert("First upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
+    
+    var tx = request.transaction;
+    var db = event.target.result;
+
+    alert(tx + " - " + tx.mode);
+    alert(db);
+
+    var os1 = db.createObjectStore("TestObjectStore1");
+    var os2 = db.createObjectStore("TestObjectStore2");
+
+    var putRequest = os1.put("bar", "foo");
+    
+    putRequest._onsuccess_ = function(event) {
+        alert("put succeeded - key was '" + putRequest.result + "'");
+        
+        var getRequest1 = os1.get("foo");
+        getRequest1._onsuccess_ = function(event) {
+            alert("get 'foo' succeeded - value was '" + getRequest1.result + "'");
+        }
+
+        getRequest1._onerror_ = function(event) {
+            alert("get 'foo' unexpectedly failed - " + event);
+            done();
+        }
+        
+        var getRequest2 = os2.get("far");
+        getRequest2._onsuccess_ = function(event) {
+            alert("get 'far' succeeded - value was '" + getRequest2.result + "'");
+        }
+
+        getRequest2._onerror_ = function(event) {
+            alert("get 'far' unexpectedly failed - " + event);
+            done();
+        }
+    }
+
+    putRequest._onerror_ = function(event) {
+        alert("put unexpectedly failed - " + event);
+        done();
+    }
+    
+    tx._onabort_ = function(event) {
+        alert("First version change transaction unexpected abort");
+        done();
+    }
+
+    tx._oncomplete_ = function(event) {
+        alert("First version change transaction completed");
+        db.close();
+        continueTest1();
+    }
+
+    tx._onerror_ = function(event) {
+        alert("First version change transaction unexpected error - " + event);
+        done();
+    }
+}
+
+function continueTest1()
+{
+    var request = window.indexedDB.open("AbortedPutTestDatabase", 2);
+
+    request._onupgradeneeded_ = function(event) {
+        alert("Second upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
+    
+        var tx = request.transaction;
+        var db = event.target.result;
+
+        alert(tx + " - " + tx.mode);
+        alert(db);
+
+        var os1 = tx.objectStore("TestObjectStore1");
+        var os2 = tx.objectStore("TestObjectStore2");
+        var putRequest1 = os1.put("baz", "foo");
+        var putRequest2 = os2.put("boo", "far");
+    
+        putRequest1._onerror_ = function(e) {
+            alert("Unexpected error overwriting bar with baz - " + e);
+            done();
+        }
+
+        putRequest2._onerror_ = function(e) {
+            alert("Writing into second object store unexpectedly failed - " + e);
+            done();
+        }
+        
+        putRequest2._onsuccess_ = function(e) {
+            var getRequest1 = os1.get("foo");
+            var getRequest2 = os2.get("far");
+            
+            getRequest1._onsuccess_ = function(event) {
+                alert("get1 'foo' succeeded - value was '" + getRequest1.result + "'");
+            }
+
+            getRequest1._onerror_ = function(event) {
+                alert("get1 unexpectedly failed - " + event);
+                done();
+            }
+
+            getRequest2._onsuccess_ = function(event) {
+                alert("get2 'far' succeeded - value was '" + getRequest2.result + "'");
+                tx.abort();
+            }
+
+            getRequest2._onerror_ = function(event) {
+                alert("get2 unexpectedly failed - " + event);
+                done();
+            }
+        }
+        
+        tx._onabort_ = function(event) {
+            alert("Second version change transaction abort");
+            db.close();
+            continueTest2();
+        }
+
+        tx._oncomplete_ = function(event) {
+            alert("Second version change transaction unexpected complete");
+            done();
+        }
+
+        tx._onerror_ = function(event) {
+            alert("Second version change transaction unexpected error - " + event);
+            done();
+        }
+    }
+}
+
+function continueTest2()
+{
+    var request = window.indexedDB.open("AbortedPutTestDatabase", 2);
+
+    request._onupgradeneeded_ = function(event) {
+        alert("Third upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
+    
+        var tx = request.transaction;
+        var db = event.target.result;
+
+        alert(tx + " - " + tx.mode);
+        alert(db);
+
+        var os1 = tx.objectStore("TestObjectStore1");
+        var os2 = tx.objectStore("TestObjectStore2");
+        var getRequest1 = os1.get("foo");
+        var getRequest2 = os2.get("far");
+    
+        getRequest1._onsuccess_ = function(event) {
+            alert("get1 'foo' succeeded - value was '" + getRequest1.result + "'");
+        }
+
+        getRequest1._onerror_ = function(event) {
+            alert("get1 'foo' unexpectedly failed - " + event);
+            done();
+        }
+
+        getRequest2._onsuccess_ = function(event) {
+            alert("get2 'far' succeeded - value was '" + getRequest2.result + "'");
+        }
+
+        getRequest2._onerror_ = function(event) {
+            alert("get2 'far' unexpectedly failed - " + event);
+            done();
+        }
+        
+        tx._onabort_ = function(event) {
+            alert("Third version change transaction unexpected abort");
+            done();
+        }
+
+        tx._oncomplete_ = function(event) {
+            alert("Third version change transaction complete");
+            done();
+        }
+
+        tx._onerror_ = function(event) {
+            alert("Third version change transaction unexpected error - " + event);
+            done();
+        }
+    }
+}
+
+</script>

Added: trunk/LayoutTests/storage/indexeddb/modern/idbtransaction-objectstore-failures-expected.txt (0 => 191645)


--- trunk/LayoutTests/storage/indexeddb/modern/idbtransaction-objectstore-failures-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/modern/idbtransaction-objectstore-failures-expected.txt	2015-10-28 00:12:00 UTC (rev 191645)
@@ -0,0 +1,11 @@
+ALERT: Upgrade needed: Old version - 0 New version - 1
+ALERT: [object IDBTransaction] - versionchange
+ALERT: [object IDBDatabase]
+ALERT: Caught attempt to access empty-named object store on the transaction
+ALERT: Caught attempt to access null-named object store on the transaction
+ALERT: Caught attempt to access non-existant object store on the transaction
+ALERT: Caught attempt to access valid object store on a transaction that is already finishing
+ALERT: First version change transaction abort
+ALERT: Done
+This tests some obvious failures that can happen while calling transaction.objectStore()
+

Added: trunk/LayoutTests/storage/indexeddb/modern/idbtransaction-objectstore-failures.html (0 => 191645)


--- trunk/LayoutTests/storage/indexeddb/modern/idbtransaction-objectstore-failures.html	                        (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/modern/idbtransaction-objectstore-failures.html	2015-10-28 00:12:00 UTC (rev 191645)
@@ -0,0 +1,79 @@
+This tests some obvious failures that can happen while calling transaction.objectStore()<br>
+<script>
+
+if (window.testRunner) {
+    testRunner.waitUntilDone();
+    testRunner.dumpAsText();
+}
+
+var request = window.indexedDB.open("TransactionObjectStoreFailuresTestDatabase");
+
+function done()
+{
+    alert("Done");
+    if (window.testRunner)
+        testRunner.notifyDone();
+}
+
+request._onupgradeneeded_ = function(event)
+{
+    alert("Upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
+    
+    var tx = request.transaction;
+    var db = event.target.result;
+
+    alert(tx + " - " + tx.mode);
+    alert(db);
+
+    var os1 = db.createObjectStore("TestObjectStore1");
+    var os2 = db.createObjectStore("TestObjectStore2");
+
+    var putRequest = os1.put("bar", "foo");
+    
+    putRequest._onerror_ = function(event) {
+        alert("put unexpectedly failed - " + event);
+        done();
+    }
+    
+    try {
+        tx.objectStore("");
+    } catch(e) {
+        alert("Caught attempt to access empty-named object store on the transaction");
+    }
+    
+    try {
+        tx.objectStore();
+    } catch(e) {
+        alert("Caught attempt to access null-named object store on the transaction");
+    }
+     
+    try {
+        tx.objectStore("ThisObjectStoreDoesNotExist");
+    } catch(e) {
+        alert("Caught attempt to access non-existant object store on the transaction");
+    }
+    
+    tx.abort();
+    
+    try {
+        tx.objectStore("TestObjectStore1");
+    } catch(e) {
+        alert("Caught attempt to access valid object store on a transaction that is already finishing");
+    }
+      
+    tx._onabort_ = function(event) {
+        alert("First version change transaction abort");
+        done();
+    }
+
+    tx._oncomplete_ = function(event) {
+        alert("First version change transaction unexpected complete");
+        done();
+    }
+
+    tx._onerror_ = function(event) {
+        alert("First version change transaction unexpected error - " + event);
+        done();
+    }
+}
+</script>

Modified: trunk/Source/WebCore/ChangeLog (191644 => 191645)


--- trunk/Source/WebCore/ChangeLog	2015-10-27 23:34:54 UTC (rev 191644)
+++ trunk/Source/WebCore/ChangeLog	2015-10-28 00:12:00 UTC (rev 191645)
@@ -1,3 +1,35 @@
+2015-10-27  Brady Eidson  <beid...@apple.com>
+
+        Modern IDB: IDBTransaction.objectStore() support.
+        https://bugs.webkit.org/show_bug.cgi?id=150607
+
+        Reviewed by Alex Christensen.
+
+        Tests: storage/indexeddb/modern/aborted-put.html
+               storage/indexeddb/modern/idbtransaction-objectstore-failures.html
+
+        * Modules/indexeddb/client/IDBObjectStoreImpl.cpp:
+        (WebCore::IDBClient::IDBObjectStore::put):
+        
+        * Modules/indexeddb/client/IDBTransactionImpl.cpp:
+        (WebCore::IDBClient::IDBTransaction::objectStore):
+        (WebCore::IDBClient::IDBTransaction::createObjectStoreOnServer):
+        * Modules/indexeddb/client/IDBTransactionImpl.h:
+        
+        * Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp:
+        (WebCore::IDBServer::MemoryBackingStoreTransaction::addExistingObjectStore):
+        * Modules/indexeddb/server/MemoryBackingStoreTransaction.h:
+        
+        * Modules/indexeddb/server/MemoryIDBBackingStore.cpp:
+        (WebCore::IDBServer::MemoryIDBBackingStore::beginTransaction):
+        
+        * Modules/indexeddb/shared/IDBDatabaseInfo.cpp:
+        (WebCore::IDBDatabaseInfo::infoForExistingObjectStore):
+        * Modules/indexeddb/shared/IDBDatabaseInfo.h:
+        
+        * Modules/indexeddb/shared/IDBTransactionInfo.h:
+        (WebCore::IDBTransactionInfo::objectStores):
+
 2015-10-27  Joseph Pecoraro  <pecor...@apple.com>
 
         Web Inspector: Remove unused / duplicated XHR timeline instrumentation

Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.cpp (191644 => 191645)


--- trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.cpp	2015-10-27 23:34:54 UTC (rev 191644)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.cpp	2015-10-28 00:12:00 UTC (rev 191645)
@@ -169,7 +169,7 @@
 RefPtr<WebCore::IDBRequest> IDBObjectStore::put(JSC::ExecState& execState, Deprecated::ScriptValue& value, const Deprecated::ScriptValue& key, ExceptionCode& ec)
 {
     auto idbKey = scriptValueToIDBKey(execState, key);
-    return putOrAdd(execState, value, idbKey, IndexedDB::ObjectStoreOverwriteMode::NoOverwrite, ec);
+    return putOrAdd(execState, value, idbKey, IndexedDB::ObjectStoreOverwriteMode::Overwrite, ec);
 }
 
 RefPtr<WebCore::IDBRequest> IDBObjectStore::putOrAdd(JSC::ExecState& state, Deprecated::ScriptValue& value, RefPtr<IDBKey> key, IndexedDB::ObjectStoreOverwriteMode overwriteMode, ExceptionCode& ec)

Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.cpp (191644 => 191645)


--- trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.cpp	2015-10-27 23:34:54 UTC (rev 191644)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.cpp	2015-10-28 00:12:00 UTC (rev 191645)
@@ -99,10 +99,48 @@
     return nullptr;
 }
 
-RefPtr<WebCore::IDBObjectStore> IDBTransaction::objectStore(const String&, ExceptionCode&)
+RefPtr<WebCore::IDBObjectStore> IDBTransaction::objectStore(const String& objectStoreName, ExceptionCode& ec)
 {
-    ASSERT_NOT_REACHED();
-    return nullptr;
+    LOG(IndexedDB, "IDBTransaction::objectStore");
+
+    if (objectStoreName.isEmpty()) {
+        ec = NOT_FOUND_ERR;
+        return nullptr;
+    }
+
+    if (isFinishedOrFinishing()) {
+        ec = INVALID_STATE_ERR;
+        return nullptr;
+    }
+
+    auto iterator = m_referencedObjectStores.find(objectStoreName);
+    if (iterator != m_referencedObjectStores.end())
+        return iterator->value;
+
+    bool found = false;
+    for (auto& objectStore : m_info.objectStores()) {
+        if (objectStore == objectStoreName) {
+            found = true;
+            break;
+        }
+    }
+
+    auto* info = m_database->info().infoForExistingObjectStore(objectStoreName);
+    if (!info) {
+        ec = NOT_FOUND_ERR;
+        return nullptr;
+    }
+
+    // Version change transactions are scoped to every object store in the database.
+    if (!found && !isVersionChange()) {
+        ec = NOT_FOUND_ERR;
+        return nullptr;
+    }
+
+    auto objectStore = IDBObjectStore::create(*info, *this);
+    m_referencedObjectStores.set(objectStoreName, &objectStore.get());
+
+    return adoptRef(&objectStore.leakRef());
 }
 
 void IDBTransaction::abort(ExceptionCode& ec)
@@ -297,9 +335,11 @@
 {
     LOG(IndexedDB, "IDBTransaction::createObjectStoreOnServer");
 
-    ASSERT(!isFinishedOrFinishing());
     ASSERT(isVersionChange());
 
+    if (isFinishedOrFinishing())
+        return;
+
     m_database->serverConnection().createObjectStore(operation, info);
 }
 

Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.h (191644 => 191645)


--- trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.h	2015-10-27 23:34:54 UTC (rev 191644)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.h	2015-10-28 00:12:00 UTC (rev 191645)
@@ -133,6 +133,8 @@
 
     Deque<RefPtr<TransactionOperation>> m_transactionOperationQueue;
     HashMap<IDBResourceIdentifier, RefPtr<TransactionOperation>> m_transactionOperationMap;
+
+    HashMap<String, RefPtr<IDBObjectStore>> m_referencedObjectStores;
 };
 
 class TransactionActivator {

Modified: trunk/Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp (191644 => 191645)


--- trunk/Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp	2015-10-27 23:34:54 UTC (rev 191644)
+++ trunk/Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp	2015-10-28 00:12:00 UTC (rev 191645)
@@ -68,6 +68,18 @@
     objectStore.writeTransactionStarted(*this);
 }
 
+void MemoryBackingStoreTransaction::addExistingObjectStore(MemoryObjectStore& objectStore)
+{
+    LOG(IndexedDB, "MemoryBackingStoreTransaction::addExistingObjectStore");
+
+    ASSERT(isWriting());
+
+    ASSERT(!m_objectStores.contains(&objectStore));
+    m_objectStores.add(&objectStore);
+
+    objectStore.writeTransactionStarted(*this);
+}
+
 void MemoryBackingStoreTransaction::recordValueChanged(MemoryObjectStore& objectStore, const IDBKeyData& key)
 {
     ASSERT(m_objectStores.contains(&objectStore));

Modified: trunk/Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.h (191644 => 191645)


--- trunk/Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.h	2015-10-27 23:34:54 UTC (rev 191644)
+++ trunk/Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.h	2015-10-28 00:12:00 UTC (rev 191645)
@@ -56,6 +56,7 @@
     const IDBDatabaseInfo& originalDatabaseInfo() const;
 
     void addNewObjectStore(MemoryObjectStore&);
+    void addExistingObjectStore(MemoryObjectStore&);
     void recordValueChanged(MemoryObjectStore&, const IDBKeyData&);
 
     void abort();

Modified: trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.cpp (191644 => 191645)


--- trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.cpp	2015-10-27 23:34:54 UTC (rev 191644)
+++ trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.cpp	2015-10-28 00:12:00 UTC (rev 191645)
@@ -72,6 +72,13 @@
         return IDBError(IDBExceptionCode::InvalidStateError, "Backing store asked to create transaction it already has a record of");
 
     auto transaction = MemoryBackingStoreTransaction::create(*this, info);
+
+    // VersionChange transactions are scoped to "every object store".
+    if (transaction->isVersionChange()) {
+        for (auto& objectStore : m_objectStores.values())
+            transaction->addExistingObjectStore(*objectStore);
+    }
+
     m_transactions.set(info.identifier(), WTF::move(transaction));
 
     return IDBError();

Modified: trunk/Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.cpp (191644 => 191645)


--- trunk/Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.cpp	2015-10-27 23:34:54 UTC (rev 191644)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.cpp	2015-10-28 00:12:00 UTC (rev 191645)
@@ -86,6 +86,16 @@
     return &iterator->value;
 }
 
+const IDBObjectStoreInfo* IDBDatabaseInfo::infoForExistingObjectStore(const String& name) const
+{
+    for (auto& objectStore : m_objectStoreMap.values()) {
+        if (objectStore.name() == name)
+            return &objectStore;
+    }
+
+    return nullptr;
+}
+
 Vector<String> IDBDatabaseInfo::objectStoreNames() const
 {
     Vector<String> names;

Modified: trunk/Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.h (191644 => 191645)


--- trunk/Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.h	2015-10-27 23:34:54 UTC (rev 191644)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.h	2015-10-28 00:12:00 UTC (rev 191645)
@@ -50,6 +50,7 @@
     IDBObjectStoreInfo createNewObjectStore(const String& name, const IDBKeyPath&, bool autoIncrement);
     void addExistingObjectStore(const IDBObjectStoreInfo&);
     const IDBObjectStoreInfo* infoForExistingObjectStore(uint64_t objectStoreIdentifier) const;
+    const IDBObjectStoreInfo* infoForExistingObjectStore(const String& objectStoreName) const;
 
     Vector<String> objectStoreNames() const;
 

Modified: trunk/Source/WebCore/Modules/indexeddb/shared/IDBTransactionInfo.h (191644 => 191645)


--- trunk/Source/WebCore/Modules/indexeddb/shared/IDBTransactionInfo.h	2015-10-27 23:34:54 UTC (rev 191644)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/IDBTransactionInfo.h	2015-10-28 00:12:00 UTC (rev 191645)
@@ -30,6 +30,7 @@
 
 #include "IDBResourceIdentifier.h"
 #include "IndexedDB.h"
+#include <wtf/Vector.h>
 
 namespace WebCore {
 namespace IDBServer {
@@ -47,6 +48,8 @@
     IndexedDB::TransactionMode mode() const { return m_mode; }
     uint64_t newVersion() const { return m_newVersion; }
 
+    const Vector<String>& objectStores() const { return m_objectStores; }
+
 private:
     IDBTransactionInfo(const IDBResourceIdentifier&);
 
@@ -54,6 +57,7 @@
 
     IndexedDB::TransactionMode m_mode { IndexedDB::TransactionMode::ReadOnly };
     uint64_t m_newVersion { 0 };
+    Vector<String> m_objectStores;
 };
 
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to