Title: [210148] trunk
Revision
210148
Author
wei...@apple.com
Date
2016-12-25 17:33:33 -0800 (Sun, 25 Dec 2016)

Log Message

[WebIDL] Remove (most) custom bindings for the IndexedDB code
https://bugs.webkit.org/show_bug.cgi?id=166451

Reviewed by Darin Adler.

Source/WebCore:

Removes the custom bindings for all but one attribute (IDBRequest.result) in
the IndexedDB code.
- Adds a new WebIDL extension type, IDBKey, to represent the complex key conversion
  rules IndexedDB specifies.
- Replaces custom bindings for IDBCursor.source with use of a union.
- Replaces custom enum type checking for IDBCursor.direction with a WebIDL enum.
- Replaces custom code generation for IDBKeyPaths with a union.

* CMakeLists.txt:
* DerivedSources.make:
* WebCore.xcodeproj/project.pbxproj:
Add new files.

* Modules/indexeddb/IDBCursor.cpp:
(WebCore::IDBCursor::source):
(WebCore::IDBCursor::direction):
(WebCore::IDBCursor::directionNext): Deleted.
(WebCore::IDBCursor::directionNextUnique): Deleted.
(WebCore::IDBCursor::directionPrev): Deleted.
(WebCore::IDBCursor::directionPrevUnique): Deleted.
(WebCore::IDBCursor::stringToDirection): Deleted.
(WebCore::IDBCursor::directionToString): Deleted.
* Modules/indexeddb/IDBCursor.h:
(WebCore::IDBCursor::objectStore): Deleted.
(WebCore::IDBCursor::index): Deleted.
Replace custom enum checking with direct use of the enum, letting the generator
handle the checks. Also adds source function which returns a Variant.

* Modules/indexeddb/IDBCursor.idl:
Remove custom annotation and use correct types.

* Modules/indexeddb/IDBCursorDirection.h: Added.
* Modules/indexeddb/IDBCursorDirection.idl: Added.

* Modules/indexeddb/IDBIndex.cpp:
(WebCore::IDBIndex::openCursor):
(WebCore::IDBIndex::openKeyCursor):
* Modules/indexeddb/IDBIndex.h:
* Modules/indexeddb/IDBIndex.idl:
* Modules/indexeddb/IDBObjectStore.cpp:
(WebCore::IDBObjectStore::openCursor):
(WebCore::IDBObjectStore::openKeyCursor):
* Modules/indexeddb/IDBObjectStore.h:
* Modules/indexeddb/IDBObjectStore.idl:
Replace Strings with IDBCursorDirection enums.

* Modules/indexeddb/IDBKeyRange.idl:
Remove annotation and use new IDBKey extension type.

* Modules/indexeddb/IDBOpenDBRequest.cpp:
(WebCore::IDBOpenDBRequest::onSuccess):
(WebCore::IDBOpenDBRequest::onUpgradeNeeded):
(WebCore::IDBOpenDBRequest::onDeleteDatabaseSuccess):
Use ReadyState enum in place of the old m_isDone boolean.

* Modules/indexeddb/IDBRequest.cpp:
(WebCore::IDBRequest::IDBRequest):
(WebCore::IDBRequest::error):
(WebCore::IDBRequest::source):
(WebCore::IDBRequest::dispatchEvent):
(WebCore::IDBRequest::willIterateCursor):
(WebCore::IDBRequest::completeRequestAndDispatchEvent):
(WebCore::IDBRequest::readyState): Deleted.
* Modules/indexeddb/IDBRequest.h:
(WebCore::IDBRequest::readyState):
(WebCore::IDBRequest::isDone):
(WebCore::IDBRequest::objectStoreSource): Deleted.
(WebCore::IDBRequest::indexSource): Deleted.
(WebCore::IDBRequest::cursorSource): Deleted.
* Modules/indexeddb/IDBRequest.idl:
Replace the readyState String with a enum, and the custom source binding with a
source function that returns a Variant.

* Modules/indexeddb/IndexedDB.h:
Add the missing values to CursorDirection to make it comply with the IDL definition.

* bindings/generic/IDLTypes.h:
* bindings/js/JSDOMConvert.h:
(WebCore::JSConverter<IDLIDBKey<T>>::convert):
Add new extension type IDLIDBKey.

* bindings/js/JSIDBCursorCustom.cpp:
(WebCore::JSIDBCursor::source): Deleted.
* bindings/js/JSIDBRequestCustom.cpp:
(WebCore::JSIDBRequest::source): Deleted.
Remove custom bindings.

* bindings/scripts/CodeGenerator.pm:
(IsBuiltinType):
* bindings/scripts/CodeGeneratorJS.pm:
(GetBaseIDLType):
(NativeToJSValueDOMConvertNeedsState):
(NativeToJSValueDOMConvertNeedsGlobalObject):
(NativeToJSValue):
Add support for IDBKey, and remove custom code for IndexedDB in core conversion logic.

* bindings/scripts/IDLAttributes.txt:
Remove now unused ImplementationReturnType attribute.

* inspector/InspectorIndexedDBAgent.cpp:
Update to work with new functions taking enums rather than strings.

LayoutTests:

* storage/indexeddb/exceptions-expected.txt:
* storage/indexeddb/exceptions-private-expected.txt:
* storage/indexeddb/index-basics-expected.txt:
* storage/indexeddb/index-basics-private-expected.txt:
* storage/indexeddb/index-basics-workers-expected.txt:
* storage/indexeddb/objectstore-cursor-expected.txt:
* storage/indexeddb/objectstore-cursor-private-expected.txt:
Update results for improved exception messages.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (210147 => 210148)


--- trunk/LayoutTests/ChangeLog	2016-12-25 23:57:40 UTC (rev 210147)
+++ trunk/LayoutTests/ChangeLog	2016-12-26 01:33:33 UTC (rev 210148)
@@ -1,3 +1,19 @@
+2016-12-25  Sam Weinig  <s...@webkit.org>
+
+        [WebIDL] Remove (most) custom bindings for the IndexedDB code
+        https://bugs.webkit.org/show_bug.cgi?id=166451
+
+        Reviewed by Darin Adler.
+
+        * storage/indexeddb/exceptions-expected.txt:
+        * storage/indexeddb/exceptions-private-expected.txt:
+        * storage/indexeddb/index-basics-expected.txt:
+        * storage/indexeddb/index-basics-private-expected.txt:
+        * storage/indexeddb/index-basics-workers-expected.txt:
+        * storage/indexeddb/objectstore-cursor-expected.txt:
+        * storage/indexeddb/objectstore-cursor-private-expected.txt:
+        Update results for improved exception messages.
+
 2016-12-23  Simon Fraser  <simon.fra...@apple.com>
 
         REGRESSION (r209299): Selection is broken when you zoom in webpage using trackpad

Modified: trunk/LayoutTests/storage/indexeddb/exceptions-expected.txt (210147 => 210148)


--- trunk/LayoutTests/storage/indexeddb/exceptions-expected.txt	2016-12-25 23:57:40 UTC (rev 210147)
+++ trunk/LayoutTests/storage/indexeddb/exceptions-expected.txt	2016-12-26 01:33:33 UTC (rev 210148)
@@ -253,7 +253,7 @@
 The value for the direction parameter is invalid.
 Expecting TypeError exception from store.openCursor(0, 'invalid-direction')
 PASS Exception was thrown.
-PASS store.openCursor(0, 'invalid-direction') threw TypeError: Type error
+PASS store.openCursor(0, 'invalid-direction') threw TypeError: Argument 2 ('direction') to IDBObjectStore.openCursor must be one of: "next", "nextunique", "prev", "prevunique"
 
 IDBObjectStore.put()
 This method throws a DOMException of type ReadOnlyError if the transaction which this IDBObjectStore belongs to is has its mode set to "readonly".
@@ -390,7 +390,7 @@
 The value for the direction parameter is invalid.
 Expecting TypeError exception from index.openCursor(0, 'invalid-direction')
 PASS Exception was thrown.
-PASS index.openCursor(0, 'invalid-direction') threw TypeError: Failed to execute 'openCursor' on 'IDBIndex': The direction provided ('invalid-direction') is not one of 'next', 'nextunique', 'prev', or 'prevunique'.
+PASS index.openCursor(0, 'invalid-direction') threw TypeError: Argument 2 ('direction') to IDBIndex.openCursor must be one of: "next", "nextunique", "prev", "prevunique"
 
 IDBIndex.openKeyCursor()
 If the range parameter is specified but is not a valid key or a key range, this method throws a DOMException of type DataError.
@@ -408,7 +408,7 @@
 The value for the direction parameter is invalid.
 Expecting TypeError exception from index.openKeyCursor(0, 'invalid-direction')
 PASS Exception was thrown.
-PASS index.openKeyCursor(0, 'invalid-direction') threw TypeError: Failed to execute 'openKeyCursor' on 'IDBIndex': The direction provided ('invalid-direction') is not one of 'next', 'nextunique', 'prev', or 'prevunique'.
+PASS index.openKeyCursor(0, 'invalid-direction') threw TypeError: Argument 2 ('direction') to IDBIndex.openKeyCursor must be one of: "next", "nextunique", "prev", "prevunique"
 
 3.2.7 Cursor
 transaction = db.transaction(['store', 'inlineKeyStore'], 'readwrite')

Modified: trunk/LayoutTests/storage/indexeddb/exceptions-private-expected.txt (210147 => 210148)


--- trunk/LayoutTests/storage/indexeddb/exceptions-private-expected.txt	2016-12-25 23:57:40 UTC (rev 210147)
+++ trunk/LayoutTests/storage/indexeddb/exceptions-private-expected.txt	2016-12-26 01:33:33 UTC (rev 210148)
@@ -253,7 +253,7 @@
 The value for the direction parameter is invalid.
 Expecting TypeError exception from store.openCursor(0, 'invalid-direction')
 PASS Exception was thrown.
-PASS store.openCursor(0, 'invalid-direction') threw TypeError: Type error
+PASS store.openCursor(0, 'invalid-direction') threw TypeError: Argument 2 ('direction') to IDBObjectStore.openCursor must be one of: "next", "nextunique", "prev", "prevunique"
 
 IDBObjectStore.put()
 This method throws a DOMException of type ReadOnlyError if the transaction which this IDBObjectStore belongs to is has its mode set to "readonly".
@@ -390,7 +390,7 @@
 The value for the direction parameter is invalid.
 Expecting TypeError exception from index.openCursor(0, 'invalid-direction')
 PASS Exception was thrown.
-PASS index.openCursor(0, 'invalid-direction') threw TypeError: Failed to execute 'openCursor' on 'IDBIndex': The direction provided ('invalid-direction') is not one of 'next', 'nextunique', 'prev', or 'prevunique'.
+PASS index.openCursor(0, 'invalid-direction') threw TypeError: Argument 2 ('direction') to IDBIndex.openCursor must be one of: "next", "nextunique", "prev", "prevunique"
 
 IDBIndex.openKeyCursor()
 If the range parameter is specified but is not a valid key or a key range, this method throws a DOMException of type DataError.
@@ -408,7 +408,7 @@
 The value for the direction parameter is invalid.
 Expecting TypeError exception from index.openKeyCursor(0, 'invalid-direction')
 PASS Exception was thrown.
-PASS index.openKeyCursor(0, 'invalid-direction') threw TypeError: Failed to execute 'openKeyCursor' on 'IDBIndex': The direction provided ('invalid-direction') is not one of 'next', 'nextunique', 'prev', or 'prevunique'.
+PASS index.openKeyCursor(0, 'invalid-direction') threw TypeError: Argument 2 ('direction') to IDBIndex.openKeyCursor must be one of: "next", "nextunique", "prev", "prevunique"
 
 3.2.7 Cursor
 transaction = db.transaction(['store', 'inlineKeyStore'], 'readwrite')

Modified: trunk/LayoutTests/storage/indexeddb/index-basics-expected.txt (210147 => 210148)


--- trunk/LayoutTests/storage/indexeddb/index-basics-expected.txt	2016-12-25 23:57:40 UTC (rev 210147)
+++ trunk/LayoutTests/storage/indexeddb/index-basics-expected.txt	2016-12-26 01:33:33 UTC (rev 210148)
@@ -69,7 +69,7 @@
 Verify that specifying an invalid direction raises an exception:
 Expecting TypeError exception from indexObject.openKeyCursor(0, 'invalid-direction')
 PASS Exception was thrown.
-PASS indexObject.openKeyCursor(0, 'invalid-direction') threw TypeError: Failed to execute 'openKeyCursor' on 'IDBIndex': The direction provided ('invalid-direction') is not one of 'next', 'nextunique', 'prev', or 'prevunique'.
+PASS indexObject.openKeyCursor(0, 'invalid-direction') threw TypeError: Argument 2 ('direction') to IDBIndex.openKeyCursor must be one of: "next", "nextunique", "prev", "prevunique"
 
 indexObject.openKeyCursor()
 PASS event.target.source is indexObject
