Title: [115922] trunk
Revision
115922
Author
z...@google.com
Date
2012-05-02 18:12:03 -0700 (Wed, 02 May 2012)

Log Message

Unreviewed, rolling out r115902.
http://trac.webkit.org/changeset/115902
https://bugs.webkit.org/show_bug.cgi?id=85441

Compile failure on linux 32 (Requested by zhenyao on #webkit).

Patch by Sheriff Bot <webkit.review....@gmail.com> on 2012-05-02

Source/WebCore: 

* Modules/indexeddb/IDBBackingStore.h:
(IDBBackingStore):
* Modules/indexeddb/IDBLevelDBBackingStore.cpp:
(WebCore::IDBLevelDBBackingStore::nextAutoIncrementNumber):
* Modules/indexeddb/IDBLevelDBBackingStore.h:
(IDBLevelDBBackingStore):
* Modules/indexeddb/IDBObjectStoreBackendImpl.cpp:
(WebCore::IDBObjectStoreBackendImpl::putInternal):
(WebCore::IDBObjectStoreBackendImpl::genAutoIncrementKey):
* Modules/indexeddb/IDBObjectStoreBackendImpl.h:
(IDBObjectStoreBackendImpl):

LayoutTests: 

* storage/indexeddb/key-generator-expected.txt:
* storage/indexeddb/resources/key-generator.js:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (115921 => 115922)


--- trunk/LayoutTests/ChangeLog	2012-05-03 00:53:06 UTC (rev 115921)
+++ trunk/LayoutTests/ChangeLog	2012-05-03 01:12:03 UTC (rev 115922)
@@ -1,5 +1,16 @@
 2012-05-02  Sheriff Bot  <webkit.review....@gmail.com>
 
+        Unreviewed, rolling out r115902.
+        http://trac.webkit.org/changeset/115902
+        https://bugs.webkit.org/show_bug.cgi?id=85441
+
+        Compile failure on linux 32 (Requested by zhenyao on #webkit).
+
+        * storage/indexeddb/key-generator-expected.txt:
+        * storage/indexeddb/resources/key-generator.js:
+
+2012-05-02  Sheriff Bot  <webkit.review....@gmail.com>
+
         Unreviewed, rolling out r115905.
         http://trac.webkit.org/changeset/115905
         https://bugs.webkit.org/show_bug.cgi?id=85435

Modified: trunk/LayoutTests/storage/indexeddb/key-generator-expected.txt (115921 => 115922)


--- trunk/LayoutTests/storage/indexeddb/key-generator-expected.txt	2012-05-03 00:53:06 UTC (rev 115921)
+++ trunk/LayoutTests/storage/indexeddb/key-generator-expected.txt	2012-05-03 01:12:03 UTC (rev 115922)
@@ -142,29 +142,6 @@
 PASS Got "c" for key: 1
 PASS Got "d" for key: 2
 db.close()
-
-Verify that keys above 2^53 result in errors.
-request = indexedDB.deleteDatabase('key-generator')
-request = indexedDB.open('key-generator')
-db = request.result
-request = db.setVersion('1')
-trans = request.result
-trans1 = db.transaction(['store'], IDBTransaction.READ_WRITE)
-store_t1 = trans1.objectStore('store')
-store_t1.put('a')
-request = store.get(1)
-store_t1.put('b', 9007199254740992)
-request = store.get(9007199254740992)
-store_t1.put('c')
-store_t1.put('d', 2)
-request = store.get(2)
-PASS Got "a" for key: 1
-PASS Got "b" for key: 9007199254740992
-Error event fired auto-incrementing past 2^53 (as expected)
-PASS event.target.errorCode is IDBDatabaseException.DATA_ERR
-event.preventDefault()
-PASS Got "d" for key: 2
-db.close()
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/storage/indexeddb/resources/key-generator.js (115921 => 115922)


--- trunk/LayoutTests/storage/indexeddb/resources/key-generator.js	2012-05-03 00:53:06 UTC (rev 115921)
+++ trunk/LayoutTests/storage/indexeddb/resources/key-generator.js	2012-05-03 01:12:03 UTC (rev 115922)
@@ -203,31 +203,4 @@
     }
 );
 
