Skip to content
  • jsbell@chromium.org's avatar
    IndexedDB: Calling close() during upgradeneeded handler should fire error at open request · bd1cfeab
    jsbell@chromium.org authored
    https://bugs.webkit.org/show_bug.cgi?id=96807
    
    Reviewed by Tony Chang.
    
    Source/WebCore:
    
    Per spec, if the database connection is closed before the success event fires, the request
    should have an error event of type AbortError fired at it.
    
    Test: storage/indexeddb/intversion-close-in-upgradeneeded.html
    
    * Modules/indexeddb/IDBDatabase.h:
    (WebCore::IDBDatabase::isClosePending): Expose this state so an in-flight success can be morphed.
    * Modules/indexeddb/IDBDatabaseBackendImpl.cpp:
    (WebCore::IDBDatabaseBackendImpl::close): Fire the appropriate error at connections that are mid-opening.
    * Modules/indexeddb/IDBOpenDBRequest.cpp:
    (WebCore::IDBOpenDBRequest::onSuccess): If the connection was closed before the success is enqueued -
    which can happen in multi-process ports with asynchronous messaging - convert the success to an error.
    
    LayoutTests:
    
    Update the test to match the spec behavior.
    
    * storage/indexeddb/intversion-close-in-upgradeneeded-expected.txt:
    * storage/indexeddb/resources/intversion-close-in-upgradeneeded.js:
    (deleteSuccess):
    (upgradeNeeded.transaction.oncomplete):
    (upgradeNeeded):
    (openError):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@128674 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    bd1cfeab