@@ -94,7 +94,7 @@
 Verify that specifying an invalid direction raises an exception:
 Expecting TypeError exception from indexObject.openCursor(0, 'invalid-direction')
 PASS Exception was thrown.
-PASS indexObject.openCursor(0, 'invalid-direction') threw TypeError: Failed to execute 'openCursor' on 'IDBIndex': The direction provided ('invalid-direction') is not one of 'next', 'nextunique', 'prev', or 'prevunique'.
+PASS indexObject.openCursor(0, 'invalid-direction') threw TypeError: Argument 2 ('direction') to IDBIndex.openCursor must be one of: "next", "nextunique", "prev", "prevunique"
 
 indexObject.openCursor()
 PASS event.target.source is indexObject

Modified: trunk/LayoutTests/storage/indexeddb/index-basics-private-expected.txt (210147 => 210148)


--- trunk/LayoutTests/storage/indexeddb/index-basics-private-expected.txt	2016-12-25 23:57:40 UTC (rev 210147)
+++ trunk/LayoutTests/storage/indexeddb/index-basics-private-expected.txt	2016-12-26 01:33:33 UTC (rev 210148)
@@ -69,7 +69,7 @@
 Verify that specifying an invalid direction raises an exception:
 Expecting TypeError exception from indexObject.openKeyCursor(0, 'invalid-direction')
 PASS Exception was thrown.
-PASS indexObject.openKeyCursor(0, 'invalid-direction') threw TypeError: Failed to execute 'openKeyCursor' on 'IDBIndex': The direction provided ('invalid-direction') is not one of 'next', 'nextunique', 'prev', or 'prevunique'.
+PASS indexObject.openKeyCursor(0, 'invalid-direction') threw TypeError: Argument 2 ('direction') to IDBIndex.openKeyCursor must be one of: "next", "nextunique", "prev", "prevunique"
 
 indexObject.openKeyCursor()
 PASS event.target.source is indexObject
@@ -94,7 +94,7 @@
 Verify that specifying an invalid direction raises an exception:
 Expecting TypeError exception from indexObject.openCursor(0, 'invalid-direction')
 PASS Exception was thrown.
-PASS indexObject.openCursor(0, 'invalid-direction') threw TypeError: Failed to execute 'openCursor' on 'IDBIndex': The direction provided ('invalid-direction') is not one of 'next', 'nextunique', 'prev', or 'prevunique'.
+PASS indexObject.openCursor(0, 'invalid-direction') threw TypeError: Argument 2 ('direction') to IDBIndex.openCursor must be one of: "next", "nextunique", "prev", "prevunique"
 
 indexObject.openCursor()
 PASS event.target.source is indexObject

Modified: trunk/LayoutTests/storage/indexeddb/index-basics-workers-expected.txt (210147 => 210148)


--- trunk/LayoutTests/storage/indexeddb/index-basics-workers-expected.txt	2016-12-25 23:57:40 UTC (rev 210147)
+++ trunk/LayoutTests/storage/indexeddb/index-basics-workers-expected.txt	2016-12-26 01:33:33 UTC (rev 210148)
@@ -70,7 +70,7 @@
 [Worker] Verify that specifying an invalid direction raises an exception:
 [Worker] Expecting TypeError exception from indexObject.openKeyCursor(0, 'invalid-direction')
 PASS [Worker] Exception was thrown.
-PASS [Worker] indexObject.openKeyCursor(0, 'invalid-direction') threw TypeError: Failed to execute 'openKeyCursor' on 'IDBIndex': The direction provided ('invalid-direction') is not one of 'next', 'nextunique', 'prev', or 'prevunique'.
+PASS [Worker] indexObject.openKeyCursor(0, 'invalid-direction') threw TypeError: Argument 2 ('direction') to IDBIndex.openKeyCursor must be one of: "next", "nextunique", "prev", "prevunique"
 [Worker] 
 [Worker] indexObject.openKeyCursor()
 PASS [Worker] event.target.source is indexObject
@@ -95,7 +95,7 @@
 [Worker] Verify that specifying an invalid direction raises an exception:
 [Worker] Expecting TypeError exception from indexObject.openCursor(0, 'invalid-direction')
 PASS [Worker] Exception was thrown.
-PASS [Worker] indexObject.openCursor(0, 'invalid-direction') threw TypeError: Failed to execute 'openCursor' on 'IDBIndex': The direction provided ('invalid-direction') is not one of 'next', 'nextunique', 'prev', or 'prevunique'.
+PASS [Worker] indexObject.openCursor(0, 'invalid-direction') threw TypeError: Argument 2 ('direction') to IDBIndex.openCursor must be one of: "next", "nextunique", "prev", "prevunique"
 [Worker] 
 [Worker] indexObject.openCursor()
 PASS [Worker] event.target.source is indexObject

Modified: trunk/LayoutTests/storage/indexeddb/objectstore-cursor-expected.txt (210147 => 210148)


--- trunk/LayoutTests/storage/indexeddb/objectstore-cursor-expected.txt	2016-12-25 23:57:40 UTC (rev 210147)
+++ trunk/LayoutTests/storage/indexeddb/objectstore-cursor-expected.txt	2016-12-26 01:33:33 UTC (rev 210148)
@@ -12,7 +12,7 @@
 Verify that specifying an invalid direction raises an exception:
 Expecting TypeError exception from objectStore.openCursor(0, 'invalid-direction')
 PASS Exception was thrown.
-PASS objectStore.openCursor(0, 'invalid-direction') threw TypeError: Type error
+PASS objectStore.openCursor(0, 'invalid-direction') threw TypeError: Argument 2 ('direction') to IDBObjectStore.openCursor must be one of: "next", "nextunique", "prev", "prevunique"
 
 objectStore.add('', testData[nextToAdd])
 objectStore.add('', testData[nextToAdd])

Modified: trunk/LayoutTests/storage/indexeddb/objectstore-cursor-private-expected.txt (210147 => 210148)


--- trunk/LayoutTests/storage/indexeddb/objectstore-cursor-private-expected.txt	2016-12-25 23:57:40 UTC (rev 210147)
+++ trunk/LayoutTests/storage/indexeddb/objectstore-cursor-private-expected.txt	2016-12-26 01:33:33 UTC (rev 210148)
@@ -12,7 +12,7 @@
 Verify that specifying an invalid direction raises an exception:
 Expecting TypeError exception from objectStore.openCursor(0, 'invalid-direction')
 PASS Exception was thrown.
-PASS objectStore.openCursor(0, 'invalid-direction') threw TypeError: Type error
+PASS objectStore.openCursor(0, 'invalid-direction') threw TypeError: Argument 2 ('direction') to IDBObjectStore.openCursor must be one of: "next", "nextunique", "prev", "prevunique"
 
 objectStore.add('', testData[nextToAdd])
 objectStore.add('', testData[nextToAdd])

Modified: trunk/Source/WebCore/CMakeLists.txt (210147 => 210148)


--- trunk/Source/WebCore/CMakeLists.txt	2016-12-25 23:57:40 UTC (rev 210147)
+++ trunk/Source/WebCore/CMakeLists.txt	2016-12-26 01:33:33 UTC (rev 210148)
@@ -182,6 +182,7 @@
 
     Modules/indexeddb/DOMWindowIndexedDatabase.idl
     Modules/indexeddb/IDBCursor.idl
+    Modules/indexeddb/IDBCursorDirection.idl
     Modules/indexeddb/IDBCursorWithValue.idl
     Modules/indexeddb/IDBDatabase.idl
     Modules/indexeddb/IDBFactory.idl

Modified: trunk/Source/WebCore/ChangeLog (210147 => 210148)


--- trunk/Source/WebCore/ChangeLog	2016-12-25 23:57:40 UTC (rev 210147)
+++ trunk/Source/WebCore/ChangeLog	2016-12-26 01:33:33 UTC (rev 210148)
@@ -1,3 +1,112 @@
+2016-12-24  Sam Weinig  <s...@webkit.org>
+
+        [WebIDL] Remove (most) custom bindings for the IndexedDB code
+        https://bugs.webkit.org/show_bug.cgi?id=166451
+
+        Reviewed by Darin Adler.
+
+        Removes the custom bindings for all but one attribute (IDBRequest.result) in
+        the IndexedDB code.
+        - Adds a new WebIDL extension type, IDBKey, to represent the complex key conversion
+          rules IndexedDB specifies.
+        - Replaces custom bindings for IDBCursor.source with use of a union.
+        - Replaces custom enum type checking for IDBCursor.direction with a WebIDL enum.
+        - Replaces custom code generation for IDBKeyPaths with a union.
+
+        * CMakeLists.txt:
+        * DerivedSources.make:
+        * WebCore.xcodeproj/project.pbxproj:
+        Add new files.
+
+        * Modules/indexeddb/IDBCursor.cpp:
+        (WebCore::IDBCursor::source):
+        (WebCore::IDBCursor::direction):
+        (WebCore::IDBCursor::directionNext): Deleted.
+        (WebCore::IDBCursor::directionNextUnique): Deleted.
+        (WebCore::IDBCursor::directionPrev): Deleted.
+        (WebCore::IDBCursor::directionPrevUnique): Deleted.
+        (WebCore::IDBCursor::stringToDirection): Deleted.
+        (WebCore::IDBCursor::directionToString): Deleted.
+        * Modules/indexeddb/IDBCursor.h:
+        (WebCore::IDBCursor::objectStore): Deleted.
+        (WebCore::IDBCursor::index): Deleted.
+        Replace custom enum checking with direct use of the enum, letting the generator
+        handle the checks. Also adds source function which returns a Variant.
+
+        * Modules/indexeddb/IDBCursor.idl:
+        Remove custom annotation and use correct types.
+
+        * Modules/indexeddb/IDBCursorDirection.h: Added.
+        * Modules/indexeddb/IDBCursorDirection.idl: Added.
+
+        * Modules/indexeddb/IDBIndex.cpp:
+        (WebCore::IDBIndex::openCursor):
+        (WebCore::IDBIndex::openKeyCursor):
+        * Modules/indexeddb/IDBIndex.h:
+        * Modules/indexeddb/IDBIndex.idl:
+        * Modules/indexeddb/IDBObjectStore.cpp:
+        (WebCore::IDBObjectStore::openCursor):
+        (WebCore::IDBObjectStore::openKeyCursor):
+        * Modules/indexeddb/IDBObjectStore.h:
+        * Modules/indexeddb/IDBObjectStore.idl:
+        Replace Strings with IDBCursorDirection enums.
+
+        * Modules/indexeddb/IDBKeyRange.idl:
+        Remove annotation and use new IDBKey extension type.
+
+        * Modules/indexeddb/IDBOpenDBRequest.cpp:
+        (WebCore::IDBOpenDBRequest::onSuccess):
+        (WebCore::IDBOpenDBRequest::onUpgradeNeeded):
+        (WebCore::IDBOpenDBRequest::onDeleteDatabaseSuccess):
+        Use ReadyState enum in place of the old m_isDone boolean.
+
+        * Modules/indexeddb/IDBRequest.cpp:
+        (WebCore::IDBRequest::IDBRequest):
+        (WebCore::IDBRequest::error):
+        (WebCore::IDBRequest::source):
+        (WebCore::IDBRequest::dispatchEvent):
+        (WebCore::IDBRequest::willIterateCursor):
+        (WebCore::IDBRequest::completeRequestAndDispatchEvent):
+        (WebCore::IDBRequest::readyState): Deleted.
+        * Modules/indexeddb/IDBRequest.h:
+        (WebCore::IDBRequest::readyState):
+        (WebCore::IDBRequest::isDone):
+        (WebCore::IDBRequest::objectStoreSource): Deleted.
+        (WebCore::IDBRequest::indexSource): Deleted.
+        (WebCore::IDBRequest::cursorSource): Deleted.
+        * Modules/indexeddb/IDBRequest.idl:
+        Replace the readyState String with a enum, and the custom source binding with a
+        source function that returns a Variant.
+
+        * Modules/indexeddb/IndexedDB.h:
+        Add the missing values to CursorDirection to make it comply with the IDL definition.
+
+        * bindings/generic/IDLTypes.h:
+        * bindings/js/JSDOMConvert.h:
+        (WebCore::JSConverter<IDLIDBKey<T>>::convert):
+        Add new extension type IDLIDBKey.
+
+        * bindings/js/JSIDBCursorCustom.cpp:
+        (WebCore::JSIDBCursor::source): Deleted.
+        * bindings/js/JSIDBRequestCustom.cpp:
+        (WebCore::JSIDBRequest::source): Deleted.
+        Remove custom bindings.
+
+        * bindings/scripts/CodeGenerator.pm:
+        (IsBuiltinType):
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (GetBaseIDLType):
+        (NativeToJSValueDOMConvertNeedsState):
+        (NativeToJSValueDOMConvertNeedsGlobalObject):
+        (NativeToJSValue):
+        Add support for IDBKey, and remove custom code for IndexedDB in core conversion logic.
+
+        * bindings/scripts/IDLAttributes.txt:
+        Remove now unused ImplementationReturnType attribute.
+
+        * inspector/InspectorIndexedDBAgent.cpp:
+        Update to work with new functions taking enums rather than strings.
+
 2016-12-23  Simon Fraser  <simon.fra...@apple.com>
 
         REGRESSION (r209299): Selection is broken when you zoom in webpage using trackpad

