Changeset 127669 in webkit


Ignore:
Timestamp:
Sep 5, 2012 6:07:57 PM (12 years ago)
Author:
jsbell@chromium.org
Message:

IndexedDB: Integer version lost after first open/close/open cycle
https://bugs.webkit.org/show_bug.cgi?id=95864

Reviewed by Tony Chang.

Source/WebCore:

New backing stores were being created with an old schema version, causing migration
to occur when the backing store was re-opened, which would overwrite valid integer
version metadata. New backing stores should be created with the latest schema version
since no migration is desired.

Test: storage/indexeddb/intversion-persistence.html

  • Modules/indexeddb/IDBLevelDBBackingStore.cpp:

(WebCore::setUpMetadata):

LayoutTests:

Ensure integer versions are persisted across open/close/open cycles.

Note that although this is a useful and valid test in general, the specific bug that
prompted adding this test will only repro if the origin has no pre-existing backing
store, which is not guaranteed by DRT or other shells. See http://webkit.org/b/92166

  • storage/indexeddb/intversion-persistence-expected.txt: Added.
  • storage/indexeddb/intversion-persistence.html: Added.
  • storage/indexeddb/resources/intversion-persistence.js: Added.

(test):
(openFirstTime.request.onupgradeneeded):
(openFirstTime.request.onsuccess):
(openFirstTime):
(openSecondTime.request.onsuccess):
(openSecondTime):

Location:
trunk
Files:
3 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r127668 r127669  
     12012-09-05  Joshua Bell  <jsbell@chromium.org>
     2
     3        IndexedDB: Integer version lost after first open/close/open cycle
     4        https://bugs.webkit.org/show_bug.cgi?id=95864
     5
     6        Reviewed by Tony Chang.
     7
     8        Ensure integer versions are persisted across open/close/open cycles.
     9
     10        Note that although this is a useful and valid test in general, the specific bug that
     11        prompted adding this test will only repro if the origin has no pre-existing backing
     12        store, which is not guaranteed by DRT or other shells. See http://webkit.org/b/92166
     13
     14        * storage/indexeddb/intversion-persistence-expected.txt: Added.
     15        * storage/indexeddb/intversion-persistence.html: Added.
     16        * storage/indexeddb/resources/intversion-persistence.js: Added.
     17        (test):
     18        (openFirstTime.request.onupgradeneeded):
     19        (openFirstTime.request.onsuccess):
     20        (openFirstTime):
     21        (openSecondTime.request.onsuccess):
     22        (openSecondTime):
     23
    1242012-09-05  Yoshifumi Inoue  <yosin@chromium.org>
    225
  • trunk/Source/WebCore/ChangeLog

    r127664 r127669  
     12012-09-05  Joshua Bell  <jsbell@chromium.org>
     2
     3        IndexedDB: Integer version lost after first open/close/open cycle
     4        https://bugs.webkit.org/show_bug.cgi?id=95864
     5
     6        Reviewed by Tony Chang.
     7
     8        New backing stores were being created with an old schema version, causing migration
     9        to occur when the backing store was re-opened, which would overwrite valid integer
     10        version metadata. New backing stores should be created with the latest schema version
     11        since no migration is desired.
     12
     13        Test: storage/indexeddb/intversion-persistence.html
     14
     15        * Modules/indexeddb/IDBLevelDBBackingStore.cpp:
     16        (WebCore::setUpMetadata):
     17
    1182012-09-05  Kenichi Ishibashi  <bashi@chromium.org>
    219
  • trunk/Source/WebCore/Modules/indexeddb/IDBLevelDBBackingStore.cpp

    r125627 r127669  
    139139static bool setUpMetadata(LevelDBDatabase* db, const String& origin)
    140140{
     141    const int64_t latestSchemaVersion = 1;
    141142    const Vector<char> metaDataKey = SchemaVersionKey::encode();
    142143
    143144    int64_t schemaVersion = 0;
    144145    if (!getInt(db, metaDataKey, schemaVersion)) {
    145         schemaVersion = 0;
    146         if (!putInt(db, metaDataKey, schemaVersion))
     146        schemaVersion = latestSchemaVersion;
     147        if (!putInt(db, metaDataKey, latestSchemaVersion))
    147148            return false;
    148149    } else {
    149150        if (!schemaVersion) {
    150             schemaVersion = 1;
     151            schemaVersion = latestSchemaVersion;
    151152            RefPtr<LevelDBTransaction> transaction = LevelDBTransaction::create(db);
    152153            transaction->put(metaDataKey, encodeInt(schemaVersion));
     
    177178            }
    178179        }
    179         ASSERT(schemaVersion == 1);
    180     }
     180    }
     181
     182    ASSERT(schemaVersion == latestSchemaVersion);
    181183
    182184    return true;
Note: See TracChangeset for help on using the changeset viewer.