-defineTest(
-    'Verify that keys above 2^53 result in errors.',
-    function (db, trans) {
-        db.createObjectStore('store', { autoIncrement: true });
-    },
-
-    function (db, callback) {
-        evalAndLog("trans1 = db.transaction(['store'], IDBTransaction.READ_WRITE)");
-        evalAndLog("store_t1 = trans1.objectStore('store')");
-        evalAndLog("store_t1.put('a')");
-        check(store_t1, 1, 'a');
-        evalAndLog("store_t1.put('b', 9007199254740992)");
-        check(store_t1, 9007199254740992, 'b');
-        request = evalAndLog("store_t1.put('c')");
-        request._onsuccess_ = unexpectedSuccessCallback;
-        request._onerror_ = function () {
-            debug("Error event fired auto-incrementing past 2^53 (as expected)");
-            shouldBe("event.target.errorCode", "IDBDatabaseException.DATA_ERR");
-            evalAndLog("event.preventDefault()");
-        };
-        evalAndLog("store_t1.put('d', 2)");
-        check(store_t1, 2, 'd');
-
-        trans1._oncomplete_ = callback;
-    }
-);
-
-test();
+test();
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (115921 => 115922)


--- trunk/Source/WebCore/ChangeLog	2012-05-03 00:53:06 UTC (rev 115921)
+++ trunk/Source/WebCore/ChangeLog	2012-05-03 01:12:03 UTC (rev 115922)
@@ -1,3 +1,23 @@
+2012-05-02  Sheriff Bot  <webkit.review....@gmail.com>
+
+        Unreviewed, rolling out r115902.
+        http://trac.webkit.org/changeset/115902
+        https://bugs.webkit.org/show_bug.cgi?id=85441
+
+        Compile failure on linux 32 (Requested by zhenyao on #webkit).
+
+        * Modules/indexeddb/IDBBackingStore.h:
+        (IDBBackingStore):
+        * Modules/indexeddb/IDBLevelDBBackingStore.cpp:
+        (WebCore::IDBLevelDBBackingStore::nextAutoIncrementNumber):
+        * Modules/indexeddb/IDBLevelDBBackingStore.h:
+        (IDBLevelDBBackingStore):
+        * Modules/indexeddb/IDBObjectStoreBackendImpl.cpp:
+        (WebCore::IDBObjectStoreBackendImpl::putInternal):
+        (WebCore::IDBObjectStoreBackendImpl::genAutoIncrementKey):
+        * Modules/indexeddb/IDBObjectStoreBackendImpl.h:
+        (IDBObjectStoreBackendImpl):
+
 2012-05-02  Julien Chaffraix  <jchaffr...@webkit.org>
 
         Add ASSERTs to avoid querying dirtied z-index or normal flow lists on RenderLayer

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBBackingStore.h (115921 => 115922)


--- trunk/Source/WebCore/Modules/indexeddb/IDBBackingStore.h	2012-05-03 00:53:06 UTC (rev 115921)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBBackingStore.h	2012-05-03 01:12:03 UTC (rev 115922)
@@ -67,7 +67,7 @@
     virtual bool putObjectStoreRecord(int64_t databaseId, int64_t objectStoreId, const IDBKey&, const String& value, ObjectStoreRecordIdentifier*) = 0;
     virtual void clearObjectStore(int64_t databaseId, int64_t objectStoreId) = 0;
     virtual void deleteObjectStoreRecord(int64_t databaseId, int64_t objectStoreId, const ObjectStoreRecordIdentifier*) = 0;
-    virtual int64_t nextAutoIncrementNumber(int64_t databaseId, int64_t objectStoreId) = 0;
+    virtual double nextAutoIncrementNumber(int64_t databaseId, int64_t objectStoreId) = 0;
     virtual bool keyExistsInObjectStore(int64_t databaseId, int64_t objectStoreId, const IDBKey&, ObjectStoreRecordIdentifier* foundRecordIdentifier) = 0;
 
     class ObjectStoreRecordCallback {

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBLevelDBBackingStore.cpp (115921 => 115922)


--- trunk/Source/WebCore/Modules/indexeddb/IDBLevelDBBackingStore.cpp	2012-05-03 00:53:06 UTC (rev 115921)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBLevelDBBackingStore.cpp	2012-05-03 01:12:03 UTC (rev 115922)
@@ -602,7 +602,7 @@
     m_currentTransaction->remove(existsEntryKey);
 }
 
-int64_t IDBLevelDBBackingStore::nextAutoIncrementNumber(int64_t databaseId, int64_t objectStoreId)
+double IDBLevelDBBackingStore::nextAutoIncrementNumber(int64_t databaseId, int64_t objectStoreId)
 {
     ASSERT(m_currentTransaction);
     const Vector<char> startKey = ObjectStoreDataKey::encode(databaseId, objectStoreId, minIDBKey());
@@ -610,10 +610,9 @@
 
     OwnPtr<LevelDBIterator> it = m_currentTransaction->createIterator();
 
-    int64_t maxNumericKey = 0;
+    int maxNumericKey = 0;
 
-    // FIXME: This does a forward scan over all keys. Improve it.
-    // Since all dates > all numbers, create Date(-Infinity) and seek backwards.
+    // FIXME: Be more efficient: seek to something after the object store data, then reverse.
 
     for (it->seek(startKey); it->isValid() && compareKeys(it->key(), stopKey) < 0; it->next()) {
         const char *p = it->key().begin();

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBLevelDBBackingStore.h (115921 => 115922)


--- trunk/Source/WebCore/Modules/indexeddb/IDBLevelDBBackingStore.h	2012-05-03 00:53:06 UTC (rev 115921)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBLevelDBBackingStore.h	2012-05-03 01:12:03 UTC (rev 115922)
@@ -58,7 +58,7 @@
     virtual bool putObjectStoreRecord(int64_t databaseId, int64_t objectStoreId, const IDBKey&, const String& value, ObjectStoreRecordIdentifier*);
     virtual void clearObjectStore(int64_t databaseId, int64_t objectStoreId);
     virtual void deleteObjectStoreRecord(int64_t databaseId, int64_t objectStoreId, const ObjectStoreRecordIdentifier*);
-    virtual int64_t nextAutoIncrementNumber(int64_t databaseId, int64_t objectStoreId);
+    virtual double nextAutoIncrementNumber(int64_t databaseId, int64_t objectStoreId);
     virtual bool keyExistsInObjectStore(int64_t databaseId, int64_t objectStoreId, const IDBKey&, ObjectStoreRecordIdentifier* foundRecordIdentifier);
 
     virtual bool forEachObjectStoreRecord(int64_t databaseId, int64_t objectStoreId, ObjectStoreRecordCallback&);

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.cpp (115921 => 115922)


--- trunk/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.cpp	2012-05-03 00:53:06 UTC (rev 115921)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.cpp	2012-05-03 01:12:03 UTC (rev 115922)
@@ -255,10 +255,6 @@
         if (autoIncrement) {
             if (!key) {
                 RefPtr<IDBKey> autoIncKey = objectStore->genAutoIncrementKey();
-                if (!autoIncKey->valid()) {
-                    callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::DATA_ERR, "Maximum key generator value reached."));
-                    return;
-                }
                 if (hasKeyPath) {
                     RefPtr<SerializedScriptValue> valueAfterInjection = injectKeyIntoKeyPath(autoIncKey, value, objectStore->m_keyPath);
                     ASSERT(valueAfterInjection);
@@ -683,15 +679,10 @@
 
 PassRefPtr<IDBKey> IDBObjectStoreBackendImpl::genAutoIncrementKey()
 {
-    const int64_t kMaxGeneratorValue = 9007199254740992; // Maximum integer storable as ECMAScript number.
-    if (m_autoIncrementNumber > kMaxGeneratorValue)
-        return IDBKey::createInvalid();
     if (m_autoIncrementNumber > 0)
         return IDBKey::createNumber(m_autoIncrementNumber++);
 
-    m_autoIncrementNumber = m_backingStore->nextAutoIncrementNumber(m_databaseId, id());
-    if (m_autoIncrementNumber > kMaxGeneratorValue)
-        return IDBKey::createInvalid();
+    m_autoIncrementNumber = static_cast<int>(m_backingStore->nextAutoIncrementNumber(m_databaseId, id()));
     return IDBKey::createNumber(m_autoIncrementNumber++);
 }
 

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.h (115921 => 115922)


--- trunk/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.h	2012-05-03 00:53:06 UTC (rev 115921)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.h	2012-05-03 01:12:03 UTC (rev 115922)
@@ -115,7 +115,7 @@
 
     typedef HashMap<String, RefPtr<IDBIndexBackendImpl> > IndexMap;
     IndexMap m_indexes;
-    int64_t m_autoIncrementNumber;
+    int m_autoIncrementNumber;
 };
 
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to