Modified: trunk/Source/WebCore/DerivedSources.make (210147 => 210148)


--- trunk/Source/WebCore/DerivedSources.make	2016-12-25 23:57:40 UTC (rev 210147)
+++ trunk/Source/WebCore/DerivedSources.make	2016-12-26 01:33:33 UTC (rev 210148)
@@ -126,6 +126,7 @@
     $(WebCore)/Modules/geolocation/PositionOptions.idl \
     $(WebCore)/Modules/indexeddb/DOMWindowIndexedDatabase.idl \
     $(WebCore)/Modules/indexeddb/IDBCursor.idl \
+    $(WebCore)/Modules/indexeddb/IDBCursorDirection.idl \
     $(WebCore)/Modules/indexeddb/IDBCursorWithValue.idl \
     $(WebCore)/Modules/indexeddb/IDBDatabase.idl \
     $(WebCore)/Modules/indexeddb/IDBFactory.idl \

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBCursor.cpp (210147 => 210148)


--- trunk/Source/WebCore/Modules/indexeddb/IDBCursor.cpp	2016-12-25 23:57:40 UTC (rev 210147)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBCursor.cpp	2016-12-26 01:33:33 UTC (rev 210148)
@@ -43,71 +43,11 @@
 #include <heap/HeapInlines.h>
 #include <heap/StrongInlines.h>
 #include <runtime/JSCJSValueInlines.h>
