PassRefPtr<IDBRequest> IDBFactory::open(ScriptExecutionContext* context, const String& name, ExceptionCode& ec) { if (!context->isDocument()) { // FIXME: make this work with workers. return 0; } Document* document = static_cast<Document*>(context); if (!document->frame() || !document->page()) return 0; if (name.isNull()) { ec = IDBDatabaseException::NON_TRANSIENT_ERR; return 0; } RefPtr<IDBRequest> request = IDBRequest::create(document, IDBAny::create(this), 0); GroupSettings* groupSettings = document->page()->group().groupSettings(); m_factoryBackend->open(name, request, document->securityOrigin(), document->frame(), groupSettings->indexedDBDatabasePath()); return request; }
void InspectorIndexedDBAgent::requestDatabaseNamesForFrame(ErrorString* errorString, int requestId, const String& frameId) { Document* document = assertDocument(errorString, frameId, m_pageAgent); if (!document) return; IDBFactoryBackendInterface* idbFactory = assertIDBFactory(errorString, document); if (!idbFactory) return; RefPtr<GetDatabaseNamesCallback> callback = GetDatabaseNamesCallback::create(m_frontendProvider.get(), requestId, document->securityOrigin()->toString()); GroupSettings* groupSettings = document->page()->group().groupSettings(); idbFactory->getDatabaseNames(callback.get(), document->securityOrigin(), document->frame(), groupSettings->indexedDBDatabasePath()); }
PassRefPtr<IDBRequest> IDBFactory::getDatabaseNames(ScriptExecutionContext* context) { if (!context->isDocument()) { // FIXME: make this work with workers. return 0; } Document* document = static_cast<Document*>(context); if (!document->frame() || !document->page()) return 0; RefPtr<IDBRequest> request = IDBRequest::create(document, IDBAny::create(this), 0); GroupSettings* groupSettings = document->page()->group().groupSettings(); m_factoryBackend->getDatabaseNames(request, document->securityOrigin(), document->frame(), groupSettings->indexedDBDatabasePath()); return request; }
void InspectorIndexedDBAgent::requestDatabaseNamesForFrame(ErrorString* error, const String& frameId) { Frame* frame = m_pageAgent->frameForId(frameId); Document* document = frame ? frame->document() : 0; Page* page = document ? document->page() : 0; IDBFactoryBackendInterface* idbBackend = page ? page->group().idbFactory() : 0; if (!idbBackend) { *error = "No IndexedDB factory for given frame found"; return; } RefPtr<GetDatabaseNamesCallback> callback = GetDatabaseNamesCallback::create(m_frontendProvider, frameId, document->securityOrigin()->toString()); GroupSettings* groupSettings = document->page()->group().groupSettings(); idbBackend->getDatabaseNames(callback.get(), document->securityOrigin(), document->frame(), groupSettings->indexedDBDatabasePath()); }