[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
jorlow at chromium.org
jorlow at chromium.org
Wed Dec 22 16:35:13 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 9c02b65531a5587cf8d62225768a2213e11667cd
Author: jorlow at chromium.org <jorlow at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Nov 26 16:33:28 2010 +0000
2010-11-25 Jeremy Orlow <jorlow at chromium.org>
Reviewed by Steve Block.
Convert open*Cursor and createIndex over to using OptionsObject
https://bugs.webkit.org/show_bug.cgi?id=50093
* storage/indexeddb/index-cursor.html:
* storage/indexeddb/objectstore-basics-expected.txt:
* storage/indexeddb/objectstore-basics.html:
* storage/indexeddb/objectstore-cursor.html:
* storage/indexeddb/open-cursor-expected.txt:
* storage/indexeddb/open-cursor.html:
* storage/indexeddb/tutorial.html:
2010-11-25 Jeremy Orlow <jorlow at chromium.org>
Reviewed by Steve Block.
Convert open*Cursor and createIndex over to using OptionsObject
https://bugs.webkit.org/show_bug.cgi?id=50093
Add IDBKeyRange to OptionsObject's parsing abilities. Switch
more APIs over to using it.
* bindings/v8/OptionsObject.cpp:
(WebCore::OptionsObject::getKeyDOMStringList):
(WebCore::OptionsObject::getKeyKeyRange):
* bindings/v8/OptionsObject.h:
* storage/IDBIndex.cpp:
(WebCore::IDBIndex::openCursor):
(WebCore::IDBIndex::openKeyCursor):
* storage/IDBIndex.h:
(WebCore::IDBIndex::openCursor):
(WebCore::IDBIndex::openKeyCursor):
* storage/IDBIndex.idl:
* storage/IDBObjectStore.cpp:
(WebCore::IDBObjectStore::createIndex):
(WebCore::IDBObjectStore::openCursor):
* storage/IDBObjectStore.h:
(WebCore::IDBObjectStore::createIndex):
(WebCore::IDBObjectStore::openCursor):
* storage/IDBObjectStore.idl:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72766 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 4b471a7..5790491 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -2,6 +2,21 @@
Reviewed by Steve Block.
+ Convert open*Cursor and createIndex over to using OptionsObject
+ https://bugs.webkit.org/show_bug.cgi?id=50093
+
+ * storage/indexeddb/index-cursor.html:
+ * storage/indexeddb/objectstore-basics-expected.txt:
+ * storage/indexeddb/objectstore-basics.html:
+ * storage/indexeddb/objectstore-cursor.html:
+ * storage/indexeddb/open-cursor-expected.txt:
+ * storage/indexeddb/open-cursor.html:
+ * storage/indexeddb/tutorial.html:
+
+2010-11-25 Jeremy Orlow <jorlow at chromium.org>
+
+ Reviewed by Steve Block.
+
Clean up IDBDatabase.transaction and add checks to IDBTransaction.objectStore
https://bugs.webkit.org/show_bug.cgi?id=50081
diff --git a/LayoutTests/storage/indexeddb/index-cursor.html b/LayoutTests/storage/indexeddb/index-cursor.html
index c7b61db..6a81514 100644
--- a/LayoutTests/storage/indexeddb/index-cursor.html
+++ b/LayoutTests/storage/indexeddb/index-cursor.html
@@ -187,7 +187,7 @@ function runNextTest()
else
keyRange = webkitIDBKeyRange.rightBound(testData[upper], upperIsOpen);
- var request = indexObject.openKeyCursor(keyRange, ascending ? webkitIDBCursor.NEXT : webkitIDBCursor.PREV);
+ var request = indexObject.openKeyCursor({range: keyRange, direction: ascending ? webkitIDBCursor.NEXT : webkitIDBCursor.PREV});
request.onsuccess = cursorIteration;
request.onerror = unexpectedErrorCallback;
}
@@ -254,7 +254,7 @@ function testNullKeyRange()
debug("");
debug(str);
- var request = indexObject.openKeyCursor(null, ascending ? webkitIDBCursor.NEXT : webkitIDBCursor.PREV);
+ var request = indexObject.openKeyCursor({direction: ascending ? webkitIDBCursor.NEXT : webkitIDBCursor.PREV});
request.onsuccess = cursorIteration;
request.onerror = unexpectedErrorCallback;
}
diff --git a/LayoutTests/storage/indexeddb/objectstore-basics-expected.txt b/LayoutTests/storage/indexeddb/objectstore-basics-expected.txt
index a44e20e..30c5304 100644
--- a/LayoutTests/storage/indexeddb/objectstore-basics-expected.txt
+++ b/LayoutTests/storage/indexeddb/objectstore-basics-expected.txt
@@ -54,7 +54,7 @@ Ask for an index that doesn't exist:
index = store.index('asdf')
PASS Exception thrown.
createIndex():
-index = store.createIndex('indexName', 'x', true)
+index = store.createIndex('indexName', 'x', {unique: true})
PASS index !== null is true
PASS store.indexNames.contains('indexName') is true
index = store.index('indexName')
diff --git a/LayoutTests/storage/indexeddb/objectstore-basics.html b/LayoutTests/storage/indexeddb/objectstore-basics.html
index f262add..1d08613 100644
--- a/LayoutTests/storage/indexeddb/objectstore-basics.html
+++ b/LayoutTests/storage/indexeddb/objectstore-basics.html
@@ -73,7 +73,7 @@ function createObjectStore()
function createIndex()
{
debug("createIndex():");
- var index = evalAndLog("index = store.createIndex('indexName', 'x', true)"); // true == unique requirement.
+ var index = evalAndLog("index = store.createIndex('indexName', 'x', {unique: true})"); // true == unique requirement.
shouldBeTrue("index !== null");
shouldBeTrue("store.indexNames.contains('indexName')");
index = evalAndLog("index = store.index('indexName')");
diff --git a/LayoutTests/storage/indexeddb/objectstore-cursor.html b/LayoutTests/storage/indexeddb/objectstore-cursor.html
index 2497479..215ec91 100644
--- a/LayoutTests/storage/indexeddb/objectstore-cursor.html
+++ b/LayoutTests/storage/indexeddb/objectstore-cursor.html
@@ -165,7 +165,7 @@ function runNextTest()
else
keyRange = webkitIDBKeyRange.rightBound(testData[upper], upperIsOpen);
- var request = objectStore.openCursor(keyRange, ascending ? webkitIDBCursor.NEXT : webkitIDBCursor.PREV);
+ var request = objectStore.openCursor({range: keyRange, direction: ascending ? webkitIDBCursor.NEXT : webkitIDBCursor.PREV});
request.onsuccess = cursorIteration;
request.onerror = unexpectedErrorCallback;
}
@@ -231,7 +231,7 @@ function testNullKeyRange()
debug("");
debug(str);
- var request = objectStore.openCursor(null, ascending ? webkitIDBCursor.NEXT : webkitIDBCursor.PREV);
+ var request = objectStore.openCursor({direction: ascending ? webkitIDBCursor.NEXT : webkitIDBCursor.PREV});
request.onsuccess = cursorIteration;
request.onerror = unexpectedErrorCallback;
}
diff --git a/LayoutTests/storage/indexeddb/open-cursor-expected.txt b/LayoutTests/storage/indexeddb/open-cursor-expected.txt
index ddaa51a..d40436c 100644
--- a/LayoutTests/storage/indexeddb/open-cursor-expected.txt
+++ b/LayoutTests/storage/indexeddb/open-cursor-expected.txt
@@ -50,7 +50,7 @@ PASS 'readyState' in result is true
An event should fire shortly...
Opening cursor
-event.source.openCursor(keyRange)
+event.source.openCursor({range: keyRange})
PASS 'onsuccess' in result is true
PASS 'onerror' in result is true
PASS 'readyState' in result is true
@@ -76,7 +76,7 @@ Passing an invalid key into .continue().
PASS Caught exception: Error: TYPE_MISMATCH_ERR: DOM Exception 17
Opening an empty cursor.
-objectStore.openCursor(keyRange)
+objectStore.openCursor({range: keyRange})
PASS 'onsuccess' in result is true
PASS 'onerror' in result is true
PASS 'readyState' in result is true
diff --git a/LayoutTests/storage/indexeddb/open-cursor.html b/LayoutTests/storage/indexeddb/open-cursor.html
index 7e6af9a..c5dd7d8 100644
--- a/LayoutTests/storage/indexeddb/open-cursor.html
+++ b/LayoutTests/storage/indexeddb/open-cursor.html
@@ -26,7 +26,7 @@ function openEmptyCursor()
{
debug("Opening an empty cursor.");
keyRange = webkitIDBKeyRange.leftBound("InexistentKey");
- result = evalAndLog("objectStore.openCursor(keyRange)");
+ result = evalAndLog("objectStore.openCursor({range: keyRange})");
verifyResult(result);
result.onsuccess = emptyCursorSuccess;
result.onerror = unexpectedErrorCallback;
@@ -56,7 +56,7 @@ function openCursor()
{
debug("Opening cursor");
keyRange = webkitIDBKeyRange.leftBound("myKey");
- result = evalAndLog("event.source.openCursor(keyRange)");
+ result = evalAndLog("event.source.openCursor({range: keyRange})");
verifyResult(result);
result.onsuccess = cursorSuccess;
result.onerror = unexpectedErrorCallback;
diff --git a/LayoutTests/storage/indexeddb/tutorial.html b/LayoutTests/storage/indexeddb/tutorial.html
index 134f9de..c90a2bc 100644
--- a/LayoutTests/storage/indexeddb/tutorial.html
+++ b/LayoutTests/storage/indexeddb/tutorial.html
@@ -342,7 +342,7 @@ function onGetSuccess()
// return unique entires (only applies to indexes with unique set to false), PREV to move backwards,
// and PREV_NO_DUPLICATE.
var keyRange = IDBKeyRange.bound(1, 3, true, false);
- var request = people.openCursor(keyRange, IDBCursor.NEXT);
+ var request = people.openCursor({range: keyRange, direction: IDBCursor.NEXT});
request.onsuccess = onObjectStoreCursor;
request.onerror = unexpectedError;
}
@@ -395,10 +395,10 @@ function onIndexGetSuccess()
// different IDBKeyRanges just to demonstrate how to use them, but we won't bother to handle
// the onsuccess conditions.
var lname = event.source;
- lname.openCursor(IDBKeyRange.leftBound("Doe", false), IDBCursor.NEXT_NO_DUPLICATE);
- lname.openCursor(null, IDBCursor.PREV_NO_DUPLICATE);
- lname.openCursor(IDBKeyRange.rightBound("ZZZZ"));
- lname.openCursor(IDBKeyRange.only("Doe"), IDBCursor.PREV);
+ lname.openCursor({range: IDBKeyRange.leftBound("Doe", false), direction: IDBCursor.NEXT_NO_DUPLICATE});
+ lname.openCursor({direction: IDBCursor.PREV_NO_DUPLICATE});
+ lname.openCursor({range: IDBKeyRange.rightBound("ZZZZ")});
+ lname.openCursor({range: IDBKeyRange.only("Doe"), direction: IDBCursor.PREV});
lname.openCursor();
lname.openKeyCursor();
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 49c73d2..c6b690a 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -2,6 +2,35 @@
Reviewed by Steve Block.
+ Convert open*Cursor and createIndex over to using OptionsObject
+ https://bugs.webkit.org/show_bug.cgi?id=50093
+
+ Add IDBKeyRange to OptionsObject's parsing abilities. Switch
+ more APIs over to using it.
+
+ * bindings/v8/OptionsObject.cpp:
+ (WebCore::OptionsObject::getKeyDOMStringList):
+ (WebCore::OptionsObject::getKeyKeyRange):
+ * bindings/v8/OptionsObject.h:
+ * storage/IDBIndex.cpp:
+ (WebCore::IDBIndex::openCursor):
+ (WebCore::IDBIndex::openKeyCursor):
+ * storage/IDBIndex.h:
+ (WebCore::IDBIndex::openCursor):
+ (WebCore::IDBIndex::openKeyCursor):
+ * storage/IDBIndex.idl:
+ * storage/IDBObjectStore.cpp:
+ (WebCore::IDBObjectStore::createIndex):
+ (WebCore::IDBObjectStore::openCursor):
+ * storage/IDBObjectStore.h:
+ (WebCore::IDBObjectStore::createIndex):
+ (WebCore::IDBObjectStore::openCursor):
+ * storage/IDBObjectStore.idl:
+
+2010-11-25 Jeremy Orlow <jorlow at chromium.org>
+
+ Reviewed by Steve Block.
+
Clean up IDBDatabase.transaction and add checks to IDBTransaction.objectStore
https://bugs.webkit.org/show_bug.cgi?id=50081
diff --git a/WebCore/bindings/v8/OptionsObject.cpp b/WebCore/bindings/v8/OptionsObject.cpp
index ab247eb..ce9189a 100644
--- a/WebCore/bindings/v8/OptionsObject.cpp
+++ b/WebCore/bindings/v8/OptionsObject.cpp
@@ -30,6 +30,11 @@
#include "V8Binding.h"
#include <limits>
+#if ENABLE(INDEXED_DATABASE)
+#include "IDBKeyRange.h"
+#include "V8IDBKeyRange.h"
+#endif
+
namespace WebCore {
OptionsObject::OptionsObject()
@@ -116,6 +121,22 @@ PassRefPtr<DOMStringList> OptionsObject::getKeyDOMStringList(const String& key)
return ret.release();
}
+#if ENABLE(INDEXED_DATABASE)
+
+PassRefPtr<IDBKeyRange> OptionsObject::getKeyKeyRange(const String& key) const
+{
+ v8::Local<v8::Value> v8Value;
+ if (!getKey(key, v8Value))
+ return 0;
+
+ if (!V8IDBKeyRange::HasInstance(v8Value))
+ return 0;
+
+ return V8IDBKeyRange::toNative(v8::Handle<v8::Object>::Cast(v8Value));
+}
+
+#endif
+
bool OptionsObject::getKey(const String& key, v8::Local<v8::Value>& value) const
{
if (isUndefinedOrNull())
diff --git a/WebCore/bindings/v8/OptionsObject.h b/WebCore/bindings/v8/OptionsObject.h
index 6b51f05..b006927 100644
--- a/WebCore/bindings/v8/OptionsObject.h
+++ b/WebCore/bindings/v8/OptionsObject.h
@@ -32,6 +32,7 @@
namespace WebCore {
class DOMStringList;
+class IDBKeyRange;
class OptionsObject {
public:
@@ -46,6 +47,7 @@ public:
bool getKeyInt32(const String& key, int32_t& value) const;
bool getKeyString(const String& key, String& value) const;
PassRefPtr<DOMStringList> getKeyDOMStringList(const String& key) const;
+ PassRefPtr<IDBKeyRange> getKeyKeyRange(const String& key) const;
private:
bool getKey(const String& key, v8::Local<v8::Value>&) const;
diff --git a/WebCore/storage/IDBIndex.cpp b/WebCore/storage/IDBIndex.cpp
index a008470..aecba16 100644
--- a/WebCore/storage/IDBIndex.cpp
+++ b/WebCore/storage/IDBIndex.cpp
@@ -29,6 +29,7 @@
#if ENABLE(INDEXED_DATABASE)
#include "IDBCursorBackendInterface.h"
+#include "IDBDatabaseException.h"
#include "IDBIndexBackendInterface.h"
#include "IDBKey.h"
#include "IDBKeyRange.h"
@@ -37,6 +38,8 @@
namespace WebCore {
+static const unsigned short defaultDirection = IDBCursor::NEXT;
+
IDBIndex::IDBIndex(PassRefPtr<IDBIndexBackendInterface> backend, IDBTransactionBackendInterface* transaction)
: m_backend(backend)
, m_transaction(transaction)
@@ -49,8 +52,19 @@ IDBIndex::~IDBIndex()
{
}
-PassRefPtr<IDBRequest> IDBIndex::openCursor(ScriptExecutionContext* context, PassRefPtr<IDBKeyRange> keyRange, unsigned short direction, ExceptionCode& ec)
+PassRefPtr<IDBRequest> IDBIndex::openCursor(ScriptExecutionContext* context, const OptionsObject& options, ExceptionCode& ec)
{
+ RefPtr<IDBKeyRange> keyRange = options.getKeyKeyRange("range");
+
+ // Converted to an unsigned short.
+ int64_t direction = defaultDirection;
+ options.getKeyInteger("direction", direction);
+ if (direction != IDBCursor::NEXT && direction != IDBCursor::NEXT_NO_DUPLICATE && direction != IDBCursor::PREV && direction != IDBCursor::PREV_NO_DUPLICATE) {
+ // FIXME: May need to change when specced: http://www.w3.org/Bugs/Public/show_bug.cgi?id=11406
+ ec = IDBDatabaseException::CONSTRAINT_ERR;
+ return 0;
+ }
+
RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), m_transaction.get());
m_backend->openCursor(keyRange, direction, request, m_transaction.get(), ec);
if (ec)
@@ -58,8 +72,19 @@ PassRefPtr<IDBRequest> IDBIndex::openCursor(ScriptExecutionContext* context, Pas
return request;
}
-PassRefPtr<IDBRequest> IDBIndex::openKeyCursor(ScriptExecutionContext* context, PassRefPtr<IDBKeyRange> keyRange, unsigned short direction, ExceptionCode& ec)
+PassRefPtr<IDBRequest> IDBIndex::openKeyCursor(ScriptExecutionContext* context, const OptionsObject& options, ExceptionCode& ec)
{
+ RefPtr<IDBKeyRange> keyRange = options.getKeyKeyRange("range");
+
+ // Converted to an unsigned short.
+ int64_t direction = defaultDirection;
+ options.getKeyInteger("direction", direction);
+ if (direction != IDBCursor::NEXT && direction != IDBCursor::NEXT_NO_DUPLICATE && direction != IDBCursor::PREV && direction != IDBCursor::PREV_NO_DUPLICATE) {
+ // FIXME: May need to change when specced: http://www.w3.org/Bugs/Public/show_bug.cgi?id=11406
+ ec = IDBDatabaseException::CONSTRAINT_ERR;
+ return 0;
+ }
+
RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), m_transaction.get());
m_backend->openKeyCursor(keyRange, direction, request, m_transaction.get(), ec);
if (ec)
diff --git a/WebCore/storage/IDBIndex.h b/WebCore/storage/IDBIndex.h
index 4a1a666..7f1aae3 100644
--- a/WebCore/storage/IDBIndex.h
+++ b/WebCore/storage/IDBIndex.h
@@ -30,6 +30,7 @@
#include "IDBIndexBackendInterface.h"
#include "IDBKeyRange.h"
#include "IDBRequest.h"
+#include "OptionsObject.h"
#include "PlatformString.h"
#include <wtf/Forward.h>
@@ -52,13 +53,11 @@ public:
bool unique() const { return m_backend->unique(); }
// FIXME: Try to modify the code generator so this is unneeded.
- PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext* context, ExceptionCode& ec) { return openCursor(context, 0, ec); }
- PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext* context, PassRefPtr<IDBKeyRange> keyRange, ExceptionCode& ec) { return openCursor(context, keyRange, IDBCursor::NEXT, ec); }
- PassRefPtr<IDBRequest> openKeyCursor(ScriptExecutionContext* context, ExceptionCode& ec) { return openKeyCursor(context, 0, ec); }
- PassRefPtr<IDBRequest> openKeyCursor(ScriptExecutionContext* context, PassRefPtr<IDBKeyRange> keyRange, ExceptionCode& ec) { return openKeyCursor(context, keyRange, IDBCursor::NEXT, ec); }
+ PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext* context, ExceptionCode& ec) { return openCursor(context, OptionsObject(), ec); }
+ PassRefPtr<IDBRequest> openKeyCursor(ScriptExecutionContext* context, ExceptionCode& ec) { return openKeyCursor(context, OptionsObject(), ec); }
- PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext*, PassRefPtr<IDBKeyRange>, unsigned short direction, ExceptionCode&);
- PassRefPtr<IDBRequest> openKeyCursor(ScriptExecutionContext*, PassRefPtr<IDBKeyRange>, unsigned short direction, ExceptionCode&);
+ PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext*, const OptionsObject&, ExceptionCode&);
+ PassRefPtr<IDBRequest> openKeyCursor(ScriptExecutionContext*, const OptionsObject&, ExceptionCode&);
PassRefPtr<IDBRequest> get(ScriptExecutionContext*, PassRefPtr<IDBKey>, ExceptionCode&);
PassRefPtr<IDBRequest> getKey(ScriptExecutionContext*, PassRefPtr<IDBKey>, ExceptionCode&);
diff --git a/WebCore/storage/IDBIndex.idl b/WebCore/storage/IDBIndex.idl
index 7c2c962..e6ba1e6 100644
--- a/WebCore/storage/IDBIndex.idl
+++ b/WebCore/storage/IDBIndex.idl
@@ -33,9 +33,9 @@ module storage {
readonly attribute DOMString keyPath;
readonly attribute boolean unique;
- [CallWith=ScriptExecutionContext] IDBRequest openCursor(in [Optional] IDBKeyRange range, in [Optional] unsigned short direction)
+ [CallWith=ScriptExecutionContext] IDBRequest openCursor(in [Optional] OptionsObject options)
raises (IDBDatabaseException);
- [CallWith=ScriptExecutionContext] IDBRequest openKeyCursor(in [Optional] IDBKeyRange range, in [Optional] unsigned short direction)
+ [CallWith=ScriptExecutionContext] IDBRequest openKeyCursor(in [Optional] OptionsObject options)
raises (IDBDatabaseException);
[CallWith=ScriptExecutionContext] IDBRequest get(in IDBKey key)
raises (IDBDatabaseException);
diff --git a/WebCore/storage/IDBObjectStore.cpp b/WebCore/storage/IDBObjectStore.cpp
index c30243e..e3d673e 100644
--- a/WebCore/storage/IDBObjectStore.cpp
+++ b/WebCore/storage/IDBObjectStore.cpp
@@ -26,8 +26,11 @@
#include "config.h"
#include "IDBObjectStore.h"
+#if ENABLE(INDEXED_DATABASE)
+
#include "DOMStringList.h"
#include "IDBAny.h"
+#include "IDBDatabaseException.h"
#include "IDBIndex.h"
#include "IDBKey.h"
#include "IDBKeyRange.h"
@@ -35,10 +38,10 @@
#include "SerializedScriptValue.h"
#include <wtf/UnusedParam.h>
-#if ENABLE(INDEXED_DATABASE)
-
namespace WebCore {
+static const unsigned short defaultDirection = IDBCursor::NEXT;
+
IDBObjectStore::IDBObjectStore(PassRefPtr<IDBObjectStoreBackendInterface> idbObjectStore, IDBTransactionBackendInterface* transaction)
: m_objectStore(idbObjectStore)
, m_transaction(transaction)
@@ -100,8 +103,11 @@ PassRefPtr<IDBRequest> IDBObjectStore::remove(ScriptExecutionContext* context, P
return request;
}
-PassRefPtr<IDBIndex> IDBObjectStore::createIndex(const String& name, const String& keyPath, bool unique, ExceptionCode& ec)
+PassRefPtr<IDBIndex> IDBObjectStore::createIndex(const String& name, const String& keyPath, const OptionsObject& options, ExceptionCode& ec)
{
+ bool unique = false;
+ options.getKeyBool("unique", unique);
+
RefPtr<IDBIndexBackendInterface> index = m_objectStore->createIndex(name, keyPath, unique, m_transaction.get(), ec);
ASSERT(!index != !ec); // If we didn't get an index, we should have gotten an exception code. And vice versa.
if (!index)
@@ -123,8 +129,19 @@ void IDBObjectStore::removeIndex(const String& name, ExceptionCode& ec)
m_objectStore->removeIndex(name, m_transaction.get(), ec);
}
-PassRefPtr<IDBRequest> IDBObjectStore::openCursor(ScriptExecutionContext* context, PassRefPtr<IDBKeyRange> range, unsigned short direction, ExceptionCode& ec)
+PassRefPtr<IDBRequest> IDBObjectStore::openCursor(ScriptExecutionContext* context, const OptionsObject& options, ExceptionCode& ec)
{
+ RefPtr<IDBKeyRange> range = options.getKeyKeyRange("range");
+
+ // Converted to an unsigned short.
+ int64_t direction = defaultDirection;
+ options.getKeyInteger("direction", direction);
+ if (direction != IDBCursor::NEXT && direction != IDBCursor::NEXT_NO_DUPLICATE && direction != IDBCursor::PREV && direction != IDBCursor::PREV_NO_DUPLICATE) {
+ // FIXME: May need to change when specced: http://www.w3.org/Bugs/Public/show_bug.cgi?id=11406
+ ec = IDBDatabaseException::CONSTRAINT_ERR;
+ return 0;
+ }
+
RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), m_transaction.get());
m_objectStore->openCursor(range, direction, request, m_transaction.get(), ec);
if (ec)
diff --git a/WebCore/storage/IDBObjectStore.h b/WebCore/storage/IDBObjectStore.h
index dc92233..567601a 100644
--- a/WebCore/storage/IDBObjectStore.h
+++ b/WebCore/storage/IDBObjectStore.h
@@ -32,6 +32,7 @@
#include "IDBKeyRange.h"
#include "IDBObjectStoreBackendInterface.h"
#include "IDBRequest.h"
+#include "OptionsObject.h"
#include "PlatformString.h"
#include "SerializedScriptValue.h"
#include <wtf/PassRefPtr.h>
@@ -61,20 +62,19 @@ public:
// FIXME: Try to modify the code generator so this is unneeded.
PassRefPtr<IDBRequest> add(ScriptExecutionContext* context, PassRefPtr<SerializedScriptValue> value, ExceptionCode& ec) { return add(context, value, 0, ec); }
PassRefPtr<IDBRequest> put(ScriptExecutionContext* context, PassRefPtr<SerializedScriptValue> value, ExceptionCode& ec) { return put(context, value, 0, ec); }
- PassRefPtr<IDBIndex> createIndex(const String& name, const String& keyPath, ExceptionCode& ec) { return createIndex(name, keyPath, false, ec); }
- PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext* context, ExceptionCode& ec) { return openCursor(context, 0, ec); }
- PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext* context, PassRefPtr<IDBKeyRange> keyRange, ExceptionCode& ec) { return openCursor(context, keyRange, IDBCursor::NEXT, ec); }
+ PassRefPtr<IDBIndex> createIndex(const String& name, const String& keyPath, ExceptionCode& ec) { return createIndex(name, keyPath, OptionsObject(), ec); }
+ PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext* context, ExceptionCode& ec) { return openCursor(context, OptionsObject(), ec); }
PassRefPtr<IDBRequest> get(ScriptExecutionContext*, PassRefPtr<IDBKey>, ExceptionCode&);
PassRefPtr<IDBRequest> add(ScriptExecutionContext*, PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBKey>, ExceptionCode&);
PassRefPtr<IDBRequest> put(ScriptExecutionContext*, PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBKey>, ExceptionCode&);
PassRefPtr<IDBRequest> remove(ScriptExecutionContext*, PassRefPtr<IDBKey> key, ExceptionCode&);
- PassRefPtr<IDBIndex> createIndex(const String& name, const String& keyPath, bool unique, ExceptionCode&);
+ PassRefPtr<IDBIndex> createIndex(const String& name, const String& keyPath, const OptionsObject&, ExceptionCode&);
PassRefPtr<IDBIndex> index(const String& name, ExceptionCode&);
void removeIndex(const String& name, ExceptionCode&);
- PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext*, PassRefPtr<IDBKeyRange>, unsigned short direction, ExceptionCode&);
+ PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext*, const OptionsObject&, ExceptionCode&);
private:
IDBObjectStore(PassRefPtr<IDBObjectStoreBackendInterface>, IDBTransactionBackendInterface* transaction);
diff --git a/WebCore/storage/IDBObjectStore.idl b/WebCore/storage/IDBObjectStore.idl
index 31eb865..b3115e9 100644
--- a/WebCore/storage/IDBObjectStore.idl
+++ b/WebCore/storage/IDBObjectStore.idl
@@ -40,9 +40,9 @@ module storage {
raises (IDBDatabaseException);
[CallWith=ScriptExecutionContext] IDBRequest get(in IDBKey key)
raises (IDBDatabaseException);
- [CallWith=ScriptExecutionContext] IDBRequest openCursor(in [Optional] IDBKeyRange range, in [Optional] unsigned short direction)
+ [CallWith=ScriptExecutionContext] IDBRequest openCursor(in [Optional] OptionsObject options)
raises (IDBDatabaseException);
- IDBIndex createIndex(in DOMString name, in [ConvertNullToNullString] DOMString keyPath, in [Optional] boolean unique)
+ IDBIndex createIndex(in DOMString name, in [ConvertNullToNullString] DOMString keyPath, in [Optional] OptionsObject options)
raises (IDBDatabaseException);
IDBIndex index(in DOMString name)
raises (IDBDatabaseException);
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list