-#include <wtf/NeverDestroyed.h>
 
 using namespace JSC;
 
 namespace WebCore {
 
-const AtomicString& IDBCursor::directionNext()
-{
-    static NeverDestroyed<AtomicString> next("next", AtomicString::ConstructFromLiteral);
-    return next;
-}
-
-const AtomicString& IDBCursor::directionNextUnique()
-{
-    static NeverDestroyed<AtomicString> nextunique("nextunique", AtomicString::ConstructFromLiteral);
-    return nextunique;
-}
-
-const AtomicString& IDBCursor::directionPrev()
-{
-    static NeverDestroyed<AtomicString> prev("prev", AtomicString::ConstructFromLiteral);
-    return prev;
-}
-
-const AtomicString& IDBCursor::directionPrevUnique()
-{
-    static NeverDestroyed<AtomicString> prevunique("prevunique", AtomicString::ConstructFromLiteral);
-    return prevunique;
-}
-
-std::optional<IndexedDB::CursorDirection> IDBCursor::stringToDirection(const String& directionString)
-{
-    if (directionString == directionNext())
-        return IndexedDB::CursorDirection::Next;
-    if (directionString == directionNextUnique())
-        return IndexedDB::CursorDirection::NextNoDuplicate;
-    if (directionString == directionPrev())
-        return IndexedDB::CursorDirection::Prev;
-    if (directionString == directionPrevUnique())
-        return IndexedDB::CursorDirection::PrevNoDuplicate;
-
-    return std::nullopt;
-}
-
-const AtomicString& IDBCursor::directionToString(IndexedDB::CursorDirection direction)
-{
-    switch (direction) {
-    case IndexedDB::CursorDirection::Next:
-        return directionNext();
-
-    case IndexedDB::CursorDirection::NextNoDuplicate:
-        return directionNextUnique();
-
-    case IndexedDB::CursorDirection::Prev:
-        return directionPrev();
-
-    case IndexedDB::CursorDirection::PrevNoDuplicate:
-        return directionPrevUnique();
-
-    default:
-        ASSERT_NOT_REACHED();
-        return directionNext();
-    }
-}
-
 Ref<IDBCursor> IDBCursor::create(IDBTransaction& transaction, IDBObjectStore& objectStore, const IDBCursorInfo& info)
 {
     return adoptRef(*new IDBCursor(transaction, objectStore, info));
@@ -121,7 +61,7 @@
 IDBCursor::IDBCursor(IDBTransaction& transaction, IDBObjectStore& objectStore, const IDBCursorInfo& info)
     : ActiveDOMObject(transaction.scriptExecutionContext())
     , m_info(info)
-    , m_objectStore(&objectStore)
+    , m_source(&objectStore)
 {
     ASSERT(currentThread() == effectiveObjectStore().transaction().database().originThreadID());
 
@@ -131,7 +71,7 @@
 IDBCursor::IDBCursor(IDBTransaction& transaction, IDBIndex& index, const IDBCursorInfo& info)
     : ActiveDOMObject(transaction.scriptExecutionContext())
     , m_info(info)
-    , m_index(&index)
+    , m_source(&index)
 {
     ASSERT(currentThread() == effectiveObjectStore().transaction().database().originThreadID());
 
@@ -147,20 +87,18 @@
 {
     ASSERT(currentThread() == effectiveObjectStore().transaction().database().originThreadID());
 
-    if (m_objectStore)
-        return m_objectStore->isDeleted();
-
-    ASSERT(m_index);
-    return m_index->isDeleted() || m_index->objectStore().isDeleted();
+    return WTF::switchOn(m_source,
+        [] (const RefPtr<IDBObjectStore>& objectStore) { return objectStore->isDeleted(); },
+        [] (const RefPtr<IDBIndex>& index) { return index->isDeleted() || index->objectStore().isDeleted(); }
+    );
 }
 
 IDBObjectStore& IDBCursor::effectiveObjectStore() const
 {
-    if (m_objectStore)
-        return *m_objectStore;
-
-    ASSERT(m_index);
-    return m_index->objectStore();
+    return WTF::switchOn(m_source,
+        [] (const RefPtr<IDBObjectStore>& objectStore) -> IDBObjectStore& { return *objectStore; },
+        [] (const RefPtr<IDBIndex>& index) -> IDBObjectStore& { return index->objectStore(); }
+    );
 }
 
 IDBTransaction& IDBCursor::transaction() const
@@ -169,12 +107,6 @@
     return effectiveObjectStore().transaction();
 }
 
-const String& IDBCursor::direction() const
-{
-    ASSERT(currentThread() == effectiveObjectStore().transaction().database().originThreadID());
-    return directionToString(m_info.cursorDirection());
-}
-
 ExceptionOr<Ref<IDBRequest>> IDBCursor::update(ExecState& state, JSValue value)
 {
     LOG(IndexedDB, "IDBCursor::update");
@@ -251,7 +183,7 @@
     if (sourcesDeleted())
         return Exception { IDBDatabaseException::InvalidStateError, ASCIILiteral("Failed to execute 'continuePrimaryKey' on 'IDBCursor': The cursor's source or effective object store has been deleted.") };
 
-    if (!m_index)
+    if (!WTF::holds_alternative<RefPtr<IDBIndex>>(m_source))
         return Exception { IDBDatabaseException::InvalidAccessError, ASCIILiteral("Failed to execute 'continuePrimaryKey' on 'IDBCursor': The cursor's source is not an index.") };
 
     auto direction = m_info.cursorDirection();

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBCursor.h (210147 => 210148)


--- trunk/Source/WebCore/Modules/indexeddb/IDBCursor.h	2016-12-25 23:57:40 UTC (rev 210147)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBCursor.h	2016-12-26 01:33:33 UTC (rev 210148)
@@ -30,8 +30,10 @@
 #include "ActiveDOMObject.h"
 #include "DOMWrapperWorld.h"
 #include "ExceptionOr.h"
+#include "IDBCursorDirection.h"
 #include "IDBCursorInfo.h"
 #include <heap/Strong.h>
+#include <wtf/Variant.h>
 
 namespace WebCore {
 
@@ -44,23 +46,16 @@
 public:
     static Ref<IDBCursor> create(IDBTransaction&, IDBObjectStore&, const IDBCursorInfo&);
     static Ref<IDBCursor> create(IDBTransaction&, IDBIndex&, const IDBCursorInfo&);
-
-    static const AtomicString& directionNext();
-    static const AtomicString& directionNextUnique();
-    static const AtomicString& directionPrev();
-    static const AtomicString& directionPrevUnique();
-
-    static std::optional<IndexedDB::CursorDirection> stringToDirection(const String& modeString);
-    static const AtomicString& directionToString(IndexedDB::CursorDirection mode);
     
     virtual ~IDBCursor();
 
-    const String& direction() const;
+    using Source = Variant<RefPtr<IDBObjectStore>, RefPtr<IDBIndex>>;
+
+    const Source& source() const;
+    IDBCursorDirection direction() const;
     JSC::JSValue key() const;
     JSC::JSValue primaryKey() const;
     JSC::JSValue value() const;
-    IDBObjectStore* objectStore() const { return m_objectStore.get(); }
-    IDBIndex* index() const { return m_index.get(); }
 
     ExceptionOr<Ref<IDBRequest>> update(JSC::ExecState&, JSC::JSValue);
     ExceptionOr<void> advance(unsigned);
@@ -103,8 +98,7 @@
     unsigned m_outstandingRequestCount { 1 };
 
     IDBCursorInfo m_info;
-    RefPtr<IDBObjectStore> m_objectStore;
-    RefPtr<IDBIndex> m_index;
+    Source m_source;
     IDBRequest* m_request { nullptr };
 
     bool m_gotValue { false };
@@ -117,6 +111,17 @@
     JSC::Strong<JSC::Unknown> m_currentValue;
 };
 
+
+inline const IDBCursor::Source& IDBCursor::source() const
+{
+    return m_source;
+}
+
+inline IDBCursorDirection IDBCursor::direction() const
+{
+    return m_info.cursorDirection();
+}
+
 inline JSC::JSValue IDBCursor::key() const
 {
     return m_currentKey.get();

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBCursor.idl (210147 => 210148)


--- trunk/Source/WebCore/Modules/indexeddb/IDBCursor.idl	2016-12-25 23:57:40 UTC (rev 210147)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBCursor.idl	2016-12-26 01:33:33 UTC (rev 210148)
@@ -31,8 +31,8 @@
     JSCustomMarkFunction,
     SkipVTableValidation,
 ] interface IDBCursor {
-    [CustomGetter] readonly attribute any source;
-    readonly attribute DOMString direction;
+    readonly attribute (IDBObjectStore or IDBIndex) source;
+    readonly attribute IDBCursorDirection direction;
     readonly attribute any key;
     readonly attribute any primaryKey;
 

Added: trunk/Source/WebCore/Modules/indexeddb/IDBCursorDirection.h (0 => 210148)


--- trunk/Source/WebCore/Modules/indexeddb/IDBCursorDirection.h	                        (rev 0)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBCursorDirection.h	2016-12-26 01:33:33 UTC (rev 210148)
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "IndexedDB.h"
+
+namespace WebCore {
+
+using IDBCursorDirection = IndexedDB::CursorDirection;
+
+}

Added: trunk/Source/WebCore/Modules/indexeddb/IDBCursorDirection.idl (0 => 210148)


--- trunk/Source/WebCore/Modules/indexeddb/IDBCursorDirection.idl	                        (rev 0)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBCursorDirection.idl	2016-12-26 01:33:33 UTC (rev 210148)
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+[
+    Conditional=INDEXED_DATABASE,
+] enum IDBCursorDirection {
+    "next",
+    "nextunique",
+    "prev",
+    "prevunique"
+};

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBIndex.cpp (210147 => 210148)


--- trunk/Source/WebCore/Modules/indexeddb/IDBIndex.cpp	2016-12-25 23:57:40 UTC (rev 210147)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBIndex.cpp	2016-12-26 01:33:33 UTC (rev 210148)
@@ -151,7 +151,7 @@
     m_deleted = false;
 }
 
-ExceptionOr<Ref<IDBRequest>> IDBIndex::openCursor(ExecState& execState, IDBKeyRange* range, const String& directionString)
+ExceptionOr<Ref<IDBRequest>> IDBIndex::openCursor(ExecState& execState, IDBKeyRange* range, IDBCursorDirection direction)
 {
     LOG(IndexedDB, "IDBIndex::openCursor");
     ASSERT(currentThread() == m_objectStore.transaction().database().originThreadID());
@@ -162,10 +162,6 @@
     if (!m_objectStore.transaction().isActive())
         return Exception { IDBDatabaseException::TransactionInactiveError, ASCIILiteral("Failed to execute 'openCursor' on 'IDBIndex': The transaction is inactive or finished.") };
 
-    auto direction = IDBCursor::stringToDirection(directionString);
-    if (!direction)
-        return Exception { TypeError, ASCIILiteral("Failed to execute 'openCursor' on 'IDBIndex': The direction provided ('invalid-direction') is not one of 'next', 'nextunique', 'prev', or 'prevunique'.") };
-
     IDBKeyRangeData rangeData = range;
     if (rangeData.lowerKey.isNull())
         rangeData.lowerKey = IDBKeyData::minimum();
@@ -172,11 +168,11 @@
     if (rangeData.upperKey.isNull())
         rangeData.upperKey = IDBKeyData::maximum();
 
-    auto info = IDBCursorInfo::indexCursor(m_objectStore.transaction(), m_objectStore.info().identifier(), m_info.identifier(), rangeData, direction.value(), IndexedDB::CursorType::KeyAndValue);
+    auto info = IDBCursorInfo::indexCursor(m_objectStore.transaction(), m_objectStore.info().identifier(), m_info.identifier(), rangeData, direction, IndexedDB::CursorType::KeyAndValue);
     return m_objectStore.transaction().requestOpenCursor(execState, *this, info);
 }
 
-ExceptionOr<Ref<IDBRequest>> IDBIndex::openCursor(ExecState& execState, JSValue key, const String& direction)
+ExceptionOr<Ref<IDBRequest>> IDBIndex::openCursor(ExecState& execState, JSValue key, IDBCursorDirection direction)
 {
     LOG(IndexedDB, "IDBIndex::openCursor");
     ASSERT(currentThread() == m_objectStore.transaction().database().originThreadID());
@@ -188,6 +184,31 @@
     return openCursor(execState, keyRange.releaseReturnValue().ptr(), direction);
 }
 
+ExceptionOr<Ref<IDBRequest>> IDBIndex::openKeyCursor(ExecState& execState, IDBKeyRange* range, IDBCursorDirection direction)
+{
+    LOG(IndexedDB, "IDBIndex::openKeyCursor");
+    ASSERT(currentThread() == m_objectStore.transaction().database().originThreadID());
+
+    if (m_deleted || m_objectStore.isDeleted())
+        return Exception { IDBDatabaseException::InvalidStateError, ASCIILiteral("Failed to execute 'openKeyCursor' on 'IDBIndex': The index or its object store has been deleted.") };
+
+    if (!m_objectStore.transaction().isActive())
+        return Exception { IDBDatabaseException::TransactionInactiveError, ASCIILiteral("Failed to execute 'openKeyCursor' on 'IDBIndex': The transaction is inactive or finished.") };
+
+    auto info = IDBCursorInfo::indexCursor(m_objectStore.transaction(), m_objectStore.info().identifier(), m_info.identifier(), range, direction, IndexedDB::CursorType::KeyOnly);
+    return m_objectStore.transaction().requestOpenCursor(execState, *this, info);
+}
+
+ExceptionOr<Ref<IDBRequest>> IDBIndex::openKeyCursor(ExecState& execState, JSValue key, IDBCursorDirection direction)
+{
+    LOG(IndexedDB, "IDBIndex::openKeyCursor");
+
+    auto keyRange = IDBKeyRange::only(execState, key);
+    if (keyRange.hasException())
+        return Exception { IDBDatabaseException::DataError, ASCIILiteral("Failed to execute 'openKeyCursor' on 'IDBIndex': The parameter is not a valid key.") };
+    return openKeyCursor(execState, keyRange.releaseReturnValue().ptr(), direction);
+}
+
 ExceptionOr<Ref<IDBRequest>> IDBIndex::count(ExecState& execState, IDBKeyRange* range)
 {
     LOG(IndexedDB, "IDBIndex::count");
@@ -223,35 +244,6 @@
     return transaction.requestCount(execState, *this, range);
 }
 
-ExceptionOr<Ref<IDBRequest>> IDBIndex::openKeyCursor(ExecState& execState, IDBKeyRange* range, const String& directionString)
-{
-    LOG(IndexedDB, "IDBIndex::openKeyCursor");
-    ASSERT(currentThread() == m_objectStore.transaction().database().originThreadID());
-
-    if (m_deleted || m_objectStore.isDeleted())
-        return Exception { IDBDatabaseException::InvalidStateError, ASCIILiteral("Failed to execute 'openKeyCursor' on 'IDBIndex': The index or its object store has been deleted.") };
-
-    if (!m_objectStore.transaction().isActive())
-        return Exception { IDBDatabaseException::TransactionInactiveError, ASCIILiteral("Failed to execute 'openKeyCursor' on 'IDBIndex': The transaction is inactive or finished.") };
-
-    auto direction = IDBCursor::stringToDirection(directionString);
-    if (!direction)
-        return Exception { TypeError, ASCIILiteral("Failed to execute 'openKeyCursor' on 'IDBIndex': The direction provided ('invalid-direction') is not one of 'next', 'nextunique', 'prev', or 'prevunique'.") };
-
-    auto info = IDBCursorInfo::indexCursor(m_objectStore.transaction(), m_objectStore.info().identifier(), m_info.identifier(), range, direction.value(), IndexedDB::CursorType::KeyOnly);
-    return m_objectStore.transaction().requestOpenCursor(execState, *this, info);
-}
-
-ExceptionOr<Ref<IDBRequest>> IDBIndex::openKeyCursor(ExecState& execState, JSValue key, const String& direction)
-{
-    LOG(IndexedDB, "IDBIndex::openKeyCursor");
-
-    auto keyRange = IDBKeyRange::only(execState, key);
-    if (keyRange.hasException())
-        return Exception { IDBDatabaseException::DataError, ASCIILiteral("Failed to execute 'openKeyCursor' on 'IDBIndex': The parameter is not a valid key.") };
-    return openKeyCursor(execState, keyRange.releaseReturnValue().ptr(), direction);
-}
-
 ExceptionOr<Ref<IDBRequest>> IDBIndex::get(ExecState& execState, IDBKeyRange* range)
 {
     LOG(IndexedDB, "IDBIndex::get");

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBIndex.h (210147 => 210148)


--- trunk/Source/WebCore/Modules/indexeddb/IDBIndex.h	2016-12-25 23:57:40 UTC (rev 210147)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBIndex.h	2016-12-26 01:33:33 UTC (rev 210148)
@@ -56,15 +56,14 @@
 
     void rollbackInfoForVersionChangeAbort();
 
-    ExceptionOr<Ref<IDBRequest>> openCursor(JSC::ExecState&, IDBKeyRange*, const String& direction);
-    ExceptionOr<Ref<IDBRequest>> openCursor(JSC::ExecState&, JSC::JSValue key, const String& direction);
+    ExceptionOr<Ref<IDBRequest>> openCursor(JSC::ExecState&, IDBKeyRange*, IDBCursorDirection);
+    ExceptionOr<Ref<IDBRequest>> openCursor(JSC::ExecState&, JSC::JSValue key, IDBCursorDirection);
+    ExceptionOr<Ref<IDBRequest>> openKeyCursor(JSC::ExecState&, IDBKeyRange*, IDBCursorDirection);
+    ExceptionOr<Ref<IDBRequest>> openKeyCursor(JSC::ExecState&, JSC::JSValue key, IDBCursorDirection);
 
     ExceptionOr<Ref<IDBRequest>> count(JSC::ExecState&, IDBKeyRange*);
     ExceptionOr<Ref<IDBRequest>> count(JSC::ExecState&, JSC::JSValue key);
 
-    ExceptionOr<Ref<IDBRequest>> openKeyCursor(JSC::ExecState&, IDBKeyRange*, const String& direction);
-    ExceptionOr<Ref<IDBRequest>> openKeyCursor(JSC::ExecState&, JSC::JSValue key, const String& direction);
-
     ExceptionOr<Ref<IDBRequest>> get(JSC::ExecState&, IDBKeyRange*);
     ExceptionOr<Ref<IDBRequest>> get(JSC::ExecState&, JSC::JSValue key);
     ExceptionOr<Ref<IDBRequest>> getKey(JSC::ExecState&, IDBKeyRange*);

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBIndex.idl (210147 => 210148)


--- trunk/Source/WebCore/Modules/indexeddb/IDBIndex.idl	2016-12-25 23:57:40 UTC (rev 210147)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBIndex.idl	2016-12-26 01:33:33 UTC (rev 210148)
@@ -23,6 +23,10 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+// NOTE: This type is specified as 'any' in the IndexedDB specification, but is always
+// constrained to this union.
+typedef (DOMString or sequence<DOMString>) IDBKeyPath;
+
 [
     Conditional=INDEXED_DATABASE,
     EnabledAtRuntime=IndexedDB,
@@ -32,15 +36,15 @@
 ] interface IDBIndex {
     [SetterMayThrowException] attribute DOMString name;
     readonly attribute IDBObjectStore objectStore;
-    [ImplementationReturnType=IDBKeyPath] readonly attribute any keyPath;
+    readonly attribute IDBKeyPath? keyPath;
     readonly attribute boolean multiEntry;
     readonly attribute boolean unique;
 
-    [CallWith=ScriptState, MayThrowException] IDBRequest openCursor(optional IDBKeyRange? range = null, optional DOMString direction = "next");
-    [CallWith=ScriptState, MayThrowException] IDBRequest openCursor(any key, optional DOMString direction = "next");
+    [CallWith=ScriptState, MayThrowException] IDBRequest openCursor(optional IDBKeyRange? range = null, optional IDBCursorDirection direction = "next");
+    [CallWith=ScriptState, MayThrowException] IDBRequest openCursor(any key, optional IDBCursorDirection direction = "next");
 
-    [CallWith=ScriptState, MayThrowException] IDBRequest openKeyCursor(optional IDBKeyRange? range = null, optional DOMString direction = "next");
-    [CallWith=ScriptState, MayThrowException] IDBRequest openKeyCursor(any key, optional DOMString direction = "next");
+    [CallWith=ScriptState, MayThrowException] IDBRequest openKeyCursor(optional IDBKeyRange? range = null, optional IDBCursorDirection direction = "next");
+    [CallWith=ScriptState, MayThrowException] IDBRequest openKeyCursor(any key, optional IDBCursorDirection direction = "next");
 
     [CallWith=ScriptState, MayThrowException] IDBRequest get(IDBKeyRange? key);
     [CallWith=ScriptState, MayThrowException] IDBRequest get(any key);
@@ -53,4 +57,3 @@
     [CallWith=ScriptState, MayThrowException] IDBRequest count(optional IDBKeyRange? range = null);
     [CallWith=ScriptState, MayThrowException] IDBRequest count(any key);
 };
-

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBKeyRange.idl (210147 => 210148)


--- trunk/Source/WebCore/Modules/indexeddb/IDBKeyRange.idl	2016-12-25 23:57:40 UTC (rev 210147)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBKeyRange.idl	2016-12-26 01:33:33 UTC (rev 210148)
@@ -28,8 +28,11 @@
     ImplementationLacksVTable,
     EnabledAtRuntime=IndexedDB,
 ] interface IDBKeyRange {
-    [ImplementationReturnType=IDBKey] readonly attribute any lower;
-    [ImplementationReturnType=IDBKey] readonly attribute any upper;
+    // NOTE: The 'lower' and 'upper' attributes are specified to be of type 'any'
+    // but we use the extension type IDBKey, to allow code generator to know our
+    // which conversion to use based on our actual implementation type.
+    readonly attribute IDBKey lower;
+    readonly attribute IDBKey upper;
     readonly attribute boolean lowerOpen;
     readonly attribute boolean upperOpen;
 

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp (210147 => 210148)


--- trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp	2016-12-25 23:57:40 UTC (rev 210147)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp	2016-12-26 01:33:33 UTC (rev 210148)
@@ -150,7 +150,7 @@
     return m_info.autoIncrement();
 }
 
-ExceptionOr<Ref<IDBRequest>> IDBObjectStore::openCursor(ExecState& execState, RefPtr<IDBKeyRange> range, const String& directionString)
+ExceptionOr<Ref<IDBRequest>> IDBObjectStore::openCursor(ExecState& execState, RefPtr<IDBKeyRange> range, IDBCursorDirection direction)
 {
     LOG(IndexedDB, "IDBObjectStore::openCursor");
     ASSERT(currentThread() == m_transaction.database().originThreadID());
@@ -161,15 +161,11 @@
     if (!m_transaction.isActive())
         return Exception { IDBDatabaseException::TransactionInactiveError, ASCIILiteral("Failed to execute 'openCursor' on 'IDBObjectStore': The transaction is inactive or finished.") };
 
-    auto direction = IDBCursor::stringToDirection(directionString);
-    if (!direction)
-        return Exception { TypeError };
-
-    auto info = IDBCursorInfo::objectStoreCursor(m_transaction, m_info.identifier(), range.get(), direction.value(), IndexedDB::CursorType::KeyAndValue);
+    auto info = IDBCursorInfo::objectStoreCursor(m_transaction, m_info.identifier(), range.get(), direction, IndexedDB::CursorType::KeyAndValue);
     return m_transaction.requestOpenCursor(execState, *this, info);
 }
 
-ExceptionOr<Ref<IDBRequest>> IDBObjectStore::openCursor(ExecState& execState, JSValue key, const String& direction)
+ExceptionOr<Ref<IDBRequest>> IDBObjectStore::openCursor(ExecState& execState, JSValue key, IDBCursorDirection direction)
 {
     auto _onlyResult_ = IDBKeyRange::only(execState, key);
     if (onlyResult.hasException())
@@ -178,7 +174,7 @@
     return openCursor(execState, onlyResult.releaseReturnValue(), direction);
 }
 
-ExceptionOr<Ref<IDBRequest>> IDBObjectStore::openKeyCursor(ExecState& execState, RefPtr<IDBKeyRange> range, const String& directionString)
+ExceptionOr<Ref<IDBRequest>> IDBObjectStore::openKeyCursor(ExecState& execState, RefPtr<IDBKeyRange> range, IDBCursorDirection direction)
 {
     LOG(IndexedDB, "IDBObjectStore::openCursor");
     ASSERT(currentThread() == m_transaction.database().originThreadID());
@@ -189,15 +185,11 @@
     if (!m_transaction.isActive())
         return Exception { IDBDatabaseException::TransactionInactiveError, ASCIILiteral("Failed to execute 'openKeyCursor' on 'IDBObjectStore': The transaction is inactive or finished.") };
 
-    auto direction = IDBCursor::stringToDirection(directionString);
-    if (!direction)
-        return Exception { TypeError };
-
-    auto info = IDBCursorInfo::objectStoreCursor(m_transaction, m_info.identifier(), range.get(), direction.value(), IndexedDB::CursorType::KeyOnly);
+    auto info = IDBCursorInfo::objectStoreCursor(m_transaction, m_info.identifier(), range.get(), direction, IndexedDB::CursorType::KeyOnly);
     return m_transaction.requestOpenCursor(execState, *this, info);
 }
 
-ExceptionOr<Ref<IDBRequest>> IDBObjectStore::openKeyCursor(ExecState& execState, JSValue key, const String& direction)
+ExceptionOr<Ref<IDBRequest>> IDBObjectStore::openKeyCursor(ExecState& execState, JSValue key, IDBCursorDirection direction)
 {
     auto _onlyResult_ = IDBKeyRange::only(execState, key);
     if (onlyResult.hasException())

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.h (210147 => 210148)


--- trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.h	2016-12-25 23:57:40 UTC (rev 210147)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.h	2016-12-26 01:33:33 UTC (rev 210148)
@@ -29,6 +29,7 @@
 
 #include "ActiveDOMObject.h"
 #include "ExceptionOr.h"
+#include "IDBCursorDirection.h"
 #include "IDBKeyPath.h"
 #include "IDBObjectStoreInfo.h"
 #include <wtf/HashSet.h>
@@ -71,10 +72,10 @@
         bool multiEntry;
     };
 
-    ExceptionOr<Ref<IDBRequest>> openCursor(JSC::ExecState&, RefPtr<IDBKeyRange>, const String& direction);
-    ExceptionOr<Ref<IDBRequest>> openCursor(JSC::ExecState&, JSC::JSValue key, const String& direction);
-    ExceptionOr<Ref<IDBRequest>> openKeyCursor(JSC::ExecState&, RefPtr<IDBKeyRange>, const String& direction);
-    ExceptionOr<Ref<IDBRequest>> openKeyCursor(JSC::ExecState&, JSC::JSValue key, const String& direction);
+    ExceptionOr<Ref<IDBRequest>> openCursor(JSC::ExecState&, RefPtr<IDBKeyRange>, IDBCursorDirection);
+    ExceptionOr<Ref<IDBRequest>> openCursor(JSC::ExecState&, JSC::JSValue key, IDBCursorDirection);
+    ExceptionOr<Ref<IDBRequest>> openKeyCursor(JSC::ExecState&, RefPtr<IDBKeyRange>, IDBCursorDirection);
+    ExceptionOr<Ref<IDBRequest>> openKeyCursor(JSC::ExecState&, JSC::JSValue key, IDBCursorDirection);
     ExceptionOr<Ref<IDBRequest>> get(JSC::ExecState&, JSC::JSValue key);
     ExceptionOr<Ref<IDBRequest>> get(JSC::ExecState&, IDBKeyRange*);
     ExceptionOr<Ref<IDBRequest>> getKey(JSC::ExecState&, JSC::JSValue key);

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.idl (210147 => 210148)


--- trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.idl	2016-12-25 23:57:40 UTC (rev 210147)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.idl	2016-12-26 01:33:33 UTC (rev 210148)
@@ -23,6 +23,10 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+// NOTE: This type is specified as 'any' in the IndexedDB specification, but is always
+// constrained to this union.
+typedef (DOMString or sequence<DOMString>) IDBKeyPath;
+
 [
     Conditional=INDEXED_DATABASE,
     EnabledAtRuntime=IndexedDB,
@@ -31,7 +35,7 @@
     SkipVTableValidation,
 ] interface IDBObjectStore {
     [SetterMayThrowException] attribute DOMString name;
-    [ImplementationReturnType=IDBKeyPath] readonly attribute any keyPath;
+    readonly attribute IDBKeyPath? keyPath;
     readonly attribute DOMStringList indexNames;
     readonly attribute IDBTransaction transaction;
     readonly attribute boolean autoIncrement;
@@ -45,10 +49,10 @@
     [CallWith=ScriptState, MayThrowException] IDBRequest getKey(IDBKeyRange? key);
     [CallWith=ScriptState, MayThrowException] IDBRequest getKey(any key);
     [CallWith=ScriptState, MayThrowException] IDBRequest clear();
-    [CallWith=ScriptState, MayThrowException] IDBRequest openCursor(optional IDBKeyRange? range = null, optional DOMString direction = "next");
-    [CallWith=ScriptState, MayThrowException] IDBRequest openCursor(any key, optional DOMString direction = "next");
-    [CallWith=ScriptState, MayThrowException] IDBRequest openKeyCursor(optional IDBKeyRange? range = null, optional DOMString direction = "next");
-    [CallWith=ScriptState, MayThrowException] IDBRequest openKeyCursor(any key, optional DOMString direction = "next");
+    [CallWith=ScriptState, MayThrowException] IDBRequest openCursor(optional IDBKeyRange? range = null, optional IDBCursorDirection direction = "next");
+    [CallWith=ScriptState, MayThrowException] IDBRequest openCursor(any key, optional IDBCursorDirection direction = "next");
+    [CallWith=ScriptState, MayThrowException] IDBRequest openKeyCursor(optional IDBKeyRange? range = null, optional IDBCursorDirection direction = "next");
+    [CallWith=ScriptState, MayThrowException] IDBRequest openKeyCursor(any key, optional IDBCursorDirection direction = "next");
     [CallWith=ScriptState, MayThrowException] IDBRequest getAll(optional IDBKeyRange? range = null, [EnforceRange] optional unsigned long count);
     [CallWith=ScriptState, MayThrowException] IDBRequest getAll(any key,  [EnforceRange] optional unsigned long count);
     [CallWith=ScriptState, MayThrowException] IDBRequest getAllKeys(optional IDBKeyRange? range = null, [EnforceRange] optional unsigned long count);

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBOpenDBRequest.cpp (210147 => 210148)


--- trunk/Source/WebCore/Modules/indexeddb/IDBOpenDBRequest.cpp	2016-12-25 23:57:40 UTC (rev 210147)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBOpenDBRequest.cpp	2016-12-26 01:33:33 UTC (rev 210148)
@@ -136,7 +136,7 @@
     ASSERT(currentThread() == originThreadID());
 
     setResult(IDBDatabase::create(*scriptExecutionContext(), connectionProxy(), resultData));
-    m_isDone = true;
+    m_readyState = ReadyState::Done;
 
     enqueueEvent(IDBRequestCompletionEvent::create(eventNames().successEvent, false, false, *this));
 }
@@ -157,7 +157,7 @@
     LOG(IndexedDB, "IDBOpenDBRequest::onUpgradeNeeded() - current version is %" PRIu64 ", new is %" PRIu64, oldVersion, newVersion);
 
     setResult(WTFMove(database));
-    m_isDone = true;
+    m_readyState = ReadyState::Done;
     m_transaction = WTFMove(transaction);
     m_transaction->addRequest(*this);
 
@@ -172,7 +172,7 @@
 
     LOG(IndexedDB, "IDBOpenDBRequest::onDeleteDatabaseSuccess() - current version is %" PRIu64, oldVersion);
 
-    m_isDone = true;
+    m_readyState = ReadyState::Done;
     setResultToUndefined();
 
     enqueueEvent(IDBVersionChangeEvent::create(oldVersion, 0, eventNames().successEvent));

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBRequest.cpp (210147 => 210148)


--- trunk/Source/WebCore/Modules/indexeddb/IDBRequest.cpp	2016-12-25 23:57:40 UTC (rev 210147)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBRequest.cpp	2016-12-26 01:33:33 UTC (rev 210148)
@@ -48,7 +48,7 @@
 #include "ScriptExecutionContext.h"
 #include "ThreadSafeDataBuffer.h"
 #include <heap/StrongInlines.h>
-#include <wtf/NeverDestroyed.h>
+#include <wtf/Variant.h>
 
 using namespace JSC;
 
@@ -101,13 +101,16 @@
     : IDBActiveDOMObject(&context)
     , m_transaction(&transaction)
     , m_resourceIdentifier(transaction.connectionProxy())
-    , m_objectStoreSource(cursor.objectStore())
-    , m_indexSource(cursor.index())
     , m_pendingCursor(&cursor)
     , m_connectionProxy(transaction.database().connectionProxy())
 {
     suspendIfNeeded();
 
+    WTF::switchOn(cursor.source(),
+        [this] (const RefPtr<IDBIndex>& index) { this->m_indexSource = index; },
+        [this] (const RefPtr<IDBObjectStore>& objectStore) { this->m_objectStoreSource = objectStore; }
+    );
+
     cursor.setRequest(*this);
 }
 
@@ -150,12 +153,24 @@
 {
     ASSERT(currentThread() == originThreadID());
 
-    if (!m_isDone)
+    if (!isDone())
         return Exception { IDBDatabaseException::InvalidStateError, ASCIILiteral("Failed to read the 'error' property from 'IDBRequest': The request has not finished.") };
 
     return m_domError.get();
 }
 
+std::optional<IDBRequest::Source> IDBRequest::source() const
+{
+    if (m_cursorSource)
+        return Source { m_cursorSource };
+    if (m_indexSource)
+        return Source { m_indexSource };
+    if (m_objectStoreSource)
+        return Source { m_objectStoreSource };
+
+    return std::nullopt;
+}
+
 void IDBRequest::setSource(IDBCursor& cursor)
 {
     ASSERT(currentThread() == originThreadID());
@@ -186,15 +201,6 @@
     return m_shouldExposeTransactionToDOM ? m_transaction : nullptr;
 }
 
-const String& IDBRequest::readyState() const
-{
-    ASSERT(currentThread() == originThreadID());
-
-    static NeverDestroyed<String> pendingString(ASCIILiteral("pending"));
-    static NeverDestroyed<String> doneString(ASCIILiteral("done"));
-    return m_isDone ? doneString : pendingString;
-}
-
 uint64_t IDBRequest::sourceObjectStoreIdentifier() const
 {
     ASSERT(currentThread() == originThreadID());
@@ -292,7 +298,7 @@
     ASSERT(!m_contextStopped);
 
     if (event.type() != eventNames().blockedEvent)
-        m_isDone = true;
+        m_readyState = ReadyState::Done;
 
     Vector<RefPtr<EventTarget>> targets;
     targets.append(this);
@@ -457,7 +463,7 @@
 void IDBRequest::willIterateCursor(IDBCursor& cursor)
 {
     ASSERT(currentThread() == originThreadID());
-    ASSERT(m_isDone);
+    ASSERT(isDone());
     ASSERT(scriptExecutionContext());
     ASSERT(m_transaction);
     ASSERT(!m_pendingCursor);
@@ -467,7 +473,7 @@
     m_pendingCursor = &cursor;
     m_hasPendingActivity = true;
     clearResult();
-    m_isDone = false;
+    m_readyState = ReadyState::Pending;
     m_domError = nullptr;
     m_idbError = { };
 
@@ -499,7 +505,7 @@
 {
     ASSERT(currentThread() == originThreadID());
 
-    m_isDone = true;
+    m_readyState = ReadyState::Done;
 
     m_idbError = resultData.error();
     if (!m_idbError.isNull())

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBRequest.h (210147 => 210148)


--- trunk/Source/WebCore/Modules/indexeddb/IDBRequest.h	2016-12-25 23:57:40 UTC (rev 210147)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBRequest.h	2016-12-26 01:33:33 UTC (rev 210148)
@@ -70,14 +70,18 @@
     IDBCursor* cursorResult() const { return m_cursorResult.get(); }
     IDBDatabase* databaseResult() const { return m_databaseResult.get(); }
     JSC::JSValue scriptResult() const { return m_scriptResult.get(); }
+
+    using Source = Variant<RefPtr<IDBObjectStore>, RefPtr<IDBIndex>, RefPtr<IDBCursor>>;
+    std::optional<Source> source() const;
+
     ExceptionOr<DOMError*> error() const;
-    IDBObjectStore* objectStoreSource() const { return m_objectStoreSource.get(); }
-    IDBIndex* indexSource() const { return m_indexSource.get(); }
-    IDBCursor* cursorSource() const { return m_cursorSource.get(); }
+
     RefPtr<IDBTransaction> transaction() const;
-    const String& readyState() const;
+    
+    enum class ReadyState { Pending, Done };
+    ReadyState readyState() const { return m_readyState; }
 
-    bool isDone() const { return m_isDone; }
+    bool isDone() const { return m_readyState == ReadyState::Done; }
 
     uint64_t sourceObjectStoreIdentifier() const;
     uint64_t sourceIndexIdentifier() const;
@@ -122,7 +126,7 @@
 
     // FIXME: Protected data members aren't great for maintainability.
     // Consider adding protected helper functions and making these private.
-    bool m_isDone { false };
+    ReadyState m_readyState { ReadyState::Pending };
     RefPtr<IDBTransaction> m_transaction;
     bool m_shouldExposeTransactionToDOM { true };
     RefPtr<DOMError> m_domError;

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBRequest.idl (210147 => 210148)


--- trunk/Source/WebCore/Modules/indexeddb/IDBRequest.idl	2016-12-25 23:57:40 UTC (rev 210147)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBRequest.idl	2016-12-26 01:33:33 UTC (rev 210148)
@@ -34,12 +34,17 @@
     GenerateIsReachable=Impl,
     SkipVTableValidation,
 ] interface IDBRequest : EventTarget {
-    [CustomGetter] readonly attribute any result;
+    [CustomGetter, GetterMayThrowException] readonly attribute any result;
     [GetterMayThrowException] readonly attribute DOMError? error;
-    [CustomGetter] readonly attribute any source;
+    readonly attribute (IDBObjectStore or IDBIndex or IDBCursor)? source;
     readonly attribute IDBTransaction transaction;
-    readonly attribute DOMString readyState;
+    readonly attribute IDBRequestReadyState readyState;
 
     attribute EventHandler onsuccess;
     attribute EventHandler onerror;
 };
+
+enum IDBRequestReadyState {
+    "pending",
+    "done"
+};

Modified: trunk/Source/WebCore/Modules/indexeddb/IndexedDB.h (210147 => 210148)


--- trunk/Source/WebCore/Modules/indexeddb/IndexedDB.h	2016-12-25 23:57:40 UTC (rev 210147)
+++ trunk/Source/WebCore/Modules/indexeddb/IndexedDB.h	2016-12-26 01:33:33 UTC (rev 210148)
@@ -40,10 +40,10 @@
 };
 
 enum class CursorDirection {
-    Next = 0,
-    NextNoDuplicate = 1,
-    Prev = 2,
-    PrevNoDuplicate = 3,
+    Next,
+    Nextunique,
+    Prev,
+    Prevunique,
 };
 const unsigned CursorDirectionMaximum = 3;
 

Modified: trunk/Source/WebCore/Modules/indexeddb/server/MemoryIndexCursor.cpp (210147 => 210148)


--- trunk/Source/WebCore/Modules/indexeddb/server/MemoryIndexCursor.cpp	2016-12-25 23:57:40 UTC (rev 210147)
+++ trunk/Source/WebCore/Modules/indexeddb/server/MemoryIndexCursor.cpp	2016-12-26 01:33:33 UTC (rev 210148)
@@ -151,13 +151,13 @@
         case IndexedDB::CursorDirection::Next:
             m_currentIterator = valueStore->find(m_currentKey, m_currentPrimaryKey);
             break;
-        case IndexedDB::CursorDirection::NextNoDuplicate:
+        case IndexedDB::CursorDirection::Nextunique:
             m_currentIterator = valueStore->find(m_currentKey, true);
             break;
         case IndexedDB::CursorDirection::Prev:
             m_currentIterator = valueStore->reverseFind(m_currentKey, m_currentPrimaryKey, m_info.duplicity());
             break;
-        case IndexedDB::CursorDirection::PrevNoDuplicate:
+        case IndexedDB::CursorDirection::Prevunique:
             m_currentIterator = valueStore->reverseFind(m_currentKey, m_info.duplicity(), true);
             break;
         }

Modified: trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBCursor.cpp (210147 => 210148)


--- trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBCursor.cpp	2016-12-25 23:57:40 UTC (rev 210147)
+++ trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBCursor.cpp	2016-12-26 01:33:33 UTC (rev 210148)
@@ -132,7 +132,7 @@
         builder.append('<');
 
     builder.appendLiteral(" CAST(? AS TEXT) ORDER BY key");
-    if (cursorDirection == IndexedDB::CursorDirection::Prev || cursorDirection == IndexedDB::CursorDirection::PrevNoDuplicate)
+    if (cursorDirection == IndexedDB::CursorDirection::Prev || cursorDirection == IndexedDB::CursorDirection::Prevunique)
         builder.appendLiteral(" DESC");
 
     builder.appendLiteral(", value");
@@ -164,7 +164,7 @@
 
     builder.appendLiteral(" CAST(? AS TEXT) ORDER BY key");
 
-    if (cursorDirection == IndexedDB::CursorDirection::Prev || cursorDirection == IndexedDB::CursorDirection::PrevNoDuplicate)
+    if (cursorDirection == IndexedDB::CursorDirection::Prev || cursorDirection == IndexedDB::CursorDirection::Prevunique)
         builder.appendLiteral(" DESC");
 
     builder.append(';');
@@ -221,7 +221,7 @@
     m_statementNeedsReset = true;
     ASSERT(!m_fetchedRecords.isEmpty());
 
-    if (m_cursorDirection == IndexedDB::CursorDirection::Next || m_cursorDirection == IndexedDB::CursorDirection::NextNoDuplicate) {
+    if (m_cursorDirection == IndexedDB::CursorDirection::Next || m_cursorDirection == IndexedDB::CursorDirection::Nextunique) {
         m_currentLowerKey = m_fetchedRecords.first().record.key;
         if (!m_keyRange.lowerOpen) {
             m_keyRange.lowerOpen = true;
@@ -366,7 +366,7 @@
 
     m_fetchedRecords.append({ });
 
-    bool isUnique = m_cursorDirection == IndexedDB::CursorDirection::NextNoDuplicate || m_cursorDirection == IndexedDB::CursorDirection::PrevNoDuplicate;
+    bool isUnique = m_cursorDirection == IndexedDB::CursorDirection::Nextunique || m_cursorDirection == IndexedDB::CursorDirection::Prevunique;
     if (!isUnique)
         return fetchNextRecord(m_fetchedRecords.last());
 
@@ -509,7 +509,7 @@
             return false;
 
         // Search for the next key >= the target if the cursor is a Next cursor, or the next key <= if the cursor is a Previous cursor.
-        if (m_cursorDirection == IndexedDB::CursorDirection::Next || m_cursorDirection == IndexedDB::CursorDirection::NextNoDuplicate) {
+        if (m_cursorDirection == IndexedDB::CursorDirection::Next || m_cursorDirection == IndexedDB::CursorDirection::Nextunique) {
             if (m_fetchedRecords.first().record.key.compare(targetKey) >= 0)
                 break;
         } else if (m_fetchedRecords.first().record.key.compare(targetKey) <= 0)
@@ -524,7 +524,7 @@
                 return false;
 
             // Search for the next primary key >= the primary target if the cursor is a Next cursor, or the next key <= if the cursor is a Previous cursor.
-            if (m_cursorDirection == IndexedDB::CursorDirection::Next || m_cursorDirection == IndexedDB::CursorDirection::NextNoDuplicate) {
+            if (m_cursorDirection == IndexedDB::CursorDirection::Next || m_cursorDirection == IndexedDB::CursorDirection::Nextunique) {
                 if (m_fetchedRecords.first().record.primaryKey.compare(targetPrimaryKey) >= 0)
                     break;
             } else if (m_fetchedRecords.first().record.primaryKey.compare(targetPrimaryKey) <= 0)

Modified: trunk/Source/WebCore/Modules/indexeddb/shared/IDBCursorInfo.cpp (210147 => 210148)


--- trunk/Source/WebCore/Modules/indexeddb/shared/IDBCursorInfo.cpp	2016-12-25 23:57:40 UTC (rev 210147)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/IDBCursorInfo.cpp	2016-12-26 01:33:33 UTC (rev 210148)
@@ -86,12 +86,12 @@
 
 bool IDBCursorInfo::isDirectionForward() const
 {
-    return m_direction == IndexedDB::CursorDirection::Next || m_direction == IndexedDB::CursorDirection::NextNoDuplicate;
+    return m_direction == IndexedDB::CursorDirection::Next || m_direction == IndexedDB::CursorDirection::Nextunique;
 }
 
 CursorDuplicity IDBCursorInfo::duplicity() const
 {
-    return m_direction == IndexedDB::CursorDirection::NextNoDuplicate || m_direction == IndexedDB::CursorDirection::PrevNoDuplicate ? CursorDuplicity::NoDuplicates : CursorDuplicity::Duplicates;
+    return m_direction == IndexedDB::CursorDirection::Nextunique || m_direction == IndexedDB::CursorDirection::Prevunique ? CursorDuplicity::NoDuplicates : CursorDuplicity::Duplicates;
 }
 
 IDBCursorInfo IDBCursorInfo::isolatedCopy() const

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (210147 => 210148)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2016-12-25 23:57:40 UTC (rev 210147)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2016-12-26 01:33:33 UTC (rev 210148)
@@ -2820,6 +2820,9 @@
 		7C3A91E61C963B8800D1A7E3 /* ClipboardAccessPolicy.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C3A91E51C963B8800D1A7E3 /* ClipboardAccessPolicy.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		7C3B79711908757B00B47A2D /* UserMessageHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C3B796F1908757B00B47A2D /* UserMessageHandler.cpp */; };
 		7C3B79721908757B00B47A2D /* UserMessageHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C3B79701908757B00B47A2D /* UserMessageHandler.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		7C3D8EEB1E0B15A70023B084 /* IDBCursorDirection.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C3D8EE91E0B15A70023B084 /* IDBCursorDirection.h */; };
+		7C3D8EEF1E0B21430023B084 /* JSIDBCursorDirection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C3D8EED1E0B21430023B084 /* JSIDBCursorDirection.cpp */; };
+		7C3D8EF01E0B21430023B084 /* JSIDBCursorDirection.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C3D8EEE1E0B21430023B084 /* JSIDBCursorDirection.h */; };
 		7C3E510A18DF8F3500C112F7 /* HTMLConverter.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C3E510818DF8F3500C112F7 /* HTMLConverter.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		7C3E510B18DF8F3500C112F7 /* HTMLConverter.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7C3E510918DF8F3500C112F7 /* HTMLConverter.mm */; };
 		7C3F01C11C8E5ABA00ADD962 /* UserContentProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C3F01C01C8E5AB100ADD962 /* UserContentProvider.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -2896,6 +2899,7 @@
 		7CD0BA051B8F79C9005CEBBE /* ActiveDOMCallbackMicrotask.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CD0BA031B8F79C9005CEBBE /* ActiveDOMCallbackMicrotask.h */; };
 		7CD494CC1A86EB1D000A87EC /* RenderAttachment.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CD494CA1A86EB1D000A87EC /* RenderAttachment.cpp */; };
 		7CD494CD1A86EB1D000A87EC /* RenderAttachment.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CD494CB1A86EB1D000A87EC /* RenderAttachment.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		7CD686561E0E26D300E97AA7 /* JSIDBRequestCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CD686551E0E26D300E97AA7 /* JSIDBRequestCustom.cpp */; };
 		7CE58D4A1DD64A5B00128552 /* SVGPoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE58D491DD64A5B00128552 /* SVGPoint.h */; };
 		7CE58D4E1DD694FE00128552 /* SVGRectTraits.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE58D4D1DD694FE00128552 /* SVGRectTraits.h */; };
 		7CE58D501DD69A1E00128552 /* SVGNumber.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE58D4F1DD69A1E00128552 /* SVGNumber.h */; };
