Skip to content
  • jsbell@chromium.org's avatar
    IndexedDB: Remove IDBUpgradeNeededEvent, merge with IDBVersionChangeEvent · cd4af9db
    jsbell@chromium.org authored
    https://bugs.webkit.org/show_bug.cgi?id=107754
    
    Reviewed by Tony Chang.
    
    Source/WebCore:
    
    The IndexedDB spec calls deleteDatabase() to fire a "blocked" event with the
    IDBVersionChangeEvent interface which we were doing, but with an older interface - just
    a "version" property. We were already firing an event on "versionchange" with the new
    "oldVersion" and "newVersion" properties, but with an IDBUpgradeNeededEvent interface that
    doesn't exist in the spec. This patch merges the event types to match the spec, including
    that the newVersion property is null when deleting.
    
    Test: storage/indexeddb/events.html
          storage/indexeddb/deletedatabase-*.html
    
    * CMakeLists.txt: Remove references to deleted files.
    * GNUmakefile.list.am: Ditto.
    * Modules/indexeddb/IDBDatabase.cpp:
    (WebCore::IDBDatabase::onVersionChange): Generate IDBVersionChangeEvent.
    * Modules/indexeddb/IDBOpenDBRequest.cpp:
    (WebCore::IDBOpenDBRequest::onBlocked): Ditto.
    (WebCore::IDBOpenDBRequest::onUpgradeNeeded): Ditto.
    * Modules/indexeddb/IDBUpgradeNeededEvent.cpp: Removed.
    * Modules/indexeddb/IDBUpgradeNeededEvent.h: Removed.
    * Modules/indexeddb/IDBUpgradeNeededEvent.idl: Removed.
    * Modules/indexeddb/IDBVersionChangeEvent.cpp:
    (WebCore::IDBVersionChangeEvent::create): Take IDBAny's as old/new versions
    may be integers, strings (for legacy databases), or null (when deleting).
    (WebCore::IDBVersionChangeEvent::IDBVersionChangeEvent):
    * Modules/indexeddb/IDBVersionChangeEvent.h:
    (IDBVersionChangeEvent): Remove version property.
    (WebCore::IDBVersionChangeEvent::oldVersion): Added new property.
    (WebCore::IDBVersionChangeEvent::newVersion): Added new property.
    * Modules/indexeddb/IDBVersionChangeEvent.idl: Updated properties.
    * WebCore.gypi: Remove references to deleted files.
    * dom/EventNames.in: Ditto.
    
    LayoutTests:
    
    Updated expectations, and new test file. In most cases, just switch test from
    looking at event.target.version and event.version to event.oldVersion and event.newVersion,
    in some cases verifying the old properties as well as a sanity check.
    
    * storage/indexeddb/delete-in-upgradeneeded-close-in-open-success-expected.txt:
    * storage/indexeddb/delete-in-upgradeneeded-close-in-versionchange-expected.txt:
    * storage/indexeddb/deletedatabase-blocked-expected.txt:
    * storage/indexeddb/deletedatabase-delayed-by-open-and-versionchange-expected.txt:
    * storage/indexeddb/deletedatabase-delayed-by-open-and-versionchange-workers-expected.txt:
    * storage/indexeddb/deletedatabase-delayed-by-versionchange-expected.txt:
    * storage/indexeddb/deletedatabase-not-blocked-expected.txt:
    * storage/indexeddb/events-expected.txt: Added.
    * storage/indexeddb/events.html: Added.
    * storage/indexeddb/intversion-gated-on-delete-expected.txt:
    * storage/indexeddb/intversion-long-queue-expected.txt:
    * storage/indexeddb/removed-expected.txt:
    * storage/indexeddb/resources/delete-in-upgradeneeded-close-in-open-success.js:
    * storage/indexeddb/resources/deletedatabase-blocked.js:
    * storage/indexeddb/resources/deletedatabase-delayed-by-open-and-versionchange.js:
    * storage/indexeddb/resources/deletedatabase-delayed-by-versionchange.js:
    * storage/indexeddb/resources/deletedatabase-not-blocked.js:
    * storage/indexeddb/resources/events.js: Added.
    * storage/indexeddb/resources/intversion-gated-on-delete.js:
    * storage/indexeddb/resources/intversion-long-queue.js:
    * storage/indexeddb/resources/removed.js: Verify that old Event type and property are gone.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@140741 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    cd4af9db