Changeset 206280 in webkit


Ignore:
Timestamp:
Sep 22, 2016 3:34:02 PM (8 years ago)
Author:
beidson@apple.com
Message:

IDBIndex.openCursor() matches indices on multiple object stores.
<rdar://problem/28434463> and https://bugs.webkit.org/show_bug.cgi?id=158833

Reviewed by Alex Christensen.

Source/WebCore:

Tests: storage/indexeddb/modern/multiple-objectstore-index-cursor-collision-private.html

storage/indexeddb/modern/multiple-objectstore-index-cursor-collision.html

  • Modules/indexeddb/server/SQLiteIDBCursor.cpp:

(WebCore::IDBServer::buildIndexStatement): Need to include the object store id in the statement for

index cursors, otherwise there will be collisions amongst multiple object stores that happen to
share primary keys.

(WebCore::IDBServer::SQLiteIDBCursor::bindArguments):

LayoutTests:

  • storage/indexeddb/modern/multiple-objectstore-index-cursor-collision-expected.txt: Added.
  • storage/indexeddb/modern/multiple-objectstore-index-cursor-collision-private-expected.txt: Added.
  • storage/indexeddb/modern/multiple-objectstore-index-cursor-collision-private.html: Added.
  • storage/indexeddb/modern/multiple-objectstore-index-cursor-collision.html: Added.
  • storage/indexeddb/modern/resources/multiple-objectstore-index-cursor-collision.js: Added.
Location:
trunk
Files:
5 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r206278 r206280  
     12016-09-22  Brady Eidson  <beidson@apple.com>
     2
     3        IDBIndex.openCursor() matches indices on multiple object stores.
     4        <rdar://problem/28434463> and https://bugs.webkit.org/show_bug.cgi?id=158833
     5
     6        Reviewed by Alex Christensen.
     7
     8        * storage/indexeddb/modern/multiple-objectstore-index-cursor-collision-expected.txt: Added.
     9        * storage/indexeddb/modern/multiple-objectstore-index-cursor-collision-private-expected.txt: Added.
     10        * storage/indexeddb/modern/multiple-objectstore-index-cursor-collision-private.html: Added.
     11        * storage/indexeddb/modern/multiple-objectstore-index-cursor-collision.html: Added.
     12        * storage/indexeddb/modern/resources/multiple-objectstore-index-cursor-collision.js: Added.
     13
    1142016-09-22  Daniel Bates  <dabates@apple.com>
    215
  • trunk/Source/WebCore/ChangeLog

    r206279 r206280  
     12016-09-22  Brady Eidson  <beidson@apple.com>
     2
     3        IDBIndex.openCursor() matches indices on multiple object stores.
     4        <rdar://problem/28434463> and https://bugs.webkit.org/show_bug.cgi?id=158833
     5
     6        Reviewed by Alex Christensen.
     7
     8        Tests: storage/indexeddb/modern/multiple-objectstore-index-cursor-collision-private.html
     9               storage/indexeddb/modern/multiple-objectstore-index-cursor-collision.html
     10
     11        * Modules/indexeddb/server/SQLiteIDBCursor.cpp:
     12        (WebCore::IDBServer::buildIndexStatement): Need to include the object store id in the statement for
     13          index cursors, otherwise there will be collisions amongst multiple object stores that happen to
     14          share primary keys.
     15        (WebCore::IDBServer::SQLiteIDBCursor::bindArguments):
     16
    1172016-09-22  Zalan Bujtas  <zalan@apple.com>
    218
  • trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBCursor.cpp

    r199668 r206280  
    113113    StringBuilder builder;
    114114
    115     builder.appendLiteral("SELECT rowid, key, value FROM IndexRecords WHERE indexID = ? AND key ");
     115    builder.appendLiteral("SELECT rowid, key, value FROM IndexRecords WHERE indexID = ? AND objectStoreID = ? AND key ");
    116116    if (!keyRange.lowerKey.isNull() && !keyRange.lowerOpen)
    117117        builder.appendLiteral(">=");
     
    261261    LOG(IndexedDB, "Cursor is binding lower key '%s' and upper key '%s'", m_currentLowerKey.loggingString().utf8().data(), m_currentUpperKey.loggingString().utf8().data());
    262262
    263     if (m_statement->bindInt64(1, m_boundID) != SQLITE_OK) {
     263    int currentBindArgument = 1;
     264
     265    if (m_statement->bindInt64(currentBindArgument++, m_boundID) != SQLITE_OK) {
    264266        LOG_ERROR("Could not bind id argument (bound ID)");
    265267        return false;
    266268    }
    267269
     270    if (m_indexID != IDBIndexInfo::InvalidId && m_statement->bindInt64(currentBindArgument++, m_objectStoreID) != SQLITE_OK) {
     271        LOG_ERROR("Could not bind object store id argument for an index cursor");
     272        return false;
     273    }
     274
    268275    RefPtr<SharedBuffer> buffer = serializeIDBKeyData(m_currentLowerKey);
    269     if (m_statement->bindBlob(2, buffer->data(), buffer->size()) != SQLITE_OK) {
     276    if (m_statement->bindBlob(currentBindArgument++, buffer->data(), buffer->size()) != SQLITE_OK) {
    270277        LOG_ERROR("Could not create cursor statement (lower key)");
    271278        return false;
     
    273280
    274281    buffer = serializeIDBKeyData(m_currentUpperKey);
    275     if (m_statement->bindBlob(3, buffer->data(), buffer->size()) != SQLITE_OK) {
     282    if (m_statement->bindBlob(currentBindArgument++, buffer->data(), buffer->size()) != SQLITE_OK) {
    276283        LOG_ERROR("Could not create cursor statement (upper key)");
    277284        return false;
Note: See TracChangeset for help on using the changeset viewer.