Modern IDB: Support IDBObjectStore.get() for IDBKeyRanges.
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 31 Oct 2015 00:17:49 +0000 (00:17 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 31 Oct 2015 00:17:49 +0000 (00:17 +0000)
https://bugs.webkit.org/show_bug.cgi?id=150718

Reviewed by Alex Christensen.

Source/WebCore:

Test: storage/indexeddb/modern/get-keyrange.html

* Modules/indexeddb/IDBKeyRangeData.cpp:
(WebCore::IDBKeyRangeData::IDBKeyRangeData):
* Modules/indexeddb/IDBKeyRangeData.h:

* Modules/indexeddb/client/IDBConnectionToServer.cpp:
(WebCore::IDBClient::IDBConnectionToServer::getRecord):
* Modules/indexeddb/client/IDBConnectionToServer.h:
* Modules/indexeddb/client/IDBConnectionToServerDelegate.h:

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

* Modules/indexeddb/client/IDBTransactionImpl.cpp:
(WebCore::IDBClient::IDBTransaction::requestGetRecord):
(WebCore::IDBClient::IDBTransaction::getRecordOnServer):
* Modules/indexeddb/client/IDBTransactionImpl.h:

* Modules/indexeddb/server/IDBBackingStore.h:

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

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

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

* Modules/indexeddb/server/MemoryObjectStore.cpp:
(WebCore::IDBServer::MemoryObjectStore::deleteRecord):
(WebCore::IDBServer::MemoryObjectStore::setKeyValue):
(WebCore::IDBServer::MemoryObjectStore::valueForKeyRange): Using a std::set, find the appropriate
  key in the range, and return the value if one exists.
(WebCore::IDBServer::MemoryObjectStore::valueForKey): Deleted.
* Modules/indexeddb/server/MemoryObjectStore.h:

* Modules/indexeddb/server/UniqueIDBDatabase.cpp:
(WebCore::IDBServer::UniqueIDBDatabase::getRecord):
(WebCore::IDBServer::UniqueIDBDatabase::performGetRecord):
* Modules/indexeddb/server/UniqueIDBDatabase.h:

* Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp:
(WebCore::IDBServer::UniqueIDBDatabaseTransaction::getRecord):
* Modules/indexeddb/server/UniqueIDBDatabaseTransaction.h:

* Modules/indexeddb/shared/InProcessIDBServer.cpp:
(WebCore::InProcessIDBServer::getRecord):
* Modules/indexeddb/shared/InProcessIDBServer.h:

LayoutTests:

* storage/indexeddb/modern/get-keyrange.html: Added.
* storage/indexeddb/modern/get-keyrange-expected.txt: Added.

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

26 files changed:
LayoutTests/ChangeLog
LayoutTests/storage/indexeddb/modern/get-keyrange-expected.txt [new file with mode: 0644]
LayoutTests/storage/indexeddb/modern/get-keyrange.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/Modules/indexeddb/IDBKeyRangeData.cpp
Source/WebCore/Modules/indexeddb/IDBKeyRangeData.h
Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.cpp
Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.h
Source/WebCore/Modules/indexeddb/client/IDBConnectionToServerDelegate.h
Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.cpp
Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.cpp
Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.h
Source/WebCore/Modules/indexeddb/server/IDBBackingStore.h
Source/WebCore/Modules/indexeddb/server/IDBServer.cpp
Source/WebCore/Modules/indexeddb/server/IDBServer.h
Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp
Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.cpp
Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.h
Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.cpp
Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.h
Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp
Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.h
Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp
Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseTransaction.h
Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.cpp
Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.h

index 503905c..fa50b01 100644 (file)
@@ -1,5 +1,15 @@
 2015-10-30  Brady Eidson  <beidson@apple.com>
 
+        Modern IDB: Support IDBObjectStore.get() for IDBKeyRanges.
+        https://bugs.webkit.org/show_bug.cgi?id=150718
+
+        Reviewed by Alex Christensen.
+
+        * storage/indexeddb/modern/get-keyrange.html: Added.
+        * storage/indexeddb/modern/get-keyrange-expected.txt: Added.
+
+2015-10-30  Brady Eidson  <beidson@apple.com>
+
         Modern IDB: IDBObjectStore.clear() support.
         https://bugs.webkit.org/show_bug.cgi?id=150733
 
diff --git a/LayoutTests/storage/indexeddb/modern/get-keyrange-expected.txt b/LayoutTests/storage/indexeddb/modern/get-keyrange-expected.txt
new file mode 100644 (file)
index 0000000..c114180
--- /dev/null
@@ -0,0 +1,103 @@
+ALERT: Initial upgrade needed: Old version - 0 New version - 1
+ALERT: Initial upgrade versionchange transaction complete
+ALERT: Success getting keyRange [-1 (Closed), undefined (Open)]
+ALERT: Result is "0"
+ALERT: Success getting keyRange [-1 (Open), undefined (Open)]
+ALERT: Result is "0"
+ALERT: Success getting keyRange [0 (Closed), undefined (Open)]
+ALERT: Result is "0"
+ALERT: Success getting keyRange [0 (Open), undefined (Open)]
+ALERT: Result is "1"
+ALERT: Success getting keyRange [0.1 (Closed), undefined (Open)]
+ALERT: Result is "1"
+ALERT: Success getting keyRange [0.1 (Open), undefined (Open)]
+ALERT: Result is "1"
+ALERT: Success getting keyRange [99 (Closed), undefined (Open)]
+ALERT: Result is "99"
+ALERT: Success getting keyRange [99 (Open), undefined (Open)]
+ALERT: Result is PosInf
+ALERT: Success getting keyRange [99.1 (Closed), undefined (Open)]
+ALERT: Result is PosInf
+ALERT: Success getting keyRange [99.1 (Open), undefined (Open)]
+ALERT: Result is PosInf
+ALERT: Success getting keyRange [undefined (Open), 100 (Closed)]
+ALERT: Result is NegInf
+ALERT: Success getting keyRange [undefined (Open), 100 (Open)]
+ALERT: Result is NegInf
+ALERT: Success getting keyRange [undefined (Open), 99 (Closed)]
+ALERT: Result is NegInf
+ALERT: Success getting keyRange [undefined (Open), 99 (Open)]
+ALERT: Result is NegInf
+ALERT: Success getting keyRange [undefined (Open), 98.99999 (Closed)]
+ALERT: Result is NegInf
+ALERT: Success getting keyRange [undefined (Open), 98.99999 (Open)]
+ALERT: Result is NegInf
+ALERT: Success getting keyRange [undefined (Open), 98 (Closed)]
+ALERT: Result is NegInf
+ALERT: Success getting keyRange [undefined (Open), 98 (Open)]
+ALERT: Result is NegInf
+ALERT: Success getting keyRange [undefined (Open), 0 (Closed)]
+ALERT: Result is NegInf
+ALERT: Success getting keyRange [undefined (Open), 0 (Open)]
+ALERT: Result is NegInf
+ALERT: Success getting keyRange [undefined (Open), -0.1 (Closed)]
+ALERT: Result is NegInf
+ALERT: Success getting keyRange [undefined (Open), -0.1 (Open)]
+ALERT: Result is NegInf
+ALERT: Success getting keyRange [2.5 (Closed), 3.5 (Closed)]
+ALERT: Result is "3"
+ALERT: Success getting keyRange [-0.5 (Closed), 0.5 (Closed)]
+ALERT: Result is "0"
+ALERT: Success getting keyRange [98.5 (Closed), 99.5 (Closed)]
+ALERT: Result is "99"
+ALERT: Success getting keyRange [-1 (Closed), 0 (Closed)]
+ALERT: Result is "0"
+ALERT: Success getting keyRange [-1 (Open), 0 (Closed)]
+ALERT: Result is "0"
+ALERT: Success getting keyRange [-1 (Closed), 0 (Open)]
+ALERT: Result is undefined
+ALERT: Success getting keyRange [-1 (Open), 0 (Open)]
+ALERT: Result is undefined
+ALERT: Success getting keyRange [3 (Closed), 4 (Closed)]
+ALERT: Result is "3"
+ALERT: Success getting keyRange [3 (Open), 4 (Closed)]
+ALERT: Result is "4"
+ALERT: Success getting keyRange [3 (Closed), 4 (Open)]
+ALERT: Result is "3"
+ALERT: Success getting keyRange [3 (Open), 4 (Open)]
+ALERT: Result is undefined
+ALERT: Success getting keyRange [99 (Closed), 100 (Closed)]
+ALERT: Result is "99"
+ALERT: Success getting keyRange [99 (Open), 100 (Closed)]
+ALERT: Result is undefined
+ALERT: Success getting keyRange [99 (Closed), 100 (Open)]
+ALERT: Result is "99"
+ALERT: Success getting keyRange [99 (Open), 100 (Open)]
+ALERT: Result is undefined
+ALERT: Success getting keyRange [Infinity (Closed), a (Closed)]
+ALERT: Result is PosInf
+ALERT: Success getting keyRange [Infinity (Open), a (Closed)]
+ALERT: Result is A
+ALERT: Success getting keyRange [Infinity (Closed), a (Open)]
+ALERT: Result is PosInf
+ALERT: Success getting keyRange [Infinity (Open), a (Open)]
+ALERT: Result is A
+ALERT: Success getting keyRange [AS (Closed), a (Closed)]
+ALERT: Result is AS
+ALERT: Success getting keyRange [AS (Open), a (Closed)]
+ALERT: Result is As
+ALERT: Success getting keyRange [AS (Closed), a (Open)]
+ALERT: Result is AS
+ALERT: Success getting keyRange [AS (Open), a (Open)]
+ALERT: Result is As
+ALERT: Success getting keyRange [Infinity (Closed),  (Closed)]
+ALERT: Result is PosInf
+ALERT: Success getting keyRange [Infinity (Open),  (Closed)]
+ALERT: Result is A
+ALERT: Success getting keyRange [Infinity (Closed),  (Open)]
+ALERT: Result is PosInf
+ALERT: Success getting keyRange [Infinity (Open),  (Open)]
+ALERT: Result is A
+ALERT: readonly transaction complete
+ALERT: Done
+This test exercises IDBObjectStore.get() with an IDBKeyRange as the parameter.
diff --git a/LayoutTests/storage/indexeddb/modern/get-keyrange.html b/LayoutTests/storage/indexeddb/modern/get-keyrange.html
new file mode 100644 (file)
index 0000000..fef9f79
--- /dev/null
@@ -0,0 +1,147 @@
+This test exercises IDBObjectStore.get() with an IDBKeyRange as the parameter.
+<script>
+
+if (window.testRunner) {
+    testRunner.waitUntilDone();
+    testRunner.dumpAsText();
+}
+
+function done()
+{
+    alert("Done");
+    if (window.testRunner)
+        testRunner.notifyDone();
+}
+
+var createRequest = window.indexedDB.open("GetKeyRangeDatabase", 1);
+var database;
+
+createRequest.onupgradeneeded = function(event) {
+    alert("Initial upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
+
+    var versionTransaction = createRequest.transaction;
+    database = event.target.result;
+    var objectStore = database.createObjectStore("TestObjectStore");
+    for (var i = 0; i < 100; ++i)
+        objectStore.put("\"" + i + "\"", i);
+
+    objectStore.put("PosInf", Infinity);
+    objectStore.put("NegInf", -Infinity);
+
+    objectStore.put("A", "A");
+    objectStore.put("As", "As");
+    objectStore.put("AS", "AS");
+    objectStore.put("a", "a");
+
+    objectStore.put("array 1", [1, "hello"]);
+    objectStore.put("array 2", [2, "goodbye"]);
+    objectStore.put("array 3", []);
+
+    versionTransaction.onabort = function(event) {
+        alert("Initial upgrade versionchange transaction unexpected aborted");
+        done();
+    }
+
+    versionTransaction.oncomplete = function(event) {
+        alert("Initial upgrade versionchange transaction complete");
+        continueTest1();
+    }
+
+    versionTransaction.onerror = function(event) {
+        alert("Initial upgrade versionchange transaction unexpected error" + event);
+        done();
+    }
+}
+
+var objectStore;
+
+function testGet(keyRange) {
+    var request = objectStore.get(keyRange);
+    request.onsuccess = function()
+    {
+        alert("Success getting keyRange [" + keyRange.lower + " (" + (keyRange.lowerOpen ? "Open" : "Closed") + "), " + keyRange.upper + " (" + (keyRange.upperOpen ? "Open" : "Closed") + ")]");
+        alert("Result is " + request.result);
+    }
+    request.onerror = function()
+    {
+        alert("Unexpected error getting keyRange [" + keyRange.lower + " (" + keyRange.lowerOpen + "), " + keyRange.upper + " (" + keyRange.upperOpen + ")]");
+    }
+}
+
+function continueTest1()
+{
+    var transaction = database.transaction("TestObjectStore", "readonly");
+    objectStore = transaction.objectStore("TestObjectStore");
+
+    testGet(IDBKeyRange.lowerBound(-1));
+    testGet(IDBKeyRange.lowerBound(-1, true));
+    testGet(IDBKeyRange.lowerBound(0));
+    testGet(IDBKeyRange.lowerBound(0, true));
+    testGet(IDBKeyRange.lowerBound(0.1));
+    testGet(IDBKeyRange.lowerBound(0.1, true));
+    testGet(IDBKeyRange.lowerBound(99));
+    testGet(IDBKeyRange.lowerBound(99, true));
+    testGet(IDBKeyRange.lowerBound(99.1));
+    testGet(IDBKeyRange.lowerBound(99.1, true));
+    
+    testGet(IDBKeyRange.upperBound(100));
+    testGet(IDBKeyRange.upperBound(100, true));
+    testGet(IDBKeyRange.upperBound(99));
+    testGet(IDBKeyRange.upperBound(99, true));
+    testGet(IDBKeyRange.upperBound(98.99999));
+    testGet(IDBKeyRange.upperBound(98.99999, true));
+    testGet(IDBKeyRange.upperBound(98));
+    testGet(IDBKeyRange.upperBound(98, true));
+    testGet(IDBKeyRange.upperBound(0));
+    testGet(IDBKeyRange.upperBound(0, true));
+    testGet(IDBKeyRange.upperBound(-0.1));
+    testGet(IDBKeyRange.upperBound(-0.1, true));
+    
+    testGet(IDBKeyRange.bound(2.5, 3.5));
+    testGet(IDBKeyRange.bound(-0.5, 0.5));
+    testGet(IDBKeyRange.bound(98.5, 99.5));
+    testGet(IDBKeyRange.bound(-1, 0));
+    testGet(IDBKeyRange.bound(-1, 0, true));
+    testGet(IDBKeyRange.bound(-1, 0, false, true));
+    testGet(IDBKeyRange.bound(-1, 0, true, true));
+    testGet(IDBKeyRange.bound(3, 4));
+    testGet(IDBKeyRange.bound(3, 4, true));
+    testGet(IDBKeyRange.bound(3, 4, false, true));
+    testGet(IDBKeyRange.bound(3, 4, true, true));
+    testGet(IDBKeyRange.bound(99, 100));
+    testGet(IDBKeyRange.bound(99, 100, true));
+    testGet(IDBKeyRange.bound(99, 100, false, true));
+    testGet(IDBKeyRange.bound(99, 100, true, true));
+
+    testGet(IDBKeyRange.bound(Infinity, "a"));
+    testGet(IDBKeyRange.bound(Infinity, "a", true));
+    testGet(IDBKeyRange.bound(Infinity, "a", false, true));
+    testGet(IDBKeyRange.bound(Infinity, "a", true, true));
+
+    testGet(IDBKeyRange.bound("AS", "a"));
+    testGet(IDBKeyRange.bound("AS", "a", true));
+    testGet(IDBKeyRange.bound("AS", "a", false, true));
+    testGet(IDBKeyRange.bound("AS", "a", true, true));
+    
+    testGet(IDBKeyRange.bound(Infinity, []));
+    testGet(IDBKeyRange.bound(Infinity, [], true));
+    testGet(IDBKeyRange.bound(Infinity, [], false, true));
+    testGet(IDBKeyRange.bound(Infinity, [], true, true));
+    
+    transaction.onabort = function(event) {
+        alert("readonly transaction unexpected abort" + event);
+        done();
+    }
+
+    transaction.oncomplete = function(event) {
+        alert("readonly transaction complete");
+        done();
+    }
+
+    transaction.onerror = function(event) {
+        alert("readonly transaction unexpected error" + event);
+        done();
+    }
+}
+
+</script>
index 5f38db0..a89c59c 100644 (file)
@@ -1,5 +1,65 @@
 2015-10-30  Brady Eidson  <beidson@apple.com>
 
+        Modern IDB: Support IDBObjectStore.get() for IDBKeyRanges.
+        https://bugs.webkit.org/show_bug.cgi?id=150718
+
+        Reviewed by Alex Christensen.
+
+        Test: storage/indexeddb/modern/get-keyrange.html
+
+        * Modules/indexeddb/IDBKeyRangeData.cpp:
+        (WebCore::IDBKeyRangeData::IDBKeyRangeData):
+        * Modules/indexeddb/IDBKeyRangeData.h:
+        
+        * Modules/indexeddb/client/IDBConnectionToServer.cpp:
+        (WebCore::IDBClient::IDBConnectionToServer::getRecord):
+        * Modules/indexeddb/client/IDBConnectionToServer.h:
+        * Modules/indexeddb/client/IDBConnectionToServerDelegate.h:
+        
+        * Modules/indexeddb/client/IDBObjectStoreImpl.cpp:
+        (WebCore::IDBClient::IDBObjectStore::get):
+        
+        * Modules/indexeddb/client/IDBTransactionImpl.cpp:
+        (WebCore::IDBClient::IDBTransaction::requestGetRecord):
+        (WebCore::IDBClient::IDBTransaction::getRecordOnServer):
+        * Modules/indexeddb/client/IDBTransactionImpl.h:
+        
+        * Modules/indexeddb/server/IDBBackingStore.h:
+        
+        * Modules/indexeddb/server/IDBServer.cpp:
+        (WebCore::IDBServer::IDBServer::getRecord):
+        * Modules/indexeddb/server/IDBServer.h:
+        
+        * Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp:
+        (WebCore::IDBServer::MemoryBackingStoreTransaction::recordValueChanged):
+        
+        * Modules/indexeddb/server/MemoryIDBBackingStore.cpp:
+        (WebCore::IDBServer::MemoryIDBBackingStore::getRecord):
+        * Modules/indexeddb/server/MemoryIDBBackingStore.h:
+        
+        * Modules/indexeddb/server/MemoryObjectStore.cpp:
+        (WebCore::IDBServer::MemoryObjectStore::deleteRecord):
+        (WebCore::IDBServer::MemoryObjectStore::setKeyValue):
+        (WebCore::IDBServer::MemoryObjectStore::valueForKeyRange): Using a std::set, find the appropriate
+          key in the range, and return the value if one exists.
+        (WebCore::IDBServer::MemoryObjectStore::valueForKey): Deleted.
+        * Modules/indexeddb/server/MemoryObjectStore.h:
+        
+        * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
+        (WebCore::IDBServer::UniqueIDBDatabase::getRecord):
+        (WebCore::IDBServer::UniqueIDBDatabase::performGetRecord):
+        * Modules/indexeddb/server/UniqueIDBDatabase.h:
+        
+        * Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp:
+        (WebCore::IDBServer::UniqueIDBDatabaseTransaction::getRecord):
+        * Modules/indexeddb/server/UniqueIDBDatabaseTransaction.h:
+        
+        * Modules/indexeddb/shared/InProcessIDBServer.cpp:
+        (WebCore::InProcessIDBServer::getRecord):
+        * Modules/indexeddb/shared/InProcessIDBServer.h:
+
+2015-10-30  Brady Eidson  <beidson@apple.com>
+
         Modern IDB: IDBObjectStore.clear() support.
         https://bugs.webkit.org/show_bug.cgi?id=150733
 
index 5546294..c01a2ae 100644 (file)
 
 #if ENABLE(INDEXED_DATABASE)
 
+#include "IDBKey.h"
+
 namespace WebCore {
 
+IDBKeyRangeData::IDBKeyRangeData(IDBKey* key)
+    : isNull(!key)
+    , lowerKey(key)
+    , upperKey(key)
+    , lowerOpen(false)
+    , upperOpen(false)
+{
+}
+
+IDBKeyRangeData::IDBKeyRangeData(const IDBKeyData& keyData)
+    : isNull(keyData.isNull())
+    , lowerKey(keyData)
+    , upperKey(keyData)
+    , lowerOpen(false)
+    , upperOpen(false)
+{
+}
+
 IDBKeyRangeData IDBKeyRangeData::isolatedCopy() const
 {
     IDBKeyRangeData result;
index 98c82ca..933aa40 100644 (file)
@@ -33,6 +33,8 @@
 
 namespace WebCore {
 
+class IDBKey;
+
 struct IDBKeyRangeData {
     IDBKeyRangeData()
         : isNull(true)
@@ -41,6 +43,9 @@ struct IDBKeyRangeData {
     {
     }
 
+    IDBKeyRangeData(IDBKey*);
+    IDBKeyRangeData(const IDBKeyData&);
+
     IDBKeyRangeData(IDBKeyRange* keyRange)
         : isNull(!keyRange)
         , lowerOpen(false)
index b1ed6d3..9ce20ff 100644 (file)
@@ -28,6 +28,7 @@
 
 #if ENABLE(INDEXED_DATABASE)
 
+#include "IDBKeyRangeData.h"
 #include "IDBOpenDBRequestImpl.h"
 #include "IDBRequestData.h"
 #include "IDBResultData.h"
@@ -153,14 +154,14 @@ void IDBConnectionToServer::didPutOrAdd(const IDBResultData& resultData)
     completeOperation(resultData);
 }
 
-void IDBConnectionToServer::getRecord(TransactionOperation& operation, RefPtr<IDBKey>& key)
+void IDBConnectionToServer::getRecord(TransactionOperation& operation, const IDBKeyRangeData& keyRangeData)
 {
     LOG(IndexedDB, "IDBConnectionToServer::getRecord");
 
-    ASSERT(key);
+    ASSERT(!keyRangeData.isNull);
 
     saveOperation(operation);
-    m_delegate->getRecord(IDBRequestData(operation), key.get());
+    m_delegate->getRecord(IDBRequestData(operation), keyRangeData);
 }
 
 void IDBConnectionToServer::didGetRecord(const IDBResultData& resultData)
index f2ccbb1..b412432 100644 (file)
@@ -73,7 +73,7 @@ public:
     void putOrAdd(TransactionOperation&, RefPtr<IDBKey>&, RefPtr<SerializedScriptValue>&, const IndexedDB::ObjectStoreOverwriteMode);
     void didPutOrAdd(const IDBResultData&);
 
-    void getRecord(TransactionOperation&, RefPtr<IDBKey>&);
+    void getRecord(TransactionOperation&, const IDBKeyRangeData&);
     void didGetRecord(const IDBResultData&);
 
     void commitTransaction(IDBTransaction&);
index 8971a8e..89f0d31 100644 (file)
@@ -43,6 +43,8 @@ namespace IndexedDB {
 enum class ObjectStoreOverwriteMode;
 }
 
+struct IDBKeyRangeData;
+
 namespace IDBClient {
 
 class IDBConnectionToServerDelegate {
@@ -58,7 +60,7 @@ public:
     virtual void deleteObjectStore(const IDBRequestData&, const String& objectStoreName) = 0;
     virtual void clearObjectStore(const IDBRequestData&, uint64_t objectStoreIdentifier) = 0;
     virtual void putOrAdd(const IDBRequestData&, IDBKey*, SerializedScriptValue&, const IndexedDB::ObjectStoreOverwriteMode) = 0;
-    virtual void getRecord(const IDBRequestData&, IDBKey*) = 0;
+    virtual void getRecord(const IDBRequestData&, const IDBKeyRangeData&) = 0;
     virtual void establishTransaction(uint64_t databaseConnectionIdentifier, const IDBTransactionInfo&) = 0;
 
     virtual void databaseConnectionClosed(uint64_t databaseConnectionIdentifier) = 0;
index 365bc57..66f99ea 100644 (file)
@@ -32,6 +32,7 @@
 #include "IDBBindingUtilities.h"
 #include "IDBError.h"
 #include "IDBKey.h"
+#include "IDBKeyRangeData.h"
 #include "IDBRequestImpl.h"
 #include "IDBTransactionImpl.h"
 #include "IndexedDB.h"
@@ -147,13 +148,39 @@ RefPtr<WebCore::IDBRequest> IDBObjectStore::get(ScriptExecutionContext* context,
         return nullptr;
     }
 
-    Ref<IDBRequest> request = m_transaction->requestGetRecord(*context, *this, *idbKey);
-    return adoptRef(request.leakRef());
+    Ref<IDBRequest> request = m_transaction->requestGetRecord(*context, *this, idbKey.get());
+    return WTF::move(request);
 }
 
-RefPtr<WebCore::IDBRequest> IDBObjectStore::get(ScriptExecutionContext*, IDBKeyRange*, ExceptionCode&)
+RefPtr<WebCore::IDBRequest> IDBObjectStore::get(ScriptExecutionContext* context, IDBKeyRange* keyRange, ExceptionCode& ec)
 {
-    RELEASE_ASSERT_NOT_REACHED();
+    LOG(IndexedDB, "IDBObjectStore::get");
+
+    if (!context) {
+        ec = INVALID_STATE_ERR;
+        return nullptr;
+    }
+
+    if (!m_transaction->isActive()) {
+        ec = static_cast<ExceptionCode>(IDBExceptionCode::TransactionInactiveError);
+        return nullptr;
+    }
+
+    if (m_deleted) {
+        ec = INVALID_STATE_ERR;
+        return nullptr;
+    }
+
+    IDBKeyRangeData keyRangeData(keyRange);
+    if (keyRangeData.isNull
+        || (!keyRangeData.lowerKey.isValid() && !keyRangeData.lowerKey.isNull())
+        || (!keyRangeData.upperKey.isValid() && !keyRangeData.upperKey.isNull())) {
+        ec = static_cast<ExceptionCode>(IDBExceptionCode::DataError);
+        return nullptr;
+    }
+
+    Ref<IDBRequest> request = m_transaction->requestGetRecord(*context, *this, keyRangeData);
+    return WTF::move(request);
 }
 
 RefPtr<WebCore::IDBRequest> IDBObjectStore::add(JSC::ExecState& execState, Deprecated::ScriptValue& value, const Deprecated::ScriptValue& key, ExceptionCode& ec)
index a547204..5fa4607 100644 (file)
@@ -33,6 +33,7 @@
 #include "IDBDatabaseImpl.h"
 #include "IDBError.h"
 #include "IDBEventDispatcher.h"
+#include "IDBKeyRangeData.h"
 #include "IDBObjectStore.h"
 #include "IDBRequestImpl.h"
 #include "IDBResultData.h"
@@ -385,25 +386,25 @@ void IDBTransaction::didCreateObjectStoreOnServer(const IDBResultData& resultDat
     ASSERT_UNUSED(resultData, resultData.type() == IDBResultType::CreateObjectStoreSuccess);
 }
 
-Ref<IDBRequest> IDBTransaction::requestGetRecord(ScriptExecutionContext& context, IDBObjectStore& objectStore, IDBKey& key)
+Ref<IDBRequest> IDBTransaction::requestGetRecord(ScriptExecutionContext& context, IDBObjectStore& objectStore, const IDBKeyRangeData& keyRangeData)
 {
     LOG(IndexedDB, "IDBTransaction::requestGetRecord");
     ASSERT(isActive());
-    ASSERT(key.isValid());
+    ASSERT(!keyRangeData.isNull);
 
     Ref<IDBRequest> request = IDBRequest::create(context, objectStore, *this);
 
-    auto operation = createTransactionOperation(*this, request.get(), &IDBTransaction::didGetRecordOnServer, &IDBTransaction::getRecordOnServer, &key);
+    auto operation = createTransactionOperation(*this, request.get(), &IDBTransaction::didGetRecordOnServer, &IDBTransaction::getRecordOnServer, keyRangeData);
     scheduleOperation(WTF::move(operation));
 
     return WTF::move(request);
 }
 
-void IDBTransaction::getRecordOnServer(TransactionOperation& operation, RefPtr<IDBKey> key)
+void IDBTransaction::getRecordOnServer(TransactionOperation& operation, const IDBKeyRangeData& keyRange)
 {
     LOG(IndexedDB, "IDBTransaction::getRecordOnServer");
 
-    serverConnection().getRecord(operation, key);
+    serverConnection().getRecord(operation, keyRange);
 }
 
 void IDBTransaction::didGetRecordOnServer(IDBRequest& request, const IDBResultData& resultData)
index 4ef51a1..721b430 100644 (file)
@@ -43,6 +43,8 @@ namespace WebCore {
 class IDBObjectStoreInfo;
 class IDBResultData;
 
+struct IDBKeyRangeData;
+
 namespace IDBClient {
 
 class IDBDatabase;
@@ -88,7 +90,7 @@ public:
     Ref<IDBObjectStore> createObjectStore(const IDBObjectStoreInfo&);
 
     Ref<IDBRequest> requestPutOrAdd(ScriptExecutionContext&, IDBObjectStore&, IDBKey*, SerializedScriptValue&, IndexedDB::ObjectStoreOverwriteMode);
-    Ref<IDBRequest> requestGetRecord(ScriptExecutionContext&, IDBObjectStore&, IDBKey&);
+    Ref<IDBRequest> requestGetRecord(ScriptExecutionContext&, IDBObjectStore&, const IDBKeyRangeData&);
     Ref<IDBRequest> requestClearObjectStore(ScriptExecutionContext&, IDBObjectStore&);
 
     void deleteObjectStore(const String& objectStoreName);
@@ -128,7 +130,7 @@ private:
     void putOrAddOnServer(TransactionOperation&, RefPtr<IDBKey>, RefPtr<SerializedScriptValue>, const IndexedDB::ObjectStoreOverwriteMode&);
     void didPutOrAddOnServer(IDBRequest&, const IDBResultData&);
 
-    void getRecordOnServer(TransactionOperation&, RefPtr<IDBKey>);
+    void getRecordOnServer(TransactionOperation&, const IDBKeyRangeData&);
     void didGetRecordOnServer(IDBRequest&, const IDBResultData&);
 
     void deleteObjectStoreOnServer(TransactionOperation&, const String& objectStoreName);
index 08fa646..8f39c72 100644 (file)
@@ -39,6 +39,8 @@ class IDBResourceIdentifier;
 class IDBTransactionInfo;
 class ThreadSafeDataBuffer;
 
+struct IDBKeyRangeData;
+
 namespace IDBServer {
 
 class IDBBackingStore {
@@ -57,7 +59,7 @@ public:
     virtual IDBError keyExistsInObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData&, bool& keyExists) = 0;
     virtual IDBError deleteRecord(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData&) = 0;
     virtual IDBError putRecord(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData&, const ThreadSafeDataBuffer& value) = 0;
-    virtual IDBError getRecord(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData&, ThreadSafeDataBuffer& outValue) = 0;
+    virtual IDBError getRecord(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData&, ThreadSafeDataBuffer& outValue) = 0;
     virtual IDBError generateKeyNumber(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t& keyNumber) = 0;
 
 };
index 9ff2783..5882365 100644 (file)
@@ -202,7 +202,7 @@ void IDBServer::putOrAdd(const IDBRequestData& requestData, const IDBKeyData& ke
     transaction->putOrAdd(requestData, keyData, valueData, overwriteMode);
 }
 
-void IDBServer::getRecord(const IDBRequestData& requestData, const IDBKeyData& keyData)
+void IDBServer::getRecord(const IDBRequestData& requestData, const IDBKeyRangeData& keyRangeData)
 {
     LOG(IndexedDB, "IDBServer::getRecord");
 
@@ -210,7 +210,7 @@ void IDBServer::getRecord(const IDBRequestData& requestData, const IDBKeyData& k
     if (!transaction)
         return;
 
-    transaction->getRecord(requestData, keyData);
+    transaction->getRecord(requestData, keyRangeData);
 }
 
 void IDBServer::establishTransaction(uint64_t databaseConnectionIdentifier, const IDBTransactionInfo& info)
index da00c38..61b692c 100644 (file)
@@ -63,7 +63,7 @@ public:
     void deleteObjectStore(const IDBRequestData&, const String& objectStoreName);
     void clearObjectStore(const IDBRequestData&, uint64_t objectStoreIdentifier);
     void putOrAdd(const IDBRequestData&, const IDBKeyData&, const ThreadSafeDataBuffer& valueData, IndexedDB::ObjectStoreOverwriteMode);
-    void getRecord(const IDBRequestData&, const IDBKeyData&);
+    void getRecord(const IDBRequestData&, const IDBKeyRangeData&);
     void establishTransaction(uint64_t databaseConnectionIdentifier, const IDBTransactionInfo&);
     void databaseConnectionClosed(uint64_t databaseConnectionIdentifier);
 
index f87e374..9ba86e5 100644 (file)
@@ -28,6 +28,7 @@
 
 #if ENABLE(INDEXED_DATABASE)
 
+#include "IDBKeyRangeData.h"
 #include "IndexedDB.h"
 #include "Logging.h"
 #include "MemoryIDBBackingStore.h"
@@ -133,7 +134,7 @@ void MemoryBackingStoreTransaction::recordValueChanged(MemoryObjectStore& object
     if (!addResult.isNewEntry)
         return;
 
-    addResult.iterator->value = objectStore.valueForKey(key);
+    addResult.iterator->value = objectStore.valueForKeyRange(IDBKeyRangeData(key));
 }
 
 void MemoryBackingStoreTransaction::abort()
index c846357..20606c9 100644 (file)
@@ -242,7 +242,7 @@ IDBError MemoryIDBBackingStore::putRecord(const IDBResourceIdentifier& transacti
     return IDBError();
 }
 
-IDBError MemoryIDBBackingStore::getRecord(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData& keyData, ThreadSafeDataBuffer& outValue)
+IDBError MemoryIDBBackingStore::getRecord(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData& keyRangeData, ThreadSafeDataBuffer& outValue)
 {
     LOG(IndexedDB, "MemoryIDBBackingStore::getRecord");
 
@@ -255,7 +255,7 @@ IDBError MemoryIDBBackingStore::getRecord(const IDBResourceIdentifier& transacti
     if (!objectStore)
         return IDBError(IDBExceptionCode::Unknown, WTF::ASCIILiteral("No backing store object store found"));
 
-    outValue = objectStore->valueForKey(keyData);
+    outValue = objectStore->valueForKeyRange(keyRangeData);
     return IDBError();
 }
 
index 77bbe39..2451ad9 100644 (file)
@@ -58,7 +58,7 @@ public:
     virtual IDBError keyExistsInObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData&, bool& keyExists) override final;
     virtual IDBError deleteRecord(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData&) override final;
     virtual IDBError putRecord(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData&, const ThreadSafeDataBuffer& value) override final;
-    virtual IDBError getRecord(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData&, ThreadSafeDataBuffer& outValue) override final;
+    virtual IDBError getRecord(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData&, ThreadSafeDataBuffer& outValue) override final;
     virtual IDBError generateKeyNumber(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t& keyNumber) override final;
 
     void removeObjectStoreForVersionChangeAbort(MemoryObjectStore&);
index 2409ab3..e30a057 100644 (file)
@@ -28,6 +28,7 @@
 
 #if ENABLE(INDEXED_DATABASE)
 
+#include "IDBKeyRangeData.h"
 #include "Logging.h"
 #include "MemoryBackingStoreTransaction.h"
 
@@ -99,9 +100,10 @@ void MemoryObjectStore::deleteRecord(const IDBKeyData& key)
     if (!m_keyValueStore)
         return;
 
+    ASSERT(m_orderedKeys);
+
     m_keyValueStore->remove(key);
-    if (m_orderedKeys)
-        m_orderedKeys->erase(key);
+    m_orderedKeys->erase(key);
 }
 
 void MemoryObjectStore::putRecord(MemoryBackingStoreTransaction& transaction, const IDBKeyData& keyData, const ThreadSafeDataBuffer& value)
@@ -118,22 +120,48 @@ void MemoryObjectStore::putRecord(MemoryBackingStoreTransaction& transaction, co
 
 void MemoryObjectStore::setKeyValue(const IDBKeyData& keyData, const ThreadSafeDataBuffer& value)
 {
-    if (!m_keyValueStore)
+    if (!m_keyValueStore) {
+        ASSERT(!m_orderedKeys);
         m_keyValueStore = std::make_unique<KeyValueMap>();
+        m_orderedKeys = std::make_unique<std::set<IDBKeyData>>();
+    }
 
     auto result = m_keyValueStore->set(keyData, value);
-    if (result.isNewEntry && m_orderedKeys)
+    if (result.isNewEntry)
         m_orderedKeys->insert(keyData);
 }
 
-ThreadSafeDataBuffer MemoryObjectStore::valueForKey(const IDBKeyData& keyData) const
+ThreadSafeDataBuffer MemoryObjectStore::valueForKeyRange(const IDBKeyRangeData& keyRangeData) const
 {
     LOG(IndexedDB, "MemoryObjectStore::valueForKey");
 
     if (!m_keyValueStore)
         return ThreadSafeDataBuffer();
 
-    return m_keyValueStore->get(keyData);
+    if (keyRangeData.isExactlyOneKey())
+        return m_keyValueStore->get(keyRangeData.lowerKey);
+
+    ASSERT(m_orderedKeys);
+
+    auto lowestInRange = m_orderedKeys->lower_bound(keyRangeData.lowerKey);
+
+    if (lowestInRange == m_orderedKeys->end())
+        return ThreadSafeDataBuffer();
+
+    if (keyRangeData.lowerOpen && *lowestInRange == keyRangeData.lowerKey)
+        ++lowestInRange;
+
+    if (lowestInRange == m_orderedKeys->end())
+        return ThreadSafeDataBuffer();
+
+    if (!keyRangeData.upperKey.isNull()) {
+        if (lowestInRange->compare(keyRangeData.upperKey) > 0)
+            return ThreadSafeDataBuffer();
+        if (keyRangeData.upperOpen && *lowestInRange == keyRangeData.upperKey)
+            return ThreadSafeDataBuffer();
+    }
+
+    return m_keyValueStore->get(*lowestInRange);
 }
 
 } // namespace IDBServer
index d047a79..56646a5 100644 (file)
@@ -38,6 +38,8 @@ namespace WebCore {
 
 class IDBKeyData;
 
+struct IDBKeyRangeData;
+
 namespace IDBServer {
 
 class MemoryBackingStoreTransaction;
@@ -66,7 +68,7 @@ public:
     void clear();
     void replaceKeyValueStore(std::unique_ptr<KeyValueMap>&&);
 
-    ThreadSafeDataBuffer valueForKey(const IDBKeyData&) const;
+    ThreadSafeDataBuffer valueForKeyRange(const IDBKeyRangeData&) const;
 
     const IDBObjectStoreInfo& info() const { return m_info; }
 
index 30b3fa3..0cb5918 100644 (file)
@@ -28,6 +28,7 @@
 
 #if ENABLE(INDEXED_DATABASE)
 
+#include "IDBKeyRangeData.h"
 #include "IDBResultData.h"
 #include "IDBServer.h"
 #include "IDBTransactionInfo.h"
@@ -399,16 +400,16 @@ void UniqueIDBDatabase::didPerformPutOrAdd(uint64_t callbackIdentifier, const ID
     performKeyDataCallback(callbackIdentifier, error, resultKey);
 }
 
-void UniqueIDBDatabase::getRecord(const IDBRequestData& requestData, const IDBKeyData& keyData, ValueDataCallback callback)
+void UniqueIDBDatabase::getRecord(const IDBRequestData& requestData, const IDBKeyRangeData& keyRangeData, ValueDataCallback callback)
 {
     ASSERT(isMainThread());
     LOG(IndexedDB, "(main) UniqueIDBDatabase::getRecord");
 
     uint64_t callbackID = storeCallback(callback);
-    m_server.postDatabaseTask(createCrossThreadTask(*this, &UniqueIDBDatabase::performGetRecord, callbackID, requestData.transactionIdentifier(), requestData.objectStoreIdentifier(), keyData));
+    m_server.postDatabaseTask(createCrossThreadTask(*this, &UniqueIDBDatabase::performGetRecord, callbackID, requestData.transactionIdentifier(), requestData.objectStoreIdentifier(), keyRangeData));
 }
 
-void UniqueIDBDatabase::performGetRecord(uint64_t callbackIdentifier, const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData& keyData)
+void UniqueIDBDatabase::performGetRecord(uint64_t callbackIdentifier, const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData& keyRangeData)
 {
     ASSERT(!isMainThread());
     LOG(IndexedDB, "(db) UniqueIDBDatabase::performGetRecord");
@@ -417,7 +418,7 @@ void UniqueIDBDatabase::performGetRecord(uint64_t callbackIdentifier, const IDBR
     ASSERT(objectStoreIdentifier);
 
     ThreadSafeDataBuffer valueData;
-    IDBError error = m_backingStore->getRecord(transactionIdentifier, objectStoreIdentifier, keyData, valueData);
+    IDBError error = m_backingStore->getRecord(transactionIdentifier, objectStoreIdentifier, keyRangeData, valueData);
 
     m_server.postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didPerformGetRecord, callbackIdentifier, error, valueData));
 }
index 2cb63ff..b5cfdc9 100644 (file)
@@ -73,7 +73,7 @@ public:
     void deleteObjectStore(UniqueIDBDatabaseTransaction&, const String& objectStoreName, ErrorCallback);
     void clearObjectStore(UniqueIDBDatabaseTransaction&, uint64_t objectStoreIdentifier, ErrorCallback);
     void putOrAdd(const IDBRequestData&, const IDBKeyData&, const ThreadSafeDataBuffer& valueData, IndexedDB::ObjectStoreOverwriteMode, KeyDataCallback);
-    void getRecord(const IDBRequestData&, const IDBKeyData&, ValueDataCallback);
+    void getRecord(const IDBRequestData&, const IDBKeyRangeData&, ValueDataCallback);
     void commitTransaction(UniqueIDBDatabaseTransaction&, ErrorCallback);
     void abortTransaction(UniqueIDBDatabaseTransaction&, ErrorCallback);
     void transactionDestroyed(UniqueIDBDatabaseTransaction&);
@@ -103,7 +103,7 @@ private:
     void performDeleteObjectStore(uint64_t callbackIdentifier, const IDBResourceIdentifier& transactionIdentifier, const String& objectStoreName);
     void performClearObjectStore(uint64_t callbackIdentifier, const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier);
     void performPutOrAdd(uint64_t callbackIdentifier, const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData&, const ThreadSafeDataBuffer& valueData, IndexedDB::ObjectStoreOverwriteMode);
-    void performGetRecord(uint64_t callbackIdentifier, const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData&);
+    void performGetRecord(uint64_t callbackIdentifier, const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData&);
     void performActivateTransactionInBackingStore(uint64_t callbackIdentifier, const IDBTransactionInfo&);
 
     // Main thread callbacks
index ea6b64a..d60141f 100644 (file)
@@ -164,14 +164,14 @@ void UniqueIDBDatabaseTransaction::putOrAdd(const IDBRequestData& requestData, c
     });
 }
 
-void UniqueIDBDatabaseTransaction::getRecord(const IDBRequestData& requestData, const IDBKeyData& keyData)
+void UniqueIDBDatabaseTransaction::getRecord(const IDBRequestData& requestData, const IDBKeyRangeData& keyRangeData)
 {
     LOG(IndexedDB, "UniqueIDBDatabaseTransaction::getRecord");
 
     ASSERT(m_transactionInfo.identifier() == requestData.transactionIdentifier());
 
     RefPtr<UniqueIDBDatabaseTransaction> self(this);
-    m_databaseConnection->database().getRecord(requestData, keyData, [this, self, requestData](const IDBError& error, const ThreadSafeDataBuffer& valueData) {
+    m_databaseConnection->database().getRecord(requestData, keyRangeData, [this, self, requestData](const IDBError& error, const ThreadSafeDataBuffer& valueData) {
         LOG(IndexedDB, "UniqueIDBDatabaseTransaction::getRecord (callback)");
 
         if (error.isNull())
index 9c66876..c3ed3f7 100644 (file)
@@ -42,6 +42,8 @@ class IDBObjectStoreInfo;
 class IDBRequestData;
 class ThreadSafeDataBuffer;
 
+struct IDBKeyRangeData;
+
 namespace IDBServer {
 
 class UniqueIDBDatabaseConnection;
@@ -66,7 +68,7 @@ public:
     void deleteObjectStore(const IDBRequestData&, const String& objectStoreName);
     void clearObjectStore(const IDBRequestData&, uint64_t objectStoreIdentifier);
     void putOrAdd(const IDBRequestData&, const IDBKeyData&, const ThreadSafeDataBuffer& valueData, IndexedDB::ObjectStoreOverwriteMode);
-    void getRecord(const IDBRequestData&, const IDBKeyData&);
+    void getRecord(const IDBRequestData&, const IDBKeyRangeData&);
 
     void didActivateInBackingStore(const IDBError&);
 
index afadb2a..80d721b 100644 (file)
@@ -30,7 +30,7 @@
 
 #include "IDBConnectionToClient.h"
 #include "IDBConnectionToServer.h"
-#include "IDBKeyData.h"
+#include "IDBKeyRangeData.h"
 #include "IDBOpenDBRequestImpl.h"
 #include "IDBRequestData.h"
 #include "IDBResultData.h"
@@ -210,13 +210,12 @@ void InProcessIDBServer::putOrAdd(const IDBRequestData& requestData, IDBKey* key
     });
 }
 
-void InProcessIDBServer::getRecord(const IDBRequestData& requestData, IDBKey* key)
+void InProcessIDBServer::getRecord(const IDBRequestData& requestData, const IDBKeyRangeData& keyRangeData)
 {
     RefPtr<InProcessIDBServer> self(this);
-    IDBKeyData keyData(key);
 
-    RunLoop::current().dispatch([this, self, requestData, keyData] {
-        m_server->getRecord(requestData, keyData);
+    RunLoop::current().dispatch([this, self, requestData, keyRangeData] {
+        m_server->getRecord(requestData, keyRangeData);
     });
 }
 
index db5637e..408bf16 100644 (file)
@@ -62,7 +62,7 @@ public:
     virtual void deleteObjectStore(const IDBRequestData&, const String& objectStoreName) override final;
     virtual void clearObjectStore(const IDBRequestData&, uint64_t objectStoreIdentifier) override final;
     virtual void putOrAdd(const IDBRequestData&, IDBKey*, SerializedScriptValue&, const IndexedDB::ObjectStoreOverwriteMode) override final;
-    virtual void getRecord(const IDBRequestData&, IDBKey*) override final;
+    virtual void getRecord(const IDBRequestData&, const IDBKeyRangeData&) override final;
     virtual void establishTransaction(uint64_t databaseConnectionIdentifier, const IDBTransactionInfo&) override final;
     virtual void databaseConnectionClosed(uint64_t databaseConnectionIdentifier) override final;