Diff
Modified: trunk/Source/WebCore/ChangeLog (125729 => 125730)
--- trunk/Source/WebCore/ChangeLog 2012-08-16 00:52:20 UTC (rev 125729)
+++ trunk/Source/WebCore/ChangeLog 2012-08-16 00:57:53 UTC (rev 125730)
@@ -1,3 +1,33 @@
+2012-08-15 Alec Flett <[email protected]>
+
+ IndexedDB: IDB*::keyPath should return IDBKeyPath, not IDBAny
+ https://bugs.webkit.org/show_bug.cgi?id=92434
+
+ Reviewed by Tony Chang.
+
+ Clean up IDBKeyPath conversion to IDBAny objects. This gets rid of
+ some implicit conversion from IDBKeyPath to IDBAny.
+
+ No new tests, just changing method signatures.
+
+ * Modules/indexeddb/IDBAny.cpp:
+ (WebCore::IDBAny::set):
+ (WebCore):
+ * Modules/indexeddb/IDBAny.h:
+ (WebCore):
+ (WebCore::IDBAny::create):
+ (IDBAny):
+ * Modules/indexeddb/IDBIndex.h:
+ (WebCore::IDBIndex::keyPathAny):
+ (WebCore::IDBIndex::keyPath):
+ * Modules/indexeddb/IDBIndex.idl:
+ * Modules/indexeddb/IDBKeyPath.cpp:
+ * Modules/indexeddb/IDBKeyPath.h:
+ * Modules/indexeddb/IDBObjectStore.h:
+ (WebCore::IDBObjectStore::keyPathAny):
+ (WebCore::IDBObjectStore::keyPath):
+ * Modules/indexeddb/IDBObjectStore.idl:
+
2012-08-15 Ryosuke Niwa <[email protected]>
EFL build fix attempt after r125711. Touch an IDL file to regenerate derived sources.
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBAny.cpp (125729 => 125730)
--- trunk/Source/WebCore/Modules/indexeddb/IDBAny.cpp 2012-08-16 00:52:20 UTC (rev 125729)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBAny.cpp 2012-08-16 00:57:53 UTC (rev 125730)
@@ -32,6 +32,7 @@
#include "IDBDatabase.h"
#include "IDBFactory.h"
#include "IDBIndex.h"
+#include "IDBKeyPath.h"
#include "IDBObjectStore.h"
#include "SerializedScriptValue.h"
@@ -207,6 +208,27 @@
m_serializedScriptValue = value;
}
+void IDBAny::set(const IDBKeyPath& value)
+{
+ ASSERT(m_type == UndefinedType);
+ switch (value.type()) {
+ case IDBKeyPath::NullType:
+ m_type = NullType;
+ break;
+ case IDBKeyPath::StringType:
+ m_type = StringType;
+ m_string = value.string();
+ break;
+ case IDBKeyPath::ArrayType:
+ RefPtr<DOMStringList> keyPaths = DOMStringList::create();
+ for (Vector<String>::const_iterator it = value.array().begin(); it != value.array().end(); ++it)
+ keyPaths->append(*it);
+ m_type = DOMStringListType;
+ m_domStringList = keyPaths.release();
+ break;
+ }
+}
+
void IDBAny::set(const String& value)
{
ASSERT(m_type == UndefinedType);
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBAny.h (125729 => 125730)
--- trunk/Source/WebCore/Modules/indexeddb/IDBAny.h 2012-08-16 00:52:20 UTC (rev 125729)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBAny.h 2012-08-16 00:57:53 UTC (rev 125730)
@@ -42,6 +42,7 @@
class IDBFactory;
class IDBIndex;
class IDBKey;
+class IDBKeyPath;
class IDBObjectStore;
class IDBTransaction;
class SerializedScriptValue;
@@ -58,6 +59,12 @@
any->set(idbObject);
return any.release();
}
+ static PassRefPtr<IDBAny> create(const IDBKeyPath& keyPath)
+ {
+ RefPtr<IDBAny> any = IDBAny::createInvalid();
+ any->set(keyPath);
+ return any.release();
+ }
template<typename T>
static PassRefPtr<IDBAny> create(PassRefPtr<T> idbObject)
{
@@ -109,6 +116,7 @@
void set(PassRefPtr<IDBObjectStore>);
void set(PassRefPtr<IDBTransaction>);
void set(PassRefPtr<SerializedScriptValue>);
+ void set(const IDBKeyPath&);
void set(const String&);
private:
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBIndex.h (125729 => 125730)
--- trunk/Source/WebCore/Modules/indexeddb/IDBIndex.h 2012-08-16 00:52:20 UTC (rev 125729)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBIndex.h 2012-08-16 00:57:53 UTC (rev 125730)
@@ -53,7 +53,8 @@
// Implement the IDL
const String name() const { return m_metadata.name; }
PassRefPtr<IDBObjectStore> objectStore() const { return m_objectStore; }
- PassRefPtr<IDBAny> keyPath() const { return m_metadata.keyPath; }
+ PassRefPtr<IDBAny> keyPathAny() const { return IDBAny::create(m_metadata.keyPath); }
+ const IDBKeyPath keyPath() const { return m_metadata.keyPath; }
bool unique() const { return m_metadata.unique; }
bool multiEntry() const { return m_metadata.multiEntry; }
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBIndex.idl (125729 => 125730)
--- trunk/Source/WebCore/Modules/indexeddb/IDBIndex.idl 2012-08-16 00:52:20 UTC (rev 125729)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBIndex.idl 2012-08-16 00:57:53 UTC (rev 125730)
@@ -30,7 +30,7 @@
] IDBIndex {
readonly attribute DOMString name;
readonly attribute IDBObjectStore objectStore;
- readonly attribute IDBAny keyPath;
+ readonly attribute [ImplementedAs=keyPathAny] IDBAny keyPath;
readonly attribute boolean unique;
readonly attribute boolean multiEntry;
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBKeyPath.cpp (125729 => 125730)
--- trunk/Source/WebCore/Modules/indexeddb/IDBKeyPath.cpp 2012-08-16 00:52:20 UTC (rev 125729)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBKeyPath.cpp 2012-08-16 00:57:53 UTC (rev 125730)
@@ -219,48 +219,6 @@
return false;
}
-IDBKeyPath::operator PassRefPtr<IDBAny>() const
-{
- switch (m_type) {
- case NullType:
- return IDBAny::createNull();
- case StringType:
- return IDBAny::createString(m_string);
- case ArrayType:
- RefPtr<DOMStringList> keyPaths = DOMStringList::create();
- for (Vector<String>::const_iterator it = m_array.begin(); it != m_array.end(); ++it)
- keyPaths->append(*it);
- return IDBAny::create(static_cast<PassRefPtr<DOMStringList> >(keyPaths));
- }
- ASSERT_NOT_REACHED();
- return 0;
-}
-
-bool IDBKeyPath::operator==(PassRefPtr<IDBAny> other) const
-{
- if (!isValid())
- return false;
-
- switch (m_type) {
- case NullType:
- return other->type() == IDBAny::NullType;
- case StringType:
- return other->type() == IDBAny::StringType && other->string() == string();
- case ArrayType:
- if (other->type() != IDBAny::DOMStringListType)
- return false;
-
- RefPtr<DOMStringList> otherList = other->domStringList();
- for (size_t i = 0; i < m_array.size(); ++i) {
- if (otherList->item(i) != m_array[i])
- return false;
- }
- return true;
- }
- ASSERT_NOT_REACHED();
- return false;
-}
-
bool IDBKeyPath::operator==(const IDBKeyPath& other) const
{
if (m_type != other.m_type)
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBKeyPath.h (125729 => 125730)
--- trunk/Source/WebCore/Modules/indexeddb/IDBKeyPath.h 2012-08-16 00:52:20 UTC (rev 125729)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBKeyPath.h 2012-08-16 00:57:53 UTC (rev 125730)
@@ -28,7 +28,6 @@
#if ENABLE(INDEXED_DATABASE)
-#include "IDBAny.h"
#include "PlatformString.h"
#include <wtf/Vector.h>
@@ -71,8 +70,6 @@
bool isNull() const { return m_type == NullType; }
bool isValid() const;
- operator PassRefPtr<IDBAny>() const;
- bool operator==(PassRefPtr<IDBAny> other) const;
bool operator==(const IDBKeyPath& other) const;
private:
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.h (125729 => 125730)
--- trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.h 2012-08-16 00:52:20 UTC (rev 125729)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.h 2012-08-16 00:57:53 UTC (rev 125730)
@@ -58,7 +58,8 @@
// Implement the IDBObjectStore IDL
const String name() const { return m_metadata.name; }
- PassRefPtr<IDBAny> keyPath() const { return m_metadata.keyPath; }
+ PassRefPtr<IDBAny> keyPathAny() const { return IDBAny::create(m_metadata.keyPath); }
+ const IDBKeyPath keyPath() const { return m_metadata.keyPath; }
PassRefPtr<DOMStringList> indexNames() const;
PassRefPtr<IDBTransaction> transaction() const { return m_transaction; }
bool autoIncrement() const { return m_metadata.autoIncrement; }
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.idl (125729 => 125730)
--- trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.idl 2012-08-16 00:52:20 UTC (rev 125729)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.idl 2012-08-16 00:57:53 UTC (rev 125730)
@@ -29,7 +29,7 @@
Conditional=INDEXED_DATABASE
] IDBObjectStore {
readonly attribute [TreatReturnedNullStringAs=Null] DOMString name;
- readonly attribute IDBAny keyPath;
+ readonly attribute [ImplementedAs=keyPathAny] IDBAny keyPath;
readonly attribute DOMStringList indexNames;
readonly attribute IDBTransaction transaction;
readonly attribute boolean autoIncrement;