diff options
author | hans@chromium.org <hans@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-10 14:28:12 +0000 |
---|---|---|
committer | hans@chromium.org <hans@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-10 14:28:12 +0000 |
commit | f4c308a5397bced16aca71fe449e0f23ae46e1cd (patch) | |
tree | d68ce1729a8b064a8b71877e3addfa3a59a99c4d | |
parent | 56b9dc2e57bb721153ef8915fbebf8377a870ab1 (diff) | |
download | chromium_src-f4c308a5397bced16aca71fe449e0f23ae46e1cd.zip chromium_src-f4c308a5397bced16aca71fe449e0f23ae46e1cd.tar.gz chromium_src-f4c308a5397bced16aca71fe449e0f23ae46e1cd.tar.bz2 |
IndexedDB: Numeric keys are floating point.
Depends on WebKit r73697.
BUG=65619
TEST=browser_tests
Review URL: http://codereview.chromium.org/5695002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@68851 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/common/indexed_db_key.cc | 5 | ||||
-rw-r--r-- | chrome/common/indexed_db_key.h | 6 | ||||
-rw-r--r-- | chrome/common/indexed_db_param_traits.cc | 2 | ||||
-rw-r--r-- | chrome/test/data/indexeddb/cursor_test.js | 6 |
4 files changed, 9 insertions, 10 deletions
diff --git a/chrome/common/indexed_db_key.cc b/chrome/common/indexed_db_key.cc index b4b0de4..4488673 100644 --- a/chrome/common/indexed_db_key.cc +++ b/chrome/common/indexed_db_key.cc @@ -34,7 +34,7 @@ void IndexedDBKey::Set(const string16& string) { string_ = string; } -void IndexedDBKey::Set(int32_t number) { +void IndexedDBKey::Set(double number) { type_ = WebIDBKey::NumberType; number_ = number; } @@ -43,8 +43,7 @@ void IndexedDBKey::Set(const WebIDBKey& key) { type_ = key.type(); string_ = key.type() == WebIDBKey::StringType ? static_cast<string16>(key.string()) : string16(); - number_ = key.type() == WebIDBKey::NumberType ? - static_cast<int32_t>(key.number()) : 0; + number_ = key.type() == WebIDBKey::NumberType ? key.number() : 0; } IndexedDBKey::operator WebIDBKey() const { diff --git a/chrome/common/indexed_db_key.h b/chrome/common/indexed_db_key.h index 29c1792..60b4529 100644 --- a/chrome/common/indexed_db_key.h +++ b/chrome/common/indexed_db_key.h @@ -19,19 +19,19 @@ class IndexedDBKey { void SetNull(); void SetInvalid(); void Set(const string16& string); - void Set(int32_t number); + void Set(double number); void Set(const WebKit::WebIDBKey& key); WebKit::WebIDBKey::Type type() const { return type_; } const string16& string() const { return string_; } - int32_t number() const { return number_; } + double number() const { return number_; } operator WebKit::WebIDBKey() const; private: WebKit::WebIDBKey::Type type_; string16 string_; - int32_t number_; + double number_; }; #endif // CHROME_COMMON_INDEXED_DB_KEY_H_ diff --git a/chrome/common/indexed_db_param_traits.cc b/chrome/common/indexed_db_param_traits.cc index fd47ecf..3bab96e 100644 --- a/chrome/common/indexed_db_param_traits.cc +++ b/chrome/common/indexed_db_param_traits.cc @@ -58,7 +58,7 @@ bool ParamTraits<IndexedDBKey>::Read(const Message* m, param_type* r) { int type; string16 string; - int32 number; + double number; bool ok = ReadParam(m, iter, &type) && ReadParam(m, iter, &string) && diff --git a/chrome/test/data/indexeddb/cursor_test.js b/chrome/test/data/indexeddb/cursor_test.js index 1c6b40c..968cc5f 100644 --- a/chrome/test/data/indexeddb/cursor_test.js +++ b/chrome/test/data/indexeddb/cursor_test.js @@ -28,7 +28,7 @@ function cursorSuccess() debug('Cursor opened successfully.'); shouldBe("event.result.direction", "0"); - shouldBe("event.result.key", "'myKey'"); + shouldBe("event.result.key", "3.14"); shouldBe("event.result.value", "'myValue'"); cursor.continue(); @@ -37,7 +37,7 @@ function cursorSuccess() function openCursor(objectStore) { debug('Opening cursor'); - var keyRange = webkitIDBKeyRange.lowerBound('myKey'); + var keyRange = webkitIDBKeyRange.lowerBound(3.12); var result = objectStore.openCursor({range: keyRange}); result.onsuccess = cursorSuccess; result.onerror = unexpectedErrorCallback; @@ -54,7 +54,7 @@ function populateObjectStore() debug('Populating object store'); deleteAllObjectStores(db); window.objectStore = db.createObjectStore('test'); - var result = objectStore.add('myValue', 'myKey'); + var result = objectStore.add('myValue', 3.14); result.onsuccess = dataAddedSuccess; result.onerror = unexpectedErrorCallback; } |