@@ -3340,7 +3344,6 @@
 		934CC10A0EDB223900A658F2 /* ScriptSourceCode.h in Headers */ = {isa = PBXBuildFile; fileRef = 934CC1090EDB223900A658F2 /* ScriptSourceCode.h */; };
 		934D9BA50B8C116B007B42A9 /* WebCoreNSStringExtras.mm in Sources */ = {isa = PBXBuildFile; fileRef = 934D9BA40B8C116B007B42A9 /* WebCoreNSStringExtras.mm */; };
 		934D9BA70B8C1175007B42A9 /* WebCoreNSStringExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = 934D9BA60B8C1175007B42A9 /* WebCoreNSStringExtras.h */; settings = {ATTRIBUTES = (Private, ); }; };
-		934F31B51CC0737200DB43DC /* JSIDBRequestCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 934F31B41CC0737200DB43DC /* JSIDBRequestCustom.cpp */; };
 		934F71380D5A6EFF00018D69 /* AuthenticationChallengeBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 934F71370D5A6EFF00018D69 /* AuthenticationChallengeBase.cpp */; };
 		934F713A0D5A6F1000018D69 /* AuthenticationChallengeBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 934F71390D5A6F1000018D69 /* AuthenticationChallengeBase.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		934F713C0D5A6F1900018D69 /* ResourceErrorBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 934F713B0D5A6F1900018D69 /* ResourceErrorBase.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -10303,6 +10306,10 @@
 		7C3A91E51C963B8800D1A7E3 /* ClipboardAccessPolicy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ClipboardAccessPolicy.h; sourceTree = "<group>"; };
 		7C3B796F1908757B00B47A2D /* UserMessageHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UserMessageHandler.cpp; sourceTree = "<group>"; };
 		7C3B79701908757B00B47A2D /* UserMessageHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserMessageHandler.h; sourceTree = "<group>"; };
+		7C3D8EE91E0B15A70023B084 /* IDBCursorDirection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBCursorDirection.h; sourceTree = "<group>"; };
+		7C3D8EEA1E0B15A70023B084 /* IDBCursorDirection.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = IDBCursorDirection.idl; sourceTree = "<group>"; };
+		7C3D8EED1E0B21430023B084 /* JSIDBCursorDirection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIDBCursorDirection.cpp; sourceTree = "<group>"; };
+		7C3D8EEE1E0B21430023B084 /* JSIDBCursorDirection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSIDBCursorDirection.h; sourceTree = "<group>"; };
 		7C3E510818DF8F3500C112F7 /* HTMLConverter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLConverter.h; sourceTree = "<group>"; };
 		7C3E510918DF8F3500C112F7 /* HTMLConverter.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = HTMLConverter.mm; sourceTree = "<group>"; };
 		7C3F01BF1C8E5AB100ADD962 /* UserContentProvider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UserContentProvider.cpp; sourceTree = "<group>"; };
@@ -10401,6 +10408,7 @@
 		7CD0BA031B8F79C9005CEBBE /* ActiveDOMCallbackMicrotask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ActiveDOMCallbackMicrotask.h; sourceTree = "<group>"; };
 		7CD494CA1A86EB1D000A87EC /* RenderAttachment.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderAttachment.cpp; sourceTree = "<group>"; };
 		7CD494CB1A86EB1D000A87EC /* RenderAttachment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderAttachment.h; sourceTree = "<group>"; };
+		7CD686551E0E26D300E97AA7 /* JSIDBRequestCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIDBRequestCustom.cpp; sourceTree = "<group>"; };
 		7CE58D491DD64A5B00128552 /* SVGPoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPoint.h; sourceTree = "<group>"; };
 		7CE58D4D1DD694FE00128552 /* SVGRectTraits.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGRectTraits.h; sourceTree = "<group>"; };
 		7CE58D4F1DD69A1E00128552 /* SVGNumber.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGNumber.h; sourceTree = "<group>"; };
@@ -10937,7 +10945,6 @@
 		934CC1090EDB223900A658F2 /* ScriptSourceCode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptSourceCode.h; sourceTree = "<group>"; };
 		934D9BA40B8C116B007B42A9 /* WebCoreNSStringExtras.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCoreNSStringExtras.mm; sourceTree = "<group>"; };
 		934D9BA60B8C1175007B42A9 /* WebCoreNSStringExtras.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebCoreNSStringExtras.h; sourceTree = "<group>"; };
-		934F31B41CC0737200DB43DC /* JSIDBRequestCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIDBRequestCustom.cpp; sourceTree = "<group>"; };
 		934F71370D5A6EFF00018D69 /* AuthenticationChallengeBase.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = AuthenticationChallengeBase.cpp; sourceTree = "<group>"; };
 		934F71390D5A6F1000018D69 /* AuthenticationChallengeBase.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = AuthenticationChallengeBase.h; sourceTree = "<group>"; };
 		934F713B0D5A6F1900018D69 /* ResourceErrorBase.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ResourceErrorBase.h; sourceTree = "<group>"; };
@@ -18337,6 +18344,7 @@
 				ADEC78F718EE5308001315C2 /* JSElementCustom.h */,
 				BCEFAF4D0C317E6900FA81F6 /* JSEventCustom.cpp */,
 				E34EE49F1DC2D57500EAA9D3 /* JSEventCustom.h */,
