Title: [207847] trunk/Source/WebCore
- Revision
- 207847
- Author
- [email protected]
- Date
- 2016-10-25 15:01:55 -0700 (Tue, 25 Oct 2016)
Log Message
IDBDatabase.transaction() should take a union in parameter
https://bugs.webkit.org/show_bug.cgi?id=163966
Reviewed by Sam Weinig.
IDBDatabase.transaction() should take a union in parameter:
- https://www.w3.org/TR/IndexedDB/#widl-IDBDatabase-transaction-IDBTransaction-DOMString-sequence-DOMString--storeNames-IDBTransactionMode-mode
No new tests, no expected Web-exposed behavior change.
* Modules/indexeddb/IDBDatabase.cpp:
(WebCore::IDBDatabase::transaction):
* Modules/indexeddb/IDBDatabase.h:
* Modules/indexeddb/IDBDatabase.idl:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (207846 => 207847)
--- trunk/Source/WebCore/ChangeLog 2016-10-25 21:48:19 UTC (rev 207846)
+++ trunk/Source/WebCore/ChangeLog 2016-10-25 22:01:55 UTC (rev 207847)
@@ -1,3 +1,20 @@
+2016-10-25 Chris Dumez <[email protected]>
+
+ IDBDatabase.transaction() should take a union in parameter
+ https://bugs.webkit.org/show_bug.cgi?id=163966
+
+ Reviewed by Sam Weinig.
+
+ IDBDatabase.transaction() should take a union in parameter:
+ - https://www.w3.org/TR/IndexedDB/#widl-IDBDatabase-transaction-IDBTransaction-DOMString-sequence-DOMString--storeNames-IDBTransactionMode-mode
+
+ No new tests, no expected Web-exposed behavior change.
+
+ * Modules/indexeddb/IDBDatabase.cpp:
+ (WebCore::IDBDatabase::transaction):
+ * Modules/indexeddb/IDBDatabase.h:
+ * Modules/indexeddb/IDBDatabase.idl:
+
2016-10-25 Brady Eidson <[email protected]>
IndexedDB 2.0: Support IDBObjectStore openKeyCursor.
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp (207846 => 207847)
--- trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp 2016-10-25 21:48:19 UTC (rev 207846)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp 2016-10-25 22:01:55 UTC (rev 207847)
@@ -160,7 +160,7 @@
return m_versionChangeTransaction->createObjectStore(info);
}
-ExceptionOr<Ref<IDBTransaction>> IDBDatabase::transaction(const Vector<String>& objectStores, const String& modeString)
+ExceptionOr<Ref<IDBTransaction>> IDBDatabase::transaction(StringOrVectorOfStrings&& storeNames, const String& modeString)
{
LOG(IndexedDB, "IDBDatabase::transaction");
@@ -169,6 +169,12 @@
if (m_closePending)
return Exception { IDBDatabaseException::InvalidStateError, ASCIILiteral("Failed to execute 'transaction' on 'IDBDatabase': The database connection is closing.") };
+ Vector<String> objectStores;
+ if (WTF::holds_alternative<Vector<String>>(storeNames))
+ objectStores = WTFMove(WTF::get<Vector<String>>(storeNames));
+ else
+ objectStores.append(WTFMove(WTF::get<String>(storeNames)));
+
if (objectStores.isEmpty())
return Exception { IDBDatabaseException::InvalidAccessError, ASCIILiteral("Failed to execute 'transaction' on 'IDBDatabase': The storeNames parameter was empty.") };
@@ -198,15 +204,6 @@
return WTFMove(transaction);
}
-ExceptionOr<Ref<IDBTransaction>> IDBDatabase::transaction(const String& objectStore, const String& mode)
-{
- ASSERT(currentThread() == originThreadID());
-
- Vector<String> objectStores(1);
- objectStores[0] = objectStore;
- return transaction(objectStores, mode);
-}
-
ExceptionOr<void> IDBDatabase::deleteObjectStore(const String& objectStoreName)
{
LOG(IndexedDB, "IDBDatabase::deleteObjectStore");
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.h (207846 => 207847)
--- trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.h 2016-10-25 21:48:19 UTC (rev 207846)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.h 2016-10-25 22:01:55 UTC (rev 207847)
@@ -63,8 +63,8 @@
ExceptionOr<Ref<IDBObjectStore>> createObjectStore(const String& name, ObjectStoreParameters&&);
- ExceptionOr<Ref<IDBTransaction>> transaction(const Vector<String>&, const String& mode);
- ExceptionOr<Ref<IDBTransaction>> transaction(const String&, const String& mode);
+ using StringOrVectorOfStrings = WTF::Variant<String, Vector<String>>;
+ ExceptionOr<Ref<IDBTransaction>> transaction(StringOrVectorOfStrings&& storeNames, const String& mode);
ExceptionOr<void> deleteObjectStore(const String& name);
void close();
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.idl (207846 => 207847)
--- trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.idl 2016-10-25 21:48:19 UTC (rev 207846)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.idl 2016-10-25 22:01:55 UTC (rev 207847)
@@ -36,8 +36,10 @@
[MayThrowException] IDBObjectStore createObjectStore(DOMString name, optional IDBObjectStoreParameters parameters);
[MayThrowException] void deleteObjectStore(DOMString name);
- [MayThrowException] IDBTransaction transaction(DOMString storeName, optional DOMString mode = "readonly");
- [MayThrowException] IDBTransaction transaction(sequence<DOMString> storeNames, optional DOMString mode = "readonly");
+
+ // FIXME: mode parameter type should be a IDBTransactionMode string enumeration.
+ [MayThrowException] IDBTransaction transaction((DOMString or sequence<DOMString>) storeNames, optional DOMString mode = "readonly");
+
// FIXME: This is not part of the spec, but is needed for compatibility.
// See https://github.com/w3c/IndexedDB/issues/85
[MayThrowException] IDBTransaction transaction(DOMStringList storeNames, optional DOMString mode = "readonly");
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes