Changeset 207937 in webkit
- Timestamp:
- Oct 26, 2016 11:00:11 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 35 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r207932 r207937 1 2016-10-26 Chris Dumez <cdumez@apple.com> 2 3 [Web IDL] Add support for having string enumerations in their own IDL file 4 https://bugs.webkit.org/show_bug.cgi?id=164025 5 6 Reviewed by Darin Adler. 7 8 Rebaseline existign tests as the exception messages differ slightly. 9 10 * storage/indexeddb/exceptions-expected.txt: 11 * storage/indexeddb/exceptions-private-expected.txt: 12 * storage/indexeddb/modern/idbdatabase-transaction-failures-expected.txt: 13 * storage/indexeddb/modern/idbdatabase-transaction-failures-private-expected.txt: 14 * storage/indexeddb/transaction-basics-expected.txt: 15 * storage/indexeddb/transaction-basics-private-expected.txt: 16 1 17 2016-10-26 Yusuke Suzuki <utatane.tea@gmail.com> 2 18 -
trunk/LayoutTests/storage/indexeddb/exceptions-expected.txt
r195181 r207937 106 106 Expecting TypeError exception from db.transaction('store', 'invalid-mode') 107 107 PASS Exception was thrown. 108 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'.108 PASS db.transaction('store', 'invalid-mode') threw TypeError: Argument 2 ('mode') to IDBDatabase.transaction must be one of: "readonly", "readwrite", "versionchange" 109 109 The function was called with an empty list of store names 110 110 Expecting exception from db.transaction([]) -
trunk/LayoutTests/storage/indexeddb/exceptions-private-expected.txt
r195247 r207937 106 106 Expecting TypeError exception from db.transaction('store', 'invalid-mode') 107 107 PASS Exception was thrown. 108 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'.108 PASS db.transaction('store', 'invalid-mode') threw TypeError: Argument 2 ('mode') to IDBDatabase.transaction must be one of: "readonly", "readwrite", "versionchange" 109 109 The function was called with an empty list of store names 110 110 Expecting exception from db.transaction([]) -
trunk/LayoutTests/storage/indexeddb/modern/idbdatabase-transaction-failures-expected.txt
r203309 r207937 13 13 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. 14 14 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. 15 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'.16 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'.15 Failed to start a transaction with an invalid mode - TypeError: Argument 2 ('mode') to IDBDatabase.transaction must be one of: "readonly", "readwrite", "versionchange" 16 Failed to explicitly start a versionchange transaction - TypeError: Type error 17 17 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. 18 18 PASS successfullyParsed is true -
trunk/LayoutTests/storage/indexeddb/modern/idbdatabase-transaction-failures-private-expected.txt
r203309 r207937 13 13 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. 14 14 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. 15 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'.16 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'.15 Failed to start a transaction with an invalid mode - TypeError: Argument 2 ('mode') to IDBDatabase.transaction must be one of: "readonly", "readwrite", "versionchange" 16 Failed to explicitly start a versionchange transaction - TypeError: Type error 17 17 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. 18 18 PASS successfullyParsed is true -
trunk/LayoutTests/storage/indexeddb/transaction-basics-expected.txt
r195181 r207937 230 230 Expecting TypeError exception from db.transaction(['storeName'], 'lsakjdf') 231 231 PASS Exception was thrown. 232 PASS db.transaction(['storeName'], 'lsakjdf') threw TypeError: Failed to execute 'transaction' on 'IDBDatabase': The mode provided ('lsakjdf') is not one of 'readonly' or 'readwrite'.232 PASS db.transaction(['storeName'], 'lsakjdf') threw TypeError: Argument 2 ('mode') to IDBDatabase.transaction must be one of: "readonly", "readwrite", "versionchange" 233 233 234 234 Test that null and undefined are treated as strings -
trunk/LayoutTests/storage/indexeddb/transaction-basics-private-expected.txt
r195247 r207937 230 230 Expecting TypeError exception from db.transaction(['storeName'], 'lsakjdf') 231 231 PASS Exception was thrown. 232 PASS db.transaction(['storeName'], 'lsakjdf') threw TypeError: Failed to execute 'transaction' on 'IDBDatabase': The mode provided ('lsakjdf') is not one of 'readonly' or 'readwrite'.232 PASS db.transaction(['storeName'], 'lsakjdf') threw TypeError: Argument 2 ('mode') to IDBDatabase.transaction must be one of: "readonly", "readwrite", "versionchange" 233 233 234 234 Test that null and undefined are treated as strings -
trunk/Source/WebCore/CMakeLists.txt
r207903 r207937 200 200 Modules/indexeddb/IDBRequest.idl 201 201 Modules/indexeddb/IDBTransaction.idl 202 Modules/indexeddb/IDBTransactionMode.idl 202 203 Modules/indexeddb/IDBVersionChangeEvent.idl 203 204 Modules/indexeddb/WorkerGlobalScopeIndexedDatabase.idl -
trunk/Source/WebCore/ChangeLog
r207933 r207937 1 2016-10-26 Chris Dumez <cdumez@apple.com> 2 3 [Web IDL] Add support for having string enumerations in their own IDL file 4 https://bugs.webkit.org/show_bug.cgi?id=164025 5 6 Reviewed by Darin Adler. 7 8 Add support for having string enumerations in their own IDL file to facilitate 9 sharing them. Use this new support to implement IDBTransactionMode enumeration 10 for IndexedDB: 11 - https://www.w3.org/TR/IndexedDB/#idl-def-IDBTransactionMode 12 13 No new tests, rebaselined existing tests. 14 15 * CMakeLists.txt: 16 * DerivedSources.cpp: 17 * DerivedSources.make: 18 * Modules/indexeddb/IDBDatabase.cpp: 19 (WebCore::IDBDatabase::transaction): 20 (WebCore::IDBDatabase::startVersionChangeTransaction): 21 * Modules/indexeddb/IDBDatabase.h: 22 * Modules/indexeddb/IDBDatabase.idl: 23 * Modules/indexeddb/IDBOpenDBRequest.cpp: 24 (WebCore::IDBOpenDBRequest::onUpgradeNeeded): 25 * Modules/indexeddb/IDBTransaction.cpp: 26 (WebCore::IDBTransaction::IDBTransaction): 27 * Modules/indexeddb/IDBTransaction.h: 28 (WebCore::IDBTransaction::mode): 29 (WebCore::IDBTransaction::isVersionChange): 30 (WebCore::IDBTransaction::isReadOnly): 31 * Modules/indexeddb/IDBTransaction.idl: 32 * Modules/indexeddb/IDBTransactionMode.h: Added. 33 * Modules/indexeddb/IDBTransactionMode.idl: Copied from Source/WebCore/Modules/indexeddb/IDBTransaction.idl. 34 * Modules/indexeddb/IndexedDB.h: 35 * Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp: 36 (WebCore::IDBServer::MemoryBackingStoreTransaction::MemoryBackingStoreTransaction): 37 (WebCore::IDBServer::MemoryBackingStoreTransaction::objectStoreRenamed): 38 (WebCore::IDBServer::MemoryBackingStoreTransaction::indexRenamed): 39 (WebCore::IDBServer::MemoryBackingStoreTransaction::abort): 40 * Modules/indexeddb/server/MemoryBackingStoreTransaction.h: 41 (WebCore::IDBServer::MemoryBackingStoreTransaction::isVersionChange): 42 (WebCore::IDBServer::MemoryBackingStoreTransaction::isWriting): 43 * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp: 44 (WebCore::IDBServer::SQLiteIDBBackingStore::beginTransaction): 45 (WebCore::IDBServer::SQLiteIDBBackingStore::abortTransaction): 46 (WebCore::IDBServer::SQLiteIDBBackingStore::commitTransaction): 47 (WebCore::IDBServer::SQLiteIDBBackingStore::createObjectStore): 48 (WebCore::IDBServer::SQLiteIDBBackingStore::deleteObjectStore): 49 (WebCore::IDBServer::SQLiteIDBBackingStore::renameObjectStore): 50 (WebCore::IDBServer::SQLiteIDBBackingStore::clearObjectStore): 51 (WebCore::IDBServer::SQLiteIDBBackingStore::createIndex): 52 (WebCore::IDBServer::SQLiteIDBBackingStore::deleteIndex): 53 (WebCore::IDBServer::SQLiteIDBBackingStore::renameIndex): 54 (WebCore::IDBServer::SQLiteIDBBackingStore::deleteRecord): 55 (WebCore::IDBServer::SQLiteIDBBackingStore::deleteRange): 56 (WebCore::IDBServer::SQLiteIDBBackingStore::addRecord): 57 (WebCore::IDBServer::SQLiteIDBBackingStore::generateKeyNumber): 58 (WebCore::IDBServer::SQLiteIDBBackingStore::revertGeneratedKeyNumber): 59 (WebCore::IDBServer::SQLiteIDBBackingStore::maybeUpdateKeyGeneratorNumber): 60 * Modules/indexeddb/server/SQLiteIDBTransaction.cpp: 61 (WebCore::IDBServer::SQLiteIDBTransaction::begin): 62 * Modules/indexeddb/server/SQLiteIDBTransaction.h: 63 (WebCore::IDBServer::SQLiteIDBTransaction::mode): 64 * Modules/indexeddb/server/UniqueIDBDatabase.cpp: 65 (WebCore::IDBServer::UniqueIDBDatabase::enqueueTransaction): 66 (WebCore::IDBServer::UniqueIDBDatabase::takeNextRunnableTransaction): 67 * Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp: 68 (WebCore::IDBServer::UniqueIDBDatabaseConnection::establishTransaction): 69 * Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp: 70 (WebCore::IDBServer::UniqueIDBDatabaseTransaction::UniqueIDBDatabaseTransaction): 71 (WebCore::IDBServer::UniqueIDBDatabaseTransaction::originalDatabaseInfo): 72 (WebCore::IDBServer::UniqueIDBDatabaseTransaction::isVersionChange): 73 (WebCore::IDBServer::UniqueIDBDatabaseTransaction::isReadOnly): 74 * Modules/indexeddb/shared/IDBTransactionInfo.cpp: 75 (WebCore::IDBTransactionInfo::clientTransaction): 76 (WebCore::IDBTransactionInfo::versionChange): 77 (WebCore::IDBTransactionInfo::loggingString): 78 * Modules/indexeddb/shared/IDBTransactionInfo.h: 79 (WebCore::IDBTransactionInfo::mode): 80 * WebCore.xcodeproj/project.pbxproj: 81 * bindings/scripts/CodeGenerator.pm: 82 (ProcessDocument): 83 (IsEnumType): 84 (GetEnumByName): 85 (IsExternalEnumType): 86 (ValidEnumValues): 87 * bindings/scripts/CodeGeneratorJS.pm: 88 (GenerateEnumeration): 89 (AddToImplIncludesForIDLType): 90 (GetEnumerationClassName): 91 (GenerateEnumerationHeader): 92 (GenerateEnumerationImplementation): 93 (GenerateEnumerationImplementationContent): 94 (GenerateEnumerationsImplementationContent): 95 (GenerateEnumerationHeaderContent): 96 (GenerateEnumerationsHeaderContent): 97 * bindings/scripts/test/JS/JSTestObj.cpp: 98 (WebCore::jsTestObjPrototypeFunctionMethodWithEnumArgCaller): 99 (WebCore::jsTestObjPrototypeFunctionMethodWithStandaloneEnumArg): 100 (WebCore::jsTestObjPrototypeFunctionMethodWithStandaloneEnumArgCaller): 101 * bindings/scripts/test/JS/JSTestStandaloneEnumeration.cpp: Added. 102 (WebCore::convertEnumerationToJS): 103 (WebCore::parseEnumeration<TestStandaloneEnumeration>): 104 (WebCore::convertEnumeration<TestStandaloneEnumeration>): 105 (WebCore::expectedEnumerationValues<TestStandaloneEnumeration>): 106 * bindings/scripts/test/JS/JSTestStandaloneEnumeration.h: Added. 107 * bindings/scripts/test/TestObj.idl: 108 * bindings/scripts/test/TestStandaloneEnumeration.idl: Copied from Source/WebCore/Modules/indexeddb/IDBTransaction.idl. 109 * inspector/InspectorIndexedDBAgent.cpp: 110 1 111 2016-10-26 Dan Bernstein <mitz@apple.com> 2 112 -
trunk/Source/WebCore/DerivedSources.cpp
r207772 r207937 309 309 #include "JSIDBRequest.cpp" 310 310 #include "JSIDBTransaction.cpp" 311 #include "JSIDBTransactionMode.cpp" 311 312 #include "JSIDBVersionChangeEvent.cpp" 312 313 #endif -
trunk/Source/WebCore/DerivedSources.make
r207901 r207937 116 116 $(WebCore)/Modules/indexeddb/IDBRequest.idl \ 117 117 $(WebCore)/Modules/indexeddb/IDBTransaction.idl \ 118 $(WebCore)/Modules/indexeddb/IDBTransactionMode.idl \ 118 119 $(WebCore)/Modules/indexeddb/IDBVersionChangeEvent.idl \ 119 120 $(WebCore)/Modules/indexeddb/WorkerGlobalScopeIndexedDatabase.idl \ -
trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp
r207847 r207937 161 161 } 162 162 163 ExceptionOr<Ref<IDBTransaction>> IDBDatabase::transaction(StringOrVectorOfStrings&& storeNames, const String& modeString)163 ExceptionOr<Ref<IDBTransaction>> IDBDatabase::transaction(StringOrVectorOfStrings&& storeNames, IDBTransactionMode mode) 164 164 { 165 165 LOG(IndexedDB, "IDBDatabase::transaction"); … … 179 179 return Exception { IDBDatabaseException::InvalidAccessError, ASCIILiteral("Failed to execute 'transaction' on 'IDBDatabase': The storeNames parameter was empty.") }; 180 180 181 auto mode = IDBTransaction::stringToMode(modeString); 182 if (!mode) 183 return Exception { TypeError, "Failed to execute 'transaction' on 'IDBDatabase': The mode provided ('" + modeString + "') is not one of 'readonly' or 'readwrite'." }; 184 185 if (mode.value() != IndexedDB::TransactionMode::ReadOnly && mode.value() != IndexedDB::TransactionMode::ReadWrite) 181 if (mode != IDBTransactionMode::Readonly && mode != IDBTransactionMode::Readwrite) 186 182 return Exception { TypeError }; 187 183 … … 195 191 } 196 192 197 auto info = IDBTransactionInfo::clientTransaction(m_connectionProxy.get(), objectStores, mode .value());193 auto info = IDBTransactionInfo::clientTransaction(m_connectionProxy.get(), objectStores, mode); 198 194 auto transaction = IDBTransaction::create(*this, info); 199 195 … … 327 323 ASSERT(currentThread() == originThreadID()); 328 324 ASSERT(!m_versionChangeTransaction); 329 ASSERT(info.mode() == I ndexedDB::TransactionMode::VersionChange);325 ASSERT(info.mode() == IDBTransactionMode::Versionchange); 330 326 ASSERT(!m_closePending); 331 327 ASSERT(scriptExecutionContext()); -
trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.h
r207931 r207937 36 36 #include "IDBDatabaseInfo.h" 37 37 #include "IDBKeyPath.h" 38 #include "IDBTransactionMode.h" 38 39 39 40 namespace WebCore { … … 65 66 66 67 using StringOrVectorOfStrings = WTF::Variant<String, Vector<String>>; 67 ExceptionOr<Ref<IDBTransaction>> transaction(StringOrVectorOfStrings&& storeNames, const String& mode);68 ExceptionOr<Ref<IDBTransaction>> transaction(StringOrVectorOfStrings&& storeNames, IDBTransactionMode); 68 69 ExceptionOr<void> deleteObjectStore(const String& name); 69 70 void close(); -
trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.idl
r207847 r207937 38 38 [MayThrowException] void deleteObjectStore(DOMString name); 39 39 40 // FIXME: mode parameter type should be a IDBTransactionMode string enumeration. 41 [MayThrowException] IDBTransaction transaction((DOMString or sequence<DOMString>) storeNames, optional DOMString mode = "readonly"); 40 [MayThrowException] IDBTransaction transaction((DOMString or sequence<DOMString>) storeNames, optional IDBTransactionMode mode = "readonly"); 42 41 43 42 // FIXME: This is not part of the spec, but is needed for compatibility. 44 43 // See https://github.com/w3c/IndexedDB/issues/85 45 [MayThrowException] IDBTransaction transaction(DOMStringList storeNames, optional DOMStringmode = "readonly");44 [MayThrowException] IDBTransaction transaction(DOMStringList storeNames, optional IDBTransactionMode mode = "readonly"); 46 45 void close(); 47 46 -
trunk/Source/WebCore/Modules/indexeddb/IDBOpenDBRequest.cpp
r202105 r207937 149 149 Ref<IDBTransaction> transaction = database->startVersionChangeTransaction(resultData.transactionInfo(), *this); 150 150 151 ASSERT(transaction->info().mode() == I ndexedDB::TransactionMode::VersionChange);151 ASSERT(transaction->info().mode() == IDBTransactionMode::Versionchange); 152 152 ASSERT(transaction->originalDatabaseInfo()); 153 153 -
trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp
r207845 r207937 60 60 namespace WebCore { 61 61 62 const AtomicString& IDBTransaction::modeReadOnly()63 {64 static NeverDestroyed<AtomicString> readonly("readonly", AtomicString::ConstructFromLiteral);65 return readonly;66 }67 68 const AtomicString& IDBTransaction::modeReadWrite()69 {70 static NeverDestroyed<AtomicString> readwrite("readwrite", AtomicString::ConstructFromLiteral);71 return readwrite;72 }73 74 const AtomicString& IDBTransaction::modeVersionChange()75 {76 static NeverDestroyed<AtomicString> versionchange("versionchange", AtomicString::ConstructFromLiteral);77 return versionchange;78 }79 80 const AtomicString& IDBTransaction::modeReadOnlyLegacy()81 {82 static NeverDestroyed<AtomicString> readonly("0", AtomicString::ConstructFromLiteral);83 return readonly;84 }85 86 const AtomicString& IDBTransaction::modeReadWriteLegacy()87 {88 static NeverDestroyed<AtomicString> readwrite("1", AtomicString::ConstructFromLiteral);89 return readwrite;90 }91 92 Optional<IndexedDB::TransactionMode> IDBTransaction::stringToMode(const String& modeString)93 {94 if (modeString.isNull() || modeString == IDBTransaction::modeReadOnly())95 return IndexedDB::TransactionMode::ReadOnly;96 if (modeString == IDBTransaction::modeReadWrite())97 return IndexedDB::TransactionMode::ReadWrite;98 99 return Nullopt;100 }101 102 const AtomicString& IDBTransaction::modeToString(IndexedDB::TransactionMode mode)103 {104 switch (mode) {105 case IndexedDB::TransactionMode::ReadOnly:106 return IDBTransaction::modeReadOnly();107 108 case IndexedDB::TransactionMode::ReadWrite:109 return IDBTransaction::modeReadWrite();110 111 case IndexedDB::TransactionMode::VersionChange:112 return IDBTransaction::modeVersionChange();113 }114 115 ASSERT_NOT_REACHED();116 return IDBTransaction::modeReadOnly();117 }118 119 62 Ref<IDBTransaction> IDBTransaction::create(IDBDatabase& database, const IDBTransactionInfo& info) 120 63 { … … 138 81 ASSERT(currentThread() == m_database->originThreadID()); 139 82 140 if (m_info.mode() == I ndexedDB::TransactionMode::VersionChange) {83 if (m_info.mode() == IDBTransactionMode::Versionchange) { 141 84 ASSERT(m_openDBRequest); 142 85 m_openDBRequest->setVersionChangeTransaction(*this); … … 182 125 objectStoreNames->sort(); 183 126 return objectStoreNames; 184 }185 186 const String& IDBTransaction::mode() const187 {188 ASSERT(currentThread() == m_database->originThreadID());189 190 switch (m_info.mode()) {191 case IndexedDB::TransactionMode::ReadOnly:192 return IDBTransaction::modeReadOnly();193 case IndexedDB::TransactionMode::ReadWrite:194 return IDBTransaction::modeReadWrite();195 case IndexedDB::TransactionMode::VersionChange:196 return IDBTransaction::modeVersionChange();197 }198 199 RELEASE_ASSERT_NOT_REACHED();200 127 } 201 128 -
trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.h
r207821 r207937 35 35 #include "IDBOpenDBRequest.h" 36 36 #include "IDBTransactionInfo.h" 37 #include "IDBTransactionMode.h" 37 38 #include "IndexedDB.h" 38 39 #include "Timer.h" … … 65 66 class IDBTransaction : public ThreadSafeRefCounted<IDBTransaction>, public EventTargetWithInlineData, public IDBActiveDOMObject { 66 67 public: 67 static const AtomicString& modeReadOnly();68 static const AtomicString& modeReadWrite();69 static const AtomicString& modeVersionChange();70 static const AtomicString& modeReadOnlyLegacy();71 static const AtomicString& modeReadWriteLegacy();72 73 static Optional<IndexedDB::TransactionMode> stringToMode(const String&);74 static const AtomicString& modeToString(IndexedDB::TransactionMode);75 76 68 static Ref<IDBTransaction> create(IDBDatabase&, const IDBTransactionInfo&); 77 69 static Ref<IDBTransaction> create(IDBDatabase&, const IDBTransactionInfo&, IDBOpenDBRequest&); … … 81 73 // IDBTransaction IDL 82 74 Ref<DOMStringList> objectStoreNames() const; 83 const String& mode() const;75 IDBTransactionMode mode() const { return m_info.mode(); } 84 76 IDBDatabase* db(); 85 77 DOMError* error() const; … … 111 103 void didCommit(const IDBError&); 112 104 113 bool isVersionChange() const { return m _info.mode() == IndexedDB::TransactionMode::VersionChange; }114 bool isReadOnly() const { return m _info.mode() == IndexedDB::TransactionMode::ReadOnly; }105 bool isVersionChange() const { return mode() == IDBTransactionMode::Versionchange; } 106 bool isReadOnly() const { return mode() == IDBTransactionMode::Readonly; } 115 107 bool isActive() const; 116 108 -
trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.idl
r207821 r207937 32 32 ] interface IDBTransaction : EventTarget { 33 33 readonly attribute DOMStringList objectStoreNames; 34 readonly attribute DOMStringmode;34 readonly attribute IDBTransactionMode mode; 35 35 readonly attribute IDBDatabase db; 36 36 readonly attribute DOMError error; -
trunk/Source/WebCore/Modules/indexeddb/IDBTransactionMode.idl
r207935 r207937 1 /* 2 * Copyright (C) 2010 Google Inc. All rights reserved. 3 * Copyright (C) 2011 Apple Inc. All rights reserved. 1 /* 2 * Copyright (C) 2016 Apple Inc. All rights reserved. 4 3 * 5 4 * Redistribution and use in source and binary forms, with or without … … 26 25 27 26 [ 28 ActiveDOMObject,29 27 Conditional=INDEXED_DATABASE, 30 EnabledAtRuntime=IndexedDB, 31 SkipVTableValidation, 32 ] interface IDBTransaction : EventTarget { 33 readonly attribute DOMStringList objectStoreNames; 34 readonly attribute DOMString mode; 35 readonly attribute IDBDatabase db; 36 readonly attribute DOMError error; 37 38 [MayThrowException] IDBObjectStore objectStore(DOMString name); 39 [MayThrowException] void abort(); 40 41 attribute EventHandler onabort; 42 attribute EventHandler oncomplete; 43 attribute EventHandler onerror; 28 ] enum IDBTransactionMode { 29 "readonly", 30 "readwrite", 31 "versionchange" 44 32 }; -
trunk/Source/WebCore/Modules/indexeddb/IndexedDB.h
r200699 r207937 31 31 32 32 namespace IndexedDB { 33 34 enum class TransactionMode {35 ReadOnly = 0,36 ReadWrite = 1,37 VersionChange = 2,38 };39 const unsigned TransactionModeMaximum = 2;40 33 41 34 enum class TransactionState { -
trunk/Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp
r207761 r207937 49 49 , m_info(info) 50 50 { 51 if (m_info.mode() == I ndexedDB::TransactionMode::VersionChange) {51 if (m_info.mode() == IDBTransactionMode::Versionchange) { 52 52 IDBDatabaseInfo info; 53 53 auto error = m_backingStore.getOrEstablishDatabaseInfo(info); … … 154 154 { 155 155 ASSERT(m_objectStores.contains(&objectStore)); 156 ASSERT(m_info.mode() == I ndexedDB::TransactionMode::VersionChange);156 ASSERT(m_info.mode() == IDBTransactionMode::Versionchange); 157 157 158 158 // We only care about the first rename in a given transaction, because if the transaction is aborted we want … … 164 164 { 165 165 ASSERT(m_objectStores.contains(&index.objectStore())); 166 ASSERT(m_info.mode() == I ndexedDB::TransactionMode::VersionChange);166 ASSERT(m_info.mode() == IDBTransactionMode::Versionchange); 167 167 168 168 // We only care about the first rename in a given transaction, because if the transaction is aborted we want … … 234 234 235 235 if (m_originalDatabaseInfo) { 236 ASSERT(m_info.mode() == I ndexedDB::TransactionMode::VersionChange);236 ASSERT(m_info.mode() == IDBTransactionMode::Versionchange); 237 237 m_backingStore.setDatabaseInfo(*m_originalDatabaseInfo); 238 238 } -
trunk/Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.h
r207761 r207937 53 53 ~MemoryBackingStoreTransaction(); 54 54 55 bool isVersionChange() const { return m_info.mode() == I ndexedDB::TransactionMode::VersionChange; }56 bool isWriting() const { return m_info.mode() != I ndexedDB::TransactionMode::ReadOnly; }55 bool isVersionChange() const { return m_info.mode() == IDBTransactionMode::Versionchange; } 56 bool isWriting() const { return m_info.mode() != IDBTransactionMode::Readonly; } 57 57 bool isAborting() const { return m_isAborting; } 58 58 -
trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp
r207931 r207937 779 779 780 780 auto error = addResult.iterator->value->begin(*m_sqliteDB); 781 if (error.isNull() && info.mode() == I ndexedDB::TransactionMode::VersionChange) {781 if (error.isNull() && info.mode() == IDBTransactionMode::Versionchange) { 782 782 m_originalDatabaseInfoBeforeVersionChange = std::make_unique<IDBDatabaseInfo>(*m_databaseInfo); 783 783 … … 806 806 807 807 808 if (transaction->mode() == I ndexedDB::TransactionMode::VersionChange) {808 if (transaction->mode() == IDBTransactionMode::Versionchange) { 809 809 ASSERT(m_originalDatabaseInfoBeforeVersionChange); 810 810 m_databaseInfo = WTFMove(m_originalDatabaseInfoBeforeVersionChange); … … 829 829 auto error = transaction->commit(); 830 830 if (!error.isNull()) { 831 if (transaction->mode() == I ndexedDB::TransactionMode::VersionChange) {831 if (transaction->mode() == IDBTransactionMode::Versionchange) { 832 832 ASSERT(m_originalDatabaseInfoBeforeVersionChange); 833 833 m_databaseInfo = WTFMove(m_originalDatabaseInfoBeforeVersionChange); … … 851 851 return { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to create an object store without an in-progress transaction") }; 852 852 } 853 if (transaction->mode() != I ndexedDB::TransactionMode::VersionChange) {853 if (transaction->mode() != IDBTransactionMode::Versionchange) { 854 854 LOG_ERROR("Attempt to create an object store in a non-version-change transaction"); 855 855 return { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to create an object store in a non-version-change transaction") }; … … 903 903 return { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to delete an object store without an in-progress transaction") }; 904 904 } 905 if (transaction->mode() != I ndexedDB::TransactionMode::VersionChange) {905 if (transaction->mode() != IDBTransactionMode::Versionchange) { 906 906 LOG_ERROR("Attempt to delete an object store in a non-version-change transaction"); 907 907 return { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to delete an object store in a non-version-change transaction") }; … … 995 995 return { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to rename an object store without an in-progress transaction") }; 996 996 } 997 if (transaction->mode() != I ndexedDB::TransactionMode::VersionChange) {997 if (transaction->mode() != IDBTransactionMode::Versionchange) { 998 998 LOG_ERROR("Attempt to rename an object store in a non-version-change transaction"); 999 999 return { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to rename an object store in a non-version-change transaction") }; … … 1028 1028 return { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to clear an object store without an in-progress transaction") }; 1029 1029 } 1030 if (transaction->mode() == I ndexedDB::TransactionMode::ReadOnly) {1030 if (transaction->mode() == IDBTransactionMode::Readonly) { 1031 1031 LOG_ERROR("Attempt to clear an object store in a read-only transaction"); 1032 1032 return { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to clear an object store in a read-only transaction") }; … … 1069 1069 return { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to create an index without an in-progress transaction") }; 1070 1070 } 1071 if (transaction->mode() != I ndexedDB::TransactionMode::VersionChange) {1071 if (transaction->mode() != IDBTransactionMode::Versionchange) { 1072 1072 LOG_ERROR("Attempt to create an index in a non-version-change transaction"); 1073 1073 return { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to create an index in a non-version-change transaction") }; … … 1246 1246 } 1247 1247 1248 if (transaction->mode() != I ndexedDB::TransactionMode::VersionChange) {1248 if (transaction->mode() != IDBTransactionMode::Versionchange) { 1249 1249 LOG_ERROR("Attempt to delete index during a non-version-change transaction"); 1250 1250 return { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to delete index during a non-version-change transaction") }; … … 1301 1301 } 1302 1302 1303 if (transaction->mode() != I ndexedDB::TransactionMode::VersionChange) {1303 if (transaction->mode() != IDBTransactionMode::Versionchange) { 1304 1304 LOG_ERROR("Attempt to rename an index in a non-version-change transaction"); 1305 1305 return { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to rename an index in a non-version-change transaction") }; … … 1415 1415 ASSERT(m_sqliteDB->isOpen()); 1416 1416 ASSERT(transaction.inProgress()); 1417 ASSERT(transaction.mode() != I ndexedDB::TransactionMode::ReadOnly);1417 ASSERT(transaction.mode() != IDBTransactionMode::Readonly); 1418 1418 UNUSED_PARAM(transaction); 1419 1419 … … 1512 1512 return { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to delete range from database without an in-progress transaction") }; 1513 1513 } 1514 if (transaction->mode() == I ndexedDB::TransactionMode::ReadOnly) {1514 if (transaction->mode() == IDBTransactionMode::Readonly) { 1515 1515 LOG_ERROR("Attempt to delete records from an object store in a read-only transaction"); 1516 1516 return { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to delete records from an object store in a read-only transaction") }; … … 1631 1631 return { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to store a record in an object store without an in-progress transaction") }; 1632 1632 } 1633 if (transaction->mode() == I ndexedDB::TransactionMode::ReadOnly) {1633 if (transaction->mode() == IDBTransactionMode::Readonly) { 1634 1634 LOG_ERROR("Attempt to store a record in an object store in a read-only transaction"); 1635 1635 return { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to store a record in an object store in a read-only transaction") }; … … 1990 1990 return { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to generate key in database without an in-progress transaction") }; 1991 1991 } 1992 if (transaction->mode() == I ndexedDB::TransactionMode::ReadOnly) {1992 if (transaction->mode() == IDBTransactionMode::Readonly) { 1993 1993 LOG_ERROR("Attempt to generate key in a read-only transaction"); 1994 1994 return { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to generate key in a read-only transaction") }; … … 2019 2019 return { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to revert key generator value in database without an in-progress transaction") }; 2020 2020 } 2021 if (transaction->mode() == I ndexedDB::TransactionMode::ReadOnly) {2021 if (transaction->mode() == IDBTransactionMode::Readonly) { 2022 2022 LOG_ERROR("Attempt to revert key generator value in a read-only transaction"); 2023 2023 return { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to revert key generator value in a read-only transaction") }; … … 2040 2040 return { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to update key generator value in database without an in-progress transaction") }; 2041 2041 } 2042 if (transaction->mode() == I ndexedDB::TransactionMode::ReadOnly) {2042 if (transaction->mode() == IDBTransactionMode::Readonly) { 2043 2043 LOG_ERROR("Attempt to update key generator value in a read-only transaction"); 2044 2044 return { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to update key generator value in a read-only transaction") }; -
trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBTransaction.cpp
r199730 r207937 59 59 ASSERT(!m_sqliteTransaction); 60 60 61 m_sqliteTransaction = std::make_unique<SQLiteTransaction>(database, m_info.mode() == I ndexedDB::TransactionMode::ReadOnly);61 m_sqliteTransaction = std::make_unique<SQLiteTransaction>(database, m_info.mode() == IDBTransactionMode::Readonly); 62 62 m_sqliteTransaction->begin(); 63 63 -
trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBTransaction.h
r199524 r207937 67 67 void notifyCursorsOfChanges(int64_t objectStoreID); 68 68 69 I ndexedDB::TransactionMode mode() const { return m_info.mode(); }69 IDBTransactionMode mode() const { return m_info.mode(); } 70 70 bool inProgress() const; 71 71 -
trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp
r207931 r207937 1413 1413 ASSERT(!m_hardClosedForUserDelete); 1414 1414 1415 ASSERT(transaction->info().mode() != I ndexedDB::TransactionMode::VersionChange);1415 ASSERT(transaction->info().mode() != IDBTransactionMode::Versionchange); 1416 1416 1417 1417 m_pendingTransactions.append(WTFMove(transaction)); … … 1549 1549 1550 1550 switch (currentTransaction->info().mode()) { 1551 case I ndexedDB::TransactionMode::ReadOnly: {1551 case IDBTransactionMode::Readonly: { 1552 1552 bool hasOverlappingScopes = scopesOverlap(deferredReadWriteScopes, currentTransaction->objectStoreIdentifiers()); 1553 1553 hasOverlappingScopes |= scopesOverlap(m_objectStoreWriteTransactions, currentTransaction->objectStoreIdentifiers()); … … 1558 1558 break; 1559 1559 } 1560 case I ndexedDB::TransactionMode::ReadWrite: {1560 case IDBTransactionMode::Readwrite: { 1561 1561 bool hasOverlappingScopes = scopesOverlap(m_objectStoreTransactionCounts, currentTransaction->objectStoreIdentifiers()); 1562 1562 hasOverlappingScopes |= scopesOverlap(deferredReadWriteScopes, currentTransaction->objectStoreIdentifiers()); … … 1570 1570 break; 1571 1571 } 1572 case I ndexedDB::TransactionMode::VersionChange:1572 case IDBTransactionMode::Versionchange: 1573 1573 // Version change transactions should never be scheduled in the traditional manner. 1574 1574 RELEASE_ASSERT_NOT_REACHED(); -
trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp
r207761 r207937 136 136 LOG(IndexedDB, "UniqueIDBDatabaseConnection::establishTransaction - %s - %" PRIu64, m_openRequestIdentifier.loggingString().utf8().data(), m_identifier); 137 137 138 ASSERT(info.mode() != I ndexedDB::TransactionMode::VersionChange);138 ASSERT(info.mode() != IDBTransactionMode::Versionchange); 139 139 140 140 // No transactions should ever come from the client after the client has already told us -
trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp
r207761 r207937 47 47 , m_transactionInfo(info) 48 48 { 49 if (m_transactionInfo.mode() == I ndexedDB::TransactionMode::VersionChange)49 if (m_transactionInfo.mode() == IDBTransactionMode::Versionchange) 50 50 m_originalDatabaseInfo = std::make_unique<IDBDatabaseInfo>(m_databaseConnection->database().info()); 51 51 … … 61 61 IDBDatabaseInfo* UniqueIDBDatabaseTransaction::originalDatabaseInfo() const 62 62 { 63 ASSERT(m_transactionInfo.mode() == I ndexedDB::TransactionMode::VersionChange);63 ASSERT(m_transactionInfo.mode() == IDBTransactionMode::Versionchange); 64 64 return m_originalDatabaseInfo.get(); 65 65 } … … 85 85 bool UniqueIDBDatabaseTransaction::isVersionChange() const 86 86 { 87 return m_transactionInfo.mode() == I ndexedDB::TransactionMode::VersionChange;87 return m_transactionInfo.mode() == IDBTransactionMode::Versionchange; 88 88 } 89 89 90 90 bool UniqueIDBDatabaseTransaction::isReadOnly() const 91 91 { 92 return m_transactionInfo.mode() == I ndexedDB::TransactionMode::ReadOnly;92 return m_transactionInfo.mode() == IDBTransactionMode::Readonly; 93 93 } 94 94 -
trunk/Source/WebCore/Modules/indexeddb/shared/IDBTransactionInfo.cpp
r202806 r207937 42 42 } 43 43 44 IDBTransactionInfo IDBTransactionInfo::clientTransaction(const IDBClient::IDBConnectionProxy& connectionProxy, const Vector<String>& objectStores, I ndexedDB::TransactionMode mode)44 IDBTransactionInfo IDBTransactionInfo::clientTransaction(const IDBClient::IDBConnectionProxy& connectionProxy, const Vector<String>& objectStores, IDBTransactionMode mode) 45 45 { 46 46 IDBTransactionInfo result((IDBResourceIdentifier(connectionProxy))); … … 54 54 { 55 55 IDBTransactionInfo result((IDBResourceIdentifier(connection))); 56 result.m_mode = I ndexedDB::TransactionMode::VersionChange;56 result.m_mode = IDBTransactionMode::Versionchange; 57 57 result.m_newVersion = newVersion; 58 58 result.m_originalDatabaseInfo = std::make_unique<IDBDatabaseInfo>(originalDatabaseInfo); … … 100 100 String modeString; 101 101 switch (m_mode) { 102 case I ndexedDB::TransactionMode::ReadOnly:103 modeString = IDBTransaction::modeReadOnly();102 case IDBTransactionMode::Readonly: 103 modeString = ASCIILiteral("readonly"); 104 104 break; 105 case I ndexedDB::TransactionMode::ReadWrite:106 modeString = IDBTransaction::modeReadWrite();105 case IDBTransactionMode::Readwrite: 106 modeString = ASCIILiteral("readwrite"); 107 107 break; 108 case I ndexedDB::TransactionMode::VersionChange:109 modeString = IDBTransaction::modeVersionChange();108 case IDBTransactionMode::Versionchange: 109 modeString = ASCIILiteral("versionchange"); 110 110 break; 111 111 default: -
trunk/Source/WebCore/Modules/indexeddb/shared/IDBTransactionInfo.h
r202806 r207937 31 31 #include "IDBDatabaseInfo.h" 32 32 #include "IDBResourceIdentifier.h" 33 #include "IDBTransactionMode.h" 33 34 #include "IndexedDB.h" 34 35 #include <wtf/Vector.h> … … 46 47 class IDBTransactionInfo { 47 48 public: 48 static IDBTransactionInfo clientTransaction(const IDBClient::IDBConnectionProxy&, const Vector<String>& objectStores, I ndexedDB::TransactionMode);49 static IDBTransactionInfo clientTransaction(const IDBClient::IDBConnectionProxy&, const Vector<String>& objectStores, IDBTransactionMode); 49 50 static IDBTransactionInfo versionChange(const IDBServer::IDBConnectionToClient&, const IDBDatabaseInfo& originalDatabaseInfo, uint64_t newVersion); 50 51 … … 58 59 const IDBResourceIdentifier& identifier() const { return m_identifier; } 59 60 60 I ndexedDB::TransactionMode mode() const { return m_mode; }61 IDBTransactionMode mode() const { return m_mode; } 61 62 uint64_t newVersion() const { return m_newVersion; } 62 63 … … 80 81 IDBResourceIdentifier m_identifier; 81 82 82 I ndexedDB::TransactionMode m_mode { IndexedDB::TransactionMode::ReadOnly };83 IDBTransactionMode m_mode { IDBTransactionMode::Readonly }; 83 84 uint64_t m_newVersion { 0 }; 84 85 Vector<String> m_objectStores; -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r207909 r207937 2949 2949 838867351D13BA5F003697D0 /* RenderObjectEnums.h in Headers */ = {isa = PBXBuildFile; fileRef = 838867341D13BA59003697D0 /* RenderObjectEnums.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2950 2950 838869EC1CE81EA300D16A9E /* JSTextCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 838869EB1CE81E9E00D16A9E /* JSTextCustom.cpp */; }; 2951 838EF5381DC149E2008F0C39 /* IDBTransactionMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 838EF5361DC149DA008F0C39 /* IDBTransactionMode.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2952 838EF53B1DC14A7C008F0C39 /* JSIDBTransactionMode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 838EF5391DC14A75008F0C39 /* JSIDBTransactionMode.cpp */; }; 2953 838EF53C1DC14A7C008F0C39 /* JSIDBTransactionMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 838EF53A1DC14A75008F0C39 /* JSIDBTransactionMode.h */; }; 2951 2954 839AAFEC1A0C0C8D00605F99 /* HTMLWBRElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 839AAFEA1A0C0C8D00605F99 /* HTMLWBRElement.cpp */; }; 2952 2955 839AAFED1A0C0C8D00605F99 /* HTMLWBRElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 839AAFEB1A0C0C8D00605F99 /* HTMLWBRElement.h */; }; … … 10273 10276 838867341D13BA59003697D0 /* RenderObjectEnums.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderObjectEnums.h; sourceTree = "<group>"; }; 10274 10277 838869EB1CE81E9E00D16A9E /* JSTextCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSTextCustom.cpp; sourceTree = "<group>"; }; 10278 838EF5361DC149DA008F0C39 /* IDBTransactionMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBTransactionMode.h; sourceTree = "<group>"; }; 10279 838EF5371DC149DA008F0C39 /* IDBTransactionMode.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = IDBTransactionMode.idl; sourceTree = "<group>"; }; 10280 838EF5391DC14A75008F0C39 /* JSIDBTransactionMode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIDBTransactionMode.cpp; sourceTree = "<group>"; }; 10281 838EF53A1DC14A75008F0C39 /* JSIDBTransactionMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSIDBTransactionMode.h; sourceTree = "<group>"; }; 10275 10282 839AAFEA1A0C0C8D00605F99 /* HTMLWBRElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLWBRElement.cpp; sourceTree = "<group>"; }; 10276 10283 839AAFEB1A0C0C8D00605F99 /* HTMLWBRElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLWBRElement.h; sourceTree = "<group>"; }; … … 18835 18842 51645B511B9F889B00F789CE /* IDBTransaction.h */, 18836 18843 51D719A6181106E00016DC51 /* IDBTransaction.idl */, 18844 838EF5361DC149DA008F0C39 /* IDBTransactionMode.h */, 18845 838EF5371DC149DA008F0C39 /* IDBTransactionMode.idl */, 18837 18846 516103AD1CADB9A30016B4C7 /* IDBValue.cpp */, 18838 18847 516103AE1CADB9A30016B4C7 /* IDBValue.h */, … … 20227 20236 511EF2B417F0FC4800E4FA16 /* JSIDBTransaction.cpp */, 20228 20237 B656626E120B1227006EA85C /* JSIDBTransaction.h */, 20238 838EF5391DC14A75008F0C39 /* JSIDBTransactionMode.cpp */, 20239 838EF53A1DC14A75008F0C39 /* JSIDBTransactionMode.h */, 20229 20240 269239911505E1AA009E57FC /* JSIDBVersionChangeEvent.cpp */, 20230 20241 269239921505E1AA009E57FC /* JSIDBVersionChangeEvent.h */, … … 25519 25530 65DF323A09D1DE65000BE325 /* JSCanvasGradient.h in Headers */, 25520 25531 65DF323C09D1DE65000BE325 /* JSCanvasPattern.h in Headers */, 25532 838EF53C1DC14A7C008F0C39 /* JSIDBTransactionMode.h in Headers */, 25521 25533 65DF323C09D1DE65001BE325 /* JSCanvasProxy.h in Headers */, 25522 25534 49EED1451051969400099FAB /* JSCanvasRenderingContext2D.h in Headers */, … … 26836 26848 A8CFF5E10A155A05000A4234 /* RootInlineBox.h in Headers */, 26837 26849 49E911C90EF86D47009D0CAF /* RotateTransformOperation.h in Headers */, 26850 838EF5381DC149E2008F0C39 /* IDBTransactionMode.h in Headers */, 26838 26851 A73F95FF12C97BFE0031AAF9 /* RoundedRect.h in Headers */, 26839 26852 07AB996918DA3C010018771E /* RTCConfiguration.h in Headers */, … … 28974 28987 A81369DD097374F600D74463 /* HTMLOptionElement.cpp in Sources */, 28975 28988 9327A94209968D1A0068A546 /* HTMLOptionsCollection.cpp in Sources */, 28989 838EF53B1DC14A7C008F0C39 /* JSIDBTransactionMode.cpp in Sources */, 28976 28990 4AD01008127E642A0015035F /* HTMLOutputElement.cpp in Sources */, 28977 28991 A8EA7CB20A192B9C00A8EF5F /* HTMLParagraphElement.cpp in Sources */, -
trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm
r207770 r207937 73 73 ); 74 74 75 my %dictionaryTypes = ();76 75 my %dictionaryTypeImplementationNameOverrides = (); 77 78 my %enumTypeHash = ();79 76 my %enumTypeImplementationNameOverrides = (); 80 77 … … 142 139 my $cachedInterfaces = {}; 143 140 my $cachedExternalDictionaries = {}; 141 my $cachedExternalEnumerations = {}; 144 142 145 143 sub assert … … 182 180 183 181 foreach my $dictionary (@{$useDocument->dictionaries}) { 184 $dictionaryTypes{$dictionary->name} = 1;185 182 if ($dictionary->extendedAttributes->{"ImplementedAs"}) { 186 183 $dictionaryTypeImplementationNameOverrides{$dictionary->name} = $dictionary->extendedAttributes->{"ImplementedAs"}; … … 189 186 190 187 foreach my $enumeration (@{$useDocument->enumerations}) { 191 $enumTypeHash{$enumeration->name} = $enumeration->values;192 188 if ($enumeration->extendedAttributes->{"ImplementedAs"}) { 193 189 $enumTypeImplementationNameOverrides{$enumeration->name} = $enumeration->extendedAttributes->{"ImplementedAs"}; … … 224 220 $codeGenerator->GenerateDictionary($dictionary, $useDocument->enumerations); 225 221 $codeGenerator->WriteData($dictionary, $useOutputDir, $useOutputHeadersDir); 222 return; 223 } 224 225 my $enumerations = $useDocument->enumerations; 226 if (@$enumerations) { 227 die "Multiple standalone enumerations per document are not supported" if @$enumerations > 1; 228 229 my $enumeration = @$enumerations[0]; 230 print "Generating $useGenerator bindings code for IDL enumeration \"" . $enumeration->name . "\"...\n" if $verbose; 231 $codeGenerator->GenerateEnumeration($enumeration); 232 $codeGenerator->WriteData($enumeration, $useOutputDir, $useOutputHeadersDir); 226 233 return; 227 234 } … … 445 452 my ($object, $type) = @_; 446 453 447 return 1 if exists $enumTypeHash{$type}; 448 return 0; 454 return defined($object->GetEnumByName($type)); 455 } 456 457 sub GetEnumByName 458 { 459 my ($object, $name) = @_; 460 461 die "GetEnumByName() was called with an undefined enumeration name" unless defined($name); 462 463 for my $enumeration (@{$useDocument->enumerations}) { 464 return $enumeration if $enumeration->name eq $name; 465 } 466 467 return $cachedExternalEnumerations->{$name} if exists($cachedExternalEnumerations->{$name}); 468 469 # Find the IDL file associated with the dictionary. 470 my $filename = $object->IDLFileForInterface($name) or return; 471 472 # Do a fast check to see if it seems to contain a dictionary. 473 my $fileContents = slurp($filename); 474 475 if ($fileContents =~ /\benum\s+$name/gs) { 476 # Parse the IDL. 477 my $parser = IDLParser->new(1); 478 my $document = $parser->Parse($filename, $defines, $preprocessor); 479 480 foreach my $enumeration (@{$document->enumerations}) { 481 next unless $enumeration->name eq $name; 482 483 $cachedExternalEnumerations->{$name} = $enumeration; 484 my $implementedAs = $enumeration->extendedAttributes->{ImplementedAs}; 485 $enumTypeImplementationNameOverrides{$enumeration->name} = $implementedAs if $implementedAs; 486 return $enumeration; 487 } 488 } 489 $cachedExternalEnumerations->{$name} = undef; 490 } 491 492 # An enumeration defined in its own IDL file. 493 sub IsExternalEnumType 494 { 495 my ($object, $type) = @_; 496 497 return $object->IsEnumType($type) && defined($cachedExternalEnumerations->{$type}); 449 498 } 450 499 … … 453 502 my ($object, $type) = @_; 454 503 455 return @{$enumTypeHash{$type}}; 504 my $enumeration = $object->GetEnumByName($type); 505 die "ValidEnumValues() was with a type that is not an enumeration: " . $type unless defined($enumeration); 506 507 return $enumeration->values; 456 508 } 457 509 -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
r207912 r207937 133 133 } 134 134 135 sub GenerateEnumeration 136 { 137 my ($object, $enumeration) = @_; 138 139 my $className = GetEnumerationClassName($enumeration->name); 140 $object->GenerateEnumerationHeader($enumeration, $className); 141 $object->GenerateEnumerationImplementation($enumeration, $className); 142 } 143 135 144 sub GenerateDictionary 136 145 { … … 289 298 } 290 299 291 if ($codeGenerator->IsExternalDictionaryType($idlType->name) ) {300 if ($codeGenerator->IsExternalDictionaryType($idlType->name) || $codeGenerator->IsExternalEnumType($idlType->name)) { 292 301 AddToImplIncludes("JS" . $idlType->name . ".h", $conditional); 293 302 return; … … 853 862 } 854 863 864 return $name if $codeGenerator->IsExternalEnumType($name); 855 865 return $name unless defined($interface); 866 856 867 return GetNestedClassName($interface, $name); 857 868 } … … 867 878 } 868 879 880 sub GenerateEnumerationHeader 881 { 882 my ($object, $enumeration, $className) = @_; 883 884 # - Add default header template and header protection. 885 push(@headerContentHeader, GenerateHeaderContentHeader($enumeration)); 886 887 $headerIncludes{"$className.h"} = 1; 888 $headerIncludes{"JSDOMConvert.h"} = 1; 889 890 push(@headerContent, "\nnamespace WebCore {\n\n"); 891 push(@headerContent, GenerateEnumerationHeaderContent($enumeration, $className)); 892 push(@headerContent, "} // namespace WebCore\n"); 893 894 my $conditionalString = $codeGenerator->GenerateConditionalString($enumeration); 895 push(@headerContent, "\n#endif // ${conditionalString}\n") if $conditionalString; 896 } 897 898 sub GenerateEnumerationImplementation 899 { 900 my ($object, $enumeration, $className) = @_; 901 902 # - Add default header template 903 push(@implContentHeader, GenerateImplementationContentHeader($enumeration)); 904 905 # FIXME: A little ugly to have this be a side effect instead of a return value. 906 AddToImplIncludes("<runtime/JSString.h>"); 907 AddToImplIncludes("JSDOMConvert.h"); 908 909 push(@implContent, "\nusing namespace JSC;\n\n"); 910 push(@implContent, "namespace WebCore {\n\n"); 911 push(@implContent, GenerateEnumerationImplementationContent($enumeration, $className)); 912 push(@implContent, "} // namespace WebCore\n"); 913 914 my $conditionalString = $codeGenerator->GenerateConditionalString($enumeration); 915 push(@implContent, "\n#endif // ${conditionalString}\n") if $conditionalString; 916 } 917 918 sub GenerateEnumerationImplementationContent 919 { 920 my ($enumeration, $className, $interface, $conditionalString) = @_; 921 922 my $result = ""; 923 $result .= "#if ${conditionalString}\n\n" if $conditionalString; 924 925 # FIXME: Change to take VM& instead of ExecState*. 926 $result .= "template<> JSString* convertEnumerationToJS(ExecState& state, $className enumerationValue)\n"; 927 $result .= "{\n"; 928 # FIXME: Might be nice to make this global be "const", but NeverDestroyed does not currently support that. 929 # FIXME: Might be nice to make the entire array be NeverDestroyed instead of each value, but not sure what the syntax for that is. 930 AddToImplIncludes("<wtf/NeverDestroyed.h>"); 931 $result .= " static NeverDestroyed<const String> values[] = {\n"; 932 foreach my $value (@{$enumeration->values}) { 933 if ($value eq "") { 934 $result .= " emptyString(),\n"; 935 } else { 936 $result .= " ASCIILiteral(\"$value\"),\n"; 937 } 938 } 939 $result .= " };\n"; 940 my $index = 0; 941 foreach my $value (@{$enumeration->values}) { 942 my $enumerationValueName = GetEnumerationValueName($value); 943 $result .= " static_assert(static_cast<size_t>(${className}::$enumerationValueName) == $index, \"${className}::$enumerationValueName is not $index as expected\");\n"; 944 $index++; 945 } 946 $result .= " ASSERT(static_cast<size_t>(enumerationValue) < WTF_ARRAY_LENGTH(values));\n"; 947 $result .= " return jsStringWithCache(&state, values[static_cast<size_t>(enumerationValue)]);\n"; 948 $result .= "}\n\n"; 949 950 # FIXME: Change to take VM& instead of ExecState&. 951 # FIXME: Consider using toStringOrNull to make exception checking faster. 952 # FIXME: Consider finding a more efficient way to match against all the strings quickly. 953 $result .= "template<> Optional<$className> parseEnumeration<$className>(ExecState& state, JSValue value)\n"; 954 $result .= "{\n"; 955 $result .= " auto stringValue = value.toWTFString(&state);\n"; 956 foreach my $value (@{$enumeration->values}) { 957 my $enumerationValueName = GetEnumerationValueName($value); 958 if ($value eq "") { 959 $result .= " if (stringValue.isEmpty())\n"; 960 } else { 961 $result .= " if (stringValue == \"$value\")\n"; 962 } 963 $result .= " return ${className}::${enumerationValueName};\n"; 964 } 965 $result .= " return Nullopt;\n"; 966 $result .= "}\n\n"; 967 968 $result .= "template<> $className convertEnumeration<$className>(ExecState& state, JSValue value)\n"; 969 $result .= "{\n"; 970 $result .= " VM& vm = state.vm();\n"; 971 $result .= " auto throwScope = DECLARE_THROW_SCOPE(vm);\n"; 972 $result .= " auto result = parseEnumeration<$className>(state, value);\n"; 973 $result .= " if (UNLIKELY(!result)) {\n"; 974 $result .= " throwTypeError(&state, throwScope);\n"; 975 $result .= " return { };\n"; 976 $result .= " }\n"; 977 $result .= " return result.value();\n"; 978 $result .= "}\n\n"; 979 980 $result .= "template<> const char* expectedEnumerationValues<$className>()\n"; 981 $result .= "{\n"; 982 $result .= " return \"\\\"" . join ("\\\", \\\"", @{$enumeration->values}) . "\\\"\";\n"; 983 $result .= "}\n\n"; 984 985 $result .= "#endif\n\n" if $conditionalString; 986 987 return $result; 988 } 989 869 990 sub GenerateEnumerationsImplementationContent 870 991 { … … 872 993 873 994 return "" unless @$enumerations; 995 996 # FIXME: A little ugly to have this be a side effect instead of a return value. 997 AddToImplIncludes("<runtime/JSString.h>"); 998 AddToImplIncludes("JSDOMConvert.h"); 874 999 875 1000 my $result = ""; … … 878 1003 879 1004 my $className = GetEnumerationClassName($name, $interface); 880 881 # FIXME: A little ugly to have this be a side effect instead of a return value.882 AddToImplIncludes("<runtime/JSString.h>");883 884 1005 my $conditionalString = $codeGenerator->GenerateConditionalString($enumeration); 885 $result .= "#if ${conditionalString}\n\n" if $conditionalString; 886 887 # FIXME: Change to take VM& instead of ExecState*. 888 $result .= "template<> JSString* convertEnumerationToJS(ExecState& state, $className enumerationValue)\n"; 889 $result .= "{\n"; 890 # FIXME: Might be nice to make this global be "const", but NeverDestroyed does not currently support that. 891 # FIXME: Might be nice to make the entire array be NeverDestroyed instead of each value, but not sure what the syntax for that is. 892 AddToImplIncludes("<wtf/NeverDestroyed.h>"); 893 $result .= " static NeverDestroyed<const String> values[] = {\n"; 894 foreach my $value (@{$enumeration->values}) { 895 if ($value eq "") { 896 $result .= " emptyString(),\n"; 897 } else { 898 $result .= " ASCIILiteral(\"$value\"),\n"; 899 } 900 } 901 $result .= " };\n"; 902 my $index = 0; 903 foreach my $value (@{$enumeration->values}) { 904 my $enumerationValueName = GetEnumerationValueName($value); 905 $result .= " static_assert(static_cast<size_t>(${className}::$enumerationValueName) == $index, \"${className}::$enumerationValueName is not $index as expected\");\n"; 906 $index++; 907 } 908 $result .= " ASSERT(static_cast<size_t>(enumerationValue) < WTF_ARRAY_LENGTH(values));\n"; 909 $result .= " return jsStringWithCache(&state, values[static_cast<size_t>(enumerationValue)]);\n"; 910 $result .= "}\n\n"; 911 912 # FIXME: Change to take VM& instead of ExecState&. 913 # FIXME: Consider using toStringOrNull to make exception checking faster. 914 # FIXME: Consider finding a more efficient way to match against all the strings quickly. 915 $result .= "template<> Optional<$className> parseEnumeration<$className>(ExecState& state, JSValue value)\n"; 916 $result .= "{\n"; 917 $result .= " auto stringValue = value.toWTFString(&state);\n"; 918 foreach my $value (@{$enumeration->values}) { 919 my $enumerationValueName = GetEnumerationValueName($value); 920 if ($value eq "") { 921 $result .= " if (stringValue.isEmpty())\n"; 922 } else { 923 $result .= " if (stringValue == \"$value\")\n"; 924 } 925 $result .= " return ${className}::${enumerationValueName};\n"; 926 } 927 $result .= " return Nullopt;\n"; 928 $result .= "}\n\n"; 929 930 # FIXME: A little ugly to have this be a side effect instead of a return value. 931 AddToImplIncludes("JSDOMConvert.h"); 932 933 $result .= "template<> $className convertEnumeration<$className>(ExecState& state, JSValue value)\n"; 934 $result .= "{\n"; 935 $result .= " VM& vm = state.vm();\n"; 936 $result .= " auto throwScope = DECLARE_THROW_SCOPE(vm);\n"; 937 $result .= " auto result = parseEnumeration<$className>(state, value);\n"; 938 $result .= " if (UNLIKELY(!result)) {\n"; 939 $result .= " throwTypeError(&state, throwScope);\n"; 940 $result .= " return { };\n"; 941 $result .= " }\n"; 942 $result .= " return result.value();\n"; 943 $result .= "}\n\n"; 944 945 $result .= "template<> const char* expectedEnumerationValues<$className>()\n"; 946 $result .= "{\n"; 947 $result .= " return \"\\\"" . join ("\\\", \\\"", @{$enumeration->values}) . "\\\"\";\n"; 948 $result .= "}\n\n"; 949 950 $result .= "#endif\n\n" if $conditionalString; 951 } 1006 $result .= GenerateEnumerationImplementationContent($enumeration, $className, $interface, $conditionalString); 1007 } 1008 return $result; 1009 } 1010 1011 sub GenerateEnumerationHeaderContent 1012 { 1013 my ($enumeration, $className, $conditionalString) = @_; 1014 1015 my $result = ""; 1016 $result .= "#if ${conditionalString}\n\n" if $conditionalString; 1017 $result .= "template<> JSC::JSString* convertEnumerationToJS(JSC::ExecState&, $className);\n\n"; 1018 $result .= "template<> Optional<$className> parseEnumeration<$className>(JSC::ExecState&, JSC::JSValue);\n"; 1019 $result .= "template<> $className convertEnumeration<$className>(JSC::ExecState&, JSC::JSValue);\n"; 1020 $result .= "template<> const char* expectedEnumerationValues<$className>();\n\n"; 1021 $result .= "#endif\n\n" if $conditionalString; 1022 952 1023 return $result; 953 1024 } … … 965 1036 966 1037 my $result = ""; 967 968 1038 foreach my $enumeration (@$enumerations) { 969 my $name = $enumeration->name; 970 971 my $className = GetEnumerationClassName($name, $interface); 972 1039 my $className = GetEnumerationClassName($enumeration->name, $interface); 973 1040 my $conditionalString = $codeGenerator->GenerateConditionalString($enumeration); 974 $result .= "#if ${conditionalString}\n\n" if $conditionalString; 975 976 $result .= "template<> JSC::JSString* convertEnumerationToJS(JSC::ExecState&, $className);\n\n"; 977 978 $result .= "template<> Optional<$className> parseEnumeration<$className>(JSC::ExecState&, JSC::JSValue);\n"; 979 $result .= "template<> $className convertEnumeration<$className>(JSC::ExecState&, JSC::JSValue);\n"; 980 $result .= "template<> const char* expectedEnumerationValues<$className>();\n\n"; 981 982 $result .= "#endif\n\n" if $conditionalString; 1041 $result .= GenerateEnumerationHeaderContent($enumeration, $className, $conditionalString); 983 1042 } 984 1043 return $result; … … 4396 4455 } 4397 4456 4457 $implIncludes{"JS$className.h"} = 1 if $codeGenerator->IsExternalEnumType($type); 4398 4458 push(@$outputArray, "$indent $defineOptionalValue = parseEnumeration<$className>(*state, ${name}Value);\n"); 4399 4459 push(@$outputArray, "$indent RETURN_IF_EXCEPTION(throwScope, encodedJSValue());\n"); … … 5304 5364 5305 5365 return ("to$type($value)", 1) if $codeGenerator->IsTypedArrayType($type); 5306 return ("parseEnumeration<" . GetEnumerationClassName($type, $interface) . ">($stateReference, $value)", 1) if $codeGenerator->IsEnumType($type); 5307 5366 5367 if ($codeGenerator->IsEnumType($type)) { 5368 AddToImplIncludes("JS$type.h", $conditional) if $codeGenerator->IsExternalEnumType($type); 5369 return ("parseEnumeration<" . GetEnumerationClassName($type, $interface) . ">($stateReference, $value)", 1); 5370 } 5371 5308 5372 AddToImplIncludes("JS$type.h", $conditional); 5309 5373 -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
r207912 r207937 53 53 #include "JSTestObj.h" 54 54 #include "JSTestStandaloneDictionary.h" 55 #include "JSTestStandaloneEnumeration.h" 55 56 #include "JSTestSubObj.h" 56 57 #include "JSXPathNSResolver.h" … … 961 962 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionNullableStringSpecialMethod(JSC::ExecState*); 962 963 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithEnumArg(JSC::ExecState*); 964 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithStandaloneEnumArg(JSC::ExecState*); 963 965 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalEnumArg(JSC::ExecState*); 964 966 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalEnumArgAndDefaultValue(JSC::ExecState*); … … 1572 1574 { "nullableStringSpecialMethod", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionNullableStringSpecialMethod), (intptr_t) (1) } }, 1573 1575 { "methodWithEnumArg", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithEnumArg), (intptr_t) (1) } }, 1576 { "methodWithStandaloneEnumArg", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithStandaloneEnumArg), (intptr_t) (1) } }, 1574 1577 { "methodWithOptionalEnumArg", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalEnumArg), (intptr_t) (0) } }, 1575 1578 { "methodWithOptionalEnumArgAndDefaultValue", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalEnumArgAndDefaultValue), (intptr_t) (0) } }, … … 5187 5190 } 5188 5191 5192 static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionMethodWithStandaloneEnumArgCaller(JSC::ExecState*, JSTestObj*, JSC::ThrowScope&); 5193 5194 EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithStandaloneEnumArg(ExecState* state) 5195 { 5196 return BindingCaller<JSTestObj>::callOperation<jsTestObjPrototypeFunctionMethodWithStandaloneEnumArgCaller>(state, "methodWithStandaloneEnumArg"); 5197 } 5198 5199 static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionMethodWithStandaloneEnumArgCaller(JSC::ExecState* state, JSTestObj* castedThis, JSC::ThrowScope& throwScope) 5200 { 5201 UNUSED_PARAM(state); 5202 UNUSED_PARAM(throwScope); 5203 auto& impl = castedThis->wrapped(); 5204 if (UNLIKELY(state->argumentCount() < 1)) 5205 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 5206 auto enumArgValue = state->uncheckedArgument(0); 5207 TestStandaloneEnumeration enumArg; 5208 auto optionalValue = parseEnumeration<TestStandaloneEnumeration>(*state, enumArgValue); 5209 RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); 5210 if (UNLIKELY(!optionalValue)) 5211 return throwArgumentMustBeEnumError(*state, throwScope, 0, "enumArg", "TestObject", "methodWithStandaloneEnumArg", expectedEnumerationValues<TestStandaloneEnumeration>()); 5212 enumArg = optionalValue.value(); 5213 impl.methodWithStandaloneEnumArg(enumArg); 5214 return JSValue::encode(jsUndefined()); 5215 } 5216 5189 5217 static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionMethodWithOptionalEnumArgCaller(JSC::ExecState*, JSTestObj*, JSC::ThrowScope&); 5190 5218 -
trunk/Source/WebCore/bindings/scripts/test/TestObj.idl
r207766 r207937 136 136 137 137 void methodWithEnumArg(TestEnumType enumArg); 138 void methodWithStandaloneEnumArg(TestStandaloneEnumeration enumArg); 138 139 void methodWithOptionalEnumArg(optional TestEnumType enumArg); 139 140 void methodWithOptionalEnumArgAndDefaultValue(optional TestEnumType enumArg = "EnumValue1"); -
trunk/Source/WebCore/bindings/scripts/test/TestStandaloneEnumeration.idl
r207935 r207937 1 /* 2 * Copyright (C) 2010 Google Inc. All rights reserved. 3 * Copyright (C) 2011 Apple Inc. All rights reserved. 1 /* 2 * Copyright (C) 2016 Apple Inc. All rights reserved. 4 3 * 5 * Redistribution and use in source and binary form s, with or without4 * Redistribution and use in source and binary form, with or without 6 5 * modification, are permitted provided that the following conditions 7 6 * are met: … … 12 11 * notice, this list of conditions and the following disclaimer in the 13 12 * documentation and/or other materials provided with the distribution. 13 * 3. Neither the name of Apple Inc. ("Apple") nor the names of 14 * its contributors may be used to endorse or promote products derived 15 * from this software without specific prior written permission. 14 16 * 15 17 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY … … 26 28 27 29 [ 28 ActiveDOMObject, 29 Conditional=INDEXED_DATABASE, 30 EnabledAtRuntime=IndexedDB, 31 SkipVTableValidation, 32 ] interface IDBTransaction : EventTarget { 33 readonly attribute DOMStringList objectStoreNames; 34 readonly attribute DOMString mode; 35 readonly attribute IDBDatabase db; 36 readonly attribute DOMError error; 30 Conditional=CONDITION, 31 ] enum TestStandaloneEnumeration { 32 "enumValue1", 33 "enumValue2" 34 }; 37 35 38 [MayThrowException] IDBObjectStore objectStore(DOMString name);39 [MayThrowException] void abort();40 41 attribute EventHandler onabort;42 attribute EventHandler oncomplete;43 attribute EventHandler onerror;44 }; -
trunk/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp
r207931 r207937 183 183 } 184 184 185 static RefPtr<IDBTransaction> transactionForDatabase(IDBDatabase* idbDatabase, const String& objectStoreName, const String& mode = IDBTransaction::modeReadOnly())185 static RefPtr<IDBTransaction> transactionForDatabase(IDBDatabase* idbDatabase, const String& objectStoreName, IDBTransactionMode mode = IDBTransactionMode::Readonly) 186 186 { 187 187 auto result = idbDatabase->transaction(objectStoreName, mode); … … 692 692 return; 693 693 694 auto idbTransaction = transactionForDatabase(&database, m_objectStoreName, IDBTransaction ::modeReadWrite());694 auto idbTransaction = transactionForDatabase(&database, m_objectStoreName, IDBTransactionMode::Readwrite); 695 695 if (!idbTransaction) { 696 696 m_requestCallback->sendFailure("Could not get transaction");
Note: See TracChangeset
for help on using the changeset viewer.