+				512BDB4C1C46B0FF006494DF /* JSIDBCursorCustom.cpp */,
 				5141298D1C5FD7E90059E714 /* JSIDBCursorWithValueCustom.cpp */,
 				5141299A1C6C166D0059E714 /* JSIDBIndexCustom.cpp */,
 				511EF2CE17F0FDF100E4FA16 /* JSIDBObjectStoreCustom.cpp */,
@@ -19276,6 +19284,8 @@
 				51645B541B9F88E800F789CE /* IDBCursor.cpp */,
 				51645B411B9F889B00F789CE /* IDBCursor.h */,
 				51D71977181106DF0016DC51 /* IDBCursor.idl */,
+				7C3D8EE91E0B15A70023B084 /* IDBCursorDirection.h */,
+				7C3D8EEA1E0B15A70023B084 /* IDBCursorDirection.idl */,
 				51645B421B9F889B00F789CE /* IDBCursorWithValue.cpp */,
 				51645B431B9F889B00F789CE /* IDBCursorWithValue.h */,
 				51D7197B181106DF0016DC51 /* IDBCursorWithValue.idl */,
@@ -20701,6 +20711,8 @@
 				B59DD697119029E5007E9684 /* JSDatabaseCallback.h */,
 				511EF2A917F0FC4800E4FA16 /* JSIDBCursor.cpp */,
 				81BE20A811F4B66F00915DFA /* JSIDBCursor.h */,
