[WebIDL] Remove (most) custom bindings for the IndexedDB code
authorweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 26 Dec 2016 01:33:33 +0000 (01:33 +0000)
committerweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 26 Dec 2016 01:33:33 +0000 (01:33 +0000)
commit1d472e3b9b78cc29950e250747420bd002edb873
treeb257d482e3874e6bf9aec3d5469a13010df3054f
parenta983d0022293820865921da73535473649f66db5
[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.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210148 268f45cc-cd09-0410-ab3c-d52691b4dbfc
40 files changed:
LayoutTests/ChangeLog
LayoutTests/storage/indexeddb/exceptions-expected.txt
LayoutTests/storage/indexeddb/exceptions-private-expected.txt
LayoutTests/storage/indexeddb/index-basics-expected.txt
LayoutTests/storage/indexeddb/index-basics-private-expected.txt
LayoutTests/storage/indexeddb/index-basics-workers-expected.txt
LayoutTests/storage/indexeddb/objectstore-cursor-expected.txt
LayoutTests/storage/indexeddb/objectstore-cursor-private-expected.txt
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/DerivedSources.make
Source/WebCore/Modules/indexeddb/IDBCursor.cpp
Source/WebCore/Modules/indexeddb/IDBCursor.h
Source/WebCore/Modules/indexeddb/IDBCursor.idl
Source/WebCore/Modules/indexeddb/IDBCursorDirection.h [new file with mode: 0644]
Source/WebCore/Modules/indexeddb/IDBCursorDirection.idl [new file with mode: 0644]
Source/WebCore/Modules/indexeddb/IDBIndex.cpp
Source/WebCore/Modules/indexeddb/IDBIndex.h
Source/WebCore/Modules/indexeddb/IDBIndex.idl
Source/WebCore/Modules/indexeddb/IDBKeyRange.idl
Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp
Source/WebCore/Modules/indexeddb/IDBObjectStore.h
Source/WebCore/Modules/indexeddb/IDBObjectStore.idl
Source/WebCore/Modules/indexeddb/IDBOpenDBRequest.cpp
Source/WebCore/Modules/indexeddb/IDBRequest.cpp
Source/WebCore/Modules/indexeddb/IDBRequest.h
Source/WebCore/Modules/indexeddb/IDBRequest.idl
Source/WebCore/Modules/indexeddb/IndexedDB.h
Source/WebCore/Modules/indexeddb/server/MemoryIndexCursor.cpp
Source/WebCore/Modules/indexeddb/server/SQLiteIDBCursor.cpp
Source/WebCore/Modules/indexeddb/shared/IDBCursorInfo.cpp
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/bindings/generic/IDLTypes.h
Source/WebCore/bindings/js/JSDOMConvert.h
Source/WebCore/bindings/js/JSIDBCursorCustom.cpp
Source/WebCore/bindings/js/JSIDBRequestCustom.cpp
Source/WebCore/bindings/scripts/CodeGenerator.pm
Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
Source/WebCore/bindings/scripts/IDLAttributes.txt
Source/WebCore/inspector/InspectorIndexedDBAgent.cpp