Skip to content
  • jsbell@chromium.org's avatar
    IndexedDB: Enable IDBFactory.deleteDatabase() and webkitGetDatabaseNames() in Workers · 078ffdf5
    jsbell@chromium.org authored
    https://bugs.webkit.org/show_bug.cgi?id=90310
    
    Reviewed by Tony Chang.
    
    Source/WebCore:
    
    Simplify Document vs. Worker logic for IDBFactory::open() and hook up the
    other two IDBFactory methods for use by workers as well.
    
    Test: storage/indexeddb/factory-basics-workers.html
    
    * Modules/indexeddb/IDBFactory.cpp:
    (isContextValid): Helper function consolidating checks that context is usable.
    (getIndexedDBDatabasePath): Helper function for accessing group settings.
    (WebCore::IDBFactory::getDatabaseNames): Simplify - just pass context through to back end.
    (WebCore::IDBFactory::open): Ditto.
    (WebCore::IDBFactory::deleteDatabase): Ditto.
    (WebCore::IDBFactory::cmp): Whitespace.
    * Modules/indexeddb/IDBFactoryBackendImpl.cpp: Obsolete openFromWorker() removed.
    (WebCore::IDBFactoryBackendImpl::getDatabaseNames): Signature updated.
    (WebCore::IDBFactoryBackendImpl::deleteDatabase): Signature updated.
    (WebCore::IDBFactoryBackendImpl::open): Signature updated.
    * Modules/indexeddb/IDBFactoryBackendImpl.h:
    (IDBFactoryBackendImpl):
    * Modules/indexeddb/IDBFactoryBackendInterface.h: Interface methods now take both SecurityOrigin
    and ScriptExecutionContext, but not Frame. In the proxy, SecurityOrigin is redundant (can be
    accessed from context) but on the real back end the context is null (as Frame was previously).
    (IDBFactoryBackendInterface):
    * inspector/InspectorIndexedDBAgent.cpp:
    (WebCore):
    (WebCore::InspectorIndexedDBAgent::requestDatabaseNamesForFrame):
    (WebCore::InspectorIndexedDBAgent::requestDatabase):
    (WebCore::InspectorIndexedDBAgent::requestData):
    
    Source/WebKit/chromium:
    
    * src/IDBFactoryBackendProxy.cpp:
    (WebKit::IDBFactoryBackendProxy::allowIndexedDB): Consolidates user-prompting logic.
    (WebKit::getWebFrame): Helper to dig out frame from Document, or null for Worker.
    (WebKit::IDBFactoryBackendProxy::getDatabaseNames):
    (WebKit):
    (WebKit::IDBFactoryBackendProxy::open):
    (WebKit::IDBFactoryBackendProxy::deleteDatabase):
    * src/IDBFactoryBackendProxy.h: Update method signatures to match interface.
    (WebCore):
    (IDBFactoryBackendProxy):
    
    LayoutTests:
    
    * storage/indexeddb/factory-basics-workers-expected.txt: Added.
    * storage/indexeddb/factory-basics-workers.html: Added.
    * storage/indexeddb/resources/factory-basics.js: Allow use by Worker as well as Window.
    (getDatabaseNamesSuccess1):
    (openSuccess):
    (getDatabaseNamesSuccess2):
    (getDatabaseNamesSuccess3):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@122515 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    078ffdf5