Diff
Modified: trunk/LayoutTests/ChangeLog (207936 => 207937)
--- trunk/LayoutTests/ChangeLog 2016-10-27 05:51:29 UTC (rev 207936)
+++ trunk/LayoutTests/ChangeLog 2016-10-27 06:00:11 UTC (rev 207937)
@@ -1,3 +1,19 @@
+2016-10-26 Chris Dumez <[email protected]>
+
+ [Web IDL] Add support for having string enumerations in their own IDL file
+ https://bugs.webkit.org/show_bug.cgi?id=164025
+
+ Reviewed by Darin Adler.
+
+ Rebaseline existign tests as the exception messages differ slightly.
+
+ * storage/indexeddb/exceptions-expected.txt:
+ * storage/indexeddb/exceptions-private-expected.txt:
+ * storage/indexeddb/modern/idbdatabase-transaction-failures-expected.txt:
+ * storage/indexeddb/modern/idbdatabase-transaction-failures-private-expected.txt:
+ * storage/indexeddb/transaction-basics-expected.txt:
+ * storage/indexeddb/transaction-basics-private-expected.txt:
+
2016-10-26 Yusuke Suzuki <[email protected]>
[DOMJIT] Implement Node::ownerDocument
Modified: trunk/LayoutTests/storage/indexeddb/exceptions-expected.txt (207936 => 207937)
--- trunk/LayoutTests/storage/indexeddb/exceptions-expected.txt 2016-10-27 05:51:29 UTC (rev 207936)
+++ trunk/LayoutTests/storage/indexeddb/exceptions-expected.txt 2016-10-27 06:00:11 UTC (rev 207937)
@@ -105,7 +105,7 @@
The value for the mode parameter is invalid.
Expecting TypeError exception from db.transaction('store', 'invalid-mode')
PASS Exception was thrown.
-PASS db.transaction('store', 'invalid-mode') threw TypeError: Failed to execute 'transaction' on 'IDBDatabase': The mode provided ('invalid-mode') is not one of 'readonly' or 'readwrite'.
+PASS db.transaction('store', 'invalid-mode') threw TypeError: Argument 2 ('mode') to IDBDatabase.transaction must be one of: "readonly", "readwrite", "versionchange"
The function was called with an empty list of store names
Expecting exception from db.transaction([])
PASS Exception was thrown.
Modified: trunk/LayoutTests/storage/indexeddb/exceptions-private-expected.txt (207936 => 207937)
--- trunk/LayoutTests/storage/indexeddb/exceptions-private-expected.txt 2016-10-27 05:51:29 UTC (rev 207936)
+++ trunk/LayoutTests/storage/indexeddb/exceptions-private-expected.txt 2016-10-27 06:00:11 UTC (rev 207937)
@@ -105,7 +105,7 @@
The value for the mode parameter is invalid.
Expecting TypeError exception from db.transaction('store', 'invalid-mode')
PASS Exception was thrown.
-PASS db.transaction('store', 'invalid-mode') threw TypeError: Failed to execute 'transaction' on 'IDBDatabase': The mode provided ('invalid-mode') is not one of 'readonly' or 'readwrite'.
+PASS db.transaction('store', 'invalid-mode') threw TypeError: Argument 2 ('mode') to IDBDatabase.transaction must be one of: "readonly", "readwrite", "versionchange"
The function was called with an empty list of store names
Expecting exception from db.transaction([])
PASS Exception was thrown.
Modified: trunk/LayoutTests/storage/indexeddb/modern/idbdatabase-transaction-failures-expected.txt (207936 => 207937)
--- trunk/LayoutTests/storage/indexeddb/modern/idbdatabase-transaction-failures-expected.txt 2016-10-27 05:51:29 UTC (rev 207936)
+++ trunk/LayoutTests/storage/indexeddb/modern/idbdatabase-transaction-failures-expected.txt 2016-10-27 06:00:11 UTC (rev 207937)
@@ -12,8 +12,8 @@
versionchange transaction completed
Failed to start a transaction with an empty set of object stores - InvalidAccessError (DOM IDBDatabase Exception 15): Failed to execute 'transaction' on 'IDBDatabase': The storeNames parameter was empty.
Failed to start a transaction to a nonexistent object store - NotFoundError (DOM IDBDatabase Exception 8): Failed to execute 'transaction' on 'IDBDatabase': One of the specified object stores was not found.
-Failed to start a transaction with an invalid mode - TypeError: Failed to execute 'transaction' on 'IDBDatabase': The mode provided ('blahblah') is not one of 'readonly' or 'readwrite'.
-Failed to explicitly start a versionchange transaction - TypeError: Failed to execute 'transaction' on 'IDBDatabase': The mode provided ('versionchange') is not one of 'readonly' or 'readwrite'.
+Failed to start a transaction with an invalid mode - TypeError: Argument 2 ('mode') to IDBDatabase.transaction must be one of: "readonly", "readwrite", "versionchange"
+Failed to explicitly start a versionchange transaction - TypeError: Type error
Failed to explicitly start a transaction with the close pending flag set - InvalidStateError (DOM IDBDatabase Exception 11): Failed to execute 'transaction' on 'IDBDatabase': The database connection is closing.
PASS successfullyParsed is true
Modified: trunk/LayoutTests/storage/indexeddb/modern/idbdatabase-transaction-failures-private-expected.txt (207936 => 207937)
--- trunk/LayoutTests/storage/indexeddb/modern/idbdatabase-transaction-failures-private-expected.txt 2016-10-27 05:51:29 UTC (rev 207936)
+++ trunk/LayoutTests/storage/indexeddb/modern/idbdatabase-transaction-failures-private-expected.txt 2016-10-27 06:00:11 UTC (rev 207937)
@@ -12,8 +12,8 @@
versionchange transaction completed
Failed to start a transaction with an empty set of object stores - InvalidAccessError (DOM IDBDatabase Exception 15): Failed to execute 'transaction' on 'IDBDatabase': The storeNames parameter was empty.
Failed to start a transaction to a nonexistent object store - NotFoundError (DOM IDBDatabase Exception 8): Failed to execute 'transaction' on 'IDBDatabase': One of the specified object stores was not found.
-Failed to start a transaction with an invalid mode - TypeError: Failed to execute 'transaction' on 'IDBDatabase': The mode provided ('blahblah') is not one of 'readonly' or 'readwrite'.
-Failed to explicitly start a versionchange transaction - TypeError: Failed to execute 'transaction' on 'IDBDatabase': The mode provided ('versionchange') is not one of 'readonly' or 'readwrite'.
+Failed to start a transaction with an invalid mode - TypeError: Argument 2 ('mode') to IDBDatabase.transaction must be one of: "readonly", "readwrite", "versionchange"
+Failed to explicitly start a versionchange transaction - TypeError: Type error
Failed to explicitly start a transaction with the close pending flag set - InvalidStateError (DOM IDBDatabase Exception 11): Failed to execute 'transaction' on 'IDBDatabase': The database connection is closing.
PASS successfullyParsed is true
Modified: trunk/LayoutTests/storage/indexeddb/transaction-basics-expected.txt (207936 => 207937)
--- trunk/LayoutTests/storage/indexeddb/transaction-basics-expected.txt 2016-10-27 05:51:29 UTC (rev 207936)
+++ trunk/LayoutTests/storage/indexeddb/transaction-basics-expected.txt 2016-10-27 06:00:11 UTC (rev 207937)
@@ -229,7 +229,7 @@
Verify that specifying an invalid mode raises an exception
Expecting TypeError exception from db.transaction(['storeName'], 'lsakjdf')
PASS Exception was thrown.
-PASS db.transaction(['storeName'], 'lsakjdf') threw TypeError: Failed to execute 'transaction' on 'IDBDatabase': The mode provided ('lsakjdf') is not one of 'readonly' or 'readwrite'.
+PASS db.transaction(['storeName'], 'lsakjdf') threw TypeError: Argument 2 ('mode') to IDBDatabase.transaction must be one of: "readonly", "readwrite", "versionchange"
Test that null and undefined are treated as strings
Expecting exception from db.transaction(null)
Modified: trunk/LayoutTests/storage/indexeddb/transaction-basics-private-expected.txt (207936 => 207937)
--- trunk/LayoutTests/storage/indexeddb/transaction-basics-private-expected.txt 2016-10-27 05:51:29 UTC (rev 207936)
+++ trunk/LayoutTests/storage/indexeddb/transaction-basics-private-expected.txt 2016-10-27 06:00:11 UTC (rev 207937)
@@ -229,7 +229,7 @@
Verify that specifying an invalid mode raises an exception
Expecting TypeError exception from db.transaction(['storeName'], 'lsakjdf')
PASS Exception was thrown.
-PASS db.transaction(['storeName'], 'lsakjdf') threw TypeError: Failed to execute 'transaction' on 'IDBDatabase': The mode provided ('lsakjdf') is not one of 'readonly' or 'readwrite'.
+PASS db.transaction(['storeName'], 'lsakjdf') threw TypeError: Argument 2 ('mode') to IDBDatabase.transaction must be one of: "readonly", "readwrite", "versionchange"
Test that null and undefined are treated as strings
Expecting exception from db.transaction(null)
Modified: trunk/Source/WebCore/CMakeLists.txt (207936 => 207937)
--- trunk/Source/WebCore/CMakeLists.txt 2016-10-27 05:51:29 UTC (rev 207936)
+++ trunk/Source/WebCore/CMakeLists.txt 2016-10-27 06:00:11 UTC (rev 207937)
@@ -199,6 +199,7 @@
Modules/indexeddb/IDBOpenDBRequest.idl
Modules/indexeddb/IDBRequest.idl
Modules/indexeddb/IDBTransaction.idl
+ Modules/indexeddb/IDBTransactionMode.idl
Modules/indexeddb/IDBVersionChangeEvent.idl
Modules/indexeddb/WorkerGlobalScopeIndexedDatabase.idl
Modified: trunk/Source/WebCore/ChangeLog (207936 => 207937)
--- trunk/Source/WebCore/ChangeLog 2016-10-27 05:51:29 UTC (rev 207936)
+++ trunk/Source/WebCore/ChangeLog 2016-10-27 06:00:11 UTC (rev 207937)
@@ -1,3 +1,113 @@
+2016-10-26 Chris Dumez <[email protected]>
+
+ [Web IDL] Add support for having string enumerations in their own IDL file
+ https://bugs.webkit.org/show_bug.cgi?id=164025
+
+ Reviewed by Darin Adler.
+
+ Add support for having string enumerations in their own IDL file to facilitate
+ sharing them. Use this new support to implement IDBTransactionMode enumeration
+ for IndexedDB:
+ - https://www.w3.org/TR/IndexedDB/#idl-def-IDBTransactionMode
+
+ No new tests, rebaselined existing tests.
+
+ * CMakeLists.txt:
+ * DerivedSources.cpp:
+ * DerivedSources.make:
+ * Modules/indexeddb/IDBDatabase.cpp:
+ (WebCore::IDBDatabase::transaction):
+ (WebCore::IDBDatabase::startVersionChangeTransaction):
+ * Modules/indexeddb/IDBDatabase.h:
+ * Modules/indexeddb/IDBDatabase.idl:
+ * Modules/indexeddb/IDBOpenDBRequest.cpp:
+ (WebCore::IDBOpenDBRequest::onUpgradeNeeded):
+ * Modules/indexeddb/IDBTransaction.cpp:
+ (WebCore::IDBTransaction::IDBTransaction):
+ * Modules/indexeddb/IDBTransaction.h:
+ (WebCore::IDBTransaction::mode):
+ (WebCore::IDBTransaction::isVersionChange):
+ (WebCore::IDBTransaction::isReadOnly):
+ * Modules/indexeddb/IDBTransaction.idl:
+ * Modules/indexeddb/IDBTransactionMode.h: Added.
+ * Modules/indexeddb/IDBTransactionMode.idl: Copied from Source/WebCore/Modules/indexeddb/IDBTransaction.idl.
+ * Modules/indexeddb/IndexedDB.h:
+ * Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp:
+ (WebCore::IDBServer::MemoryBackingStoreTransaction::MemoryBackingStoreTransaction):
+ (WebCore::IDBServer::MemoryBackingStoreTransaction::objectStoreRenamed):
+ (WebCore::IDBServer::MemoryBackingStoreTransaction::indexRenamed):
+ (WebCore::IDBServer::MemoryBackingStoreTransaction::abort):
+ * Modules/indexeddb/server/MemoryBackingStoreTransaction.h:
+ (WebCore::IDBServer::MemoryBackingStoreTransaction::isVersionChange):
+ (WebCore::IDBServer::MemoryBackingStoreTransaction::isWriting):
+ * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
+ (WebCore::IDBServer::SQLiteIDBBackingStore::beginTransaction):
+ (WebCore::IDBServer::SQLiteIDBBackingStore::abortTransaction):
+ (WebCore::IDBServer::SQLiteIDBBackingStore::commitTransaction):
+ (WebCore::IDBServer::SQLiteIDBBackingStore::createObjectStore):
+ (WebCore::IDBServer::SQLiteIDBBackingStore::deleteObjectStore):
+ (WebCore::IDBServer::SQLiteIDBBackingStore::renameObjectStore):
+ (WebCore::IDBServer::SQLiteIDBBackingStore::clearObjectStore):
+ (WebCore::IDBServer::SQLiteIDBBackingStore::createIndex):
+ (WebCore::IDBServer::SQLiteIDBBackingStore::deleteIndex):
+ (WebCore::IDBServer::SQLiteIDBBackingStore::renameIndex):
+ (WebCore::IDBServer::SQLiteIDBBackingStore::deleteRecord):
+ (WebCore::IDBServer::SQLiteIDBBackingStore::deleteRange):
+ (WebCore::IDBServer::SQLiteIDBBackingStore::addRecord):
+ (WebCore::IDBServer::SQLiteIDBBackingStore::generateKeyNumber):
+ (WebCore::IDBServer::SQLiteIDBBackingStore::revertGeneratedKeyNumber):
+ (WebCore::IDBServer::SQLiteIDBBackingStore::maybeUpdateKeyGeneratorNumber):
+ * Modules/indexeddb/server/SQLiteIDBTransaction.cpp:
+ (WebCore::IDBServer::SQLiteIDBTransaction::begin):
+ * Modules/indexeddb/server/SQLiteIDBTransaction.h:
+ (WebCore::IDBServer::SQLiteIDBTransaction::mode):
+ * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
+ (WebCore::IDBServer::UniqueIDBDatabase::enqueueTransaction):
+ (WebCore::IDBServer::UniqueIDBDatabase::takeNextRunnableTransaction):
+ * Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp:
+ (WebCore::IDBServer::UniqueIDBDatabaseConnection::establishTransaction):
+ * Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp:
+ (WebCore::IDBServer::UniqueIDBDatabaseTransaction::UniqueIDBDatabaseTransaction):
+ (WebCore::IDBServer::UniqueIDBDatabaseTransaction::originalDatabaseInfo):
+ (WebCore::IDBServer::UniqueIDBDatabaseTransaction::isVersionChange):
+ (WebCore::IDBServer::UniqueIDBDatabaseTransaction::isReadOnly):
+ * Modules/indexeddb/shared/IDBTransactionInfo.cpp:
+ (WebCore::IDBTransactionInfo::clientTransaction):
+ (WebCore::IDBTransactionInfo::versionChange):
+ (WebCore::IDBTransactionInfo::loggingString):
+ * Modules/indexeddb/shared/IDBTransactionInfo.h:
+ (WebCore::IDBTransactionInfo::mode):
+ * WebCore.xcodeproj/project.pbxproj:
+ * bindings/scripts/CodeGenerator.pm:
+ (ProcessDocument):
+ (IsEnumType):
+ (GetEnumByName):
+ (IsExternalEnumType):
+ (ValidEnumValues):
+ * bindings/scripts/CodeGeneratorJS.pm:
+ (GenerateEnumeration):
+ (AddToImplIncludesForIDLType):
+ (GetEnumerationClassName):
+ (GenerateEnumerationHeader):
+ (GenerateEnumerationImplementation):
+ (GenerateEnumerationImplementationContent):
+ (GenerateEnumerationsImplementationContent):
+ (GenerateEnumerationHeaderContent):
+ (GenerateEnumerationsHeaderContent):
+ * bindings/scripts/test/JS/JSTestObj.cpp:
+ (WebCore::jsTestObjPrototypeFunctionMethodWithEnumArgCaller):
+ (WebCore::jsTestObjPrototypeFunctionMethodWithStandaloneEnumArg):
+ (WebCore::jsTestObjPrototypeFunctionMethodWithStandaloneEnumArgCaller):
+ * bindings/scripts/test/JS/JSTestStandaloneEnumeration.cpp: Added.
+ (WebCore::convertEnumerationToJS):
+ (WebCore::parseEnumeration<TestStandaloneEnumeration>):
+ (WebCore::convertEnumeration<TestStandaloneEnumeration>):
+ (WebCore::expectedEnumerationValues<TestStandaloneEnumeration>):
+ * bindings/scripts/test/JS/JSTestStandaloneEnumeration.h: Added.
+ * bindings/scripts/test/TestObj.idl:
+ * bindings/scripts/test/TestStandaloneEnumeration.idl: Copied from Source/WebCore/Modules/indexeddb/IDBTransaction.idl.
+ * inspector/InspectorIndexedDBAgent.cpp:
+
2016-10-26 Dan Bernstein <[email protected]>
Fixed the WebKit2 build.
Modified: trunk/Source/WebCore/DerivedSources.cpp (207936 => 207937)
--- trunk/Source/WebCore/DerivedSources.cpp 2016-10-27 05:51:29 UTC (rev 207936)
+++ trunk/Source/WebCore/DerivedSources.cpp 2016-10-27 06:00:11 UTC (rev 207937)
@@ -308,6 +308,7 @@
#include "JSIDBOpenDBRequest.cpp"
#include "JSIDBRequest.cpp"
#include "JSIDBTransaction.cpp"
+#include "JSIDBTransactionMode.cpp"
#include "JSIDBVersionChangeEvent.cpp"
#endif
#include "JSImageData.cpp"
Modified: trunk/Source/WebCore/DerivedSources.make (207936 => 207937)
--- trunk/Source/WebCore/DerivedSources.make 2016-10-27 05:51:29 UTC (rev 207936)
+++ trunk/Source/WebCore/DerivedSources.make 2016-10-27 06:00:11 UTC (rev 207937)
@@ -115,6 +115,7 @@
$(WebCore)/Modules/indexeddb/IDBOpenDBRequest.idl \
$(WebCore)/Modules/indexeddb/IDBRequest.idl \
$(WebCore)/Modules/indexeddb/IDBTransaction.idl \
+ $(WebCore)/Modules/indexeddb/IDBTransactionMode.idl \
$(WebCore)/Modules/indexeddb/IDBVersionChangeEvent.idl \
$(WebCore)/Modules/indexeddb/WorkerGlobalScopeIndexedDatabase.idl \
$(WebCore)/Modules/indieui/UIRequestEvent.idl \
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp (207936 => 207937)
--- trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp 2016-10-27 05:51:29 UTC (rev 207936)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp 2016-10-27 06:00:11 UTC (rev 207937)
@@ -160,7 +160,7 @@
return m_versionChangeTransaction->createObjectStore(info);
}
-ExceptionOr<Ref<IDBTransaction>> IDBDatabase::transaction(StringOrVectorOfStrings&& storeNames, const String& modeString)
+ExceptionOr<Ref<IDBTransaction>> IDBDatabase::transaction(StringOrVectorOfStrings&& storeNames, IDBTransactionMode mode)
{
LOG(IndexedDB, "IDBDatabase::transaction");
@@ -178,11 +178,7 @@
if (objectStores.isEmpty())
return Exception { IDBDatabaseException::InvalidAccessError, ASCIILiteral("Failed to execute 'transaction' on 'IDBDatabase': The storeNames parameter was empty.") };
- auto mode = IDBTransaction::stringToMode(modeString);
- if (!mode)
- return Exception { TypeError, "Failed to execute 'transaction' on 'IDBDatabase': The mode provided ('" + modeString + "') is not one of 'readonly' or 'readwrite'." };
-
- if (mode.value() != IndexedDB::TransactionMode::ReadOnly && mode.value() != IndexedDB::TransactionMode::ReadWrite)
+ if (mode != IDBTransactionMode::Readonly && mode != IDBTransactionMode::Readwrite)
return Exception { TypeError };
if (m_versionChangeTransaction && !m_versionChangeTransaction->isFinishedOrFinishing())
@@ -194,7 +190,7 @@
return Exception { IDBDatabaseException::NotFoundError, ASCIILiteral("Failed to execute 'transaction' on 'IDBDatabase': One of the specified object stores was not found.") };
}
- auto info = IDBTransactionInfo::clientTransaction(m_connectionProxy.get(), objectStores, mode.value());
+ auto info = IDBTransactionInfo::clientTransaction(m_connectionProxy.get(), objectStores, mode);
auto transaction = IDBTransaction::create(*this, info);
LOG(IndexedDB, "IDBDatabase::transaction - Added active transaction %s", info.identifier().loggingString().utf8().data());
@@ -326,7 +322,7 @@
ASSERT(currentThread() == originThreadID());
ASSERT(!m_versionChangeTransaction);
- ASSERT(info.mode() == IndexedDB::TransactionMode::VersionChange);
+ ASSERT(info.mode() == IDBTransactionMode::Versionchange);
ASSERT(!m_closePending);
ASSERT(scriptExecutionContext());
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.h (207936 => 207937)
--- trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.h 2016-10-27 05:51:29 UTC (rev 207936)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.h 2016-10-27 06:00:11 UTC (rev 207937)
@@ -35,6 +35,7 @@
#include "IDBConnectionToServer.h"
#include "IDBDatabaseInfo.h"
#include "IDBKeyPath.h"
+#include "IDBTransactionMode.h"
namespace WebCore {
@@ -64,7 +65,7 @@
ExceptionOr<Ref<IDBObjectStore>> createObjectStore(const String& name, ObjectStoreParameters&&);
using StringOrVectorOfStrings = WTF::Variant<String, Vector<String>>;
- ExceptionOr<Ref<IDBTransaction>> transaction(StringOrVectorOfStrings&& storeNames, const String& mode);
+ ExceptionOr<Ref<IDBTransaction>> transaction(StringOrVectorOfStrings&& storeNames, IDBTransactionMode);
ExceptionOr<void> deleteObjectStore(const String& name);
void close();
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.idl (207936 => 207937)
--- trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.idl 2016-10-27 05:51:29 UTC (rev 207936)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.idl 2016-10-27 06:00:11 UTC (rev 207937)
@@ -37,12 +37,11 @@
[MayThrowException] IDBObjectStore createObjectStore(DOMString name, optional IDBObjectStoreParameters parameters);
[MayThrowException] void deleteObjectStore(DOMString name);
- // FIXME: mode parameter type should be a IDBTransactionMode string enumeration.
- [MayThrowException] IDBTransaction transaction((DOMString or sequence<DOMString>) storeNames, optional DOMString mode = "readonly");
+ [MayThrowException] IDBTransaction transaction((DOMString or sequence<DOMString>) storeNames, optional IDBTransactionMode 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");
+ [MayThrowException] IDBTransaction transaction(DOMStringList storeNames, optional IDBTransactionMode mode = "readonly");
void close();
attribute EventHandler onabort;
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBOpenDBRequest.cpp (207936 => 207937)
--- trunk/Source/WebCore/Modules/indexeddb/IDBOpenDBRequest.cpp 2016-10-27 05:51:29 UTC (rev 207936)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBOpenDBRequest.cpp 2016-10-27 06:00:11 UTC (rev 207937)
@@ -148,7 +148,7 @@
Ref<IDBDatabase> database = IDBDatabase::create(*scriptExecutionContext(), connectionProxy(), resultData);
Ref<IDBTransaction> transaction = database->startVersionChangeTransaction(resultData.transactionInfo(), *this);
- ASSERT(transaction->info().mode() == IndexedDB::TransactionMode::VersionChange);
+ ASSERT(transaction->info().mode() == IDBTransactionMode::Versionchange);
ASSERT(transaction->originalDatabaseInfo());
uint64_t oldVersion = transaction->originalDatabaseInfo()->version();
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp (207936 => 207937)
--- trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp 2016-10-27 05:51:29 UTC (rev 207936)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp 2016-10-27 06:00:11 UTC (rev 207937)
@@ -59,63 +59,6 @@
namespace WebCore {
-const AtomicString& IDBTransaction::modeReadOnly()
-{
- static NeverDestroyed<AtomicString> readonly("readonly", AtomicString::ConstructFromLiteral);
- return readonly;
-}
-
-const AtomicString& IDBTransaction::modeReadWrite()
-{
- static NeverDestroyed<AtomicString> readwrite("readwrite", AtomicString::ConstructFromLiteral);
- return readwrite;
-}
-
-const AtomicString& IDBTransaction::modeVersionChange()
-{
- static NeverDestroyed<AtomicString> versionchange("versionchange", AtomicString::ConstructFromLiteral);
- return versionchange;
-}
-
-const AtomicString& IDBTransaction::modeReadOnlyLegacy()
-{
- static NeverDestroyed<AtomicString> readonly("0", AtomicString::ConstructFromLiteral);
- return readonly;
-}
-
-const AtomicString& IDBTransaction::modeReadWriteLegacy()
-{
- static NeverDestroyed<AtomicString> readwrite("1", AtomicString::ConstructFromLiteral);
- return readwrite;
-}
-
-Optional<IndexedDB::TransactionMode> IDBTransaction::stringToMode(const String& modeString)
-{
- if (modeString.isNull() || modeString == IDBTransaction::modeReadOnly())
- return IndexedDB::TransactionMode::ReadOnly;
- if (modeString == IDBTransaction::modeReadWrite())
- return IndexedDB::TransactionMode::ReadWrite;
-
- return Nullopt;
-}
-
-const AtomicString& IDBTransaction::modeToString(IndexedDB::TransactionMode mode)
-{
- switch (mode) {
- case IndexedDB::TransactionMode::ReadOnly:
- return IDBTransaction::modeReadOnly();
-
- case IndexedDB::TransactionMode::ReadWrite:
- return IDBTransaction::modeReadWrite();
-
- case IndexedDB::TransactionMode::VersionChange:
- return IDBTransaction::modeVersionChange();
- }
-
- ASSERT_NOT_REACHED();
- return IDBTransaction::modeReadOnly();
-}
-
Ref<IDBTransaction> IDBTransaction::create(IDBDatabase& database, const IDBTransactionInfo& info)
{
return adoptRef(*new IDBTransaction(database, info, nullptr));
@@ -137,7 +80,7 @@
LOG(IndexedDB, "IDBTransaction::IDBTransaction - %s", m_info.loggingString().utf8().data());
ASSERT(currentThread() == m_database->originThreadID());
- if (m_info.mode() == IndexedDB::TransactionMode::VersionChange) {
+ if (m_info.mode() == IDBTransactionMode::Versionchange) {
ASSERT(m_openDBRequest);
m_openDBRequest->setVersionChangeTransaction(*this);
m_startedOnServer = true;
@@ -183,22 +126,6 @@
return objectStoreNames;
}
-const String& IDBTransaction::mode() const
-{
- ASSERT(currentThread() == m_database->originThreadID());
-
- switch (m_info.mode()) {
- case IndexedDB::TransactionMode::ReadOnly:
- return IDBTransaction::modeReadOnly();
- case IndexedDB::TransactionMode::ReadWrite:
- return IDBTransaction::modeReadWrite();
- case IndexedDB::TransactionMode::VersionChange:
- return IDBTransaction::modeVersionChange();
- }
-
- RELEASE_ASSERT_NOT_REACHED();
-}
-
IDBDatabase* IDBTransaction::db()
{
ASSERT(currentThread() == m_database->originThreadID());
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.h (207936 => 207937)
--- trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.h 2016-10-27 05:51:29 UTC (rev 207936)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.h 2016-10-27 06:00:11 UTC (rev 207937)
@@ -34,6 +34,7 @@
#include "IDBKeyRangeData.h"
#include "IDBOpenDBRequest.h"
#include "IDBTransactionInfo.h"
+#include "IDBTransactionMode.h"
#include "IndexedDB.h"
#include "Timer.h"
#include <wtf/Deque.h>
@@ -64,15 +65,6 @@
class IDBTransaction : public ThreadSafeRefCounted<IDBTransaction>, public EventTargetWithInlineData, public IDBActiveDOMObject {
public:
- static const AtomicString& modeReadOnly();
- static const AtomicString& modeReadWrite();
- static const AtomicString& modeVersionChange();
- static const AtomicString& modeReadOnlyLegacy();
- static const AtomicString& modeReadWriteLegacy();
-
- static Optional<IndexedDB::TransactionMode> stringToMode(const String&);
- static const AtomicString& modeToString(IndexedDB::TransactionMode);
-
static Ref<IDBTransaction> create(IDBDatabase&, const IDBTransactionInfo&);
static Ref<IDBTransaction> create(IDBDatabase&, const IDBTransactionInfo&, IDBOpenDBRequest&);
@@ -80,7 +72,7 @@
// IDBTransaction IDL
Ref<DOMStringList> objectStoreNames() const;
- const String& mode() const;
+ IDBTransactionMode mode() const { return m_info.mode(); }
IDBDatabase* db();
DOMError* error() const;
ExceptionOr<Ref<IDBObjectStore>> objectStore(const String& name);
@@ -110,8 +102,8 @@
void didAbort(const IDBError&);
void didCommit(const IDBError&);
- bool isVersionChange() const { return m_info.mode() == IndexedDB::TransactionMode::VersionChange; }
- bool isReadOnly() const { return m_info.mode() == IndexedDB::TransactionMode::ReadOnly; }
+ bool isVersionChange() const { return mode() == IDBTransactionMode::Versionchange; }
+ bool isReadOnly() const { return mode() == IDBTransactionMode::Readonly; }
bool isActive() const;
Ref<IDBObjectStore> createObjectStore(const IDBObjectStoreInfo&);
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.idl (207936 => 207937)
--- trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.idl 2016-10-27 05:51:29 UTC (rev 207936)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.idl 2016-10-27 06:00:11 UTC (rev 207937)
@@ -31,7 +31,7 @@
SkipVTableValidation,
] interface IDBTransaction : EventTarget {
readonly attribute DOMStringList objectStoreNames;
- readonly attribute DOMString mode;
+ readonly attribute IDBTransactionMode mode;
readonly attribute IDBDatabase db;
readonly attribute DOMError error;
Added: trunk/Source/WebCore/Modules/indexeddb/IDBTransactionMode.h (0 => 207937)
--- trunk/Source/WebCore/Modules/indexeddb/IDBTransactionMode.h (rev 0)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBTransactionMode.h 2016-10-27 06:00:11 UTC (rev 207937)
@@ -0,0 +1,40 @@
+/*
+ * 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
+
+#if ENABLE(INDEXED_DATABASE)
+
+namespace WebCore {
+
+enum class IDBTransactionMode {
+ Readonly,
+ Readwrite,
+ Versionchange
+};
+
+}
+
+#endif
Copied: trunk/Source/WebCore/Modules/indexeddb/IDBTransactionMode.idl (from rev 207935, trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.idl) (0 => 207937)
--- trunk/Source/WebCore/Modules/indexeddb/IDBTransactionMode.idl (rev 0)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBTransactionMode.idl 2016-10-27 06:00:11 UTC (rev 207937)
@@ -0,0 +1,32 @@
+/*
+ * 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 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 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 IDBTransactionMode {
+ "readonly",
+ "readwrite",
+ "versionchange"
+};
Modified: trunk/Source/WebCore/Modules/indexeddb/IndexedDB.h (207936 => 207937)
--- trunk/Source/WebCore/Modules/indexeddb/IndexedDB.h 2016-10-27 05:51:29 UTC (rev 207936)
+++ trunk/Source/WebCore/Modules/indexeddb/IndexedDB.h 2016-10-27 06:00:11 UTC (rev 207937)
@@ -31,13 +31,6 @@
namespace IndexedDB {
-enum class TransactionMode {
- ReadOnly = 0,
- ReadWrite = 1,
- VersionChange = 2,
-};
-const unsigned TransactionModeMaximum = 2;
-
enum class TransactionState {
Active,
Inactive,
Modified: trunk/Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp (207936 => 207937)
--- trunk/Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp 2016-10-27 05:51:29 UTC (rev 207936)
+++ trunk/Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp 2016-10-27 06:00:11 UTC (rev 207937)
@@ -48,7 +48,7 @@
: m_backingStore(backingStore)
, m_info(info)
{
- if (m_info.mode() == IndexedDB::TransactionMode::VersionChange) {
+ if (m_info.mode() == IDBTransactionMode::Versionchange) {
IDBDatabaseInfo info;
auto error = m_backingStore.getOrEstablishDatabaseInfo(info);
if (error.isNull())
@@ -153,7 +153,7 @@
void MemoryBackingStoreTransaction::objectStoreRenamed(MemoryObjectStore& objectStore, const String& oldName)
{
ASSERT(m_objectStores.contains(&objectStore));
- ASSERT(m_info.mode() == IndexedDB::TransactionMode::VersionChange);
+ ASSERT(m_info.mode() == IDBTransactionMode::Versionchange);
// We only care about the first rename in a given transaction, because if the transaction is aborted we want
// to go back to the first 'oldName'
@@ -163,7 +163,7 @@
void MemoryBackingStoreTransaction::indexRenamed(MemoryIndex& index, const String& oldName)
{
ASSERT(m_objectStores.contains(&index.objectStore()));
- ASSERT(m_info.mode() == IndexedDB::TransactionMode::VersionChange);
+ ASSERT(m_info.mode() == IDBTransactionMode::Versionchange);
// We only care about the first rename in a given transaction, because if the transaction is aborted we want
// to go back to the first 'oldName'
@@ -233,7 +233,7 @@
m_deletedObjectStores.clear();
if (m_originalDatabaseInfo) {
- ASSERT(m_info.mode() == IndexedDB::TransactionMode::VersionChange);
+ ASSERT(m_info.mode() == IDBTransactionMode::Versionchange);
m_backingStore.setDatabaseInfo(*m_originalDatabaseInfo);
}
Modified: trunk/Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.h (207936 => 207937)
--- trunk/Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.h 2016-10-27 05:51:29 UTC (rev 207936)
+++ trunk/Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.h 2016-10-27 06:00:11 UTC (rev 207937)
@@ -52,8 +52,8 @@
MemoryBackingStoreTransaction(MemoryIDBBackingStore&, const IDBTransactionInfo&);
~MemoryBackingStoreTransaction();
- bool isVersionChange() const { return m_info.mode() == IndexedDB::TransactionMode::VersionChange; }
- bool isWriting() const { return m_info.mode() != IndexedDB::TransactionMode::ReadOnly; }
+ bool isVersionChange() const { return m_info.mode() == IDBTransactionMode::Versionchange; }
+ bool isWriting() const { return m_info.mode() != IDBTransactionMode::Readonly; }
bool isAborting() const { return m_isAborting; }
const IDBDatabaseInfo& originalDatabaseInfo() const;
Modified: trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp (207936 => 207937)
--- trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp 2016-10-27 05:51:29 UTC (rev 207936)
+++ trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp 2016-10-27 06:00:11 UTC (rev 207937)
@@ -778,7 +778,7 @@
addResult.iterator->value = std::make_unique<SQLiteIDBTransaction>(*this, info);
auto error = addResult.iterator->value->begin(*m_sqliteDB);
- if (error.isNull() && info.mode() == IndexedDB::TransactionMode::VersionChange) {
+ if (error.isNull() && info.mode() == IDBTransactionMode::Versionchange) {
m_originalDatabaseInfoBeforeVersionChange = std::make_unique<IDBDatabaseInfo>(*m_databaseInfo);
SQLiteStatement sql(*m_sqliteDB, ASCIILiteral("UPDATE IDBDatabaseInfo SET value = ? where key = 'DatabaseVersion';"));
@@ -805,7 +805,7 @@
}
- if (transaction->mode() == IndexedDB::TransactionMode::VersionChange) {
+ if (transaction->mode() == IDBTransactionMode::Versionchange) {
ASSERT(m_originalDatabaseInfoBeforeVersionChange);
m_databaseInfo = WTFMove(m_originalDatabaseInfoBeforeVersionChange);
}
@@ -828,7 +828,7 @@
auto error = transaction->commit();
if (!error.isNull()) {
- if (transaction->mode() == IndexedDB::TransactionMode::VersionChange) {
+ if (transaction->mode() == IDBTransactionMode::Versionchange) {
ASSERT(m_originalDatabaseInfoBeforeVersionChange);
m_databaseInfo = WTFMove(m_originalDatabaseInfoBeforeVersionChange);
}
@@ -850,7 +850,7 @@
LOG_ERROR("Attempt to create an object store without an in-progress transaction");
return { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to create an object store without an in-progress transaction") };
}
- if (transaction->mode() != IndexedDB::TransactionMode::VersionChange) {
+ if (transaction->mode() != IDBTransactionMode::Versionchange) {
LOG_ERROR("Attempt to create an object store in a non-version-change transaction");
return { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to create an object store in a non-version-change transaction") };
}
@@ -902,7 +902,7 @@
LOG_ERROR("Attempt to delete an object store without an in-progress transaction");
return { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to delete an object store without an in-progress transaction") };
}
- if (transaction->mode() != IndexedDB::TransactionMode::VersionChange) {
+ if (transaction->mode() != IDBTransactionMode::Versionchange) {
LOG_ERROR("Attempt to delete an object store in a non-version-change transaction");
return { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to delete an object store in a non-version-change transaction") };
}
@@ -994,7 +994,7 @@
LOG_ERROR("Attempt to rename an object store without an in-progress transaction");
return { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to rename an object store without an in-progress transaction") };
}
- if (transaction->mode() != IndexedDB::TransactionMode::VersionChange) {
+ if (transaction->mode() != IDBTransactionMode::Versionchange) {
LOG_ERROR("Attempt to rename an object store in a non-version-change transaction");
return { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to rename an object store in a non-version-change transaction") };
}
@@ -1027,7 +1027,7 @@
LOG_ERROR("Attempt to clear an object store without an in-progress transaction");
return { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to clear an object store without an in-progress transaction") };
}
- if (transaction->mode() == IndexedDB::TransactionMode::ReadOnly) {
+ if (transaction->mode() == IDBTransactionMode::Readonly) {
LOG_ERROR("Attempt to clear an object store in a read-only transaction");
return { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to clear an object store in a read-only transaction") };
}
@@ -1068,7 +1068,7 @@
LOG_ERROR("Attempt to create an index without an in-progress transaction");
return { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to create an index without an in-progress transaction") };
}
- if (transaction->mode() != IndexedDB::TransactionMode::VersionChange) {
+ if (transaction->mode() != IDBTransactionMode::Versionchange) {
LOG_ERROR("Attempt to create an index in a non-version-change transaction");
return { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to create an index in a non-version-change transaction") };
}
@@ -1245,7 +1245,7 @@
return { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to delete index without an in-progress transaction") };
}
- if (transaction->mode() != IndexedDB::TransactionMode::VersionChange) {
+ if (transaction->mode() != IDBTransactionMode::Versionchange) {
LOG_ERROR("Attempt to delete index during a non-version-change transaction");
return { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to delete index during a non-version-change transaction") };
}
@@ -1300,7 +1300,7 @@
return { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to rename an index without an in-progress transaction") };
}
- if (transaction->mode() != IndexedDB::TransactionMode::VersionChange) {
+ if (transaction->mode() != IDBTransactionMode::Versionchange) {
LOG_ERROR("Attempt to rename an index in a non-version-change transaction");
return { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to rename an index in a non-version-change transaction") };
}
@@ -1414,7 +1414,7 @@
ASSERT(m_sqliteDB);
ASSERT(m_sqliteDB->isOpen());
ASSERT(transaction.inProgress());
- ASSERT(transaction.mode() != IndexedDB::TransactionMode::ReadOnly);
+ ASSERT(transaction.mode() != IDBTransactionMode::Readonly);
UNUSED_PARAM(transaction);
RefPtr<SharedBuffer> keyBuffer = serializeIDBKeyData(keyData);
@@ -1511,7 +1511,7 @@
LOG_ERROR("Attempt to delete range from database without an in-progress transaction");
return { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to delete range from database without an in-progress transaction") };
}
- if (transaction->mode() == IndexedDB::TransactionMode::ReadOnly) {
+ if (transaction->mode() == IDBTransactionMode::Readonly) {
LOG_ERROR("Attempt to delete records from an object store in a read-only transaction");
return { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to delete records from an object store in a read-only transaction") };
}
@@ -1630,7 +1630,7 @@
LOG_ERROR("Attempt to store a record in an object store without an in-progress transaction");
return { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to store a record in an object store without an in-progress transaction") };
}
- if (transaction->mode() == IndexedDB::TransactionMode::ReadOnly) {
+ if (transaction->mode() == IDBTransactionMode::Readonly) {
LOG_ERROR("Attempt to store a record in an object store in a read-only transaction");
return { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to store a record in an object store in a read-only transaction") };
}
@@ -1989,7 +1989,7 @@
LOG_ERROR("Attempt to generate key in database without an in-progress transaction");
return { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to generate key in database without an in-progress transaction") };
}
- if (transaction->mode() == IndexedDB::TransactionMode::ReadOnly) {
+ if (transaction->mode() == IDBTransactionMode::Readonly) {
LOG_ERROR("Attempt to generate key in a read-only transaction");
return { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to generate key in a read-only transaction") };
}
@@ -2018,7 +2018,7 @@
LOG_ERROR("Attempt to revert key generator value in database without an in-progress transaction");
return { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to revert key generator value in database without an in-progress transaction") };
}
- if (transaction->mode() == IndexedDB::TransactionMode::ReadOnly) {
+ if (transaction->mode() == IDBTransactionMode::Readonly) {
LOG_ERROR("Attempt to revert key generator value in a read-only transaction");
return { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to revert key generator value in a read-only transaction") };
}
@@ -2039,7 +2039,7 @@
LOG_ERROR("Attempt to update key generator value in database without an in-progress transaction");
return { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to update key generator value in database without an in-progress transaction") };
}
- if (transaction->mode() == IndexedDB::TransactionMode::ReadOnly) {
+ if (transaction->mode() == IDBTransactionMode::Readonly) {
LOG_ERROR("Attempt to update key generator value in a read-only transaction");
return { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to update key generator value in a read-only transaction") };
}
Modified: trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBTransaction.cpp (207936 => 207937)
--- trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBTransaction.cpp 2016-10-27 05:51:29 UTC (rev 207936)
+++ trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBTransaction.cpp 2016-10-27 06:00:11 UTC (rev 207937)
@@ -58,7 +58,7 @@
{
ASSERT(!m_sqliteTransaction);
- m_sqliteTransaction = std::make_unique<SQLiteTransaction>(database, m_info.mode() == IndexedDB::TransactionMode::ReadOnly);
+ m_sqliteTransaction = std::make_unique<SQLiteTransaction>(database, m_info.mode() == IDBTransactionMode::Readonly);
m_sqliteTransaction->begin();
if (m_sqliteTransaction->inProgress())
Modified: trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBTransaction.h (207936 => 207937)
--- trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBTransaction.h 2016-10-27 05:51:29 UTC (rev 207936)
+++ trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBTransaction.h 2016-10-27 06:00:11 UTC (rev 207937)
@@ -66,7 +66,7 @@
void closeCursor(SQLiteIDBCursor&);
void notifyCursorsOfChanges(int64_t objectStoreID);
- IndexedDB::TransactionMode mode() const { return m_info.mode(); }
+ IDBTransactionMode mode() const { return m_info.mode(); }
bool inProgress() const;
SQLiteTransaction* sqliteTransaction() const { return m_sqliteTransaction.get(); }
Modified: trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp (207936 => 207937)
--- trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp 2016-10-27 05:51:29 UTC (rev 207936)
+++ trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp 2016-10-27 06:00:11 UTC (rev 207937)
@@ -1412,7 +1412,7 @@
LOG(IndexedDB, "UniqueIDBDatabase::enqueueTransaction - %s", transaction->info().loggingString().utf8().data());
ASSERT(!m_hardClosedForUserDelete);
- ASSERT(transaction->info().mode() != IndexedDB::TransactionMode::VersionChange);
+ ASSERT(transaction->info().mode() != IDBTransactionMode::Versionchange);
m_pendingTransactions.append(WTFMove(transaction));
@@ -1548,7 +1548,7 @@
currentTransaction = m_pendingTransactions.takeFirst();
switch (currentTransaction->info().mode()) {
- case IndexedDB::TransactionMode::ReadOnly: {
+ case IDBTransactionMode::Readonly: {
bool hasOverlappingScopes = scopesOverlap(deferredReadWriteScopes, currentTransaction->objectStoreIdentifiers());
hasOverlappingScopes |= scopesOverlap(m_objectStoreWriteTransactions, currentTransaction->objectStoreIdentifiers());
@@ -1557,7 +1557,7 @@
break;
}
- case IndexedDB::TransactionMode::ReadWrite: {
+ case IDBTransactionMode::Readwrite: {
bool hasOverlappingScopes = scopesOverlap(m_objectStoreTransactionCounts, currentTransaction->objectStoreIdentifiers());
hasOverlappingScopes |= scopesOverlap(deferredReadWriteScopes, currentTransaction->objectStoreIdentifiers());
@@ -1569,7 +1569,7 @@
break;
}
- case IndexedDB::TransactionMode::VersionChange:
+ case IDBTransactionMode::Versionchange:
// Version change transactions should never be scheduled in the traditional manner.
RELEASE_ASSERT_NOT_REACHED();
}
Modified: trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp (207936 => 207937)
--- trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp 2016-10-27 05:51:29 UTC (rev 207936)
+++ trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp 2016-10-27 06:00:11 UTC (rev 207937)
@@ -135,7 +135,7 @@
{
LOG(IndexedDB, "UniqueIDBDatabaseConnection::establishTransaction - %s - %" PRIu64, m_openRequestIdentifier.loggingString().utf8().data(), m_identifier);
- ASSERT(info.mode() != IndexedDB::TransactionMode::VersionChange);
+ ASSERT(info.mode() != IDBTransactionMode::Versionchange);
// No transactions should ever come from the client after the client has already told us
// the connection is closing.
Modified: trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp (207936 => 207937)
--- trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp 2016-10-27 05:51:29 UTC (rev 207936)
+++ trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp 2016-10-27 06:00:11 UTC (rev 207937)
@@ -46,7 +46,7 @@
: m_databaseConnection(connection)
, m_transactionInfo(info)
{
- if (m_transactionInfo.mode() == IndexedDB::TransactionMode::VersionChange)
+ if (m_transactionInfo.mode() == IDBTransactionMode::Versionchange)
m_originalDatabaseInfo = std::make_unique<IDBDatabaseInfo>(m_databaseConnection->database().info());
m_databaseConnection->database().server().registerTransaction(*this);
@@ -60,7 +60,7 @@
IDBDatabaseInfo* UniqueIDBDatabaseTransaction::originalDatabaseInfo() const
{
- ASSERT(m_transactionInfo.mode() == IndexedDB::TransactionMode::VersionChange);
+ ASSERT(m_transactionInfo.mode() == IDBTransactionMode::Versionchange);
return m_originalDatabaseInfo.get();
}
@@ -84,12 +84,12 @@
bool UniqueIDBDatabaseTransaction::isVersionChange() const
{
- return m_transactionInfo.mode() == IndexedDB::TransactionMode::VersionChange;
+ return m_transactionInfo.mode() == IDBTransactionMode::Versionchange;
}
bool UniqueIDBDatabaseTransaction::isReadOnly() const
{
- return m_transactionInfo.mode() == IndexedDB::TransactionMode::ReadOnly;
+ return m_transactionInfo.mode() == IDBTransactionMode::Readonly;
}
void UniqueIDBDatabaseTransaction::commit()
Modified: trunk/Source/WebCore/Modules/indexeddb/shared/IDBTransactionInfo.cpp (207936 => 207937)
--- trunk/Source/WebCore/Modules/indexeddb/shared/IDBTransactionInfo.cpp 2016-10-27 05:51:29 UTC (rev 207936)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/IDBTransactionInfo.cpp 2016-10-27 06:00:11 UTC (rev 207937)
@@ -41,7 +41,7 @@
{
}
-IDBTransactionInfo IDBTransactionInfo::clientTransaction(const IDBClient::IDBConnectionProxy& connectionProxy, const Vector<String>& objectStores, IndexedDB::TransactionMode mode)
+IDBTransactionInfo IDBTransactionInfo::clientTransaction(const IDBClient::IDBConnectionProxy& connectionProxy, const Vector<String>& objectStores, IDBTransactionMode mode)
{
IDBTransactionInfo result((IDBResourceIdentifier(connectionProxy)));
result.m_mode = mode;
@@ -53,7 +53,7 @@
IDBTransactionInfo IDBTransactionInfo::versionChange(const IDBServer::IDBConnectionToClient& connection, const IDBDatabaseInfo& originalDatabaseInfo, uint64_t newVersion)
{
IDBTransactionInfo result((IDBResourceIdentifier(connection)));
- result.m_mode = IndexedDB::TransactionMode::VersionChange;
+ result.m_mode = IDBTransactionMode::Versionchange;
result.m_newVersion = newVersion;
result.m_originalDatabaseInfo = std::make_unique<IDBDatabaseInfo>(originalDatabaseInfo);
@@ -99,14 +99,14 @@
{
String modeString;
switch (m_mode) {
- case IndexedDB::TransactionMode::ReadOnly:
- modeString = IDBTransaction::modeReadOnly();
+ case IDBTransactionMode::Readonly:
+ modeString = ASCIILiteral("readonly");
break;
- case IndexedDB::TransactionMode::ReadWrite:
- modeString = IDBTransaction::modeReadWrite();
+ case IDBTransactionMode::Readwrite:
+ modeString = ASCIILiteral("readwrite");
break;
- case IndexedDB::TransactionMode::VersionChange:
- modeString = IDBTransaction::modeVersionChange();
+ case IDBTransactionMode::Versionchange:
+ modeString = ASCIILiteral("versionchange");
break;
default:
ASSERT_NOT_REACHED();
Modified: trunk/Source/WebCore/Modules/indexeddb/shared/IDBTransactionInfo.h (207936 => 207937)
--- trunk/Source/WebCore/Modules/indexeddb/shared/IDBTransactionInfo.h 2016-10-27 05:51:29 UTC (rev 207936)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/IDBTransactionInfo.h 2016-10-27 06:00:11 UTC (rev 207937)
@@ -30,6 +30,7 @@
#include "IDBDatabaseInfo.h"
#include "IDBResourceIdentifier.h"
+#include "IDBTransactionMode.h"
#include "IndexedDB.h"
#include <wtf/Vector.h>
@@ -45,7 +46,7 @@
class IDBTransactionInfo {
public:
- static IDBTransactionInfo clientTransaction(const IDBClient::IDBConnectionProxy&, const Vector<String>& objectStores, IndexedDB::TransactionMode);
+ static IDBTransactionInfo clientTransaction(const IDBClient::IDBConnectionProxy&, const Vector<String>& objectStores, IDBTransactionMode);
static IDBTransactionInfo versionChange(const IDBServer::IDBConnectionToClient&, const IDBDatabaseInfo& originalDatabaseInfo, uint64_t newVersion);
IDBTransactionInfo(const IDBTransactionInfo&);
@@ -57,7 +58,7 @@
const IDBResourceIdentifier& identifier() const { return m_identifier; }
- IndexedDB::TransactionMode mode() const { return m_mode; }
+ IDBTransactionMode mode() const { return m_mode; }
uint64_t newVersion() const { return m_newVersion; }
const Vector<String>& objectStores() const { return m_objectStores; }
@@ -79,7 +80,7 @@
IDBResourceIdentifier m_identifier;
- IndexedDB::TransactionMode m_mode { IndexedDB::TransactionMode::ReadOnly };
+ IDBTransactionMode m_mode { IDBTransactionMode::Readonly };
uint64_t m_newVersion { 0 };
Vector<String> m_objectStores;
std::unique_ptr<IDBDatabaseInfo> m_originalDatabaseInfo;
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (207936 => 207937)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2016-10-27 05:51:29 UTC (rev 207936)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2016-10-27 06:00:11 UTC (rev 207937)
@@ -2948,6 +2948,9 @@
8386A97019F61E4F00E1EC4A /* StyleBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8386A96E19F61E4F00E1EC4A /* StyleBuilder.cpp */; };
838867351D13BA5F003697D0 /* RenderObjectEnums.h in Headers */ = {isa = PBXBuildFile; fileRef = 838867341D13BA59003697D0 /* RenderObjectEnums.h */; settings = {ATTRIBUTES = (Private, ); }; };
838869EC1CE81EA300D16A9E /* JSTextCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 838869EB1CE81E9E00D16A9E /* JSTextCustom.cpp */; };
+ 838EF5381DC149E2008F0C39 /* IDBTransactionMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 838EF5361DC149DA008F0C39 /* IDBTransactionMode.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 838EF53B1DC14A7C008F0C39 /* JSIDBTransactionMode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 838EF5391DC14A75008F0C39 /* JSIDBTransactionMode.cpp */; };
+ 838EF53C1DC14A7C008F0C39 /* JSIDBTransactionMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 838EF53A1DC14A75008F0C39 /* JSIDBTransactionMode.h */; };
839AAFEC1A0C0C8D00605F99 /* HTMLWBRElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 839AAFEA1A0C0C8D00605F99 /* HTMLWBRElement.cpp */; };
839AAFED1A0C0C8D00605F99 /* HTMLWBRElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 839AAFEB1A0C0C8D00605F99 /* HTMLWBRElement.h */; };
83A4A9F91CE7FD8100709B00 /* JSXMLDocumentCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83A4A9F81CE7FD7E00709B00 /* JSXMLDocumentCustom.cpp */; };
@@ -10272,6 +10275,10 @@
8386A96E19F61E4F00E1EC4A /* StyleBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StyleBuilder.cpp; sourceTree = "<group>"; };
838867341D13BA59003697D0 /* RenderObjectEnums.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderObjectEnums.h; sourceTree = "<group>"; };
838869EB1CE81E9E00D16A9E /* JSTextCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSTextCustom.cpp; sourceTree = "<group>"; };
+ 838EF5361DC149DA008F0C39 /* IDBTransactionMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBTransactionMode.h; sourceTree = "<group>"; };
+ 838EF5371DC149DA008F0C39 /* IDBTransactionMode.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = IDBTransactionMode.idl; sourceTree = "<group>"; };
+ 838EF5391DC14A75008F0C39 /* JSIDBTransactionMode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIDBTransactionMode.cpp; sourceTree = "<group>"; };
+ 838EF53A1DC14A75008F0C39 /* JSIDBTransactionMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSIDBTransactionMode.h; sourceTree = "<group>"; };
839AAFEA1A0C0C8D00605F99 /* HTMLWBRElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLWBRElement.cpp; sourceTree = "<group>"; };
839AAFEB1A0C0C8D00605F99 /* HTMLWBRElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLWBRElement.h; sourceTree = "<group>"; };
83A4A9F81CE7FD7E00709B00 /* JSXMLDocumentCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSXMLDocumentCustom.cpp; sourceTree = "<group>"; };
@@ -18834,6 +18841,8 @@
51645B501B9F889B00F789CE /* IDBTransaction.cpp */,
51645B511B9F889B00F789CE /* IDBTransaction.h */,
51D719A6181106E00016DC51 /* IDBTransaction.idl */,
+ 838EF5361DC149DA008F0C39 /* IDBTransactionMode.h */,
+ 838EF5371DC149DA008F0C39 /* IDBTransactionMode.idl */,
516103AD1CADB9A30016B4C7 /* IDBValue.cpp */,
516103AE1CADB9A30016B4C7 /* IDBValue.h */,
51645B521B9F889B00F789CE /* IDBVersionChangeEvent.cpp */,
@@ -20226,6 +20235,8 @@
C585A67911D4FB07004C3E4B /* JSIDBRequest.h */,
511EF2B417F0FC4800E4FA16 /* JSIDBTransaction.cpp */,
B656626E120B1227006EA85C /* JSIDBTransaction.h */,
+ 838EF5391DC14A75008F0C39 /* JSIDBTransactionMode.cpp */,
+ 838EF53A1DC14A75008F0C39 /* JSIDBTransactionMode.h */,
269239911505E1AA009E57FC /* JSIDBVersionChangeEvent.cpp */,
269239921505E1AA009E57FC /* JSIDBVersionChangeEvent.h */,
514C76350CE9225E007EF3CD /* JSSQLError.cpp */,
@@ -25518,6 +25529,7 @@
1449E24C107D4A8400B5793F /* JSCallbackData.h in Headers */,
65DF323A09D1DE65000BE325 /* JSCanvasGradient.h in Headers */,
65DF323C09D1DE65000BE325 /* JSCanvasPattern.h in Headers */,
+ 838EF53C1DC14A7C008F0C39 /* JSIDBTransactionMode.h in Headers */,
65DF323C09D1DE65001BE325 /* JSCanvasProxy.h in Headers */,
49EED1451051969400099FAB /* JSCanvasRenderingContext2D.h in Headers */,
93F9B7A10BA6032600854064 /* JSCDATASection.h in Headers */,
@@ -26835,6 +26847,7 @@
BC74DA371013F3F7007987AD /* RGBColor.h in Headers */,
A8CFF5E10A155A05000A4234 /* RootInlineBox.h in Headers */,
49E911C90EF86D47009D0CAF /* RotateTransformOperation.h in Headers */,
+ 838EF5381DC149E2008F0C39 /* IDBTransactionMode.h in Headers */,
A73F95FF12C97BFE0031AAF9 /* RoundedRect.h in Headers */,
07AB996918DA3C010018771E /* RTCConfiguration.h in Headers */,
07AB996F18DA3C740018771E /* RTCConfigurationPrivate.h in Headers */,
@@ -28973,6 +28986,7 @@
A81369DF097374F600D74463 /* HTMLOptGroupElement.cpp in Sources */,
A81369DD097374F600D74463 /* HTMLOptionElement.cpp in Sources */,
9327A94209968D1A0068A546 /* HTMLOptionsCollection.cpp in Sources */,
+ 838EF53B1DC14A7C008F0C39 /* JSIDBTransactionMode.cpp in Sources */,
4AD01008127E642A0015035F /* HTMLOutputElement.cpp in Sources */,
A8EA7CB20A192B9C00A8EF5F /* HTMLParagraphElement.cpp in Sources */,
A871D4590A127CBC00B12A68 /* HTMLParamElement.cpp in Sources */,
Modified: trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm (207936 => 207937)
--- trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm 2016-10-27 05:51:29 UTC (rev 207936)
+++ trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm 2016-10-27 06:00:11 UTC (rev 207937)
@@ -72,10 +72,7 @@
"SerializedScriptValue" => 1,
);
-my %dictionaryTypes = ();
my %dictionaryTypeImplementationNameOverrides = ();
-
-my %enumTypeHash = ();
my %enumTypeImplementationNameOverrides = ();
@@ -141,6 +138,7 @@
my $idlFiles;
my $cachedInterfaces = {};
my $cachedExternalDictionaries = {};
+my $cachedExternalEnumerations = {};
sub assert
{
@@ -181,7 +179,6 @@
require $ifaceName . ".pm";
foreach my $dictionary (@{$useDocument->dictionaries}) {
- $dictionaryTypes{$dictionary->name} = 1;
if ($dictionary->extendedAttributes->{"ImplementedAs"}) {
$dictionaryTypeImplementationNameOverrides{$dictionary->name} = $dictionary->extendedAttributes->{"ImplementedAs"};
}
@@ -188,7 +185,6 @@
}
foreach my $enumeration (@{$useDocument->enumerations}) {
- $enumTypeHash{$enumeration->name} = $enumeration->values;
if ($enumeration->extendedAttributes->{"ImplementedAs"}) {
$enumTypeImplementationNameOverrides{$enumeration->name} = $enumeration->extendedAttributes->{"ImplementedAs"};
}
@@ -225,7 +221,18 @@
$codeGenerator->WriteData($dictionary, $useOutputDir, $useOutputHeadersDir);
return;
}
+
+ my $enumerations = $useDocument->enumerations;
+ if (@$enumerations) {
+ die "Multiple standalone enumerations per document are not supported" if @$enumerations > 1;
+ my $enumeration = @$enumerations[0];
+ print "Generating $useGenerator bindings code for IDL enumeration \"" . $enumeration->name . "\"...\n" if $verbose;
+ $codeGenerator->GenerateEnumeration($enumeration);
+ $codeGenerator->WriteData($enumeration, $useOutputDir, $useOutputHeadersDir);
+ return;
+ }
+
die "Processing document " . $useDocument->fileName . " did not generate anything"
}
@@ -444,15 +451,60 @@
{
my ($object, $type) = @_;
- return 1 if exists $enumTypeHash{$type};
- return 0;
+ return defined($object->GetEnumByName($type));
}
+sub GetEnumByName
+{
+ my ($object, $name) = @_;
+
+ die "GetEnumByName() was called with an undefined enumeration name" unless defined($name);
+
+ for my $enumeration (@{$useDocument->enumerations}) {
+ return $enumeration if $enumeration->name eq $name;
+ }
+
+ return $cachedExternalEnumerations->{$name} if exists($cachedExternalEnumerations->{$name});
+
+ # Find the IDL file associated with the dictionary.
+ my $filename = $object->IDLFileForInterface($name) or return;
+
+ # Do a fast check to see if it seems to contain a dictionary.
+ my $fileContents = slurp($filename);
+
+ if ($fileContents =~ /\benum\s+$name/gs) {
+ # Parse the IDL.
+ my $parser = IDLParser->new(1);
+ my $document = $parser->Parse($filename, $defines, $preprocessor);
+
+ foreach my $enumeration (@{$document->enumerations}) {
+ next unless $enumeration->name eq $name;
+
+ $cachedExternalEnumerations->{$name} = $enumeration;
+ my $implementedAs = $enumeration->extendedAttributes->{ImplementedAs};
+ $enumTypeImplementationNameOverrides{$enumeration->name} = $implementedAs if $implementedAs;
+ return $enumeration;
+ }
+ }
+ $cachedExternalEnumerations->{$name} = undef;
+}
+
+# An enumeration defined in its own IDL file.
+sub IsExternalEnumType
+{
+ my ($object, $type) = @_;
+
+ return $object->IsEnumType($type) && defined($cachedExternalEnumerations->{$type});
+}
+
sub ValidEnumValues
{
my ($object, $type) = @_;
- return @{$enumTypeHash{$type}};
+ my $enumeration = $object->GetEnumByName($type);
+ die "ValidEnumValues() was with a type that is not an enumeration: " . $type unless defined($enumeration);
+
+ return $enumeration->values;
}
sub HasEnumImplementationNameOverride
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (207936 => 207937)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2016-10-27 05:51:29 UTC (rev 207936)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2016-10-27 06:00:11 UTC (rev 207937)
@@ -132,6 +132,15 @@
return $reference;
}
+sub GenerateEnumeration
+{
+ my ($object, $enumeration) = @_;
+
+ my $className = GetEnumerationClassName($enumeration->name);
+ $object->GenerateEnumerationHeader($enumeration, $className);
+ $object->GenerateEnumerationImplementation($enumeration, $className);
+}
+
sub GenerateDictionary
{
my ($object, $dictionary, $enumerations) = @_;
@@ -288,7 +297,7 @@
return;
}
- if ($codeGenerator->IsExternalDictionaryType($idlType->name)) {
+ if ($codeGenerator->IsExternalDictionaryType($idlType->name) || $codeGenerator->IsExternalEnumType($idlType->name)) {
AddToImplIncludes("JS" . $idlType->name . ".h", $conditional);
return;
}
@@ -852,7 +861,9 @@
return $codeGenerator->GetEnumImplementationNameOverride($name);
}
+ return $name if $codeGenerator->IsExternalEnumType($name);
return $name unless defined($interface);
+
return GetNestedClassName($interface, $name);
}
@@ -866,11 +877,125 @@
return $name;
}
+sub GenerateEnumerationHeader
+{
+ my ($object, $enumeration, $className) = @_;
+
+ # - Add default header template and header protection.
+ push(@headerContentHeader, GenerateHeaderContentHeader($enumeration));
+
+ $headerIncludes{"$className.h"} = 1;
+ $headerIncludes{"JSDOMConvert.h"} = 1;
+
+ push(@headerContent, "\nnamespace WebCore {\n\n");
+ push(@headerContent, GenerateEnumerationHeaderContent($enumeration, $className));
+ push(@headerContent, "} // namespace WebCore\n");
+
+ my $conditionalString = $codeGenerator->GenerateConditionalString($enumeration);
+ push(@headerContent, "\n#endif // ${conditionalString}\n") if $conditionalString;
+}
+
+sub GenerateEnumerationImplementation
+{
+ my ($object, $enumeration, $className) = @_;
+
+ # - Add default header template
+ push(@implContentHeader, GenerateImplementationContentHeader($enumeration));
+
+ # FIXME: A little ugly to have this be a side effect instead of a return value.
+ AddToImplIncludes("<runtime/JSString.h>");
+ AddToImplIncludes("JSDOMConvert.h");
+
+ push(@implContent, "\nusing namespace JSC;\n\n");
+ push(@implContent, "namespace WebCore {\n\n");
+ push(@implContent, GenerateEnumerationImplementationContent($enumeration, $className));
+ push(@implContent, "} // namespace WebCore\n");
+
+ my $conditionalString = $codeGenerator->GenerateConditionalString($enumeration);
+ push(@implContent, "\n#endif // ${conditionalString}\n") if $conditionalString;
+}
+
+sub GenerateEnumerationImplementationContent
+{
+ my ($enumeration, $className, $interface, $conditionalString) = @_;
+
+ my $result = "";
+ $result .= "#if ${conditionalString}\n\n" if $conditionalString;
+
+ # FIXME: Change to take VM& instead of ExecState*.
+ $result .= "template<> JSString* convertEnumerationToJS(ExecState& state, $className enumerationValue)\n";
+ $result .= "{\n";
+ # FIXME: Might be nice to make this global be "const", but NeverDestroyed does not currently support that.
+ # FIXME: Might be nice to make the entire array be NeverDestroyed instead of each value, but not sure what the syntax for that is.
+ AddToImplIncludes("<wtf/NeverDestroyed.h>");
+ $result .= " static NeverDestroyed<const String> values[] = {\n";
+ foreach my $value (@{$enumeration->values}) {
+ if ($value eq "") {
+ $result .= " emptyString(),\n";
+ } else {
+ $result .= " ASCIILiteral(\"$value\"),\n";
+ }
+ }
+ $result .= " };\n";
+ my $index = 0;
+ foreach my $value (@{$enumeration->values}) {
+ my $enumerationValueName = GetEnumerationValueName($value);
+ $result .= " static_assert(static_cast<size_t>(${className}::$enumerationValueName) == $index, \"${className}::$enumerationValueName is not $index as expected\");\n";
+ $index++;
+ }
+ $result .= " ASSERT(static_cast<size_t>(enumerationValue) < WTF_ARRAY_LENGTH(values));\n";
+ $result .= " return jsStringWithCache(&state, values[static_cast<size_t>(enumerationValue)]);\n";
+ $result .= "}\n\n";
+
+ # FIXME: Change to take VM& instead of ExecState&.
+ # FIXME: Consider using toStringOrNull to make exception checking faster.
+ # FIXME: Consider finding a more efficient way to match against all the strings quickly.
+ $result .= "template<> Optional<$className> parseEnumeration<$className>(ExecState& state, JSValue value)\n";
+ $result .= "{\n";
+ $result .= " auto stringValue = value.toWTFString(&state);\n";
+ foreach my $value (@{$enumeration->values}) {
+ my $enumerationValueName = GetEnumerationValueName($value);
+ if ($value eq "") {
+ $result .= " if (stringValue.isEmpty())\n";
+ } else {
+ $result .= " if (stringValue == \"$value\")\n";
+ }
+ $result .= " return ${className}::${enumerationValueName};\n";
+ }
+ $result .= " return Nullopt;\n";
+ $result .= "}\n\n";
+
+ $result .= "template<> $className convertEnumeration<$className>(ExecState& state, JSValue value)\n";
+ $result .= "{\n";
+ $result .= " VM& vm = state.vm();\n";
+ $result .= " auto throwScope = DECLARE_THROW_SCOPE(vm);\n";
+ $result .= " auto result = parseEnumeration<$className>(state, value);\n";
+ $result .= " if (UNLIKELY(!result)) {\n";
+ $result .= " throwTypeError(&state, throwScope);\n";
+ $result .= " return { };\n";
+ $result .= " }\n";
+ $result .= " return result.value();\n";
+ $result .= "}\n\n";
+
+ $result .= "template<> const char* expectedEnumerationValues<$className>()\n";
+ $result .= "{\n";
+ $result .= " return \"\\\"" . join ("\\\", \\\"", @{$enumeration->values}) . "\\\"\";\n";
+ $result .= "}\n\n";
+
+ $result .= "#endif\n\n" if $conditionalString;
+
+ return $result;
+}
+
sub GenerateEnumerationsImplementationContent
{
my ($interface, $enumerations) = @_;
return "" unless @$enumerations;
+
+ # FIXME: A little ugly to have this be a side effect instead of a return value.
+ AddToImplIncludes("<runtime/JSString.h>");
+ AddToImplIncludes("JSDOMConvert.h");
my $result = "";
foreach my $enumeration (@$enumerations) {
@@ -877,78 +1002,24 @@
my $name = $enumeration->name;
my $className = GetEnumerationClassName($name, $interface);
-
- # FIXME: A little ugly to have this be a side effect instead of a return value.
- AddToImplIncludes("<runtime/JSString.h>");
-
my $conditionalString = $codeGenerator->GenerateConditionalString($enumeration);
- $result .= "#if ${conditionalString}\n\n" if $conditionalString;
+ $result .= GenerateEnumerationImplementationContent($enumeration, $className, $interface, $conditionalString);
+ }
+ return $result;
+}
- # FIXME: Change to take VM& instead of ExecState*.
- $result .= "template<> JSString* convertEnumerationToJS(ExecState& state, $className enumerationValue)\n";
- $result .= "{\n";
- # FIXME: Might be nice to make this global be "const", but NeverDestroyed does not currently support that.
- # FIXME: Might be nice to make the entire array be NeverDestroyed instead of each value, but not sure what the syntax for that is.
- AddToImplIncludes("<wtf/NeverDestroyed.h>");
- $result .= " static NeverDestroyed<const String> values[] = {\n";
- foreach my $value (@{$enumeration->values}) {
- if ($value eq "") {
- $result .= " emptyString(),\n";
- } else {
- $result .= " ASCIILiteral(\"$value\"),\n";
- }
- }
- $result .= " };\n";
- my $index = 0;
- foreach my $value (@{$enumeration->values}) {
- my $enumerationValueName = GetEnumerationValueName($value);
- $result .= " static_assert(static_cast<size_t>(${className}::$enumerationValueName) == $index, \"${className}::$enumerationValueName is not $index as expected\");\n";
- $index++;
- }
- $result .= " ASSERT(static_cast<size_t>(enumerationValue) < WTF_ARRAY_LENGTH(values));\n";
- $result .= " return jsStringWithCache(&state, values[static_cast<size_t>(enumerationValue)]);\n";
- $result .= "}\n\n";
+sub GenerateEnumerationHeaderContent
+{
+ my ($enumeration, $className, $conditionalString) = @_;
- # FIXME: Change to take VM& instead of ExecState&.
- # FIXME: Consider using toStringOrNull to make exception checking faster.
- # FIXME: Consider finding a more efficient way to match against all the strings quickly.
- $result .= "template<> Optional<$className> parseEnumeration<$className>(ExecState& state, JSValue value)\n";
- $result .= "{\n";
- $result .= " auto stringValue = value.toWTFString(&state);\n";
- foreach my $value (@{$enumeration->values}) {
- my $enumerationValueName = GetEnumerationValueName($value);
- if ($value eq "") {
- $result .= " if (stringValue.isEmpty())\n";
- } else {
- $result .= " if (stringValue == \"$value\")\n";
- }
- $result .= " return ${className}::${enumerationValueName};\n";
- }
- $result .= " return Nullopt;\n";
- $result .= "}\n\n";
-
- # FIXME: A little ugly to have this be a side effect instead of a return value.
- AddToImplIncludes("JSDOMConvert.h");
-
- $result .= "template<> $className convertEnumeration<$className>(ExecState& state, JSValue value)\n";
- $result .= "{\n";
- $result .= " VM& vm = state.vm();\n";
- $result .= " auto throwScope = DECLARE_THROW_SCOPE(vm);\n";
- $result .= " auto result = parseEnumeration<$className>(state, value);\n";
- $result .= " if (UNLIKELY(!result)) {\n";
- $result .= " throwTypeError(&state, throwScope);\n";
- $result .= " return { };\n";
- $result .= " }\n";
- $result .= " return result.value();\n";
- $result .= "}\n\n";
-
- $result .= "template<> const char* expectedEnumerationValues<$className>()\n";
- $result .= "{\n";
- $result .= " return \"\\\"" . join ("\\\", \\\"", @{$enumeration->values}) . "\\\"\";\n";
- $result .= "}\n\n";
-
- $result .= "#endif\n\n" if $conditionalString;
- }
+ my $result = "";
+ $result .= "#if ${conditionalString}\n\n" if $conditionalString;
+ $result .= "template<> JSC::JSString* convertEnumerationToJS(JSC::ExecState&, $className);\n\n";
+ $result .= "template<> Optional<$className> parseEnumeration<$className>(JSC::ExecState&, JSC::JSValue);\n";
+ $result .= "template<> $className convertEnumeration<$className>(JSC::ExecState&, JSC::JSValue);\n";
+ $result .= "template<> const char* expectedEnumerationValues<$className>();\n\n";
+ $result .= "#endif\n\n" if $conditionalString;
+
return $result;
}
@@ -964,22 +1035,10 @@
$headerIncludes{"JSDOMConvert.h"} = 1;
my $result = "";
-
foreach my $enumeration (@$enumerations) {
- my $name = $enumeration->name;
-
- my $className = GetEnumerationClassName($name, $interface);
-
+ my $className = GetEnumerationClassName($enumeration->name, $interface);
my $conditionalString = $codeGenerator->GenerateConditionalString($enumeration);
- $result .= "#if ${conditionalString}\n\n" if $conditionalString;
-
- $result .= "template<> JSC::JSString* convertEnumerationToJS(JSC::ExecState&, $className);\n\n";
-
- $result .= "template<> Optional<$className> parseEnumeration<$className>(JSC::ExecState&, JSC::JSValue);\n";
- $result .= "template<> $className convertEnumeration<$className>(JSC::ExecState&, JSC::JSValue);\n";
- $result .= "template<> const char* expectedEnumerationValues<$className>();\n\n";
-
- $result .= "#endif\n\n" if $conditionalString;
+ $result .= GenerateEnumerationHeaderContent($enumeration, $className, $conditionalString);
}
return $result;
}
@@ -4395,6 +4454,7 @@
$indent = " ";
}
+ $implIncludes{"JS$className.h"} = 1 if $codeGenerator->IsExternalEnumType($type);
push(@$outputArray, "$indent $defineOptionalValue = parseEnumeration<$className>(*state, ${name}Value);\n");
push(@$outputArray, "$indent RETURN_IF_EXCEPTION(throwScope, encodedJSValue());\n");
push(@$outputArray, "$indent if (UNLIKELY(!$optionalValue))\n");
@@ -5303,8 +5363,12 @@
}
return ("to$type($value)", 1) if $codeGenerator->IsTypedArrayType($type);
- return ("parseEnumeration<" . GetEnumerationClassName($type, $interface) . ">($stateReference, $value)", 1) if $codeGenerator->IsEnumType($type);
-
+
+ if ($codeGenerator->IsEnumType($type)) {
+ AddToImplIncludes("JS$type.h", $conditional) if $codeGenerator->IsExternalEnumType($type);
+ return ("parseEnumeration<" . GetEnumerationClassName($type, $interface) . ">($stateReference, $value)", 1);
+ }
+
AddToImplIncludes("JS$type.h", $conditional);
# FIXME: EventListener should be a callback interface.
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (207936 => 207937)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp 2016-10-27 05:51:29 UTC (rev 207936)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp 2016-10-27 06:00:11 UTC (rev 207937)
@@ -52,6 +52,7 @@
#include "JSTestNode.h"
#include "JSTestObj.h"
#include "JSTestStandaloneDictionary.h"
+#include "JSTestStandaloneEnumeration.h"
#include "JSTestSubObj.h"
#include "JSXPathNSResolver.h"
#include "RuntimeEnabledFeatures.h"
@@ -960,6 +961,7 @@
JSC::EncodedJSValue JSC_HOST_CALL jsTestObjConstructorFunctionNullableStringStaticMethod(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionNullableStringSpecialMethod(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithEnumArg(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithStandaloneEnumArg(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalEnumArg(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalEnumArgAndDefaultValue(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThrows(JSC::ExecState*);
@@ -1571,6 +1573,7 @@
{ "nullableStringMethod", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionNullableStringMethod), (intptr_t) (0) } },
{ "nullableStringSpecialMethod", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionNullableStringSpecialMethod), (intptr_t) (1) } },
{ "methodWithEnumArg", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithEnumArg), (intptr_t) (1) } },
+ { "methodWithStandaloneEnumArg", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithStandaloneEnumArg), (intptr_t) (1) } },
{ "methodWithOptionalEnumArg", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalEnumArg), (intptr_t) (0) } },
{ "methodWithOptionalEnumArgAndDefaultValue", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalEnumArgAndDefaultValue), (intptr_t) (0) } },
{ "methodThatRequiresAllArgsAndThrows", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThrows), (intptr_t) (2) } },
@@ -5186,6 +5189,31 @@
return JSValue::encode(jsUndefined());
}
+static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionMethodWithStandaloneEnumArgCaller(JSC::ExecState*, JSTestObj*, JSC::ThrowScope&);
+
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithStandaloneEnumArg(ExecState* state)
+{
+ return BindingCaller<JSTestObj>::callOperation<jsTestObjPrototypeFunctionMethodWithStandaloneEnumArgCaller>(state, "methodWithStandaloneEnumArg");
+}
+
+static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionMethodWithStandaloneEnumArgCaller(JSC::ExecState* state, JSTestObj* castedThis, JSC::ThrowScope& throwScope)
+{
+ UNUSED_PARAM(state);
+ UNUSED_PARAM(throwScope);
+ auto& impl = castedThis->wrapped();
+ if (UNLIKELY(state->argumentCount() < 1))
+ return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
+ auto enumArgValue = state->uncheckedArgument(0);
+ TestStandaloneEnumeration enumArg;
+ auto optionalValue = parseEnumeration<TestStandaloneEnumeration>(*state, enumArgValue);
+ RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
+ if (UNLIKELY(!optionalValue))
+ return throwArgumentMustBeEnumError(*state, throwScope, 0, "enumArg", "TestObject", "methodWithStandaloneEnumArg", expectedEnumerationValues<TestStandaloneEnumeration>());
+ enumArg = optionalValue.value();
+ impl.methodWithStandaloneEnumArg(enumArg);
+ return JSValue::encode(jsUndefined());
+}
+
static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionMethodWithOptionalEnumArgCaller(JSC::ExecState*, JSTestObj*, JSC::ThrowScope&);
EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalEnumArg(ExecState* state)
Added: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestStandaloneEnumeration.cpp (0 => 207937)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestStandaloneEnumeration.cpp (rev 0)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestStandaloneEnumeration.cpp 2016-10-27 06:00:11 UTC (rev 207937)
@@ -0,0 +1,75 @@
+/*
+ This file is part of the WebKit open source project.
+ This file has been generated by generate-bindings.pl. DO NOT MODIFY!
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "config.h"
+
+#if ENABLE(CONDITION)
+
+#include "JSTestStandaloneEnumeration.h"
+
+#include <runtime/JSString.h>
+#include <wtf/NeverDestroyed.h>
+
+using namespace JSC;
+
+namespace WebCore {
+
+template<> JSString* convertEnumerationToJS(ExecState& state, TestStandaloneEnumeration enumerationValue)
+{
+ static NeverDestroyed<const String> values[] = {
+ ASCIILiteral("enumValue1"),
+ ASCIILiteral("enumValue2"),
+ };
+ static_assert(static_cast<size_t>(TestStandaloneEnumeration::EnumValue1) == 0, "TestStandaloneEnumeration::EnumValue1 is not 0 as expected");
+ static_assert(static_cast<size_t>(TestStandaloneEnumeration::EnumValue2) == 1, "TestStandaloneEnumeration::EnumValue2 is not 1 as expected");
+ ASSERT(static_cast<size_t>(enumerationValue) < WTF_ARRAY_LENGTH(values));
+ return jsStringWithCache(&state, values[static_cast<size_t>(enumerationValue)]);
+}
+
+template<> Optional<TestStandaloneEnumeration> parseEnumeration<TestStandaloneEnumeration>(ExecState& state, JSValue value)
+{
+ auto stringValue = value.toWTFString(&state);
+ if (stringValue == "enumValue1")
+ return TestStandaloneEnumeration::EnumValue1;
+ if (stringValue == "enumValue2")
+ return TestStandaloneEnumeration::EnumValue2;
+ return Nullopt;
+}
+
+template<> TestStandaloneEnumeration convertEnumeration<TestStandaloneEnumeration>(ExecState& state, JSValue value)
+{
+ VM& vm = state.vm();
+ auto throwScope = DECLARE_THROW_SCOPE(vm);
+ auto result = parseEnumeration<TestStandaloneEnumeration>(state, value);
+ if (UNLIKELY(!result)) {
+ throwTypeError(&state, throwScope);
+ return { };
+ }
+ return result.value();
+}
+
+template<> const char* expectedEnumerationValues<TestStandaloneEnumeration>()
+{
+ return "\"enumValue1\", \"enumValue2\"";
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(CONDITION)
Added: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestStandaloneEnumeration.h (0 => 207937)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestStandaloneEnumeration.h (rev 0)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestStandaloneEnumeration.h 2016-10-27 06:00:11 UTC (rev 207937)
@@ -0,0 +1,38 @@
+/*
+ This file is part of the WebKit open source project.
+ This file has been generated by generate-bindings.pl. DO NOT MODIFY!
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#pragma once
+
+#if ENABLE(CONDITION)
+
+#include "JSDOMConvert.h"
+#include "TestStandaloneEnumeration.h"
+
+namespace WebCore {
+
+template<> JSC::JSString* convertEnumerationToJS(JSC::ExecState&, TestStandaloneEnumeration);
+
+template<> Optional<TestStandaloneEnumeration> parseEnumeration<TestStandaloneEnumeration>(JSC::ExecState&, JSC::JSValue);
+template<> TestStandaloneEnumeration convertEnumeration<TestStandaloneEnumeration>(JSC::ExecState&, JSC::JSValue);
+template<> const char* expectedEnumerationValues<TestStandaloneEnumeration>();
+
+} // namespace WebCore
+
+#endif // ENABLE(CONDITION)
Modified: trunk/Source/WebCore/bindings/scripts/test/TestObj.idl (207936 => 207937)
--- trunk/Source/WebCore/bindings/scripts/test/TestObj.idl 2016-10-27 05:51:29 UTC (rev 207936)
+++ trunk/Source/WebCore/bindings/scripts/test/TestObj.idl 2016-10-27 06:00:11 UTC (rev 207937)
@@ -135,6 +135,7 @@
getter DOMString? nullableStringSpecialMethod(unsigned long index);
void methodWithEnumArg(TestEnumType enumArg);
+ void methodWithStandaloneEnumArg(TestStandaloneEnumeration enumArg);
void methodWithOptionalEnumArg(optional TestEnumType enumArg);
void methodWithOptionalEnumArgAndDefaultValue(optional TestEnumType enumArg = "EnumValue1");
[MayThrowLegacyException] TestObj methodThatRequiresAllArgsAndThrows(DOMString strArg, TestObj objArg);
Copied: trunk/Source/WebCore/bindings/scripts/test/TestStandaloneEnumeration.idl (from rev 207935, trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.idl) (0 => 207937)
--- trunk/Source/WebCore/bindings/scripts/test/TestStandaloneEnumeration.idl (rev 0)
+++ trunk/Source/WebCore/bindings/scripts/test/TestStandaloneEnumeration.idl 2016-10-27 06:00:11 UTC (rev 207937)
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary form, 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.
+ * 3. Neither the name of Apple Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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=CONDITION,
+] enum TestStandaloneEnumeration {
+ "enumValue1",
+ "enumValue2"
+};
+
Modified: trunk/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp (207936 => 207937)
--- trunk/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp 2016-10-27 05:51:29 UTC (rev 207936)
+++ trunk/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp 2016-10-27 06:00:11 UTC (rev 207937)
@@ -182,7 +182,7 @@
return WTF::visit(visitor, idbKeyPath.value());
}
-static RefPtr<IDBTransaction> transactionForDatabase(IDBDatabase* idbDatabase, const String& objectStoreName, const String& mode = IDBTransaction::modeReadOnly())
+static RefPtr<IDBTransaction> transactionForDatabase(IDBDatabase* idbDatabase, const String& objectStoreName, IDBTransactionMode mode = IDBTransactionMode::Readonly)
{
auto result = idbDatabase->transaction(objectStoreName, mode);
if (result.hasException())
@@ -691,7 +691,7 @@
if (!requestCallback().isActive())
return;
- auto idbTransaction = transactionForDatabase(&database, m_objectStoreName, IDBTransaction::modeReadWrite());
+ auto idbTransaction = transactionForDatabase(&database, m_objectStoreName, IDBTransactionMode::Readwrite);
if (!idbTransaction) {
m_requestCallback->sendFailure("Could not get transaction");
return;