Changeset 192825 in webkit


Ignore:
Timestamp:
Nov 30, 2015 1:51:06 PM (8 years ago)
Author:
beidson@apple.com
Message:

Modern IDB: Correct handling of cursors finishing iteration.
https://bugs.webkit.org/show_bug.cgi?id=151664

Reviewed by Andy Estes.

Source/WebCore:

No new tests (At least one previously failing test now passes).

  • Modules/indexeddb/client/IDBCursorImpl.cpp:

(WebCore::IDBClient::IDBCursor::setGetResult):

  • Modules/indexeddb/client/IDBObjectStoreImpl.cpp:

(WebCore::IDBClient::IDBObjectStore::putOrAdd):

LayoutTests:

  • platform/mac-wk1/TestExpectations:
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r192819 r192825  
     12015-11-30  Brady Eidson  <beidson@apple.com>
     2
     3        Modern IDB: Correct handling of cursors finishing iteration.
     4        https://bugs.webkit.org/show_bug.cgi?id=151664
     5
     6        Reviewed by Andy Estes.
     7
     8        * platform/mac-wk1/TestExpectations:
     9
    1102015-11-30  Myles C. Maxfield  <mmaxfield@apple.com>
    211
  • trunk/LayoutTests/platform/mac-wk1/TestExpectations

    r192813 r192825  
    7373# But Modern IndexedDB is.
    7474storage/indexeddb/aborted-versionchange-closes.html [ Pass ]
     75storage/indexeddb/cursor-finished.html [ Pass ]
    7576storage/indexeddb/modern [ Pass ]
    7677storage/indexeddb/mozilla/add-twice-failure.html [ Pass ]
  • trunk/Source/WebCore/ChangeLog

    r192819 r192825  
     12015-11-30  Brady Eidson  <beidson@apple.com>
     2
     3        Modern IDB: Correct handling of cursors finishing iteration.
     4        https://bugs.webkit.org/show_bug.cgi?id=151664
     5
     6        Reviewed by Andy Estes.
     7
     8        No new tests (At least one previously failing test now passes).
     9
     10        * Modules/indexeddb/client/IDBCursorImpl.cpp:
     11        (WebCore::IDBClient::IDBCursor::setGetResult):
     12       
     13        * Modules/indexeddb/client/IDBObjectStoreImpl.cpp:
     14        (WebCore::IDBClient::IDBObjectStore::putOrAdd):
     15
    1162015-11-30  Myles C. Maxfield  <mmaxfield@apple.com>
    217
  • trunk/Source/WebCore/Modules/indexeddb/client/IDBCursorImpl.cpp

    r192806 r192825  
    289289        return;
    290290
     291    if (!getResult.isDefined()) {
     292        m_deprecatedCurrentKey = { };
     293        m_deprecatedCurrentPrimaryKey = { };
     294        m_currentPrimaryKeyData = { };
     295        m_deprecatedCurrentValue = { };
     296
     297        m_gotValue = false;
     298        return;
     299    }
     300
    291301    m_deprecatedCurrentKey = idbKeyDataToScriptValue(context, getResult.keyData());
    292302    m_deprecatedCurrentPrimaryKey = idbKeyDataToScriptValue(context, getResult.primaryKeyData());
  • trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.cpp

    r192806 r192825  
    234234
    235235    if (m_transaction->isReadOnly()) {
    236         ec = static_cast<ExceptionCode>(IDBExceptionCode::ReadOnlyError);
    237         return nullptr;
    238     }
    239 
    240     if (!m_transaction->isActive()) {
    241         ec = static_cast<ExceptionCode>(IDBExceptionCode::TransactionInactiveError);
    242         return nullptr;
    243     }
    244 
    245     if (m_deleted) {
    246         ec = INVALID_STATE_ERR;
     236        ec = IDBDatabaseException::ReadOnlyError;
     237        return nullptr;
     238    }
     239
     240    if (!m_transaction->isActive()) {
     241        ec = IDBDatabaseException::TransactionInactiveError;
     242        return nullptr;
     243    }
     244
     245    if (m_deleted) {
     246        ec = IDBDatabaseException::InvalidStateError;
    247247        return nullptr;
    248248    }
     
    250250    RefPtr<SerializedScriptValue> serializedValue = SerializedScriptValue::create(&state, value, nullptr, nullptr);
    251251    if (state.hadException()) {
    252         ec = DATA_CLONE_ERR;
     252        ec = IDBDatabaseException::DataCloneError;
    253253        return nullptr;
    254254    }
     
    256256    if (serializedValue->hasBlobURLs()) {
    257257        // FIXME: Add Blob/File/FileList support
    258         ec = DATA_CLONE_ERR;
     258        ec = IDBDatabaseException::DataCloneError;
    259259        return nullptr;
    260260    }
    261261
    262262    if (key && key->type() == KeyType::Invalid) {
    263         ec = static_cast<ExceptionCode>(IDBExceptionCode::DataError);
     263        ec = IDBDatabaseException::DataError;
    264264        return nullptr;
    265265    }
     
    269269    if (usesInlineKeys && inlineKeyCheck == InlineKeyCheck::Perform) {
    270270        if (key) {
    271             ec = static_cast<ExceptionCode>(IDBExceptionCode::DataError);
     271            ec = IDBDatabaseException::DataError;
    272272            return nullptr;
    273273        }
     
    275275        RefPtr<IDBKey> keyPathKey = maybeCreateIDBKeyFromScriptValueAndKeyPath(state, value, m_info.keyPath());
    276276        if (keyPathKey && !keyPathKey->isValid()) {
    277             ec = static_cast<ExceptionCode>(IDBExceptionCode::DataError);
     277            ec = IDBDatabaseException::DataError;
    278278            return nullptr;
    279279        }
     
    282282            if (usesKeyGenerator) {
    283283                if (!canInjectIDBKeyIntoScriptValue(state, value, m_info.keyPath())) {
    284                     ec = static_cast<ExceptionCode>(IDBExceptionCode::DataError);
     284                    ec = IDBDatabaseException::DataError;
    285285                    return nullptr;
    286286                }
    287287            } else {
    288                 ec = static_cast<ExceptionCode>(IDBExceptionCode::DataError);
     288                ec = IDBDatabaseException::DataError;
    289289                return nullptr;
    290290            }
     
    296296        }
    297297    } else if (!usesKeyGenerator && !key) {
    298         ec = static_cast<ExceptionCode>(IDBExceptionCode::DataError);
     298        ec = IDBDatabaseException::DataError;
    299299        return nullptr;
    300300    }
     
    302302    auto context = scriptExecutionContextFromExecState(&state);
    303303    if (!context) {
    304         ec = static_cast<ExceptionCode>(IDBExceptionCode::Unknown);
     304        ec = IDBDatabaseException::UnknownError;
    305305        return nullptr;
    306306    }
Note: See TracChangeset for help on using the changeset viewer.