+				7C3D8EED1E0B21430023B084 /* JSIDBCursorDirection.cpp */,
+				7C3D8EEE1E0B21430023B084 /* JSIDBCursorDirection.h */,
 				511EF2AA17F0FC4800E4FA16 /* JSIDBCursorWithValue.cpp */,
 				511EF2AB17F0FC4800E4FA16 /* JSIDBCursorWithValue.h */,
 				511EF2AC17F0FC4800E4FA16 /* JSIDBDatabase.cpp */,
@@ -22126,8 +22138,7 @@
 				BC17F9650B64EBB8004A65CB /* JSHTMLSelectElementCustom.cpp */,
 				AB4CB4EA0B8BDA3D009F40B0 /* JSHTMLSelectElementCustom.h */,
 				D6F7960C166FFECE0076DD18 /* JSHTMLTemplateElementCustom.cpp */,
-				512BDB4C1C46B0FF006494DF /* JSIDBCursorCustom.cpp */,
-				934F31B41CC0737200DB43DC /* JSIDBRequestCustom.cpp */,
+				7CD686551E0E26D300E97AA7 /* JSIDBRequestCustom.cpp */,
 				7A74ECBC101839DA00BF939E /* JSInspectorFrontendHostCustom.cpp */,
 				BCE1C43F0D9830F4003B02F2 /* JSLocationCustom.cpp */,
 				2D9BF7481DBFDDF8007A7D99 /* JSMediaKeySessionCustom.cpp */,
@@ -25657,6 +25668,7 @@
 				41885B9311B6FDA6003383BB /* FormSubmission.h in Headers */,
 				A853123D11D0471B00D4D077 /* FragmentScriptingPermission.h in Headers */,
 				65BF022F0974816300C43196 /* Frame.h in Headers */,
+				7C3D8EF01E0B21430023B084 /* JSIDBCursorDirection.h in Headers */,
 				974A862314B7ADBB003FDC76 /* FrameDestructionObserver.h in Headers */,
 				656D373C0ADBA5DE00A4554D /* FrameLoader.h in Headers */,
 				656D373E0ADBA5DE00A4554D /* FrameLoaderClient.h in Headers */,
@@ -26122,6 +26134,7 @@
 				FC54D05816A7676E00575E4D /* JSCSSSupportsRule.h in Headers */,
 				9BD4E9171C462872005065BC /* JSCustomElementInterface.h in Headers */,
 				9BE6710C1D5AEB2500345514 /* JSCustomElementRegistry.h in Headers */,
+				7C3D8EEB1E0B15A70023B084 /* IDBCursorDirection.h in Headers */,
 				E4778B80115A581A00B5D372 /* JSCustomEvent.h in Headers */,
 				E10B937C0B73C00A003ED890 /* JSCustomXPathNSResolver.h in Headers */,
 				1AE82F900CAAFA9D002237AE /* JSDatabase.h in Headers */,
@@ -30073,7 +30086,6 @@
 				511EF2D117F0FDF100E4FA16 /* JSIDBObjectStoreCustom.cpp in Sources */,
 				511EF2C817F0FD3500E4FA16 /* JSIDBOpenDBRequest.cpp in Sources */,
 				511EF2C917F0FD3500E4FA16 /* JSIDBRequest.cpp in Sources */,
-				934F31B51CC0737200DB43DC /* JSIDBRequestCustom.cpp in Sources */,
 				511EF2CA17F0FD3500E4FA16 /* JSIDBTransaction.cpp in Sources */,
 				51E269331DD3BC4E006B6A58 /* JSIDBTransactionCustom.cpp in Sources */,
 				838EF53B1DC14A7C008F0C39 /* JSIDBTransactionMode.cpp in Sources */,
@@ -31049,6 +31061,7 @@
 				7EE6847512D26E7000E79415 /* ResourceLoaderCFNet.cpp in Sources */,
 				51AA3F6F0BD5AA9E00892971 /* ResourceLoaderMac.mm in Sources */,
 				51EE7B3A1AA5123100F92B21 /* ResourceLoadInfo.cpp in Sources */,
+				7C3D8EEF1E0B21430023B084 /* JSIDBCursorDirection.cpp in Sources */,
 				973E325610883B7C005BC493 /* ResourceLoadNotifier.cpp in Sources */,
 				6B693A341C51A95D00B03BEF /* ResourceLoadObserver.cpp in Sources */,
 				7A929CA61C598A9E004DF226 /* ResourceLoadStatistics.cpp in Sources */,
@@ -31736,6 +31749,7 @@
 				49C7B9D91042D32F0009D447 /* WebGLRenderbuffer.cpp in Sources */,
 				49C7B9DF1042D32F0009D447 /* WebGLRenderingContext.cpp in Sources */,
 				D3F3D3691A69B7B00059FC2B /* WebGLRenderingContextBase.cpp in Sources */,
+				7CD686561E0E26D300E97AA7 /* JSIDBRequestCustom.cpp in Sources */,
 				6F995A211A7078B100A735F4 /* WebGLSampler.cpp in Sources */,
 				49C7B9E21042D32F0009D447 /* WebGLShader.cpp in Sources */,
 				A08CF154152B77B3009C5775 /* WebGLShaderPrecisionFormat.cpp in Sources */,

Modified: trunk/Source/WebCore/bindings/generic/IDLTypes.h (210147 => 210148)


--- trunk/Source/WebCore/bindings/generic/IDLTypes.h	2016-12-25 23:57:40 UTC (rev 210147)
+++ trunk/Source/WebCore/bindings/generic/IDLTypes.h	2016-12-26 01:33:33 UTC (rev 210148)
@@ -170,10 +170,6 @@
     static double extractValueFromNullable(double value) { return value; }
 };
 
-template<typename T> struct IDLSerializedScriptValue : IDLWrapper<T> { };
-template<typename T> struct IDLEventListener : IDLWrapper<T> { };
-template<typename T> struct IDLXPathNSResolver : IDLWrapper<T> { };
-
 struct IDLJSON : IDLType<String> { 
     using ParameterType = const String&;
 
@@ -183,6 +179,11 @@
     template <typename U> static U&& extractValueFromNullable(U&& value) { return std::forward<U>(value); }
 };
 
+template<typename T> struct IDLSerializedScriptValue : IDLWrapper<T> { };
+template<typename T> struct IDLEventListener : IDLWrapper<T> { };
+template<typename T> struct IDLXPathNSResolver : IDLWrapper<T> { };
+template<typename T> struct IDLIDBKey : IDLWrapper<T> { };
+
 // Non-WebIDL convenience type aliases
 
 using IDLBufferSource = IDLUnion<IDLInterface<JSC::ArrayBufferView>, IDLInterface<JSC::ArrayBuffer>>;

Modified: trunk/Source/WebCore/bindings/js/JSDOMConvert.h (210147 => 210148)


--- trunk/Source/WebCore/bindings/js/JSDOMConvert.h	2016-12-25 23:57:40 UTC (rev 210147)
+++ trunk/Source/WebCore/bindings/js/JSDOMConvert.h	2016-12-26 01:33:33 UTC (rev 210148)
@@ -26,6 +26,7 @@
 #pragma once
 
 #include "BufferSource.h"
+#include "IDBBindingUtilities.h"
 #include "IDLTypes.h"
 #include "JSDOMBinding.h"
 #include <runtime/JSONObject.h>
@@ -210,6 +211,31 @@
 };
 
 // MARK: -
+// MARK: Any type
+
+template<> struct Converter<IDLAny> : DefaultConverter<IDLAny> {
+    static JSC::JSValue convert(JSC::ExecState&, JSC::JSValue value)
+    {
+        return value;
+    }
+};
+
+template<> struct JSConverter<IDLAny> {
+    static constexpr bool needsState = false;
+    static constexpr bool needsGlobalObject = false;
+
+    static JSC::JSValue convert(const JSC::JSValue& value)
+    {
+        return value;
+    }
+
+    static JSC::JSValue convert(const JSC::Strong<JSC::Unknown>& value)
+    {
+        return value.get();
+    }
+};
+
+// MARK: -
 // MARK: Nullable type
 
 namespace Detail {
@@ -434,26 +460,6 @@
 };
 
 // MARK: -
-// MARK: Any type
-
-template<> struct Converter<IDLAny> : DefaultConverter<IDLAny> {
-    static JSC::JSValue convert(JSC::ExecState&, JSC::JSValue value)
-    {
-        return value;
-    }
-};
-
-template<> struct JSConverter<IDLAny> {
-    static constexpr bool needsState = false;
-    static constexpr bool needsGlobalObject = false;
-
-    static JSC::JSValue convert(const JSC::JSValue& value)
-    {
-        return value;
-    }
-};
-
-// MARK: -
 // MARK: Integer types
 
 template<> struct Converter<IDLByte> : DefaultConverter<IDLByte> {
@@ -1463,6 +1469,26 @@
 };
 
 // MARK: -
+// MARK: IDLJSON type
+
+template<> struct Converter<IDLJSON> : DefaultConverter<IDLJSON> {
+    static String convert(JSC::ExecState& state, JSC::JSValue value)
+    {
+        return JSC::JSONStringify(&state, value, 0);
+    }
+};
+
+template<> struct JSConverter<IDLJSON> {
+    static constexpr bool needsState = true;
+    static constexpr bool needsGlobalObject = false;
+
+    static JSC::JSValue convert(JSC::ExecState& state, const String& value)
+    {
+        return JSC::JSONParse(&state, value);
+    }
+};
+
+// MARK: -
 // MARK: SerializedScriptValue type
 
 template<typename T> struct Converter<IDLSerializedScriptValue<T>> : DefaultConverter<IDLSerializedScriptValue<T>> {
@@ -1537,22 +1563,16 @@
 };
 
 // MARK: -
-// MARK: IDLJSON type
+// MARK: IDLIDBKey type
 
-template<> struct Converter<IDLJSON> : DefaultConverter<IDLJSON> {
-    static String convert(JSC::ExecState& state, JSC::JSValue value)
-    {
-        return JSC::JSONStringify(&state, value, 0);
-    }
-};
-
-template<> struct JSConverter<IDLJSON> {
+template<typename T> struct JSConverter<IDLIDBKey<T>> {
     static constexpr bool needsState = true;
-    static constexpr bool needsGlobalObject = false;
+    static constexpr bool needsGlobalObject = true;
 
-    static JSC::JSValue convert(JSC::ExecState& state, const String& value)
+    template <typename U>
+    static JSC::JSValue convert(JSC::ExecState& state, JSDOMGlobalObject& globalObject, U&& value)
     {
-        return JSC::JSONParse(&state, value);
+        return toJS(state, globalObject, std::forward<U>(value));
     }
 };
 

Modified: trunk/Source/WebCore/bindings/js/JSIDBCursorCustom.cpp (210147 => 210148)


--- trunk/Source/WebCore/bindings/js/JSIDBCursorCustom.cpp	2016-12-25 23:57:40 UTC (rev 210147)
+++ trunk/Source/WebCore/bindings/js/JSIDBCursorCustom.cpp	2016-12-26 01:33:33 UTC (rev 210148)
@@ -30,8 +30,6 @@
 
 #include "JSDOMBinding.h"
 #include "JSIDBCursorWithValue.h"
-#include "JSIDBIndex.h"
-#include "JSIDBObjectStore.h"
 
 using namespace JSC;
 
@@ -44,14 +42,6 @@
         visitor.addOpaqueRoot(request);
 }
 
-JSValue JSIDBCursor::source(ExecState& state) const
-{
-    auto& cursor = wrapped();
-    if (auto* index = cursor.index())
-        return toJS(&state, globalObject(), *index);
-    return toJS(&state, globalObject(), cursor.objectStore());
-}
-
 JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<IDBCursor>&& cursor)
 {
     if (is<IDBCursorWithValue>(cursor))

Modified: trunk/Source/WebCore/bindings/js/JSIDBRequestCustom.cpp (210147 => 210148)


--- trunk/Source/WebCore/bindings/js/JSIDBRequestCustom.cpp	2016-12-25 23:57:40 UTC (rev 210147)
+++ trunk/Source/WebCore/bindings/js/JSIDBRequestCustom.cpp	2016-12-26 01:33:33 UTC (rev 210148)
@@ -45,6 +45,7 @@
         propagateException(state, Exception { IDBDatabaseException::InvalidStateError, ASCIILiteral("Failed to read the 'result' property from 'IDBRequest': The request has not finished.") });
         return { };
     }
+
     if (auto* cursor = request.cursorResult())
         return toJS(&state, globalObject(), *cursor);
     if (auto* database = request.databaseResult())
@@ -54,16 +55,6 @@
     return jsNull();
 }
 
-JSValue JSIDBRequest::source(ExecState& state) const
-{
-    auto& request = wrapped();
-    if (auto* cursor = request.cursorSource())
-        return toJS(&state, globalObject(), *cursor);
-    if (auto* index = request.indexSource())
-        return toJS(&state, globalObject(), *index);
-    return toJS(&state, globalObject(), request.objectStoreSource());
-}
-
 } // namespace WebCore
 
 #endif // ENABLE(INDEXED_DATABASE)

Modified: trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm (210147 => 210148)


--- trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm	2016-12-25 23:57:40 UTC (rev 210147)
+++ trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm	2016-12-26 01:33:33 UTC (rev 210148)
@@ -876,14 +876,15 @@
     return 1 if $object->IsStringType($type);
     return 1 if $object->IsTypedArrayType($type);
     return 1 if $type->isUnion;
+    return 1 if $type->name eq "BufferSource";
+    return 1 if $type->name eq "EventListener";
+    return 1 if $type->name eq "IDBKey";
+    return 1 if $type->name eq "JSON";
+    return 1 if $type->name eq "Promise";
+    return 1 if $type->name eq "SerializedScriptValue";
+    return 1 if $type->name eq "XPathNSResolver";
     return 1 if $type->name eq "any";
     return 1 if $type->name eq "object";
-    return 1 if $type->name eq "BufferSource";
-    return 1 if $type->name eq "Promise";
-    return 1 if $type->name eq "XPathNSResolver";    
-    return 1 if $type->name eq "EventListener";    
-    return 1 if $type->name eq "SerializedScriptValue";    
-    return 1 if $type->name eq "JSON";    
 
     return 0;
 }

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (210147 => 210148)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2016-12-25 23:57:40 UTC (rev 210147)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2016-12-26 01:33:33 UTC (rev 210148)
@@ -5107,10 +5107,11 @@
         
         # Non-WebIDL extensions
         "Date" => "IDLDate",
+        "EventListener" => "IDLEventListener<JSEventListener>",
+        "IDBKey" => "IDLIDBKey<IDBKey>",
+        "JSON" => "IDLJSON",
         "SerializedScriptValue" => "IDLSerializedScriptValue<SerializedScriptValue>",
-        "EventListener" => "IDLEventListener<JSEventListener>",
         "XPathNSResolver" => "IDLXPathNSResolver<XPathNSResolver>",
-        "JSON" => "IDLJSON",
 
         # Convenience type aliases
         "BufferSource" => "IDLBufferSource",
@@ -5333,9 +5334,10 @@
     return 1 if $codeGenerator->IsInterfaceType($type);
     return 1 if $codeGenerator->IsTypedArrayType($type);
     return 1 if $type->name eq "Date";
+    return 1 if $type->name eq "IDBKey";
+    return 1 if $type->name eq "JSON";
     return 1 if $type->name eq "SerializedScriptValue";
     return 1 if $type->name eq "XPathNSResolver";
-    return 1 if $type->name eq "JSON";
 
     return 0;
 }
@@ -5351,6 +5353,7 @@
     return 1 if $codeGenerator->IsDictionaryType($type);
     return 1 if $codeGenerator->IsInterfaceType($type);
     return 1 if $codeGenerator->IsTypedArrayType($type);
+    return 1 if $type->name eq "IDBKey";
     return 1 if $type->name eq "SerializedScriptValue";
     return 1 if $type->name eq "XPathNSResolver";
 
@@ -5402,14 +5405,6 @@
         $value = "std::max(0, $value)";
     }
 
-    if ($type->name eq "any") {
-        my $returnType = $context->extendedAttributes->{ImplementationReturnType};
-        if (defined $returnType and ($returnType eq "IDBKeyPath" or $returnType eq "IDBKey")) {
-            AddToImplIncludes("IDBBindingUtilities.h", $conditional);
-            return "toJS($stateReference, $globalObjectReference, $value)";
-        }
-    }
-
     AddToImplIncludesForIDLType($type, $conditional);
     AddToImplIncludes("JSDOMConvert.h", $conditional);
 

Modified: trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt (210147 => 210148)


--- trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt	2016-12-25 23:57:40 UTC (rev 210147)
+++ trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt	2016-12-26 01:33:33 UTC (rev 210148)
@@ -71,7 +71,6 @@
 Immutable
 ImplementedAs=*
 ImplementationLacksVTable
-ImplementationReturnType=*
 ImplicitThis
 InterfaceName=*
 IsImmutablePrototypeExoticObject

Modified: trunk/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp (210147 => 210148)


--- trunk/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp	2016-12-25 23:57:40 UTC (rev 210147)
+++ trunk/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp	2016-12-26 01:33:33 UTC (rev 210148)
@@ -127,6 +127,7 @@
             m_executableWithDatabase->requestCallback().sendFailure("Could not get result in callback.");
             return;
         }
+
         auto databaseResult = request.databaseResult();
         if (!databaseResult) {
             m_executableWithDatabase->requestCallback().sendFailure("Unexpected result type.");
@@ -365,10 +366,12 @@
             m_requestCallback->sendFailure("Could not get result in callback.");
             return;
         }
+        
         if (request.scriptResult()) {
             end(false);
             return;
         }
+        
         auto* cursorResult = request.cursorResult();
         if (!cursorResult) {
             end(false);
@@ -468,13 +471,13 @@
             }
 
             if (exec) {
-                auto result = idbIndex->openCursor(*exec, m_idbKeyRange.get(), IDBCursor::directionNext());
+                auto result = idbIndex->openCursor(*exec, m_idbKeyRange.get(), IDBCursorDirection::Next);
                 if (!result.hasException())
                     idbRequest = result.releaseReturnValue();
             }
         } else {
             if (exec) {
-                auto result = idbObjectStore->openCursor(*exec, m_idbKeyRange.get(), IDBCursor::directionNext());
+                auto result = idbObjectStore->openCursor(*exec, m_idbKeyRange.get(), IDBCursorDirection::Next);
                 if (!result.hasException())
                     idbRequest = result.releaseReturnValue();
             }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to