<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[198762] trunk/Source</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/198762">198762</a></dd>
<dt>Author</dt> <dd>beidson@apple.com</dd>
<dt>Date</dt> <dd>2016-03-28 15:49:04 -0700 (Mon, 28 Mar 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Modern IDB: Remove abstract base classes for all IDB DOM classes.
https://bugs.webkit.org/show_bug.cgi?id=155951
Reviewed by Alex Christensen.
Source/WebCore:
Refactor - No behavior change.
* Modules/indexeddb/DOMWindowIndexedDatabase.cpp:
(WebCore::DOMWindowIndexedDatabase::indexedDB):
* Modules/indexeddb/IDBAny.cpp:
(WebCore::IDBAny::IDBAny):
(WebCore::IDBAny::~IDBAny):
(WebCore::IDBAny::idbDatabase):
(WebCore::IDBAny::domStringList):
(WebCore::IDBAny::idbCursor):
(WebCore::IDBAny::idbCursorWithValue):
(WebCore::IDBAny::idbFactory):
(WebCore::IDBAny::idbIndex):
(WebCore::IDBAny::idbObjectStore):
(WebCore::IDBAny::idbTransaction):
(WebCore::IDBAny::scriptValue):
(WebCore::IDBAny::integer):
(WebCore::IDBAny::string):
(WebCore::IDBAny::keyPath):
* Modules/indexeddb/IDBAny.h:
(WebCore::IDBAny::create):
(WebCore::IDBAny::createUndefined):
(WebCore::IDBAny::type):
(WebCore::IDBAny::~IDBAny): Deleted.
(WebCore::IDBAny::isLegacy): Deleted.
* Modules/indexeddb/IDBCursor.cpp:
(WebCore::IDBCursor::create):
(WebCore::IDBCursor::IDBCursor):
(WebCore::IDBCursor::~IDBCursor):
(WebCore::IDBCursor::sourcesDeleted):
(WebCore::IDBCursor::effectiveObjectStore):
(WebCore::IDBCursor::transaction):
(WebCore::IDBCursor::direction):
(WebCore::IDBCursor::key):
(WebCore::IDBCursor::primaryKey):
(WebCore::IDBCursor::value):
(WebCore::IDBCursor::source):
(WebCore::IDBCursor::update):
(WebCore::IDBCursor::advance):
(WebCore::IDBCursor::continueFunction):
(WebCore::IDBCursor::uncheckedIterateCursor):
(WebCore::IDBCursor::deleteFunction):
(WebCore::IDBCursor::setGetResult):
(WebCore::IDBCursor::activeDOMObjectName):
(WebCore::IDBCursor::canSuspendForDocumentSuspension):
(WebCore::IDBCursor::hasPendingActivity):
(WebCore::IDBCursor::decrementOutstandingRequestCount):
* Modules/indexeddb/IDBCursor.h:
(WebCore::IDBCursor::info):
(WebCore::IDBCursor::setRequest):
(WebCore::IDBCursor::clearRequest):
(WebCore::IDBCursor::request):
(WebCore::IDBCursor::isKeyCursor):
(WebCore::IDBCursor::~IDBCursor): Deleted.
(WebCore::IDBCursor::continueFunction): Deleted.
(WebCore::IDBCursor::isModernCursor): Deleted.
(WebCore::IDBCursor::hasPendingActivity): Deleted.
* Modules/indexeddb/IDBCursorWithValue.cpp:
(WebCore::IDBCursorWithValue::create):
(WebCore::IDBCursorWithValue::IDBCursorWithValue):
(WebCore::IDBCursorWithValue::~IDBCursorWithValue):
* Modules/indexeddb/IDBCursorWithValue.h:
(WebCore::IDBCursorWithValue::~IDBCursorWithValue): Deleted.
* Modules/indexeddb/IDBDatabase.cpp:
(WebCore::IDBDatabase::create):
(WebCore::IDBDatabase::IDBDatabase):
(WebCore::IDBDatabase::~IDBDatabase):
(WebCore::IDBDatabase::hasPendingActivity):
(WebCore::IDBDatabase::name):
(WebCore::IDBDatabase::version):
(WebCore::IDBDatabase::objectStoreNames):
(WebCore::IDBDatabase::createObjectStore):
(WebCore::IDBDatabase::transaction):
(WebCore::IDBDatabase::deleteObjectStore):
(WebCore::IDBDatabase::close):
(WebCore::IDBDatabase::maybeCloseInServer):
(WebCore::IDBDatabase::activeDOMObjectName):
(WebCore::IDBDatabase::canSuspendForDocumentSuspension):
(WebCore::IDBDatabase::stop):
(WebCore::IDBDatabase::startVersionChangeTransaction):
(WebCore::IDBDatabase::didStartTransaction):
(WebCore::IDBDatabase::willCommitTransaction):
(WebCore::IDBDatabase::didCommitTransaction):
(WebCore::IDBDatabase::willAbortTransaction):
(WebCore::IDBDatabase::didAbortTransaction):
(WebCore::IDBDatabase::didCommitOrAbortTransaction):
(WebCore::IDBDatabase::fireVersionChangeEvent):
(WebCore::IDBDatabase::dispatchEvent):
(WebCore::IDBDatabase::didCreateIndexInfo):
(WebCore::IDBDatabase::didDeleteIndexInfo):
* Modules/indexeddb/IDBDatabase.h:
(WebCore::IDBDatabase::info):
(WebCore::IDBDatabase::databaseConnectionIdentifier):
(WebCore::IDBDatabase::serverConnection):
(WebCore::IDBDatabase::isClosingOrClosed):
(WebCore::IDBDatabase::~IDBDatabase): Deleted.
* Modules/indexeddb/IDBFactory.cpp:
(WebCore::shouldThrowSecurityException):
(WebCore::IDBFactory::create):
(WebCore::IDBFactory::IDBFactory):
(WebCore::IDBFactory::getDatabaseNames):
(WebCore::IDBFactory::open):
(WebCore::IDBFactory::openInternal):
(WebCore::IDBFactory::deleteDatabase):
(WebCore::IDBFactory::cmp):
* Modules/indexeddb/IDBFactory.h:
(WebCore::IDBFactory::~IDBFactory): Deleted.
* Modules/indexeddb/IDBIndex.cpp:
(WebCore::IDBIndex::IDBIndex):
(WebCore::IDBIndex::~IDBIndex):
(WebCore::IDBIndex::activeDOMObjectName):
(WebCore::IDBIndex::canSuspendForDocumentSuspension):
(WebCore::IDBIndex::hasPendingActivity):
(WebCore::IDBIndex::name):
(WebCore::IDBIndex::objectStore):
(WebCore::IDBIndex::keyPathAny):
(WebCore::IDBIndex::keyPath):
(WebCore::IDBIndex::unique):
(WebCore::IDBIndex::multiEntry):
(WebCore::IDBIndex::openCursor):
(WebCore::IDBIndex::count):
(WebCore::IDBIndex::doCount):
(WebCore::IDBIndex::openKeyCursor):
(WebCore::IDBIndex::get):
(WebCore::IDBIndex::doGet):
(WebCore::IDBIndex::getKey):
(WebCore::IDBIndex::doGetKey):
(WebCore::IDBIndex::markAsDeleted):
(WebCore::IDBIndex::ref):
(WebCore::IDBIndex::deref):
* Modules/indexeddb/IDBIndex.h:
(WebCore::IDBIndex::openCursor):
(WebCore::IDBIndex::openKeyCursor):
(WebCore::IDBIndex::info):
(WebCore::IDBIndex::modernObjectStore):
(WebCore::IDBIndex::isDeleted):
(WebCore::IDBIndex::~IDBIndex): Deleted.
(WebCore::IDBIndex::isModern): Deleted.
* Modules/indexeddb/IDBObjectStore.cpp:
(WebCore::IDBObjectStore::create):
(WebCore::IDBObjectStore::IDBObjectStore):
(WebCore::IDBObjectStore::~IDBObjectStore):
(WebCore::IDBObjectStore::activeDOMObjectName):
(WebCore::IDBObjectStore::canSuspendForDocumentSuspension):
(WebCore::IDBObjectStore::hasPendingActivity):
(WebCore::IDBObjectStore::name):
(WebCore::IDBObjectStore::keyPathAny):
(WebCore::IDBObjectStore::keyPath):
(WebCore::IDBObjectStore::indexNames):
(WebCore::IDBObjectStore::transaction):
(WebCore::IDBObjectStore::autoIncrement):
(WebCore::IDBObjectStore::openCursor):
(WebCore::IDBObjectStore::get):
(WebCore::IDBObjectStore::add):
(WebCore::IDBObjectStore::put):
(WebCore::IDBObjectStore::putForCursorUpdate):
(WebCore::IDBObjectStore::putOrAdd):
(WebCore::IDBObjectStore::deleteFunction):
(WebCore::IDBObjectStore::doDelete):
(WebCore::IDBObjectStore::modernDelete):
(WebCore::IDBObjectStore::clear):
(WebCore::IDBObjectStore::createIndex):
(WebCore::IDBObjectStore::index):
(WebCore::IDBObjectStore::deleteIndex):
(WebCore::IDBObjectStore::count):
(WebCore::IDBObjectStore::doCount):
(WebCore::IDBObjectStore::markAsDeleted):
(WebCore::IDBObjectStore::rollbackInfoForVersionChangeAbort):
(WebCore::IDBObjectStore::visitReferencedIndexes):
* Modules/indexeddb/IDBObjectStore.h:
(WebCore::IDBObjectStore::isDeleted):
(WebCore::IDBObjectStore::info):
(WebCore::IDBObjectStore::modernTransaction):
(WebCore::IDBObjectStore::~IDBObjectStore): Deleted.
(WebCore::IDBObjectStore::isModern): Deleted.
* Modules/indexeddb/IDBOpenDBRequest.cpp:
(WebCore::IDBOpenDBRequest::createDeleteRequest):
(WebCore::IDBOpenDBRequest::createOpenRequest):
(WebCore::IDBOpenDBRequest::IDBOpenDBRequest):
(WebCore::IDBOpenDBRequest::~IDBOpenDBRequest):
(WebCore::IDBOpenDBRequest::onError):
(WebCore::IDBOpenDBRequest::versionChangeTransactionDidFinish):
(WebCore::IDBOpenDBRequest::fireSuccessAfterVersionChangeCommit):
(WebCore::IDBOpenDBRequest::fireErrorAfterVersionChangeCompletion):
(WebCore::IDBOpenDBRequest::dispatchEvent):
(WebCore::IDBOpenDBRequest::onSuccess):
(WebCore::IDBOpenDBRequest::onUpgradeNeeded):
(WebCore::IDBOpenDBRequest::onDeleteDatabaseSuccess):
(WebCore::IDBOpenDBRequest::requestCompleted):
(WebCore::IDBOpenDBRequest::requestBlocked):
* Modules/indexeddb/IDBOpenDBRequest.h:
(WebCore::IDBOpenDBRequest::databaseIdentifier):
(WebCore::IDBOpenDBRequest::version):
(WebCore::IDBOpenDBRequest::~IDBOpenDBRequest): Deleted.
* Modules/indexeddb/IDBRequest.cpp:
(WebCore::IDBRequest::create):
(WebCore::IDBRequest::createCount):
(WebCore::IDBRequest::createGet):
(WebCore::IDBRequest::IDBRequest):
(WebCore::IDBRequest::~IDBRequest):
(WebCore::IDBRequest::result):
(WebCore::IDBRequest::errorCode):
(WebCore::IDBRequest::error):
(WebCore::IDBRequest::source):
(WebCore::IDBRequest::setSource):
(WebCore::IDBRequest::setVersionChangeTransaction):
(WebCore::IDBRequest::transaction):
(WebCore::IDBRequest::readyState):
(WebCore::IDBRequest::sourceObjectStoreIdentifier):
(WebCore::IDBRequest::sourceIndexIdentifier):
(WebCore::IDBRequest::requestedIndexRecordType):
(WebCore::IDBRequest::eventTargetInterface):
(WebCore::IDBRequest::activeDOMObjectName):
(WebCore::IDBRequest::canSuspendForDocumentSuspension):
(WebCore::IDBRequest::hasPendingActivity):
(WebCore::IDBRequest::stop):
(WebCore::IDBRequest::enqueueEvent):
(WebCore::IDBRequest::dispatchEvent):
(WebCore::IDBRequest::uncaughtExceptionInEventHandler):
(WebCore::IDBRequest::setResult):
(WebCore::IDBRequest::setResultToStructuredClone):
(WebCore::IDBRequest::setResultToUndefined):
(WebCore::IDBRequest::resultCursor):
(WebCore::IDBRequest::willIterateCursor):
(WebCore::IDBRequest::didOpenOrIterateCursor):
(WebCore::IDBRequest::requestCompleted):
(WebCore::IDBRequest::onError):
(WebCore::IDBRequest::onSuccess):
* Modules/indexeddb/IDBRequest.h:
(WebCore::IDBRequest::resourceIdentifier):
(WebCore::IDBRequest::connection):
(WebCore::IDBRequest::modernResult):
(WebCore::IDBRequest::pendingCursor):
(WebCore::IDBRequest::requestType):
(WebCore::IDBRequest::isOpenDBRequest):
(WebCore::IDBRequest::~IDBRequest): Deleted.
* Modules/indexeddb/IDBRequestCompletionEvent.cpp:
(WebCore::IDBRequestCompletionEvent::IDBRequestCompletionEvent):
* Modules/indexeddb/IDBRequestCompletionEvent.h:
(WebCore::IDBRequestCompletionEvent::create):
* Modules/indexeddb/IDBTransaction.cpp:
(WebCore::IDBTransaction::create):
(WebCore::IDBTransaction::IDBTransaction):
(WebCore::IDBTransaction::~IDBTransaction):
(WebCore::IDBTransaction::mode):
(WebCore::IDBTransaction::db):
(WebCore::IDBTransaction::serverConnection):
(WebCore::IDBTransaction::error):
(WebCore::IDBTransaction::objectStore):
(WebCore::IDBTransaction::abortDueToFailedRequest):
(WebCore::IDBTransaction::transitionedToFinishing):
(WebCore::IDBTransaction::abort):
(WebCore::IDBTransaction::abortOnServerAndCancelRequests):
(WebCore::IDBTransaction::activeDOMObjectName):
(WebCore::IDBTransaction::canSuspendForDocumentSuspension):
(WebCore::IDBTransaction::hasPendingActivity):
(WebCore::IDBTransaction::stop):
(WebCore::IDBTransaction::isActive):
(WebCore::IDBTransaction::isFinishedOrFinishing):
(WebCore::IDBTransaction::addRequest):
(WebCore::IDBTransaction::removeRequest):
(WebCore::IDBTransaction::scheduleOperation):
(WebCore::IDBTransaction::scheduleOperationTimer):
(WebCore::IDBTransaction::operationTimerFired):
(WebCore::IDBTransaction::commit):
(WebCore::IDBTransaction::commitOnServer):
(WebCore::IDBTransaction::finishAbortOrCommit):
(WebCore::IDBTransaction::didStart):
(WebCore::IDBTransaction::notifyDidAbort):
(WebCore::IDBTransaction::didAbort):
(WebCore::IDBTransaction::didCommit):
(WebCore::IDBTransaction::fireOnComplete):
(WebCore::IDBTransaction::fireOnAbort):
(WebCore::IDBTransaction::enqueueEvent):
(WebCore::IDBTransaction::dispatchEvent):
(WebCore::IDBTransaction::createObjectStore):
(WebCore::IDBTransaction::createObjectStoreOnServer):
(WebCore::IDBTransaction::didCreateObjectStoreOnServer):
(WebCore::IDBTransaction::createIndex):
(WebCore::IDBTransaction::createIndexOnServer):
(WebCore::IDBTransaction::didCreateIndexOnServer):
(WebCore::IDBTransaction::requestOpenCursor):
(WebCore::IDBTransaction::doRequestOpenCursor):
(WebCore::IDBTransaction::openCursorOnServer):
(WebCore::IDBTransaction::didOpenCursorOnServer):
(WebCore::IDBTransaction::iterateCursor):
(WebCore::IDBTransaction::iterateCursorOnServer):
(WebCore::IDBTransaction::didIterateCursorOnServer):
(WebCore::IDBTransaction::requestGetRecord):
(WebCore::IDBTransaction::requestGetValue):
(WebCore::IDBTransaction::requestGetKey):
(WebCore::IDBTransaction::requestIndexRecord):
(WebCore::IDBTransaction::getRecordOnServer):
(WebCore::IDBTransaction::didGetRecordOnServer):
(WebCore::IDBTransaction::requestCount):
(WebCore::IDBTransaction::getCountOnServer):
(WebCore::IDBTransaction::didGetCountOnServer):
(WebCore::IDBTransaction::requestDeleteRecord):
(WebCore::IDBTransaction::deleteRecordOnServer):
(WebCore::IDBTransaction::didDeleteRecordOnServer):
(WebCore::IDBTransaction::requestClearObjectStore):
(WebCore::IDBTransaction::clearObjectStoreOnServer):
(WebCore::IDBTransaction::didClearObjectStoreOnServer):
(WebCore::IDBTransaction::requestPutOrAdd):
(WebCore::IDBTransaction::putOrAddOnServer):
(WebCore::IDBTransaction::didPutOrAddOnServer):
(WebCore::IDBTransaction::deleteObjectStore):
(WebCore::IDBTransaction::deleteObjectStoreOnServer):
(WebCore::IDBTransaction::didDeleteObjectStoreOnServer):
(WebCore::IDBTransaction::deleteIndex):
(WebCore::IDBTransaction::deleteIndexOnServer):
(WebCore::IDBTransaction::didDeleteIndexOnServer):
(WebCore::IDBTransaction::operationDidComplete):
(WebCore::IDBTransaction::establishOnServer):
(WebCore::IDBTransaction::activate):
(WebCore::IDBTransaction::deactivate):
* Modules/indexeddb/IDBTransaction.h:
(WebCore::IDBTransaction::info):
(WebCore::IDBTransaction::database):
(WebCore::IDBTransaction::originalDatabaseInfo):
(WebCore::IDBTransaction::isVersionChange):
(WebCore::IDBTransaction::isReadOnly):
(WebCore::IDBTransaction::isFinished):
(WebCore::TransactionActivator::TransactionActivator):
(WebCore::TransactionActivator::~TransactionActivator):
(WebCore::IDBTransaction::~IDBTransaction): Deleted.
* Modules/indexeddb/IDBVersionChangeEvent.cpp:
(WebCore::IDBVersionChangeEvent::IDBVersionChangeEvent):
(WebCore::IDBVersionChangeEvent::newVersion):
(WebCore::IDBVersionChangeEvent::eventInterface):
(WebCore::IDBVersionChangeEvent::create): Deleted.
* Modules/indexeddb/IDBVersionChangeEvent.h:
(isType):
* Modules/indexeddb/client/IDBAnyImpl.cpp: Removed.
* Modules/indexeddb/client/IDBAnyImpl.h: Removed.
* Modules/indexeddb/client/IDBConnectionToServer.cpp:
* Modules/indexeddb/client/IDBConnectionToServer.h:
* Modules/indexeddb/client/IDBCursorImpl.cpp: Removed.
* Modules/indexeddb/client/IDBCursorImpl.h: Removed.
* Modules/indexeddb/client/IDBCursorWithValueImpl.cpp: Removed.
* Modules/indexeddb/client/IDBCursorWithValueImpl.h: Removed.
* Modules/indexeddb/client/IDBDatabaseImpl.cpp: Removed.
* Modules/indexeddb/client/IDBDatabaseImpl.h: Removed.
* Modules/indexeddb/client/IDBFactoryImpl.cpp: Removed.
* Modules/indexeddb/client/IDBFactoryImpl.h: Removed.
* Modules/indexeddb/client/IDBIndexImpl.cpp: Removed.
* Modules/indexeddb/client/IDBIndexImpl.h: Removed.
* Modules/indexeddb/client/IDBObjectStoreImpl.cpp: Removed.
* Modules/indexeddb/client/IDBObjectStoreImpl.h: Removed.
* Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp: Removed.
* Modules/indexeddb/client/IDBOpenDBRequestImpl.h: Removed.
* Modules/indexeddb/client/IDBRequestImpl.cpp: Removed.
* Modules/indexeddb/client/IDBRequestImpl.h: Removed.
* Modules/indexeddb/client/IDBTransactionImpl.cpp: Removed.
* Modules/indexeddb/client/IDBTransactionImpl.h: Removed.
* Modules/indexeddb/client/IDBVersionChangeEventImpl.cpp: Removed.
* Modules/indexeddb/client/IDBVersionChangeEventImpl.h: Removed.
* Modules/indexeddb/client/TransactionOperation.cpp:
* Modules/indexeddb/client/TransactionOperation.h:
* Modules/indexeddb/shared/IDBCursorInfo.cpp:
(WebCore::IDBCursorInfo::objectStoreCursor):
(WebCore::IDBCursorInfo::indexCursor):
(WebCore::IDBCursorInfo::IDBCursorInfo):
* Modules/indexeddb/shared/IDBCursorInfo.h:
* Modules/indexeddb/shared/IDBRequestData.cpp:
(WebCore::IDBRequestData::IDBRequestData):
* Modules/indexeddb/shared/IDBRequestData.h:
* Modules/indexeddb/shared/IDBResourceIdentifier.cpp:
(WebCore::IDBResourceIdentifier::IDBResourceIdentifier):
* Modules/indexeddb/shared/IDBResourceIdentifier.h:
* Modules/indexeddb/shared/IDBTransactionInfo.cpp:
* Modules/indexeddb/shared/InProcessIDBServer.cpp:
* Modules/indexeddb/shared/InProcessIDBServer.h:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSIDBCursorCustom.cpp:
(WebCore::JSIDBCursor::visitAdditionalChildren):
* bindings/js/JSIDBCursorWithValueCustom.cpp:
* bindings/js/JSIDBIndexCustom.cpp:
(WebCore::JSIDBIndex::visitAdditionalChildren):
* bindings/js/JSIDBObjectStoreCustom.cpp:
(WebCore::JSIDBObjectStore::visitAdditionalChildren):
* inspector/InspectorIndexedDBAgent.cpp:
Source/WebKit2:
* WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreCMakeListstxt">trunk/Source/WebCore/CMakeLists.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbDOMWindowIndexedDatabasecpp">trunk/Source/WebCore/Modules/indexeddb/DOMWindowIndexedDatabase.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBAnycpp">trunk/Source/WebCore/Modules/indexeddb/IDBAny.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBAnyh">trunk/Source/WebCore/Modules/indexeddb/IDBAny.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBCursorcpp">trunk/Source/WebCore/Modules/indexeddb/IDBCursor.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBCursorh">trunk/Source/WebCore/Modules/indexeddb/IDBCursor.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBCursorWithValuecpp">trunk/Source/WebCore/Modules/indexeddb/IDBCursorWithValue.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBCursorWithValueh">trunk/Source/WebCore/Modules/indexeddb/IDBCursorWithValue.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBDatabasecpp">trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBDatabaseh">trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBFactorycpp">trunk/Source/WebCore/Modules/indexeddb/IDBFactory.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBFactoryh">trunk/Source/WebCore/Modules/indexeddb/IDBFactory.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBIndexcpp">trunk/Source/WebCore/Modules/indexeddb/IDBIndex.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBIndexh">trunk/Source/WebCore/Modules/indexeddb/IDBIndex.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBObjectStorecpp">trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBObjectStoreh">trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBOpenDBRequestcpp">trunk/Source/WebCore/Modules/indexeddb/IDBOpenDBRequest.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBOpenDBRequesth">trunk/Source/WebCore/Modules/indexeddb/IDBOpenDBRequest.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBRequestcpp">trunk/Source/WebCore/Modules/indexeddb/IDBRequest.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBRequesth">trunk/Source/WebCore/Modules/indexeddb/IDBRequest.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBRequestCompletionEventcpp">trunk/Source/WebCore/Modules/indexeddb/IDBRequestCompletionEvent.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBRequestCompletionEventh">trunk/Source/WebCore/Modules/indexeddb/IDBRequestCompletionEvent.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBTransactioncpp">trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBTransactionh">trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBVersionChangeEventcpp">trunk/Source/WebCore/Modules/indexeddb/IDBVersionChangeEvent.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBVersionChangeEventh">trunk/Source/WebCore/Modules/indexeddb/IDBVersionChangeEvent.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientIDBConnectionToServercpp">trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientIDBConnectionToServerh">trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientTransactionOperationcpp">trunk/Source/WebCore/Modules/indexeddb/client/TransactionOperation.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientTransactionOperationh">trunk/Source/WebCore/Modules/indexeddb/client/TransactionOperation.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbsharedIDBCursorInfocpp">trunk/Source/WebCore/Modules/indexeddb/shared/IDBCursorInfo.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbsharedIDBCursorInfoh">trunk/Source/WebCore/Modules/indexeddb/shared/IDBCursorInfo.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbsharedIDBRequestDatacpp">trunk/Source/WebCore/Modules/indexeddb/shared/IDBRequestData.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbsharedIDBRequestDatah">trunk/Source/WebCore/Modules/indexeddb/shared/IDBRequestData.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbsharedIDBResourceIdentifiercpp">trunk/Source/WebCore/Modules/indexeddb/shared/IDBResourceIdentifier.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbsharedIDBResourceIdentifierh">trunk/Source/WebCore/Modules/indexeddb/shared/IDBResourceIdentifier.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbsharedIDBTransactionInfocpp">trunk/Source/WebCore/Modules/indexeddb/shared/IDBTransactionInfo.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbsharedInProcessIDBServercpp">trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbsharedInProcessIDBServerh">trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.h</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSIDBCursorCustomcpp">trunk/Source/WebCore/bindings/js/JSIDBCursorCustom.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSIDBCursorWithValueCustomcpp">trunk/Source/WebCore/bindings/js/JSIDBCursorWithValueCustom.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSIDBIndexCustomcpp">trunk/Source/WebCore/bindings/js/JSIDBIndexCustom.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSIDBObjectStoreCustomcpp">trunk/Source/WebCore/bindings/js/JSIDBObjectStoreCustom.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorIndexedDBAgentcpp">trunk/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2WebProcessDatabasesIndexedDBWebIDBConnectionToServercpp">trunk/Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientIDBAnyImplcpp">trunk/Source/WebCore/Modules/indexeddb/client/IDBAnyImpl.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientIDBAnyImplh">trunk/Source/WebCore/Modules/indexeddb/client/IDBAnyImpl.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientIDBCursorImplcpp">trunk/Source/WebCore/Modules/indexeddb/client/IDBCursorImpl.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientIDBCursorImplh">trunk/Source/WebCore/Modules/indexeddb/client/IDBCursorImpl.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientIDBCursorWithValueImplcpp">trunk/Source/WebCore/Modules/indexeddb/client/IDBCursorWithValueImpl.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientIDBCursorWithValueImplh">trunk/Source/WebCore/Modules/indexeddb/client/IDBCursorWithValueImpl.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientIDBDatabaseImplcpp">trunk/Source/WebCore/Modules/indexeddb/client/IDBDatabaseImpl.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientIDBDatabaseImplh">trunk/Source/WebCore/Modules/indexeddb/client/IDBDatabaseImpl.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientIDBFactoryImplcpp">trunk/Source/WebCore/Modules/indexeddb/client/IDBFactoryImpl.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientIDBFactoryImplh">trunk/Source/WebCore/Modules/indexeddb/client/IDBFactoryImpl.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientIDBIndexImplcpp">trunk/Source/WebCore/Modules/indexeddb/client/IDBIndexImpl.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientIDBIndexImplh">trunk/Source/WebCore/Modules/indexeddb/client/IDBIndexImpl.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientIDBObjectStoreImplcpp">trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientIDBObjectStoreImplh">trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientIDBOpenDBRequestImplcpp">trunk/Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientIDBOpenDBRequestImplh">trunk/Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientIDBRequestImplcpp">trunk/Source/WebCore/Modules/indexeddb/client/IDBRequestImpl.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientIDBRequestImplh">trunk/Source/WebCore/Modules/indexeddb/client/IDBRequestImpl.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientIDBTransactionImplcpp">trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientIDBTransactionImplh">trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientIDBVersionChangeEventImplcpp">trunk/Source/WebCore/Modules/indexeddb/client/IDBVersionChangeEventImpl.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientIDBVersionChangeEventImplh">trunk/Source/WebCore/Modules/indexeddb/client/IDBVersionChangeEventImpl.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/CMakeLists.txt (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/CMakeLists.txt        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/CMakeLists.txt        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -853,18 +853,7 @@
</span><span class="cx"> Modules/indexeddb/IDBVersionChangeEvent.cpp
</span><span class="cx"> Modules/indexeddb/WorkerGlobalScopeIndexedDatabase.cpp
</span><span class="cx">
</span><del>- Modules/indexeddb/client/IDBAnyImpl.cpp
</del><span class="cx"> Modules/indexeddb/client/IDBConnectionToServer.cpp
</span><del>- Modules/indexeddb/client/IDBCursorImpl.cpp
- Modules/indexeddb/client/IDBCursorWithValueImpl.cpp
- Modules/indexeddb/client/IDBDatabaseImpl.cpp
- Modules/indexeddb/client/IDBFactoryImpl.cpp
- Modules/indexeddb/client/IDBIndexImpl.cpp
- Modules/indexeddb/client/IDBObjectStoreImpl.cpp
- Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp
- Modules/indexeddb/client/IDBRequestImpl.cpp
- Modules/indexeddb/client/IDBTransactionImpl.cpp
- Modules/indexeddb/client/IDBVersionChangeEventImpl.cpp
</del><span class="cx"> Modules/indexeddb/client/TransactionOperation.cpp
</span><span class="cx">
</span><span class="cx"> Modules/indexeddb/server/IDBConnectionToClient.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/ChangeLog        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -1,3 +1,393 @@
</span><ins>+2016-03-28 Brady Eidson <beidson@apple.com>
+
+ Modern IDB: Remove abstract base classes for all IDB DOM classes.
+ https://bugs.webkit.org/show_bug.cgi?id=155951
+
+ Reviewed by Alex Christensen.
+
+ Refactor - No behavior change.
+
+ * Modules/indexeddb/DOMWindowIndexedDatabase.cpp:
+ (WebCore::DOMWindowIndexedDatabase::indexedDB):
+ * Modules/indexeddb/IDBAny.cpp:
+ (WebCore::IDBAny::IDBAny):
+ (WebCore::IDBAny::~IDBAny):
+ (WebCore::IDBAny::idbDatabase):
+ (WebCore::IDBAny::domStringList):
+ (WebCore::IDBAny::idbCursor):
+ (WebCore::IDBAny::idbCursorWithValue):
+ (WebCore::IDBAny::idbFactory):
+ (WebCore::IDBAny::idbIndex):
+ (WebCore::IDBAny::idbObjectStore):
+ (WebCore::IDBAny::idbTransaction):
+ (WebCore::IDBAny::scriptValue):
+ (WebCore::IDBAny::integer):
+ (WebCore::IDBAny::string):
+ (WebCore::IDBAny::keyPath):
+ * Modules/indexeddb/IDBAny.h:
+ (WebCore::IDBAny::create):
+ (WebCore::IDBAny::createUndefined):
+ (WebCore::IDBAny::type):
+ (WebCore::IDBAny::~IDBAny): Deleted.
+ (WebCore::IDBAny::isLegacy): Deleted.
+ * Modules/indexeddb/IDBCursor.cpp:
+ (WebCore::IDBCursor::create):
+ (WebCore::IDBCursor::IDBCursor):
+ (WebCore::IDBCursor::~IDBCursor):
+ (WebCore::IDBCursor::sourcesDeleted):
+ (WebCore::IDBCursor::effectiveObjectStore):
+ (WebCore::IDBCursor::transaction):
+ (WebCore::IDBCursor::direction):
+ (WebCore::IDBCursor::key):
+ (WebCore::IDBCursor::primaryKey):
+ (WebCore::IDBCursor::value):
+ (WebCore::IDBCursor::source):
+ (WebCore::IDBCursor::update):
+ (WebCore::IDBCursor::advance):
+ (WebCore::IDBCursor::continueFunction):
+ (WebCore::IDBCursor::uncheckedIterateCursor):
+ (WebCore::IDBCursor::deleteFunction):
+ (WebCore::IDBCursor::setGetResult):
+ (WebCore::IDBCursor::activeDOMObjectName):
+ (WebCore::IDBCursor::canSuspendForDocumentSuspension):
+ (WebCore::IDBCursor::hasPendingActivity):
+ (WebCore::IDBCursor::decrementOutstandingRequestCount):
+ * Modules/indexeddb/IDBCursor.h:
+ (WebCore::IDBCursor::info):
+ (WebCore::IDBCursor::setRequest):
+ (WebCore::IDBCursor::clearRequest):
+ (WebCore::IDBCursor::request):
+ (WebCore::IDBCursor::isKeyCursor):
+ (WebCore::IDBCursor::~IDBCursor): Deleted.
+ (WebCore::IDBCursor::continueFunction): Deleted.
+ (WebCore::IDBCursor::isModernCursor): Deleted.
+ (WebCore::IDBCursor::hasPendingActivity): Deleted.
+ * Modules/indexeddb/IDBCursorWithValue.cpp:
+ (WebCore::IDBCursorWithValue::create):
+ (WebCore::IDBCursorWithValue::IDBCursorWithValue):
+ (WebCore::IDBCursorWithValue::~IDBCursorWithValue):
+ * Modules/indexeddb/IDBCursorWithValue.h:
+ (WebCore::IDBCursorWithValue::~IDBCursorWithValue): Deleted.
+ * Modules/indexeddb/IDBDatabase.cpp:
+ (WebCore::IDBDatabase::create):
+ (WebCore::IDBDatabase::IDBDatabase):
+ (WebCore::IDBDatabase::~IDBDatabase):
+ (WebCore::IDBDatabase::hasPendingActivity):
+ (WebCore::IDBDatabase::name):
+ (WebCore::IDBDatabase::version):
+ (WebCore::IDBDatabase::objectStoreNames):
+ (WebCore::IDBDatabase::createObjectStore):
+ (WebCore::IDBDatabase::transaction):
+ (WebCore::IDBDatabase::deleteObjectStore):
+ (WebCore::IDBDatabase::close):
+ (WebCore::IDBDatabase::maybeCloseInServer):
+ (WebCore::IDBDatabase::activeDOMObjectName):
+ (WebCore::IDBDatabase::canSuspendForDocumentSuspension):
+ (WebCore::IDBDatabase::stop):
+ (WebCore::IDBDatabase::startVersionChangeTransaction):
+ (WebCore::IDBDatabase::didStartTransaction):
+ (WebCore::IDBDatabase::willCommitTransaction):
+ (WebCore::IDBDatabase::didCommitTransaction):
+ (WebCore::IDBDatabase::willAbortTransaction):
+ (WebCore::IDBDatabase::didAbortTransaction):
+ (WebCore::IDBDatabase::didCommitOrAbortTransaction):
+ (WebCore::IDBDatabase::fireVersionChangeEvent):
+ (WebCore::IDBDatabase::dispatchEvent):
+ (WebCore::IDBDatabase::didCreateIndexInfo):
+ (WebCore::IDBDatabase::didDeleteIndexInfo):
+ * Modules/indexeddb/IDBDatabase.h:
+ (WebCore::IDBDatabase::info):
+ (WebCore::IDBDatabase::databaseConnectionIdentifier):
+ (WebCore::IDBDatabase::serverConnection):
+ (WebCore::IDBDatabase::isClosingOrClosed):
+ (WebCore::IDBDatabase::~IDBDatabase): Deleted.
+ * Modules/indexeddb/IDBFactory.cpp:
+ (WebCore::shouldThrowSecurityException):
+ (WebCore::IDBFactory::create):
+ (WebCore::IDBFactory::IDBFactory):
+ (WebCore::IDBFactory::getDatabaseNames):
+ (WebCore::IDBFactory::open):
+ (WebCore::IDBFactory::openInternal):
+ (WebCore::IDBFactory::deleteDatabase):
+ (WebCore::IDBFactory::cmp):
+ * Modules/indexeddb/IDBFactory.h:
+ (WebCore::IDBFactory::~IDBFactory): Deleted.
+ * Modules/indexeddb/IDBIndex.cpp:
+ (WebCore::IDBIndex::IDBIndex):
+ (WebCore::IDBIndex::~IDBIndex):
+ (WebCore::IDBIndex::activeDOMObjectName):
+ (WebCore::IDBIndex::canSuspendForDocumentSuspension):
+ (WebCore::IDBIndex::hasPendingActivity):
+ (WebCore::IDBIndex::name):
+ (WebCore::IDBIndex::objectStore):
+ (WebCore::IDBIndex::keyPathAny):
+ (WebCore::IDBIndex::keyPath):
+ (WebCore::IDBIndex::unique):
+ (WebCore::IDBIndex::multiEntry):
+ (WebCore::IDBIndex::openCursor):
+ (WebCore::IDBIndex::count):
+ (WebCore::IDBIndex::doCount):
+ (WebCore::IDBIndex::openKeyCursor):
+ (WebCore::IDBIndex::get):
+ (WebCore::IDBIndex::doGet):
+ (WebCore::IDBIndex::getKey):
+ (WebCore::IDBIndex::doGetKey):
+ (WebCore::IDBIndex::markAsDeleted):
+ (WebCore::IDBIndex::ref):
+ (WebCore::IDBIndex::deref):
+ * Modules/indexeddb/IDBIndex.h:
+ (WebCore::IDBIndex::openCursor):
+ (WebCore::IDBIndex::openKeyCursor):
+ (WebCore::IDBIndex::info):
+ (WebCore::IDBIndex::modernObjectStore):
+ (WebCore::IDBIndex::isDeleted):
+ (WebCore::IDBIndex::~IDBIndex): Deleted.
+ (WebCore::IDBIndex::isModern): Deleted.
+ * Modules/indexeddb/IDBObjectStore.cpp:
+ (WebCore::IDBObjectStore::create):
+ (WebCore::IDBObjectStore::IDBObjectStore):
+ (WebCore::IDBObjectStore::~IDBObjectStore):
+ (WebCore::IDBObjectStore::activeDOMObjectName):
+ (WebCore::IDBObjectStore::canSuspendForDocumentSuspension):
+ (WebCore::IDBObjectStore::hasPendingActivity):
+ (WebCore::IDBObjectStore::name):
+ (WebCore::IDBObjectStore::keyPathAny):
+ (WebCore::IDBObjectStore::keyPath):
+ (WebCore::IDBObjectStore::indexNames):
+ (WebCore::IDBObjectStore::transaction):
+ (WebCore::IDBObjectStore::autoIncrement):
+ (WebCore::IDBObjectStore::openCursor):
+ (WebCore::IDBObjectStore::get):
+ (WebCore::IDBObjectStore::add):
+ (WebCore::IDBObjectStore::put):
+ (WebCore::IDBObjectStore::putForCursorUpdate):
+ (WebCore::IDBObjectStore::putOrAdd):
+ (WebCore::IDBObjectStore::deleteFunction):
+ (WebCore::IDBObjectStore::doDelete):
+ (WebCore::IDBObjectStore::modernDelete):
+ (WebCore::IDBObjectStore::clear):
+ (WebCore::IDBObjectStore::createIndex):
+ (WebCore::IDBObjectStore::index):
+ (WebCore::IDBObjectStore::deleteIndex):
+ (WebCore::IDBObjectStore::count):
+ (WebCore::IDBObjectStore::doCount):
+ (WebCore::IDBObjectStore::markAsDeleted):
+ (WebCore::IDBObjectStore::rollbackInfoForVersionChangeAbort):
+ (WebCore::IDBObjectStore::visitReferencedIndexes):
+ * Modules/indexeddb/IDBObjectStore.h:
+ (WebCore::IDBObjectStore::isDeleted):
+ (WebCore::IDBObjectStore::info):
+ (WebCore::IDBObjectStore::modernTransaction):
+ (WebCore::IDBObjectStore::~IDBObjectStore): Deleted.
+ (WebCore::IDBObjectStore::isModern): Deleted.
+ * Modules/indexeddb/IDBOpenDBRequest.cpp:
+ (WebCore::IDBOpenDBRequest::createDeleteRequest):
+ (WebCore::IDBOpenDBRequest::createOpenRequest):
+ (WebCore::IDBOpenDBRequest::IDBOpenDBRequest):
+ (WebCore::IDBOpenDBRequest::~IDBOpenDBRequest):
+ (WebCore::IDBOpenDBRequest::onError):
+ (WebCore::IDBOpenDBRequest::versionChangeTransactionDidFinish):
+ (WebCore::IDBOpenDBRequest::fireSuccessAfterVersionChangeCommit):
+ (WebCore::IDBOpenDBRequest::fireErrorAfterVersionChangeCompletion):
+ (WebCore::IDBOpenDBRequest::dispatchEvent):
+ (WebCore::IDBOpenDBRequest::onSuccess):
+ (WebCore::IDBOpenDBRequest::onUpgradeNeeded):
+ (WebCore::IDBOpenDBRequest::onDeleteDatabaseSuccess):
+ (WebCore::IDBOpenDBRequest::requestCompleted):
+ (WebCore::IDBOpenDBRequest::requestBlocked):
+ * Modules/indexeddb/IDBOpenDBRequest.h:
+ (WebCore::IDBOpenDBRequest::databaseIdentifier):
+ (WebCore::IDBOpenDBRequest::version):
+ (WebCore::IDBOpenDBRequest::~IDBOpenDBRequest): Deleted.
+ * Modules/indexeddb/IDBRequest.cpp:
+ (WebCore::IDBRequest::create):
+ (WebCore::IDBRequest::createCount):
+ (WebCore::IDBRequest::createGet):
+ (WebCore::IDBRequest::IDBRequest):
+ (WebCore::IDBRequest::~IDBRequest):
+ (WebCore::IDBRequest::result):
+ (WebCore::IDBRequest::errorCode):
+ (WebCore::IDBRequest::error):
+ (WebCore::IDBRequest::source):
+ (WebCore::IDBRequest::setSource):
+ (WebCore::IDBRequest::setVersionChangeTransaction):
+ (WebCore::IDBRequest::transaction):
+ (WebCore::IDBRequest::readyState):
+ (WebCore::IDBRequest::sourceObjectStoreIdentifier):
+ (WebCore::IDBRequest::sourceIndexIdentifier):
+ (WebCore::IDBRequest::requestedIndexRecordType):
+ (WebCore::IDBRequest::eventTargetInterface):
+ (WebCore::IDBRequest::activeDOMObjectName):
+ (WebCore::IDBRequest::canSuspendForDocumentSuspension):
+ (WebCore::IDBRequest::hasPendingActivity):
+ (WebCore::IDBRequest::stop):
+ (WebCore::IDBRequest::enqueueEvent):
+ (WebCore::IDBRequest::dispatchEvent):
+ (WebCore::IDBRequest::uncaughtExceptionInEventHandler):
+ (WebCore::IDBRequest::setResult):
+ (WebCore::IDBRequest::setResultToStructuredClone):
+ (WebCore::IDBRequest::setResultToUndefined):
+ (WebCore::IDBRequest::resultCursor):
+ (WebCore::IDBRequest::willIterateCursor):
+ (WebCore::IDBRequest::didOpenOrIterateCursor):
+ (WebCore::IDBRequest::requestCompleted):
+ (WebCore::IDBRequest::onError):
+ (WebCore::IDBRequest::onSuccess):
+ * Modules/indexeddb/IDBRequest.h:
+ (WebCore::IDBRequest::resourceIdentifier):
+ (WebCore::IDBRequest::connection):
+ (WebCore::IDBRequest::modernResult):
+ (WebCore::IDBRequest::pendingCursor):
+ (WebCore::IDBRequest::requestType):
+ (WebCore::IDBRequest::isOpenDBRequest):
+ (WebCore::IDBRequest::~IDBRequest): Deleted.
+ * Modules/indexeddb/IDBRequestCompletionEvent.cpp:
+ (WebCore::IDBRequestCompletionEvent::IDBRequestCompletionEvent):
+ * Modules/indexeddb/IDBRequestCompletionEvent.h:
+ (WebCore::IDBRequestCompletionEvent::create):
+ * Modules/indexeddb/IDBTransaction.cpp:
+ (WebCore::IDBTransaction::create):
+ (WebCore::IDBTransaction::IDBTransaction):
+ (WebCore::IDBTransaction::~IDBTransaction):
+ (WebCore::IDBTransaction::mode):
+ (WebCore::IDBTransaction::db):
+ (WebCore::IDBTransaction::serverConnection):
+ (WebCore::IDBTransaction::error):
+ (WebCore::IDBTransaction::objectStore):
+ (WebCore::IDBTransaction::abortDueToFailedRequest):
+ (WebCore::IDBTransaction::transitionedToFinishing):
+ (WebCore::IDBTransaction::abort):
+ (WebCore::IDBTransaction::abortOnServerAndCancelRequests):
+ (WebCore::IDBTransaction::activeDOMObjectName):
+ (WebCore::IDBTransaction::canSuspendForDocumentSuspension):
+ (WebCore::IDBTransaction::hasPendingActivity):
+ (WebCore::IDBTransaction::stop):
+ (WebCore::IDBTransaction::isActive):
+ (WebCore::IDBTransaction::isFinishedOrFinishing):
+ (WebCore::IDBTransaction::addRequest):
+ (WebCore::IDBTransaction::removeRequest):
+ (WebCore::IDBTransaction::scheduleOperation):
+ (WebCore::IDBTransaction::scheduleOperationTimer):
+ (WebCore::IDBTransaction::operationTimerFired):
+ (WebCore::IDBTransaction::commit):
+ (WebCore::IDBTransaction::commitOnServer):
+ (WebCore::IDBTransaction::finishAbortOrCommit):
+ (WebCore::IDBTransaction::didStart):
+ (WebCore::IDBTransaction::notifyDidAbort):
+ (WebCore::IDBTransaction::didAbort):
+ (WebCore::IDBTransaction::didCommit):
+ (WebCore::IDBTransaction::fireOnComplete):
+ (WebCore::IDBTransaction::fireOnAbort):
+ (WebCore::IDBTransaction::enqueueEvent):
+ (WebCore::IDBTransaction::dispatchEvent):
+ (WebCore::IDBTransaction::createObjectStore):
+ (WebCore::IDBTransaction::createObjectStoreOnServer):
+ (WebCore::IDBTransaction::didCreateObjectStoreOnServer):
+ (WebCore::IDBTransaction::createIndex):
+ (WebCore::IDBTransaction::createIndexOnServer):
+ (WebCore::IDBTransaction::didCreateIndexOnServer):
+ (WebCore::IDBTransaction::requestOpenCursor):
+ (WebCore::IDBTransaction::doRequestOpenCursor):
+ (WebCore::IDBTransaction::openCursorOnServer):
+ (WebCore::IDBTransaction::didOpenCursorOnServer):
+ (WebCore::IDBTransaction::iterateCursor):
+ (WebCore::IDBTransaction::iterateCursorOnServer):
+ (WebCore::IDBTransaction::didIterateCursorOnServer):
+ (WebCore::IDBTransaction::requestGetRecord):
+ (WebCore::IDBTransaction::requestGetValue):
+ (WebCore::IDBTransaction::requestGetKey):
+ (WebCore::IDBTransaction::requestIndexRecord):
+ (WebCore::IDBTransaction::getRecordOnServer):
+ (WebCore::IDBTransaction::didGetRecordOnServer):
+ (WebCore::IDBTransaction::requestCount):
+ (WebCore::IDBTransaction::getCountOnServer):
+ (WebCore::IDBTransaction::didGetCountOnServer):
+ (WebCore::IDBTransaction::requestDeleteRecord):
+ (WebCore::IDBTransaction::deleteRecordOnServer):
+ (WebCore::IDBTransaction::didDeleteRecordOnServer):
+ (WebCore::IDBTransaction::requestClearObjectStore):
+ (WebCore::IDBTransaction::clearObjectStoreOnServer):
+ (WebCore::IDBTransaction::didClearObjectStoreOnServer):
+ (WebCore::IDBTransaction::requestPutOrAdd):
+ (WebCore::IDBTransaction::putOrAddOnServer):
+ (WebCore::IDBTransaction::didPutOrAddOnServer):
+ (WebCore::IDBTransaction::deleteObjectStore):
+ (WebCore::IDBTransaction::deleteObjectStoreOnServer):
+ (WebCore::IDBTransaction::didDeleteObjectStoreOnServer):
+ (WebCore::IDBTransaction::deleteIndex):
+ (WebCore::IDBTransaction::deleteIndexOnServer):
+ (WebCore::IDBTransaction::didDeleteIndexOnServer):
+ (WebCore::IDBTransaction::operationDidComplete):
+ (WebCore::IDBTransaction::establishOnServer):
+ (WebCore::IDBTransaction::activate):
+ (WebCore::IDBTransaction::deactivate):
+ * Modules/indexeddb/IDBTransaction.h:
+ (WebCore::IDBTransaction::info):
+ (WebCore::IDBTransaction::database):
+ (WebCore::IDBTransaction::originalDatabaseInfo):
+ (WebCore::IDBTransaction::isVersionChange):
+ (WebCore::IDBTransaction::isReadOnly):
+ (WebCore::IDBTransaction::isFinished):
+ (WebCore::TransactionActivator::TransactionActivator):
+ (WebCore::TransactionActivator::~TransactionActivator):
+ (WebCore::IDBTransaction::~IDBTransaction): Deleted.
+ * Modules/indexeddb/IDBVersionChangeEvent.cpp:
+ (WebCore::IDBVersionChangeEvent::IDBVersionChangeEvent):
+ (WebCore::IDBVersionChangeEvent::newVersion):
+ (WebCore::IDBVersionChangeEvent::eventInterface):
+ (WebCore::IDBVersionChangeEvent::create): Deleted.
+ * Modules/indexeddb/IDBVersionChangeEvent.h:
+ (isType):
+ * Modules/indexeddb/client/IDBAnyImpl.cpp: Removed.
+ * Modules/indexeddb/client/IDBAnyImpl.h: Removed.
+ * Modules/indexeddb/client/IDBConnectionToServer.cpp:
+ * Modules/indexeddb/client/IDBConnectionToServer.h:
+ * Modules/indexeddb/client/IDBCursorImpl.cpp: Removed.
+ * Modules/indexeddb/client/IDBCursorImpl.h: Removed.
+ * Modules/indexeddb/client/IDBCursorWithValueImpl.cpp: Removed.
+ * Modules/indexeddb/client/IDBCursorWithValueImpl.h: Removed.
+ * Modules/indexeddb/client/IDBDatabaseImpl.cpp: Removed.
+ * Modules/indexeddb/client/IDBDatabaseImpl.h: Removed.
+ * Modules/indexeddb/client/IDBFactoryImpl.cpp: Removed.
+ * Modules/indexeddb/client/IDBFactoryImpl.h: Removed.
+ * Modules/indexeddb/client/IDBIndexImpl.cpp: Removed.
+ * Modules/indexeddb/client/IDBIndexImpl.h: Removed.
+ * Modules/indexeddb/client/IDBObjectStoreImpl.cpp: Removed.
+ * Modules/indexeddb/client/IDBObjectStoreImpl.h: Removed.
+ * Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp: Removed.
+ * Modules/indexeddb/client/IDBOpenDBRequestImpl.h: Removed.
+ * Modules/indexeddb/client/IDBRequestImpl.cpp: Removed.
+ * Modules/indexeddb/client/IDBRequestImpl.h: Removed.
+ * Modules/indexeddb/client/IDBTransactionImpl.cpp: Removed.
+ * Modules/indexeddb/client/IDBTransactionImpl.h: Removed.
+ * Modules/indexeddb/client/IDBVersionChangeEventImpl.cpp: Removed.
+ * Modules/indexeddb/client/IDBVersionChangeEventImpl.h: Removed.
+ * Modules/indexeddb/client/TransactionOperation.cpp:
+ * Modules/indexeddb/client/TransactionOperation.h:
+ * Modules/indexeddb/shared/IDBCursorInfo.cpp:
+ (WebCore::IDBCursorInfo::objectStoreCursor):
+ (WebCore::IDBCursorInfo::indexCursor):
+ (WebCore::IDBCursorInfo::IDBCursorInfo):
+ * Modules/indexeddb/shared/IDBCursorInfo.h:
+ * Modules/indexeddb/shared/IDBRequestData.cpp:
+ (WebCore::IDBRequestData::IDBRequestData):
+ * Modules/indexeddb/shared/IDBRequestData.h:
+ * Modules/indexeddb/shared/IDBResourceIdentifier.cpp:
+ (WebCore::IDBResourceIdentifier::IDBResourceIdentifier):
+ * Modules/indexeddb/shared/IDBResourceIdentifier.h:
+ * Modules/indexeddb/shared/IDBTransactionInfo.cpp:
+ * Modules/indexeddb/shared/InProcessIDBServer.cpp:
+ * Modules/indexeddb/shared/InProcessIDBServer.h:
+ * WebCore.xcodeproj/project.pbxproj:
+ * bindings/js/JSIDBCursorCustom.cpp:
+ (WebCore::JSIDBCursor::visitAdditionalChildren):
+ * bindings/js/JSIDBCursorWithValueCustom.cpp:
+ * bindings/js/JSIDBIndexCustom.cpp:
+ (WebCore::JSIDBIndex::visitAdditionalChildren):
+ * bindings/js/JSIDBObjectStoreCustom.cpp:
+ (WebCore::JSIDBObjectStore::visitAdditionalChildren):
+ * inspector/InspectorIndexedDBAgent.cpp:
+
</ins><span class="cx"> 2016-03-28 Myles C. Maxfield <mmaxfield@apple.com>
</span><span class="cx">
</span><span class="cx"> [RTL Scrollbars] Position:sticky can be positioned under vertical RTL scrollbar
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbDOMWindowIndexedDatabasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/DOMWindowIndexedDatabase.cpp (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/DOMWindowIndexedDatabase.cpp        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/Modules/indexeddb/DOMWindowIndexedDatabase.cpp        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -31,7 +31,7 @@
</span><span class="cx"> #include "DOMWindow.h"
</span><span class="cx"> #include "DatabaseProvider.h"
</span><span class="cx"> #include "Document.h"
</span><del>-#include "IDBFactoryImpl.h"
</del><ins>+#include "IDBFactory.h"
</ins><span class="cx"> #include "Page.h"
</span><span class="cx"> #include "SecurityOrigin.h"
</span><span class="cx">
</span><span class="lines">@@ -112,7 +112,7 @@
</span><span class="cx"> return nullptr;
</span><span class="cx">
</span><span class="cx"> if (!m_idbFactory)
</span><del>- m_idbFactory = IDBClient::IDBFactory::create(page->idbConnection());
</del><ins>+ m_idbFactory = IDBFactory::create(page->idbConnection());
</ins><span class="cx">
</span><span class="cx"> return m_idbFactory.get();
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBAnycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBAny.cpp (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBAny.cpp        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBAny.cpp        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -28,12 +28,131 @@
</span><span class="cx">
</span><span class="cx"> #if ENABLE(INDEXED_DATABASE)
</span><span class="cx">
</span><ins>+#include "DOMStringList.h"
+#include "IDBCursorWithValue.h"
+#include "IDBDatabase.h"
+#include "IDBFactory.h"
+#include "IDBIndex.h"
+#include "IDBObjectStore.h"
+#include "IDBTransaction.h"
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-IDBAny::IDBAny()
</del><ins>+IDBAny::IDBAny(IDBAny::Type type)
+ : m_type(type)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+IDBAny::IDBAny(Ref<IDBDatabase>&& database)
+ : m_type(IDBAny::Type::IDBDatabase)
+ , m_database(WTFMove(database))
+{
+}
+
+IDBAny::IDBAny(Ref<IDBObjectStore>&& objectStore)
+ : m_type(IDBAny::Type::IDBObjectStore)
+ , m_objectStore(WTFMove(objectStore))
+{
+}
+
+IDBAny::IDBAny(Ref<IDBIndex>&& index)
+ : m_type(IDBAny::Type::IDBIndex)
+ , m_index(WTFMove(index))
+{
+}
+
+IDBAny::IDBAny(Ref<IDBCursor>&& cursor)
+{
+ if (cursor->isKeyCursor()) {
+ m_type = IDBAny::Type::IDBCursor;
+ m_cursor = WTFMove(cursor);
+ } else {
+ m_type = IDBAny::Type::IDBCursorWithValue;
+ m_cursorWithValue = static_cast<IDBCursorWithValue*>(&cursor.get());
+ }
+}
+
+IDBAny::IDBAny(const IDBKeyPath& keyPath)
+ : m_type(IDBAny::Type::KeyPath)
+ , m_idbKeyPath(keyPath)
+{
+}
+
+IDBAny::IDBAny(const Deprecated::ScriptValue& value)
+ : m_type(IDBAny::Type::ScriptValue)
+ , m_scriptValue(value)
+{
+}
+
+IDBAny::~IDBAny()
+{
+}
+
+RefPtr<IDBDatabase> IDBAny::idbDatabase()
+{
+ ASSERT(m_type == IDBAny::Type::IDBDatabase);
+ return m_database.get();
+}
+
+RefPtr<DOMStringList> IDBAny::domStringList()
+{
+ return nullptr;
+}
+
+RefPtr<IDBCursor> IDBAny::idbCursor()
+{
+ ASSERT(m_type == IDBAny::Type::IDBCursor || m_type == IDBAny::Type::IDBCursorWithValue);
+ return m_cursor ? m_cursor.get() : m_cursorWithValue.get();
+}
+
+RefPtr<IDBCursorWithValue> IDBAny::idbCursorWithValue()
+{
+ ASSERT(m_type == IDBAny::Type::IDBCursorWithValue);
+ return m_cursorWithValue.get();
+}
+
+RefPtr<IDBFactory> IDBAny::idbFactory()
+{
+ return nullptr;
+}
+
+RefPtr<IDBIndex> IDBAny::idbIndex()
+{
+ ASSERT(m_type == IDBAny::Type::IDBIndex);
+ return m_index.get();
+}
+
+RefPtr<IDBObjectStore> IDBAny::idbObjectStore()
+{
+ ASSERT(m_type == IDBAny::Type::IDBObjectStore);
+ return m_objectStore.get();
+}
+
+RefPtr<IDBTransaction> IDBAny::idbTransaction()
+{
+ return nullptr;
+}
+
+const Deprecated::ScriptValue& IDBAny::scriptValue()
+{
+ return m_scriptValue;
+}
+
+int64_t IDBAny::integer()
+{
+ return m_integer;
+}
+
+const String& IDBAny::string()
+{
+ return m_string;
+}
+
+const IDBKeyPath& IDBAny::keyPath()
+{
+ return m_idbKeyPath;
+}
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx">
</span><span class="cx"> #endif // ENABLE(INDEXED_DATABASE)
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBAnyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBAny.h (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBAny.h        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBAny.h        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -23,8 +23,7 @@
</span><span class="cx"> * THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><del>-#ifndef IDBAny_h
-#define IDBAny_h
</del><ins>+#pragma once
</ins><span class="cx">
</span><span class="cx"> #if ENABLE(INDEXED_DATABASE)
</span><span class="cx">
</span><span class="lines">@@ -32,8 +31,6 @@
</span><span class="cx"> #include "ScriptWrappable.h"
</span><span class="cx"> #include <bindings/ScriptValue.h>
</span><span class="cx"> #include <wtf/RefCounted.h>
</span><del>-#include <wtf/RefPtr.h>
-#include <wtf/text/WTFString.h>
</del><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="lines">@@ -43,14 +40,48 @@
</span><span class="cx"> class IDBDatabase;
</span><span class="cx"> class IDBFactory;
</span><span class="cx"> class IDBIndex;
</span><del>-class IDBKeyPath;
</del><span class="cx"> class IDBObjectStore;
</span><span class="cx"> class IDBTransaction;
</span><span class="cx">
</span><span class="cx"> class IDBAny : public ScriptWrappable, public RefCounted<IDBAny> {
</span><span class="cx"> public:
</span><del>- virtual ~IDBAny() { }
</del><ins>+ static RefPtr<IDBAny> create(Ref<IDBDatabase>&& database)
+ {
+ return adoptRef(new IDBAny(WTFMove(database)));
+ }
</ins><span class="cx">
</span><ins>+ static Ref<IDBAny> create(Ref<IDBObjectStore>&& objectStore)
+ {
+ return adoptRef(*new IDBAny(WTFMove(objectStore)));
+ }
+
+ static Ref<IDBAny> create(Ref<IDBIndex>&& index)
+ {
+ return adoptRef(*new IDBAny(WTFMove(index)));
+ }
+
+ static RefPtr<IDBAny> create(Ref<IDBCursor>&& cursor)
+ {
+ return adoptRef(new IDBAny(WTFMove(cursor)));
+ }
+
+ static RefPtr<IDBAny> create(const IDBKeyPath& keyPath)
+ {
+ return adoptRef(new IDBAny(keyPath));
+ }
+
+ static RefPtr<IDBAny> create(const Deprecated::ScriptValue& value)
+ {
+ return adoptRef(new IDBAny(value));
+ }
+
+ static RefPtr<IDBAny> createUndefined()
+ {
+ return adoptRef(new IDBAny(IDBAny::Type::Undefined));
+ }
+
+ virtual ~IDBAny();
+
</ins><span class="cx"> enum class Type {
</span><span class="cx"> Undefined = 0,
</span><span class="cx"> Null,
</span><span class="lines">@@ -68,30 +99,42 @@
</span><span class="cx"> KeyPath,
</span><span class="cx"> };
</span><span class="cx">
</span><del>- // FIXME: This is a temporary hack to allow casts in WebInspector code while Modern IDB and Legacy IDB live side-by-side.
- // It should be removed when the legacy implementation is removed as part of https://bugs.webkit.org/show_bug.cgi?id=149117
- virtual bool isLegacy() const { return false; }
</del><ins>+ Type type() const { return m_type; }
+ RefPtr<DOMStringList> domStringList();
+ RefPtr<IDBCursor> idbCursor();
+ RefPtr<IDBCursorWithValue> idbCursorWithValue();
+ RefPtr<IDBDatabase> idbDatabase();
+ RefPtr<IDBFactory> idbFactory();
+ RefPtr<IDBIndex> idbIndex();
+ RefPtr<IDBObjectStore> idbObjectStore();
+ RefPtr<IDBTransaction> idbTransaction();
+ const Deprecated::ScriptValue& scriptValue();
+ int64_t integer();
+ const String& string();
+ const IDBKeyPath& keyPath();
</ins><span class="cx">
</span><del>- virtual Type type() const = 0;
- virtual RefPtr<DOMStringList> domStringList() = 0;
- virtual RefPtr<IDBCursor> idbCursor() = 0;
- virtual RefPtr<IDBCursorWithValue> idbCursorWithValue() = 0;
- virtual RefPtr<IDBDatabase> idbDatabase() = 0;
- virtual RefPtr<IDBFactory> idbFactory() = 0;
- virtual RefPtr<IDBIndex> idbIndex() = 0;
- virtual RefPtr<IDBObjectStore> idbObjectStore() = 0;
- virtual RefPtr<IDBTransaction> idbTransaction() = 0;
- virtual const Deprecated::ScriptValue& scriptValue() = 0;
- virtual int64_t integer() = 0;
- virtual const String& string() = 0;
- virtual const IDBKeyPath& keyPath() = 0;
</del><ins>+private:
+ explicit IDBAny(IDBAny::Type);
+ explicit IDBAny(Ref<IDBDatabase>&&);
+ explicit IDBAny(Ref<IDBObjectStore>&&);
+ explicit IDBAny(Ref<IDBIndex>&&);
+ explicit IDBAny(Ref<IDBCursor>&&);
+ explicit IDBAny(const IDBKeyPath&);
+ explicit IDBAny(const Deprecated::ScriptValue&);
</ins><span class="cx">
</span><del>-protected:
- IDBAny();
</del><ins>+ IDBAny::Type m_type { IDBAny::Type::Undefined };
+ RefPtr<IDBDatabase> m_database;
+ RefPtr<IDBObjectStore> m_objectStore;
+ RefPtr<IDBIndex> m_index;
+ RefPtr<IDBCursor> m_cursor;
+ RefPtr<IDBCursorWithValue> m_cursorWithValue;
+
+ const IDBKeyPath m_idbKeyPath;
+ const Deprecated::ScriptValue m_scriptValue;
+ const String m_string;
+ const int64_t m_integer { 0 };
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span><span class="cx">
</span><span class="cx"> #endif // ENABLE(INDEXED_DATABASE)
</span><del>-
-#endif // IDBAny_h
</del></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBCursorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBCursor.cpp (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBCursor.cpp        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBCursor.cpp        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -28,15 +28,20 @@
</span><span class="cx">
</span><span class="cx"> #if ENABLE(INDEXED_DATABASE)
</span><span class="cx">
</span><ins>+#include "DOMRequestState.h"
</ins><span class="cx"> #include "ExceptionCode.h"
</span><ins>+#include "IDBBindingUtilities.h"
+#include "IDBDatabaseException.h"
+#include "IDBGetResult.h"
+#include "IDBObjectStore.h"
+#include "IDBRequest.h"
+#include "IDBTransaction.h"
+#include "Logging.h"
+#include "ScriptExecutionContext.h"
</ins><span class="cx"> #include <wtf/NeverDestroyed.h>
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-IDBCursor::IDBCursor()
-{
-}
-
</del><span class="cx"> const AtomicString& IDBCursor::directionNext()
</span><span class="cx"> {
</span><span class="cx"> static NeverDestroyed<AtomicString> next("next", AtomicString::ConstructFromLiteral);
</span><span class="lines">@@ -97,6 +102,348 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+Ref<IDBCursor> IDBCursor::create(IDBTransaction& transaction, IDBIndex& index, const IDBCursorInfo& info)
+{
+ return adoptRef(*new IDBCursor(transaction, index, info));
+}
+
+IDBCursor::IDBCursor(IDBTransaction& transaction, IDBObjectStore& objectStore, const IDBCursorInfo& info)
+ : ActiveDOMObject(transaction.scriptExecutionContext())
+ , m_info(info)
+ , m_source(IDBAny::create(objectStore).leakRef())
+ , m_objectStore(&objectStore)
+{
+ suspendIfNeeded();
+}
+
+IDBCursor::IDBCursor(IDBTransaction& transaction, IDBIndex& index, const IDBCursorInfo& info)
+ : ActiveDOMObject(transaction.scriptExecutionContext())
+ , m_info(info)
+ , m_source(IDBAny::create(index).leakRef())
+ , m_index(&index)
+{
+ suspendIfNeeded();
+}
+
+IDBCursor::~IDBCursor()
+{
+}
+
+bool IDBCursor::sourcesDeleted() const
+{
+ if (m_objectStore)
+ return m_objectStore->isDeleted();
+
+ ASSERT(m_index);
+ return m_index->isDeleted() || m_index->modernObjectStore().isDeleted();
+}
+
+IDBObjectStore& IDBCursor::effectiveObjectStore() const
+{
+ if (m_objectStore)
+ return *m_objectStore;
+
+ ASSERT(m_index);
+ return m_index->modernObjectStore();
+}
+
+IDBTransaction& IDBCursor::transaction() const
+{
+ return effectiveObjectStore().modernTransaction();
+}
+
+const String& IDBCursor::direction() const
+{
+ return IDBCursor::directionToString(m_info.cursorDirection());
+}
+
+const Deprecated::ScriptValue& IDBCursor::key() const
+{
+ return m_deprecatedCurrentKey;
+}
+
+const Deprecated::ScriptValue& IDBCursor::primaryKey() const
+{
+ return m_deprecatedCurrentPrimaryKey;
+}
+
+const Deprecated::ScriptValue& IDBCursor::value() const
+{
+ return m_deprecatedCurrentValue;
+}
+
+IDBAny* IDBCursor::source()
+{
+ return &m_source.get();
+}
+
+RefPtr<WebCore::IDBRequest> IDBCursor::update(JSC::ExecState& exec, Deprecated::ScriptValue& value, ExceptionCodeWithMessage& ec)
+{
+ LOG(IndexedDB, "IDBCursor::update");
+
+ if (sourcesDeleted()) {
+ ec.code = IDBDatabaseException::InvalidStateError;
+ ec.message = ASCIILiteral("Failed to execute 'update' on 'IDBCursor': The cursor's source or effective object store has been deleted.");
+ return nullptr;
+ }
+
+ if (!transaction().isActive()) {
+ ec.code = IDBDatabaseException::TransactionInactiveError;
+ ec.message = ASCIILiteral("Failed to execute 'update' on 'IDBCursor': The transaction is inactive or finished.");
+ return nullptr;
+ }
+
+ if (transaction().isReadOnly()) {
+ ec.code = IDBDatabaseException::ReadOnlyError;
+ ec.message = ASCIILiteral("Failed to execute 'update' on 'IDBCursor': The record may not be updated inside a read-only transaction.");
+ return nullptr;
+ }
+
+ if (!m_gotValue) {
+ ec.code = IDBDatabaseException::InvalidStateError;
+ ec.message = ASCIILiteral("Failed to execute 'update' on 'IDBCursor': The cursor is being iterated or has iterated past its end.");
+ return nullptr;
+ }
+
+ if (isKeyCursor()) {
+ ec.code = IDBDatabaseException::InvalidStateError;
+ ec.message = ASCIILiteral("Failed to execute 'update' on 'IDBCursor': The cursor is a key cursor.");
+ return nullptr;
+ }
+
+ auto& objectStore = effectiveObjectStore();
+ auto& keyPath = objectStore.info().keyPath();
+ const bool usesInLineKeys = !keyPath.isNull();
+ if (usesInLineKeys) {
+ RefPtr<IDBKey> keyPathKey = maybeCreateIDBKeyFromScriptValueAndKeyPath(exec, value, keyPath);
+ IDBKeyData keyPathKeyData(keyPathKey.get());
+ if (!keyPathKey || keyPathKeyData != m_currentPrimaryKeyData) {
+ ec.code = IDBDatabaseException::DataError;
+ ec.message = ASCIILiteral("Failed to execute 'update' on 'IDBCursor': The effective object store of this cursor uses in-line keys and evaluating the key path of the value parameter results in a different value than the cursor's effective key.");
+ return nullptr;
+ }
+ }
+
+ auto request = effectiveObjectStore().putForCursorUpdate(exec, value.jsValue(), m_deprecatedCurrentPrimaryKey.jsValue(), ec);
+ if (ec.code)
+ return nullptr;
+
+ ASSERT(request);
+ request->setSource(*this);
+ ++m_outstandingRequestCount;
+
+ return request;
+}
+
+void IDBCursor::advance(unsigned long count, ExceptionCodeWithMessage& ec)
+{
+ LOG(IndexedDB, "IDBCursor::advance");
+
+ if (!m_request) {
+ ec.code = IDBDatabaseException::InvalidStateError;
+ return;
+ }
+
+ if (!count) {
+ ec.code = TypeError;
+ ec.message = ASCIILiteral("Failed to execute 'advance' on 'IDBCursor': A count argument with value 0 (zero) was supplied, must be greater than 0.");
+ return;
+ }
+
+ if (sourcesDeleted()) {
+ ec.code = IDBDatabaseException::InvalidStateError;
+ ec.message = ASCIILiteral("Failed to execute 'advance' on 'IDBCursor': The cursor's source or effective object store has been deleted.");
+ return;
+ }
+
+ if (!transaction().isActive()) {
+ ec.code = IDBDatabaseException::TransactionInactiveError;
+ ec.message = ASCIILiteral("Failed to execute 'advance' on 'IDBCursor': The transaction is inactive or finished.");
+ return;
+ }
+
+ if (!m_gotValue) {
+ ec.code = IDBDatabaseException::InvalidStateError;
+ ec.message = ASCIILiteral("Failed to execute 'advance' on 'IDBCursor': The cursor is being iterated or has iterated past its end.");
+ return;
+ }
+
+ m_gotValue = false;
+
+ uncheckedIterateCursor(IDBKeyData(), count);
+}
+
+void IDBCursor::continueFunction(ScriptExecutionContext&, ExceptionCodeWithMessage& ec)
+{
+ continueFunction(IDBKeyData(), ec);
+}
+
+void IDBCursor::continueFunction(ScriptExecutionContext& context, const Deprecated::ScriptValue& keyValue, ExceptionCodeWithMessage& ec)
+{
+ DOMRequestState requestState(&context);
+ RefPtr<IDBKey> key;
+ if (!keyValue.jsValue().isUndefined())
+ key = scriptValueToIDBKey(&requestState, keyValue);
+
+ continueFunction(key.get(), ec);
+}
+
+void IDBCursor::continueFunction(const IDBKeyData& key, ExceptionCodeWithMessage& ec)
+{
+ LOG(IndexedDB, "IDBCursor::continueFunction (to key %s)", key.loggingString().utf8().data());
+
+ if (!m_request) {
+ ec.code = IDBDatabaseException::InvalidStateError;
+ return;
+ }
+
+ if (sourcesDeleted()) {
+ ec.code = IDBDatabaseException::InvalidStateError;
+ ec.message = ASCIILiteral("Failed to execute 'continue' on 'IDBCursor': The cursor's source or effective object store has been deleted.");
+ return;
+ }
+
+ if (!transaction().isActive()) {
+ ec.code = IDBDatabaseException::TransactionInactiveError;
+ ec.message = ASCIILiteral("Failed to execute 'continue' on 'IDBCursor': The transaction is inactive or finished.");
+ return;
+ }
+
+ if (!m_gotValue) {
+ ec.code = IDBDatabaseException::InvalidStateError;
+ ec.message = ASCIILiteral("Failed to execute 'continue' on 'IDBCursor': The cursor is being iterated or has iterated past its end.");
+ return;
+ }
+
+ if (!key.isNull() && !key.isValid()) {
+ ec.code = IDBDatabaseException::DataError;
+ ec.message = ASCIILiteral("Failed to execute 'continue' on 'IDBCursor': The parameter is not a valid key.");
+ return;
+ }
+
+ if (m_info.isDirectionForward()) {
+ if (!key.isNull() && key.compare(m_currentKeyData) <= 0) {
+ ec.code = IDBDatabaseException::DataError;
+ ec.message = ASCIILiteral("Failed to execute 'continue' on 'IDBCursor': The parameter is less than or equal to this cursor's position.");
+ return;
+ }
+ } else if (!key.isNull() && key.compare(m_currentKeyData) >= 0) {
+ ec.code = IDBDatabaseException::DataError;
+ ec.message = ASCIILiteral("Failed to execute 'continue' on 'IDBCursor': The parameter is greater than or equal to this cursor's position.");
+ return;
+ }
+
+ m_gotValue = false;
+
+ uncheckedIterateCursor(key, 0);
+}
+
+void IDBCursor::uncheckedIterateCursor(const IDBKeyData& key, unsigned long count)
+{
+ ++m_outstandingRequestCount;
+
+ m_request->willIterateCursor(*this);
+ transaction().iterateCursor(*this, key, count);
+}
+
+RefPtr<WebCore::IDBRequest> IDBCursor::deleteFunction(ScriptExecutionContext& context, ExceptionCodeWithMessage& ec)
+{
+ LOG(IndexedDB, "IDBCursor::deleteFunction");
+
+ if (sourcesDeleted()) {
+ ec.code = IDBDatabaseException::InvalidStateError;
+ ec.message = ASCIILiteral("Failed to execute 'delete' on 'IDBCursor': The cursor's source or effective object store has been deleted.");
+ return nullptr;
+ }
+
+ if (!transaction().isActive()) {
+ ec.code = IDBDatabaseException::TransactionInactiveError;
+ ec.message = ASCIILiteral("Failed to execute 'delete' on 'IDBCursor': The transaction is inactive or finished.");
+ return nullptr;
+ }
+
+ if (transaction().isReadOnly()) {
+ ec.code = IDBDatabaseException::ReadOnlyError;
+ ec.message = ASCIILiteral("Failed to execute 'delete' on 'IDBCursor': The record may not be deleted inside a read-only transaction.");
+ return nullptr;
+ }
+
+ if (!m_gotValue) {
+ ec.code = IDBDatabaseException::InvalidStateError;
+ ec.message = ASCIILiteral("Failed to execute 'delete' on 'IDBCursor': The cursor is being iterated or has iterated past its end.");
+ return nullptr;
+ }
+
+ if (isKeyCursor()) {
+ ec.code = IDBDatabaseException::InvalidStateError;
+ ec.message = ASCIILiteral("Failed to execute 'delete' on 'IDBCursor': The cursor is a key cursor.");
+ return nullptr;
+ }
+
+ auto request = effectiveObjectStore().modernDelete(context, m_deprecatedCurrentPrimaryKey.jsValue(), ec);
+ if (ec.code)
+ return nullptr;
+
+ ASSERT(request);
+ request->setSource(*this);
+ ++m_outstandingRequestCount;
+
+ return request;
+}
+
+void IDBCursor::setGetResult(IDBRequest& request, const IDBGetResult& getResult)
+{
+ LOG(IndexedDB, "IDBCursor::setGetResult - current key %s", getResult.keyData().loggingString().substring(0, 100).utf8().data());
+
+ auto* context = request.scriptExecutionContext();
+ if (!context)
+ return;
+
+ if (!getResult.isDefined()) {
+ m_deprecatedCurrentKey = { };
+ m_currentKeyData = { };
+ m_deprecatedCurrentPrimaryKey = { };
+ m_currentPrimaryKeyData = { };
+ m_deprecatedCurrentValue = { };
+
+ m_gotValue = false;
+ return;
+ }
+
+ m_deprecatedCurrentKey = idbKeyDataToScriptValue(context, getResult.keyData());
+ m_currentKeyData = getResult.keyData();
+ m_deprecatedCurrentPrimaryKey = idbKeyDataToScriptValue(context, getResult.primaryKeyData());
+ m_currentPrimaryKeyData = getResult.primaryKeyData();
+
+ if (isKeyCursor())
+ m_deprecatedCurrentValue = { };
+ else
+ m_deprecatedCurrentValue = deserializeIDBValueData(*context, getResult.valueBuffer());
+
+ m_gotValue = true;
+}
+
+const char* IDBCursor::activeDOMObjectName() const
+{
+ return "IDBCursor";
+}
+
+bool IDBCursor::canSuspendForDocumentSuspension() const
+{
+ return false;
+}
+
+bool IDBCursor::hasPendingActivity() const
+{
+ return m_outstandingRequestCount;
+}
+
+void IDBCursor::decrementOutstandingRequestCount()
+{
+ ASSERT(m_outstandingRequestCount);
+ --m_outstandingRequestCount;
+}
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx">
</span><span class="cx"> #endif // ENABLE(INDEXED_DATABASE)
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBCursorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBCursor.h (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBCursor.h        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBCursor.h        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -23,31 +23,27 @@
</span><span class="cx"> * THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><del>-#ifndef IDBCursor_h
-#define IDBCursor_h
</del><ins>+#pragma once
</ins><span class="cx">
</span><span class="cx"> #if ENABLE(INDEXED_DATABASE)
</span><span class="cx">
</span><del>-#include "IDBKey.h"
-#include "IDBTransaction.h"
-#include "IndexedDB.h"
-#include "ScriptWrappable.h"
-#include <bindings/ScriptValue.h>
-#include <wtf/RefCounted.h>
-#include <wtf/RefPtr.h>
</del><ins>+#include "ActiveDOMObject.h"
+#include "ExceptionCode.h"
+#include "IDBAny.h"
+#include "IDBCursorInfo.h"
</ins><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-class DOMRequestState;
</del><span class="cx"> class IDBAny;
</span><del>-class IDBCallbacks;
-class IDBRequest;
-class ScriptExecutionContext;
</del><ins>+class IDBGetResult;
+class IDBIndex;
+class IDBObjectStore;
+class IDBTransaction;
</ins><span class="cx">
</span><del>-struct ExceptionCodeWithMessage;
</del><ins>+class IDBCursor : public ScriptWrappable, public RefCounted<IDBCursor>, public ActiveDOMObject {
+public:
+ static Ref<IDBCursor> create(IDBTransaction&, IDBIndex&, const IDBCursorInfo&);
</ins><span class="cx">
</span><del>-class IDBCursor : public ScriptWrappable, public RefCounted<IDBCursor> {
-public:
</del><span class="cx"> static const AtomicString& directionNext();
</span><span class="cx"> static const AtomicString& directionNextUnique();
</span><span class="cx"> static const AtomicString& directionPrev();
</span><span class="lines">@@ -55,39 +51,73 @@
</span><span class="cx">
</span><span class="cx"> static IndexedDB::CursorDirection stringToDirection(const String& modeString, ExceptionCode&);
</span><span class="cx"> static const AtomicString& directionToString(IndexedDB::CursorDirection mode);
</span><ins>+
+ virtual ~IDBCursor();
</ins><span class="cx">
</span><del>- virtual ~IDBCursor() { }
-
</del><span class="cx"> // Implement the IDL
</span><del>- virtual const String& direction() const = 0;
- virtual const Deprecated::ScriptValue& key() const = 0;
- virtual const Deprecated::ScriptValue& primaryKey() const = 0;
- virtual const Deprecated::ScriptValue& value() const = 0;
- virtual IDBAny* source() = 0;
</del><ins>+ const String& direction() const;
+ const Deprecated::ScriptValue& key() const;
+ const Deprecated::ScriptValue& primaryKey() const;
+ const Deprecated::ScriptValue& value() const;
+ IDBAny* source();
</ins><span class="cx">
</span><del>- virtual RefPtr<IDBRequest> update(JSC::ExecState&, Deprecated::ScriptValue&, ExceptionCodeWithMessage&) = 0;
- virtual void advance(unsigned long, ExceptionCodeWithMessage&) = 0;
</del><ins>+ RefPtr<WebCore::IDBRequest> update(JSC::ExecState&, Deprecated::ScriptValue&, ExceptionCodeWithMessage&);
+ void advance(unsigned long, ExceptionCodeWithMessage&);
+ void continueFunction(ScriptExecutionContext&, ExceptionCodeWithMessage&);
+ void continueFunction(ScriptExecutionContext&, const Deprecated::ScriptValue& key, ExceptionCodeWithMessage&);
+ RefPtr<WebCore::IDBRequest> deleteFunction(ScriptExecutionContext&, ExceptionCodeWithMessage&);
</ins><span class="cx">
</span><del>- // FIXME: We should not need that method (taking a ScriptExecutionContext pointer and not a reference)
- // but InspectorIndexedDBAgent wants to call it with a null context.
- virtual void continueFunction(ScriptExecutionContext*, ExceptionCodeWithMessage&) = 0;
- // FIXME: Try to modify the code generator so this overload is unneeded.
- void continueFunction(ScriptExecutionContext& context, ExceptionCodeWithMessage& ec) { continueFunction(&context, ec); }
- virtual void continueFunction(ScriptExecutionContext&, const Deprecated::ScriptValue& key, ExceptionCodeWithMessage&) = 0;
- virtual RefPtr<IDBRequest> deleteFunction(ScriptExecutionContext&, ExceptionCodeWithMessage&) = 0;
</del><ins>+ void continueFunction(const IDBKeyData&, ExceptionCodeWithMessage&);
</ins><span class="cx">
</span><del>- virtual bool isKeyCursor() const = 0;
</del><ins>+ const IDBCursorInfo& info() const { return m_info; }
</ins><span class="cx">
</span><del>- virtual bool isModernCursor() const { return false; }
</del><ins>+ void setRequest(IDBRequest& request) { m_request = &request; }
+ void clearRequest() { m_request = nullptr; }
+ IDBRequest* request() { return m_request; }
</ins><span class="cx">
</span><del>- virtual bool hasPendingActivity() const { return false; }
</del><ins>+ void setGetResult(IDBRequest&, const IDBGetResult&);
</ins><span class="cx">
</span><ins>+ virtual bool isKeyCursor() const { return true; }
+
+ void decrementOutstandingRequestCount();
+
+ // ActiveDOMObject.
+ const char* activeDOMObjectName() const;
+ bool canSuspendForDocumentSuspension() const;
+ bool hasPendingActivity() const;
+
</ins><span class="cx"> protected:
</span><del>- IDBCursor();
</del><ins>+ IDBCursor(IDBTransaction&, IDBObjectStore&, const IDBCursorInfo&);
+ IDBCursor(IDBTransaction&, IDBIndex&, const IDBCursorInfo&);
+
+private:
+ // Cursors are created with an outstanding iteration request.
+ unsigned m_outstandingRequestCount { 1 };
+
+ IDBCursorInfo m_info;
+ Ref<IDBAny> m_source;
+ IDBObjectStore* m_objectStore { nullptr };
+ IDBIndex* m_index { nullptr };
+ IDBRequest* m_request;
+
+ bool sourcesDeleted() const;
+ IDBObjectStore& effectiveObjectStore() const;
+ IDBTransaction& transaction() const;
+
+ void uncheckedIterateCursor(const IDBKeyData&, unsigned long count);
+
+ bool m_gotValue { false };
+
+ IDBKeyData m_currentKeyData;
+ IDBKeyData m_currentPrimaryKeyData;
+
+ // FIXME: When ditching Legacy IDB and combining this implementation with the abstract IDBCursor,
+ // these Deprecated::ScriptValue members should be JSValues instead.
+ Deprecated::ScriptValue m_deprecatedCurrentKey;
+ Deprecated::ScriptValue m_deprecatedCurrentPrimaryKey;
+ Deprecated::ScriptValue m_deprecatedCurrentValue;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span><span class="cx">
</span><del>-#endif
-
-#endif // IDBCursor_h
</del><ins>+#endif // ENABLE(INDEXED_DATABASE)
</ins></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBCursorWithValuecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBCursorWithValue.cpp (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBCursorWithValue.cpp        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBCursorWithValue.cpp        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -30,10 +30,30 @@
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-IDBCursorWithValue::IDBCursorWithValue()
</del><ins>+Ref<IDBCursorWithValue> IDBCursorWithValue::create(IDBTransaction& transaction, IDBObjectStore& objectStore, const IDBCursorInfo& info)
</ins><span class="cx"> {
</span><ins>+ return adoptRef(*new IDBCursorWithValue(transaction, objectStore, info));
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+Ref<IDBCursorWithValue> IDBCursorWithValue::create(IDBTransaction& transaction, IDBIndex& index, const IDBCursorInfo& info)
+{
+ return adoptRef(*new IDBCursorWithValue(transaction, index, info));
+}
+
+IDBCursorWithValue::IDBCursorWithValue(IDBTransaction& transaction, IDBObjectStore& objectStore, const IDBCursorInfo& info)
+ : IDBCursor(transaction, objectStore, info)
+{
+}
+
+IDBCursorWithValue::IDBCursorWithValue(IDBTransaction& transaction, IDBIndex& index, const IDBCursorInfo& info)
+ : IDBCursor(transaction, index, info)
+{
+}
+
+IDBCursorWithValue::~IDBCursorWithValue()
+{
+}
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx">
</span><span class="cx"> #endif // ENABLE(INDEXED_DATABASE)
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBCursorWithValueh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBCursorWithValue.h (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBCursorWithValue.h        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBCursorWithValue.h        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -23,8 +23,7 @@
</span><span class="cx"> * THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><del>-#ifndef IDBCursorWithValue_h
-#define IDBCursorWithValue_h
</del><ins>+#pragma once
</ins><span class="cx">
</span><span class="cx"> #if ENABLE(INDEXED_DATABASE)
</span><span class="cx">
</span><span class="lines">@@ -34,14 +33,18 @@
</span><span class="cx">
</span><span class="cx"> class IDBCursorWithValue : public IDBCursor {
</span><span class="cx"> public:
</span><del>- virtual ~IDBCursorWithValue() { }
</del><ins>+ static Ref<IDBCursorWithValue> create(IDBTransaction&, IDBObjectStore&, const IDBCursorInfo&);
+ static Ref<IDBCursorWithValue> create(IDBTransaction&, IDBIndex&, const IDBCursorInfo&);
</ins><span class="cx">
</span><del>-protected:
- IDBCursorWithValue();
</del><ins>+ virtual ~IDBCursorWithValue();
+
+ bool isKeyCursor() const final { return false; }
+
+private:
+ IDBCursorWithValue(IDBTransaction&, IDBObjectStore&, const IDBCursorInfo&);
+ IDBCursorWithValue(IDBTransaction&, IDBIndex&, const IDBCursorInfo&);
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span><span class="cx">
</span><del>-#endif
-
-#endif // LegacyCursorWithValue_h
</del><ins>+#endif // ENABLE(INDEXED_DATABASE)
</ins></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBDatabasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -28,13 +28,403 @@
</span><span class="cx">
</span><span class="cx"> #if ENABLE(INDEXED_DATABASE)
</span><span class="cx">
</span><ins>+#include "DOMStringList.h"
+#include "EventQueue.h"
+#include "IDBConnectionToServer.h"
+#include "IDBDatabaseException.h"
+#include "IDBOpenDBRequest.h"
+#include "IDBResultData.h"
+#include "IDBTransaction.h"
+#include "IDBVersionChangeEvent.h"
+#include "Logging.h"
+#include "ScriptExecutionContext.h"
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-IDBDatabase::IDBDatabase(ScriptExecutionContext* context)
- : ActiveDOMObject(context)
</del><ins>+Ref<IDBDatabase> IDBDatabase::create(ScriptExecutionContext& context, IDBClient::IDBConnectionToServer& connection, const IDBResultData& resultData)
</ins><span class="cx"> {
</span><ins>+ return adoptRef(*new IDBDatabase(context, connection, resultData));
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+IDBDatabase::IDBDatabase(ScriptExecutionContext& context, IDBClient::IDBConnectionToServer& connection, const IDBResultData& resultData)
+ : WebCore::ActiveDOMObject(&context)
+ , m_serverConnection(connection)
+ , m_info(resultData.databaseInfo())
+ , m_databaseConnectionIdentifier(resultData.databaseConnectionIdentifier())
+{
+ LOG(IndexedDB, "IDBDatabase::IDBDatabase - Creating database %s with version %" PRIu64 " connection %" PRIu64, m_info.name().utf8().data(), m_info.version(), m_databaseConnectionIdentifier);
+ suspendIfNeeded();
+ relaxAdoptionRequirement();
+ m_serverConnection->registerDatabaseConnection(*this);
+}
+
+IDBDatabase::~IDBDatabase()
+{
+ m_serverConnection->unregisterDatabaseConnection(*this);
+}
+
+bool IDBDatabase::hasPendingActivity() const
+{
+ return !m_closedInServer;
+}
+
+const String IDBDatabase::name() const
+{
+ return m_info.name();
+}
+
+uint64_t IDBDatabase::version() const
+{
+ return m_info.version();
+}
+
+RefPtr<DOMStringList> IDBDatabase::objectStoreNames() const
+{
+ RefPtr<DOMStringList> objectStoreNames = DOMStringList::create();
+ for (auto& name : m_info.objectStoreNames())
+ objectStoreNames->append(name);
+ objectStoreNames->sort();
+ return objectStoreNames;
+}
+
+RefPtr<WebCore::IDBObjectStore> IDBDatabase::createObjectStore(const String&, const Dictionary&, ExceptionCodeWithMessage&)
+{
+ ASSERT_NOT_REACHED();
+ return nullptr;
+}
+
+RefPtr<WebCore::IDBObjectStore> IDBDatabase::createObjectStore(const String& name, const IDBKeyPath& keyPath, bool autoIncrement, ExceptionCodeWithMessage& ec)
+{
+ LOG(IndexedDB, "IDBDatabase::createObjectStore");
+
+ ASSERT(!m_versionChangeTransaction || m_versionChangeTransaction->isVersionChange());
+
+ if (!m_versionChangeTransaction) {
+ ec.code = IDBDatabaseException::InvalidStateError;
+ ec.message = ASCIILiteral("Failed to execute 'createObjectStore' on 'IDBDatabase': The database is not running a version change transaction.");
+ return nullptr;
+ }
+
+ if (!m_versionChangeTransaction->isActive()) {
+ ec.code = IDBDatabaseException::TransactionInactiveError;
+ return nullptr;
+ }
+
+ if (m_info.hasObjectStore(name)) {
+ ec.code = IDBDatabaseException::ConstraintError;
+ ec.message = ASCIILiteral("Failed to execute 'createObjectStore' on 'IDBDatabase': An object store with the specified name already exists.");
+ return nullptr;
+ }
+
+ if (!keyPath.isNull() && !keyPath.isValid()) {
+ ec.code = IDBDatabaseException::SyntaxError;
+ ec.message = ASCIILiteral("Failed to execute 'createObjectStore' on 'IDBDatabase': The keyPath option is not a valid key path.");
+ return nullptr;
+ }
+
+ if (autoIncrement && !keyPath.isNull()) {
+ if ((keyPath.type() == IndexedDB::KeyPathType::String && keyPath.string().isEmpty()) || keyPath.type() == IndexedDB::KeyPathType::Array) {
+ ec.code = IDBDatabaseException::InvalidAccessError;
+ ec.message = ASCIILiteral("Failed to execute 'createObjectStore' on 'IDBDatabase': The autoIncrement option was set but the keyPath option was empty or an array.");
+ return nullptr;
+ }
+ }
+
+ // Install the new ObjectStore into the connection's metadata.
+ IDBObjectStoreInfo info = m_info.createNewObjectStore(name, keyPath, autoIncrement);
+
+ // Create the actual IDBObjectStore from the transaction, which also schedules the operation server side.
+ Ref<IDBObjectStore> objectStore = m_versionChangeTransaction->createObjectStore(info);
+ return adoptRef(&objectStore.leakRef());
+}
+
+RefPtr<WebCore::IDBTransaction> IDBDatabase::transaction(ScriptExecutionContext*, const Vector<String>& objectStores, const String& modeString, ExceptionCodeWithMessage& ec)
+{
+ LOG(IndexedDB, "IDBDatabase::transaction");
+
+ if (m_closePending) {
+ ec.code = IDBDatabaseException::InvalidStateError;
+ ec.message = ASCIILiteral("Failed to execute 'transaction' on 'IDBDatabase': The database connection is closing.");
+ return nullptr;
+ }
+
+ if (objectStores.isEmpty()) {
+ ec.code = IDBDatabaseException::InvalidAccessError;
+ ec.message = ASCIILiteral("Failed to execute 'transaction' on 'IDBDatabase': The storeNames parameter was empty.");
+ return nullptr;
+ }
+
+ IndexedDB::TransactionMode mode = IDBTransaction::stringToMode(modeString, ec.code);
+ if (ec.code) {
+ ec.message = makeString(ASCIILiteral("Failed to execute 'transaction' on 'IDBDatabase': The mode provided ('"), modeString, ASCIILiteral("') is not one of 'readonly' or 'readwrite'."));
+ return nullptr;
+ }
+
+ if (mode != IndexedDB::TransactionMode::ReadOnly && mode != IndexedDB::TransactionMode::ReadWrite) {
+ ec.code = TypeError;
+ return nullptr;
+ }
+
+ if (m_versionChangeTransaction && !m_versionChangeTransaction->isFinishedOrFinishing()) {
+ ec.code = IDBDatabaseException::InvalidStateError;
+ ec.message = ASCIILiteral("Failed to execute 'transaction' on 'IDBDatabase': A version change transaction is running.");
+ return nullptr;
+ }
+
+ for (auto& objectStoreName : objectStores) {
+ if (m_info.hasObjectStore(objectStoreName))
+ continue;
+ ec.code = IDBDatabaseException::NotFoundError;
+ ec.message = ASCIILiteral("Failed to execute 'transaction' on 'IDBDatabase': One of the specified object stores was not found.");
+ return nullptr;
+ }
+
+ auto info = IDBTransactionInfo::clientTransaction(m_serverConnection.get(), objectStores, mode);
+ auto transaction = IDBTransaction::create(*this, info);
+
+ LOG(IndexedDB, "IDBDatabase::transaction - Added active transaction %s", info.identifier().loggingString().utf8().data());
+
+ m_activeTransactions.set(info.identifier(), &transaction.get());
+
+ return adoptRef(&transaction.leakRef());
+}
+
+RefPtr<WebCore::IDBTransaction> IDBDatabase::transaction(ScriptExecutionContext* context, const String& objectStore, const String& mode, ExceptionCodeWithMessage& ec)
+{
+ Vector<String> objectStores(1);
+ objectStores[0] = objectStore;
+ return transaction(context, objectStores, mode, ec);
+}
+
+void IDBDatabase::deleteObjectStore(const String& objectStoreName, ExceptionCodeWithMessage& ec)
+{
+ LOG(IndexedDB, "IDBDatabase::deleteObjectStore");
+
+ if (!m_versionChangeTransaction) {
+ ec.code = IDBDatabaseException::InvalidStateError;
+ ec.message = ASCIILiteral("Failed to execute 'deleteObjectStore' on 'IDBDatabase': The database is not running a version change transaction.");
+ return;
+ }
+
+ if (!m_versionChangeTransaction->isActive()) {
+ ec.code = IDBDatabaseException::TransactionInactiveError;
+ return;
+ }
+
+ if (!m_info.hasObjectStore(objectStoreName)) {
+ ec.code = IDBDatabaseException::NotFoundError;
+ ec.message = ASCIILiteral("Failed to execute 'deleteObjectStore' on 'IDBDatabase': The specified object store was not found.");
+ return;
+ }
+
+ m_info.deleteObjectStore(objectStoreName);
+ m_versionChangeTransaction->deleteObjectStore(objectStoreName);
+}
+
+void IDBDatabase::close()
+{
+ LOG(IndexedDB, "IDBDatabase::close - %" PRIu64, m_databaseConnectionIdentifier);
+
+ m_closePending = true;
+ maybeCloseInServer();
+}
+
+void IDBDatabase::maybeCloseInServer()
+{
+ LOG(IndexedDB, "IDBDatabase::maybeCloseInServer - %" PRIu64, m_databaseConnectionIdentifier);
+
+ if (m_closedInServer)
+ return;
+
+ // 3.3.9 Database closing steps
+ // Wait for all transactions created using this connection to complete.
+ // Once they are complete, this connection is closed.
+ if (!m_activeTransactions.isEmpty())
+ return;
+
+ m_closedInServer = true;
+ m_serverConnection->databaseConnectionClosed(*this);
+}
+
+const char* IDBDatabase::activeDOMObjectName() const
+{
+ return "IDBDatabase";
+}
+
+bool IDBDatabase::canSuspendForDocumentSuspension() const
+{
+ // FIXME: This value will sometimes be false when database operations are actually in progress.
+ // Such database operations do not yet exist.
+ return true;
+}
+
+void IDBDatabase::stop()
+{
+ LOG(IndexedDB, "IDBDatabase::stop - %" PRIu64, m_databaseConnectionIdentifier);
+
+ Vector<IDBResourceIdentifier> transactionIdentifiers;
+ transactionIdentifiers.reserveInitialCapacity(m_activeTransactions.size());
+
+ for (auto& id : m_activeTransactions.keys())
+ transactionIdentifiers.uncheckedAppend(id);
+
+ for (auto& id : transactionIdentifiers) {
+ IDBTransaction* transaction = m_activeTransactions.get(id);
+ if (transaction)
+ transaction->stop();
+ }
+
+ close();
+}
+
+Ref<IDBTransaction> IDBDatabase::startVersionChangeTransaction(const IDBTransactionInfo& info, IDBOpenDBRequest& request)
+{
+ LOG(IndexedDB, "IDBDatabase::startVersionChangeTransaction %s", info.identifier().loggingString().utf8().data());
+
+ ASSERT(!m_versionChangeTransaction);
+ ASSERT(info.mode() == IndexedDB::TransactionMode::VersionChange);
+ ASSERT(!m_closePending);
+ ASSERT(scriptExecutionContext());
+
+ Ref<IDBTransaction> transaction = IDBTransaction::create(*this, info, request);
+ m_versionChangeTransaction = &transaction.get();
+
+ m_activeTransactions.set(transaction->info().identifier(), &transaction.get());
+
+ return transaction;
+}
+
+void IDBDatabase::didStartTransaction(IDBTransaction& transaction)
+{
+ LOG(IndexedDB, "IDBDatabase::didStartTransaction %s", transaction.info().identifier().loggingString().utf8().data());
+ ASSERT(!m_versionChangeTransaction);
+
+ // It is possible for the client to have aborted a transaction before the server replies back that it has started.
+ if (m_abortingTransactions.contains(transaction.info().identifier()))
+ return;
+
+ m_activeTransactions.set(transaction.info().identifier(), &transaction);
+}
+
+void IDBDatabase::willCommitTransaction(IDBTransaction& transaction)
+{
+ LOG(IndexedDB, "IDBDatabase::willCommitTransaction %s", transaction.info().identifier().loggingString().utf8().data());
+
+ auto refTransaction = m_activeTransactions.take(transaction.info().identifier());
+ ASSERT(refTransaction);
+ m_committingTransactions.set(transaction.info().identifier(), WTFMove(refTransaction));
+}
+
+void IDBDatabase::didCommitTransaction(IDBTransaction& transaction)
+{
+ LOG(IndexedDB, "IDBDatabase::didCommitTransaction %s", transaction.info().identifier().loggingString().utf8().data());
+
+ if (m_versionChangeTransaction == &transaction)
+ m_info.setVersion(transaction.info().newVersion());
+
+ didCommitOrAbortTransaction(transaction);
+}
+
+void IDBDatabase::willAbortTransaction(IDBTransaction& transaction)
+{
+ LOG(IndexedDB, "IDBDatabase::willAbortTransaction %s", transaction.info().identifier().loggingString().utf8().data());
+
+ auto refTransaction = m_activeTransactions.take(transaction.info().identifier());
+ if (!refTransaction)
+ refTransaction = m_committingTransactions.take(transaction.info().identifier());
+
+ ASSERT(refTransaction);
+ m_abortingTransactions.set(transaction.info().identifier(), WTFMove(refTransaction));
+
+ if (transaction.isVersionChange()) {
+ ASSERT(transaction.originalDatabaseInfo());
+ m_info = *transaction.originalDatabaseInfo();
+ m_closePending = true;
+ }
+}
+
+void IDBDatabase::didAbortTransaction(IDBTransaction& transaction)
+{
+ LOG(IndexedDB, "IDBDatabase::didAbortTransaction %s", transaction.info().identifier().loggingString().utf8().data());
+
+ if (transaction.isVersionChange()) {
+ ASSERT(transaction.originalDatabaseInfo());
+ ASSERT(m_info.version() == transaction.originalDatabaseInfo()->version());
+ m_closePending = true;
+ maybeCloseInServer();
+ }
+
+ didCommitOrAbortTransaction(transaction);
+}
+
+void IDBDatabase::didCommitOrAbortTransaction(IDBTransaction& transaction)
+{
+ LOG(IndexedDB, "IDBDatabase::didCommitOrAbortTransaction %s", transaction.info().identifier().loggingString().utf8().data());
+
+ if (m_versionChangeTransaction == &transaction)
+ m_versionChangeTransaction = nullptr;
+
+#ifndef NDBEBUG
+ unsigned count = 0;
+ if (m_activeTransactions.contains(transaction.info().identifier()))
+ ++count;
+ if (m_committingTransactions.contains(transaction.info().identifier()))
+ ++count;
+ if (m_abortingTransactions.contains(transaction.info().identifier()))
+ ++count;
+
+ ASSERT(count == 1);
+#endif
+
+ m_activeTransactions.remove(transaction.info().identifier());
+ m_committingTransactions.remove(transaction.info().identifier());
+ m_abortingTransactions.remove(transaction.info().identifier());
+
+ if (m_closePending)
+ maybeCloseInServer();
+}
+
+void IDBDatabase::fireVersionChangeEvent(const IDBResourceIdentifier& requestIdentifier, uint64_t requestedVersion)
+{
+ uint64_t currentVersion = m_info.version();
+ LOG(IndexedDB, "IDBDatabase::fireVersionChangeEvent - current version %" PRIu64 ", requested version %" PRIu64 ", connection %" PRIu64, currentVersion, requestedVersion, m_databaseConnectionIdentifier);
+
+ if (!scriptExecutionContext() || m_closePending) {
+ serverConnection().didFireVersionChangeEvent(m_databaseConnectionIdentifier, requestIdentifier);
+ return;
+ }
+
+ Ref<Event> event = IDBVersionChangeEvent::create(requestIdentifier, currentVersion, requestedVersion, eventNames().versionchangeEvent);
+ event->setTarget(this);
+ scriptExecutionContext()->eventQueue().enqueueEvent(WTFMove(event));
+}
+
+bool IDBDatabase::dispatchEvent(Event& event)
+{
+ LOG(IndexedDB, "IDBDatabase::dispatchEvent (%" PRIu64 ")", m_databaseConnectionIdentifier);
+
+ bool result = EventTargetWithInlineData::dispatchEvent(event);
+
+ if (event.isVersionChangeEvent() && event.type() == eventNames().versionchangeEvent)
+ serverConnection().didFireVersionChangeEvent(m_databaseConnectionIdentifier, downcast<IDBVersionChangeEvent>(event).requestIdentifier());
+
+ return result;
+}
+
+void IDBDatabase::didCreateIndexInfo(const IDBIndexInfo& info)
+{
+ auto* objectStore = m_info.infoForExistingObjectStore(info.objectStoreIdentifier());
+ ASSERT(objectStore);
+ objectStore->addExistingIndex(info);
+}
+
+void IDBDatabase::didDeleteIndexInfo(const IDBIndexInfo& info)
+{
+ auto* objectStore = m_info.infoForExistingObjectStore(info.objectStoreIdentifier());
+ ASSERT(objectStore);
+ objectStore->deleteIndex(info.name());
+}
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx">
</span><span class="cx"> #endif // ENABLE(INDEXED_DATABASE)
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBDatabaseh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.h (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.h        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.h        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -23,54 +23,101 @@
</span><span class="cx"> * THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><del>-#ifndef IDBDatabase_h
-#define IDBDatabase_h
</del><ins>+#pragma once
</ins><span class="cx">
</span><del>-#include "ActiveDOMObject.h"
-#include "DOMStringList.h"
</del><ins>+#if ENABLE(INDEXED_DATABASE)
+
</ins><span class="cx"> #include "Dictionary.h"
</span><del>-#include "Event.h"
</del><span class="cx"> #include "EventTarget.h"
</span><del>-#include "IDBObjectStore.h"
-#include "IDBTransaction.h"
-#include "IndexedDB.h"
-#include "ScriptWrappable.h"
-#include <wtf/RefCounted.h>
-#include <wtf/RefPtr.h>
</del><ins>+#include "ExceptionCode.h"
+#include "IDBConnectionToServer.h"
+#include "IDBDatabase.h"
+#include "IDBDatabaseInfo.h"
</ins><span class="cx">
</span><del>-#if ENABLE(INDEXED_DATABASE)
-
</del><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-class ScriptExecutionContext;
</del><ins>+class DOMStringList;
+class IDBObjectStore;
+class IDBOpenDBRequest;
+class IDBResultData;
+class IDBTransaction;
+class IDBTransactionInfo;
</ins><span class="cx">
</span><del>-struct ExceptionCodeWithMessage;
-
</del><span class="cx"> class IDBDatabase : public RefCounted<IDBDatabase>, public EventTargetWithInlineData, public ActiveDOMObject {
</span><span class="cx"> public:
</span><del>- virtual ~IDBDatabase() { }
</del><ins>+ static Ref<IDBDatabase> create(ScriptExecutionContext&, IDBClient::IDBConnectionToServer&, const IDBResultData&);
</ins><span class="cx">
</span><del>- // Implement the IDL
- virtual const String name() const = 0;
- virtual uint64_t version() const = 0;
- virtual RefPtr<DOMStringList> objectStoreNames() const = 0;
</del><ins>+ virtual ~IDBDatabase();
</ins><span class="cx">
</span><del>- virtual RefPtr<IDBObjectStore> createObjectStore(const String& name, const Dictionary&, ExceptionCodeWithMessage&) = 0;
- virtual RefPtr<IDBObjectStore> createObjectStore(const String& name, const IDBKeyPath&, bool autoIncrement, ExceptionCodeWithMessage&) = 0;
- virtual RefPtr<IDBTransaction> transaction(ScriptExecutionContext*, const Vector<String>&, const String& mode, ExceptionCodeWithMessage&) = 0;
- virtual RefPtr<IDBTransaction> transaction(ScriptExecutionContext*, const String&, const String& mode, ExceptionCodeWithMessage&) = 0;
- virtual void deleteObjectStore(const String& name, ExceptionCodeWithMessage&) = 0;
- virtual void close() = 0;
</del><ins>+ // IDBDatabase IDL
+ const String name() const;
+ uint64_t version() const;
+ RefPtr<DOMStringList> objectStoreNames() const;
</ins><span class="cx">
</span><ins>+ RefPtr<IDBObjectStore> createObjectStore(const String& name, const Dictionary&, ExceptionCodeWithMessage&);
+ RefPtr<IDBObjectStore> createObjectStore(const String& name, const IDBKeyPath&, bool autoIncrement, ExceptionCodeWithMessage&);
+ RefPtr<IDBTransaction> transaction(ScriptExecutionContext*, const Vector<String>&, const String& mode, ExceptionCodeWithMessage&);
+ RefPtr<IDBTransaction> transaction(ScriptExecutionContext*, const String&, const String& mode, ExceptionCodeWithMessage&);
+ void deleteObjectStore(const String& name, ExceptionCodeWithMessage&);
+ void close();
+
+ // EventTarget
+ EventTargetInterface eventTargetInterface() const final { return IDBDatabaseEventTargetInterfaceType; }
+ ScriptExecutionContext* scriptExecutionContext() const final { return ActiveDOMObject::scriptExecutionContext(); }
+ void refEventTarget() final { RefCounted<IDBDatabase>::ref(); }
+ void derefEventTarget() final { RefCounted<IDBDatabase>::deref(); }
+
</ins><span class="cx"> using RefCounted<IDBDatabase>::ref;
</span><span class="cx"> using RefCounted<IDBDatabase>::deref;
</span><span class="cx">
</span><del>-protected:
- IDBDatabase(ScriptExecutionContext*);
</del><ins>+ const char* activeDOMObjectName() const final;
+ bool canSuspendForDocumentSuspension() const final;
+ void stop() final;
+
+ const IDBDatabaseInfo& info() const { return m_info; }
+ uint64_t databaseConnectionIdentifier() const { return m_databaseConnectionIdentifier; }
+
+ Ref<IDBTransaction> startVersionChangeTransaction(const IDBTransactionInfo&, IDBOpenDBRequest&);
+ void didStartTransaction(IDBTransaction&);
+
+ void willCommitTransaction(IDBTransaction&);
+ void didCommitTransaction(IDBTransaction&);
+ void willAbortTransaction(IDBTransaction&);
+ void didAbortTransaction(IDBTransaction&);
+
+ void fireVersionChangeEvent(const IDBResourceIdentifier& requestIdentifier, uint64_t requestedVersion);
+
+ IDBClient::IDBConnectionToServer& serverConnection() { return m_serverConnection.get(); }
+
+ void didCreateIndexInfo(const IDBIndexInfo&);
+ void didDeleteIndexInfo(const IDBIndexInfo&);
+
+ bool isClosingOrClosed() const { return m_closePending || m_closedInServer; }
+
+ bool dispatchEvent(Event&) final;
+
+ bool hasPendingActivity() const final;
+
+private:
+ IDBDatabase(ScriptExecutionContext&, IDBClient::IDBConnectionToServer&, const IDBResultData&);
+
+ void didCommitOrAbortTransaction(IDBTransaction&);
+
+ void maybeCloseInServer();
+
+ Ref<IDBClient::IDBConnectionToServer> m_serverConnection;
+ IDBDatabaseInfo m_info;
+ uint64_t m_databaseConnectionIdentifier { 0 };
+
+ bool m_closePending { false };
+ bool m_closedInServer { false };
+
+ RefPtr<IDBTransaction> m_versionChangeTransaction;
+ HashMap<IDBResourceIdentifier, RefPtr<IDBTransaction>> m_activeTransactions;
+ HashMap<IDBResourceIdentifier, RefPtr<IDBTransaction>> m_committingTransactions;
+ HashMap<IDBResourceIdentifier, RefPtr<IDBTransaction>> m_abortingTransactions;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span><span class="cx">
</span><del>-#endif
-
-#endif // IDBDatabase_h
</del><ins>+#endif // ENABLE(INDEXED_DATABASE)
</ins></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBFactorycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBFactory.cpp (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBFactory.cpp        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBFactory.cpp        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -28,12 +28,143 @@
</span><span class="cx">
</span><span class="cx"> #if ENABLE(INDEXED_DATABASE)
</span><span class="cx">
</span><ins>+#include "DOMRequestState.h"
+#include "Document.h"
+#include "ExceptionCode.h"
+#include "IDBBindingUtilities.h"
+#include "IDBDatabaseIdentifier.h"
+#include "IDBOpenDBRequest.h"
+#include "Logging.h"
+#include "Page.h"
+#include "SchemeRegistry.h"
+#include "ScriptExecutionContext.h"
+#include "SecurityOrigin.h"
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-IDBFactory::IDBFactory()
</del><ins>+static bool shouldThrowSecurityException(ScriptExecutionContext& context)
</ins><span class="cx"> {
</span><ins>+ ASSERT(is<Document>(context) || context.isWorkerGlobalScope());
+ if (is<Document>(context)) {
+ Document& document = downcast<Document>(context);
+ if (!document.frame())
+ return true;
+ if (!document.page())
+ return true;
+ }
+
+ if (!context.securityOrigin()->canAccessDatabase(context.topOrigin()))
+ return true;
+
+ return false;
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+Ref<IDBFactory> IDBFactory::create(IDBClient::IDBConnectionToServer& connection)
+{
+ return adoptRef(*new IDBFactory(connection));
+}
+
+IDBFactory::IDBFactory(IDBClient::IDBConnectionToServer& connection)
+ : m_connectionToServer(connection)
+{
+}
+
+RefPtr<IDBRequest> IDBFactory::getDatabaseNames(ScriptExecutionContext&, ExceptionCode&)
+{
+ return nullptr;
+}
+
+RefPtr<IDBOpenDBRequest> IDBFactory::open(ScriptExecutionContext& context, const String& name, ExceptionCode& ec)
+{
+ LOG(IndexedDB, "IDBFactory::open");
+
+ return openInternal(context, name, 0, ec).release();
+}
+
+RefPtr<IDBOpenDBRequest> IDBFactory::open(ScriptExecutionContext& context, const String& name, unsigned long long version, ExceptionCode& ec)
+{
+ LOG(IndexedDB, "IDBFactory::open");
+
+ if (!version) {
+ ec = TypeError;
+ return nullptr;
+ }
+
+ return openInternal(context, name, version, ec).release();
+}
+
+RefPtr<IDBOpenDBRequest> IDBFactory::openInternal(ScriptExecutionContext& context, const String& name, unsigned long long version, ExceptionCode& ec)
+{
+ if (name.isNull()) {
+ ec = TypeError;
+ return nullptr;
+ }
+
+ if (shouldThrowSecurityException(context)) {
+ ec = SECURITY_ERR;
+ return nullptr;
+ }
+
+ ASSERT(context.securityOrigin());
+ ASSERT(context.topOrigin());
+ IDBDatabaseIdentifier databaseIdentifier(name, *context.securityOrigin(), *context.topOrigin());
+ if (!databaseIdentifier.isValid()) {
+ ec = TypeError;
+ return nullptr;
+ }
+
+ auto request = IDBOpenDBRequest::createOpenRequest(m_connectionToServer.get(), context, databaseIdentifier, version);
+ m_connectionToServer->openDatabase(request.get());
+
+ return adoptRef(&request.leakRef());
+}
+
+RefPtr<IDBOpenDBRequest> IDBFactory::deleteDatabase(ScriptExecutionContext& context, const String& name, ExceptionCode& ec)
+{
+ LOG(IndexedDB, "IDBFactory::deleteDatabase - %s", name.utf8().data());
+
+ if (name.isNull()) {
+ ec = TypeError;
+ return nullptr;
+ }
+
+ if (shouldThrowSecurityException(context)) {
+ ec = SECURITY_ERR;
+ return nullptr;
+ }
+
+ ASSERT(context.securityOrigin());
+ ASSERT(context.topOrigin());
+ IDBDatabaseIdentifier databaseIdentifier(name, *context.securityOrigin(), *context.topOrigin());
+ if (!databaseIdentifier.isValid()) {
+ ec = TypeError;
+ return nullptr;
+ }
+
+ auto request = IDBOpenDBRequest::createDeleteRequest(m_connectionToServer.get(), context, databaseIdentifier);
+ m_connectionToServer->deleteDatabase(request.get());
+
+ return adoptRef(&request.leakRef());
+}
+
+short IDBFactory::cmp(ScriptExecutionContext& context, const Deprecated::ScriptValue& firstValue, const Deprecated::ScriptValue& secondValue, ExceptionCodeWithMessage& ec)
+{
+ DOMRequestState requestState(&context);
+ RefPtr<IDBKey> first = scriptValueToIDBKey(&requestState, firstValue);
+ RefPtr<IDBKey> second = scriptValueToIDBKey(&requestState, secondValue);
+
+ ASSERT(first);
+ ASSERT(second);
+
+ if (!first->isValid() || !second->isValid()) {
+ ec.code = IDBDatabaseException::DataError;
+ ec.message = ASCIILiteral("Failed to execute 'cmp' on 'IDBFactory': The parameter is not a valid key.");
+ return 0;
+ }
+
+ return static_cast<short>(first->compare(second.get()));
+}
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx">
</span><span class="cx"> #endif // ENABLE(INDEXED_DATABASE)
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBFactoryh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBFactory.h (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBFactory.h        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBFactory.h        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -23,48 +23,39 @@
</span><span class="cx"> * THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><del>-#ifndef IDBFactory_h
-#define IDBFactory_h
</del><ins>+#pragma once
</ins><span class="cx">
</span><del>-#include "IDBOpenDBRequest.h"
-#include "ScriptWrappable.h"
-#include <wtf/RefCounted.h>
-#include <wtf/RefPtr.h>
-#include <wtf/text/WTFString.h>
-
</del><span class="cx"> #if ENABLE(INDEXED_DATABASE)
</span><span class="cx">
</span><ins>+#include "IDBConnectionToServer.h"
+#include "IDBFactory.h"
+#include "IDBOpenDBRequest.h"
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-class IDBKey;
-class IDBKeyRange;
-class ScriptExecutionContext;
-
-struct ExceptionCodeWithMessage;
-
-typedef int ExceptionCode;
-
</del><span class="cx"> class IDBFactory : public RefCounted<IDBFactory> {
</span><span class="cx"> public:
</span><del>- virtual ~IDBFactory() { }
</del><ins>+ static Ref<IDBFactory> create(IDBClient::IDBConnectionToServer&);
</ins><span class="cx">
</span><span class="cx"> // FIXME: getDatabaseNames is no longer a web-facing API, and should be removed from IDBFactory.
</span><span class="cx"> // The Web Inspector currently uses this to enumerate the list of databases, but is more complicated as a result.
</span><span class="cx"> // We should provide a simpler API to the Web Inspector then remove getDatabaseNames.
</span><del>- virtual RefPtr<IDBRequest> getDatabaseNames(ScriptExecutionContext&, ExceptionCode&) = 0;
</del><ins>+ RefPtr<IDBRequest> getDatabaseNames(ScriptExecutionContext&, ExceptionCode&);
</ins><span class="cx">
</span><del>- virtual RefPtr<IDBOpenDBRequest> open(ScriptExecutionContext&, const String& name, ExceptionCode&) = 0;
- virtual RefPtr<IDBOpenDBRequest> open(ScriptExecutionContext&, const String& name, unsigned long long version, ExceptionCode&) = 0;
- virtual RefPtr<IDBOpenDBRequest> deleteDatabase(ScriptExecutionContext&, const String& name, ExceptionCode&) = 0;
</del><ins>+ RefPtr<IDBOpenDBRequest> open(ScriptExecutionContext&, const String& name, ExceptionCode&);
+ RefPtr<IDBOpenDBRequest> open(ScriptExecutionContext&, const String& name, unsigned long long version, ExceptionCode&);
+ RefPtr<IDBOpenDBRequest> deleteDatabase(ScriptExecutionContext&, const String& name, ExceptionCode&);
</ins><span class="cx">
</span><del>- virtual short cmp(ScriptExecutionContext&, const Deprecated::ScriptValue& first, const Deprecated::ScriptValue& second, ExceptionCodeWithMessage&) = 0;
</del><ins>+ short cmp(ScriptExecutionContext&, const Deprecated::ScriptValue& first, const Deprecated::ScriptValue& second, ExceptionCodeWithMessage&);
</ins><span class="cx">
</span><del>-protected:
- IDBFactory();
</del><ins>+private:
+ IDBFactory(IDBClient::IDBConnectionToServer&);
+
+ RefPtr<IDBOpenDBRequest> openInternal(ScriptExecutionContext&, const String& name, unsigned long long version, ExceptionCode&);
+
+ Ref<IDBClient::IDBConnectionToServer> m_connectionToServer;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span><span class="cx">
</span><del>-#endif
-
-#endif // IDBFactory_h
</del><ins>+#endif // ENABLE(INDEXED_DATABASE)
</ins></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBIndexcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBIndex.cpp (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBIndex.cpp        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBIndex.cpp        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -28,12 +28,315 @@
</span><span class="cx">
</span><span class="cx"> #if ENABLE(INDEXED_DATABASE)
</span><span class="cx">
</span><ins>+#include "DOMRequestState.h"
+#include "IDBAny.h"
+#include "IDBBindingUtilities.h"
+#include "IDBCursor.h"
+#include "IDBDatabaseException.h"
+#include "IDBKeyRangeData.h"
+#include "IDBObjectStore.h"
+#include "IDBRequest.h"
+#include "IDBTransaction.h"
+#include "Logging.h"
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-IDBIndex::IDBIndex()
</del><ins>+IDBIndex::IDBIndex(ScriptExecutionContext& context, const IDBIndexInfo& info, IDBObjectStore& objectStore)
+ : ActiveDOMObject(&context)
+ , m_info(info)
+ , m_objectStore(objectStore)
</ins><span class="cx"> {
</span><ins>+ suspendIfNeeded();
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+IDBIndex::~IDBIndex()
+{
+}
+
+const char* IDBIndex::activeDOMObjectName() const
+{
+ return "IDBIndex";
+}
+
+bool IDBIndex::canSuspendForDocumentSuspension() const
+{
+ return false;
+}
+
+bool IDBIndex::hasPendingActivity() const
+{
+ return !m_objectStore.modernTransaction().isFinished();
+}
+
+const String& IDBIndex::name() const
+{
+ return m_info.name();
+}
+
+RefPtr<IDBObjectStore> IDBIndex::objectStore()
+{
+ return &m_objectStore;
+}
+
+RefPtr<IDBAny> IDBIndex::keyPathAny() const
+{
+ return IDBAny::create(m_info.keyPath());
+}
+
+const IDBKeyPath& IDBIndex::keyPath() const
+{
+ return m_info.keyPath();
+}
+
+bool IDBIndex::unique() const
+{
+ return m_info.unique();
+}
+
+bool IDBIndex::multiEntry() const
+{
+ return m_info.multiEntry();
+}
+
+RefPtr<IDBRequest> IDBIndex::openCursor(ScriptExecutionContext& context, IDBKeyRange* range, const String& directionString, ExceptionCodeWithMessage& ec)
+{
+ LOG(IndexedDB, "IDBIndex::openCursor");
+
+ if (m_deleted || m_objectStore.isDeleted()) {
+ ec.code = IDBDatabaseException::InvalidStateError;
+ ec.message = ASCIILiteral("Failed to execute 'openCursor' on 'IDBIndex': The index or its object store has been deleted.");
+ return nullptr;
+ }
+
+ if (!m_objectStore.modernTransaction().isActive()) {
+ ec.code = IDBDatabaseException::TransactionInactiveError;
+ ec.message = ASCIILiteral("Failed to execute 'openCursor' on 'IDBIndex': The transaction is inactive or finished.");
+ return nullptr;
+ }
+
+ IndexedDB::CursorDirection direction = IDBCursor::stringToDirection(directionString, ec.code);
+ if (ec.code) {
+ ec.message = ASCIILiteral("Failed to execute 'openCursor' on 'IDBIndex': The direction provided ('invalid-direction') is not one of 'next', 'nextunique', 'prev', or 'prevunique'.");
+ return nullptr;
+ }
+
+ IDBKeyRangeData rangeData = range;
+ if (rangeData.lowerKey.isNull())
+ rangeData.lowerKey = IDBKeyData::minimum();
+ if (rangeData.upperKey.isNull())
+ rangeData.upperKey = IDBKeyData::maximum();
+
+ auto info = IDBCursorInfo::indexCursor(m_objectStore.modernTransaction(), m_objectStore.info().identifier(), m_info.identifier(), rangeData, direction, IndexedDB::CursorType::KeyAndValue);
+ return m_objectStore.modernTransaction().requestOpenCursor(context, *this, info);
+}
+
+RefPtr<IDBRequest> IDBIndex::openCursor(ScriptExecutionContext& context, const Deprecated::ScriptValue& key, const String& direction, ExceptionCodeWithMessage& ec)
+{
+ LOG(IndexedDB, "IDBIndex::openCursor");
+ RefPtr<IDBKeyRange> keyRange = IDBKeyRange::only(context, key, ec.code);
+ if (ec.code) {
+ ec.message = ASCIILiteral("Failed to execute 'openCursor' on 'IDBIndex': The parameter is not a valid key.");
+ return nullptr;
+ }
+
+ return openCursor(context, keyRange.get(), direction, ec);
+}
+
+RefPtr<IDBRequest> IDBIndex::count(ScriptExecutionContext& context, ExceptionCodeWithMessage& ec)
+{
+ LOG(IndexedDB, "IDBIndex::count");
+
+ return doCount(context, IDBKeyRangeData::allKeys(), ec);
+}
+
+RefPtr<IDBRequest> IDBIndex::count(ScriptExecutionContext& context, IDBKeyRange* range, ExceptionCodeWithMessage& ec)
+{
+ LOG(IndexedDB, "IDBIndex::count");
+
+ return doCount(context, range ? IDBKeyRangeData(range) : IDBKeyRangeData::allKeys(), ec);
+}
+
+RefPtr<IDBRequest> IDBIndex::count(ScriptExecutionContext& context, const Deprecated::ScriptValue& key, ExceptionCodeWithMessage& ec)
+{
+ LOG(IndexedDB, "IDBIndex::count");
+
+ DOMRequestState requestState(&context);
+ RefPtr<IDBKey> idbKey = scriptValueToIDBKey(&requestState, key);
+ if (!idbKey || idbKey->type() == KeyType::Invalid) {
+ ec.code = IDBDatabaseException::DataError;
+ ec.message = ASCIILiteral("Failed to execute 'count' on 'IDBIndex': The parameter is not a valid key.");
+ return nullptr;
+ }
+
+ return doCount(context, IDBKeyRangeData(idbKey.get()), ec);
+}
+
+RefPtr<IDBRequest> IDBIndex::doCount(ScriptExecutionContext& context, const IDBKeyRangeData& range, ExceptionCodeWithMessage& ec)
+{
+ if (m_deleted || m_objectStore.isDeleted()) {
+ ec.code = IDBDatabaseException::InvalidStateError;
+ ec.message = ASCIILiteral("Failed to execute 'count' on 'IDBIndex': The index or its object store has been deleted.");
+ return nullptr;
+ }
+
+ if (!range.isValid()) {
+ ec.code = IDBDatabaseException::DataError;
+ return nullptr;
+ }
+
+ auto& transaction = m_objectStore.modernTransaction();
+ if (!transaction.isActive()) {
+ ec.code = IDBDatabaseException::TransactionInactiveError;
+ ec.message = ASCIILiteral("Failed to execute 'count' on 'IDBIndex': The transaction is inactive or finished.");
+ return nullptr;
+ }
+
+ return transaction.requestCount(context, *this, range);
+}
+
+RefPtr<IDBRequest> IDBIndex::openKeyCursor(ScriptExecutionContext& context, IDBKeyRange* range, const String& directionString, ExceptionCodeWithMessage& ec)
+{
+ LOG(IndexedDB, "IDBIndex::openKeyCursor");
+
+ if (m_deleted || m_objectStore.isDeleted()) {
+ ec.code = IDBDatabaseException::InvalidStateError;
+ ec.message = ASCIILiteral("Failed to execute 'openKeyCursor' on 'IDBIndex': The index or its object store has been deleted.");
+ return nullptr;
+ }
+
+ if (!m_objectStore.modernTransaction().isActive()) {
+ ec.code = IDBDatabaseException::TransactionInactiveError;
+ ec.message = ASCIILiteral("Failed to execute 'openKeyCursor' on 'IDBIndex': The transaction is inactive or finished.");
+ return nullptr;
+ }
+
+ IndexedDB::CursorDirection direction = IDBCursor::stringToDirection(directionString, ec.code);
+ if (ec.code) {
+ ec.message = ASCIILiteral("Failed to execute 'openKeyCursor' on 'IDBIndex': The direction provided ('invalid-direction') is not one of 'next', 'nextunique', 'prev', or 'prevunique'.");
+ return nullptr;
+ }
+
+ auto info = IDBCursorInfo::indexCursor(m_objectStore.modernTransaction(), m_objectStore.info().identifier(), m_info.identifier(), range, direction, IndexedDB::CursorType::KeyOnly);
+ return m_objectStore.modernTransaction().requestOpenCursor(context, *this, info);
+}
+
+RefPtr<IDBRequest> IDBIndex::openKeyCursor(ScriptExecutionContext& context, const Deprecated::ScriptValue& key, const String& direction, ExceptionCodeWithMessage& ec)
+{
+ LOG(IndexedDB, "IDBIndex::openKeyCursor");
+ RefPtr<IDBKeyRange> keyRange = IDBKeyRange::only(context, key, ec.code);
+ if (ec.code) {
+ ec.message = ASCIILiteral("Failed to execute 'openKeyCursor' on 'IDBIndex': The parameter is not a valid key.");
+ return nullptr;
+ }
+ return openKeyCursor(context, keyRange.get(), direction, ec);
+}
+
+RefPtr<IDBRequest> IDBIndex::get(ScriptExecutionContext& context, IDBKeyRange* range, ExceptionCodeWithMessage& ec)
+{
+ LOG(IndexedDB, "IDBIndex::get");
+
+ return doGet(context, IDBKeyRangeData(range), ec);
+}
+
+RefPtr<IDBRequest> IDBIndex::get(ScriptExecutionContext& context, const Deprecated::ScriptValue& key, ExceptionCodeWithMessage& ec)
+{
+ LOG(IndexedDB, "IDBIndex::get");
+
+ DOMRequestState requestState(&context);
+ RefPtr<IDBKey> idbKey = scriptValueToIDBKey(&requestState, key);
+ if (!idbKey || idbKey->type() == KeyType::Invalid) {
+ ec.code = IDBDatabaseException::DataError;
+ ec.message = ASCIILiteral("Failed to execute 'get' on 'IDBIndex': The parameter is not a valid key.");
+ return nullptr;
+ }
+
+ return doGet(context, IDBKeyRangeData(idbKey.get()), ec);
+}
+
+RefPtr<IDBRequest> IDBIndex::doGet(ScriptExecutionContext& context, const IDBKeyRangeData& range, ExceptionCodeWithMessage& ec)
+{
+ if (m_deleted || m_objectStore.isDeleted()) {
+ ec.code = IDBDatabaseException::InvalidStateError;
+ ec.message = ASCIILiteral("Failed to execute 'get' on 'IDBIndex': The index or its object store has been deleted.");
+ return nullptr;
+ }
+
+ if (range.isNull) {
+ ec.code = IDBDatabaseException::DataError;
+ return nullptr;
+ }
+
+ auto& transaction = m_objectStore.modernTransaction();
+ if (!transaction.isActive()) {
+ ec.code = IDBDatabaseException::TransactionInactiveError;
+ ec.message = ASCIILiteral("Failed to execute 'get' on 'IDBIndex': The transaction is inactive or finished.");
+ return nullptr;
+ }
+
+ return transaction.requestGetValue(context, *this, range);
+}
+
+RefPtr<IDBRequest> IDBIndex::getKey(ScriptExecutionContext& context, IDBKeyRange* range, ExceptionCodeWithMessage& ec)
+{
+ LOG(IndexedDB, "IDBIndex::getKey");
+
+ return doGetKey(context, IDBKeyRangeData(range), ec);
+}
+
+RefPtr<IDBRequest> IDBIndex::getKey(ScriptExecutionContext& context, const Deprecated::ScriptValue& key, ExceptionCodeWithMessage& ec)
+{
+ LOG(IndexedDB, "IDBIndex::getKey");
+
+ DOMRequestState requestState(&context);
+ RefPtr<IDBKey> idbKey = scriptValueToIDBKey(&requestState, key);
+ if (!idbKey || idbKey->type() == KeyType::Invalid) {
+ ec.code = IDBDatabaseException::DataError;
+ ec.message = ASCIILiteral("Failed to execute 'getKey' on 'IDBIndex': The parameter is not a valid key.");
+ return nullptr;
+ }
+
+ return doGetKey(context, IDBKeyRangeData(idbKey.get()), ec);
+}
+
+RefPtr<IDBRequest> IDBIndex::doGetKey(ScriptExecutionContext& context, const IDBKeyRangeData& range, ExceptionCodeWithMessage& ec)
+{
+ if (m_deleted || m_objectStore.isDeleted()) {
+ ec.code = IDBDatabaseException::InvalidStateError;
+ ec.message = ASCIILiteral("Failed to execute 'getKey' on 'IDBIndex': The index or its object store has been deleted.");
+ return nullptr;
+ }
+
+ if (range.isNull) {
+ ec.code = IDBDatabaseException::DataError;
+ return nullptr;
+ }
+
+ auto& transaction = m_objectStore.modernTransaction();
+ if (!transaction.isActive()) {
+ ec.code = IDBDatabaseException::TransactionInactiveError;
+ ec.message = ASCIILiteral("Failed to execute 'getKey' on 'IDBIndex': The transaction is inactive or finished.");
+ return nullptr;
+ }
+
+ return transaction.requestGetKey(context, *this, range);
+}
+
+void IDBIndex::markAsDeleted()
+{
+ ASSERT(!m_deleted);
+ m_deleted = true;
+}
+
+void IDBIndex::ref()
+{
+ m_objectStore.ref();
+}
+
+void IDBIndex::deref()
+{
+ m_objectStore.deref();
+}
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx">
</span><span class="cx"> #endif // ENABLE(INDEXED_DATABASE)
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBIndexh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBIndex.h (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBIndex.h        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBIndex.h        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -23,73 +23,90 @@
</span><span class="cx"> * THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><del>-#ifndef IDBIndex_h
-#define IDBIndex_h
</del><ins>+#pragma once
</ins><span class="cx">
</span><ins>+#include "IDBIndex.h"
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include "ActiveDOMObject.h"
+#include "ExceptionCode.h"
</ins><span class="cx"> #include "IDBCursor.h"
</span><del>-#include "IDBDatabase.h"
-#include "IDBKeyPath.h"
-#include "IDBKeyRange.h"
-#include "IDBObjectStore.h"
</del><ins>+#include "IDBIndexInfo.h"
</ins><span class="cx"> #include "IDBRequest.h"
</span><del>-#include "ScriptWrappable.h"
-#include <wtf/Forward.h>
-#include <wtf/text/WTFString.h>
</del><ins>+#include <bindings/ScriptValue.h>
</ins><span class="cx">
</span><del>-#if ENABLE(INDEXED_DATABASE)
-
</del><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><ins>+class IDBAny;
+class IDBKeyRange;
</ins><span class="cx"> class IDBObjectStore;
</span><ins>+struct IDBKeyRangeData;
</ins><span class="cx">
</span><del>-class IDBIndex {
</del><ins>+class IDBIndex : public ActiveDOMObject {
</ins><span class="cx"> public:
</span><del>- virtual ~IDBIndex() { }
</del><ins>+ IDBIndex(ScriptExecutionContext&, const IDBIndexInfo&, IDBObjectStore&);
</ins><span class="cx">
</span><ins>+ virtual ~IDBIndex();
+
</ins><span class="cx"> // Implement the IDL
</span><del>- virtual const String& name() const = 0;
- virtual RefPtr<IDBObjectStore> objectStore() = 0;
- virtual RefPtr<IDBAny> keyPathAny() const = 0;
- virtual const IDBKeyPath& keyPath() const = 0;
- virtual bool unique() const = 0;
- virtual bool multiEntry() const = 0;
</del><ins>+ const String& name() const;
+ RefPtr<IDBObjectStore> objectStore();
+ RefPtr<IDBAny> keyPathAny() const;
+ const IDBKeyPath& keyPath() const;
+ bool unique() const;
+ bool multiEntry() const;
</ins><span class="cx">
</span><del>- virtual RefPtr<IDBRequest> openCursor(ScriptExecutionContext&, ExceptionCodeWithMessage&) = 0;
- virtual RefPtr<IDBRequest> openCursor(ScriptExecutionContext&, IDBKeyRange*, ExceptionCodeWithMessage&) = 0;
- virtual RefPtr<IDBRequest> openCursor(ScriptExecutionContext&, const Deprecated::ScriptValue& key, ExceptionCodeWithMessage&) = 0;
- virtual RefPtr<IDBRequest> openCursor(ScriptExecutionContext&, IDBKeyRange*, const String& direction, ExceptionCodeWithMessage&) = 0;
- virtual RefPtr<IDBRequest> openCursor(ScriptExecutionContext&, const Deprecated::ScriptValue& key, const String& direction, ExceptionCodeWithMessage&) = 0;
</del><ins>+ RefPtr<IDBRequest> openCursor(ScriptExecutionContext& context, ExceptionCodeWithMessage& ec) { return openCursor(context, static_cast<IDBKeyRange*>(nullptr), ec); }
+ RefPtr<IDBRequest> openCursor(ScriptExecutionContext& context, IDBKeyRange* keyRange, ExceptionCodeWithMessage& ec) { return openCursor(context, keyRange, IDBCursor::directionNext(), ec); }
+ RefPtr<IDBRequest> openCursor(ScriptExecutionContext& context, const Deprecated::ScriptValue& key, ExceptionCodeWithMessage& ec) { return openCursor(context, key, IDBCursor::directionNext(), ec); }
+ RefPtr<IDBRequest> openCursor(ScriptExecutionContext&, IDBKeyRange*, const String& direction, ExceptionCodeWithMessage&);
+ RefPtr<IDBRequest> openCursor(ScriptExecutionContext&, const Deprecated::ScriptValue& key, const String& direction, ExceptionCodeWithMessage&);
</ins><span class="cx">
</span><del>- virtual RefPtr<IDBRequest> count(ScriptExecutionContext&, ExceptionCodeWithMessage&) = 0;
- virtual RefPtr<IDBRequest> count(ScriptExecutionContext&, IDBKeyRange*, ExceptionCodeWithMessage&) = 0;
- virtual RefPtr<IDBRequest> count(ScriptExecutionContext&, const Deprecated::ScriptValue& key, ExceptionCodeWithMessage&) = 0;
</del><ins>+ RefPtr<IDBRequest> count(ScriptExecutionContext&, ExceptionCodeWithMessage&);
+ RefPtr<IDBRequest> count(ScriptExecutionContext&, IDBKeyRange*, ExceptionCodeWithMessage&);
+ RefPtr<IDBRequest> count(ScriptExecutionContext&, const Deprecated::ScriptValue& key, ExceptionCodeWithMessage&);
</ins><span class="cx">
</span><del>- virtual RefPtr<IDBRequest> openKeyCursor(ScriptExecutionContext&, ExceptionCodeWithMessage&) = 0;
- virtual RefPtr<IDBRequest> openKeyCursor(ScriptExecutionContext&, IDBKeyRange*, ExceptionCodeWithMessage&) = 0;
- virtual RefPtr<IDBRequest> openKeyCursor(ScriptExecutionContext&, const Deprecated::ScriptValue& key, ExceptionCodeWithMessage&) = 0;
- virtual RefPtr<IDBRequest> openKeyCursor(ScriptExecutionContext&, IDBKeyRange*, const String& direction, ExceptionCodeWithMessage&) = 0;
- virtual RefPtr<IDBRequest> openKeyCursor(ScriptExecutionContext&, const Deprecated::ScriptValue& key, const String& direction, ExceptionCodeWithMessage&) = 0;
</del><ins>+ RefPtr<IDBRequest> openKeyCursor(ScriptExecutionContext& context, ExceptionCodeWithMessage& ec) { return openKeyCursor(context, static_cast<IDBKeyRange*>(nullptr), ec); }
+ RefPtr<IDBRequest> openKeyCursor(ScriptExecutionContext& context, IDBKeyRange* keyRange, ExceptionCodeWithMessage& ec) { return openKeyCursor(context, keyRange, IDBCursor::directionNext(), ec); }
+ RefPtr<IDBRequest> openKeyCursor(ScriptExecutionContext& context, const Deprecated::ScriptValue& key, ExceptionCodeWithMessage& ec) { return openKeyCursor(context, key, IDBCursor::directionNext(), ec); }
+ RefPtr<IDBRequest> openKeyCursor(ScriptExecutionContext&, IDBKeyRange*, const String& direction, ExceptionCodeWithMessage&);
+ RefPtr<IDBRequest> openKeyCursor(ScriptExecutionContext&, const Deprecated::ScriptValue& key, const String& direction, ExceptionCodeWithMessage&);
</ins><span class="cx">
</span><del>- virtual RefPtr<IDBRequest> get(ScriptExecutionContext&, IDBKeyRange*, ExceptionCodeWithMessage&) = 0;
- virtual RefPtr<IDBRequest> get(ScriptExecutionContext&, const Deprecated::ScriptValue& key, ExceptionCodeWithMessage&) = 0;
</del><ins>+ RefPtr<IDBRequest> get(ScriptExecutionContext&, IDBKeyRange*, ExceptionCodeWithMessage&);
+ RefPtr<IDBRequest> get(ScriptExecutionContext&, const Deprecated::ScriptValue& key, ExceptionCodeWithMessage&);
+ RefPtr<IDBRequest> getKey(ScriptExecutionContext&, IDBKeyRange*, ExceptionCodeWithMessage&);
+ RefPtr<IDBRequest> getKey(ScriptExecutionContext&, const Deprecated::ScriptValue& key, ExceptionCodeWithMessage&);
</ins><span class="cx">
</span><del>- virtual RefPtr<IDBRequest> getKey(ScriptExecutionContext&, IDBKeyRange*, ExceptionCodeWithMessage&) = 0;
- virtual RefPtr<IDBRequest> getKey(ScriptExecutionContext&, const Deprecated::ScriptValue& key, ExceptionCodeWithMessage&) = 0;
</del><ins>+ const IDBIndexInfo& info() const { return m_info; }
</ins><span class="cx">
</span><del>- virtual bool isModern() const { return false; }
</del><ins>+ IDBObjectStore& modernObjectStore() { return m_objectStore; }
</ins><span class="cx">
</span><del>- // We use our own ref/deref function because Legacy IDB and Modern IDB have very different
- // lifetime management of their indexes.
- // This will go away once Legacy IDB is dropped.
- virtual void ref() = 0;
- virtual void deref() = 0;
</del><ins>+ void markAsDeleted();
+ bool isDeleted() const { return m_deleted; }
</ins><span class="cx">
</span><del>-protected:
- IDBIndex();
</del><ins>+ void ref();
+ void deref();
+
+private:
+ RefPtr<IDBRequest> doCount(ScriptExecutionContext&, const IDBKeyRangeData&, ExceptionCodeWithMessage&);
+ RefPtr<IDBRequest> doGet(ScriptExecutionContext&, const IDBKeyRangeData&, ExceptionCodeWithMessage&);
+ RefPtr<IDBRequest> doGetKey(ScriptExecutionContext&, const IDBKeyRangeData&, ExceptionCodeWithMessage&);
+
+ // ActiveDOMObject
+ const char* activeDOMObjectName() const;
+ bool canSuspendForDocumentSuspension() const;
+ bool hasPendingActivity() const;
+
+ IDBIndexInfo m_info;
+
+ bool m_deleted { false };
+
+ // IDBIndex objects are always owned by their referencing IDBObjectStore.
+ // Indexes will never outlive ObjectStores so its okay to keep a raw C++ reference here.
+ IDBObjectStore& m_objectStore;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span><span class="cx">
</span><del>-#endif
-
-#endif // IDBIndex_h
</del><ins>+#endif // ENABLE(INDEXED_DATABASE)
</ins></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBObjectStorecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -28,12 +28,634 @@
</span><span class="cx">
</span><span class="cx"> #if ENABLE(INDEXED_DATABASE)
</span><span class="cx">
</span><ins>+#include "DOMRequestState.h"
+#include "DOMStringList.h"
+#include "IDBBindingUtilities.h"
+#include "IDBCursor.h"
+#include "IDBDatabase.h"
+#include "IDBDatabaseException.h"
+#include "IDBError.h"
+#include "IDBIndex.h"
+#include "IDBKey.h"
+#include "IDBKeyRangeData.h"
+#include "IDBRequest.h"
+#include "IDBTransaction.h"
+#include "IndexedDB.h"
+#include "Logging.h"
+#include "SerializedScriptValue.h"
+#include <wtf/Locker.h>
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-IDBObjectStore::IDBObjectStore()
</del><ins>+Ref<IDBObjectStore> IDBObjectStore::create(ScriptExecutionContext& context, const IDBObjectStoreInfo& info, IDBTransaction& transaction)
</ins><span class="cx"> {
</span><ins>+ return adoptRef(*new IDBObjectStore(context, info, transaction));
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+IDBObjectStore::IDBObjectStore(ScriptExecutionContext& context, const IDBObjectStoreInfo& info, IDBTransaction& transaction)
+ : ActiveDOMObject(&context)
+ , m_info(info)
+ , m_originalInfo(info)
+ , m_transaction(transaction)
+{
+ suspendIfNeeded();
+}
+
+IDBObjectStore::~IDBObjectStore()
+{
+}
+
+const char* IDBObjectStore::activeDOMObjectName() const
+{
+ return "IDBObjectStore";
+}
+
+bool IDBObjectStore::canSuspendForDocumentSuspension() const
+{
+ return false;
+}
+
+bool IDBObjectStore::hasPendingActivity() const
+{
+ return !m_transaction->isFinished();
+}
+
+const String IDBObjectStore::name() const
+{
+ return m_info.name();
+}
+
+RefPtr<WebCore::IDBAny> IDBObjectStore::keyPathAny() const
+{
+ return IDBAny::create(m_info.keyPath());
+}
+
+const IDBKeyPath IDBObjectStore::keyPath() const
+{
+ return m_info.keyPath();
+}
+
+RefPtr<DOMStringList> IDBObjectStore::indexNames() const
+{
+ RefPtr<DOMStringList> indexNames = DOMStringList::create();
+ for (auto& name : m_info.indexNames())
+ indexNames->append(name);
+ indexNames->sort();
+
+ return indexNames;
+}
+
+RefPtr<WebCore::IDBTransaction> IDBObjectStore::transaction()
+{
+ return &m_transaction.get();
+}
+
+bool IDBObjectStore::autoIncrement() const
+{
+ return m_info.autoIncrement();
+}
+
+RefPtr<WebCore::IDBRequest> IDBObjectStore::openCursor(ScriptExecutionContext& context, ExceptionCodeWithMessage& ec)
+{
+ return openCursor(context, static_cast<IDBKeyRange*>(nullptr), ec);
+}
+
+RefPtr<WebCore::IDBRequest> IDBObjectStore::openCursor(ScriptExecutionContext& context, IDBKeyRange* keyRange, ExceptionCodeWithMessage& ec)
+{
+ return openCursor(context, keyRange, IDBCursor::directionNext(), ec);
+}
+
+RefPtr<WebCore::IDBRequest> IDBObjectStore::openCursor(ScriptExecutionContext& context, const Deprecated::ScriptValue& key, ExceptionCodeWithMessage& ec)
+{
+ return openCursor(context, key, IDBCursor::directionNext(), ec);
+}
+
+RefPtr<WebCore::IDBRequest> IDBObjectStore::openCursor(ScriptExecutionContext& context, IDBKeyRange* range, const String& directionString, ExceptionCodeWithMessage& ec)
+{
+ LOG(IndexedDB, "IDBObjectStore::openCursor");
+
+ if (m_deleted) {
+ ec.code = IDBDatabaseException::InvalidStateError;
+ ec.message = ASCIILiteral("Failed to execute 'openCursor' on 'IDBObjectStore': The object store has been deleted.");
+ return nullptr;
+ }
+
+ if (!m_transaction->isActive()) {
+ ec.code = IDBDatabaseException::TransactionInactiveError;
+ ec.message = ASCIILiteral("Failed to execute 'openCursor' on 'IDBObjectStore': The transaction is inactive or finished.");
+ return nullptr;
+ }
+
+ IndexedDB::CursorDirection direction = IDBCursor::stringToDirection(directionString, ec.code);
+ if (ec.code)
+ return nullptr;
+
+ auto info = IDBCursorInfo::objectStoreCursor(m_transaction.get(), m_info.identifier(), range, direction);
+ Ref<IDBRequest> request = m_transaction->requestOpenCursor(context, *this, info);
+ return WTFMove(request);
+}
+
+RefPtr<WebCore::IDBRequest> IDBObjectStore::openCursor(ScriptExecutionContext& context, const Deprecated::ScriptValue& key, const String& direction, ExceptionCodeWithMessage& ec)
+{
+ RefPtr<IDBKeyRange> keyRange = IDBKeyRange::only(context, key, ec.code);
+ if (ec.code) {
+ ec.message = ASCIILiteral("Failed to execute 'openCursor' on 'IDBObjectStore': The parameter is not a valid key.");
+ return 0;
+ }
+
+ return openCursor(context, keyRange.get(), direction, ec);
+}
+
+RefPtr<WebCore::IDBRequest> IDBObjectStore::get(ScriptExecutionContext& context, const Deprecated::ScriptValue& key, ExceptionCodeWithMessage& ec)
+{
+ LOG(IndexedDB, "IDBObjectStore::get");
+
+ if (!m_transaction->isActive()) {
+ ec.code = IDBDatabaseException::TransactionInactiveError;
+ ec.message = ASCIILiteral("Failed to execute 'get' on 'IDBObjectStore': The transaction is inactive or finished.");
+ return nullptr;
+ }
+
+ if (m_deleted) {
+ ec.code = IDBDatabaseException::InvalidStateError;
+ ec.message = ASCIILiteral("Failed to execute 'get' on 'IDBObjectStore': The object store has been deleted.");
+ return nullptr;
+ }
+
+ DOMRequestState requestState(&context);
+ RefPtr<IDBKey> idbKey = scriptValueToIDBKey(&requestState, key);
+ if (!idbKey || idbKey->type() == KeyType::Invalid) {
+ ec.code = IDBDatabaseException::DataError;
+ ec.message = ASCIILiteral("Failed to execute 'get' on 'IDBObjectStore': The parameter is not a valid key.");
+ return nullptr;
+ }
+
+ Ref<IDBRequest> request = m_transaction->requestGetRecord(context, *this, idbKey.get());
+ return WTFMove(request);
+}
+
+RefPtr<WebCore::IDBRequest> IDBObjectStore::get(ScriptExecutionContext& context, IDBKeyRange* keyRange, ExceptionCodeWithMessage& ec)
+{
+ LOG(IndexedDB, "IDBObjectStore::get");
+
+ if (!m_transaction->isActive()) {
+ ec.code = IDBDatabaseException::TransactionInactiveError;
+ return nullptr;
+ }
+
+ if (m_deleted) {
+ ec.code = IDBDatabaseException::InvalidStateError;
+ ec.message = ASCIILiteral("Failed to execute 'get' on 'IDBObjectStore': The object store has been deleted.");
+ return nullptr;
+ }
+
+ IDBKeyRangeData keyRangeData(keyRange);
+ if (!keyRangeData.isValid()) {
+ ec.code = IDBDatabaseException::DataError;
+ return nullptr;
+ }
+
+ Ref<IDBRequest> request = m_transaction->requestGetRecord(context, *this, keyRangeData);
+ return WTFMove(request);
+}
+
+RefPtr<WebCore::IDBRequest> IDBObjectStore::add(JSC::ExecState& state, JSC::JSValue value, ExceptionCodeWithMessage& ec)
+{
+ return putOrAdd(state, value, nullptr, IndexedDB::ObjectStoreOverwriteMode::NoOverwrite, InlineKeyCheck::Perform, ec);
+}
+
+RefPtr<WebCore::IDBRequest> IDBObjectStore::add(JSC::ExecState& execState, JSC::JSValue value, JSC::JSValue key, ExceptionCodeWithMessage& ec)
+{
+ RefPtr<IDBKey> idbKey;
+ if (!key.isUndefined())
+ idbKey = scriptValueToIDBKey(execState, key);
+ return putOrAdd(execState, value, idbKey, IndexedDB::ObjectStoreOverwriteMode::NoOverwrite, InlineKeyCheck::Perform, ec);
+}
+
+RefPtr<WebCore::IDBRequest> IDBObjectStore::put(JSC::ExecState& execState, JSC::JSValue value, JSC::JSValue key, ExceptionCodeWithMessage& ec)
+{
+ RefPtr<IDBKey> idbKey;
+ if (!key.isUndefined())
+ idbKey = scriptValueToIDBKey(execState, key);
+ return putOrAdd(execState, value, idbKey, IndexedDB::ObjectStoreOverwriteMode::Overwrite, InlineKeyCheck::Perform, ec);
+}
+
+RefPtr<WebCore::IDBRequest> IDBObjectStore::put(JSC::ExecState& state, JSC::JSValue value, ExceptionCodeWithMessage& ec)
+{
+ return putOrAdd(state, value, nullptr, IndexedDB::ObjectStoreOverwriteMode::Overwrite, InlineKeyCheck::Perform, ec);
+}
+
+RefPtr<IDBRequest> IDBObjectStore::putForCursorUpdate(JSC::ExecState& state, JSC::JSValue value, JSC::JSValue key, ExceptionCodeWithMessage& ec)
+{
+ return putOrAdd(state, value, scriptValueToIDBKey(state, key), IndexedDB::ObjectStoreOverwriteMode::OverwriteForCursor, InlineKeyCheck::DoNotPerform, ec);
+}
+
+RefPtr<IDBRequest> IDBObjectStore::putOrAdd(JSC::ExecState& state, JSC::JSValue value, RefPtr<IDBKey> key, IndexedDB::ObjectStoreOverwriteMode overwriteMode, InlineKeyCheck inlineKeyCheck, ExceptionCodeWithMessage& ec)
+{
+ LOG(IndexedDB, "IDBObjectStore::putOrAdd");
+
+ // The IDB spec for several IDBObjectStore methods states that transaction related exceptions should fire before
+ // the exception for an object store being deleted.
+ // However, a handful of W3C IDB tests expect the deleted exception even though the transaction inactive exception also applies.
+ // Additionally, Chrome and Edge agree with the test, as does Legacy IDB in WebKit.
+ // Until this is sorted out, we'll agree with the test and the majority share browsers.
+ if (m_deleted) {
+ ec.code = IDBDatabaseException::InvalidStateError;
+ ec.message = ASCIILiteral("Failed to store record in an IDBObjectStore: The object store has been deleted.");
+ return nullptr;
+ }
+
+ if (!m_transaction->isActive()) {
+ ec.code = IDBDatabaseException::TransactionInactiveError;
+ ec.message = ASCIILiteral("Failed to store record in an IDBObjectStore: The transaction is inactive or finished.");
+ return nullptr;
+ }
+
+ if (m_transaction->isReadOnly()) {
+ ec.code = IDBDatabaseException::ReadOnlyError;
+ ec.message = ASCIILiteral("Failed to store record in an IDBObjectStore: The transaction is read-only.");
+ return nullptr;
+ }
+
+ RefPtr<SerializedScriptValue> serializedValue = SerializedScriptValue::create(&state, value, nullptr, nullptr);
+ if (state.hadException()) {
+ // Clear the DOM exception from the serializer so we can give a more targeted exception.
+ state.clearException();
+
+ ec.code = IDBDatabaseException::DataCloneError;
+ ec.message = ASCIILiteral("Failed to store record in an IDBObjectStore: An object could not be cloned.");
+ return nullptr;
+ }
+
+ if (serializedValue->hasBlobURLs()) {
+ // FIXME: Add Blob/File/FileList support
+ ec.code = IDBDatabaseException::DataCloneError;
+ ec.message = ASCIILiteral("Failed to store record in an IDBObjectStore: BlobURLs are not yet supported.");
+ return nullptr;
+ }
+
+ if (key && !key->isValid()) {
+ ec.code = IDBDatabaseException::DataError;
+ ec.message = ASCIILiteral("Failed to store record in an IDBObjectStore: The parameter is not a valid key.");
+ return nullptr;
+ }
+
+ bool usesInlineKeys = !m_info.keyPath().isNull();
+ bool usesKeyGenerator = autoIncrement();
+ if (usesInlineKeys && inlineKeyCheck == InlineKeyCheck::Perform) {
+ if (key) {
+ ec.code = IDBDatabaseException::DataError;
+ ec.message = ASCIILiteral("Failed to store record in an IDBObjectStore: The object store uses in-line keys and the key parameter was provided.");
+ return nullptr;
+ }
+
+ RefPtr<IDBKey> keyPathKey = maybeCreateIDBKeyFromScriptValueAndKeyPath(state, value, m_info.keyPath());
+ if (keyPathKey && !keyPathKey->isValid()) {
+ ec.code = IDBDatabaseException::DataError;
+ ec.message = ASCIILiteral("Failed to store record in an IDBObjectStore: Evaluating the object store's key path yielded a value that is not a valid key.");
+ return nullptr;
+ }
+
+ if (!keyPathKey) {
+ if (usesKeyGenerator) {
+ if (!canInjectIDBKeyIntoScriptValue(state, value, m_info.keyPath())) {
+ ec.code = IDBDatabaseException::DataError;
+ return nullptr;
+ }
+ } else {
+ ec.code = IDBDatabaseException::DataError;
+ ec.message = ASCIILiteral("Failed to store record in an IDBObjectStore: Evaluating the object store's key path did not yield a value.");
+ return nullptr;
+ }
+ }
+
+ if (keyPathKey) {
+ ASSERT(!key);
+ key = keyPathKey;
+ }
+ } else if (!usesKeyGenerator && !key) {
+ ec.code = IDBDatabaseException::DataError;
+ ec.message = ASCIILiteral("Failed to store record in an IDBObjectStore: The object store uses out-of-line keys and has no key generator and the key parameter was not provided.");
+ return nullptr;
+ }
+
+ auto context = scriptExecutionContextFromExecState(&state);
+ if (!context) {
+ ec.code = IDBDatabaseException::UnknownError;
+ return nullptr;
+ }
+
+ Ref<IDBRequest> request = m_transaction->requestPutOrAdd(*context, *this, key.get(), *serializedValue, overwriteMode);
+ return adoptRef(request.leakRef());
+}
+
+RefPtr<WebCore::IDBRequest> IDBObjectStore::deleteFunction(ScriptExecutionContext& context, IDBKeyRange* keyRange, ExceptionCodeWithMessage& ec)
+{
+ return doDelete(context, keyRange, ec);
+}
+
+RefPtr<IDBRequest> IDBObjectStore::doDelete(ScriptExecutionContext& context, IDBKeyRange* keyRange, ExceptionCodeWithMessage& ec)
+{
+ LOG(IndexedDB, "IDBObjectStore::deleteFunction");
+
+ // The IDB spec for several IDBObjectStore methods states that transaction related exceptions should fire before
+ // the exception for an object store being deleted.
+ // However, a handful of W3C IDB tests expect the deleted exception even though the transaction inactive exception also applies.
+ // Additionally, Chrome and Edge agree with the test, as does Legacy IDB in WebKit.
+ // Until this is sorted out, we'll agree with the test and the majority share browsers.
+ if (m_deleted) {
+ ec.code = IDBDatabaseException::InvalidStateError;
+ ec.message = ASCIILiteral("Failed to execute 'delete' on 'IDBObjectStore': The object store has been deleted.");
+ return nullptr;
+ }
+
+ if (!m_transaction->isActive()) {
+ ec.code = IDBDatabaseException::TransactionInactiveError;
+ ec.message = ASCIILiteral("Failed to execute 'delete' on 'IDBObjectStore': The transaction is inactive or finished.");
+ return nullptr;
+ }
+
+ if (m_transaction->isReadOnly()) {
+ ec.code = IDBDatabaseException::ReadOnlyError;
+ ec.message = ASCIILiteral("Failed to execute 'delete' on 'IDBObjectStore': The transaction is read-only.");
+ return nullptr;
+ }
+
+ IDBKeyRangeData keyRangeData(keyRange);
+ if (!keyRangeData.isValid()) {
+ ec.code = IDBDatabaseException::DataError;
+ ec.message = ASCIILiteral("Failed to execute 'delete' on 'IDBObjectStore': The parameter is not a valid key range.");
+ return nullptr;
+ }
+
+ Ref<IDBRequest> request = m_transaction->requestDeleteRecord(context, *this, keyRangeData);
+ return WTFMove(request);
+}
+
+RefPtr<WebCore::IDBRequest> IDBObjectStore::deleteFunction(ScriptExecutionContext& context, const Deprecated::ScriptValue& key, ExceptionCodeWithMessage& ec)
+{
+ return modernDelete(context, key.jsValue(), ec);
+}
+
+RefPtr<IDBRequest> IDBObjectStore::modernDelete(ScriptExecutionContext& context, JSC::JSValue key, ExceptionCodeWithMessage& ec)
+{
+ DOMRequestState requestState(&context);
+ RefPtr<IDBKey> idbKey = scriptValueToIDBKey(&requestState, key);
+ if (!idbKey || idbKey->type() == KeyType::Invalid) {
+ ec.code = IDBDatabaseException::DataError;
+ ec.message = ASCIILiteral("Failed to execute 'delete' on 'IDBObjectStore': The parameter is not a valid key.");
+ return nullptr;
+ }
+
+ return doDelete(context, &IDBKeyRange::create(idbKey.get()).get(), ec);
+}
+
+RefPtr<WebCore::IDBRequest> IDBObjectStore::clear(ScriptExecutionContext& context, ExceptionCodeWithMessage& ec)
+{
+ LOG(IndexedDB, "IDBObjectStore::clear");
+
+ // The IDB spec for several IDBObjectStore methods states that transaction related exceptions should fire before
+ // the exception for an object store being deleted.
+ // However, a handful of W3C IDB tests expect the deleted exception even though the transaction inactive exception also applies.
+ // Additionally, Chrome and Edge agree with the test, as does Legacy IDB in WebKit.
+ // Until this is sorted out, we'll agree with the test and the majority share browsers.
+ if (m_deleted) {
+ ec.code = IDBDatabaseException::InvalidStateError;
+ ec.message = ASCIILiteral("Failed to execute 'clear' on 'IDBObjectStore': The object store has been deleted.");
+ return nullptr;
+ }
+
+ if (!m_transaction->isActive()) {
+ ec.code = IDBDatabaseException::TransactionInactiveError;
+ ec.message = ASCIILiteral("Failed to execute 'clear' on 'IDBObjectStore': The transaction is inactive or finished.");
+ return nullptr;
+ }
+
+ if (m_transaction->isReadOnly()) {
+ ec.code = IDBDatabaseException::ReadOnlyError;
+ ec.message = ASCIILiteral("Failed to execute 'clear' on 'IDBObjectStore': The transaction is read-only.");
+ return nullptr;
+ }
+
+ Ref<IDBRequest> request = m_transaction->requestClearObjectStore(context, *this);
+ return adoptRef(request.leakRef());
+}
+
+RefPtr<WebCore::IDBIndex> IDBObjectStore::createIndex(ScriptExecutionContext&, const String& name, const IDBKeyPath& keyPath, bool unique, bool multiEntry, ExceptionCodeWithMessage& ec)
+{
+ LOG(IndexedDB, "IDBObjectStore::createIndex %s", name.utf8().data());
+
+ if (m_deleted) {
+ ec.code = IDBDatabaseException::InvalidStateError;
+ ec.message = ASCIILiteral("Failed to execute 'createIndex' on 'IDBObjectStore': The object store has been deleted.");
+ return nullptr;
+ }
+
+ if (!m_transaction->isVersionChange()) {
+ ec.code = IDBDatabaseException::InvalidStateError;
+ ec.message = ASCIILiteral("Failed to execute 'createIndex' on 'IDBObjectStore': The database is not running a version change transaction.");
+ return nullptr;
+ }
+
+ if (!m_transaction->isActive()) {
+ ec.code = IDBDatabaseException::TransactionInactiveError;
+ return nullptr;
+ }
+
+ if (!keyPath.isValid()) {
+ ec.code = IDBDatabaseException::SyntaxError;
+ ec.message = ASCIILiteral("Failed to execute 'createIndex' on 'IDBObjectStore': The keyPath argument contains an invalid key path.");
+ return nullptr;
+ }
+
+ if (name.isNull()) {
+ ec.code = TypeError;
+ return nullptr;
+ }
+
+ if (m_info.hasIndex(name)) {
+ ec.code = IDBDatabaseException::ConstraintError;
+ ec.message = ASCIILiteral("Failed to execute 'createIndex' on 'IDBObjectStore': An index with the specified name already exists.");
+ return nullptr;
+ }
+
+ if (keyPath.type() == IndexedDB::KeyPathType::Array && multiEntry) {
+ ec.code = IDBDatabaseException::InvalidAccessError;
+ ec.message = ASCIILiteral("Failed to execute 'createIndex' on 'IDBObjectStore': The keyPath argument was an array and the multiEntry option is true.");
+ return nullptr;
+ }
+
+ // Install the new Index into the ObjectStore's info.
+ IDBIndexInfo info = m_info.createNewIndex(name, keyPath, unique, multiEntry);
+ m_transaction->database().didCreateIndexInfo(info);
+
+ // Create the actual IDBObjectStore from the transaction, which also schedules the operation server side.
+ auto index = m_transaction->createIndex(*this, info);
+ RefPtr<IDBIndex> refIndex = index.get();
+
+ Locker<Lock> locker(m_referencedIndexLock);
+ m_referencedIndexes.set(name, WTFMove(index));
+
+ return WTFMove(refIndex);
+}
+
+RefPtr<WebCore::IDBIndex> IDBObjectStore::index(const String& indexName, ExceptionCodeWithMessage& ec)
+{
+ LOG(IndexedDB, "IDBObjectStore::index");
+
+ if (!scriptExecutionContext())
+ return nullptr;
+
+ if (m_deleted) {
+ ec.code = IDBDatabaseException::InvalidStateError;
+ ec.message = ASCIILiteral("Failed to execute 'index' on 'IDBObjectStore': The object store has been deleted.");
+ return nullptr;
+ }
+
+ if (m_transaction->isFinishedOrFinishing()) {
+ ec.code = IDBDatabaseException::InvalidStateError;
+ ec.message = ASCIILiteral("Failed to execute 'index' on 'IDBObjectStore': The transaction is finished.");
+ return nullptr;
+ }
+
+ Locker<Lock> locker(m_referencedIndexLock);
+ auto iterator = m_referencedIndexes.find(indexName);
+ if (iterator != m_referencedIndexes.end())
+ return iterator->value.get();
+
+ auto* info = m_info.infoForExistingIndex(indexName);
+ if (!info) {
+ ec.code = IDBDatabaseException::NotFoundError;
+ ec.message = ASCIILiteral("Failed to execute 'index' on 'IDBObjectStore': The specified index was not found.");
+ return nullptr;
+ }
+
+ auto index = std::make_unique<IDBIndex>(*scriptExecutionContext(), *info, *this);
+ RefPtr<IDBIndex> refIndex = index.get();
+ m_referencedIndexes.set(indexName, WTFMove(index));
+
+ return refIndex;
+}
+
+void IDBObjectStore::deleteIndex(const String& name, ExceptionCodeWithMessage& ec)
+{
+ LOG(IndexedDB, "IDBObjectStore::deleteIndex %s", name.utf8().data());
+
+ if (m_deleted) {
+ ec.code = IDBDatabaseException::InvalidStateError;
+ ec.message = ASCIILiteral("Failed to execute 'deleteIndex' on 'IDBObjectStore': The object store has been deleted.");
+ return;
+ }
+
+ if (!m_transaction->isVersionChange()) {
+ ec.code = IDBDatabaseException::InvalidStateError;
+ ec.message = ASCIILiteral("Failed to execute 'deleteIndex' on 'IDBObjectStore': The database is not running a version change transaction.");
+ return;
+ }
+
+ if (!m_transaction->isActive()) {
+ ec.code = IDBDatabaseException::TransactionInactiveError;
+ ec.message = ASCIILiteral("Failed to execute 'deleteIndex' on 'IDBObjectStore': The transaction is inactive or finished.");
+ return;
+ }
+
+ if (!m_info.hasIndex(name)) {
+ ec.code = IDBDatabaseException::NotFoundError;
+ ec.message = ASCIILiteral("Failed to execute 'deleteIndex' on 'IDBObjectStore': The specified index was not found.");
+ return;
+ }
+
+ auto* info = m_info.infoForExistingIndex(name);
+ ASSERT(info);
+ m_transaction->database().didDeleteIndexInfo(*info);
+
+ m_info.deleteIndex(name);
+
+ {
+ Locker<Lock> locker(m_referencedIndexLock);
+ if (auto index = m_referencedIndexes.take(name)) {
+ index->markAsDeleted();
+ m_deletedIndexes.add(WTFMove(index));
+ }
+
+ }
+
+ m_transaction->deleteIndex(m_info.identifier(), name);
+}
+
+RefPtr<WebCore::IDBRequest> IDBObjectStore::count(ScriptExecutionContext& context, ExceptionCodeWithMessage& ec)
+{
+ LOG(IndexedDB, "IDBObjectStore::count");
+
+ return doCount(context, IDBKeyRangeData::allKeys(), ec);
+}
+
+RefPtr<WebCore::IDBRequest> IDBObjectStore::count(ScriptExecutionContext& context, const Deprecated::ScriptValue& key, ExceptionCodeWithMessage& ec)
+{
+ LOG(IndexedDB, "IDBObjectStore::count");
+
+ DOMRequestState requestState(&context);
+ RefPtr<IDBKey> idbKey = scriptValueToIDBKey(&requestState, key);
+ if (!idbKey || idbKey->type() == KeyType::Invalid) {
+ ec.code = IDBDatabaseException::DataError;
+ ec.message = ASCIILiteral("Failed to execute 'count' on 'IDBObjectStore': The parameter is not a valid key.");
+ return nullptr;
+ }
+
+ return doCount(context, IDBKeyRangeData(idbKey.get()), ec);
+}
+
+RefPtr<WebCore::IDBRequest> IDBObjectStore::count(ScriptExecutionContext& context, IDBKeyRange* range, ExceptionCodeWithMessage& ec)
+{
+ LOG(IndexedDB, "IDBObjectStore::count");
+
+ return doCount(context, range ? IDBKeyRangeData(range) : IDBKeyRangeData::allKeys(), ec);
+}
+
+RefPtr<WebCore::IDBRequest> IDBObjectStore::doCount(ScriptExecutionContext& context, const IDBKeyRangeData& range, ExceptionCodeWithMessage& ec)
+{
+ // The IDB spec for several IDBObjectStore methods states that transaction related exceptions should fire before
+ // the exception for an object store being deleted.
+ // However, a handful of W3C IDB tests expect the deleted exception even though the transaction inactive exception also applies.
+ // Additionally, Chrome and Edge agree with the test, as does Legacy IDB in WebKit.
+ // Until this is sorted out, we'll agree with the test and the majority share browsers.
+ if (m_deleted) {
+ ec.code = IDBDatabaseException::InvalidStateError;
+ ec.message = ASCIILiteral("Failed to execute 'count' on 'IDBObjectStore': The object store has been deleted.");
+ return nullptr;
+ }
+
+ if (!m_transaction->isActive()) {
+ ec.code = IDBDatabaseException::TransactionInactiveError;
+ ec.message = ASCIILiteral("Failed to execute 'count' on 'IDBObjectStore': The transaction is inactive or finished.");
+ return nullptr;
+ }
+
+ if (!range.isValid()) {
+ ec.code = IDBDatabaseException::DataError;
+ return nullptr;
+ }
+
+ return m_transaction->requestCount(context, *this, range);
+}
+
+void IDBObjectStore::markAsDeleted()
+{
+ m_deleted = true;
+}
+
+void IDBObjectStore::rollbackInfoForVersionChangeAbort()
+{
+ m_info = m_originalInfo;
+}
+
+void IDBObjectStore::visitReferencedIndexes(JSC::SlotVisitor& visitor) const
+{
+ Locker<Lock> locker(m_referencedIndexLock);
+ for (auto& index : m_referencedIndexes.values())
+ visitor.addOpaqueRoot(index.get());
+}
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx">
</span><span class="cx"> #endif // ENABLE(INDEXED_DATABASE)
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBObjectStoreh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.h (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.h        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.h        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -23,83 +23,106 @@
</span><span class="cx"> * THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><del>-#ifndef IDBObjectStore_h
-#define IDBObjectStore_h
</del><ins>+#pragma once
</ins><span class="cx">
</span><del>-#include "Dictionary.h"
-#include "ExceptionCode.h"
-#include "ScriptWrappable.h"
-#include <wtf/RefCounted.h>
-#include <wtf/RefPtr.h>
-#include <wtf/text/WTFString.h>
-
</del><span class="cx"> #if ENABLE(INDEXED_DATABASE)
</span><span class="cx">
</span><del>-namespace Deprecated {
-class ScriptValue;
-}
</del><ins>+#include "ActiveDOMObject.h"
+#include "IDBIndex.h"
+#include "IDBObjectStore.h"
+#include "IDBObjectStoreInfo.h"
+#include "IndexedDB.h"
</ins><span class="cx">
</span><del>-namespace JSC {
-class ExecState;
-class JSValue;
-}
-
</del><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="cx"> class DOMStringList;
</span><span class="cx"> class IDBAny;
</span><span class="cx"> class IDBIndex;
</span><del>-class IDBKeyPath;
</del><ins>+class IDBKey;
</ins><span class="cx"> class IDBKeyRange;
</span><span class="cx"> class IDBRequest;
</span><span class="cx"> class IDBTransaction;
</span><del>-class ScriptExecutionContext;
</del><ins>+struct IDBKeyRangeData;
</ins><span class="cx">
</span><del>-class IDBObjectStore : public RefCounted<IDBObjectStore> {
</del><ins>+class IDBObjectStore : public RefCounted<IDBObjectStore>, public ActiveDOMObject {
</ins><span class="cx"> public:
</span><del>- virtual ~IDBObjectStore() { }
</del><ins>+ static Ref<IDBObjectStore> create(ScriptExecutionContext&, const IDBObjectStoreInfo&, IDBTransaction&);
</ins><span class="cx">
</span><ins>+ ~IDBObjectStore();
+
</ins><span class="cx"> // Implement the IDBObjectStore IDL
</span><del>- virtual const String name() const = 0;
- virtual RefPtr<IDBAny> keyPathAny() const = 0;
- virtual const IDBKeyPath keyPath() const = 0;
- virtual RefPtr<DOMStringList> indexNames() const = 0;
- virtual RefPtr<IDBTransaction> transaction() = 0;
- virtual bool autoIncrement() const = 0;
</del><ins>+ const String name() const;
+ RefPtr<IDBAny> keyPathAny() const;
+ const IDBKeyPath keyPath() const;
+ RefPtr<DOMStringList> indexNames() const;
+ RefPtr<IDBTransaction> transaction();
+ bool autoIncrement() const;
</ins><span class="cx">
</span><del>- virtual RefPtr<IDBRequest> add(JSC::ExecState&, JSC::JSValue, ExceptionCodeWithMessage&) = 0;
- virtual RefPtr<IDBRequest> put(JSC::ExecState&, JSC::JSValue, ExceptionCodeWithMessage&) = 0;
- virtual RefPtr<IDBRequest> openCursor(ScriptExecutionContext&, ExceptionCodeWithMessage&) = 0;
- virtual RefPtr<IDBRequest> openCursor(ScriptExecutionContext&, IDBKeyRange*, ExceptionCodeWithMessage&) = 0;
- virtual RefPtr<IDBRequest> openCursor(ScriptExecutionContext&, const Deprecated::ScriptValue& key, ExceptionCodeWithMessage&) = 0;
- virtual RefPtr<IDBRequest> openCursor(ScriptExecutionContext&, IDBKeyRange*, const String& direction, ExceptionCodeWithMessage&) = 0;
- virtual RefPtr<IDBRequest> openCursor(ScriptExecutionContext&, const Deprecated::ScriptValue& key, const String& direction, ExceptionCodeWithMessage&) = 0;
</del><ins>+ RefPtr<IDBRequest> add(JSC::ExecState&, JSC::JSValue, ExceptionCodeWithMessage&);
+ RefPtr<IDBRequest> put(JSC::ExecState&, JSC::JSValue, ExceptionCodeWithMessage&);
+ RefPtr<IDBRequest> openCursor(ScriptExecutionContext&, ExceptionCodeWithMessage&);
+ RefPtr<IDBRequest> openCursor(ScriptExecutionContext&, IDBKeyRange*, ExceptionCodeWithMessage&);
+ RefPtr<IDBRequest> openCursor(ScriptExecutionContext&, const Deprecated::ScriptValue& key, ExceptionCodeWithMessage&);
+ RefPtr<IDBRequest> openCursor(ScriptExecutionContext&, IDBKeyRange*, const String& direction, ExceptionCodeWithMessage&);
+ RefPtr<IDBRequest> openCursor(ScriptExecutionContext&, const Deprecated::ScriptValue& key, const String& direction, ExceptionCodeWithMessage&);
+ RefPtr<IDBRequest> get(ScriptExecutionContext&, const Deprecated::ScriptValue& key, ExceptionCodeWithMessage&);
+ RefPtr<IDBRequest> get(ScriptExecutionContext&, IDBKeyRange*, ExceptionCodeWithMessage&);
+ RefPtr<IDBRequest> add(JSC::ExecState&, JSC::JSValue, JSC::JSValue key, ExceptionCodeWithMessage&);
+ RefPtr<IDBRequest> put(JSC::ExecState&, JSC::JSValue, JSC::JSValue key, ExceptionCodeWithMessage&);
+ RefPtr<IDBRequest> deleteFunction(ScriptExecutionContext&, IDBKeyRange*, ExceptionCodeWithMessage&);
+ RefPtr<IDBRequest> deleteFunction(ScriptExecutionContext&, const Deprecated::ScriptValue& key, ExceptionCodeWithMessage&);
+ RefPtr<IDBRequest> clear(ScriptExecutionContext&, ExceptionCodeWithMessage&);
+ RefPtr<IDBIndex> createIndex(ScriptExecutionContext&, const String& name, const IDBKeyPath&, bool unique, bool multiEntry, ExceptionCodeWithMessage&);
+ RefPtr<IDBIndex> index(const String& name, ExceptionCodeWithMessage&);
+ void deleteIndex(const String& name, ExceptionCodeWithMessage&);
+ RefPtr<IDBRequest> count(ScriptExecutionContext&, ExceptionCodeWithMessage&);
+ RefPtr<IDBRequest> count(ScriptExecutionContext&, IDBKeyRange*, ExceptionCodeWithMessage&);
+ RefPtr<IDBRequest> count(ScriptExecutionContext&, const Deprecated::ScriptValue& key, ExceptionCodeWithMessage&);
</ins><span class="cx">
</span><del>- virtual RefPtr<IDBRequest> get(ScriptExecutionContext&, const Deprecated::ScriptValue& key, ExceptionCodeWithMessage&) = 0;
- virtual RefPtr<IDBRequest> get(ScriptExecutionContext&, IDBKeyRange*, ExceptionCodeWithMessage&) = 0;
- virtual RefPtr<IDBRequest> add(JSC::ExecState&, JSC::JSValue, JSC::JSValue key, ExceptionCodeWithMessage&) = 0;
- virtual RefPtr<IDBRequest> put(JSC::ExecState&, JSC::JSValue, JSC::JSValue key, ExceptionCodeWithMessage&) = 0;
- virtual RefPtr<IDBRequest> deleteFunction(ScriptExecutionContext&, IDBKeyRange*, ExceptionCodeWithMessage&) = 0;
- virtual RefPtr<IDBRequest> deleteFunction(ScriptExecutionContext&, const Deprecated::ScriptValue& key, ExceptionCodeWithMessage&) = 0;
- virtual RefPtr<IDBRequest> clear(ScriptExecutionContext&, ExceptionCodeWithMessage&) = 0;
</del><ins>+ RefPtr<IDBRequest> putForCursorUpdate(JSC::ExecState&, JSC::JSValue, JSC::JSValue key, ExceptionCodeWithMessage&);
+ RefPtr<IDBRequest> modernDelete(ScriptExecutionContext&, JSC::JSValue key, ExceptionCodeWithMessage&);
</ins><span class="cx">
</span><del>- virtual RefPtr<IDBIndex> createIndex(ScriptExecutionContext&, const String& name, const IDBKeyPath&, bool unique, bool multiEntry, ExceptionCodeWithMessage&) = 0;
</del><ins>+ void markAsDeleted();
+ bool isDeleted() const { return m_deleted; }
</ins><span class="cx">
</span><del>- virtual RefPtr<IDBIndex> index(const String& name, ExceptionCodeWithMessage&) = 0;
- virtual void deleteIndex(const String& name, ExceptionCodeWithMessage&) = 0;
</del><ins>+ const IDBObjectStoreInfo& info() const { return m_info; }
</ins><span class="cx">
</span><del>- virtual RefPtr<IDBRequest> count(ScriptExecutionContext&, ExceptionCodeWithMessage&) = 0;
- virtual RefPtr<IDBRequest> count(ScriptExecutionContext&, IDBKeyRange*, ExceptionCodeWithMessage&) = 0;
- virtual RefPtr<IDBRequest> count(ScriptExecutionContext&, const Deprecated::ScriptValue& key, ExceptionCodeWithMessage&) = 0;
</del><ins>+ // FIXME: After removing LegacyIDB and folding abstract/implementation classes together,
+ // this will no longer be necessary.
+ IDBTransaction& modernTransaction() { return m_transaction.get(); }
</ins><span class="cx">
</span><del>- virtual bool isModern() const { return false; }
</del><ins>+ void rollbackInfoForVersionChangeAbort();
</ins><span class="cx">
</span><del>-protected:
- IDBObjectStore();
</del><ins>+ void visitReferencedIndexes(JSC::SlotVisitor&) const;
+
+private:
+ IDBObjectStore(ScriptExecutionContext&, const IDBObjectStoreInfo&, IDBTransaction&);
+
+ enum class InlineKeyCheck {
+ Perform,
+ DoNotPerform,
+ };
+
+ RefPtr<IDBRequest> putOrAdd(JSC::ExecState&, JSC::JSValue, RefPtr<IDBKey>, IndexedDB::ObjectStoreOverwriteMode, InlineKeyCheck, ExceptionCodeWithMessage&);
+ RefPtr<WebCore::IDBRequest> doCount(ScriptExecutionContext&, const IDBKeyRangeData&, ExceptionCodeWithMessage&);
+ RefPtr<IDBRequest> doDelete(ScriptExecutionContext&, IDBKeyRange*, ExceptionCodeWithMessage&);
+
+ // ActiveDOMObject
+ const char* activeDOMObjectName() const;
+ bool canSuspendForDocumentSuspension() const;
+ bool hasPendingActivity() const;
+
+ IDBObjectStoreInfo m_info;
+ IDBObjectStoreInfo m_originalInfo;
+ Ref<IDBTransaction> m_transaction;
+
+ bool m_deleted { false };
+
+ mutable Lock m_referencedIndexLock;
+ HashMap<String, std::unique_ptr<IDBIndex>> m_referencedIndexes;
+ HashSet<std::unique_ptr<IDBIndex>> m_deletedIndexes;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span><span class="cx">
</span><del>-#endif
-
-#endif // IDBObjectStore_h
</del><ins>+#endif // ENABLE(INDEXED_DATABASE)
</ins></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBOpenDBRequestcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBOpenDBRequest.cpp (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBOpenDBRequest.cpp        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBOpenDBRequest.cpp        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -28,13 +28,185 @@
</span><span class="cx">
</span><span class="cx"> #if ENABLE(INDEXED_DATABASE)
</span><span class="cx">
</span><ins>+#include "IDBDatabase.h"
+#include "IDBError.h"
+#include "IDBRequestCompletionEvent.h"
+#include "IDBResultData.h"
+#include "IDBTransaction.h"
+#include "IDBVersionChangeEvent.h"
+#include "Logging.h"
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-IDBOpenDBRequest::IDBOpenDBRequest(ScriptExecutionContext& context)
- : IDBRequest(context)
</del><ins>+Ref<IDBOpenDBRequest> IDBOpenDBRequest::createDeleteRequest(IDBClient::IDBConnectionToServer& connection, ScriptExecutionContext& context, const IDBDatabaseIdentifier& databaseIdentifier)
</ins><span class="cx"> {
</span><ins>+ ASSERT(databaseIdentifier.isValid());
+ return adoptRef(*new IDBOpenDBRequest(connection, context, databaseIdentifier, 0, IndexedDB::RequestType::Delete));
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+Ref<IDBOpenDBRequest> IDBOpenDBRequest::createOpenRequest(IDBClient::IDBConnectionToServer& connection, ScriptExecutionContext& context, const IDBDatabaseIdentifier& databaseIdentifier, uint64_t version)
+{
+ ASSERT(databaseIdentifier.isValid());
+ return adoptRef(*new IDBOpenDBRequest(connection, context, databaseIdentifier, version, IndexedDB::RequestType::Open));
+}
+
+IDBOpenDBRequest::IDBOpenDBRequest(IDBClient::IDBConnectionToServer& connection, ScriptExecutionContext& context, const IDBDatabaseIdentifier& databaseIdentifier, uint64_t version, IndexedDB::RequestType requestType)
+ : IDBRequest(connection, context)
+ , m_databaseIdentifier(databaseIdentifier)
+ , m_version(version)
+{
+ m_requestType = requestType;
+}
+
+IDBOpenDBRequest::~IDBOpenDBRequest()
+{
+}
+
+void IDBOpenDBRequest::onError(const IDBResultData& data)
+{
+ m_domError = DOMError::create(data.error().name());
+ enqueueEvent(IDBRequestCompletionEvent::create(eventNames().errorEvent, true, true, *this));
+}
+
+void IDBOpenDBRequest::versionChangeTransactionDidFinish()
+{
+ // 3.3.7 "versionchange" transaction steps
+ // When the transaction is finished, after firing complete/abort on the transaction, immediately set request's transaction property to null.
+ m_shouldExposeTransactionToDOM = false;
+}
+
+void IDBOpenDBRequest::fireSuccessAfterVersionChangeCommit()
+{
+ LOG(IndexedDB, "IDBOpenDBRequest::fireSuccessAfterVersionChangeCommit()");
+
+ ASSERT(hasPendingActivity());
+ ASSERT(m_result);
+ ASSERT(m_result->type() == IDBAny::Type::IDBDatabase);
+ m_transaction->addRequest(*this);
+
+ auto event = IDBRequestCompletionEvent::create(eventNames().successEvent, false, false, *this);
+ m_openDatabaseSuccessEvent = &event.get();
+
+ enqueueEvent(WTFMove(event));
+}
+
+void IDBOpenDBRequest::fireErrorAfterVersionChangeCompletion()
+{
+ LOG(IndexedDB, "IDBOpenDBRequest::fireErrorAfterVersionChangeCompletion()");
+
+ ASSERT(hasPendingActivity());
+
+ IDBError idbError(IDBDatabaseException::AbortError);
+ m_domError = DOMError::create(idbError.name());
+ m_result = IDBAny::createUndefined();
+
+ m_transaction->addRequest(*this);
+ enqueueEvent(IDBRequestCompletionEvent::create(eventNames().errorEvent, true, true, *this));
+}
+
+bool IDBOpenDBRequest::dispatchEvent(Event& event)
+{
+ bool result = IDBRequest::dispatchEvent(event);
+
+ if (m_transaction && m_transaction->isVersionChange() && (event.type() == eventNames().errorEvent || event.type() == eventNames().successEvent))
+ m_transaction->database().serverConnection().didFinishHandlingVersionChangeTransaction(*m_transaction);
+
+ return result;
+}
+
+void IDBOpenDBRequest::onSuccess(const IDBResultData& resultData)
+{
+ LOG(IndexedDB, "IDBOpenDBRequest::onSuccess()");
+
+ if (!scriptExecutionContext())
+ return;
+
+ Ref<IDBDatabase> database = IDBDatabase::create(*scriptExecutionContext(), connection(), resultData);
+ m_result = IDBAny::create(WTFMove(database));
+ m_readyState = IDBRequestReadyState::Done;
+
+ enqueueEvent(IDBRequestCompletionEvent::create(eventNames().successEvent, false, false, *this));
+}
+
+void IDBOpenDBRequest::onUpgradeNeeded(const IDBResultData& resultData)
+{
+ Ref<IDBDatabase> database = IDBDatabase::create(*scriptExecutionContext(), connection(), resultData);
+ Ref<IDBTransaction> transaction = database->startVersionChangeTransaction(resultData.transactionInfo(), *this);
+
+ ASSERT(transaction->info().mode() == IndexedDB::TransactionMode::VersionChange);
+ ASSERT(transaction->originalDatabaseInfo());
+
+ uint64_t oldVersion = transaction->originalDatabaseInfo()->version();
+ uint64_t newVersion = transaction->info().newVersion();
+
+ LOG(IndexedDB, "IDBOpenDBRequest::onUpgradeNeeded() - current version is %" PRIu64 ", new is %" PRIu64, oldVersion, newVersion);
+
+ m_result = IDBAny::create(WTFMove(database));
+ m_readyState = IDBRequestReadyState::Done;
+ m_transaction = adoptRef(&transaction.leakRef());
+ m_transaction->addRequest(*this);
+
+ enqueueEvent(IDBVersionChangeEvent::create(oldVersion, newVersion, eventNames().upgradeneededEvent));
+}
+
+void IDBOpenDBRequest::onDeleteDatabaseSuccess(const IDBResultData& resultData)
+{
+ uint64_t oldVersion = resultData.databaseInfo().version();
+
+ LOG(IndexedDB, "IDBOpenDBRequest::onDeleteDatabaseSuccess() - current version is %" PRIu64, oldVersion);
+
+ m_readyState = IDBRequestReadyState::Done;
+ m_result = IDBAny::createUndefined();
+
+ enqueueEvent(IDBVersionChangeEvent::create(oldVersion, 0, eventNames().successEvent));
+}
+
+void IDBOpenDBRequest::requestCompleted(const IDBResultData& data)
+{
+ LOG(IndexedDB, "IDBOpenDBRequest::requestCompleted");
+
+ // If an Open request was completed after the page has navigated, leaving this request
+ // with a stopped script execution context, we need to message back to the server so it
+ // doesn't hang waiting on a database connection or transaction that will never exist.
+ if (m_contextStopped) {
+ switch (data.type()) {
+ case IDBResultType::OpenDatabaseSuccess:
+ connection().abortOpenAndUpgradeNeeded(data.databaseConnectionIdentifier(), IDBResourceIdentifier::emptyValue());
+ break;
+ case IDBResultType::OpenDatabaseUpgradeNeeded:
+ connection().abortOpenAndUpgradeNeeded(data.databaseConnectionIdentifier(), data.transactionInfo().identifier());
+ break;
+ default:
+ break;
+ }
+
+ return;
+ }
+
+ switch (data.type()) {
+ case IDBResultType::Error:
+ onError(data);
+ break;
+ case IDBResultType::OpenDatabaseSuccess:
+ onSuccess(data);
+ break;
+ case IDBResultType::OpenDatabaseUpgradeNeeded:
+ onUpgradeNeeded(data);
+ break;
+ case IDBResultType::DeleteDatabaseSuccess:
+ onDeleteDatabaseSuccess(data);
+ break;
+ default:
+ RELEASE_ASSERT_NOT_REACHED();
+ }
+}
+
+void IDBOpenDBRequest::requestBlocked(uint64_t oldVersion, uint64_t newVersion)
+{
+ LOG(IndexedDB, "IDBOpenDBRequest::requestBlocked");
+ enqueueEvent(IDBVersionChangeEvent::create(oldVersion, newVersion, eventNames().blockedEvent));
+}
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx">
</span><span class="cx"> #endif // ENABLE(INDEXED_DATABASE)
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBOpenDBRequesth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBOpenDBRequest.h (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBOpenDBRequest.h        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBOpenDBRequest.h        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -23,26 +23,58 @@
</span><span class="cx"> * THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><del>-#ifndef IDBOpenDBRequest_h
-#define IDBOpenDBRequest_h
</del><ins>+#pragma once
</ins><span class="cx">
</span><span class="cx"> #if ENABLE(INDEXED_DATABASE)
</span><span class="cx">
</span><ins>+#include "DOMError.h"
+#include "IDBDatabaseIdentifier.h"
</ins><span class="cx"> #include "IDBRequest.h"
</span><del>-#include "IndexedDB.h"
</del><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><ins>+class Event;
+class IDBDatabaseIdentifier;
+class IDBResultData;
+class ScriptExecutionContext;
+
+namespace IDBClient {
+class IDBConnectionToServer;
+}
+
</ins><span class="cx"> class IDBOpenDBRequest : public IDBRequest {
</span><span class="cx"> public:
</span><del>- virtual ~IDBOpenDBRequest() { }
</del><ins>+ static Ref<IDBOpenDBRequest> createDeleteRequest(IDBClient::IDBConnectionToServer&, ScriptExecutionContext&, const IDBDatabaseIdentifier&);
+ static Ref<IDBOpenDBRequest> createOpenRequest(IDBClient::IDBConnectionToServer&, ScriptExecutionContext&, const IDBDatabaseIdentifier&, uint64_t version);
</ins><span class="cx">
</span><del>-protected:
- IDBOpenDBRequest(ScriptExecutionContext&);
</del><ins>+ ~IDBOpenDBRequest() final;
+
+ const IDBDatabaseIdentifier& databaseIdentifier() const { return m_databaseIdentifier; }
+ uint64_t version() const { return m_version; }
+
+ void requestCompleted(const IDBResultData&);
+ void requestBlocked(uint64_t oldVersion, uint64_t newVersion);
+
+ void versionChangeTransactionDidFinish();
+ void fireSuccessAfterVersionChangeCommit();
+ void fireErrorAfterVersionChangeCompletion();
+
+ bool dispatchEvent(Event&) final;
+
+private:
+ IDBOpenDBRequest(IDBClient::IDBConnectionToServer&, ScriptExecutionContext&, const IDBDatabaseIdentifier&, uint64_t version, IndexedDB::RequestType);
+
+ void onError(const IDBResultData&);
+ void onSuccess(const IDBResultData&);
+ void onUpgradeNeeded(const IDBResultData&);
+ void onDeleteDatabaseSuccess(const IDBResultData&);
+
+ bool isOpenDBRequest() const override { return true; }
+
+ IDBDatabaseIdentifier m_databaseIdentifier;
+ uint64_t m_version { 0 };
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span><span class="cx">
</span><span class="cx"> #endif // ENABLE(INDEXED_DATABASE)
</span><del>-
-#endif // IDBOpenDBRequest_h
</del></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBRequestcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBRequest.cpp (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBRequest.cpp        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBRequest.cpp        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -28,13 +28,410 @@
</span><span class="cx">
</span><span class="cx"> #if ENABLE(INDEXED_DATABASE)
</span><span class="cx">
</span><ins>+#include "DOMError.h"
+#include "DOMRequestState.h"
+#include "Event.h"
+#include "EventQueue.h"
+#include "IDBBindingUtilities.h"
+#include "IDBCursor.h"
+#include "IDBDatabase.h"
+#include "IDBDatabaseException.h"
+#include "IDBEventDispatcher.h"
+#include "IDBKeyData.h"
+#include "IDBResultData.h"
+#include "Logging.h"
+#include "ScriptExecutionContext.h"
+#include "ThreadSafeDataBuffer.h"
+#include <wtf/NeverDestroyed.h>
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-IDBRequest::IDBRequest(ScriptExecutionContext& context)
</del><ins>+Ref<IDBRequest> IDBRequest::create(ScriptExecutionContext& context, IDBObjectStore& objectStore, IDBTransaction& transaction)
+{
+ return adoptRef(*new IDBRequest(context, objectStore, transaction));
+}
+
+Ref<IDBRequest> IDBRequest::create(ScriptExecutionContext& context, IDBCursor& cursor, IDBTransaction& transaction)
+{
+ return adoptRef(*new IDBRequest(context, cursor, transaction));
+}
+
+Ref<IDBRequest> IDBRequest::createCount(ScriptExecutionContext& context, IDBIndex& index, IDBTransaction& transaction)
+{
+ return adoptRef(*new IDBRequest(context, index, transaction));
+}
+
+Ref<IDBRequest> IDBRequest::createGet(ScriptExecutionContext& context, IDBIndex& index, IndexedDB::IndexRecordType requestedRecordType, IDBTransaction& transaction)
+{
+ return adoptRef(*new IDBRequest(context, index, requestedRecordType, transaction));
+}
+
+IDBRequest::IDBRequest(IDBClient::IDBConnectionToServer& connection, ScriptExecutionContext& context)
</ins><span class="cx"> : ActiveDOMObject(&context)
</span><ins>+ , m_connection(connection)
+ , m_resourceIdentifier(connection)
</ins><span class="cx"> {
</span><ins>+ suspendIfNeeded();
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+IDBRequest::IDBRequest(ScriptExecutionContext& context, IDBObjectStore& objectStore, IDBTransaction& transaction)
+ : ActiveDOMObject(&context)
+ , m_transaction(&transaction)
+ , m_connection(transaction.serverConnection())
+ , m_resourceIdentifier(transaction.serverConnection())
+ , m_source(IDBAny::create(objectStore))
+{
+ suspendIfNeeded();
+}
+
+IDBRequest::IDBRequest(ScriptExecutionContext& context, IDBCursor& cursor, IDBTransaction& transaction)
+ : ActiveDOMObject(&context)
+ , m_transaction(&transaction)
+ , m_connection(transaction.serverConnection())
+ , m_resourceIdentifier(transaction.serverConnection())
+ , m_source(cursor.source())
+ , m_pendingCursor(&cursor)
+{
+ suspendIfNeeded();
+
+ cursor.setRequest(*this);
+}
+
+IDBRequest::IDBRequest(ScriptExecutionContext& context, IDBIndex& index, IDBTransaction& transaction)
+ : ActiveDOMObject(&context)
+ , m_transaction(&transaction)
+ , m_connection(transaction.serverConnection())
+ , m_resourceIdentifier(transaction.serverConnection())
+ , m_source(IDBAny::create(index))
+{
+ suspendIfNeeded();
+}
+
+IDBRequest::IDBRequest(ScriptExecutionContext& context, IDBIndex& index, IndexedDB::IndexRecordType requestedRecordType, IDBTransaction& transaction)
+ : IDBRequest(context, index, transaction)
+{
+ m_requestedIndexRecordType = requestedRecordType;
+}
+
+IDBRequest::~IDBRequest()
+{
+ if (m_result) {
+ auto type = m_result->type();
+ if (type == IDBAny::Type::IDBCursor || type == IDBAny::Type::IDBCursorWithValue)
+ m_result->idbCursor()->clearRequest();
+ }
+}
+
+RefPtr<WebCore::IDBAny> IDBRequest::result(ExceptionCodeWithMessage& ec) const
+{
+ if (m_readyState == IDBRequestReadyState::Done)
+ return m_result;
+
+ ec.code = IDBDatabaseException::InvalidStateError;
+ ec.message = ASCIILiteral("Failed to read the 'result' property from 'IDBRequest': The request has not finished.");
+ return nullptr;
+}
+
+unsigned short IDBRequest::errorCode(ExceptionCode&) const
+{
+ return 0;
+}
+
+RefPtr<DOMError> IDBRequest::error(ExceptionCodeWithMessage& ec) const
+{
+ if (m_readyState == IDBRequestReadyState::Done)
+ return m_domError;
+
+ ec.code = IDBDatabaseException::InvalidStateError;
+ ec.message = ASCIILiteral("Failed to read the 'error' property from 'IDBRequest': The request has not finished.");
+ return nullptr;
+}
+
+RefPtr<WebCore::IDBAny> IDBRequest::source() const
+{
+ return m_source;
+}
+
+void IDBRequest::setSource(IDBCursor& cursor)
+{
+ ASSERT(!m_cursorRequestNotifier);
+
+ m_source = IDBAny::create(cursor);
+ m_cursorRequestNotifier = std::make_unique<ScopeGuard>([this]() {
+ ASSERT(m_source->type() == IDBAny::Type::IDBCursor || m_source->type() == IDBAny::Type::IDBCursorWithValue);
+ m_source->idbCursor()->decrementOutstandingRequestCount();
+ });
+}
+
+void IDBRequest::setVersionChangeTransaction(IDBTransaction& transaction)
+{
+ ASSERT(!m_transaction);
+ ASSERT(transaction.isVersionChange());
+ ASSERT(!transaction.isFinishedOrFinishing());
+
+ m_transaction = &transaction;
+}
+
+RefPtr<WebCore::IDBTransaction> IDBRequest::transaction() const
+{
+ return m_shouldExposeTransactionToDOM ? m_transaction : nullptr;
+}
+
+const String& IDBRequest::readyState() const
+{
+ static WTF::NeverDestroyed<String> pendingString("pending");
+ static WTF::NeverDestroyed<String> doneString("done");
+
+ switch (m_readyState) {
+ case IDBRequestReadyState::Pending:
+ return pendingString;
+ case IDBRequestReadyState::Done:
+ return doneString;
+ default:
+ RELEASE_ASSERT_NOT_REACHED();
+ }
+}
+
+uint64_t IDBRequest::sourceObjectStoreIdentifier() const
+{
+ if (!m_source)
+ return 0;
+
+ if (m_source->type() == IDBAny::Type::IDBObjectStore) {
+ auto* objectStore = m_source->idbObjectStore().get();
+ if (!objectStore)
+ return 0;
+ return objectStore->info().identifier();
+ }
+
+ if (m_source->type() == IDBAny::Type::IDBIndex) {
+ auto* index = m_source->idbIndex().get();
+ if (!index)
+ return 0;
+ return index->info().objectStoreIdentifier();
+ }
+
+ return 0;
+}
+
+uint64_t IDBRequest::sourceIndexIdentifier() const
+{
+ if (!m_source)
+ return 0;
+ if (m_source->type() != IDBAny::Type::IDBIndex)
+ return 0;
+ if (!m_source->idbIndex())
+ return 0;
+
+ return m_source->idbIndex()->info().identifier();
+}
+
+IndexedDB::IndexRecordType IDBRequest::requestedIndexRecordType() const
+{
+ ASSERT(m_source);
+ ASSERT(m_source->type() == IDBAny::Type::IDBIndex);
+
+ return m_requestedIndexRecordType;
+}
+
+EventTargetInterface IDBRequest::eventTargetInterface() const
+{
+ return IDBRequestEventTargetInterfaceType;
+}
+
+const char* IDBRequest::activeDOMObjectName() const
+{
+ return "IDBRequest";
+}
+
+bool IDBRequest::canSuspendForDocumentSuspension() const
+{
+ return false;
+}
+
+bool IDBRequest::hasPendingActivity() const
+{
+ return m_hasPendingActivity;
+}
+
+void IDBRequest::stop()
+{
+ ASSERT(!m_contextStopped);
+ m_contextStopped = true;
+}
+
+void IDBRequest::enqueueEvent(Ref<Event>&& event)
+{
+ if (!scriptExecutionContext() || m_contextStopped)
+ return;
+
+ event->setTarget(this);
+ scriptExecutionContext()->eventQueue().enqueueEvent(WTFMove(event));
+}
+
+bool IDBRequest::dispatchEvent(Event& event)
+{
+ LOG(IndexedDB, "IDBRequest::dispatchEvent - %s (%p)", event.type().string().utf8().data(), this);
+
+ ASSERT(m_hasPendingActivity);
+ ASSERT(!m_contextStopped);
+
+ if (event.type() != eventNames().blockedEvent)
+ m_readyState = IDBRequestReadyState::Done;
+
+ Vector<RefPtr<EventTarget>> targets;
+ targets.append(this);
+
+ if (&event == m_openDatabaseSuccessEvent)
+ m_openDatabaseSuccessEvent = nullptr;
+ else if (m_transaction && !m_transaction->isFinished()) {
+ targets.append(m_transaction);
+ targets.append(m_transaction->db());
+ }
+
+ m_hasPendingActivity = false;
+
+ m_cursorRequestNotifier = nullptr;
+
+ bool dontPreventDefault;
+ {
+ TransactionActivator activator(m_transaction.get());
+ dontPreventDefault = IDBEventDispatcher::dispatch(event, targets);
+ }
+
+ // IDBEventDispatcher::dispatch() might have set the pending activity flag back to true, suggesting the request will be reused.
+ // We might also re-use the request if this event was the upgradeneeded event for an IDBOpenDBRequest.
+ if (!m_hasPendingActivity)
+ m_hasPendingActivity = isOpenDBRequest() && (event.type() == eventNames().upgradeneededEvent || event.type() == eventNames().blockedEvent);
+
+ // The request should only remain in the transaction's request list if it represents a pending cursor operation, or this is an open request that was blocked.
+ if (m_transaction && !m_pendingCursor && event.type() != eventNames().blockedEvent)
+ m_transaction->removeRequest(*this);
+
+ if (dontPreventDefault && event.type() == eventNames().errorEvent && m_transaction && !m_transaction->isFinishedOrFinishing()) {
+ ASSERT(m_domError);
+ m_transaction->abortDueToFailedRequest(*m_domError);
+ }
+
+ return dontPreventDefault;
+}
+
+void IDBRequest::uncaughtExceptionInEventHandler()
+{
+ LOG(IndexedDB, "IDBRequest::uncaughtExceptionInEventHandler");
+
+ if (m_transaction && m_idbError.code() != IDBDatabaseException::AbortError)
+ m_transaction->abortDueToFailedRequest(DOMError::create(IDBDatabaseException::getErrorName(IDBDatabaseException::AbortError)));
+}
+
+void IDBRequest::setResult(const IDBKeyData* keyData)
+{
+ if (!keyData) {
+ m_result = nullptr;
+ return;
+ }
+
+ Deprecated::ScriptValue value = idbKeyDataToScriptValue(scriptExecutionContext(), *keyData);
+ m_result = IDBAny::create(WTFMove(value));
+}
+
+void IDBRequest::setResult(uint64_t number)
+{
+ ASSERT(scriptExecutionContext());
+ m_result = IDBAny::create(Deprecated::ScriptValue(scriptExecutionContext()->vm(), JSC::JSValue(number)));
+}
+
+void IDBRequest::setResultToStructuredClone(const ThreadSafeDataBuffer& valueData)
+{
+ LOG(IndexedDB, "IDBRequest::setResultToStructuredClone");
+
+ auto context = scriptExecutionContext();
+ if (!context)
+ return;
+
+ Deprecated::ScriptValue value = deserializeIDBValueData(*context, valueData);
+ m_result = IDBAny::create(WTFMove(value));
+}
+
+void IDBRequest::setResultToUndefined()
+{
+ m_result = IDBAny::createUndefined();
+}
+
+IDBCursor* IDBRequest::resultCursor()
+{
+ if (!m_result)
+ return nullptr;
+ if (m_result->type() == IDBAny::Type::IDBCursor || m_result->type() == IDBAny::Type::IDBCursorWithValue)
+ return m_result->idbCursor().get();
+ return nullptr;
+}
+
+void IDBRequest::willIterateCursor(IDBCursor& cursor)
+{
+ ASSERT(m_readyState == IDBRequestReadyState::Done);
+ ASSERT(scriptExecutionContext());
+ ASSERT(m_transaction);
+ ASSERT(!m_pendingCursor);
+ ASSERT(&cursor == resultCursor());
+ ASSERT(!m_cursorRequestNotifier);
+
+ m_pendingCursor = &cursor;
+ m_hasPendingActivity = true;
+ m_result = nullptr;
+ m_readyState = IDBRequestReadyState::Pending;
+ m_domError = nullptr;
+ m_idbError = { };
+
+ m_cursorRequestNotifier = std::make_unique<ScopeGuard>([this]() {
+ m_pendingCursor->decrementOutstandingRequestCount();
+ });
+}
+
+void IDBRequest::didOpenOrIterateCursor(const IDBResultData& resultData)
+{
+ ASSERT(m_pendingCursor);
+ m_result = nullptr;
+
+ if (resultData.type() == IDBResultType::IterateCursorSuccess || resultData.type() == IDBResultType::OpenCursorSuccess) {
+ m_pendingCursor->setGetResult(*this, resultData.getResult());
+ if (resultData.getResult().isDefined())
+ m_result = IDBAny::create(*m_pendingCursor);
+ }
+
+ m_cursorRequestNotifier = nullptr;
+ m_pendingCursor = nullptr;
+
+ requestCompleted(resultData);
+}
+
+void IDBRequest::requestCompleted(const IDBResultData& resultData)
+{
+ m_readyState = IDBRequestReadyState::Done;
+
+ m_idbError = resultData.error();
+ if (!m_idbError.isNull())
+ onError();
+ else
+ onSuccess();
+}
+
+void IDBRequest::onError()
+{
+ LOG(IndexedDB, "IDBRequest::onError");
+
+ ASSERT(!m_idbError.isNull());
+ m_domError = DOMError::create(m_idbError.name());
+ enqueueEvent(Event::create(eventNames().errorEvent, true, true));
+}
+
+void IDBRequest::onSuccess()
+{
+ LOG(IndexedDB, "IDBRequest::onSuccess");
+
+ enqueueEvent(Event::create(eventNames().successEvent, false, false));
+}
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx">
</span><span class="cx"> #endif // ENABLE(INDEXED_DATABASE)
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBRequesth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBRequest.h (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBRequest.h        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBRequest.h        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -23,54 +23,144 @@
</span><span class="cx"> * THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><del>-#ifndef IDBRequest_h
-#define IDBRequest_h
</del><ins>+#pragma once
</ins><span class="cx">
</span><span class="cx"> #if ENABLE(INDEXED_DATABASE)
</span><span class="cx">
</span><span class="cx"> #include "ActiveDOMObject.h"
</span><del>-#include "DOMError.h"
-#include "DOMStringList.h"
-#include "Event.h"
-#include "EventListener.h"
</del><span class="cx"> #include "EventTarget.h"
</span><span class="cx"> #include "IDBAny.h"
</span><del>-#include "IDBCursor.h"
-#include "ScriptWrappable.h"
</del><ins>+#include "IDBResourceIdentifier.h"
+#include "IDBTransaction.h"
+#include "ScopeGuard.h"
+#include <wtf/RefCounted.h>
</ins><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-class IDBTransaction;
</del><ins>+class Event;
+class IDBAny;
+class IDBCursor;
+class IDBIndex;
+class IDBKeyData;
+class IDBObjectStore;
+class IDBResultData;
+class ThreadSafeDataBuffer;
</ins><span class="cx">
</span><del>-struct ExceptionCodeWithMessage;
</del><ins>+namespace IDBClient {
+class IDBConnectionToServer;
+}
</ins><span class="cx">
</span><del>-typedef int ExceptionCode;
</del><ins>+namespace IndexedDB {
+enum class IndexRecordType;
+}
</ins><span class="cx">
</span><span class="cx"> // Defined in the IDL
</span><span class="cx"> enum class IDBRequestReadyState {
</span><span class="cx"> Pending = 1,
</span><span class="cx"> Done = 2,
</span><del>- DeprecatedEarlyDeath = 3, // FIXME: https://bugs.webkit.org/show_bug.cgi?id=149117 - Remove this when removing LegacyIDB
</del><span class="cx"> };
</span><span class="cx">
</span><del>-class IDBRequest : public EventTargetWithInlineData, public ActiveDOMObject {
</del><ins>+class IDBRequest : public EventTargetWithInlineData, public ActiveDOMObject, public RefCounted<IDBRequest> {
</ins><span class="cx"> public:
</span><del>- virtual ~IDBRequest() { }
</del><ins>+ static Ref<IDBRequest> create(ScriptExecutionContext&, IDBObjectStore&, IDBTransaction&);
+ static Ref<IDBRequest> create(ScriptExecutionContext&, IDBCursor&, IDBTransaction&);
+ static Ref<IDBRequest> createCount(ScriptExecutionContext&, IDBIndex&, IDBTransaction&);
+ static Ref<IDBRequest> createGet(ScriptExecutionContext&, IDBIndex&, IndexedDB::IndexRecordType, IDBTransaction&);
</ins><span class="cx">
</span><del>- virtual RefPtr<IDBAny> result(ExceptionCodeWithMessage&) const = 0;
- virtual unsigned short errorCode(ExceptionCode&) const = 0;
- virtual RefPtr<DOMError> error(ExceptionCodeWithMessage&) const = 0;
- virtual RefPtr<IDBAny> source() const = 0;
- virtual RefPtr<IDBTransaction> transaction() const = 0;
</del><ins>+ const IDBResourceIdentifier& resourceIdentifier() const { return m_resourceIdentifier; }
</ins><span class="cx">
</span><del>- virtual const String& readyState() const = 0;
</del><ins>+ virtual ~IDBRequest();
</ins><span class="cx">
</span><ins>+ RefPtr<IDBAny> result(ExceptionCodeWithMessage&) const;
+ unsigned short errorCode(ExceptionCode&) const;
+ RefPtr<DOMError> error(ExceptionCodeWithMessage&) const;
+ RefPtr<IDBAny> source() const;
+ RefPtr<IDBTransaction> transaction() const;
+ const String& readyState() const;
+
+ uint64_t sourceObjectStoreIdentifier() const;
+ uint64_t sourceIndexIdentifier() const;
+ IndexedDB::IndexRecordType requestedIndexRecordType() const;
+
+ // EventTarget
+ EventTargetInterface eventTargetInterface() const override;
+ ScriptExecutionContext* scriptExecutionContext() const final { return ActiveDOMObject::scriptExecutionContext(); }
+
+ using RefCounted<IDBRequest>::ref;
+ using RefCounted<IDBRequest>::deref;
+
+ void enqueueEvent(Ref<Event>&&);
+ bool dispatchEvent(Event&) override;
+
+ IDBClient::IDBConnectionToServer& connection() { return m_connection; }
+
+ void requestCompleted(const IDBResultData&);
+
+ void setResult(const IDBKeyData*);
+ void setResult(uint64_t);
+ void setResultToStructuredClone(const ThreadSafeDataBuffer&);
+ void setResultToUndefined();
+
+ IDBAny* modernResult() { return m_result.get(); }
+
+ void willIterateCursor(IDBCursor&);
+ void didOpenOrIterateCursor(const IDBResultData&);
+
+ const IDBCursor* pendingCursor() const { return m_pendingCursor.get(); }
+
+ void setSource(IDBCursor&);
+ void setVersionChangeTransaction(IDBTransaction&);
+
+ IndexedDB::RequestType requestType() const { return m_requestType; }
+
+ // ActiveDOMObject.
+ const char* activeDOMObjectName() const final;
+ bool canSuspendForDocumentSuspension() const final;
+ bool hasPendingActivity() const final;
+ void stop() final;
+
</ins><span class="cx"> protected:
</span><del>- IDBRequest(ScriptExecutionContext&);
</del><ins>+ IDBRequest(IDBClient::IDBConnectionToServer&, ScriptExecutionContext&);
+ IDBRequest(ScriptExecutionContext&, IDBObjectStore&, IDBTransaction&);
+ IDBRequest(ScriptExecutionContext&, IDBCursor&, IDBTransaction&);
+ IDBRequest(ScriptExecutionContext&, IDBIndex&, IDBTransaction&);
+ IDBRequest(ScriptExecutionContext&, IDBIndex&, IndexedDB::IndexRecordType, IDBTransaction&);
+
+ // EventTarget.
+ void refEventTarget() final { RefCounted<IDBRequest>::ref(); }
+ void derefEventTarget() final { RefCounted<IDBRequest>::deref(); }
+ void uncaughtExceptionInEventHandler() final;
+
+ virtual bool isOpenDBRequest() const { return false; }
+
+ IDBRequestReadyState m_readyState { IDBRequestReadyState::Pending };
+ RefPtr<IDBAny> m_result;
+ RefPtr<IDBTransaction> m_transaction;
+ bool m_shouldExposeTransactionToDOM { true };
+ RefPtr<DOMError> m_domError;
+ IDBError m_idbError;
+ IndexedDB::RequestType m_requestType = { IndexedDB::RequestType::Other };
+ bool m_contextStopped { false };
+
+ Event* m_openDatabaseSuccessEvent { nullptr };
+
+private:
+ void onError();
+ void onSuccess();
+
+ IDBCursor* resultCursor();
+
+ IDBClient::IDBConnectionToServer& m_connection;
+ IDBResourceIdentifier m_resourceIdentifier;
+ RefPtr<IDBAny> m_source;
+ bool m_hasPendingActivity { true };
+ IndexedDB::IndexRecordType m_requestedIndexRecordType;
+
+ RefPtr<IDBCursor> m_pendingCursor;
+
+ std::unique_ptr<ScopeGuard> m_cursorRequestNotifier;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span><span class="cx">
</span><span class="cx"> #endif // ENABLE(INDEXED_DATABASE)
</span><del>-
-#endif // LegacyRequest_h
</del></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBRequestCompletionEventcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBRequestCompletionEvent.cpp (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBRequestCompletionEvent.cpp        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBRequestCompletionEvent.cpp        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -30,7 +30,7 @@
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-IDBRequestCompletionEvent::IDBRequestCompletionEvent(const AtomicString& type, bool canBubble, bool cancelable, IDBClient::IDBRequest& request)
</del><ins>+IDBRequestCompletionEvent::IDBRequestCompletionEvent(const AtomicString& type, bool canBubble, bool cancelable, IDBRequest& request)
</ins><span class="cx"> : Event(type, canBubble, cancelable)
</span><span class="cx"> , m_request(request)
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBRequestCompletionEventh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBRequestCompletionEvent.h (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBRequestCompletionEvent.h        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBRequestCompletionEvent.h        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -29,21 +29,21 @@
</span><span class="cx"> #if ENABLE(INDEXED_DATABASE)
</span><span class="cx">
</span><span class="cx"> #include "Event.h"
</span><del>-#include "IDBRequestImpl.h"
</del><ins>+#include "IDBRequest.h"
</ins><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="cx"> class IDBRequestCompletionEvent : public Event {
</span><span class="cx"> public:
</span><del>- static Ref<Event> create(const AtomicString& type, bool canBubble, bool cancelable, IDBClient::IDBRequest& request)
</del><ins>+ static Ref<Event> create(const AtomicString& type, bool canBubble, bool cancelable, IDBRequest& request)
</ins><span class="cx"> {
</span><span class="cx"> return adoptRef(*new IDBRequestCompletionEvent(type, canBubble, cancelable, request));
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> private:
</span><del>- IDBRequestCompletionEvent(const AtomicString& type, bool canBubble, bool cancelable, IDBClient::IDBRequest&);
</del><ins>+ IDBRequestCompletionEvent(const AtomicString& type, bool canBubble, bool cancelable, IDBRequest&);
</ins><span class="cx">
</span><del>- Ref<IDBClient::IDBRequest> m_request;
</del><ins>+ Ref<IDBRequest> m_request;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBTransactioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -28,16 +28,28 @@
</span><span class="cx">
</span><span class="cx"> #if ENABLE(INDEXED_DATABASE)
</span><span class="cx">
</span><del>-#include "ExceptionCode.h"
</del><ins>+#include "DOMError.h"
+#include "Event.h"
+#include "EventQueue.h"
+#include "IDBCursorWithValue.h"
+#include "IDBDatabase.h"
+#include "IDBDatabaseException.h"
+#include "IDBError.h"
+#include "IDBEventDispatcher.h"
+#include "IDBKeyData.h"
+#include "IDBKeyRangeData.h"
+#include "IDBObjectStore.h"
+#include "IDBOpenDBRequest.h"
+#include "IDBRequest.h"
+#include "IDBResultData.h"
+#include "JSDOMWindowBase.h"
+#include "Logging.h"
+#include "ScriptExecutionContext.h"
+#include "TransactionOperation.h"
</ins><span class="cx"> #include <wtf/NeverDestroyed.h>
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-IDBTransaction::IDBTransaction(ScriptExecutionContext* context)
- : ActiveDOMObject(context)
-{
-}
-
</del><span class="cx"> const AtomicString& IDBTransaction::modeReadOnly()
</span><span class="cx"> {
</span><span class="cx"> static NeverDestroyed<AtomicString> readonly("readonly", AtomicString::ConstructFromLiteral);
</span><span class="lines">@@ -97,6 +109,858 @@
</span><span class="cx"> return IDBTransaction::modeReadOnly();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+Ref<IDBTransaction> IDBTransaction::create(IDBDatabase& database, const IDBTransactionInfo& info)
+{
+ return adoptRef(*new IDBTransaction(database, info, nullptr));
+}
+
+Ref<IDBTransaction> IDBTransaction::create(IDBDatabase& database, const IDBTransactionInfo& info, IDBOpenDBRequest& request)
+{
+ return adoptRef(*new IDBTransaction(database, info, &request));
+}
+
+IDBTransaction::IDBTransaction(IDBDatabase& database, const IDBTransactionInfo& info, IDBOpenDBRequest* request)
+ : WebCore::ActiveDOMObject(database.scriptExecutionContext())
+ , m_database(database)
+ , m_info(info)
+ , m_operationTimer(*this, &IDBTransaction::operationTimerFired)
+ , m_openDBRequest(request)
+
+{
+ LOG(IndexedDB, "IDBTransaction::IDBTransaction - %s", m_info.loggingString().utf8().data());
+
+ relaxAdoptionRequirement();
+
+ if (m_info.mode() == IndexedDB::TransactionMode::VersionChange) {
+ ASSERT(m_openDBRequest);
+ m_openDBRequest->setVersionChangeTransaction(*this);
+ m_startedOnServer = true;
+ } else {
+ activate();
+
+ RefPtr<IDBTransaction> self;
+ JSC::VM& vm = JSDOMWindowBase::commonVM();
+ vm.whenIdle([self, this]() {
+ deactivate();
+ });
+
+ establishOnServer();
+ }
+
+ suspendIfNeeded();
+}
+
+IDBTransaction::~IDBTransaction()
+{
+}
+
+const String& IDBTransaction::mode() const
+{
+ switch (m_info.mode()) {
+ case IndexedDB::TransactionMode::ReadOnly:
+ return IDBTransaction::modeReadOnly();
+ case IndexedDB::TransactionMode::ReadWrite:
+ return IDBTransaction::modeReadWrite();
+ case IndexedDB::TransactionMode::VersionChange:
+ return IDBTransaction::modeVersionChange();
+ }
+
+ RELEASE_ASSERT_NOT_REACHED();
+}
+
+WebCore::IDBDatabase* IDBTransaction::db()
+{
+ return &m_database.get();
+}
+
+IDBClient::IDBConnectionToServer& IDBTransaction::serverConnection()
+{
+ return m_database->serverConnection();
+}
+
+RefPtr<DOMError> IDBTransaction::error() const
+{
+ return m_domError;
+}
+
+RefPtr<WebCore::IDBObjectStore> IDBTransaction::objectStore(const String& objectStoreName, ExceptionCodeWithMessage& ec)
+{
+ LOG(IndexedDB, "IDBTransaction::objectStore");
+
+ if (!scriptExecutionContext())
+ return nullptr;
+
+ if (isFinishedOrFinishing()) {
+ ec.code = IDBDatabaseException::InvalidStateError;
+ ec.message = ASCIILiteral("Failed to execute 'objectStore' on 'IDBTransaction': The transaction finished.");
+ return nullptr;
+ }
+
+ auto iterator = m_referencedObjectStores.find(objectStoreName);
+ if (iterator != m_referencedObjectStores.end())
+ return iterator->value;
+
+ bool found = false;
+ for (auto& objectStore : m_info.objectStores()) {
+ if (objectStore == objectStoreName) {
+ found = true;
+ break;
+ }
+ }
+
+ auto* info = m_database->info().infoForExistingObjectStore(objectStoreName);
+ if (!info) {
+ ec.code = IDBDatabaseException::NotFoundError;
+ ec.message = ASCIILiteral("Failed to execute 'objectStore' on 'IDBTransaction': The specified object store was not found.");
+ return nullptr;
+ }
+
+ // Version change transactions are scoped to every object store in the database.
+ if (!info || (!found && !isVersionChange())) {
+ ec.code = IDBDatabaseException::NotFoundError;
+ ec.message = ASCIILiteral("Failed to execute 'objectStore' on 'IDBTransaction': The specified object store was not found.");
+ return nullptr;
+ }
+
+ auto objectStore = IDBObjectStore::create(*scriptExecutionContext(), *info, *this);
+ m_referencedObjectStores.set(objectStoreName, &objectStore.get());
+
+ return adoptRef(&objectStore.leakRef());
+}
+
+
+void IDBTransaction::abortDueToFailedRequest(DOMError& error)
+{
+ LOG(IndexedDB, "IDBTransaction::abortDueToFailedRequest");
+ if (isFinishedOrFinishing())
+ return;
+
+ m_domError = &error;
+ ExceptionCodeWithMessage ec;
+ abort(ec);
+}
+
+void IDBTransaction::transitionedToFinishing(IndexedDB::TransactionState state)
+{
+ ASSERT(!isFinishedOrFinishing());
+ m_state = state;
+ ASSERT(isFinishedOrFinishing());
+ m_referencedObjectStores.clear();
+}
+
+void IDBTransaction::abort(ExceptionCodeWithMessage& ec)
+{
+ LOG(IndexedDB, "IDBTransaction::abort");
+
+ if (isFinishedOrFinishing()) {
+ ec.code = IDBDatabaseException::InvalidStateError;
+ ec.message = ASCIILiteral("Failed to execute 'abort' on 'IDBTransaction': The transaction is inactive or finished.");
+ return;
+ }
+
+ m_database->willAbortTransaction(*this);
+
+ if (isVersionChange()) {
+ for (auto& objectStore : m_referencedObjectStores.values())
+ objectStore->rollbackInfoForVersionChangeAbort();
+ }
+
+ transitionedToFinishing(IndexedDB::TransactionState::Aborting);
+
+ m_abortQueue.swap(m_transactionOperationQueue);
+
+ auto operation = IDBClient::createTransactionOperation(*this, nullptr, &IDBTransaction::abortOnServerAndCancelRequests);
+ scheduleOperation(WTFMove(operation));
+}
+
+void IDBTransaction::abortOnServerAndCancelRequests(IDBClient::TransactionOperation& operation)
+{
+ LOG(IndexedDB, "IDBTransaction::abortOnServerAndCancelRequests");
+
+ ASSERT(m_transactionOperationQueue.isEmpty());
+
+ serverConnection().abortTransaction(*this);
+
+ ASSERT(m_transactionOperationMap.contains(operation.identifier()));
+ m_transactionOperationMap.remove(operation.identifier());
+
+ IDBError error(IDBDatabaseException::AbortError);
+ for (auto& operation : m_abortQueue)
+ operation->completed(IDBResultData::error(operation->identifier(), error));
+
+ // Since we're aborting, it should be impossible to have queued any further operations.
+ ASSERT(m_transactionOperationQueue.isEmpty());
+}
+
+const char* IDBTransaction::activeDOMObjectName() const
+{
+ return "IDBTransaction";
+}
+
+bool IDBTransaction::canSuspendForDocumentSuspension() const
+{
+ return false;
+}
+
+bool IDBTransaction::hasPendingActivity() const
+{
+ return !m_contextStopped && m_state != IndexedDB::TransactionState::Finished;
+}
+
+void IDBTransaction::stop()
+{
+ LOG(IndexedDB, "IDBTransaction::stop");
+
+ // IDBDatabase::stop() calls IDBTransaction::stop() for each of its active transactions.
+ // Since the order of calling ActiveDOMObject::stop() is random, we might already have been stopped.
+ if (m_contextStopped)
+ return;
+
+ m_contextStopped = true;
+
+ if (isFinishedOrFinishing())
+ return;
+
+ ExceptionCodeWithMessage ec;
+ abort(ec);
+}
+
+bool IDBTransaction::isActive() const
+{
+ return m_state == IndexedDB::TransactionState::Active;
+}
+
+bool IDBTransaction::isFinishedOrFinishing() const
+{
+ return m_state == IndexedDB::TransactionState::Committing
+ || m_state == IndexedDB::TransactionState::Aborting
+ || m_state == IndexedDB::TransactionState::Finished;
+}
+
+void IDBTransaction::addRequest(IDBRequest& request)
+{
+ m_openRequests.add(&request);
+}
+
+void IDBTransaction::removeRequest(IDBRequest& request)
+{
+ ASSERT(m_openRequests.contains(&request));
+ m_openRequests.remove(&request);
+}
+
+void IDBTransaction::scheduleOperation(RefPtr<IDBClient::TransactionOperation>&& operation)
+{
+ ASSERT(!m_transactionOperationMap.contains(operation->identifier()));
+
+ m_transactionOperationQueue.append(operation);
+ m_transactionOperationMap.set(operation->identifier(), WTFMove(operation));
+
+ scheduleOperationTimer();
+}
+
+void IDBTransaction::scheduleOperationTimer()
+{
+ if (!m_operationTimer.isActive())
+ m_operationTimer.startOneShot(0);
+}
+
+void IDBTransaction::operationTimerFired()
+{
+ LOG(IndexedDB, "IDBTransaction::operationTimerFired (%p)", this);
+
+ if (!m_startedOnServer)
+ return;
+
+ if (!m_transactionOperationQueue.isEmpty()) {
+ auto operation = m_transactionOperationQueue.takeFirst();
+ operation->perform();
+
+ return;
+ }
+
+ if (!m_transactionOperationMap.isEmpty() || !m_openRequests.isEmpty())
+ return;
+
+ if (!isFinishedOrFinishing())
+ commit();
+}
+
+void IDBTransaction::commit()
+{
+ LOG(IndexedDB, "IDBTransaction::commit");
+
+ ASSERT(!isFinishedOrFinishing());
+
+ transitionedToFinishing(IndexedDB::TransactionState::Committing);
+ m_database->willCommitTransaction(*this);
+
+ auto operation = IDBClient::createTransactionOperation(*this, nullptr, &IDBTransaction::commitOnServer);
+ scheduleOperation(WTFMove(operation));
+}
+
+void IDBTransaction::commitOnServer(IDBClient::TransactionOperation& operation)
+{
+ LOG(IndexedDB, "IDBTransaction::commitOnServer");
+ serverConnection().commitTransaction(*this);
+
+ ASSERT(m_transactionOperationMap.contains(operation.identifier()));
+ m_transactionOperationMap.remove(operation.identifier());
+}
+
+void IDBTransaction::finishAbortOrCommit()
+{
+ ASSERT(m_state != IndexedDB::TransactionState::Finished);
+ m_state = IndexedDB::TransactionState::Finished;
+}
+
+void IDBTransaction::didStart(const IDBError& error)
+{
+ LOG(IndexedDB, "IDBTransaction::didStart");
+
+ m_database->didStartTransaction(*this);
+
+ m_startedOnServer = true;
+
+ // It's possible the transaction failed to start on the server.
+ // That equates to an abort.
+ if (!error.isNull()) {
+ didAbort(error);
+ return;
+ }
+
+ scheduleOperationTimer();
+}
+
+void IDBTransaction::notifyDidAbort(const IDBError& error)
+{
+ m_database->didAbortTransaction(*this);
+ m_idbError = error;
+ fireOnAbort();
+
+ if (isVersionChange()) {
+ ASSERT(m_openDBRequest);
+ m_openDBRequest->fireErrorAfterVersionChangeCompletion();
+ }
+}
+
+void IDBTransaction::didAbort(const IDBError& error)
+{
+ LOG(IndexedDB, "IDBTransaction::didAbort");
+
+ if (m_state == IndexedDB::TransactionState::Finished)
+ return;
+
+ notifyDidAbort(error);
+
+ finishAbortOrCommit();
+}
+
+void IDBTransaction::didCommit(const IDBError& error)
+{
+ LOG(IndexedDB, "IDBTransaction::didCommit");
+
+ ASSERT(m_state == IndexedDB::TransactionState::Committing);
+
+ if (error.isNull()) {
+ m_database->didCommitTransaction(*this);
+ fireOnComplete();
+ } else {
+ m_database->willAbortTransaction(*this);
+ notifyDidAbort(error);
+ }
+
+ finishAbortOrCommit();
+}
+
+void IDBTransaction::fireOnComplete()
+{
+ LOG(IndexedDB, "IDBTransaction::fireOnComplete");
+ enqueueEvent(Event::create(eventNames().completeEvent, false, false));
+}
+
+void IDBTransaction::fireOnAbort()
+{
+ LOG(IndexedDB, "IDBTransaction::fireOnAbort");
+ enqueueEvent(Event::create(eventNames().abortEvent, true, false));
+}
+
+void IDBTransaction::enqueueEvent(Ref<Event>&& event)
+{
+ ASSERT(m_state != IndexedDB::TransactionState::Finished);
+
+ if (!scriptExecutionContext() || m_contextStopped)
+ return;
+
+ event->setTarget(this);
+ scriptExecutionContext()->eventQueue().enqueueEvent(WTFMove(event));
+}
+
+bool IDBTransaction::dispatchEvent(Event& event)
+{
+ LOG(IndexedDB, "IDBTransaction::dispatchEvent");
+
+ ASSERT(scriptExecutionContext());
+ ASSERT(!m_contextStopped);
+ ASSERT(event.target() == this);
+ ASSERT(event.type() == eventNames().completeEvent || event.type() == eventNames().abortEvent);
+
+ Vector<RefPtr<EventTarget>> targets;
+ targets.append(this);
+ targets.append(db());
+
+ bool result = IDBEventDispatcher::dispatch(event, targets);
+
+ if (isVersionChange()) {
+ ASSERT(m_openDBRequest);
+ m_openDBRequest->versionChangeTransactionDidFinish();
+
+ if (event.type() == eventNames().completeEvent) {
+ if (m_database->isClosingOrClosed())
+ m_openDBRequest->fireErrorAfterVersionChangeCompletion();
+ else
+ m_openDBRequest->fireSuccessAfterVersionChangeCommit();
+ }
+
+ m_openDBRequest = nullptr;
+ }
+
+ return result;
+}
+
+Ref<IDBObjectStore> IDBTransaction::createObjectStore(const IDBObjectStoreInfo& info)
+{
+ LOG(IndexedDB, "IDBTransaction::createObjectStore");
+ ASSERT(isVersionChange());
+ ASSERT(scriptExecutionContext());
+
+ Ref<IDBObjectStore> objectStore = IDBObjectStore::create(*scriptExecutionContext(), info, *this);
+ m_referencedObjectStores.set(info.name(), &objectStore.get());
+
+ auto operation = IDBClient::createTransactionOperation(*this, &IDBTransaction::didCreateObjectStoreOnServer, &IDBTransaction::createObjectStoreOnServer, info);
+ scheduleOperation(WTFMove(operation));
+
+ return objectStore;
+}
+
+void IDBTransaction::createObjectStoreOnServer(IDBClient::TransactionOperation& operation, const IDBObjectStoreInfo& info)
+{
+ LOG(IndexedDB, "IDBTransaction::createObjectStoreOnServer");
+
+ ASSERT(isVersionChange());
+
+ m_database->serverConnection().createObjectStore(operation, info);
+}
+
+void IDBTransaction::didCreateObjectStoreOnServer(const IDBResultData& resultData)
+{
+ LOG(IndexedDB, "IDBTransaction::didCreateObjectStoreOnServer");
+
+ ASSERT_UNUSED(resultData, resultData.type() == IDBResultType::CreateObjectStoreSuccess || resultData.type() == IDBResultType::Error);
+}
+
+std::unique_ptr<IDBIndex> IDBTransaction::createIndex(IDBObjectStore& objectStore, const IDBIndexInfo& info)
+{
+ LOG(IndexedDB, "IDBTransaction::createIndex");
+ ASSERT(isVersionChange());
+
+ if (!scriptExecutionContext())
+ return nullptr;
+
+ auto operation = IDBClient::createTransactionOperation(*this, &IDBTransaction::didCreateIndexOnServer, &IDBTransaction::createIndexOnServer, info);
+ scheduleOperation(WTFMove(operation));
+
+ return std::make_unique<IDBIndex>(*scriptExecutionContext(), info, objectStore);
+}
+
+void IDBTransaction::createIndexOnServer(IDBClient::TransactionOperation& operation, const IDBIndexInfo& info)
+{
+ LOG(IndexedDB, "IDBTransaction::createIndexOnServer");
+
+ ASSERT(isVersionChange());
+
+ m_database->serverConnection().createIndex(operation, info);
+}
+
+void IDBTransaction::didCreateIndexOnServer(const IDBResultData& resultData)
+{
+ LOG(IndexedDB, "IDBTransaction::didCreateIndexOnServer");
+
+ if (resultData.type() == IDBResultType::CreateIndexSuccess)
+ return;
+
+ ASSERT(resultData.type() == IDBResultType::Error);
+
+ // This operation might have failed because the transaction is already aborting.
+ if (m_state == IndexedDB::TransactionState::Aborting)
+ return;
+
+ // Otherwise, failure to create an index forced abortion of the transaction.
+ abortDueToFailedRequest(DOMError::create(IDBDatabaseException::getErrorName(resultData.error().code())));
+}
+
+Ref<IDBRequest> IDBTransaction::requestOpenCursor(ScriptExecutionContext& context, IDBObjectStore& objectStore, const IDBCursorInfo& info)
+{
+ LOG(IndexedDB, "IDBTransaction::requestOpenCursor");
+
+ return doRequestOpenCursor(context, IDBCursorWithValue::create(*this, objectStore, info));
+}
+
+Ref<IDBRequest> IDBTransaction::requestOpenCursor(ScriptExecutionContext& context, IDBIndex& index, const IDBCursorInfo& info)
+{
+ LOG(IndexedDB, "IDBTransaction::requestOpenCursor");
+
+ if (info.cursorType() == IndexedDB::CursorType::KeyOnly)
+ return doRequestOpenCursor(context, IDBCursor::create(*this, index, info));
+
+ return doRequestOpenCursor(context, IDBCursorWithValue::create(*this, index, info));
+}
+
+Ref<IDBRequest> IDBTransaction::doRequestOpenCursor(ScriptExecutionContext& context, Ref<IDBCursor>&& cursor)
+{
+ ASSERT(isActive());
+
+ Ref<IDBRequest> request = IDBRequest::create(context, cursor.get(), *this);
+ addRequest(request.get());
+
+ auto operation = IDBClient::createTransactionOperation(*this, request.get(), &IDBTransaction::didOpenCursorOnServer, &IDBTransaction::openCursorOnServer, cursor->info());
+ scheduleOperation(WTFMove(operation));
+
+ return request;
+}
+
+void IDBTransaction::openCursorOnServer(IDBClient::TransactionOperation& operation, const IDBCursorInfo& info)
+{
+ LOG(IndexedDB, "IDBTransaction::openCursorOnServer");
+
+ m_database->serverConnection().openCursor(operation, info);
+}
+
+void IDBTransaction::didOpenCursorOnServer(IDBRequest& request, const IDBResultData& resultData)
+{
+ LOG(IndexedDB, "IDBTransaction::didOpenCursorOnServer");
+
+ request.didOpenOrIterateCursor(resultData);
+}
+
+void IDBTransaction::iterateCursor(IDBCursor& cursor, const IDBKeyData& key, unsigned long count)
+{
+ LOG(IndexedDB, "IDBTransaction::iterateCursor");
+ ASSERT(isActive());
+ ASSERT(cursor.request());
+
+ addRequest(*cursor.request());
+
+ auto operation = IDBClient::createTransactionOperation(*this, *cursor.request(), &IDBTransaction::didIterateCursorOnServer, &IDBTransaction::iterateCursorOnServer, key, count);
+ scheduleOperation(WTFMove(operation));
+}
+
+void IDBTransaction::iterateCursorOnServer(IDBClient::TransactionOperation& operation, const IDBKeyData& key, const unsigned long& count)
+{
+ LOG(IndexedDB, "IDBTransaction::iterateCursorOnServer");
+
+ serverConnection().iterateCursor(operation, key, count);
+}
+
+void IDBTransaction::didIterateCursorOnServer(IDBRequest& request, const IDBResultData& resultData)
+{
+ LOG(IndexedDB, "IDBTransaction::didIterateCursorOnServer");
+
+ request.didOpenOrIterateCursor(resultData);
+}
+
+Ref<IDBRequest> IDBTransaction::requestGetRecord(ScriptExecutionContext& context, IDBObjectStore& objectStore, const IDBKeyRangeData& keyRangeData)
+{
+ LOG(IndexedDB, "IDBTransaction::requestGetRecord");
+ ASSERT(isActive());
+ ASSERT(!keyRangeData.isNull);
+
+ Ref<IDBRequest> request = IDBRequest::create(context, objectStore, *this);
+ addRequest(request.get());
+
+ auto operation = IDBClient::createTransactionOperation(*this, request.get(), &IDBTransaction::didGetRecordOnServer, &IDBTransaction::getRecordOnServer, keyRangeData);
+ scheduleOperation(WTFMove(operation));
+
+ return request;
+}
+
+Ref<IDBRequest> IDBTransaction::requestGetValue(ScriptExecutionContext& context, IDBIndex& index, const IDBKeyRangeData& range)
+{
+ LOG(IndexedDB, "IDBTransaction::requestGetValue");
+ return requestIndexRecord(context, index, IndexedDB::IndexRecordType::Value, range);
+}
+
+Ref<IDBRequest> IDBTransaction::requestGetKey(ScriptExecutionContext& context, IDBIndex& index, const IDBKeyRangeData& range)
+{
+ LOG(IndexedDB, "IDBTransaction::requestGetValue");
+ return requestIndexRecord(context, index, IndexedDB::IndexRecordType::Key, range);
+}
+
+Ref<IDBRequest> IDBTransaction::requestIndexRecord(ScriptExecutionContext& context, IDBIndex& index, IndexedDB::IndexRecordType type, const IDBKeyRangeData&range)
+{
+ LOG(IndexedDB, "IDBTransaction::requestGetValue");
+ ASSERT(isActive());
+ ASSERT(!range.isNull);
+
+ Ref<IDBRequest> request = IDBRequest::createGet(context, index, type, *this);
+ addRequest(request.get());
+
+ auto operation = IDBClient::createTransactionOperation(*this, request.get(), &IDBTransaction::didGetRecordOnServer, &IDBTransaction::getRecordOnServer, range);
+ scheduleOperation(WTFMove(operation));
+
+ return request;
+}
+
+void IDBTransaction::getRecordOnServer(IDBClient::TransactionOperation& operation, const IDBKeyRangeData& keyRange)
+{
+ LOG(IndexedDB, "IDBTransaction::getRecordOnServer");
+
+ serverConnection().getRecord(operation, keyRange);
+}
+
+void IDBTransaction::didGetRecordOnServer(IDBRequest& request, const IDBResultData& resultData)
+{
+ LOG(IndexedDB, "IDBTransaction::didGetRecordOnServer");
+
+ if (resultData.type() == IDBResultType::Error) {
+ request.requestCompleted(resultData);
+ return;
+ }
+
+ ASSERT(resultData.type() == IDBResultType::GetRecordSuccess);
+
+ const IDBGetResult& result = resultData.getResult();
+
+ if (request.sourceIndexIdentifier() && request.requestedIndexRecordType() == IndexedDB::IndexRecordType::Key) {
+ if (!result.keyData().isNull())
+ request.setResult(&result.keyData());
+ else
+ request.setResultToUndefined();
+ } else {
+ if (resultData.getResult().valueBuffer().data())
+ request.setResultToStructuredClone(resultData.getResult().valueBuffer());
+ else
+ request.setResultToUndefined();
+ }
+
+ request.requestCompleted(resultData);
+}
+
+Ref<IDBRequest> IDBTransaction::requestCount(ScriptExecutionContext& context, IDBObjectStore& objectStore, const IDBKeyRangeData& range)
+{
+ LOG(IndexedDB, "IDBTransaction::requestCount (IDBObjectStore)");
+ ASSERT(isActive());
+ ASSERT(!range.isNull);
+
+ Ref<IDBRequest> request = IDBRequest::create(context, objectStore, *this);
+ addRequest(request.get());
+
+ scheduleOperation(IDBClient::createTransactionOperation(*this, request.get(), &IDBTransaction::didGetCountOnServer, &IDBTransaction::getCountOnServer, range));
+
+ return request;
+}
+
+Ref<IDBRequest> IDBTransaction::requestCount(ScriptExecutionContext& context, IDBIndex& index, const IDBKeyRangeData& range)
+{
+ LOG(IndexedDB, "IDBTransaction::requestCount (IDBIndex)");
+ ASSERT(isActive());
+ ASSERT(!range.isNull);
+
+ Ref<IDBRequest> request = IDBRequest::createCount(context, index, *this);
+ addRequest(request.get());
+
+ scheduleOperation(IDBClient::createTransactionOperation(*this, request.get(), &IDBTransaction::didGetCountOnServer, &IDBTransaction::getCountOnServer, range));
+
+ return request;
+}
+
+void IDBTransaction::getCountOnServer(IDBClient::TransactionOperation& operation, const IDBKeyRangeData& keyRange)
+{
+ LOG(IndexedDB, "IDBTransaction::getCountOnServer");
+
+ serverConnection().getCount(operation, keyRange);
+}
+
+void IDBTransaction::didGetCountOnServer(IDBRequest& request, const IDBResultData& resultData)
+{
+ LOG(IndexedDB, "IDBTransaction::didGetCountOnServer");
+
+ request.setResult(resultData.resultInteger());
+ request.requestCompleted(resultData);
+}
+
+Ref<IDBRequest> IDBTransaction::requestDeleteRecord(ScriptExecutionContext& context, IDBObjectStore& objectStore, const IDBKeyRangeData& range)
+{
+ LOG(IndexedDB, "IDBTransaction::requestDeleteRecord");
+ ASSERT(isActive());
+ ASSERT(!range.isNull);
+
+ Ref<IDBRequest> request = IDBRequest::create(context, objectStore, *this);
+ addRequest(request.get());
+
+ scheduleOperation(IDBClient::createTransactionOperation(*this, request.get(), &IDBTransaction::didDeleteRecordOnServer, &IDBTransaction::deleteRecordOnServer, range));
+ return request;
+}
+
+void IDBTransaction::deleteRecordOnServer(IDBClient::TransactionOperation& operation, const IDBKeyRangeData& keyRange)
+{
+ LOG(IndexedDB, "IDBTransaction::deleteRecordOnServer");
+
+ serverConnection().deleteRecord(operation, keyRange);
+}
+
+void IDBTransaction::didDeleteRecordOnServer(IDBRequest& request, const IDBResultData& resultData)
+{
+ LOG(IndexedDB, "IDBTransaction::didDeleteRecordOnServer");
+
+ request.setResultToUndefined();
+ request.requestCompleted(resultData);
+}
+
+Ref<IDBRequest> IDBTransaction::requestClearObjectStore(ScriptExecutionContext& context, IDBObjectStore& objectStore)
+{
+ LOG(IndexedDB, "IDBTransaction::requestClearObjectStore");
+ ASSERT(isActive());
+
+ Ref<IDBRequest> request = IDBRequest::create(context, objectStore, *this);
+ addRequest(request.get());
+
+ uint64_t objectStoreIdentifier = objectStore.info().identifier();
+ auto operation = IDBClient::createTransactionOperation(*this, request.get(), &IDBTransaction::didClearObjectStoreOnServer, &IDBTransaction::clearObjectStoreOnServer, objectStoreIdentifier);
+ scheduleOperation(WTFMove(operation));
+
+ return request;
+}
+
+void IDBTransaction::clearObjectStoreOnServer(IDBClient::TransactionOperation& operation, const uint64_t& objectStoreIdentifier)
+{
+ LOG(IndexedDB, "IDBTransaction::clearObjectStoreOnServer");
+
+ serverConnection().clearObjectStore(operation, objectStoreIdentifier);
+}
+
+void IDBTransaction::didClearObjectStoreOnServer(IDBRequest& request, const IDBResultData& resultData)
+{
+ LOG(IndexedDB, "IDBTransaction::didClearObjectStoreOnServer");
+
+ request.setResultToUndefined();
+ request.requestCompleted(resultData);
+}
+
+Ref<IDBRequest> IDBTransaction::requestPutOrAdd(ScriptExecutionContext& context, IDBObjectStore& objectStore, IDBKey* key, SerializedScriptValue& value, IndexedDB::ObjectStoreOverwriteMode overwriteMode)
+{
+ LOG(IndexedDB, "IDBTransaction::requestPutOrAdd");
+ ASSERT(isActive());
+ ASSERT(!isReadOnly());
+ ASSERT(objectStore.info().autoIncrement() || key);
+
+ Ref<IDBRequest> request = IDBRequest::create(context, objectStore, *this);
+ addRequest(request.get());
+
+ auto operation = IDBClient::createTransactionOperation(*this, request.get(), &IDBTransaction::didPutOrAddOnServer, &IDBTransaction::putOrAddOnServer, key, &value, overwriteMode);
+ scheduleOperation(WTFMove(operation));
+
+ return request;
+}
+
+void IDBTransaction::putOrAddOnServer(IDBClient::TransactionOperation& operation, RefPtr<IDBKey> key, RefPtr<SerializedScriptValue> value, const IndexedDB::ObjectStoreOverwriteMode& overwriteMode)
+{
+ LOG(IndexedDB, "IDBTransaction::putOrAddOnServer");
+
+ ASSERT(!isReadOnly());
+
+ serverConnection().putOrAdd(operation, key, value, overwriteMode);
+}
+
+void IDBTransaction::didPutOrAddOnServer(IDBRequest& request, const IDBResultData& resultData)
+{
+ LOG(IndexedDB, "IDBTransaction::didPutOrAddOnServer");
+
+ request.setResult(resultData.resultKey());
+ request.requestCompleted(resultData);
+}
+
+void IDBTransaction::deleteObjectStore(const String& objectStoreName)
+{
+ LOG(IndexedDB, "IDBTransaction::deleteObjectStore");
+
+ ASSERT(isVersionChange());
+
+ if (auto objectStore = m_referencedObjectStores.take(objectStoreName))
+ objectStore->markAsDeleted();
+
+ auto operation = IDBClient::createTransactionOperation(*this, &IDBTransaction::didDeleteObjectStoreOnServer, &IDBTransaction::deleteObjectStoreOnServer, objectStoreName);
+ scheduleOperation(WTFMove(operation));
+}
+
+void IDBTransaction::deleteObjectStoreOnServer(IDBClient::TransactionOperation& operation, const String& objectStoreName)
+{
+ LOG(IndexedDB, "IDBTransaction::deleteObjectStoreOnServer");
+ ASSERT(isVersionChange());
+
+ serverConnection().deleteObjectStore(operation, objectStoreName);
+}
+
+void IDBTransaction::didDeleteObjectStoreOnServer(const IDBResultData& resultData)
+{
+ LOG(IndexedDB, "IDBTransaction::didDeleteObjectStoreOnServer");
+ ASSERT_UNUSED(resultData, resultData.type() == IDBResultType::DeleteObjectStoreSuccess || resultData.type() == IDBResultType::Error);
+}
+
+void IDBTransaction::deleteIndex(uint64_t objectStoreIdentifier, const String& indexName)
+{
+ LOG(IndexedDB, "IDBTransaction::deleteIndex");
+
+ ASSERT(isVersionChange());
+
+ auto operation = IDBClient::createTransactionOperation(*this, &IDBTransaction::didDeleteIndexOnServer, &IDBTransaction::deleteIndexOnServer, objectStoreIdentifier, indexName);
+ scheduleOperation(WTFMove(operation));
+}
+
+void IDBTransaction::deleteIndexOnServer(IDBClient::TransactionOperation& operation, const uint64_t& objectStoreIdentifier, const String& indexName)
+{
+ LOG(IndexedDB, "IDBTransaction::deleteIndexOnServer");
+ ASSERT(isVersionChange());
+
+ serverConnection().deleteIndex(operation, objectStoreIdentifier, indexName);
+}
+
+void IDBTransaction::didDeleteIndexOnServer(const IDBResultData& resultData)
+{
+ LOG(IndexedDB, "IDBTransaction::didDeleteIndexOnServer");
+ ASSERT_UNUSED(resultData, resultData.type() == IDBResultType::DeleteIndexSuccess || resultData.type() == IDBResultType::Error);
+}
+
+void IDBTransaction::operationDidComplete(IDBClient::TransactionOperation& operation)
+{
+ ASSERT(m_transactionOperationMap.get(operation.identifier()) == &operation);
+ m_transactionOperationMap.remove(operation.identifier());
+
+ scheduleOperationTimer();
+}
+
+void IDBTransaction::establishOnServer()
+{
+ LOG(IndexedDB, "IDBTransaction::establishOnServer");
+
+ serverConnection().establishTransaction(*this);
+}
+
+void IDBTransaction::activate()
+{
+ if (isFinishedOrFinishing())
+ return;
+
+ m_state = IndexedDB::TransactionState::Active;
+}
+
+void IDBTransaction::deactivate()
+{
+ if (m_state == IndexedDB::TransactionState::Active)
+ m_state = IndexedDB::TransactionState::Inactive;
+
+ scheduleOperationTimer();
+}
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx">
</span><span class="cx"> #endif // ENABLE(INDEXED_DATABASE)
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBTransactionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.h (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.h        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.h        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -23,33 +23,41 @@
</span><span class="cx"> * THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><del>-#ifndef IDBTransaction_h
-#define IDBTransaction_h
</del><ins>+#pragma once
</ins><span class="cx">
</span><span class="cx"> #if ENABLE(INDEXED_DATABASE)
</span><span class="cx">
</span><del>-#include "ActiveDOMObject.h"
-#include "EventTarget.h"
</del><ins>+#include "IDBDatabaseInfo.h"
+#include "IDBError.h"
+#include "IDBIndex.h"
+#include "IDBObjectStore.h"
+#include "IDBTransaction.h"
+#include "IDBTransactionInfo.h"
</ins><span class="cx"> #include "IndexedDB.h"
</span><del>-#include "ScriptWrappable.h"
-#include <wtf/HashSet.h>
-#include <wtf/RefCounted.h>
</del><ins>+#include "Timer.h"
+#include <wtf/Deque.h>
+#include <wtf/HashMap.h>
</ins><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-class DOMError;
</del><span class="cx"> class IDBCursor;
</span><ins>+class IDBCursorInfo;
</ins><span class="cx"> class IDBDatabase;
</span><del>-class IDBDatabaseError;
</del><ins>+class IDBIndex;
+class IDBIndexInfo;
+class IDBKeyData;
</ins><span class="cx"> class IDBObjectStore;
</span><ins>+class IDBObjectStoreInfo;
</ins><span class="cx"> class IDBOpenDBRequest;
</span><ins>+class IDBResultData;
+struct IDBKeyRangeData;
</ins><span class="cx">
</span><del>-struct ExceptionCodeWithMessage;
</del><ins>+namespace IDBClient {
+class TransactionOperation;
+}
</ins><span class="cx">
</span><span class="cx"> class IDBTransaction : public RefCounted<IDBTransaction>, public EventTargetWithInlineData, public ActiveDOMObject {
</span><span class="cx"> public:
</span><del>- virtual ~IDBTransaction() { }
-
</del><span class="cx"> static const AtomicString& modeReadOnly();
</span><span class="cx"> static const AtomicString& modeReadWrite();
</span><span class="cx"> static const AtomicString& modeVersionChange();
</span><span class="lines">@@ -59,22 +67,184 @@
</span><span class="cx"> static IndexedDB::TransactionMode stringToMode(const String&, ExceptionCode&);
</span><span class="cx"> static const AtomicString& modeToString(IndexedDB::TransactionMode);
</span><span class="cx">
</span><del>- // Implement the IDBTransaction IDL
- virtual const String& mode() const = 0;
- virtual IDBDatabase* db() = 0;
- virtual RefPtr<DOMError> error() const = 0;
- virtual RefPtr<IDBObjectStore> objectStore(const String& name, ExceptionCodeWithMessage&) = 0;
- virtual void abort(ExceptionCodeWithMessage&) = 0;
</del><ins>+ static Ref<IDBTransaction> create(IDBDatabase&, const IDBTransactionInfo&);
+ static Ref<IDBTransaction> create(IDBDatabase&, const IDBTransactionInfo&, IDBOpenDBRequest&);
</ins><span class="cx">
</span><ins>+ ~IDBTransaction() final;
+
+ // IDBTransaction IDL
+ const String& mode() const;
+ WebCore::IDBDatabase* db();
+ RefPtr<DOMError> error() const;
+ RefPtr<WebCore::IDBObjectStore> objectStore(const String& name, ExceptionCodeWithMessage&);
+ void abort(ExceptionCodeWithMessage&);
+
+ EventTargetInterface eventTargetInterface() const final { return IDBTransactionEventTargetInterfaceType; }
+ ScriptExecutionContext* scriptExecutionContext() const final { return ActiveDOMObject::scriptExecutionContext(); }
+ void refEventTarget() final { RefCounted<IDBTransaction>::ref(); }
+ void derefEventTarget() final { RefCounted<IDBTransaction>::deref(); }
+ using EventTarget::dispatchEvent;
+ bool dispatchEvent(Event&) final;
+
</ins><span class="cx"> using RefCounted<IDBTransaction>::ref;
</span><span class="cx"> using RefCounted<IDBTransaction>::deref;
</span><span class="cx">
</span><del>-protected:
- IDBTransaction(ScriptExecutionContext*);
</del><ins>+ const char* activeDOMObjectName() const final;
+ bool canSuspendForDocumentSuspension() const final;
+ bool hasPendingActivity() const final;
+ void stop() final;
+
+ const IDBTransactionInfo& info() const { return m_info; }
+ IDBDatabase& database() { return m_database.get(); }
+ const IDBDatabase& database() const { return m_database.get(); }
+ IDBDatabaseInfo* originalDatabaseInfo() const { return m_info.originalDatabaseInfo(); }
+
+ void didStart(const IDBError&);
+ void didAbort(const IDBError&);
+ void didCommit(const IDBError&);
+
+ bool isVersionChange() const { return m_info.mode() == IndexedDB::TransactionMode::VersionChange; }
+ bool isReadOnly() const { return m_info.mode() == IndexedDB::TransactionMode::ReadOnly; }
+ bool isActive() const;
+
+ Ref<IDBObjectStore> createObjectStore(const IDBObjectStoreInfo&);
+ std::unique_ptr<IDBIndex> createIndex(IDBObjectStore&, const IDBIndexInfo&);
+
+ Ref<IDBRequest> requestPutOrAdd(ScriptExecutionContext&, IDBObjectStore&, IDBKey*, SerializedScriptValue&, IndexedDB::ObjectStoreOverwriteMode);
+ Ref<IDBRequest> requestGetRecord(ScriptExecutionContext&, IDBObjectStore&, const IDBKeyRangeData&);
+ Ref<IDBRequest> requestDeleteRecord(ScriptExecutionContext&, IDBObjectStore&, const IDBKeyRangeData&);
+ Ref<IDBRequest> requestClearObjectStore(ScriptExecutionContext&, IDBObjectStore&);
+ Ref<IDBRequest> requestCount(ScriptExecutionContext&, IDBObjectStore&, const IDBKeyRangeData&);
+ Ref<IDBRequest> requestCount(ScriptExecutionContext&, IDBIndex&, const IDBKeyRangeData&);
+ Ref<IDBRequest> requestGetValue(ScriptExecutionContext&, IDBIndex&, const IDBKeyRangeData&);
+ Ref<IDBRequest> requestGetKey(ScriptExecutionContext&, IDBIndex&, const IDBKeyRangeData&);
+ Ref<IDBRequest> requestOpenCursor(ScriptExecutionContext&, IDBObjectStore&, const IDBCursorInfo&);
+ Ref<IDBRequest> requestOpenCursor(ScriptExecutionContext&, IDBIndex&, const IDBCursorInfo&);
+ void iterateCursor(IDBCursor&, const IDBKeyData&, unsigned long count);
+
+ void deleteObjectStore(const String& objectStoreName);
+ void deleteIndex(uint64_t objectStoreIdentifier, const String& indexName);
+
+ void addRequest(IDBRequest&);
+ void removeRequest(IDBRequest&);
+
+ void abortDueToFailedRequest(DOMError&);
+
+ IDBClient::IDBConnectionToServer& serverConnection();
+
+ void activate();
+ void deactivate();
+
+ void operationDidComplete(IDBClient::TransactionOperation&);
+
+ bool isFinishedOrFinishing() const;
+ bool isFinished() const { return m_state == IndexedDB::TransactionState::Finished; }
+
+private:
+ IDBTransaction(IDBDatabase&, const IDBTransactionInfo&, IDBOpenDBRequest*);
+
+ void commit();
+
+ void notifyDidAbort(const IDBError&);
+ void finishAbortOrCommit();
+
+ void scheduleOperation(RefPtr<IDBClient::TransactionOperation>&&);
+ void operationTimerFired();
+
+ void fireOnComplete();
+ void fireOnAbort();
+ void enqueueEvent(Ref<Event>&&);
+
+ Ref<IDBRequest> requestIndexRecord(ScriptExecutionContext&, IDBIndex&, IndexedDB::IndexRecordType, const IDBKeyRangeData&);
+
+ void commitOnServer(IDBClient::TransactionOperation&);
+ void abortOnServerAndCancelRequests(IDBClient::TransactionOperation&);
+
+ void createObjectStoreOnServer(IDBClient::TransactionOperation&, const IDBObjectStoreInfo&);
+ void didCreateObjectStoreOnServer(const IDBResultData&);
+
+ void createIndexOnServer(IDBClient::TransactionOperation&, const IDBIndexInfo&);
+ void didCreateIndexOnServer(const IDBResultData&);
+
+ void clearObjectStoreOnServer(IDBClient::TransactionOperation&, const uint64_t& objectStoreIdentifier);
+ void didClearObjectStoreOnServer(IDBRequest&, const IDBResultData&);
+
+ void putOrAddOnServer(IDBClient::TransactionOperation&, RefPtr<IDBKey>, RefPtr<SerializedScriptValue>, const IndexedDB::ObjectStoreOverwriteMode&);
+ void didPutOrAddOnServer(IDBRequest&, const IDBResultData&);
+
+ void getRecordOnServer(IDBClient::TransactionOperation&, const IDBKeyRangeData&);
+ void didGetRecordOnServer(IDBRequest&, const IDBResultData&);
+
+ void getCountOnServer(IDBClient::TransactionOperation&, const IDBKeyRangeData&);
+ void didGetCountOnServer(IDBRequest&, const IDBResultData&);
+
+ void deleteRecordOnServer(IDBClient::TransactionOperation&, const IDBKeyRangeData&);
+ void didDeleteRecordOnServer(IDBRequest&, const IDBResultData&);
+
+ void deleteObjectStoreOnServer(IDBClient::TransactionOperation&, const String& objectStoreName);
+ void didDeleteObjectStoreOnServer(const IDBResultData&);
+
+ void deleteIndexOnServer(IDBClient::TransactionOperation&, const uint64_t& objectStoreIdentifier, const String& indexName);
+ void didDeleteIndexOnServer(const IDBResultData&);
+
+ Ref<IDBRequest> doRequestOpenCursor(ScriptExecutionContext&, Ref<IDBCursor>&&);
+ void openCursorOnServer(IDBClient::TransactionOperation&, const IDBCursorInfo&);
+ void didOpenCursorOnServer(IDBRequest&, const IDBResultData&);
+
+ void iterateCursorOnServer(IDBClient::TransactionOperation&, const IDBKeyData&, const unsigned long& count);
+ void didIterateCursorOnServer(IDBRequest&, const IDBResultData&);
+
+ void transitionedToFinishing(IndexedDB::TransactionState);
+
+ void establishOnServer();
+
+ void scheduleOperationTimer();
+
+ Ref<IDBDatabase> m_database;
+ IDBTransactionInfo m_info;
+
+ IndexedDB::TransactionState m_state { IndexedDB::TransactionState::Inactive };
+ bool m_startedOnServer { false };
+
+ IDBError m_idbError;
+ RefPtr<DOMError> m_domError;
+
+ Timer m_operationTimer;
+ std::unique_ptr<Timer> m_activationTimer;
+
+ RefPtr<IDBOpenDBRequest> m_openDBRequest;
+
+ Deque<RefPtr<IDBClient::TransactionOperation>> m_transactionOperationQueue;
+ Deque<RefPtr<IDBClient::TransactionOperation>> m_abortQueue;
+ HashMap<IDBResourceIdentifier, RefPtr<IDBClient::TransactionOperation>> m_transactionOperationMap;
+
+ HashMap<String, RefPtr<IDBObjectStore>> m_referencedObjectStores;
+
+ HashSet<RefPtr<IDBRequest>> m_openRequests;
+
+ bool m_contextStopped { false };
</ins><span class="cx"> };
</span><span class="cx">
</span><ins>+class TransactionActivator {
+ WTF_MAKE_NONCOPYABLE(TransactionActivator);
+public:
+ TransactionActivator(IDBTransaction* transaction)
+ : m_transaction(transaction)
+ {
+ if (m_transaction)
+ m_transaction->activate();
+ }
+
+ ~TransactionActivator()
+ {
+ if (m_transaction)
+ m_transaction->deactivate();
+ }
+
+private:
+ IDBTransaction* m_transaction;
+};
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx">
</span><span class="cx"> #endif // ENABLE(INDEXED_DATABASE)
</span><del>-
-#endif // IDBTransaction_h
</del></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBVersionChangeEventcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBVersionChangeEvent.cpp (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBVersionChangeEvent.cpp        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBVersionChangeEvent.cpp        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -28,23 +28,28 @@
</span><span class="cx">
</span><span class="cx"> #if ENABLE(INDEXED_DATABASE)
</span><span class="cx">
</span><del>-#include "EventNames.h"
-#include "IDBVersionChangeEventImpl.h"
-
</del><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-IDBVersionChangeEvent::IDBVersionChangeEvent(const AtomicString& name)
</del><ins>+IDBVersionChangeEvent::IDBVersionChangeEvent(const IDBResourceIdentifier& requestIdentifier, uint64_t oldVersion, uint64_t newVersion, const AtomicString& name)
</ins><span class="cx"> : Event(name, false /*canBubble*/, false /*cancelable*/)
</span><ins>+ , m_requestIdentifier(requestIdentifier)
+ , m_oldVersion(oldVersion)
+ , m_newVersion(newVersion)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><del>-Ref<IDBVersionChangeEvent> IDBVersionChangeEvent::create()
</del><ins>+Optional<uint64_t> IDBVersionChangeEvent::newVersion() const
</ins><span class="cx"> {
</span><del>- // FIXME: This is called only by document.createEvent. I don't see how it's valuable to create an event with
- // read-only oldVersion attribute of 0 and newVersion of null; preserving that behavior for now.
- return IDBClient::IDBVersionChangeEvent::create(0, 0, eventNames().versionchangeEvent);
</del><ins>+ if (!m_newVersion)
+ return Nullopt;
+ return m_newVersion;
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+EventInterface IDBVersionChangeEvent::eventInterface() const
+{
+ return IDBVersionChangeEventInterfaceType;
+}
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx">
</span><span class="cx"> #endif // ENABLE(INDEXED_DATABASE)
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBVersionChangeEventh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBVersionChangeEvent.h (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBVersionChangeEvent.h        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBVersionChangeEvent.h        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -23,29 +23,49 @@
</span><span class="cx"> * THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><del>-#ifndef IDBVersionChangeEvent_h
-#define IDBVersionChangeEvent_h
</del><ins>+#pragma once
</ins><span class="cx">
</span><span class="cx"> #if ENABLE(INDEXED_DATABASE)
</span><span class="cx">
</span><span class="cx"> #include "Event.h"
</span><ins>+#include "IDBResourceIdentifier.h"
</ins><span class="cx"> #include <wtf/Optional.h>
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-class IDBVersionChangeEvent : public Event {
</del><ins>+class IDBVersionChangeEvent final : public Event {
</ins><span class="cx"> public:
</span><del>- static Ref<IDBVersionChangeEvent> create();
</del><ins>+ static Ref<IDBVersionChangeEvent> create(uint64_t oldVersion, uint64_t newVersion, const AtomicString& eventType)
+ {
+ return adoptRef(*new IDBVersionChangeEvent(IDBResourceIdentifier::emptyValue(), oldVersion, newVersion, eventType));
+ }
</ins><span class="cx">
</span><del>- virtual uint64_t oldVersion() const = 0;
- virtual Optional<uint64_t> newVersion() const = 0;
</del><ins>+ static Ref<IDBVersionChangeEvent> create(const IDBResourceIdentifier& requestIdentifier, uint64_t oldVersion, uint64_t newVersion, const AtomicString& eventType)
+ {
+ return adoptRef(*new IDBVersionChangeEvent(requestIdentifier, oldVersion, newVersion, eventType));
+ }
</ins><span class="cx">
</span><del>-protected:
- explicit IDBVersionChangeEvent(const AtomicString& type);
</del><ins>+ const IDBResourceIdentifier& requestIdentifier() const { return m_requestIdentifier; }
+
+ bool isVersionChangeEvent() const final { return true; }
+
+ uint64_t oldVersion() const { return m_oldVersion; }
+ Optional<uint64_t> newVersion() const;
+
+private:
+ IDBVersionChangeEvent(const IDBResourceIdentifier& requestIdentifier, uint64_t oldVersion, uint64_t newVersion, const AtomicString& eventType);
+
+ EventInterface eventInterface() const;
+
+ IDBResourceIdentifier m_requestIdentifier;
+ uint64_t m_oldVersion;
+ uint64_t m_newVersion;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span><span class="cx">
</span><ins>+SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::IDBVersionChangeEvent)
+ static bool isType(const WebCore::Event& event) { return event.isVersionChangeEvent(); }
+SPECIALIZE_TYPE_TRAITS_END()
+
</ins><span class="cx"> #endif // ENABLE(INDEXED_DATABASE)
</span><del>-
-#endif // IDBVersionChangeEvent_h
</del></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBAnyImplcpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/Modules/indexeddb/client/IDBAnyImpl.cpp (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBAnyImpl.cpp        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBAnyImpl.cpp        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -1,177 +0,0 @@
</span><del>-/*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "IDBAnyImpl.h"
-
-#if ENABLE(INDEXED_DATABASE)
-
-#include "IDBAny.h"
-#include "IDBCursorImpl.h"
-#include "IDBFactory.h"
-#include "IDBIndex.h"
-
-namespace WebCore {
-namespace IDBClient {
-
-IDBAny::IDBAny(IDBAny::Type type)
- : m_type(type)
-{
-}
-
-IDBAny::IDBAny(Ref<IDBDatabase>&& database)
- : m_type(IDBAny::Type::IDBDatabase)
- , m_database(adoptRef(&database.leakRef()))
-{
-}
-
-IDBAny::IDBAny(Ref<IDBObjectStore>&& objectStore)
- : m_type(IDBAny::Type::IDBObjectStore)
- , m_objectStore(WTFMove(objectStore))
-{
-}
-
-IDBAny::IDBAny(Ref<IDBIndex>&& index)
- : m_type(IDBAny::Type::IDBIndex)
- , m_index(WTFMove(index))
-{
-}
-
-IDBAny::IDBAny(Ref<IDBCursor>&& cursor)
-{
- if (cursor->isKeyCursor()) {
- m_type = IDBAny::Type::IDBCursor;
- m_cursor = WTFMove(cursor);
- } else {
- m_type = IDBAny::Type::IDBCursorWithValue;
- m_cursorWithValue = WTFMove(cursor);
- }
-}
-
-IDBAny::IDBAny(const IDBKeyPath& keyPath)
- : m_type(IDBAny::Type::KeyPath)
- , m_idbKeyPath(keyPath)
-{
-}
-
-IDBAny::IDBAny(const Deprecated::ScriptValue& value)
- : m_type(IDBAny::Type::ScriptValue)
- , m_scriptValue(value)
-{
-}
-
-IDBAny::~IDBAny()
-{
-}
-
-RefPtr<WebCore::IDBDatabase> IDBAny::idbDatabase()
-{
- ASSERT(m_type == IDBAny::Type::IDBDatabase);
- return m_database.get();
-}
-
-RefPtr<WebCore::DOMStringList> IDBAny::domStringList()
-{
- return nullptr;
-}
-
-RefPtr<WebCore::IDBCursor> IDBAny::idbCursor()
-{
- ASSERT(m_type == IDBAny::Type::IDBCursor || m_type == IDBAny::Type::IDBCursorWithValue);
- return m_cursor.get();
-}
-
-RefPtr<WebCore::IDBCursorWithValue> IDBAny::idbCursorWithValue()
-{
- ASSERT(m_type == IDBAny::Type::IDBCursorWithValue);
- return m_cursorWithValue.get();
-}
-
-RefPtr<WebCore::IDBFactory> IDBAny::idbFactory()
-{
- return nullptr;
-}
-
-RefPtr<WebCore::IDBIndex> IDBAny::idbIndex()
-{
- ASSERT(m_type == IDBAny::Type::IDBIndex);
- return m_index.get();
-}
-
-RefPtr<WebCore::IDBObjectStore> IDBAny::idbObjectStore()
-{
- ASSERT(m_type == IDBAny::Type::IDBObjectStore);
- return m_objectStore.get();
-}
-
-IDBObjectStore* IDBAny::modernIDBObjectStore()
-{
- ASSERT(m_type == IDBAny::Type::IDBObjectStore);
- return m_objectStore.get();
-}
-
-IDBIndex* IDBAny::modernIDBIndex()
-{
- ASSERT(m_type == IDBAny::Type::IDBIndex);
- return m_index.get();
-}
-
-IDBCursor* IDBAny::modernIDBCursor()
-{
- ASSERT(m_type == IDBAny::Type::IDBCursor || m_type == IDBAny::Type::IDBCursorWithValue);
- if (m_type == IDBAny::Type::IDBCursor)
- return m_cursor.get();
- return m_cursorWithValue.get();
-}
-
-RefPtr<WebCore::IDBTransaction> IDBAny::idbTransaction()
-{
- return nullptr;
-}
-
-const Deprecated::ScriptValue& IDBAny::scriptValue()
-{
- return m_scriptValue;
-}
-
-int64_t IDBAny::integer()
-{
- return m_integer;
-}
-
-const String& IDBAny::string()
-{
- return m_string;
-}
-
-const IDBKeyPath& IDBAny::keyPath()
-{
- return m_idbKeyPath;
-}
-
-} // namespace IDBClient
-} // namespace WebCore
-
-#endif // ENABLE(INDEXED_DATABASE)
</del></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBAnyImplh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/Modules/indexeddb/client/IDBAnyImpl.h (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBAnyImpl.h        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBAnyImpl.h        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -1,122 +0,0 @@
</span><del>-/*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef IDBAnyImpl_h
-#define IDBAnyImpl_h
-
-#if ENABLE(INDEXED_DATABASE)
-
-#include "IDBAny.h"
-#include "IDBDatabaseImpl.h"
-#include "IDBIndexImpl.h"
-#include "IDBObjectStoreImpl.h"
-
-namespace WebCore {
-namespace IDBClient {
-
-class IDBAny : public WebCore::IDBAny {
-public:
- static RefPtr<IDBAny> create(Ref<IDBDatabase>&& database)
- {
- return adoptRef(new IDBAny(WTFMove(database)));
- }
-
- static Ref<IDBAny> create(Ref<IDBObjectStore>&& objectStore)
- {
- return adoptRef(*new IDBAny(WTFMove(objectStore)));
- }
-
- static Ref<IDBAny> create(Ref<IDBIndex>&& index)
- {
- return adoptRef(*new IDBAny(WTFMove(index)));
- }
-
- static RefPtr<IDBAny> create(Ref<IDBCursor>&& cursor)
- {
- return adoptRef(new IDBAny(WTFMove(cursor)));
- }
-
- static RefPtr<IDBAny> create(const IDBKeyPath& keyPath)
- {
- return adoptRef(new IDBAny(keyPath));
- }
-
- static RefPtr<IDBAny> create(const Deprecated::ScriptValue& value)
- {
- return adoptRef(new IDBAny(value));
- }
-
- static RefPtr<IDBAny> createUndefined()
- {
- return adoptRef(new IDBAny(IDBAny::Type::Undefined));
- }
-
- virtual ~IDBAny();
-
- Type type() const final { return m_type; }
- RefPtr<WebCore::DOMStringList> domStringList() final;
- RefPtr<WebCore::IDBCursor> idbCursor() final;
- RefPtr<WebCore::IDBCursorWithValue> idbCursorWithValue() final;
- RefPtr<WebCore::IDBDatabase> idbDatabase() final;
- RefPtr<WebCore::IDBFactory> idbFactory() final;
- RefPtr<WebCore::IDBIndex> idbIndex() final;
- RefPtr<WebCore::IDBObjectStore> idbObjectStore() final;
- RefPtr<WebCore::IDBTransaction> idbTransaction() final;
- const Deprecated::ScriptValue& scriptValue() final;
- int64_t integer() final;
- const String& string() final;
- const IDBKeyPath& keyPath() final;
-
- IDBObjectStore* modernIDBObjectStore();
- IDBIndex* modernIDBIndex();
- IDBCursor* modernIDBCursor();
-
-private:
- explicit IDBAny(IDBAny::Type);
- explicit IDBAny(Ref<IDBDatabase>&&);
- explicit IDBAny(Ref<IDBObjectStore>&&);
- explicit IDBAny(Ref<IDBIndex>&&);
- explicit IDBAny(Ref<IDBCursor>&&);
- explicit IDBAny(const IDBKeyPath&);
- explicit IDBAny(const Deprecated::ScriptValue&);
-
- IDBAny::Type m_type { IDBAny::Type::Undefined };
- RefPtr<IDBDatabase> m_database;
- RefPtr<IDBObjectStore> m_objectStore;
- RefPtr<IDBIndex> m_index;
- RefPtr<IDBCursor> m_cursor;
- RefPtr<IDBCursor> m_cursorWithValue;
-
- const IDBKeyPath m_idbKeyPath;
- const Deprecated::ScriptValue m_scriptValue;
- const String m_string;
- const int64_t m_integer { 0 };
-};
-
-} // namespace IDBClient
-} // namespace WebCore
-
-#endif // ENABLE(INDEXED_DATABASE)
-#endif // IDBAnyImpl_h
</del></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBConnectionToServercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.cpp (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.cpp        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.cpp        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -28,8 +28,9 @@
</span><span class="cx">
</span><span class="cx"> #if ENABLE(INDEXED_DATABASE)
</span><span class="cx">
</span><ins>+#include "IDBDatabase.h"
</ins><span class="cx"> #include "IDBKeyRangeData.h"
</span><del>-#include "IDBOpenDBRequestImpl.h"
</del><ins>+#include "IDBOpenDBRequest.h"
</ins><span class="cx"> #include "IDBRequestData.h"
</span><span class="cx"> #include "IDBResultData.h"
</span><span class="cx"> #include "Logging.h"
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBConnectionToServerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.h (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.h        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.h        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -39,15 +39,15 @@
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="cx"> class IDBCursorInfo;
</span><ins>+class IDBDatabase;
</ins><span class="cx"> class IDBError;
</span><span class="cx"> class IDBObjectStoreInfo;
</span><ins>+class IDBOpenDBRequest;
</ins><span class="cx"> class IDBResultData;
</span><ins>+class IDBTransaction;
</ins><span class="cx">
</span><span class="cx"> namespace IDBClient {
</span><span class="cx">
</span><del>-class IDBDatabase;
-class IDBOpenDBRequest;
-class IDBTransaction;
</del><span class="cx"> class TransactionOperation;
</span><span class="cx">
</span><span class="cx"> class IDBConnectionToServer : public RefCounted<IDBConnectionToServer> {
</span><span class="lines">@@ -130,7 +130,7 @@
</span><span class="cx">
</span><span class="cx"> Ref<IDBConnectionToServerDelegate> m_delegate;
</span><span class="cx">
</span><del>- HashMap<IDBResourceIdentifier, RefPtr<IDBClient::IDBOpenDBRequest>> m_openDBRequestMap;
</del><ins>+ HashMap<IDBResourceIdentifier, RefPtr<IDBOpenDBRequest>> m_openDBRequestMap;
</ins><span class="cx"> HashMap<uint64_t, IDBDatabase*> m_databaseConnectionMap;
</span><span class="cx"> HashMap<IDBResourceIdentifier, RefPtr<IDBTransaction>> m_pendingTransactions;
</span><span class="cx"> HashMap<IDBResourceIdentifier, RefPtr<IDBTransaction>> m_committingTransactions;
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBCursorImplcpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/Modules/indexeddb/client/IDBCursorImpl.cpp (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBCursorImpl.cpp        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBCursorImpl.cpp        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -1,392 +0,0 @@
</span><del>-/*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "IDBCursorImpl.h"
-
-#if ENABLE(INDEXED_DATABASE)
-
-#include "DOMRequestState.h"
-#include "ExceptionCode.h"
-#include "IDBBindingUtilities.h"
-#include "IDBDatabaseException.h"
-#include "IDBGetResult.h"
-#include "Logging.h"
-#include "ScriptExecutionContext.h"
-
-namespace WebCore {
-namespace IDBClient {
-
-Ref<IDBCursor> IDBCursor::create(IDBTransaction& transaction, IDBIndex& index, const IDBCursorInfo& info)
-{
- return adoptRef(*new IDBCursor(transaction, index, info));
-}
-
-IDBCursor::IDBCursor(IDBTransaction& transaction, IDBObjectStore& objectStore, const IDBCursorInfo& info)
- : ActiveDOMObject(transaction.scriptExecutionContext())
- , m_info(info)
- , m_source(IDBAny::create(objectStore).leakRef())
- , m_objectStore(&objectStore)
-{
- suspendIfNeeded();
-}
-
-IDBCursor::IDBCursor(IDBTransaction& transaction, IDBIndex& index, const IDBCursorInfo& info)
- : ActiveDOMObject(transaction.scriptExecutionContext())
- , m_info(info)
- , m_source(IDBAny::create(index).leakRef())
- , m_index(&index)
-{
- suspendIfNeeded();
-}
-
-IDBCursor::~IDBCursor()
-{
-}
-
-bool IDBCursor::sourcesDeleted() const
-{
- if (m_objectStore)
- return m_objectStore->isDeleted();
-
- ASSERT(m_index);
- return m_index->isDeleted() || m_index->modernObjectStore().isDeleted();
-}
-
-IDBObjectStore& IDBCursor::effectiveObjectStore() const
-{
- if (m_objectStore)
- return *m_objectStore;
-
- ASSERT(m_index);
- return m_index->modernObjectStore();
-}
-
-IDBTransaction& IDBCursor::transaction() const
-{
- return effectiveObjectStore().modernTransaction();
-}
-
-const String& IDBCursor::direction() const
-{
- return IDBCursor::directionToString(m_info.cursorDirection());
-}
-
-const Deprecated::ScriptValue& IDBCursor::key() const
-{
- return m_deprecatedCurrentKey;
-}
-
-const Deprecated::ScriptValue& IDBCursor::primaryKey() const
-{
- return m_deprecatedCurrentPrimaryKey;
-}
-
-const Deprecated::ScriptValue& IDBCursor::value() const
-{
- return m_deprecatedCurrentValue;
-}
-
-IDBAny* IDBCursor::source()
-{
- return &m_source.get();
-}
-
-RefPtr<WebCore::IDBRequest> IDBCursor::update(JSC::ExecState& exec, Deprecated::ScriptValue& value, ExceptionCodeWithMessage& ec)
-{
- LOG(IndexedDB, "IDBCursor::update");
-
- if (sourcesDeleted()) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to execute 'update' on 'IDBCursor': The cursor's source or effective object store has been deleted.");
- return nullptr;
- }
-
- if (!transaction().isActive()) {
- ec.code = IDBDatabaseException::TransactionInactiveError;
- ec.message = ASCIILiteral("Failed to execute 'update' on 'IDBCursor': The transaction is inactive or finished.");
- return nullptr;
- }
-
- if (transaction().isReadOnly()) {
- ec.code = IDBDatabaseException::ReadOnlyError;
- ec.message = ASCIILiteral("Failed to execute 'update' on 'IDBCursor': The record may not be updated inside a read-only transaction.");
- return nullptr;
- }
-
- if (!m_gotValue) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to execute 'update' on 'IDBCursor': The cursor is being iterated or has iterated past its end.");
- return nullptr;
- }
-
- if (isKeyCursor()) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to execute 'update' on 'IDBCursor': The cursor is a key cursor.");
- return nullptr;
- }
-
- auto& objectStore = effectiveObjectStore();
- auto& keyPath = objectStore.info().keyPath();
- const bool usesInLineKeys = !keyPath.isNull();
- if (usesInLineKeys) {
- RefPtr<IDBKey> keyPathKey = maybeCreateIDBKeyFromScriptValueAndKeyPath(exec, value, keyPath);
- IDBKeyData keyPathKeyData(keyPathKey.get());
- if (!keyPathKey || keyPathKeyData != m_currentPrimaryKeyData) {
- ec.code = IDBDatabaseException::DataError;
- ec.message = ASCIILiteral("Failed to execute 'update' on 'IDBCursor': The effective object store of this cursor uses in-line keys and evaluating the key path of the value parameter results in a different value than the cursor's effective key.");
- return nullptr;
- }
- }
-
- auto request = effectiveObjectStore().putForCursorUpdate(exec, value.jsValue(), m_deprecatedCurrentPrimaryKey.jsValue(), ec);
- if (ec.code)
- return nullptr;
-
- ASSERT(request);
- request->setSource(*this);
- ++m_outstandingRequestCount;
-
- return request;
-}
-
-void IDBCursor::advance(unsigned long count, ExceptionCodeWithMessage& ec)
-{
- LOG(IndexedDB, "IDBCursor::advance");
-
- if (!m_request) {
- ec.code = IDBDatabaseException::InvalidStateError;
- return;
- }
-
- if (!count) {
- ec.code = TypeError;
- ec.message = ASCIILiteral("Failed to execute 'advance' on 'IDBCursor': A count argument with value 0 (zero) was supplied, must be greater than 0.");
- return;
- }
-
- if (sourcesDeleted()) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to execute 'advance' on 'IDBCursor': The cursor's source or effective object store has been deleted.");
- return;
- }
-
- if (!transaction().isActive()) {
- ec.code = IDBDatabaseException::TransactionInactiveError;
- ec.message = ASCIILiteral("Failed to execute 'advance' on 'IDBCursor': The transaction is inactive or finished.");
- return;
- }
-
- if (!m_gotValue) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to execute 'advance' on 'IDBCursor': The cursor is being iterated or has iterated past its end.");
- return;
- }
-
- m_gotValue = false;
-
- uncheckedIterateCursor(IDBKeyData(), count);
-}
-
-void IDBCursor::continueFunction(ScriptExecutionContext* context, ExceptionCodeWithMessage& ec)
-{
- if (!context) {
- ec.code = IDBDatabaseException::InvalidStateError;
- return;
- }
-
- continueFunction(IDBKeyData(), ec);
-}
-
-void IDBCursor::continueFunction(ScriptExecutionContext& context, const Deprecated::ScriptValue& keyValue, ExceptionCodeWithMessage& ec)
-{
- DOMRequestState requestState(&context);
- RefPtr<IDBKey> key;
- if (!keyValue.jsValue().isUndefined())
- key = scriptValueToIDBKey(&requestState, keyValue);
-
- continueFunction(key.get(), ec);
-}
-
-void IDBCursor::continueFunction(const IDBKeyData& key, ExceptionCodeWithMessage& ec)
-{
- LOG(IndexedDB, "IDBCursor::continueFunction (to key %s)", key.loggingString().utf8().data());
-
- if (!m_request) {
- ec.code = IDBDatabaseException::InvalidStateError;
- return;
- }
-
- if (sourcesDeleted()) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to execute 'continue' on 'IDBCursor': The cursor's source or effective object store has been deleted.");
- return;
- }
-
- if (!transaction().isActive()) {
- ec.code = IDBDatabaseException::TransactionInactiveError;
- ec.message = ASCIILiteral("Failed to execute 'continue' on 'IDBCursor': The transaction is inactive or finished.");
- return;
- }
-
- if (!m_gotValue) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to execute 'continue' on 'IDBCursor': The cursor is being iterated or has iterated past its end.");
- return;
- }
-
- if (!key.isNull() && !key.isValid()) {
- ec.code = IDBDatabaseException::DataError;
- ec.message = ASCIILiteral("Failed to execute 'continue' on 'IDBCursor': The parameter is not a valid key.");
- return;
- }
-
- if (m_info.isDirectionForward()) {
- if (!key.isNull() && key.compare(m_currentKeyData) <= 0) {
- ec.code = IDBDatabaseException::DataError;
- ec.message = ASCIILiteral("Failed to execute 'continue' on 'IDBCursor': The parameter is less than or equal to this cursor's position.");
- return;
- }
- } else if (!key.isNull() && key.compare(m_currentKeyData) >= 0) {
- ec.code = IDBDatabaseException::DataError;
- ec.message = ASCIILiteral("Failed to execute 'continue' on 'IDBCursor': The parameter is greater than or equal to this cursor's position.");
- return;
- }
-
- m_gotValue = false;
-
- uncheckedIterateCursor(key, 0);
-}
-
-void IDBCursor::uncheckedIterateCursor(const IDBKeyData& key, unsigned long count)
-{
- ++m_outstandingRequestCount;
-
- m_request->willIterateCursor(*this);
- transaction().iterateCursor(*this, key, count);
-}
-
-RefPtr<WebCore::IDBRequest> IDBCursor::deleteFunction(ScriptExecutionContext& context, ExceptionCodeWithMessage& ec)
-{
- LOG(IndexedDB, "IDBCursor::deleteFunction");
-
- if (sourcesDeleted()) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to execute 'delete' on 'IDBCursor': The cursor's source or effective object store has been deleted.");
- return nullptr;
- }
-
- if (!transaction().isActive()) {
- ec.code = IDBDatabaseException::TransactionInactiveError;
- ec.message = ASCIILiteral("Failed to execute 'delete' on 'IDBCursor': The transaction is inactive or finished.");
- return nullptr;
- }
-
- if (transaction().isReadOnly()) {
- ec.code = IDBDatabaseException::ReadOnlyError;
- ec.message = ASCIILiteral("Failed to execute 'delete' on 'IDBCursor': The record may not be deleted inside a read-only transaction.");
- return nullptr;
- }
-
- if (!m_gotValue) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to execute 'delete' on 'IDBCursor': The cursor is being iterated or has iterated past its end.");
- return nullptr;
- }
-
- if (isKeyCursor()) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to execute 'delete' on 'IDBCursor': The cursor is a key cursor.");
- return nullptr;
- }
-
- auto request = effectiveObjectStore().modernDelete(context, m_deprecatedCurrentPrimaryKey.jsValue(), ec);
- if (ec.code)
- return nullptr;
-
- ASSERT(request);
- request->setSource(*this);
- ++m_outstandingRequestCount;
-
- return request;
-}
-
-void IDBCursor::setGetResult(IDBRequest& request, const IDBGetResult& getResult)
-{
- LOG(IndexedDB, "IDBCursor::setGetResult - current key %s", getResult.keyData().loggingString().substring(0, 100).utf8().data());
-
- auto* context = request.scriptExecutionContext();
- if (!context)
- return;
-
- if (!getResult.isDefined()) {
- m_deprecatedCurrentKey = { };
- m_currentKeyData = { };
- m_deprecatedCurrentPrimaryKey = { };
- m_currentPrimaryKeyData = { };
- m_deprecatedCurrentValue = { };
-
- m_gotValue = false;
- return;
- }
-
- m_deprecatedCurrentKey = idbKeyDataToScriptValue(context, getResult.keyData());
- m_currentKeyData = getResult.keyData();
- m_deprecatedCurrentPrimaryKey = idbKeyDataToScriptValue(context, getResult.primaryKeyData());
- m_currentPrimaryKeyData = getResult.primaryKeyData();
-
- if (isKeyCursor())
- m_deprecatedCurrentValue = { };
- else
- m_deprecatedCurrentValue = deserializeIDBValueData(*context, getResult.valueBuffer());
-
- m_gotValue = true;
-}
-
-const char* IDBCursor::activeDOMObjectName() const
-{
- return "IDBCursor";
-}
-
-bool IDBCursor::canSuspendForDocumentSuspension() const
-{
- return false;
-}
-
-bool IDBCursor::hasPendingActivity() const
-{
- return m_outstandingRequestCount;
-}
-
-void IDBCursor::decrementOutstandingRequestCount()
-{
- ASSERT(m_outstandingRequestCount);
- --m_outstandingRequestCount;
-}
-
-} // namespace IDBClient
-} // namespace WebCore
-
-#endif // ENABLE(INDEXED_DATABASE)
</del></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBCursorImplh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/Modules/indexeddb/client/IDBCursorImpl.h (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBCursorImpl.h        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBCursorImpl.h        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -1,120 +0,0 @@
</span><del>-/*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef IDBCursorImpl_h
-#define IDBCursorImpl_h
-
-#if ENABLE(INDEXED_DATABASE)
-
-#include "IDBAnyImpl.h"
-#include "IDBCursorInfo.h"
-#include "IDBCursorWithValue.h"
-
-namespace WebCore {
-
-class IDBGetResult;
-
-namespace IDBClient {
-
-class IDBIndex;
-class IDBObjectStore;
-class IDBTransaction;
-
-class IDBCursor : public WebCore::IDBCursorWithValue, public ActiveDOMObject {
-public:
- static Ref<IDBCursor> create(IDBTransaction&, IDBIndex&, const IDBCursorInfo&);
-
- virtual ~IDBCursor();
-
- // Implement the IDL
- const String& direction() const final;
- const Deprecated::ScriptValue& key() const final;
- const Deprecated::ScriptValue& primaryKey() const final;
- const Deprecated::ScriptValue& value() const final;
- IDBAny* source() final;
-
- RefPtr<WebCore::IDBRequest> update(JSC::ExecState&, Deprecated::ScriptValue&, ExceptionCodeWithMessage&) final;
- void advance(unsigned long, ExceptionCodeWithMessage&) final;
- void continueFunction(ScriptExecutionContext*, ExceptionCodeWithMessage&) final;
- void continueFunction(ScriptExecutionContext&, const Deprecated::ScriptValue& key, ExceptionCodeWithMessage&) final;
- RefPtr<WebCore::IDBRequest> deleteFunction(ScriptExecutionContext&, ExceptionCodeWithMessage&) final;
-
- void continueFunction(const IDBKeyData&, ExceptionCodeWithMessage&);
-
- const IDBCursorInfo& info() const { return m_info; }
-
- void setRequest(IDBRequest& request) { m_request = &request; }
- void clearRequest() { m_request = nullptr; }
- IDBRequest* request() { return m_request; }
-
- void setGetResult(IDBRequest&, const IDBGetResult&);
-
- bool isKeyCursor() const override { return true; }
- bool isModernCursor() const final { return true; }
-
- void decrementOutstandingRequestCount();
-
-protected:
- IDBCursor(IDBTransaction&, IDBObjectStore&, const IDBCursorInfo&);
- IDBCursor(IDBTransaction&, IDBIndex&, const IDBCursorInfo&);
-
-private:
- // ActiveDOMObject.
- const char* activeDOMObjectName() const final;
- bool canSuspendForDocumentSuspension() const final;
- bool hasPendingActivity() const final;
-
- // Cursors are created with an outstanding iteration request.
- unsigned m_outstandingRequestCount { 1 };
-
- IDBCursorInfo m_info;
- Ref<IDBAny> m_source;
- IDBObjectStore* m_objectStore { nullptr };
- IDBIndex* m_index { nullptr };
- IDBRequest* m_request;
-
- bool sourcesDeleted() const;
- IDBObjectStore& effectiveObjectStore() const;
- IDBTransaction& transaction() const;
-
- void uncheckedIterateCursor(const IDBKeyData&, unsigned long count);
-
- bool m_gotValue { false };
-
- IDBKeyData m_currentKeyData;
- IDBKeyData m_currentPrimaryKeyData;
-
- // FIXME: When ditching Legacy IDB and combining this implementation with the abstract IDBCursor,
- // these Deprecated::ScriptValue members should be JSValues instead.
- Deprecated::ScriptValue m_deprecatedCurrentKey;
- Deprecated::ScriptValue m_deprecatedCurrentPrimaryKey;
- Deprecated::ScriptValue m_deprecatedCurrentValue;
-};
-
-} // namespace IDBClient
-} // namespace WebCore
-
-#endif // ENABLE(INDEXED_DATABASE)
-#endif // IDBCursorImpl_h
</del></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBCursorWithValueImplcpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/Modules/indexeddb/client/IDBCursorWithValueImpl.cpp (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBCursorWithValueImpl.cpp        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBCursorWithValueImpl.cpp        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -1,61 +0,0 @@
</span><del>-/*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "IDBCursorWithValueImpl.h"
-
-#if ENABLE(INDEXED_DATABASE)
-
-namespace WebCore {
-namespace IDBClient {
-
-Ref<IDBCursorWithValue> IDBCursorWithValue::create(IDBTransaction& transaction, IDBObjectStore& objectStore, const IDBCursorInfo& info)
-{
- return adoptRef(*new IDBCursorWithValue(transaction, objectStore, info));
-}
-
-Ref<IDBCursorWithValue> IDBCursorWithValue::create(IDBTransaction& transaction, IDBIndex& index, const IDBCursorInfo& info)
-{
- return adoptRef(*new IDBCursorWithValue(transaction, index, info));
-}
-
-IDBCursorWithValue::IDBCursorWithValue(IDBTransaction& transaction, IDBObjectStore& objectStore, const IDBCursorInfo& info)
- : IDBCursor(transaction, objectStore, info)
-{
-}
-
-IDBCursorWithValue::IDBCursorWithValue(IDBTransaction& transaction, IDBIndex& index, const IDBCursorInfo& info)
- : IDBCursor(transaction, index, info)
-{
-}
-
-IDBCursorWithValue::~IDBCursorWithValue()
-{
-}
-
-} // namespace IDBClient
-} // namespace WebCore
-
-#endif // ENABLE(INDEXED_DATABASE)
</del></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBCursorWithValueImplh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/Modules/indexeddb/client/IDBCursorWithValueImpl.h (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBCursorWithValueImpl.h        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBCursorWithValueImpl.h        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -1,54 +0,0 @@
</span><del>-/*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef IDBCursorWithValueImpl_h
-#define IDBCursorWithValueImpl_h
-
-#if ENABLE(INDEXED_DATABASE)
-
-#include "IDBCursorImpl.h"
-
-namespace WebCore {
-namespace IDBClient {
-
-class IDBCursorWithValue : public IDBCursor {
-public:
- static Ref<IDBCursorWithValue> create(IDBTransaction&, IDBObjectStore&, const IDBCursorInfo&);
- static Ref<IDBCursorWithValue> create(IDBTransaction&, IDBIndex&, const IDBCursorInfo&);
-
- virtual ~IDBCursorWithValue();
-
- bool isKeyCursor() const final { return false; }
-
-private:
- IDBCursorWithValue(IDBTransaction&, IDBObjectStore&, const IDBCursorInfo&);
- IDBCursorWithValue(IDBTransaction&, IDBIndex&, const IDBCursorInfo&);
-};
-
-} // namespace IDBClient
-} // namespace WebCore
-
-#endif // ENABLE(INDEXED_DATABASE)
-#endif // IDBCursorWithValueImpl_h
</del></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBDatabaseImplcpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/Modules/indexeddb/client/IDBDatabaseImpl.cpp (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBDatabaseImpl.cpp        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBDatabaseImpl.cpp        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -1,431 +0,0 @@
</span><del>-/*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "IDBDatabaseImpl.h"
-
-#if ENABLE(INDEXED_DATABASE)
-
-#include "EventQueue.h"
-#include "IDBConnectionToServer.h"
-#include "IDBDatabaseException.h"
-#include "IDBOpenDBRequestImpl.h"
-#include "IDBResultData.h"
-#include "IDBTransactionImpl.h"
-#include "IDBVersionChangeEventImpl.h"
-#include "Logging.h"
-#include "ScriptExecutionContext.h"
-
-namespace WebCore {
-namespace IDBClient {
-
-Ref<IDBDatabase> IDBDatabase::create(ScriptExecutionContext& context, IDBConnectionToServer& connection, const IDBResultData& resultData)
-{
- return adoptRef(*new IDBDatabase(context, connection, resultData));
-}
-
-IDBDatabase::IDBDatabase(ScriptExecutionContext& context, IDBConnectionToServer& connection, const IDBResultData& resultData)
- : WebCore::IDBDatabase(&context)
- , m_serverConnection(connection)
- , m_info(resultData.databaseInfo())
- , m_databaseConnectionIdentifier(resultData.databaseConnectionIdentifier())
-{
- LOG(IndexedDB, "IDBDatabase::IDBDatabase - Creating database %s with version %" PRIu64 " connection %" PRIu64, m_info.name().utf8().data(), m_info.version(), m_databaseConnectionIdentifier);
- suspendIfNeeded();
- relaxAdoptionRequirement();
- m_serverConnection->registerDatabaseConnection(*this);
-}
-
-IDBDatabase::~IDBDatabase()
-{
- m_serverConnection->unregisterDatabaseConnection(*this);
-}
-
-bool IDBDatabase::hasPendingActivity() const
-{
- return !m_closedInServer;
-}
-
-const String IDBDatabase::name() const
-{
- return m_info.name();
-}
-
-uint64_t IDBDatabase::version() const
-{
- return m_info.version();
-}
-
-RefPtr<DOMStringList> IDBDatabase::objectStoreNames() const
-{
- RefPtr<DOMStringList> objectStoreNames = DOMStringList::create();
- for (auto& name : m_info.objectStoreNames())
- objectStoreNames->append(name);
- objectStoreNames->sort();
- return objectStoreNames;
-}
-
-RefPtr<WebCore::IDBObjectStore> IDBDatabase::createObjectStore(const String&, const Dictionary&, ExceptionCodeWithMessage&)
-{
- ASSERT_NOT_REACHED();
- return nullptr;
-}
-
-RefPtr<WebCore::IDBObjectStore> IDBDatabase::createObjectStore(const String& name, const IDBKeyPath& keyPath, bool autoIncrement, ExceptionCodeWithMessage& ec)
-{
- LOG(IndexedDB, "IDBDatabase::createObjectStore");
-
- ASSERT(!m_versionChangeTransaction || m_versionChangeTransaction->isVersionChange());
-
- if (!m_versionChangeTransaction) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to execute 'createObjectStore' on 'IDBDatabase': The database is not running a version change transaction.");
- return nullptr;
- }
-
- if (!m_versionChangeTransaction->isActive()) {
- ec.code = IDBDatabaseException::TransactionInactiveError;
- return nullptr;
- }
-
- if (m_info.hasObjectStore(name)) {
- ec.code = IDBDatabaseException::ConstraintError;
- ec.message = ASCIILiteral("Failed to execute 'createObjectStore' on 'IDBDatabase': An object store with the specified name already exists.");
- return nullptr;
- }
-
- if (!keyPath.isNull() && !keyPath.isValid()) {
- ec.code = IDBDatabaseException::SyntaxError;
- ec.message = ASCIILiteral("Failed to execute 'createObjectStore' on 'IDBDatabase': The keyPath option is not a valid key path.");
- return nullptr;
- }
-
- if (autoIncrement && !keyPath.isNull()) {
- if ((keyPath.type() == IndexedDB::KeyPathType::String && keyPath.string().isEmpty()) || keyPath.type() == IndexedDB::KeyPathType::Array) {
- ec.code = IDBDatabaseException::InvalidAccessError;
- ec.message = ASCIILiteral("Failed to execute 'createObjectStore' on 'IDBDatabase': The autoIncrement option was set but the keyPath option was empty or an array.");
- return nullptr;
- }
- }
-
- // Install the new ObjectStore into the connection's metadata.
- IDBObjectStoreInfo info = m_info.createNewObjectStore(name, keyPath, autoIncrement);
-
- // Create the actual IDBObjectStore from the transaction, which also schedules the operation server side.
- Ref<IDBObjectStore> objectStore = m_versionChangeTransaction->createObjectStore(info);
- return adoptRef(&objectStore.leakRef());
-}
-
-RefPtr<WebCore::IDBTransaction> IDBDatabase::transaction(ScriptExecutionContext*, const Vector<String>& objectStores, const String& modeString, ExceptionCodeWithMessage& ec)
-{
- LOG(IndexedDB, "IDBDatabase::transaction");
-
- if (m_closePending) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to execute 'transaction' on 'IDBDatabase': The database connection is closing.");
- return nullptr;
- }
-
- if (objectStores.isEmpty()) {
- ec.code = IDBDatabaseException::InvalidAccessError;
- ec.message = ASCIILiteral("Failed to execute 'transaction' on 'IDBDatabase': The storeNames parameter was empty.");
- return nullptr;
- }
-
- IndexedDB::TransactionMode mode = IDBTransaction::stringToMode(modeString, ec.code);
- if (ec.code) {
- ec.message = makeString(ASCIILiteral("Failed to execute 'transaction' on 'IDBDatabase': The mode provided ('"), modeString, ASCIILiteral("') is not one of 'readonly' or 'readwrite'."));
- return nullptr;
- }
-
- if (mode != IndexedDB::TransactionMode::ReadOnly && mode != IndexedDB::TransactionMode::ReadWrite) {
- ec.code = TypeError;
- return nullptr;
- }
-
- if (m_versionChangeTransaction && !m_versionChangeTransaction->isFinishedOrFinishing()) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to execute 'transaction' on 'IDBDatabase': A version change transaction is running.");
- return nullptr;
- }
-
- for (auto& objectStoreName : objectStores) {
- if (m_info.hasObjectStore(objectStoreName))
- continue;
- ec.code = IDBDatabaseException::NotFoundError;
- ec.message = ASCIILiteral("Failed to execute 'transaction' on 'IDBDatabase': One of the specified object stores was not found.");
- return nullptr;
- }
-
- auto info = IDBTransactionInfo::clientTransaction(m_serverConnection.get(), objectStores, mode);
- auto transaction = IDBTransaction::create(*this, info);
-
- LOG(IndexedDB, "IDBDatabase::transaction - Added active transaction %s", info.identifier().loggingString().utf8().data());
-
- m_activeTransactions.set(info.identifier(), &transaction.get());
-
- return adoptRef(&transaction.leakRef());
-}
-
-RefPtr<WebCore::IDBTransaction> IDBDatabase::transaction(ScriptExecutionContext* context, const String& objectStore, const String& mode, ExceptionCodeWithMessage& ec)
-{
- Vector<String> objectStores(1);
- objectStores[0] = objectStore;
- return transaction(context, objectStores, mode, ec);
-}
-
-void IDBDatabase::deleteObjectStore(const String& objectStoreName, ExceptionCodeWithMessage& ec)
-{
- LOG(IndexedDB, "IDBDatabase::deleteObjectStore");
-
- if (!m_versionChangeTransaction) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to execute 'deleteObjectStore' on 'IDBDatabase': The database is not running a version change transaction.");
- return;
- }
-
- if (!m_versionChangeTransaction->isActive()) {
- ec.code = IDBDatabaseException::TransactionInactiveError;
- return;
- }
-
- if (!m_info.hasObjectStore(objectStoreName)) {
- ec.code = IDBDatabaseException::NotFoundError;
- ec.message = ASCIILiteral("Failed to execute 'deleteObjectStore' on 'IDBDatabase': The specified object store was not found.");
- return;
- }
-
- m_info.deleteObjectStore(objectStoreName);
- m_versionChangeTransaction->deleteObjectStore(objectStoreName);
-}
-
-void IDBDatabase::close()
-{
- LOG(IndexedDB, "IDBDatabase::close - %" PRIu64, m_databaseConnectionIdentifier);
-
- m_closePending = true;
- maybeCloseInServer();
-}
-
-void IDBDatabase::maybeCloseInServer()
-{
- LOG(IndexedDB, "IDBDatabase::maybeCloseInServer - %" PRIu64, m_databaseConnectionIdentifier);
-
- if (m_closedInServer)
- return;
-
- // 3.3.9 Database closing steps
- // Wait for all transactions created using this connection to complete.
- // Once they are complete, this connection is closed.
- if (!m_activeTransactions.isEmpty())
- return;
-
- m_closedInServer = true;
- m_serverConnection->databaseConnectionClosed(*this);
-}
-
-const char* IDBDatabase::activeDOMObjectName() const
-{
- return "IDBDatabase";
-}
-
-bool IDBDatabase::canSuspendForDocumentSuspension() const
-{
- // FIXME: This value will sometimes be false when database operations are actually in progress.
- // Such database operations do not yet exist.
- return true;
-}
-
-void IDBDatabase::stop()
-{
- LOG(IndexedDB, "IDBDatabase::stop - %" PRIu64, m_databaseConnectionIdentifier);
-
- Vector<IDBResourceIdentifier> transactionIdentifiers;
- transactionIdentifiers.reserveInitialCapacity(m_activeTransactions.size());
-
- for (auto& id : m_activeTransactions.keys())
- transactionIdentifiers.uncheckedAppend(id);
-
- for (auto& id : transactionIdentifiers) {
- IDBTransaction* transaction = m_activeTransactions.get(id);
- if (transaction)
- transaction->stop();
- }
-
- close();
-}
-
-Ref<IDBTransaction> IDBDatabase::startVersionChangeTransaction(const IDBTransactionInfo& info, IDBOpenDBRequest& request)
-{
- LOG(IndexedDB, "IDBDatabase::startVersionChangeTransaction %s", info.identifier().loggingString().utf8().data());
-
- ASSERT(!m_versionChangeTransaction);
- ASSERT(info.mode() == IndexedDB::TransactionMode::VersionChange);
- ASSERT(!m_closePending);
- ASSERT(scriptExecutionContext());
-
- Ref<IDBTransaction> transaction = IDBTransaction::create(*this, info, request);
- m_versionChangeTransaction = &transaction.get();
-
- m_activeTransactions.set(transaction->info().identifier(), &transaction.get());
-
- return transaction;
-}
-
-void IDBDatabase::didStartTransaction(IDBTransaction& transaction)
-{
- LOG(IndexedDB, "IDBDatabase::didStartTransaction %s", transaction.info().identifier().loggingString().utf8().data());
- ASSERT(!m_versionChangeTransaction);
-
- // It is possible for the client to have aborted a transaction before the server replies back that it has started.
- if (m_abortingTransactions.contains(transaction.info().identifier()))
- return;
-
- m_activeTransactions.set(transaction.info().identifier(), &transaction);
-}
-
-void IDBDatabase::willCommitTransaction(IDBTransaction& transaction)
-{
- LOG(IndexedDB, "IDBDatabase::willCommitTransaction %s", transaction.info().identifier().loggingString().utf8().data());
-
- auto refTransaction = m_activeTransactions.take(transaction.info().identifier());
- ASSERT(refTransaction);
- m_committingTransactions.set(transaction.info().identifier(), WTFMove(refTransaction));
-}
-
-void IDBDatabase::didCommitTransaction(IDBTransaction& transaction)
-{
- LOG(IndexedDB, "IDBDatabase::didCommitTransaction %s", transaction.info().identifier().loggingString().utf8().data());
-
- if (m_versionChangeTransaction == &transaction)
- m_info.setVersion(transaction.info().newVersion());
-
- didCommitOrAbortTransaction(transaction);
-}
-
-void IDBDatabase::willAbortTransaction(IDBTransaction& transaction)
-{
- LOG(IndexedDB, "IDBDatabase::willAbortTransaction %s", transaction.info().identifier().loggingString().utf8().data());
-
- auto refTransaction = m_activeTransactions.take(transaction.info().identifier());
- if (!refTransaction)
- refTransaction = m_committingTransactions.take(transaction.info().identifier());
-
- ASSERT(refTransaction);
- m_abortingTransactions.set(transaction.info().identifier(), WTFMove(refTransaction));
-
- if (transaction.isVersionChange()) {
- ASSERT(transaction.originalDatabaseInfo());
- m_info = *transaction.originalDatabaseInfo();
- m_closePending = true;
- }
-}
-
-void IDBDatabase::didAbortTransaction(IDBTransaction& transaction)
-{
- LOG(IndexedDB, "IDBDatabase::didAbortTransaction %s", transaction.info().identifier().loggingString().utf8().data());
-
- if (transaction.isVersionChange()) {
- ASSERT(transaction.originalDatabaseInfo());
- ASSERT(m_info.version() == transaction.originalDatabaseInfo()->version());
- m_closePending = true;
- maybeCloseInServer();
- }
-
- didCommitOrAbortTransaction(transaction);
-}
-
-void IDBDatabase::didCommitOrAbortTransaction(IDBTransaction& transaction)
-{
- LOG(IndexedDB, "IDBDatabase::didCommitOrAbortTransaction %s", transaction.info().identifier().loggingString().utf8().data());
-
- if (m_versionChangeTransaction == &transaction)
- m_versionChangeTransaction = nullptr;
-
-#ifndef NDBEBUG
- unsigned count = 0;
- if (m_activeTransactions.contains(transaction.info().identifier()))
- ++count;
- if (m_committingTransactions.contains(transaction.info().identifier()))
- ++count;
- if (m_abortingTransactions.contains(transaction.info().identifier()))
- ++count;
-
- ASSERT(count == 1);
-#endif
-
- m_activeTransactions.remove(transaction.info().identifier());
- m_committingTransactions.remove(transaction.info().identifier());
- m_abortingTransactions.remove(transaction.info().identifier());
-
- if (m_closePending)
- maybeCloseInServer();
-}
-
-void IDBDatabase::fireVersionChangeEvent(const IDBResourceIdentifier& requestIdentifier, uint64_t requestedVersion)
-{
- uint64_t currentVersion = m_info.version();
- LOG(IndexedDB, "IDBDatabase::fireVersionChangeEvent - current version %" PRIu64 ", requested version %" PRIu64 ", connection %" PRIu64, currentVersion, requestedVersion, m_databaseConnectionIdentifier);
-
- if (!scriptExecutionContext() || m_closePending) {
- serverConnection().didFireVersionChangeEvent(m_databaseConnectionIdentifier, requestIdentifier);
- return;
- }
-
- Ref<Event> event = IDBVersionChangeEvent::create(requestIdentifier, currentVersion, requestedVersion, eventNames().versionchangeEvent);
- event->setTarget(this);
- scriptExecutionContext()->eventQueue().enqueueEvent(WTFMove(event));
-}
-
-bool IDBDatabase::dispatchEvent(Event& event)
-{
- LOG(IndexedDB, "IDBDatabase::dispatchEvent (%" PRIu64 ")", m_databaseConnectionIdentifier);
-
- bool result = WebCore::IDBDatabase::dispatchEvent(event);
-
- if (event.isVersionChangeEvent() && event.type() == eventNames().versionchangeEvent)
- serverConnection().didFireVersionChangeEvent(m_databaseConnectionIdentifier, downcast<IDBVersionChangeEvent>(event).requestIdentifier());
-
- return result;
-}
-
-void IDBDatabase::didCreateIndexInfo(const IDBIndexInfo& info)
-{
- auto* objectStore = m_info.infoForExistingObjectStore(info.objectStoreIdentifier());
- ASSERT(objectStore);
- objectStore->addExistingIndex(info);
-}
-
-void IDBDatabase::didDeleteIndexInfo(const IDBIndexInfo& info)
-{
- auto* objectStore = m_info.infoForExistingObjectStore(info.objectStoreIdentifier());
- ASSERT(objectStore);
- objectStore->deleteIndex(info.name());
-}
-
-} // namespace IDBClient
-} // namespace WebCore
-
-#endif // ENABLE(INDEXED_DATABASE)
</del></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBDatabaseImplh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/Modules/indexeddb/client/IDBDatabaseImpl.h (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBDatabaseImpl.h        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBDatabaseImpl.h        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -1,121 +0,0 @@
</span><del>-/*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef IDBDatabaseImpl_h
-#define IDBDatabaseImpl_h
-
-#if ENABLE(INDEXED_DATABASE)
-
-#include "IDBConnectionToServer.h"
-#include "IDBDatabase.h"
-#include "IDBDatabaseInfo.h"
-
-namespace WebCore {
-
-class IDBResultData;
-class IDBTransaction;
-class IDBTransactionInfo;
-
-namespace IDBClient {
-
-class IDBTransaction;
-
-class IDBDatabase : public WebCore::IDBDatabase {
-public:
- static Ref<IDBDatabase> create(ScriptExecutionContext&, IDBConnectionToServer&, const IDBResultData&);
-
- virtual ~IDBDatabase();
-
- // IDBDatabase IDL
- const String name() const final;
- uint64_t version() const final;
- RefPtr<DOMStringList> objectStoreNames() const final;
-
- RefPtr<WebCore::IDBObjectStore> createObjectStore(const String& name, const Dictionary&, ExceptionCodeWithMessage&) final;
- RefPtr<WebCore::IDBObjectStore> createObjectStore(const String& name, const IDBKeyPath&, bool autoIncrement, ExceptionCodeWithMessage&) final;
- RefPtr<WebCore::IDBTransaction> transaction(ScriptExecutionContext*, const Vector<String>&, const String& mode, ExceptionCodeWithMessage&) final;
- RefPtr<WebCore::IDBTransaction> transaction(ScriptExecutionContext*, const String&, const String& mode, ExceptionCodeWithMessage&) final;
- void deleteObjectStore(const String& name, ExceptionCodeWithMessage&) final;
- void close() final;
-
- // EventTarget
- EventTargetInterface eventTargetInterface() const final { return IDBDatabaseEventTargetInterfaceType; }
- ScriptExecutionContext* scriptExecutionContext() const final { return ActiveDOMObject::scriptExecutionContext(); }
- void refEventTarget() final { ref(); }
- void derefEventTarget() final { deref(); }
-
- const char* activeDOMObjectName() const final;
- bool canSuspendForDocumentSuspension() const final;
- void stop() final;
-
- const IDBDatabaseInfo& info() const { return m_info; }
- uint64_t databaseConnectionIdentifier() const { return m_databaseConnectionIdentifier; }
-
- Ref<IDBTransaction> startVersionChangeTransaction(const IDBTransactionInfo&, IDBOpenDBRequest&);
- void didStartTransaction(IDBTransaction&);
-
- void willCommitTransaction(IDBTransaction&);
- void didCommitTransaction(IDBTransaction&);
- void willAbortTransaction(IDBTransaction&);
- void didAbortTransaction(IDBTransaction&);
-
- void fireVersionChangeEvent(const IDBResourceIdentifier& requestIdentifier, uint64_t requestedVersion);
-
- IDBConnectionToServer& serverConnection() { return m_serverConnection.get(); }
-
- void didCreateIndexInfo(const IDBIndexInfo&);
- void didDeleteIndexInfo(const IDBIndexInfo&);
-
- bool isClosingOrClosed() const { return m_closePending || m_closedInServer; }
-
- bool dispatchEvent(Event&) final;
-
-private:
- IDBDatabase(ScriptExecutionContext&, IDBConnectionToServer&, const IDBResultData&);
-
- void didCommitOrAbortTransaction(IDBTransaction&);
-
- void maybeCloseInServer();
-
- bool hasPendingActivity() const final;
-
- Ref<IDBConnectionToServer> m_serverConnection;
- IDBDatabaseInfo m_info;
- uint64_t m_databaseConnectionIdentifier { 0 };
-
- bool m_closePending { false };
- bool m_closedInServer { false };
-
- RefPtr<IDBTransaction> m_versionChangeTransaction;
- HashMap<IDBResourceIdentifier, RefPtr<IDBTransaction>> m_activeTransactions;
- HashMap<IDBResourceIdentifier, RefPtr<IDBTransaction>> m_committingTransactions;
- HashMap<IDBResourceIdentifier, RefPtr<IDBTransaction>> m_abortingTransactions;
-};
-
-} // namespace IDBClient
-} // namespace WebCore
-
-#endif // ENABLE(INDEXED_DATABASE)
-#endif // IDBDatabaseImpl_h
</del></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBFactoryImplcpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/Modules/indexeddb/client/IDBFactoryImpl.cpp (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBFactoryImpl.cpp        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBFactoryImpl.cpp        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -1,172 +0,0 @@
</span><del>-/*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "IDBFactoryImpl.h"
-
-#if ENABLE(INDEXED_DATABASE)
-
-#include "DOMRequestState.h"
-#include "Document.h"
-#include "ExceptionCode.h"
-#include "IDBBindingUtilities.h"
-#include "IDBDatabaseIdentifier.h"
-#include "IDBOpenDBRequestImpl.h"
-#include "Logging.h"
-#include "Page.h"
-#include "SchemeRegistry.h"
-#include "ScriptExecutionContext.h"
-#include "SecurityOrigin.h"
-
-namespace WebCore {
-namespace IDBClient {
-
-static bool shouldThrowSecurityException(ScriptExecutionContext& context)
-{
- ASSERT(is<Document>(context) || context.isWorkerGlobalScope());
- if (is<Document>(context)) {
- Document& document = downcast<Document>(context);
- if (!document.frame())
- return true;
- if (!document.page())
- return true;
- }
-
- if (!context.securityOrigin()->canAccessDatabase(context.topOrigin()))
- return true;
-
- return false;
-}
-
-Ref<IDBFactory> IDBFactory::create(IDBConnectionToServer& connection)
-{
- return adoptRef(*new IDBFactory(connection));
-}
-
-IDBFactory::IDBFactory(IDBConnectionToServer& connection)
- : m_connectionToServer(connection)
-{
-}
-
-RefPtr<WebCore::IDBRequest> IDBFactory::getDatabaseNames(ScriptExecutionContext&, ExceptionCode&)
-{
- return nullptr;
-}
-
-RefPtr<WebCore::IDBOpenDBRequest> IDBFactory::open(ScriptExecutionContext& context, const String& name, ExceptionCode& ec)
-{
- LOG(IndexedDB, "IDBFactory::open");
-
- return openInternal(context, name, 0, ec).release();
-}
-
-RefPtr<WebCore::IDBOpenDBRequest> IDBFactory::open(ScriptExecutionContext& context, const String& name, unsigned long long version, ExceptionCode& ec)
-{
- LOG(IndexedDB, "IDBFactory::open");
-
- if (!version) {
- ec = TypeError;
- return nullptr;
- }
-
- return openInternal(context, name, version, ec).release();
-}
-
-RefPtr<IDBOpenDBRequest> IDBFactory::openInternal(ScriptExecutionContext& context, const String& name, unsigned long long version, ExceptionCode& ec)
-{
- if (name.isNull()) {
- ec = TypeError;
- return nullptr;
- }
-
- if (shouldThrowSecurityException(context)) {
- ec = SECURITY_ERR;
- return nullptr;
- }
-
- ASSERT(context.securityOrigin());
- ASSERT(context.topOrigin());
- IDBDatabaseIdentifier databaseIdentifier(name, *context.securityOrigin(), *context.topOrigin());
- if (!databaseIdentifier.isValid()) {
- ec = TypeError;
- return nullptr;
- }
-
- auto request = IDBOpenDBRequest::createOpenRequest(m_connectionToServer.get(), context, databaseIdentifier, version);
- m_connectionToServer->openDatabase(request.get());
-
- return adoptRef(&request.leakRef());
-}
-
-RefPtr<WebCore::IDBOpenDBRequest> IDBFactory::deleteDatabase(ScriptExecutionContext& context, const String& name, ExceptionCode& ec)
-{
- LOG(IndexedDB, "IDBFactory::deleteDatabase - %s", name.utf8().data());
-
- if (name.isNull()) {
- ec = TypeError;
- return nullptr;
- }
-
- if (shouldThrowSecurityException(context)) {
- ec = SECURITY_ERR;
- return nullptr;
- }
-
- ASSERT(context.securityOrigin());
- ASSERT(context.topOrigin());
- IDBDatabaseIdentifier databaseIdentifier(name, *context.securityOrigin(), *context.topOrigin());
- if (!databaseIdentifier.isValid()) {
- ec = TypeError;
- return nullptr;
- }
-
- auto request = IDBOpenDBRequest::createDeleteRequest(m_connectionToServer.get(), context, databaseIdentifier);
- m_connectionToServer->deleteDatabase(request.get());
-
- return adoptRef(&request.leakRef());
-}
-
-short IDBFactory::cmp(ScriptExecutionContext& context, const Deprecated::ScriptValue& firstValue, const Deprecated::ScriptValue& secondValue, ExceptionCodeWithMessage& ec)
-{
- DOMRequestState requestState(&context);
- RefPtr<IDBKey> first = scriptValueToIDBKey(&requestState, firstValue);
- RefPtr<IDBKey> second = scriptValueToIDBKey(&requestState, secondValue);
-
- ASSERT(first);
- ASSERT(second);
-
- if (!first->isValid() || !second->isValid()) {
- ec.code = IDBDatabaseException::DataError;
- ec.message = ASCIILiteral("Failed to execute 'cmp' on 'IDBFactory': The parameter is not a valid key.");
- return 0;
- }
-
- return static_cast<short>(first->compare(second.get()));
-}
-
-} // namespace IDBClient
-} // namespace WebCore
-
-#endif // ENABLE(INDEXED_DATABASE)
</del></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBFactoryImplh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/Modules/indexeddb/client/IDBFactoryImpl.h (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBFactoryImpl.h        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBFactoryImpl.h        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -1,63 +0,0 @@
</span><del>-/*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef IDBFactoryImpl_h
-#define IDBFactoryImpl_h
-
-#if ENABLE(INDEXED_DATABASE)
-
-#include "IDBConnectionToServer.h"
-#include "IDBFactory.h"
-
-namespace WebCore {
-namespace IDBClient {
-
-class IDBOpenDBRequest;
-
-class IDBFactory : public WebCore::IDBFactory {
-public:
- static Ref<IDBFactory> create(IDBConnectionToServer&);
-
- RefPtr<WebCore::IDBRequest> getDatabaseNames(ScriptExecutionContext&, ExceptionCode&) final;
-
- RefPtr<WebCore::IDBOpenDBRequest> open(ScriptExecutionContext&, const String& name, ExceptionCode&) final;
- RefPtr<WebCore::IDBOpenDBRequest> open(ScriptExecutionContext&, const String& name, unsigned long long version, ExceptionCode&) final;
- RefPtr<WebCore::IDBOpenDBRequest> deleteDatabase(ScriptExecutionContext&, const String& name, ExceptionCode&) final;
-
- short cmp(ScriptExecutionContext&, const Deprecated::ScriptValue& first, const Deprecated::ScriptValue& second, ExceptionCodeWithMessage&) final;
-
-private:
- IDBFactory(IDBConnectionToServer&);
-
- RefPtr<IDBOpenDBRequest> openInternal(ScriptExecutionContext&, const String& name, unsigned long long version, ExceptionCode&);
-
- Ref<IDBConnectionToServer> m_connectionToServer;
-};
-
-} // namespace IDBClient
-} // namespace WebCore
-
-#endif // ENABLE(INDEXED_DATABASE)
-#endif // IDBFactoryImpl_h
</del></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBIndexImplcpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/Modules/indexeddb/client/IDBIndexImpl.cpp (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBIndexImpl.cpp        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBIndexImpl.cpp        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -1,343 +0,0 @@
</span><del>-/*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "IDBIndexImpl.h"
-
-#if ENABLE(INDEXED_DATABASE)
-
-#include "DOMRequestState.h"
-#include "IDBAnyImpl.h"
-#include "IDBBindingUtilities.h"
-#include "IDBCursorImpl.h"
-#include "IDBDatabaseException.h"
-#include "IDBKeyRangeData.h"
-#include "IDBObjectStoreImpl.h"
-#include "IDBTransactionImpl.h"
-#include "Logging.h"
-
-namespace WebCore {
-namespace IDBClient {
-
-IDBIndex::IDBIndex(ScriptExecutionContext& context, const IDBIndexInfo& info, IDBObjectStore& objectStore)
- : ActiveDOMObject(&context)
- , m_info(info)
- , m_objectStore(objectStore)
-{
- suspendIfNeeded();
-}
-
-IDBIndex::~IDBIndex()
-{
-}
-
-const char* IDBIndex::activeDOMObjectName() const
-{
- return "IDBIndex";
-}
-
-bool IDBIndex::canSuspendForDocumentSuspension() const
-{
- return false;
-}
-
-bool IDBIndex::hasPendingActivity() const
-{
- return !m_objectStore.modernTransaction().isFinished();
-}
-
-const String& IDBIndex::name() const
-{
- return m_info.name();
-}
-
-RefPtr<WebCore::IDBObjectStore> IDBIndex::objectStore()
-{
- return &m_objectStore;
-}
-
-RefPtr<WebCore::IDBAny> IDBIndex::keyPathAny() const
-{
- return IDBAny::create(m_info.keyPath());
-}
-
-const IDBKeyPath& IDBIndex::keyPath() const
-{
- return m_info.keyPath();
-}
-
-bool IDBIndex::unique() const
-{
- return m_info.unique();
-}
-
-bool IDBIndex::multiEntry() const
-{
- return m_info.multiEntry();
-}
-
-RefPtr<WebCore::IDBRequest> IDBIndex::openCursor(ScriptExecutionContext& context, IDBKeyRange* range, const String& directionString, ExceptionCodeWithMessage& ec)
-{
- LOG(IndexedDB, "IDBIndex::openCursor");
-
- if (m_deleted || m_objectStore.isDeleted()) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to execute 'openCursor' on 'IDBIndex': The index or its object store has been deleted.");
- return nullptr;
- }
-
- if (!m_objectStore.modernTransaction().isActive()) {
- ec.code = IDBDatabaseException::TransactionInactiveError;
- ec.message = ASCIILiteral("Failed to execute 'openCursor' on 'IDBIndex': The transaction is inactive or finished.");
- return nullptr;
- }
-
- IndexedDB::CursorDirection direction = IDBCursor::stringToDirection(directionString, ec.code);
- if (ec.code) {
- ec.message = ASCIILiteral("Failed to execute 'openCursor' on 'IDBIndex': The direction provided ('invalid-direction') is not one of 'next', 'nextunique', 'prev', or 'prevunique'.");
- return nullptr;
- }
-
- IDBKeyRangeData rangeData = range;
- if (rangeData.lowerKey.isNull())
- rangeData.lowerKey = IDBKeyData::minimum();
- if (rangeData.upperKey.isNull())
- rangeData.upperKey = IDBKeyData::maximum();
-
- auto info = IDBCursorInfo::indexCursor(m_objectStore.modernTransaction(), m_objectStore.info().identifier(), m_info.identifier(), rangeData, direction, IndexedDB::CursorType::KeyAndValue);
- return m_objectStore.modernTransaction().requestOpenCursor(context, *this, info);
-}
-
-RefPtr<WebCore::IDBRequest> IDBIndex::openCursor(ScriptExecutionContext& context, const Deprecated::ScriptValue& key, const String& direction, ExceptionCodeWithMessage& ec)
-{
- LOG(IndexedDB, "IDBIndex::openCursor");
- RefPtr<IDBKeyRange> keyRange = IDBKeyRange::only(context, key, ec.code);
- if (ec.code) {
- ec.message = ASCIILiteral("Failed to execute 'openCursor' on 'IDBIndex': The parameter is not a valid key.");
- return nullptr;
- }
-
- return openCursor(context, keyRange.get(), direction, ec);
-}
-
-RefPtr<WebCore::IDBRequest> IDBIndex::count(ScriptExecutionContext& context, ExceptionCodeWithMessage& ec)
-{
- LOG(IndexedDB, "IDBIndex::count");
-
- return doCount(context, IDBKeyRangeData::allKeys(), ec);
-}
-
-RefPtr<WebCore::IDBRequest> IDBIndex::count(ScriptExecutionContext& context, IDBKeyRange* range, ExceptionCodeWithMessage& ec)
-{
- LOG(IndexedDB, "IDBIndex::count");
-
- return doCount(context, range ? IDBKeyRangeData(range) : IDBKeyRangeData::allKeys(), ec);
-}
-
-RefPtr<WebCore::IDBRequest> IDBIndex::count(ScriptExecutionContext& context, const Deprecated::ScriptValue& key, ExceptionCodeWithMessage& ec)
-{
- LOG(IndexedDB, "IDBIndex::count");
-
- DOMRequestState requestState(&context);
- RefPtr<IDBKey> idbKey = scriptValueToIDBKey(&requestState, key);
- if (!idbKey || idbKey->type() == KeyType::Invalid) {
- ec.code = IDBDatabaseException::DataError;
- ec.message = ASCIILiteral("Failed to execute 'count' on 'IDBIndex': The parameter is not a valid key.");
- return nullptr;
- }
-
- return doCount(context, IDBKeyRangeData(idbKey.get()), ec);
-}
-
-RefPtr<WebCore::IDBRequest> IDBIndex::doCount(ScriptExecutionContext& context, const IDBKeyRangeData& range, ExceptionCodeWithMessage& ec)
-{
- if (m_deleted || m_objectStore.isDeleted()) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to execute 'count' on 'IDBIndex': The index or its object store has been deleted.");
- return nullptr;
- }
-
- if (!range.isValid()) {
- ec.code = IDBDatabaseException::DataError;
- return nullptr;
- }
-
- auto& transaction = m_objectStore.modernTransaction();
- if (!transaction.isActive()) {
- ec.code = IDBDatabaseException::TransactionInactiveError;
- ec.message = ASCIILiteral("Failed to execute 'count' on 'IDBIndex': The transaction is inactive or finished.");
- return nullptr;
- }
-
- return transaction.requestCount(context, *this, range);
-}
-
-RefPtr<WebCore::IDBRequest> IDBIndex::openKeyCursor(ScriptExecutionContext& context, IDBKeyRange* range, const String& directionString, ExceptionCodeWithMessage& ec)
-{
- LOG(IndexedDB, "IDBIndex::openKeyCursor");
-
- if (m_deleted || m_objectStore.isDeleted()) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to execute 'openKeyCursor' on 'IDBIndex': The index or its object store has been deleted.");
- return nullptr;
- }
-
- if (!m_objectStore.modernTransaction().isActive()) {
- ec.code = IDBDatabaseException::TransactionInactiveError;
- ec.message = ASCIILiteral("Failed to execute 'openKeyCursor' on 'IDBIndex': The transaction is inactive or finished.");
- return nullptr;
- }
-
- IndexedDB::CursorDirection direction = IDBCursor::stringToDirection(directionString, ec.code);
- if (ec.code) {
- ec.message = ASCIILiteral("Failed to execute 'openKeyCursor' on 'IDBIndex': The direction provided ('invalid-direction') is not one of 'next', 'nextunique', 'prev', or 'prevunique'.");
- return nullptr;
- }
-
- auto info = IDBCursorInfo::indexCursor(m_objectStore.modernTransaction(), m_objectStore.info().identifier(), m_info.identifier(), range, direction, IndexedDB::CursorType::KeyOnly);
- return m_objectStore.modernTransaction().requestOpenCursor(context, *this, info);
-}
-
-RefPtr<WebCore::IDBRequest> IDBIndex::openKeyCursor(ScriptExecutionContext& context, const Deprecated::ScriptValue& key, const String& direction, ExceptionCodeWithMessage& ec)
-{
- LOG(IndexedDB, "IDBIndex::openKeyCursor");
- RefPtr<IDBKeyRange> keyRange = IDBKeyRange::only(context, key, ec.code);
- if (ec.code) {
- ec.message = ASCIILiteral("Failed to execute 'openKeyCursor' on 'IDBIndex': The parameter is not a valid key.");
- return nullptr;
- }
- return openKeyCursor(context, keyRange.get(), direction, ec);
-}
-
-RefPtr<WebCore::IDBRequest> IDBIndex::get(ScriptExecutionContext& context, IDBKeyRange* range, ExceptionCodeWithMessage& ec)
-{
- LOG(IndexedDB, "IDBIndex::get");
-
- return doGet(context, IDBKeyRangeData(range), ec);
-}
-
-RefPtr<WebCore::IDBRequest> IDBIndex::get(ScriptExecutionContext& context, const Deprecated::ScriptValue& key, ExceptionCodeWithMessage& ec)
-{
- LOG(IndexedDB, "IDBIndex::get");
-
- DOMRequestState requestState(&context);
- RefPtr<IDBKey> idbKey = scriptValueToIDBKey(&requestState, key);
- if (!idbKey || idbKey->type() == KeyType::Invalid) {
- ec.code = IDBDatabaseException::DataError;
- ec.message = ASCIILiteral("Failed to execute 'get' on 'IDBIndex': The parameter is not a valid key.");
- return nullptr;
- }
-
- return doGet(context, IDBKeyRangeData(idbKey.get()), ec);
-}
-
-RefPtr<WebCore::IDBRequest> IDBIndex::doGet(ScriptExecutionContext& context, const IDBKeyRangeData& range, ExceptionCodeWithMessage& ec)
-{
- if (m_deleted || m_objectStore.isDeleted()) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to execute 'get' on 'IDBIndex': The index or its object store has been deleted.");
- return nullptr;
- }
-
- if (range.isNull) {
- ec.code = IDBDatabaseException::DataError;
- return nullptr;
- }
-
- auto& transaction = m_objectStore.modernTransaction();
- if (!transaction.isActive()) {
- ec.code = IDBDatabaseException::TransactionInactiveError;
- ec.message = ASCIILiteral("Failed to execute 'get' on 'IDBIndex': The transaction is inactive or finished.");
- return nullptr;
- }
-
- return transaction.requestGetValue(context, *this, range);
-}
-
-RefPtr<WebCore::IDBRequest> IDBIndex::getKey(ScriptExecutionContext& context, IDBKeyRange* range, ExceptionCodeWithMessage& ec)
-{
- LOG(IndexedDB, "IDBIndex::getKey");
-
- return doGetKey(context, IDBKeyRangeData(range), ec);
-}
-
-RefPtr<WebCore::IDBRequest> IDBIndex::getKey(ScriptExecutionContext& context, const Deprecated::ScriptValue& key, ExceptionCodeWithMessage& ec)
-{
- LOG(IndexedDB, "IDBIndex::getKey");
-
- DOMRequestState requestState(&context);
- RefPtr<IDBKey> idbKey = scriptValueToIDBKey(&requestState, key);
- if (!idbKey || idbKey->type() == KeyType::Invalid) {
- ec.code = IDBDatabaseException::DataError;
- ec.message = ASCIILiteral("Failed to execute 'getKey' on 'IDBIndex': The parameter is not a valid key.");
- return nullptr;
- }
-
- return doGetKey(context, IDBKeyRangeData(idbKey.get()), ec);
-}
-
-RefPtr<WebCore::IDBRequest> IDBIndex::doGetKey(ScriptExecutionContext& context, const IDBKeyRangeData& range, ExceptionCodeWithMessage& ec)
-{
- if (m_deleted || m_objectStore.isDeleted()) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to execute 'getKey' on 'IDBIndex': The index or its object store has been deleted.");
- return nullptr;
- }
-
- if (range.isNull) {
- ec.code = IDBDatabaseException::DataError;
- return nullptr;
- }
-
- auto& transaction = m_objectStore.modernTransaction();
- if (!transaction.isActive()) {
- ec.code = IDBDatabaseException::TransactionInactiveError;
- ec.message = ASCIILiteral("Failed to execute 'getKey' on 'IDBIndex': The transaction is inactive or finished.");
- return nullptr;
- }
-
- return transaction.requestGetKey(context, *this, range);
-}
-
-void IDBIndex::markAsDeleted()
-{
- ASSERT(!m_deleted);
- m_deleted = true;
-}
-
-void IDBIndex::ref()
-{
- m_objectStore.ref();
-}
-
-void IDBIndex::deref()
-{
- m_objectStore.deref();
-}
-
-} // namespace IDBClient
-} // namespace WebCore
-
-#endif // ENABLE(INDEXED_DATABASE)
</del></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBIndexImplh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/Modules/indexeddb/client/IDBIndexImpl.h (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBIndexImpl.h        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBIndexImpl.h        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -1,114 +0,0 @@
</span><del>-/*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef IDBIndexImpl_h
-#define IDBIndexImpl_h
-
-#include "IDBIndex.h"
-
-#if ENABLE(INDEXED_DATABASE)
-
-#include "ActiveDOMObject.h"
-#include "IDBIndexInfo.h"
-
-namespace WebCore {
-
-struct IDBKeyRangeData;
-
-namespace IDBClient {
-
-class IDBObjectStore;
-
-class IDBIndex : public WebCore::IDBIndex, public ActiveDOMObject {
-public:
- IDBIndex(ScriptExecutionContext&, const IDBIndexInfo&, IDBObjectStore&);
-
- virtual ~IDBIndex();
-
- // Implement the IDL
- const String& name() const final;
- RefPtr<WebCore::IDBObjectStore> objectStore() final;
- RefPtr<WebCore::IDBAny> keyPathAny() const final;
- const IDBKeyPath& keyPath() const final;
- bool unique() const final;
- bool multiEntry() const final;
-
- RefPtr<WebCore::IDBRequest> openCursor(ScriptExecutionContext& context, ExceptionCodeWithMessage& ec) final { return openCursor(context, static_cast<IDBKeyRange*>(nullptr), ec); }
- RefPtr<WebCore::IDBRequest> openCursor(ScriptExecutionContext& context, IDBKeyRange* keyRange, ExceptionCodeWithMessage& ec) final { return openCursor(context, keyRange, IDBCursor::directionNext(), ec); }
- RefPtr<WebCore::IDBRequest> openCursor(ScriptExecutionContext& context, const Deprecated::ScriptValue& key, ExceptionCodeWithMessage& ec) final { return openCursor(context, key, IDBCursor::directionNext(), ec); }
- RefPtr<WebCore::IDBRequest> openCursor(ScriptExecutionContext&, IDBKeyRange*, const String& direction, ExceptionCodeWithMessage&) final;
- RefPtr<WebCore::IDBRequest> openCursor(ScriptExecutionContext&, const Deprecated::ScriptValue& key, const String& direction, ExceptionCodeWithMessage&) final;
-
- RefPtr<WebCore::IDBRequest> count(ScriptExecutionContext&, ExceptionCodeWithMessage&) final;
- RefPtr<WebCore::IDBRequest> count(ScriptExecutionContext&, IDBKeyRange*, ExceptionCodeWithMessage&) final;
- RefPtr<WebCore::IDBRequest> count(ScriptExecutionContext&, const Deprecated::ScriptValue& key, ExceptionCodeWithMessage&) final;
-
- RefPtr<WebCore::IDBRequest> openKeyCursor(ScriptExecutionContext& context, ExceptionCodeWithMessage& ec) final { return openKeyCursor(context, static_cast<IDBKeyRange*>(nullptr), ec); }
- RefPtr<WebCore::IDBRequest> openKeyCursor(ScriptExecutionContext& context, IDBKeyRange* keyRange, ExceptionCodeWithMessage& ec) final { return openKeyCursor(context, keyRange, IDBCursor::directionNext(), ec); }
- RefPtr<WebCore::IDBRequest> openKeyCursor(ScriptExecutionContext& context, const Deprecated::ScriptValue& key, ExceptionCodeWithMessage& ec) final { return openKeyCursor(context, key, IDBCursor::directionNext(), ec); }
- RefPtr<WebCore::IDBRequest> openKeyCursor(ScriptExecutionContext&, IDBKeyRange*, const String& direction, ExceptionCodeWithMessage&) final;
- RefPtr<WebCore::IDBRequest> openKeyCursor(ScriptExecutionContext&, const Deprecated::ScriptValue& key, const String& direction, ExceptionCodeWithMessage&) final;
-
- RefPtr<WebCore::IDBRequest> get(ScriptExecutionContext&, IDBKeyRange*, ExceptionCodeWithMessage&) final;
- RefPtr<WebCore::IDBRequest> get(ScriptExecutionContext&, const Deprecated::ScriptValue& key, ExceptionCodeWithMessage&) final;
- RefPtr<WebCore::IDBRequest> getKey(ScriptExecutionContext&, IDBKeyRange*, ExceptionCodeWithMessage&) final;
- RefPtr<WebCore::IDBRequest> getKey(ScriptExecutionContext&, const Deprecated::ScriptValue& key, ExceptionCodeWithMessage&) final;
-
- const IDBIndexInfo& info() const { return m_info; }
-
- IDBObjectStore& modernObjectStore() { return m_objectStore; }
-
- void markAsDeleted();
- bool isDeleted() const { return m_deleted; }
-
- bool isModern() const override { return true; }
-
- void ref() override;
- void deref() override;
-
-private:
- RefPtr<WebCore::IDBRequest> doCount(ScriptExecutionContext&, const IDBKeyRangeData&, ExceptionCodeWithMessage&);
- RefPtr<WebCore::IDBRequest> doGet(ScriptExecutionContext&, const IDBKeyRangeData&, ExceptionCodeWithMessage&);
- RefPtr<WebCore::IDBRequest> doGetKey(ScriptExecutionContext&, const IDBKeyRangeData&, ExceptionCodeWithMessage&);
-
- // ActiveDOMObject
- const char* activeDOMObjectName() const final;
- bool canSuspendForDocumentSuspension() const final;
- bool hasPendingActivity() const final;
-
- IDBIndexInfo m_info;
-
- bool m_deleted { false };
-
- // IDBIndex objects are always owned by their referencing IDBObjectStore.
- // Indexes will never outlive ObjectStores so its okay to keep a raw C++ reference here.
- IDBObjectStore& m_objectStore;
-};
-
-} // namespace IDBClient
-} // namespace WebCore
-
-#endif // ENABLE(INDEXED_DATABASE)
-#endif // IDBIndexImpl_h
</del></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBObjectStoreImplcpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.cpp (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.cpp        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.cpp        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -1,661 +0,0 @@
</span><del>-/*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "IDBObjectStoreImpl.h"
-
-#if ENABLE(INDEXED_DATABASE)
-
-#include "DOMRequestState.h"
-#include "IDBBindingUtilities.h"
-#include "IDBCursorImpl.h"
-#include "IDBDatabaseException.h"
-#include "IDBError.h"
-#include "IDBIndexImpl.h"
-#include "IDBKey.h"
-#include "IDBKeyRangeData.h"
-#include "IDBRequestImpl.h"
-#include "IDBTransactionImpl.h"
-#include "IndexedDB.h"
-#include "Logging.h"
-#include "SerializedScriptValue.h"
-#include <wtf/Locker.h>
-
-namespace WebCore {
-namespace IDBClient {
-
-Ref<IDBObjectStore> IDBObjectStore::create(ScriptExecutionContext& context, const IDBObjectStoreInfo& info, IDBTransaction& transaction)
-{
- return adoptRef(*new IDBObjectStore(context, info, transaction));
-}
-
-IDBObjectStore::IDBObjectStore(ScriptExecutionContext& context, const IDBObjectStoreInfo& info, IDBTransaction& transaction)
- : ActiveDOMObject(&context)
- , m_info(info)
- , m_originalInfo(info)
- , m_transaction(transaction)
-{
- suspendIfNeeded();
-}
-
-IDBObjectStore::~IDBObjectStore()
-{
-}
-
-const char* IDBObjectStore::activeDOMObjectName() const
-{
- return "IDBObjectStore";
-}
-
-bool IDBObjectStore::canSuspendForDocumentSuspension() const
-{
- return false;
-}
-
-bool IDBObjectStore::hasPendingActivity() const
-{
- return !m_transaction->isFinished();
-}
-
-const String IDBObjectStore::name() const
-{
- return m_info.name();
-}
-
-RefPtr<WebCore::IDBAny> IDBObjectStore::keyPathAny() const
-{
- return IDBAny::create(m_info.keyPath());
-}
-
-const IDBKeyPath IDBObjectStore::keyPath() const
-{
- return m_info.keyPath();
-}
-
-RefPtr<DOMStringList> IDBObjectStore::indexNames() const
-{
- RefPtr<DOMStringList> indexNames = DOMStringList::create();
- for (auto& name : m_info.indexNames())
- indexNames->append(name);
- indexNames->sort();
-
- return indexNames;
-}
-
-RefPtr<WebCore::IDBTransaction> IDBObjectStore::transaction()
-{
- return &m_transaction.get();
-}
-
-bool IDBObjectStore::autoIncrement() const
-{
- return m_info.autoIncrement();
-}
-
-RefPtr<WebCore::IDBRequest> IDBObjectStore::openCursor(ScriptExecutionContext& context, ExceptionCodeWithMessage& ec)
-{
- return openCursor(context, static_cast<IDBKeyRange*>(nullptr), ec);
-}
-
-RefPtr<WebCore::IDBRequest> IDBObjectStore::openCursor(ScriptExecutionContext& context, IDBKeyRange* keyRange, ExceptionCodeWithMessage& ec)
-{
- return openCursor(context, keyRange, IDBCursor::directionNext(), ec);
-}
-
-RefPtr<WebCore::IDBRequest> IDBObjectStore::openCursor(ScriptExecutionContext& context, const Deprecated::ScriptValue& key, ExceptionCodeWithMessage& ec)
-{
- return openCursor(context, key, IDBCursor::directionNext(), ec);
-}
-
-RefPtr<WebCore::IDBRequest> IDBObjectStore::openCursor(ScriptExecutionContext& context, IDBKeyRange* range, const String& directionString, ExceptionCodeWithMessage& ec)
-{
- LOG(IndexedDB, "IDBObjectStore::openCursor");
-
- if (m_deleted) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to execute 'openCursor' on 'IDBObjectStore': The object store has been deleted.");
- return nullptr;
- }
-
- if (!m_transaction->isActive()) {
- ec.code = IDBDatabaseException::TransactionInactiveError;
- ec.message = ASCIILiteral("Failed to execute 'openCursor' on 'IDBObjectStore': The transaction is inactive or finished.");
- return nullptr;
- }
-
- IndexedDB::CursorDirection direction = IDBCursor::stringToDirection(directionString, ec.code);
- if (ec.code)
- return nullptr;
-
- auto info = IDBCursorInfo::objectStoreCursor(m_transaction.get(), m_info.identifier(), range, direction);
- Ref<IDBRequest> request = m_transaction->requestOpenCursor(context, *this, info);
- return WTFMove(request);
-}
-
-RefPtr<WebCore::IDBRequest> IDBObjectStore::openCursor(ScriptExecutionContext& context, const Deprecated::ScriptValue& key, const String& direction, ExceptionCodeWithMessage& ec)
-{
- RefPtr<IDBKeyRange> keyRange = IDBKeyRange::only(context, key, ec.code);
- if (ec.code) {
- ec.message = ASCIILiteral("Failed to execute 'openCursor' on 'IDBObjectStore': The parameter is not a valid key.");
- return 0;
- }
-
- return openCursor(context, keyRange.get(), direction, ec);
-}
-
-RefPtr<WebCore::IDBRequest> IDBObjectStore::get(ScriptExecutionContext& context, const Deprecated::ScriptValue& key, ExceptionCodeWithMessage& ec)
-{
- LOG(IndexedDB, "IDBObjectStore::get");
-
- if (!m_transaction->isActive()) {
- ec.code = IDBDatabaseException::TransactionInactiveError;
- ec.message = ASCIILiteral("Failed to execute 'get' on 'IDBObjectStore': The transaction is inactive or finished.");
- return nullptr;
- }
-
- if (m_deleted) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to execute 'get' on 'IDBObjectStore': The object store has been deleted.");
- return nullptr;
- }
-
- DOMRequestState requestState(&context);
- RefPtr<IDBKey> idbKey = scriptValueToIDBKey(&requestState, key);
- if (!idbKey || idbKey->type() == KeyType::Invalid) {
- ec.code = IDBDatabaseException::DataError;
- ec.message = ASCIILiteral("Failed to execute 'get' on 'IDBObjectStore': The parameter is not a valid key.");
- return nullptr;
- }
-
- Ref<IDBRequest> request = m_transaction->requestGetRecord(context, *this, idbKey.get());
- return WTFMove(request);
-}
-
-RefPtr<WebCore::IDBRequest> IDBObjectStore::get(ScriptExecutionContext& context, IDBKeyRange* keyRange, ExceptionCodeWithMessage& ec)
-{
- LOG(IndexedDB, "IDBObjectStore::get");
-
- if (!m_transaction->isActive()) {
- ec.code = IDBDatabaseException::TransactionInactiveError;
- return nullptr;
- }
-
- if (m_deleted) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to execute 'get' on 'IDBObjectStore': The object store has been deleted.");
- return nullptr;
- }
-
- IDBKeyRangeData keyRangeData(keyRange);
- if (!keyRangeData.isValid()) {
- ec.code = IDBDatabaseException::DataError;
- return nullptr;
- }
-
- Ref<IDBRequest> request = m_transaction->requestGetRecord(context, *this, keyRangeData);
- return WTFMove(request);
-}
-
-RefPtr<WebCore::IDBRequest> IDBObjectStore::add(JSC::ExecState& state, JSC::JSValue value, ExceptionCodeWithMessage& ec)
-{
- return putOrAdd(state, value, nullptr, IndexedDB::ObjectStoreOverwriteMode::NoOverwrite, InlineKeyCheck::Perform, ec);
-}
-
-RefPtr<WebCore::IDBRequest> IDBObjectStore::add(JSC::ExecState& execState, JSC::JSValue value, JSC::JSValue key, ExceptionCodeWithMessage& ec)
-{
- RefPtr<IDBKey> idbKey;
- if (!key.isUndefined())
- idbKey = scriptValueToIDBKey(execState, key);
- return putOrAdd(execState, value, idbKey, IndexedDB::ObjectStoreOverwriteMode::NoOverwrite, InlineKeyCheck::Perform, ec);
-}
-
-RefPtr<WebCore::IDBRequest> IDBObjectStore::put(JSC::ExecState& execState, JSC::JSValue value, JSC::JSValue key, ExceptionCodeWithMessage& ec)
-{
- RefPtr<IDBKey> idbKey;
- if (!key.isUndefined())
- idbKey = scriptValueToIDBKey(execState, key);
- return putOrAdd(execState, value, idbKey, IndexedDB::ObjectStoreOverwriteMode::Overwrite, InlineKeyCheck::Perform, ec);
-}
-
-RefPtr<WebCore::IDBRequest> IDBObjectStore::put(JSC::ExecState& state, JSC::JSValue value, ExceptionCodeWithMessage& ec)
-{
- return putOrAdd(state, value, nullptr, IndexedDB::ObjectStoreOverwriteMode::Overwrite, InlineKeyCheck::Perform, ec);
-}
-
-RefPtr<IDBRequest> IDBObjectStore::putForCursorUpdate(JSC::ExecState& state, JSC::JSValue value, JSC::JSValue key, ExceptionCodeWithMessage& ec)
-{
- return putOrAdd(state, value, scriptValueToIDBKey(state, key), IndexedDB::ObjectStoreOverwriteMode::OverwriteForCursor, InlineKeyCheck::DoNotPerform, ec);
-}
-
-RefPtr<IDBRequest> IDBObjectStore::putOrAdd(JSC::ExecState& state, JSC::JSValue value, RefPtr<IDBKey> key, IndexedDB::ObjectStoreOverwriteMode overwriteMode, InlineKeyCheck inlineKeyCheck, ExceptionCodeWithMessage& ec)
-{
- LOG(IndexedDB, "IDBObjectStore::putOrAdd");
-
- // The IDB spec for several IDBObjectStore methods states that transaction related exceptions should fire before
- // the exception for an object store being deleted.
- // However, a handful of W3C IDB tests expect the deleted exception even though the transaction inactive exception also applies.
- // Additionally, Chrome and Edge agree with the test, as does Legacy IDB in WebKit.
- // Until this is sorted out, we'll agree with the test and the majority share browsers.
- if (m_deleted) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to store record in an IDBObjectStore: The object store has been deleted.");
- return nullptr;
- }
-
- if (!m_transaction->isActive()) {
- ec.code = IDBDatabaseException::TransactionInactiveError;
- ec.message = ASCIILiteral("Failed to store record in an IDBObjectStore: The transaction is inactive or finished.");
- return nullptr;
- }
-
- if (m_transaction->isReadOnly()) {
- ec.code = IDBDatabaseException::ReadOnlyError;
- ec.message = ASCIILiteral("Failed to store record in an IDBObjectStore: The transaction is read-only.");
- return nullptr;
- }
-
- RefPtr<SerializedScriptValue> serializedValue = SerializedScriptValue::create(&state, value, nullptr, nullptr);
- if (state.hadException()) {
- // Clear the DOM exception from the serializer so we can give a more targeted exception.
- state.clearException();
-
- ec.code = IDBDatabaseException::DataCloneError;
- ec.message = ASCIILiteral("Failed to store record in an IDBObjectStore: An object could not be cloned.");
- return nullptr;
- }
-
- if (serializedValue->hasBlobURLs()) {
- // FIXME: Add Blob/File/FileList support
- ec.code = IDBDatabaseException::DataCloneError;
- ec.message = ASCIILiteral("Failed to store record in an IDBObjectStore: BlobURLs are not yet supported.");
- return nullptr;
- }
-
- if (key && !key->isValid()) {
- ec.code = IDBDatabaseException::DataError;
- ec.message = ASCIILiteral("Failed to store record in an IDBObjectStore: The parameter is not a valid key.");
- return nullptr;
- }
-
- bool usesInlineKeys = !m_info.keyPath().isNull();
- bool usesKeyGenerator = autoIncrement();
- if (usesInlineKeys && inlineKeyCheck == InlineKeyCheck::Perform) {
- if (key) {
- ec.code = IDBDatabaseException::DataError;
- ec.message = ASCIILiteral("Failed to store record in an IDBObjectStore: The object store uses in-line keys and the key parameter was provided.");
- return nullptr;
- }
-
- RefPtr<IDBKey> keyPathKey = maybeCreateIDBKeyFromScriptValueAndKeyPath(state, value, m_info.keyPath());
- if (keyPathKey && !keyPathKey->isValid()) {
- ec.code = IDBDatabaseException::DataError;
- ec.message = ASCIILiteral("Failed to store record in an IDBObjectStore: Evaluating the object store's key path yielded a value that is not a valid key.");
- return nullptr;
- }
-
- if (!keyPathKey) {
- if (usesKeyGenerator) {
- if (!canInjectIDBKeyIntoScriptValue(state, value, m_info.keyPath())) {
- ec.code = IDBDatabaseException::DataError;
- return nullptr;
- }
- } else {
- ec.code = IDBDatabaseException::DataError;
- ec.message = ASCIILiteral("Failed to store record in an IDBObjectStore: Evaluating the object store's key path did not yield a value.");
- return nullptr;
- }
- }
-
- if (keyPathKey) {
- ASSERT(!key);
- key = keyPathKey;
- }
- } else if (!usesKeyGenerator && !key) {
- ec.code = IDBDatabaseException::DataError;
- ec.message = ASCIILiteral("Failed to store record in an IDBObjectStore: The object store uses out-of-line keys and has no key generator and the key parameter was not provided.");
- return nullptr;
- }
-
- auto context = scriptExecutionContextFromExecState(&state);
- if (!context) {
- ec.code = IDBDatabaseException::UnknownError;
- return nullptr;
- }
-
- Ref<IDBRequest> request = m_transaction->requestPutOrAdd(*context, *this, key.get(), *serializedValue, overwriteMode);
- return adoptRef(request.leakRef());
-}
-
-RefPtr<WebCore::IDBRequest> IDBObjectStore::deleteFunction(ScriptExecutionContext& context, IDBKeyRange* keyRange, ExceptionCodeWithMessage& ec)
-{
- return doDelete(context, keyRange, ec);
-}
-
-RefPtr<IDBRequest> IDBObjectStore::doDelete(ScriptExecutionContext& context, IDBKeyRange* keyRange, ExceptionCodeWithMessage& ec)
-{
- LOG(IndexedDB, "IDBObjectStore::deleteFunction");
-
- // The IDB spec for several IDBObjectStore methods states that transaction related exceptions should fire before
- // the exception for an object store being deleted.
- // However, a handful of W3C IDB tests expect the deleted exception even though the transaction inactive exception also applies.
- // Additionally, Chrome and Edge agree with the test, as does Legacy IDB in WebKit.
- // Until this is sorted out, we'll agree with the test and the majority share browsers.
- if (m_deleted) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to execute 'delete' on 'IDBObjectStore': The object store has been deleted.");
- return nullptr;
- }
-
- if (!m_transaction->isActive()) {
- ec.code = IDBDatabaseException::TransactionInactiveError;
- ec.message = ASCIILiteral("Failed to execute 'delete' on 'IDBObjectStore': The transaction is inactive or finished.");
- return nullptr;
- }
-
- if (m_transaction->isReadOnly()) {
- ec.code = IDBDatabaseException::ReadOnlyError;
- ec.message = ASCIILiteral("Failed to execute 'delete' on 'IDBObjectStore': The transaction is read-only.");
- return nullptr;
- }
-
- IDBKeyRangeData keyRangeData(keyRange);
- if (!keyRangeData.isValid()) {
- ec.code = IDBDatabaseException::DataError;
- ec.message = ASCIILiteral("Failed to execute 'delete' on 'IDBObjectStore': The parameter is not a valid key range.");
- return nullptr;
- }
-
- Ref<IDBRequest> request = m_transaction->requestDeleteRecord(context, *this, keyRangeData);
- return WTFMove(request);
-}
-
-RefPtr<WebCore::IDBRequest> IDBObjectStore::deleteFunction(ScriptExecutionContext& context, const Deprecated::ScriptValue& key, ExceptionCodeWithMessage& ec)
-{
- return modernDelete(context, key.jsValue(), ec);
-}
-
-RefPtr<IDBRequest> IDBObjectStore::modernDelete(ScriptExecutionContext& context, JSC::JSValue key, ExceptionCodeWithMessage& ec)
-{
- DOMRequestState requestState(&context);
- RefPtr<IDBKey> idbKey = scriptValueToIDBKey(&requestState, key);
- if (!idbKey || idbKey->type() == KeyType::Invalid) {
- ec.code = IDBDatabaseException::DataError;
- ec.message = ASCIILiteral("Failed to execute 'delete' on 'IDBObjectStore': The parameter is not a valid key.");
- return nullptr;
- }
-
- return doDelete(context, &IDBKeyRange::create(idbKey.get()).get(), ec);
-}
-
-RefPtr<WebCore::IDBRequest> IDBObjectStore::clear(ScriptExecutionContext& context, ExceptionCodeWithMessage& ec)
-{
- LOG(IndexedDB, "IDBObjectStore::clear");
-
- // The IDB spec for several IDBObjectStore methods states that transaction related exceptions should fire before
- // the exception for an object store being deleted.
- // However, a handful of W3C IDB tests expect the deleted exception even though the transaction inactive exception also applies.
- // Additionally, Chrome and Edge agree with the test, as does Legacy IDB in WebKit.
- // Until this is sorted out, we'll agree with the test and the majority share browsers.
- if (m_deleted) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to execute 'clear' on 'IDBObjectStore': The object store has been deleted.");
- return nullptr;
- }
-
- if (!m_transaction->isActive()) {
- ec.code = IDBDatabaseException::TransactionInactiveError;
- ec.message = ASCIILiteral("Failed to execute 'clear' on 'IDBObjectStore': The transaction is inactive or finished.");
- return nullptr;
- }
-
- if (m_transaction->isReadOnly()) {
- ec.code = IDBDatabaseException::ReadOnlyError;
- ec.message = ASCIILiteral("Failed to execute 'clear' on 'IDBObjectStore': The transaction is read-only.");
- return nullptr;
- }
-
- Ref<IDBRequest> request = m_transaction->requestClearObjectStore(context, *this);
- return adoptRef(request.leakRef());
-}
-
-RefPtr<WebCore::IDBIndex> IDBObjectStore::createIndex(ScriptExecutionContext&, const String& name, const IDBKeyPath& keyPath, bool unique, bool multiEntry, ExceptionCodeWithMessage& ec)
-{
- LOG(IndexedDB, "IDBObjectStore::createIndex %s", name.utf8().data());
-
- if (m_deleted) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to execute 'createIndex' on 'IDBObjectStore': The object store has been deleted.");
- return nullptr;
- }
-
- if (!m_transaction->isVersionChange()) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to execute 'createIndex' on 'IDBObjectStore': The database is not running a version change transaction.");
- return nullptr;
- }
-
- if (!m_transaction->isActive()) {
- ec.code = IDBDatabaseException::TransactionInactiveError;
- return nullptr;
- }
-
- if (!keyPath.isValid()) {
- ec.code = IDBDatabaseException::SyntaxError;
- ec.message = ASCIILiteral("Failed to execute 'createIndex' on 'IDBObjectStore': The keyPath argument contains an invalid key path.");
- return nullptr;
- }
-
- if (name.isNull()) {
- ec.code = TypeError;
- return nullptr;
- }
-
- if (m_info.hasIndex(name)) {
- ec.code = IDBDatabaseException::ConstraintError;
- ec.message = ASCIILiteral("Failed to execute 'createIndex' on 'IDBObjectStore': An index with the specified name already exists.");
- return nullptr;
- }
-
- if (keyPath.type() == IndexedDB::KeyPathType::Array && multiEntry) {
- ec.code = IDBDatabaseException::InvalidAccessError;
- ec.message = ASCIILiteral("Failed to execute 'createIndex' on 'IDBObjectStore': The keyPath argument was an array and the multiEntry option is true.");
- return nullptr;
- }
-
- // Install the new Index into the ObjectStore's info.
- IDBIndexInfo info = m_info.createNewIndex(name, keyPath, unique, multiEntry);
- m_transaction->database().didCreateIndexInfo(info);
-
- // Create the actual IDBObjectStore from the transaction, which also schedules the operation server side.
- auto index = m_transaction->createIndex(*this, info);
- RefPtr<IDBIndex> refIndex = index.get();
-
- Locker<Lock> locker(m_referencedIndexLock);
- m_referencedIndexes.set(name, WTFMove(index));
-
- return WTFMove(refIndex);
-}
-
-RefPtr<WebCore::IDBIndex> IDBObjectStore::index(const String& indexName, ExceptionCodeWithMessage& ec)
-{
- LOG(IndexedDB, "IDBObjectStore::index");
-
- if (!scriptExecutionContext())
- return nullptr;
-
- if (m_deleted) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to execute 'index' on 'IDBObjectStore': The object store has been deleted.");
- return nullptr;
- }
-
- if (m_transaction->isFinishedOrFinishing()) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to execute 'index' on 'IDBObjectStore': The transaction is finished.");
- return nullptr;
- }
-
- Locker<Lock> locker(m_referencedIndexLock);
- auto iterator = m_referencedIndexes.find(indexName);
- if (iterator != m_referencedIndexes.end())
- return iterator->value.get();
-
- auto* info = m_info.infoForExistingIndex(indexName);
- if (!info) {
- ec.code = IDBDatabaseException::NotFoundError;
- ec.message = ASCIILiteral("Failed to execute 'index' on 'IDBObjectStore': The specified index was not found.");
- return nullptr;
- }
-
- auto index = std::make_unique<IDBIndex>(*scriptExecutionContext(), *info, *this);
- RefPtr<IDBIndex> refIndex = index.get();
- m_referencedIndexes.set(indexName, WTFMove(index));
-
- return refIndex;
-}
-
-void IDBObjectStore::deleteIndex(const String& name, ExceptionCodeWithMessage& ec)
-{
- LOG(IndexedDB, "IDBObjectStore::deleteIndex %s", name.utf8().data());
-
- if (m_deleted) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to execute 'deleteIndex' on 'IDBObjectStore': The object store has been deleted.");
- return;
- }
-
- if (!m_transaction->isVersionChange()) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to execute 'deleteIndex' on 'IDBObjectStore': The database is not running a version change transaction.");
- return;
- }
-
- if (!m_transaction->isActive()) {
- ec.code = IDBDatabaseException::TransactionInactiveError;
- ec.message = ASCIILiteral("Failed to execute 'deleteIndex' on 'IDBObjectStore': The transaction is inactive or finished.");
- return;
- }
-
- if (!m_info.hasIndex(name)) {
- ec.code = IDBDatabaseException::NotFoundError;
- ec.message = ASCIILiteral("Failed to execute 'deleteIndex' on 'IDBObjectStore': The specified index was not found.");
- return;
- }
-
- auto* info = m_info.infoForExistingIndex(name);
- ASSERT(info);
- m_transaction->database().didDeleteIndexInfo(*info);
-
- m_info.deleteIndex(name);
-
- {
- Locker<Lock> locker(m_referencedIndexLock);
- if (auto index = m_referencedIndexes.take(name)) {
- index->markAsDeleted();
- m_deletedIndexes.add(WTFMove(index));
- }
-
- }
-
- m_transaction->deleteIndex(m_info.identifier(), name);
-}
-
-RefPtr<WebCore::IDBRequest> IDBObjectStore::count(ScriptExecutionContext& context, ExceptionCodeWithMessage& ec)
-{
- LOG(IndexedDB, "IDBObjectStore::count");
-
- return doCount(context, IDBKeyRangeData::allKeys(), ec);
-}
-
-RefPtr<WebCore::IDBRequest> IDBObjectStore::count(ScriptExecutionContext& context, const Deprecated::ScriptValue& key, ExceptionCodeWithMessage& ec)
-{
- LOG(IndexedDB, "IDBObjectStore::count");
-
- DOMRequestState requestState(&context);
- RefPtr<IDBKey> idbKey = scriptValueToIDBKey(&requestState, key);
- if (!idbKey || idbKey->type() == KeyType::Invalid) {
- ec.code = IDBDatabaseException::DataError;
- ec.message = ASCIILiteral("Failed to execute 'count' on 'IDBObjectStore': The parameter is not a valid key.");
- return nullptr;
- }
-
- return doCount(context, IDBKeyRangeData(idbKey.get()), ec);
-}
-
-RefPtr<WebCore::IDBRequest> IDBObjectStore::count(ScriptExecutionContext& context, IDBKeyRange* range, ExceptionCodeWithMessage& ec)
-{
- LOG(IndexedDB, "IDBObjectStore::count");
-
- return doCount(context, range ? IDBKeyRangeData(range) : IDBKeyRangeData::allKeys(), ec);
-}
-
-RefPtr<WebCore::IDBRequest> IDBObjectStore::doCount(ScriptExecutionContext& context, const IDBKeyRangeData& range, ExceptionCodeWithMessage& ec)
-{
- // The IDB spec for several IDBObjectStore methods states that transaction related exceptions should fire before
- // the exception for an object store being deleted.
- // However, a handful of W3C IDB tests expect the deleted exception even though the transaction inactive exception also applies.
- // Additionally, Chrome and Edge agree with the test, as does Legacy IDB in WebKit.
- // Until this is sorted out, we'll agree with the test and the majority share browsers.
- if (m_deleted) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to execute 'count' on 'IDBObjectStore': The object store has been deleted.");
- return nullptr;
- }
-
- if (!m_transaction->isActive()) {
- ec.code = IDBDatabaseException::TransactionInactiveError;
- ec.message = ASCIILiteral("Failed to execute 'count' on 'IDBObjectStore': The transaction is inactive or finished.");
- return nullptr;
- }
-
- if (!range.isValid()) {
- ec.code = IDBDatabaseException::DataError;
- return nullptr;
- }
-
- return m_transaction->requestCount(context, *this, range);
-}
-
-void IDBObjectStore::markAsDeleted()
-{
- m_deleted = true;
-}
-
-void IDBObjectStore::rollbackInfoForVersionChangeAbort()
-{
- m_info = m_originalInfo;
-}
-
-void IDBObjectStore::visitReferencedIndexes(JSC::SlotVisitor& visitor) const
-{
- Locker<Lock> locker(m_referencedIndexLock);
- for (auto& index : m_referencedIndexes.values())
- visitor.addOpaqueRoot(index.get());
-}
-
-} // namespace IDBClient
-} // namespace WebCore
-
-#endif // ENABLE(INDEXED_DATABASE)
</del></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBObjectStoreImplh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.h (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.h        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.h        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -1,133 +0,0 @@
</span><del>-/*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef IDBObjectStoreImpl_h
-#define IDBObjectStoreImpl_h
-
-#if ENABLE(INDEXED_DATABASE)
-
-#include "ActiveDOMObject.h"
-#include "IDBIndexImpl.h"
-#include "IDBObjectStore.h"
-#include "IDBObjectStoreInfo.h"
-#include "IndexedDB.h"
-
-namespace WebCore {
-
-class IDBKey;
-
-struct IDBKeyRangeData;
-
-namespace IDBClient {
-
-class IDBRequest;
-class IDBTransaction;
-
-class IDBObjectStore : public WebCore::IDBObjectStore, public ActiveDOMObject {
-public:
- static Ref<IDBObjectStore> create(ScriptExecutionContext&, const IDBObjectStoreInfo&, IDBTransaction&);
-
- ~IDBObjectStore() final;
-
- // Implement the IDBObjectStore IDL
- const String name() const final;
- RefPtr<WebCore::IDBAny> keyPathAny() const final;
- const IDBKeyPath keyPath() const final;
- RefPtr<DOMStringList> indexNames() const final;
- RefPtr<WebCore::IDBTransaction> transaction() final;
- bool autoIncrement() const final;
-
- RefPtr<WebCore::IDBRequest> add(JSC::ExecState&, JSC::JSValue, ExceptionCodeWithMessage&) final;
- RefPtr<WebCore::IDBRequest> put(JSC::ExecState&, JSC::JSValue, ExceptionCodeWithMessage&) final;
- RefPtr<WebCore::IDBRequest> openCursor(ScriptExecutionContext&, ExceptionCodeWithMessage&) final;
- RefPtr<WebCore::IDBRequest> openCursor(ScriptExecutionContext&, IDBKeyRange*, ExceptionCodeWithMessage&) final;
- RefPtr<WebCore::IDBRequest> openCursor(ScriptExecutionContext&, const Deprecated::ScriptValue& key, ExceptionCodeWithMessage&) final;
- RefPtr<WebCore::IDBRequest> openCursor(ScriptExecutionContext&, IDBKeyRange*, const String& direction, ExceptionCodeWithMessage&) final;
- RefPtr<WebCore::IDBRequest> openCursor(ScriptExecutionContext&, const Deprecated::ScriptValue& key, const String& direction, ExceptionCodeWithMessage&) final;
- RefPtr<WebCore::IDBRequest> get(ScriptExecutionContext&, const Deprecated::ScriptValue& key, ExceptionCodeWithMessage&) final;
- RefPtr<WebCore::IDBRequest> get(ScriptExecutionContext&, IDBKeyRange*, ExceptionCodeWithMessage&) final;
- RefPtr<WebCore::IDBRequest> add(JSC::ExecState&, JSC::JSValue, JSC::JSValue key, ExceptionCodeWithMessage&) final;
- RefPtr<WebCore::IDBRequest> put(JSC::ExecState&, JSC::JSValue, JSC::JSValue key, ExceptionCodeWithMessage&) final;
- RefPtr<WebCore::IDBRequest> deleteFunction(ScriptExecutionContext&, IDBKeyRange*, ExceptionCodeWithMessage&) final;
- RefPtr<WebCore::IDBRequest> deleteFunction(ScriptExecutionContext&, const Deprecated::ScriptValue& key, ExceptionCodeWithMessage&) final;
- RefPtr<WebCore::IDBRequest> clear(ScriptExecutionContext&, ExceptionCodeWithMessage&) final;
- RefPtr<WebCore::IDBIndex> createIndex(ScriptExecutionContext&, const String& name, const IDBKeyPath&, bool unique, bool multiEntry, ExceptionCodeWithMessage&) final;
- RefPtr<WebCore::IDBIndex> index(const String& name, ExceptionCodeWithMessage&) final;
- void deleteIndex(const String& name, ExceptionCodeWithMessage&) final;
- RefPtr<WebCore::IDBRequest> count(ScriptExecutionContext&, ExceptionCodeWithMessage&) final;
- RefPtr<WebCore::IDBRequest> count(ScriptExecutionContext&, IDBKeyRange*, ExceptionCodeWithMessage&) final;
- RefPtr<WebCore::IDBRequest> count(ScriptExecutionContext&, const Deprecated::ScriptValue& key, ExceptionCodeWithMessage&) final;
-
- RefPtr<IDBRequest> putForCursorUpdate(JSC::ExecState&, JSC::JSValue, JSC::JSValue key, ExceptionCodeWithMessage&);
- RefPtr<IDBRequest> modernDelete(ScriptExecutionContext&, JSC::JSValue key, ExceptionCodeWithMessage&);
-
- void markAsDeleted();
- bool isDeleted() const { return m_deleted; }
-
- const IDBObjectStoreInfo& info() const { return m_info; }
-
- // FIXME: After removing LegacyIDB and folding abstract/implementation classes together,
- // this will no longer be necessary.
- IDBTransaction& modernTransaction() { return m_transaction.get(); }
-
- void rollbackInfoForVersionChangeAbort();
-
- bool isModern() const override { return true; }
-
- void visitReferencedIndexes(JSC::SlotVisitor&) const;
-
-private:
- IDBObjectStore(ScriptExecutionContext&, const IDBObjectStoreInfo&, IDBTransaction&);
-
- enum class InlineKeyCheck {
- Perform,
- DoNotPerform,
- };
-
- RefPtr<IDBRequest> putOrAdd(JSC::ExecState&, JSC::JSValue, RefPtr<IDBKey>, IndexedDB::ObjectStoreOverwriteMode, InlineKeyCheck, ExceptionCodeWithMessage&);
- RefPtr<WebCore::IDBRequest> doCount(ScriptExecutionContext&, const IDBKeyRangeData&, ExceptionCodeWithMessage&);
- RefPtr<IDBRequest> doDelete(ScriptExecutionContext&, IDBKeyRange*, ExceptionCodeWithMessage&);
-
- // ActiveDOMObject
- const char* activeDOMObjectName() const final;
- bool canSuspendForDocumentSuspension() const final;
- bool hasPendingActivity() const final;
-
- IDBObjectStoreInfo m_info;
- IDBObjectStoreInfo m_originalInfo;
- Ref<IDBTransaction> m_transaction;
-
- bool m_deleted { false };
-
- mutable Lock m_referencedIndexLock;
- HashMap<String, std::unique_ptr<IDBIndex>> m_referencedIndexes;
- HashSet<std::unique_ptr<IDBIndex>> m_deletedIndexes;
-};
-
-} // namespace IDBClient
-} // namespace WebCore
-
-#endif // ENABLE(INDEXED_DATABASE)
-#endif // IDBObjectStoreImpl_h
</del></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBOpenDBRequestImplcpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -1,214 +0,0 @@
</span><del>-/*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "IDBOpenDBRequestImpl.h"
-
-#if ENABLE(INDEXED_DATABASE)
-
-#include "IDBDatabaseImpl.h"
-#include "IDBError.h"
-#include "IDBRequestCompletionEvent.h"
-#include "IDBResultData.h"
-#include "IDBTransactionImpl.h"
-#include "IDBVersionChangeEventImpl.h"
-#include "Logging.h"
-
-namespace WebCore {
-namespace IDBClient {
-
-Ref<IDBOpenDBRequest> IDBOpenDBRequest::createDeleteRequest(IDBConnectionToServer& connection, ScriptExecutionContext& context, const IDBDatabaseIdentifier& databaseIdentifier)
-{
- ASSERT(databaseIdentifier.isValid());
- return adoptRef(*new IDBOpenDBRequest(connection, context, databaseIdentifier, 0, IndexedDB::RequestType::Delete));
-}
-
-Ref<IDBOpenDBRequest> IDBOpenDBRequest::createOpenRequest(IDBConnectionToServer& connection, ScriptExecutionContext& context, const IDBDatabaseIdentifier& databaseIdentifier, uint64_t version)
-{
- ASSERT(databaseIdentifier.isValid());
- return adoptRef(*new IDBOpenDBRequest(connection, context, databaseIdentifier, version, IndexedDB::RequestType::Open));
-}
-
-IDBOpenDBRequest::IDBOpenDBRequest(IDBConnectionToServer& connection, ScriptExecutionContext& context, const IDBDatabaseIdentifier& databaseIdentifier, uint64_t version, IndexedDB::RequestType requestType)
- : IDBRequest(connection, context)
- , m_databaseIdentifier(databaseIdentifier)
- , m_version(version)
-{
- m_requestType = requestType;
-}
-
-IDBOpenDBRequest::~IDBOpenDBRequest()
-{
-}
-
-void IDBOpenDBRequest::onError(const IDBResultData& data)
-{
- m_domError = DOMError::create(data.error().name());
- enqueueEvent(IDBRequestCompletionEvent::create(eventNames().errorEvent, true, true, *this));
-}
-
-void IDBOpenDBRequest::versionChangeTransactionDidFinish()
-{
- // 3.3.7 "versionchange" transaction steps
- // When the transaction is finished, after firing complete/abort on the transaction, immediately set request's transaction property to null.
- m_shouldExposeTransactionToDOM = false;
-}
-
-void IDBOpenDBRequest::fireSuccessAfterVersionChangeCommit()
-{
- LOG(IndexedDB, "IDBOpenDBRequest::fireSuccessAfterVersionChangeCommit()");
-
- ASSERT(hasPendingActivity());
- ASSERT(m_result);
- ASSERT(m_result->type() == IDBAny::Type::IDBDatabase);
- m_transaction->addRequest(*this);
-
- auto event = IDBRequestCompletionEvent::create(eventNames().successEvent, false, false, *this);
- m_openDatabaseSuccessEvent = &event.get();
-
- enqueueEvent(WTFMove(event));
-}
-
-void IDBOpenDBRequest::fireErrorAfterVersionChangeCompletion()
-{
- LOG(IndexedDB, "IDBOpenDBRequest::fireErrorAfterVersionChangeCompletion()");
-
- ASSERT(hasPendingActivity());
-
- IDBError idbError(IDBDatabaseException::AbortError);
- m_domError = DOMError::create(idbError.name());
- m_result = IDBAny::createUndefined();
-
- m_transaction->addRequest(*this);
- enqueueEvent(IDBRequestCompletionEvent::create(eventNames().errorEvent, true, true, *this));
-}
-
-bool IDBOpenDBRequest::dispatchEvent(Event& event)
-{
- bool result = IDBRequest::dispatchEvent(event);
-
- if (m_transaction && m_transaction->isVersionChange() && (event.type() == eventNames().errorEvent || event.type() == eventNames().successEvent))
- m_transaction->database().serverConnection().didFinishHandlingVersionChangeTransaction(*m_transaction);
-
- return result;
-}
-
-void IDBOpenDBRequest::onSuccess(const IDBResultData& resultData)
-{
- LOG(IndexedDB, "IDBOpenDBRequest::onSuccess()");
-
- if (!scriptExecutionContext())
- return;
-
- Ref<IDBDatabase> database = IDBDatabase::create(*scriptExecutionContext(), connection(), resultData);
- m_result = IDBAny::create(WTFMove(database));
- m_readyState = IDBRequestReadyState::Done;
-
- enqueueEvent(IDBRequestCompletionEvent::create(eventNames().successEvent, false, false, *this));
-}
-
-void IDBOpenDBRequest::onUpgradeNeeded(const IDBResultData& resultData)
-{
- Ref<IDBDatabase> database = IDBDatabase::create(*scriptExecutionContext(), connection(), resultData);
- Ref<IDBTransaction> transaction = database->startVersionChangeTransaction(resultData.transactionInfo(), *this);
-
- ASSERT(transaction->info().mode() == IndexedDB::TransactionMode::VersionChange);
- ASSERT(transaction->originalDatabaseInfo());
-
- uint64_t oldVersion = transaction->originalDatabaseInfo()->version();
- uint64_t newVersion = transaction->info().newVersion();
-
- LOG(IndexedDB, "IDBOpenDBRequest::onUpgradeNeeded() - current version is %" PRIu64 ", new is %" PRIu64, oldVersion, newVersion);
-
- m_result = IDBAny::create(WTFMove(database));
- m_readyState = IDBRequestReadyState::Done;
- m_transaction = adoptRef(&transaction.leakRef());
- m_transaction->addRequest(*this);
-
- enqueueEvent(IDBVersionChangeEvent::create(oldVersion, newVersion, eventNames().upgradeneededEvent));
-}
-
-void IDBOpenDBRequest::onDeleteDatabaseSuccess(const IDBResultData& resultData)
-{
- uint64_t oldVersion = resultData.databaseInfo().version();
-
- LOG(IndexedDB, "IDBOpenDBRequest::onDeleteDatabaseSuccess() - current version is %" PRIu64, oldVersion);
-
- m_readyState = IDBRequestReadyState::Done;
- m_result = IDBAny::createUndefined();
-
- enqueueEvent(IDBVersionChangeEvent::create(oldVersion, 0, eventNames().successEvent));
-}
-
-void IDBOpenDBRequest::requestCompleted(const IDBResultData& data)
-{
- LOG(IndexedDB, "IDBOpenDBRequest::requestCompleted");
-
- // If an Open request was completed after the page has navigated, leaving this request
- // with a stopped script execution context, we need to message back to the server so it
- // doesn't hang waiting on a database connection or transaction that will never exist.
- if (m_contextStopped) {
- switch (data.type()) {
- case IDBResultType::OpenDatabaseSuccess:
- connection().abortOpenAndUpgradeNeeded(data.databaseConnectionIdentifier(), IDBResourceIdentifier::emptyValue());
- break;
- case IDBResultType::OpenDatabaseUpgradeNeeded:
- connection().abortOpenAndUpgradeNeeded(data.databaseConnectionIdentifier(), data.transactionInfo().identifier());
- break;
- default:
- break;
- }
-
- return;
- }
-
- switch (data.type()) {
- case IDBResultType::Error:
- onError(data);
- break;
- case IDBResultType::OpenDatabaseSuccess:
- onSuccess(data);
- break;
- case IDBResultType::OpenDatabaseUpgradeNeeded:
- onUpgradeNeeded(data);
- break;
- case IDBResultType::DeleteDatabaseSuccess:
- onDeleteDatabaseSuccess(data);
- break;
- default:
- RELEASE_ASSERT_NOT_REACHED();
- }
-}
-
-void IDBOpenDBRequest::requestBlocked(uint64_t oldVersion, uint64_t newVersion)
-{
- LOG(IndexedDB, "IDBOpenDBRequest::requestBlocked");
- enqueueEvent(IDBVersionChangeEvent::create(oldVersion, newVersion, eventNames().blockedEvent));
-}
-
-} // namespace IDBClient
-} // namespace WebCore
-
-#endif // ENABLE(INDEXED_DATABASE)
</del></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBOpenDBRequestImplh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.h (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.h        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.h        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -1,80 +0,0 @@
</span><del>-/*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef IDBOpenDBRequestImpl_h
-#define IDBOpenDBRequestImpl_h
-
-#if ENABLE(INDEXED_DATABASE)
-
-#include "DOMError.h"
-#include "IDBDatabaseIdentifier.h"
-#include "IDBRequestImpl.h"
-
-namespace WebCore {
-
-class IDBDatabaseIdentifier;
-
-namespace IDBClient {
-
-class IDBConnectionToServer;
-
-class IDBOpenDBRequest : public IDBRequest {
-public:
- static Ref<IDBOpenDBRequest> createDeleteRequest(IDBConnectionToServer&, ScriptExecutionContext&, const IDBDatabaseIdentifier&);
- static Ref<IDBOpenDBRequest> createOpenRequest(IDBConnectionToServer&, ScriptExecutionContext&, const IDBDatabaseIdentifier&, uint64_t version);
-
- ~IDBOpenDBRequest() final;
-
- const IDBDatabaseIdentifier& databaseIdentifier() const { return m_databaseIdentifier; }
- uint64_t version() const { return m_version; }
-
- void requestCompleted(const IDBResultData&);
- void requestBlocked(uint64_t oldVersion, uint64_t newVersion);
-
- void versionChangeTransactionDidFinish();
- void fireSuccessAfterVersionChangeCommit();
- void fireErrorAfterVersionChangeCompletion();
-
- bool dispatchEvent(Event&) final;
-
-private:
- IDBOpenDBRequest(IDBConnectionToServer&, ScriptExecutionContext&, const IDBDatabaseIdentifier&, uint64_t version, IndexedDB::RequestType);
-
- void onError(const IDBResultData&);
- void onSuccess(const IDBResultData&);
- void onUpgradeNeeded(const IDBResultData&);
- void onDeleteDatabaseSuccess(const IDBResultData&);
-
- bool isOpenDBRequest() const override { return true; }
-
- IDBDatabaseIdentifier m_databaseIdentifier;
- uint64_t m_version { 0 };
-};
-
-} // namespace IDBClient
-} // namespace WebCore
-
-#endif // ENABLE(INDEXED_DATABASE)
-#endif // IDBOpenDBRequestImpl_h
</del></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBRequestImplcpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/Modules/indexeddb/client/IDBRequestImpl.cpp (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBRequestImpl.cpp        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBRequestImpl.cpp        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -1,436 +0,0 @@
</span><del>-/*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "IDBRequestImpl.h"
-
-#if ENABLE(INDEXED_DATABASE)
-
-#include "DOMRequestState.h"
-#include "EventQueue.h"
-#include "IDBBindingUtilities.h"
-#include "IDBCursorImpl.h"
-#include "IDBDatabaseException.h"
-#include "IDBEventDispatcher.h"
-#include "IDBKeyData.h"
-#include "IDBResultData.h"
-#include "Logging.h"
-#include "ScriptExecutionContext.h"
-#include "ThreadSafeDataBuffer.h"
-#include <wtf/NeverDestroyed.h>
-
-namespace WebCore {
-namespace IDBClient {
-
-Ref<IDBRequest> IDBRequest::create(ScriptExecutionContext& context, IDBObjectStore& objectStore, IDBTransaction& transaction)
-{
- return adoptRef(*new IDBRequest(context, objectStore, transaction));
-}
-
-Ref<IDBRequest> IDBRequest::create(ScriptExecutionContext& context, IDBCursor& cursor, IDBTransaction& transaction)
-{
- return adoptRef(*new IDBRequest(context, cursor, transaction));
-}
-
-Ref<IDBRequest> IDBRequest::createCount(ScriptExecutionContext& context, IDBIndex& index, IDBTransaction& transaction)
-{
- return adoptRef(*new IDBRequest(context, index, transaction));
-}
-
-Ref<IDBRequest> IDBRequest::createGet(ScriptExecutionContext& context, IDBIndex& index, IndexedDB::IndexRecordType requestedRecordType, IDBTransaction& transaction)
-{
- return adoptRef(*new IDBRequest(context, index, requestedRecordType, transaction));
-}
-
-IDBRequest::IDBRequest(IDBConnectionToServer& connection, ScriptExecutionContext& context)
- : IDBOpenDBRequest(context)
- , m_connection(connection)
- , m_resourceIdentifier(connection)
-{
- suspendIfNeeded();
-}
-
-IDBRequest::IDBRequest(ScriptExecutionContext& context, IDBObjectStore& objectStore, IDBTransaction& transaction)
- : IDBOpenDBRequest(context)
- , m_transaction(&transaction)
- , m_connection(transaction.serverConnection())
- , m_resourceIdentifier(transaction.serverConnection())
- , m_source(IDBAny::create(objectStore))
-{
- suspendIfNeeded();
-}
-
-IDBRequest::IDBRequest(ScriptExecutionContext& context, IDBCursor& cursor, IDBTransaction& transaction)
- : IDBOpenDBRequest(context)
- , m_transaction(&transaction)
- , m_connection(transaction.serverConnection())
- , m_resourceIdentifier(transaction.serverConnection())
- , m_source(cursor.source())
- , m_pendingCursor(&cursor)
-{
- suspendIfNeeded();
-
- cursor.setRequest(*this);
-}
-
-IDBRequest::IDBRequest(ScriptExecutionContext& context, IDBIndex& index, IDBTransaction& transaction)
- : IDBOpenDBRequest(context)
- , m_transaction(&transaction)
- , m_connection(transaction.serverConnection())
- , m_resourceIdentifier(transaction.serverConnection())
- , m_source(IDBAny::create(index))
-{
- suspendIfNeeded();
-}
-
-IDBRequest::IDBRequest(ScriptExecutionContext& context, IDBIndex& index, IndexedDB::IndexRecordType requestedRecordType, IDBTransaction& transaction)
- : IDBRequest(context, index, transaction)
-{
- m_requestedIndexRecordType = requestedRecordType;
-}
-
-IDBRequest::~IDBRequest()
-{
- if (m_result) {
- auto type = m_result->type();
- if (type == IDBAny::Type::IDBCursor || type == IDBAny::Type::IDBCursorWithValue)
- m_result->modernIDBCursor()->clearRequest();
- }
-}
-
-RefPtr<WebCore::IDBAny> IDBRequest::result(ExceptionCodeWithMessage& ec) const
-{
- if (m_readyState == IDBRequestReadyState::Done)
- return m_result;
-
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to read the 'result' property from 'IDBRequest': The request has not finished.");
- return nullptr;
-}
-
-unsigned short IDBRequest::errorCode(ExceptionCode&) const
-{
- return 0;
-}
-
-RefPtr<DOMError> IDBRequest::error(ExceptionCodeWithMessage& ec) const
-{
- if (m_readyState == IDBRequestReadyState::Done)
- return m_domError;
-
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to read the 'error' property from 'IDBRequest': The request has not finished.");
- return nullptr;
-}
-
-RefPtr<WebCore::IDBAny> IDBRequest::source() const
-{
- return m_source;
-}
-
-void IDBRequest::setSource(IDBCursor& cursor)
-{
- ASSERT(!m_cursorRequestNotifier);
-
- m_source = IDBAny::create(cursor);
- m_cursorRequestNotifier = std::make_unique<ScopeGuard>([this]() {
- ASSERT(m_source->type() == IDBAny::Type::IDBCursor || m_source->type() == IDBAny::Type::IDBCursorWithValue);
- m_source->modernIDBCursor()->decrementOutstandingRequestCount();
- });
-}
-
-void IDBRequest::setVersionChangeTransaction(IDBTransaction& transaction)
-{
- ASSERT(!m_transaction);
- ASSERT(transaction.isVersionChange());
- ASSERT(!transaction.isFinishedOrFinishing());
-
- m_transaction = &transaction;
-}
-
-RefPtr<WebCore::IDBTransaction> IDBRequest::transaction() const
-{
- return m_shouldExposeTransactionToDOM ? m_transaction : nullptr;
-}
-
-const String& IDBRequest::readyState() const
-{
- static WTF::NeverDestroyed<String> pendingString("pending");
- static WTF::NeverDestroyed<String> doneString("done");
-
- switch (m_readyState) {
- case IDBRequestReadyState::Pending:
- return pendingString;
- case IDBRequestReadyState::Done:
- return doneString;
- default:
- RELEASE_ASSERT_NOT_REACHED();
- }
-}
-
-uint64_t IDBRequest::sourceObjectStoreIdentifier() const
-{
- if (!m_source)
- return 0;
-
- if (m_source->type() == IDBAny::Type::IDBObjectStore) {
- auto* objectStore = m_source->modernIDBObjectStore();
- if (!objectStore)
- return 0;
- return objectStore->info().identifier();
- }
-
- if (m_source->type() == IDBAny::Type::IDBIndex) {
- auto* index = m_source->modernIDBIndex();
- if (!index)
- return 0;
- return index->info().objectStoreIdentifier();
- }
-
- return 0;
-}
-
-uint64_t IDBRequest::sourceIndexIdentifier() const
-{
- if (!m_source)
- return 0;
- if (m_source->type() != IDBAny::Type::IDBIndex)
- return 0;
- if (!m_source->modernIDBIndex())
- return 0;
-
- return m_source->modernIDBIndex()->info().identifier();
-}
-
-IndexedDB::IndexRecordType IDBRequest::requestedIndexRecordType() const
-{
- ASSERT(m_source);
- ASSERT(m_source->type() == IDBAny::Type::IDBIndex);
-
- return m_requestedIndexRecordType;
-}
-
-EventTargetInterface IDBRequest::eventTargetInterface() const
-{
- return IDBRequestEventTargetInterfaceType;
-}
-
-const char* IDBRequest::activeDOMObjectName() const
-{
- return "IDBRequest";
-}
-
-bool IDBRequest::canSuspendForDocumentSuspension() const
-{
- return false;
-}
-
-bool IDBRequest::hasPendingActivity() const
-{
- return m_hasPendingActivity;
-}
-
-void IDBRequest::stop()
-{
- ASSERT(!m_contextStopped);
- m_contextStopped = true;
-}
-
-void IDBRequest::enqueueEvent(Ref<Event>&& event)
-{
- if (!scriptExecutionContext() || m_contextStopped)
- return;
-
- event->setTarget(this);
- scriptExecutionContext()->eventQueue().enqueueEvent(WTFMove(event));
-}
-
-bool IDBRequest::dispatchEvent(Event& event)
-{
- LOG(IndexedDB, "IDBRequest::dispatchEvent - %s (%p)", event.type().string().utf8().data(), this);
-
- ASSERT(m_hasPendingActivity);
- ASSERT(!m_contextStopped);
-
- if (event.type() != eventNames().blockedEvent)
- m_readyState = IDBRequestReadyState::Done;
-
- Vector<RefPtr<EventTarget>> targets;
- targets.append(this);
-
- if (&event == m_openDatabaseSuccessEvent)
- m_openDatabaseSuccessEvent = nullptr;
- else if (m_transaction && !m_transaction->isFinished()) {
- targets.append(m_transaction);
- targets.append(m_transaction->db());
- }
-
- m_hasPendingActivity = false;
-
- m_cursorRequestNotifier = nullptr;
-
- bool dontPreventDefault;
- {
- TransactionActivator activator(m_transaction.get());
- dontPreventDefault = IDBEventDispatcher::dispatch(event, targets);
- }
-
- // IDBEventDispatcher::dispatch() might have set the pending activity flag back to true, suggesting the request will be reused.
- // We might also re-use the request if this event was the upgradeneeded event for an IDBOpenDBRequest.
- if (!m_hasPendingActivity)
- m_hasPendingActivity = isOpenDBRequest() && (event.type() == eventNames().upgradeneededEvent || event.type() == eventNames().blockedEvent);
-
- // The request should only remain in the transaction's request list if it represents a pending cursor operation, or this is an open request that was blocked.
- if (m_transaction && !m_pendingCursor && event.type() != eventNames().blockedEvent)
- m_transaction->removeRequest(*this);
-
- if (dontPreventDefault && event.type() == eventNames().errorEvent && m_transaction && !m_transaction->isFinishedOrFinishing()) {
- ASSERT(m_domError);
- m_transaction->abortDueToFailedRequest(*m_domError);
- }
-
- return dontPreventDefault;
-}
-
-void IDBRequest::uncaughtExceptionInEventHandler()
-{
- LOG(IndexedDB, "IDBRequest::uncaughtExceptionInEventHandler");
-
- if (m_transaction && m_idbError.code() != IDBDatabaseException::AbortError)
- m_transaction->abortDueToFailedRequest(DOMError::create(IDBDatabaseException::getErrorName(IDBDatabaseException::AbortError)));
-}
-
-void IDBRequest::setResult(const IDBKeyData* keyData)
-{
- if (!keyData) {
- m_result = nullptr;
- return;
- }
-
- Deprecated::ScriptValue value = idbKeyDataToScriptValue(scriptExecutionContext(), *keyData);
- m_result = IDBAny::create(WTFMove(value));
-}
-
-void IDBRequest::setResult(uint64_t number)
-{
- ASSERT(scriptExecutionContext());
- m_result = IDBAny::create(Deprecated::ScriptValue(scriptExecutionContext()->vm(), JSC::JSValue(number)));
-}
-
-void IDBRequest::setResultToStructuredClone(const ThreadSafeDataBuffer& valueData)
-{
- LOG(IndexedDB, "IDBRequest::setResultToStructuredClone");
-
- auto context = scriptExecutionContext();
- if (!context)
- return;
-
- Deprecated::ScriptValue value = deserializeIDBValueData(*context, valueData);
- m_result = IDBAny::create(WTFMove(value));
-}
-
-void IDBRequest::setResultToUndefined()
-{
- m_result = IDBAny::createUndefined();
-}
-
-IDBCursor* IDBRequest::resultCursor()
-{
- if (!m_result)
- return nullptr;
- if (m_result->type() == IDBAny::Type::IDBCursor || m_result->type() == IDBAny::Type::IDBCursorWithValue)
- return m_result->modernIDBCursor();
- return nullptr;
-}
-
-void IDBRequest::willIterateCursor(IDBCursor& cursor)
-{
- ASSERT(m_readyState == IDBRequestReadyState::Done);
- ASSERT(scriptExecutionContext());
- ASSERT(m_transaction);
- ASSERT(!m_pendingCursor);
- ASSERT(&cursor == resultCursor());
- ASSERT(!m_cursorRequestNotifier);
-
- m_pendingCursor = &cursor;
- m_hasPendingActivity = true;
- m_result = nullptr;
- m_readyState = IDBRequestReadyState::Pending;
- m_domError = nullptr;
- m_idbError = { };
-
- m_cursorRequestNotifier = std::make_unique<ScopeGuard>([this]() {
- m_pendingCursor->decrementOutstandingRequestCount();
- });
-}
-
-void IDBRequest::didOpenOrIterateCursor(const IDBResultData& resultData)
-{
- ASSERT(m_pendingCursor);
- m_result = nullptr;
-
- if (resultData.type() == IDBResultType::IterateCursorSuccess || resultData.type() == IDBResultType::OpenCursorSuccess) {
- m_pendingCursor->setGetResult(*this, resultData.getResult());
- if (resultData.getResult().isDefined())
- m_result = IDBAny::create(*m_pendingCursor);
- }
-
- m_cursorRequestNotifier = nullptr;
- m_pendingCursor = nullptr;
-
- requestCompleted(resultData);
-}
-
-void IDBRequest::requestCompleted(const IDBResultData& resultData)
-{
- m_readyState = IDBRequestReadyState::Done;
-
- m_idbError = resultData.error();
- if (!m_idbError.isNull())
- onError();
- else
- onSuccess();
-}
-
-void IDBRequest::onError()
-{
- LOG(IndexedDB, "IDBRequest::onError");
-
- ASSERT(!m_idbError.isNull());
- m_domError = DOMError::create(m_idbError.name());
- enqueueEvent(Event::create(eventNames().errorEvent, true, true));
-}
-
-void IDBRequest::onSuccess()
-{
- LOG(IndexedDB, "IDBRequest::onSuccess");
-
- enqueueEvent(Event::create(eventNames().successEvent, false, false));
-}
-
-} // namespace IDBClient
-} // namespace WebCore
-
-#endif // ENABLE(INDEXED_DATABASE)
</del></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBRequestImplh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/Modules/indexeddb/client/IDBRequestImpl.h (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBRequestImpl.h        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBRequestImpl.h        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -1,158 +0,0 @@
</span><del>-/*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef IDBRequestImpl_h
-#define IDBRequestImpl_h
-
-#if ENABLE(INDEXED_DATABASE)
-
-#include "IDBAnyImpl.h"
-#include "IDBOpenDBRequest.h"
-#include "IDBResourceIdentifier.h"
-#include "IDBTransactionImpl.h"
-#include "ScopeGuard.h"
-#include <wtf/RefCounted.h>
-
-namespace WebCore {
-
-class Event;
-class IDBKeyData;
-class IDBResultData;
-class ThreadSafeDataBuffer;
-
-namespace IndexedDB {
-enum class IndexRecordType;
-}
-
-namespace IDBClient {
-
-class IDBConnectionToServer;
-
-class IDBRequest : public WebCore::IDBOpenDBRequest, public RefCounted<IDBRequest> {
-public:
- static Ref<IDBRequest> create(ScriptExecutionContext&, IDBObjectStore&, IDBTransaction&);
- static Ref<IDBRequest> create(ScriptExecutionContext&, IDBCursor&, IDBTransaction&);
- static Ref<IDBRequest> createCount(ScriptExecutionContext&, IDBIndex&, IDBTransaction&);
- static Ref<IDBRequest> createGet(ScriptExecutionContext&, IDBIndex&, IndexedDB::IndexRecordType, IDBTransaction&);
-
- const IDBResourceIdentifier& resourceIdentifier() const { return m_resourceIdentifier; }
-
- ~IDBRequest() override;
-
- RefPtr<WebCore::IDBAny> result(ExceptionCodeWithMessage&) const override;
- unsigned short errorCode(ExceptionCode&) const override;
- RefPtr<DOMError> error(ExceptionCodeWithMessage&) const override;
- RefPtr<WebCore::IDBAny> source() const override;
- RefPtr<WebCore::IDBTransaction> transaction() const override;
- const String& readyState() const override;
-
- uint64_t sourceObjectStoreIdentifier() const;
- uint64_t sourceIndexIdentifier() const;
- IndexedDB::IndexRecordType requestedIndexRecordType() const;
-
- // EventTarget
- EventTargetInterface eventTargetInterface() const override;
- ScriptExecutionContext* scriptExecutionContext() const final { return ActiveDOMObject::scriptExecutionContext(); }
-
- using RefCounted<IDBRequest>::ref;
- using RefCounted<IDBRequest>::deref;
-
- void enqueueEvent(Ref<Event>&&);
- bool dispatchEvent(Event&) override;
-
- IDBConnectionToServer& connection() { return m_connection; }
-
- void requestCompleted(const IDBResultData&);
-
- void setResult(const IDBKeyData*);
- void setResult(uint64_t);
- void setResultToStructuredClone(const ThreadSafeDataBuffer&);
- void setResultToUndefined();
-
- IDBAny* modernResult() { return m_result.get(); }
-
- void willIterateCursor(IDBCursor&);
- void didOpenOrIterateCursor(const IDBResultData&);
-
- const IDBCursor* pendingCursor() const { return m_pendingCursor.get(); }
-
- void setSource(IDBCursor&);
- void setVersionChangeTransaction(IDBTransaction&);
-
- IndexedDB::RequestType requestType() const { return m_requestType; }
-
-protected:
- IDBRequest(IDBConnectionToServer&, ScriptExecutionContext&);
- IDBRequest(ScriptExecutionContext&, IDBObjectStore&, IDBTransaction&);
- IDBRequest(ScriptExecutionContext&, IDBCursor&, IDBTransaction&);
- IDBRequest(ScriptExecutionContext&, IDBIndex&, IDBTransaction&);
- IDBRequest(ScriptExecutionContext&, IDBIndex&, IndexedDB::IndexRecordType, IDBTransaction&);
-
- // ActiveDOMObject.
- const char* activeDOMObjectName() const final;
- bool canSuspendForDocumentSuspension() const final;
- bool hasPendingActivity() const final;
- void stop() final;
-
- // EventTarget.
- void refEventTarget() final { RefCounted<IDBRequest>::ref(); }
- void derefEventTarget() final { RefCounted<IDBRequest>::deref(); }
- void uncaughtExceptionInEventHandler() final;
-
- virtual bool isOpenDBRequest() const { return false; }
-
- IDBRequestReadyState m_readyState { IDBRequestReadyState::Pending };
- RefPtr<IDBAny> m_result;
- RefPtr<IDBTransaction> m_transaction;
- bool m_shouldExposeTransactionToDOM { true };
- RefPtr<DOMError> m_domError;
- IDBError m_idbError;
- IndexedDB::RequestType m_requestType = { IndexedDB::RequestType::Other };
- bool m_contextStopped { false };
-
- Event* m_openDatabaseSuccessEvent { nullptr };
-
-private:
- void onError();
- void onSuccess();
-
- IDBCursor* resultCursor();
-
- IDBConnectionToServer& m_connection;
- IDBResourceIdentifier m_resourceIdentifier;
- RefPtr<IDBAny> m_source;
- bool m_hasPendingActivity { true };
- IndexedDB::IndexRecordType m_requestedIndexRecordType;
-
- RefPtr<IDBCursor> m_pendingCursor;
-
- std::unique_ptr<ScopeGuard> m_cursorRequestNotifier;
-};
-
-} // namespace IDBClient
-} // namespace WebCore
-
-#endif // ENABLE(INDEXED_DATABASE)
-#endif // IDBRequestImpl_h
</del></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBTransactionImplcpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.cpp (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.cpp        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.cpp        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -1,907 +0,0 @@
</span><del>-/*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "IDBTransactionImpl.h"
-
-#if ENABLE(INDEXED_DATABASE)
-
-#include "DOMError.h"
-#include "EventQueue.h"
-#include "IDBCursorWithValueImpl.h"
-#include "IDBDatabaseException.h"
-#include "IDBDatabaseImpl.h"
-#include "IDBError.h"
-#include "IDBEventDispatcher.h"
-#include "IDBKeyData.h"
-#include "IDBKeyRangeData.h"
-#include "IDBObjectStore.h"
-#include "IDBOpenDBRequestImpl.h"
-#include "IDBRequestImpl.h"
-#include "IDBResultData.h"
-#include "JSDOMWindowBase.h"
-#include "Logging.h"
-#include "ScriptExecutionContext.h"
-#include "TransactionOperation.h"
-
-namespace WebCore {
-namespace IDBClient {
-
-Ref<IDBTransaction> IDBTransaction::create(IDBDatabase& database, const IDBTransactionInfo& info)
-{
- return adoptRef(*new IDBTransaction(database, info, nullptr));
-}
-
-Ref<IDBTransaction> IDBTransaction::create(IDBDatabase& database, const IDBTransactionInfo& info, IDBOpenDBRequest& request)
-{
- return adoptRef(*new IDBTransaction(database, info, &request));
-}
-
-IDBTransaction::IDBTransaction(IDBDatabase& database, const IDBTransactionInfo& info, IDBOpenDBRequest* request)
- : WebCore::IDBTransaction(database.scriptExecutionContext())
- , m_database(database)
- , m_info(info)
- , m_operationTimer(*this, &IDBTransaction::operationTimerFired)
- , m_openDBRequest(request)
-
-{
- LOG(IndexedDB, "IDBTransaction::IDBTransaction - %s", m_info.loggingString().utf8().data());
-
- relaxAdoptionRequirement();
-
- if (m_info.mode() == IndexedDB::TransactionMode::VersionChange) {
- ASSERT(m_openDBRequest);
- m_openDBRequest->setVersionChangeTransaction(*this);
- m_startedOnServer = true;
- } else {
- activate();
-
- RefPtr<IDBTransaction> self;
- JSC::VM& vm = JSDOMWindowBase::commonVM();
- vm.whenIdle([self, this]() {
- deactivate();
- });
-
- establishOnServer();
- }
-
- suspendIfNeeded();
-}
-
-IDBTransaction::~IDBTransaction()
-{
-}
-
-const String& IDBTransaction::mode() const
-{
- switch (m_info.mode()) {
- case IndexedDB::TransactionMode::ReadOnly:
- return IDBTransaction::modeReadOnly();
- case IndexedDB::TransactionMode::ReadWrite:
- return IDBTransaction::modeReadWrite();
- case IndexedDB::TransactionMode::VersionChange:
- return IDBTransaction::modeVersionChange();
- }
-
- RELEASE_ASSERT_NOT_REACHED();
-}
-
-WebCore::IDBDatabase* IDBTransaction::db()
-{
- return &m_database.get();
-}
-
-IDBConnectionToServer& IDBTransaction::serverConnection()
-{
- return m_database->serverConnection();
-}
-
-RefPtr<DOMError> IDBTransaction::error() const
-{
- return m_domError;
-}
-
-RefPtr<WebCore::IDBObjectStore> IDBTransaction::objectStore(const String& objectStoreName, ExceptionCodeWithMessage& ec)
-{
- LOG(IndexedDB, "IDBTransaction::objectStore");
-
- if (!scriptExecutionContext())
- return nullptr;
-
- if (isFinishedOrFinishing()) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to execute 'objectStore' on 'IDBTransaction': The transaction finished.");
- return nullptr;
- }
-
- auto iterator = m_referencedObjectStores.find(objectStoreName);
- if (iterator != m_referencedObjectStores.end())
- return iterator->value;
-
- bool found = false;
- for (auto& objectStore : m_info.objectStores()) {
- if (objectStore == objectStoreName) {
- found = true;
- break;
- }
- }
-
- auto* info = m_database->info().infoForExistingObjectStore(objectStoreName);
- if (!info) {
- ec.code = IDBDatabaseException::NotFoundError;
- ec.message = ASCIILiteral("Failed to execute 'objectStore' on 'IDBTransaction': The specified object store was not found.");
- return nullptr;
- }
-
- // Version change transactions are scoped to every object store in the database.
- if (!info || (!found && !isVersionChange())) {
- ec.code = IDBDatabaseException::NotFoundError;
- ec.message = ASCIILiteral("Failed to execute 'objectStore' on 'IDBTransaction': The specified object store was not found.");
- return nullptr;
- }
-
- auto objectStore = IDBObjectStore::create(*scriptExecutionContext(), *info, *this);
- m_referencedObjectStores.set(objectStoreName, &objectStore.get());
-
- return adoptRef(&objectStore.leakRef());
-}
-
-
-void IDBTransaction::abortDueToFailedRequest(DOMError& error)
-{
- LOG(IndexedDB, "IDBTransaction::abortDueToFailedRequest");
- if (isFinishedOrFinishing())
- return;
-
- m_domError = &error;
- ExceptionCodeWithMessage ec;
- abort(ec);
-}
-
-void IDBTransaction::transitionedToFinishing(IndexedDB::TransactionState state)
-{
- ASSERT(!isFinishedOrFinishing());
- m_state = state;
- ASSERT(isFinishedOrFinishing());
- m_referencedObjectStores.clear();
-}
-
-void IDBTransaction::abort(ExceptionCodeWithMessage& ec)
-{
- LOG(IndexedDB, "IDBTransaction::abort");
-
- if (isFinishedOrFinishing()) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to execute 'abort' on 'IDBTransaction': The transaction is inactive or finished.");
- return;
- }
-
- m_database->willAbortTransaction(*this);
-
- if (isVersionChange()) {
- for (auto& objectStore : m_referencedObjectStores.values())
- objectStore->rollbackInfoForVersionChangeAbort();
- }
-
- transitionedToFinishing(IndexedDB::TransactionState::Aborting);
-
- m_abortQueue.swap(m_transactionOperationQueue);
-
- auto operation = createTransactionOperation(*this, nullptr, &IDBTransaction::abortOnServerAndCancelRequests);
- scheduleOperation(WTFMove(operation));
-}
-
-void IDBTransaction::abortOnServerAndCancelRequests(TransactionOperation& operation)
-{
- LOG(IndexedDB, "IDBTransaction::abortOnServerAndCancelRequests");
-
- ASSERT(m_transactionOperationQueue.isEmpty());
-
- serverConnection().abortTransaction(*this);
-
- ASSERT(m_transactionOperationMap.contains(operation.identifier()));
- m_transactionOperationMap.remove(operation.identifier());
-
- IDBError error(IDBDatabaseException::AbortError);
- for (auto& operation : m_abortQueue)
- operation->completed(IDBResultData::error(operation->identifier(), error));
-
- // Since we're aborting, it should be impossible to have queued any further operations.
- ASSERT(m_transactionOperationQueue.isEmpty());
-}
-
-const char* IDBTransaction::activeDOMObjectName() const
-{
- return "IDBTransaction";
-}
-
-bool IDBTransaction::canSuspendForDocumentSuspension() const
-{
- return false;
-}
-
-bool IDBTransaction::hasPendingActivity() const
-{
- return !m_contextStopped && m_state != IndexedDB::TransactionState::Finished;
-}
-
-void IDBTransaction::stop()
-{
- LOG(IndexedDB, "IDBTransaction::stop");
-
- // IDBDatabase::stop() calls IDBTransaction::stop() for each of its active transactions.
- // Since the order of calling ActiveDOMObject::stop() is random, we might already have been stopped.
- if (m_contextStopped)
- return;
-
- m_contextStopped = true;
-
- if (isFinishedOrFinishing())
- return;
-
- ExceptionCodeWithMessage ec;
- abort(ec);
-}
-
-bool IDBTransaction::isActive() const
-{
- return m_state == IndexedDB::TransactionState::Active;
-}
-
-bool IDBTransaction::isFinishedOrFinishing() const
-{
- return m_state == IndexedDB::TransactionState::Committing
- || m_state == IndexedDB::TransactionState::Aborting
- || m_state == IndexedDB::TransactionState::Finished;
-}
-
-void IDBTransaction::addRequest(IDBRequest& request)
-{
- m_openRequests.add(&request);
-}
-
-void IDBTransaction::removeRequest(IDBRequest& request)
-{
- ASSERT(m_openRequests.contains(&request));
- m_openRequests.remove(&request);
-}
-
-void IDBTransaction::scheduleOperation(RefPtr<TransactionOperation>&& operation)
-{
- ASSERT(!m_transactionOperationMap.contains(operation->identifier()));
-
- m_transactionOperationQueue.append(operation);
- m_transactionOperationMap.set(operation->identifier(), WTFMove(operation));
-
- scheduleOperationTimer();
-}
-
-void IDBTransaction::scheduleOperationTimer()
-{
- if (!m_operationTimer.isActive())
- m_operationTimer.startOneShot(0);
-}
-
-void IDBTransaction::operationTimerFired()
-{
- LOG(IndexedDB, "IDBTransaction::operationTimerFired (%p)", this);
-
- if (!m_startedOnServer)
- return;
-
- if (!m_transactionOperationQueue.isEmpty()) {
- auto operation = m_transactionOperationQueue.takeFirst();
- operation->perform();
-
- return;
- }
-
- if (!m_transactionOperationMap.isEmpty() || !m_openRequests.isEmpty())
- return;
-
- if (!isFinishedOrFinishing())
- commit();
-}
-
-void IDBTransaction::commit()
-{
- LOG(IndexedDB, "IDBTransaction::commit");
-
- ASSERT(!isFinishedOrFinishing());
-
- transitionedToFinishing(IndexedDB::TransactionState::Committing);
- m_database->willCommitTransaction(*this);
-
- auto operation = createTransactionOperation(*this, nullptr, &IDBTransaction::commitOnServer);
- scheduleOperation(WTFMove(operation));
-}
-
-void IDBTransaction::commitOnServer(TransactionOperation& operation)
-{
- LOG(IndexedDB, "IDBTransaction::commitOnServer");
- serverConnection().commitTransaction(*this);
-
- ASSERT(m_transactionOperationMap.contains(operation.identifier()));
- m_transactionOperationMap.remove(operation.identifier());
-}
-
-void IDBTransaction::finishAbortOrCommit()
-{
- ASSERT(m_state != IndexedDB::TransactionState::Finished);
- m_state = IndexedDB::TransactionState::Finished;
-}
-
-void IDBTransaction::didStart(const IDBError& error)
-{
- LOG(IndexedDB, "IDBTransaction::didStart");
-
- m_database->didStartTransaction(*this);
-
- m_startedOnServer = true;
-
- // It's possible the transaction failed to start on the server.
- // That equates to an abort.
- if (!error.isNull()) {
- didAbort(error);
- return;
- }
-
- scheduleOperationTimer();
-}
-
-void IDBTransaction::notifyDidAbort(const IDBError& error)
-{
- m_database->didAbortTransaction(*this);
- m_idbError = error;
- fireOnAbort();
-
- if (isVersionChange()) {
- ASSERT(m_openDBRequest);
- m_openDBRequest->fireErrorAfterVersionChangeCompletion();
- }
-}
-
-void IDBTransaction::didAbort(const IDBError& error)
-{
- LOG(IndexedDB, "IDBTransaction::didAbort");
-
- if (m_state == IndexedDB::TransactionState::Finished)
- return;
-
- notifyDidAbort(error);
-
- finishAbortOrCommit();
-}
-
-void IDBTransaction::didCommit(const IDBError& error)
-{
- LOG(IndexedDB, "IDBTransaction::didCommit");
-
- ASSERT(m_state == IndexedDB::TransactionState::Committing);
-
- if (error.isNull()) {
- m_database->didCommitTransaction(*this);
- fireOnComplete();
- } else {
- m_database->willAbortTransaction(*this);
- notifyDidAbort(error);
- }
-
- finishAbortOrCommit();
-}
-
-void IDBTransaction::fireOnComplete()
-{
- LOG(IndexedDB, "IDBTransaction::fireOnComplete");
- enqueueEvent(Event::create(eventNames().completeEvent, false, false));
-}
-
-void IDBTransaction::fireOnAbort()
-{
- LOG(IndexedDB, "IDBTransaction::fireOnAbort");
- enqueueEvent(Event::create(eventNames().abortEvent, true, false));
-}
-
-void IDBTransaction::enqueueEvent(Ref<Event>&& event)
-{
- ASSERT(m_state != IndexedDB::TransactionState::Finished);
-
- if (!scriptExecutionContext() || m_contextStopped)
- return;
-
- event->setTarget(this);
- scriptExecutionContext()->eventQueue().enqueueEvent(WTFMove(event));
-}
-
-bool IDBTransaction::dispatchEvent(Event& event)
-{
- LOG(IndexedDB, "IDBTransaction::dispatchEvent");
-
- ASSERT(scriptExecutionContext());
- ASSERT(!m_contextStopped);
- ASSERT(event.target() == this);
- ASSERT(event.type() == eventNames().completeEvent || event.type() == eventNames().abortEvent);
-
- Vector<RefPtr<EventTarget>> targets;
- targets.append(this);
- targets.append(db());
-
- bool result = IDBEventDispatcher::dispatch(event, targets);
-
- if (isVersionChange()) {
- ASSERT(m_openDBRequest);
- m_openDBRequest->versionChangeTransactionDidFinish();
-
- if (event.type() == eventNames().completeEvent) {
- if (m_database->isClosingOrClosed())
- m_openDBRequest->fireErrorAfterVersionChangeCompletion();
- else
- m_openDBRequest->fireSuccessAfterVersionChangeCommit();
- }
-
- m_openDBRequest = nullptr;
- }
-
- return result;
-}
-
-Ref<IDBObjectStore> IDBTransaction::createObjectStore(const IDBObjectStoreInfo& info)
-{
- LOG(IndexedDB, "IDBTransaction::createObjectStore");
- ASSERT(isVersionChange());
- ASSERT(scriptExecutionContext());
-
- Ref<IDBObjectStore> objectStore = IDBObjectStore::create(*scriptExecutionContext(), info, *this);
- m_referencedObjectStores.set(info.name(), &objectStore.get());
-
- auto operation = createTransactionOperation(*this, &IDBTransaction::didCreateObjectStoreOnServer, &IDBTransaction::createObjectStoreOnServer, info);
- scheduleOperation(WTFMove(operation));
-
- return objectStore;
-}
-
-void IDBTransaction::createObjectStoreOnServer(TransactionOperation& operation, const IDBObjectStoreInfo& info)
-{
- LOG(IndexedDB, "IDBTransaction::createObjectStoreOnServer");
-
- ASSERT(isVersionChange());
-
- m_database->serverConnection().createObjectStore(operation, info);
-}
-
-void IDBTransaction::didCreateObjectStoreOnServer(const IDBResultData& resultData)
-{
- LOG(IndexedDB, "IDBTransaction::didCreateObjectStoreOnServer");
-
- ASSERT_UNUSED(resultData, resultData.type() == IDBResultType::CreateObjectStoreSuccess || resultData.type() == IDBResultType::Error);
-}
-
-std::unique_ptr<IDBIndex> IDBTransaction::createIndex(IDBObjectStore& objectStore, const IDBIndexInfo& info)
-{
- LOG(IndexedDB, "IDBTransaction::createIndex");
- ASSERT(isVersionChange());
-
- if (!scriptExecutionContext())
- return nullptr;
-
- auto operation = createTransactionOperation(*this, &IDBTransaction::didCreateIndexOnServer, &IDBTransaction::createIndexOnServer, info);
- scheduleOperation(WTFMove(operation));
-
- return std::make_unique<IDBIndex>(*scriptExecutionContext(), info, objectStore);
-}
-
-void IDBTransaction::createIndexOnServer(TransactionOperation& operation, const IDBIndexInfo& info)
-{
- LOG(IndexedDB, "IDBTransaction::createIndexOnServer");
-
- ASSERT(isVersionChange());
-
- m_database->serverConnection().createIndex(operation, info);
-}
-
-void IDBTransaction::didCreateIndexOnServer(const IDBResultData& resultData)
-{
- LOG(IndexedDB, "IDBTransaction::didCreateIndexOnServer");
-
- if (resultData.type() == IDBResultType::CreateIndexSuccess)
- return;
-
- ASSERT(resultData.type() == IDBResultType::Error);
-
- // This operation might have failed because the transaction is already aborting.
- if (m_state == IndexedDB::TransactionState::Aborting)
- return;
-
- // Otherwise, failure to create an index forced abortion of the transaction.
- abortDueToFailedRequest(DOMError::create(IDBDatabaseException::getErrorName(resultData.error().code())));
-}
-
-Ref<IDBRequest> IDBTransaction::requestOpenCursor(ScriptExecutionContext& context, IDBObjectStore& objectStore, const IDBCursorInfo& info)
-{
- LOG(IndexedDB, "IDBTransaction::requestOpenCursor");
-
- return doRequestOpenCursor(context, IDBCursorWithValue::create(*this, objectStore, info));
-}
-
-Ref<IDBRequest> IDBTransaction::requestOpenCursor(ScriptExecutionContext& context, IDBIndex& index, const IDBCursorInfo& info)
-{
- LOG(IndexedDB, "IDBTransaction::requestOpenCursor");
-
- if (info.cursorType() == IndexedDB::CursorType::KeyOnly)
- return doRequestOpenCursor(context, IDBCursor::create(*this, index, info));
-
- return doRequestOpenCursor(context, IDBCursorWithValue::create(*this, index, info));
-}
-
-Ref<IDBRequest> IDBTransaction::doRequestOpenCursor(ScriptExecutionContext& context, Ref<IDBCursor>&& cursor)
-{
- ASSERT(isActive());
-
- Ref<IDBRequest> request = IDBRequest::create(context, cursor.get(), *this);
- addRequest(request.get());
-
- auto operation = createTransactionOperation(*this, request.get(), &IDBTransaction::didOpenCursorOnServer, &IDBTransaction::openCursorOnServer, cursor->info());
- scheduleOperation(WTFMove(operation));
-
- return request;
-}
-
-void IDBTransaction::openCursorOnServer(TransactionOperation& operation, const IDBCursorInfo& info)
-{
- LOG(IndexedDB, "IDBTransaction::openCursorOnServer");
-
- m_database->serverConnection().openCursor(operation, info);
-}
-
-void IDBTransaction::didOpenCursorOnServer(IDBRequest& request, const IDBResultData& resultData)
-{
- LOG(IndexedDB, "IDBTransaction::didOpenCursorOnServer");
-
- request.didOpenOrIterateCursor(resultData);
-}
-
-void IDBTransaction::iterateCursor(IDBCursor& cursor, const IDBKeyData& key, unsigned long count)
-{
- LOG(IndexedDB, "IDBTransaction::iterateCursor");
- ASSERT(isActive());
- ASSERT(cursor.request());
-
- addRequest(*cursor.request());
-
- auto operation = createTransactionOperation(*this, *cursor.request(), &IDBTransaction::didIterateCursorOnServer, &IDBTransaction::iterateCursorOnServer, key, count);
- scheduleOperation(WTFMove(operation));
-}
-
-void IDBTransaction::iterateCursorOnServer(TransactionOperation& operation, const IDBKeyData& key, const unsigned long& count)
-{
- LOG(IndexedDB, "IDBTransaction::iterateCursorOnServer");
-
- serverConnection().iterateCursor(operation, key, count);
-}
-
-void IDBTransaction::didIterateCursorOnServer(IDBRequest& request, const IDBResultData& resultData)
-{
- LOG(IndexedDB, "IDBTransaction::didIterateCursorOnServer");
-
- request.didOpenOrIterateCursor(resultData);
-}
-
-Ref<IDBRequest> IDBTransaction::requestGetRecord(ScriptExecutionContext& context, IDBObjectStore& objectStore, const IDBKeyRangeData& keyRangeData)
-{
- LOG(IndexedDB, "IDBTransaction::requestGetRecord");
- ASSERT(isActive());
- ASSERT(!keyRangeData.isNull);
-
- Ref<IDBRequest> request = IDBRequest::create(context, objectStore, *this);
- addRequest(request.get());
-
- auto operation = createTransactionOperation(*this, request.get(), &IDBTransaction::didGetRecordOnServer, &IDBTransaction::getRecordOnServer, keyRangeData);
- scheduleOperation(WTFMove(operation));
-
- return request;
-}
-
-Ref<IDBRequest> IDBTransaction::requestGetValue(ScriptExecutionContext& context, IDBIndex& index, const IDBKeyRangeData& range)
-{
- LOG(IndexedDB, "IDBTransaction::requestGetValue");
- return requestIndexRecord(context, index, IndexedDB::IndexRecordType::Value, range);
-}
-
-Ref<IDBRequest> IDBTransaction::requestGetKey(ScriptExecutionContext& context, IDBIndex& index, const IDBKeyRangeData& range)
-{
- LOG(IndexedDB, "IDBTransaction::requestGetValue");
- return requestIndexRecord(context, index, IndexedDB::IndexRecordType::Key, range);
-}
-
-Ref<IDBRequest> IDBTransaction::requestIndexRecord(ScriptExecutionContext& context, IDBIndex& index, IndexedDB::IndexRecordType type, const IDBKeyRangeData&range)
-{
- LOG(IndexedDB, "IDBTransaction::requestGetValue");
- ASSERT(isActive());
- ASSERT(!range.isNull);
-
- Ref<IDBRequest> request = IDBRequest::createGet(context, index, type, *this);
- addRequest(request.get());
-
- auto operation = createTransactionOperation(*this, request.get(), &IDBTransaction::didGetRecordOnServer, &IDBTransaction::getRecordOnServer, range);
- scheduleOperation(WTFMove(operation));
-
- return request;
-}
-
-void IDBTransaction::getRecordOnServer(TransactionOperation& operation, const IDBKeyRangeData& keyRange)
-{
- LOG(IndexedDB, "IDBTransaction::getRecordOnServer");
-
- serverConnection().getRecord(operation, keyRange);
-}
-
-void IDBTransaction::didGetRecordOnServer(IDBRequest& request, const IDBResultData& resultData)
-{
- LOG(IndexedDB, "IDBTransaction::didGetRecordOnServer");
-
- if (resultData.type() == IDBResultType::Error) {
- request.requestCompleted(resultData);
- return;
- }
-
- ASSERT(resultData.type() == IDBResultType::GetRecordSuccess);
-
- const IDBGetResult& result = resultData.getResult();
-
- if (request.sourceIndexIdentifier() && request.requestedIndexRecordType() == IndexedDB::IndexRecordType::Key) {
- if (!result.keyData().isNull())
- request.setResult(&result.keyData());
- else
- request.setResultToUndefined();
- } else {
- if (resultData.getResult().valueBuffer().data())
- request.setResultToStructuredClone(resultData.getResult().valueBuffer());
- else
- request.setResultToUndefined();
- }
-
- request.requestCompleted(resultData);
-}
-
-Ref<IDBRequest> IDBTransaction::requestCount(ScriptExecutionContext& context, IDBObjectStore& objectStore, const IDBKeyRangeData& range)
-{
- LOG(IndexedDB, "IDBTransaction::requestCount (IDBObjectStore)");
- ASSERT(isActive());
- ASSERT(!range.isNull);
-
- Ref<IDBRequest> request = IDBRequest::create(context, objectStore, *this);
- addRequest(request.get());
-
- scheduleOperation(createTransactionOperation(*this, request.get(), &IDBTransaction::didGetCountOnServer, &IDBTransaction::getCountOnServer, range));
-
- return request;
-}
-
-Ref<IDBRequest> IDBTransaction::requestCount(ScriptExecutionContext& context, IDBIndex& index, const IDBKeyRangeData& range)
-{
- LOG(IndexedDB, "IDBTransaction::requestCount (IDBIndex)");
- ASSERT(isActive());
- ASSERT(!range.isNull);
-
- Ref<IDBRequest> request = IDBRequest::createCount(context, index, *this);
- addRequest(request.get());
-
- scheduleOperation(createTransactionOperation(*this, request.get(), &IDBTransaction::didGetCountOnServer, &IDBTransaction::getCountOnServer, range));
-
- return request;
-}
-
-void IDBTransaction::getCountOnServer(TransactionOperation& operation, const IDBKeyRangeData& keyRange)
-{
- LOG(IndexedDB, "IDBTransaction::getCountOnServer");
-
- serverConnection().getCount(operation, keyRange);
-}
-
-void IDBTransaction::didGetCountOnServer(IDBRequest& request, const IDBResultData& resultData)
-{
- LOG(IndexedDB, "IDBTransaction::didGetCountOnServer");
-
- request.setResult(resultData.resultInteger());
- request.requestCompleted(resultData);
-}
-
-Ref<IDBRequest> IDBTransaction::requestDeleteRecord(ScriptExecutionContext& context, IDBObjectStore& objectStore, const IDBKeyRangeData& range)
-{
- LOG(IndexedDB, "IDBTransaction::requestDeleteRecord");
- ASSERT(isActive());
- ASSERT(!range.isNull);
-
- Ref<IDBRequest> request = IDBRequest::create(context, objectStore, *this);
- addRequest(request.get());
-
- scheduleOperation(createTransactionOperation(*this, request.get(), &IDBTransaction::didDeleteRecordOnServer, &IDBTransaction::deleteRecordOnServer, range));
- return request;
-}
-
-void IDBTransaction::deleteRecordOnServer(TransactionOperation& operation, const IDBKeyRangeData& keyRange)
-{
- LOG(IndexedDB, "IDBTransaction::deleteRecordOnServer");
-
- serverConnection().deleteRecord(operation, keyRange);
-}
-
-void IDBTransaction::didDeleteRecordOnServer(IDBRequest& request, const IDBResultData& resultData)
-{
- LOG(IndexedDB, "IDBTransaction::didDeleteRecordOnServer");
-
- request.setResultToUndefined();
- request.requestCompleted(resultData);
-}
-
-Ref<IDBRequest> IDBTransaction::requestClearObjectStore(ScriptExecutionContext& context, IDBObjectStore& objectStore)
-{
- LOG(IndexedDB, "IDBTransaction::requestClearObjectStore");
- ASSERT(isActive());
-
- Ref<IDBRequest> request = IDBRequest::create(context, objectStore, *this);
- addRequest(request.get());
-
- uint64_t objectStoreIdentifier = objectStore.info().identifier();
- auto operation = createTransactionOperation(*this, request.get(), &IDBTransaction::didClearObjectStoreOnServer, &IDBTransaction::clearObjectStoreOnServer, objectStoreIdentifier);
- scheduleOperation(WTFMove(operation));
-
- return request;
-}
-
-void IDBTransaction::clearObjectStoreOnServer(TransactionOperation& operation, const uint64_t& objectStoreIdentifier)
-{
- LOG(IndexedDB, "IDBTransaction::clearObjectStoreOnServer");
-
- serverConnection().clearObjectStore(operation, objectStoreIdentifier);
-}
-
-void IDBTransaction::didClearObjectStoreOnServer(IDBRequest& request, const IDBResultData& resultData)
-{
- LOG(IndexedDB, "IDBTransaction::didClearObjectStoreOnServer");
-
- request.setResultToUndefined();
- request.requestCompleted(resultData);
-}
-
-Ref<IDBRequest> IDBTransaction::requestPutOrAdd(ScriptExecutionContext& context, IDBObjectStore& objectStore, IDBKey* key, SerializedScriptValue& value, IndexedDB::ObjectStoreOverwriteMode overwriteMode)
-{
- LOG(IndexedDB, "IDBTransaction::requestPutOrAdd");
- ASSERT(isActive());
- ASSERT(!isReadOnly());
- ASSERT(objectStore.info().autoIncrement() || key);
-
- Ref<IDBRequest> request = IDBRequest::create(context, objectStore, *this);
- addRequest(request.get());
-
- auto operation = createTransactionOperation(*this, request.get(), &IDBTransaction::didPutOrAddOnServer, &IDBTransaction::putOrAddOnServer, key, &value, overwriteMode);
- scheduleOperation(WTFMove(operation));
-
- return request;
-}
-
-void IDBTransaction::putOrAddOnServer(TransactionOperation& operation, RefPtr<IDBKey> key, RefPtr<SerializedScriptValue> value, const IndexedDB::ObjectStoreOverwriteMode& overwriteMode)
-{
- LOG(IndexedDB, "IDBTransaction::putOrAddOnServer");
-
- ASSERT(!isReadOnly());
-
- serverConnection().putOrAdd(operation, key, value, overwriteMode);
-}
-
-void IDBTransaction::didPutOrAddOnServer(IDBRequest& request, const IDBResultData& resultData)
-{
- LOG(IndexedDB, "IDBTransaction::didPutOrAddOnServer");
-
- request.setResult(resultData.resultKey());
- request.requestCompleted(resultData);
-}
-
-void IDBTransaction::deleteObjectStore(const String& objectStoreName)
-{
- LOG(IndexedDB, "IDBTransaction::deleteObjectStore");
-
- ASSERT(isVersionChange());
-
- if (auto objectStore = m_referencedObjectStores.take(objectStoreName))
- objectStore->markAsDeleted();
-
- auto operation = createTransactionOperation(*this, &IDBTransaction::didDeleteObjectStoreOnServer, &IDBTransaction::deleteObjectStoreOnServer, objectStoreName);
- scheduleOperation(WTFMove(operation));
-}
-
-void IDBTransaction::deleteObjectStoreOnServer(TransactionOperation& operation, const String& objectStoreName)
-{
- LOG(IndexedDB, "IDBTransaction::deleteObjectStoreOnServer");
- ASSERT(isVersionChange());
-
- serverConnection().deleteObjectStore(operation, objectStoreName);
-}
-
-void IDBTransaction::didDeleteObjectStoreOnServer(const IDBResultData& resultData)
-{
- LOG(IndexedDB, "IDBTransaction::didDeleteObjectStoreOnServer");
- ASSERT_UNUSED(resultData, resultData.type() == IDBResultType::DeleteObjectStoreSuccess || resultData.type() == IDBResultType::Error);
-}
-
-void IDBTransaction::deleteIndex(uint64_t objectStoreIdentifier, const String& indexName)
-{
- LOG(IndexedDB, "IDBTransaction::deleteIndex");
-
- ASSERT(isVersionChange());
-
- auto operation = createTransactionOperation(*this, &IDBTransaction::didDeleteIndexOnServer, &IDBTransaction::deleteIndexOnServer, objectStoreIdentifier, indexName);
- scheduleOperation(WTFMove(operation));
-}
-
-void IDBTransaction::deleteIndexOnServer(TransactionOperation& operation, const uint64_t& objectStoreIdentifier, const String& indexName)
-{
- LOG(IndexedDB, "IDBTransaction::deleteIndexOnServer");
- ASSERT(isVersionChange());
-
- serverConnection().deleteIndex(operation, objectStoreIdentifier, indexName);
-}
-
-void IDBTransaction::didDeleteIndexOnServer(const IDBResultData& resultData)
-{
- LOG(IndexedDB, "IDBTransaction::didDeleteIndexOnServer");
- ASSERT_UNUSED(resultData, resultData.type() == IDBResultType::DeleteIndexSuccess || resultData.type() == IDBResultType::Error);
-}
-
-void IDBTransaction::operationDidComplete(TransactionOperation& operation)
-{
- ASSERT(m_transactionOperationMap.get(operation.identifier()) == &operation);
- m_transactionOperationMap.remove(operation.identifier());
-
- scheduleOperationTimer();
-}
-
-void IDBTransaction::establishOnServer()
-{
- LOG(IndexedDB, "IDBTransaction::establishOnServer");
-
- serverConnection().establishTransaction(*this);
-}
-
-void IDBTransaction::activate()
-{
- if (isFinishedOrFinishing())
- return;
-
- m_state = IndexedDB::TransactionState::Active;
-}
-
-void IDBTransaction::deactivate()
-{
- if (m_state == IndexedDB::TransactionState::Active)
- m_state = IndexedDB::TransactionState::Inactive;
-
- scheduleOperationTimer();
-}
-
-} // namespace IDBClient
-} // namespace WebCore
-
-#endif // ENABLE(INDEXED_DATABASE)
</del></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBTransactionImplh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.h (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.h        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.h        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -1,241 +0,0 @@
</span><del>-/*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef IDBTransactionImpl_h
-#define IDBTransactionImpl_h
-
-#if ENABLE(INDEXED_DATABASE)
-
-#include "IDBDatabaseInfo.h"
-#include "IDBError.h"
-#include "IDBIndexImpl.h"
-#include "IDBObjectStoreImpl.h"
-#include "IDBTransaction.h"
-#include "IDBTransactionInfo.h"
-#include "IndexedDB.h"
-#include "Timer.h"
-#include <wtf/Deque.h>
-#include <wtf/HashMap.h>
-
-namespace WebCore {
-
-class IDBCursorInfo;
-class IDBIndexInfo;
-class IDBKeyData;
-class IDBObjectStoreInfo;
-class IDBResultData;
-
-struct IDBKeyRangeData;
-
-namespace IDBClient {
-
-class IDBCursor;
-class IDBDatabase;
-class IDBIndex;
-class IDBOpenDBRequest;
-class TransactionOperation;
-
-class IDBTransaction : public WebCore::IDBTransaction {
-public:
- static Ref<IDBTransaction> create(IDBDatabase&, const IDBTransactionInfo&);
- static Ref<IDBTransaction> create(IDBDatabase&, const IDBTransactionInfo&, IDBOpenDBRequest&);
-
- ~IDBTransaction() final;
-
- // IDBTransaction IDL
- const String& mode() const final;
- WebCore::IDBDatabase* db() final;
- RefPtr<DOMError> error() const final;
- RefPtr<WebCore::IDBObjectStore> objectStore(const String& name, ExceptionCodeWithMessage&) final;
- void abort(ExceptionCodeWithMessage&) final;
-
- EventTargetInterface eventTargetInterface() const final { return IDBTransactionEventTargetInterfaceType; }
- ScriptExecutionContext* scriptExecutionContext() const final { return ActiveDOMObject::scriptExecutionContext(); }
- void refEventTarget() final { ref(); }
- void derefEventTarget() final { deref(); }
- using EventTarget::dispatchEvent;
- bool dispatchEvent(Event&) final;
-
- const char* activeDOMObjectName() const final;
- bool canSuspendForDocumentSuspension() const final;
- bool hasPendingActivity() const final;
- void stop() final;
-
- const IDBTransactionInfo& info() const { return m_info; }
- IDBDatabase& database() { return m_database.get(); }
- const IDBDatabase& database() const { return m_database.get(); }
- IDBDatabaseInfo* originalDatabaseInfo() const { return m_info.originalDatabaseInfo(); }
-
- void didStart(const IDBError&);
- void didAbort(const IDBError&);
- void didCommit(const IDBError&);
-
- bool isVersionChange() const { return m_info.mode() == IndexedDB::TransactionMode::VersionChange; }
- bool isReadOnly() const { return m_info.mode() == IndexedDB::TransactionMode::ReadOnly; }
- bool isActive() const;
-
- Ref<IDBObjectStore> createObjectStore(const IDBObjectStoreInfo&);
- std::unique_ptr<IDBIndex> createIndex(IDBObjectStore&, const IDBIndexInfo&);
-
- Ref<IDBRequest> requestPutOrAdd(ScriptExecutionContext&, IDBObjectStore&, IDBKey*, SerializedScriptValue&, IndexedDB::ObjectStoreOverwriteMode);
- Ref<IDBRequest> requestGetRecord(ScriptExecutionContext&, IDBObjectStore&, const IDBKeyRangeData&);
- Ref<IDBRequest> requestDeleteRecord(ScriptExecutionContext&, IDBObjectStore&, const IDBKeyRangeData&);
- Ref<IDBRequest> requestClearObjectStore(ScriptExecutionContext&, IDBObjectStore&);
- Ref<IDBRequest> requestCount(ScriptExecutionContext&, IDBObjectStore&, const IDBKeyRangeData&);
- Ref<IDBRequest> requestCount(ScriptExecutionContext&, IDBIndex&, const IDBKeyRangeData&);
- Ref<IDBRequest> requestGetValue(ScriptExecutionContext&, IDBIndex&, const IDBKeyRangeData&);
- Ref<IDBRequest> requestGetKey(ScriptExecutionContext&, IDBIndex&, const IDBKeyRangeData&);
- Ref<IDBRequest> requestOpenCursor(ScriptExecutionContext&, IDBObjectStore&, const IDBCursorInfo&);
- Ref<IDBRequest> requestOpenCursor(ScriptExecutionContext&, IDBIndex&, const IDBCursorInfo&);
- void iterateCursor(IDBCursor&, const IDBKeyData&, unsigned long count);
-
- void deleteObjectStore(const String& objectStoreName);
- void deleteIndex(uint64_t objectStoreIdentifier, const String& indexName);
-
- void addRequest(IDBRequest&);
- void removeRequest(IDBRequest&);
-
- void abortDueToFailedRequest(DOMError&);
-
- IDBConnectionToServer& serverConnection();
-
- void activate();
- void deactivate();
-
- void operationDidComplete(TransactionOperation&);
-
- bool isFinishedOrFinishing() const;
- bool isFinished() const { return m_state == IndexedDB::TransactionState::Finished; }
-
-private:
- IDBTransaction(IDBDatabase&, const IDBTransactionInfo&, IDBOpenDBRequest*);
-
- void commit();
-
- void notifyDidAbort(const IDBError&);
- void finishAbortOrCommit();
-
- void scheduleOperation(RefPtr<TransactionOperation>&&);
- void operationTimerFired();
-
- void fireOnComplete();
- void fireOnAbort();
- void enqueueEvent(Ref<Event>&&);
-
- Ref<IDBRequest> requestIndexRecord(ScriptExecutionContext&, IDBIndex&, IndexedDB::IndexRecordType, const IDBKeyRangeData&);
-
- void commitOnServer(TransactionOperation&);
- void abortOnServerAndCancelRequests(TransactionOperation&);
-
- void createObjectStoreOnServer(TransactionOperation&, const IDBObjectStoreInfo&);
- void didCreateObjectStoreOnServer(const IDBResultData&);
-
- void createIndexOnServer(TransactionOperation&, const IDBIndexInfo&);
- void didCreateIndexOnServer(const IDBResultData&);
-
- void clearObjectStoreOnServer(TransactionOperation&, const uint64_t& objectStoreIdentifier);
- void didClearObjectStoreOnServer(IDBRequest&, const IDBResultData&);
-
- void putOrAddOnServer(TransactionOperation&, RefPtr<IDBKey>, RefPtr<SerializedScriptValue>, const IndexedDB::ObjectStoreOverwriteMode&);
- void didPutOrAddOnServer(IDBRequest&, const IDBResultData&);
-
- void getRecordOnServer(TransactionOperation&, const IDBKeyRangeData&);
- void didGetRecordOnServer(IDBRequest&, const IDBResultData&);
-
- void getCountOnServer(TransactionOperation&, const IDBKeyRangeData&);
- void didGetCountOnServer(IDBRequest&, const IDBResultData&);
-
- void deleteRecordOnServer(TransactionOperation&, const IDBKeyRangeData&);
- void didDeleteRecordOnServer(IDBRequest&, const IDBResultData&);
-
- void deleteObjectStoreOnServer(TransactionOperation&, const String& objectStoreName);
- void didDeleteObjectStoreOnServer(const IDBResultData&);
-
- void deleteIndexOnServer(TransactionOperation&, const uint64_t& objectStoreIdentifier, const String& indexName);
- void didDeleteIndexOnServer(const IDBResultData&);
-
- Ref<IDBRequest> doRequestOpenCursor(ScriptExecutionContext&, Ref<IDBCursor>&&);
- void openCursorOnServer(TransactionOperation&, const IDBCursorInfo&);
- void didOpenCursorOnServer(IDBRequest&, const IDBResultData&);
-
- void iterateCursorOnServer(TransactionOperation&, const IDBKeyData&, const unsigned long& count);
- void didIterateCursorOnServer(IDBRequest&, const IDBResultData&);
-
- void transitionedToFinishing(IndexedDB::TransactionState);
-
- void establishOnServer();
-
- void scheduleOperationTimer();
-
- Ref<IDBDatabase> m_database;
- IDBTransactionInfo m_info;
-
- IndexedDB::TransactionState m_state { IndexedDB::TransactionState::Inactive };
- bool m_startedOnServer { false };
-
- IDBError m_idbError;
- RefPtr<DOMError> m_domError;
-
- Timer m_operationTimer;
- std::unique_ptr<Timer> m_activationTimer;
-
- RefPtr<IDBOpenDBRequest> m_openDBRequest;
-
- Deque<RefPtr<TransactionOperation>> m_transactionOperationQueue;
- Deque<RefPtr<TransactionOperation>> m_abortQueue;
- HashMap<IDBResourceIdentifier, RefPtr<TransactionOperation>> m_transactionOperationMap;
-
- HashMap<String, RefPtr<IDBObjectStore>> m_referencedObjectStores;
-
- HashSet<RefPtr<IDBRequest>> m_openRequests;
-
- bool m_contextStopped { false };
-};
-
-class TransactionActivator {
- WTF_MAKE_NONCOPYABLE(TransactionActivator);
-public:
- TransactionActivator(IDBTransaction* transaction)
- : m_transaction(transaction)
- {
- if (m_transaction)
- m_transaction->activate();
- }
-
- ~TransactionActivator()
- {
- if (m_transaction)
- m_transaction->deactivate();
- }
-
-private:
- IDBTransaction* m_transaction;
-};
-
-} // namespace IDBClient
-} // namespace WebCore
-
-#endif // ENABLE(INDEXED_DATABASE)
-#endif // IDBTransactionImpl_h
</del></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBVersionChangeEventImplcpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/Modules/indexeddb/client/IDBVersionChangeEventImpl.cpp (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBVersionChangeEventImpl.cpp        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBVersionChangeEventImpl.cpp        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -1,57 +0,0 @@
</span><del>-/*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "IDBVersionChangeEventImpl.h"
-
-#if ENABLE(INDEXED_DATABASE)
-
-namespace WebCore {
-namespace IDBClient {
-
-IDBVersionChangeEvent::IDBVersionChangeEvent(const IDBResourceIdentifier& requestIdentifier, uint64_t oldVersion, uint64_t newVersion, const AtomicString& eventType)
- : WebCore::IDBVersionChangeEvent(eventType)
- , m_requestIdentifier(requestIdentifier)
- , m_oldVersion(oldVersion)
- , m_newVersion(newVersion)
-{
-}
-
-Optional<uint64_t> IDBVersionChangeEvent::newVersion() const
-{
- if (!m_newVersion)
- return Nullopt;
- return m_newVersion;
-}
-
-EventInterface IDBVersionChangeEvent::eventInterface() const
-{
- return IDBVersionChangeEventInterfaceType;
-}
-
-} // namespace IDBClient
-} // namespace WebCore
-
-#endif // ENABLE(INDEXED_DATABASE)
</del></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBVersionChangeEventImplh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/Modules/indexeddb/client/IDBVersionChangeEventImpl.h (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBVersionChangeEventImpl.h        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBVersionChangeEventImpl.h        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -1,73 +0,0 @@
</span><del>-/*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef IDBVersionChangeEventImpl_h
-#define IDBVersionChangeEventImpl_h
-
-#if ENABLE(INDEXED_DATABASE)
-
-#include "IDBResourceIdentifier.h"
-#include "IDBVersionChangeEvent.h"
-
-namespace WebCore {
-namespace IDBClient {
-
-class IDBVersionChangeEvent final : public WebCore::IDBVersionChangeEvent {
-public:
- static Ref<IDBVersionChangeEvent> create(uint64_t oldVersion, uint64_t newVersion, const AtomicString& eventType)
- {
- return adoptRef(*new IDBVersionChangeEvent(IDBResourceIdentifier::emptyValue(), oldVersion, newVersion, eventType));
- }
-
- static Ref<IDBVersionChangeEvent> create(const IDBResourceIdentifier& requestIdentifier, uint64_t oldVersion, uint64_t newVersion, const AtomicString& eventType)
- {
- return adoptRef(*new IDBVersionChangeEvent(requestIdentifier, oldVersion, newVersion, eventType));
- }
-
- const IDBResourceIdentifier& requestIdentifier() const { return m_requestIdentifier; }
-
- bool isVersionChangeEvent() const final { return true; }
-
-private:
- IDBVersionChangeEvent(const IDBResourceIdentifier& requestIdentifier, uint64_t oldVersion, uint64_t newVersion, const AtomicString& eventType);
-
- uint64_t oldVersion() const override { return m_oldVersion; }
- Optional<uint64_t> newVersion() const override;
- EventInterface eventInterface() const override;
-
- IDBResourceIdentifier m_requestIdentifier;
- uint64_t m_oldVersion;
- uint64_t m_newVersion;
-};
-
-} // namespace IDBClient
-} // namespace WebCore
-
-SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::IDBClient::IDBVersionChangeEvent)
- static bool isType(const WebCore::Event& event) { return event.isVersionChangeEvent(); }
-SPECIALIZE_TYPE_TRAITS_END()
-
-#endif // ENABLE(INDEXED_DATABASE)
-#endif // IDBVersionChangeEventImpl_h
</del></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientTransactionOperationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/client/TransactionOperation.cpp (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/TransactionOperation.cpp        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/Modules/indexeddb/client/TransactionOperation.cpp        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -28,7 +28,7 @@
</span><span class="cx">
</span><span class="cx"> #if ENABLE(INDEXED_DATABASE)
</span><span class="cx">
</span><del>-#include "IDBCursorImpl.h"
</del><ins>+#include "IDBCursor.h"
</ins><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> namespace IDBClient {
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientTransactionOperationh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/client/TransactionOperation.h (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/TransactionOperation.h        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/Modules/indexeddb/client/TransactionOperation.h        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -28,9 +28,9 @@
</span><span class="cx">
</span><span class="cx"> #if ENABLE(INDEXED_DATABASE)
</span><span class="cx">
</span><del>-#include "IDBRequestImpl.h"
</del><ins>+#include "IDBRequest.h"
</ins><span class="cx"> #include "IDBResourceIdentifier.h"
</span><del>-#include "IDBTransactionImpl.h"
</del><ins>+#include "IDBTransaction.h"
</ins><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbsharedIDBCursorInfocpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/shared/IDBCursorInfo.cpp (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/shared/IDBCursorInfo.cpp        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/IDBCursorInfo.cpp        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -28,17 +28,17 @@
</span><span class="cx">
</span><span class="cx"> #if ENABLE(INDEXED_DATABASE)
</span><span class="cx">
</span><del>-#include "IDBTransactionImpl.h"
</del><ins>+#include "IDBTransaction.h"
</ins><span class="cx"> #include "IndexedDB.h"
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-IDBCursorInfo IDBCursorInfo::objectStoreCursor(IDBClient::IDBTransaction& transaction, uint64_t objectStoreIdentifier, const IDBKeyRangeData& range, IndexedDB::CursorDirection direction)
</del><ins>+IDBCursorInfo IDBCursorInfo::objectStoreCursor(IDBTransaction& transaction, uint64_t objectStoreIdentifier, const IDBKeyRangeData& range, IndexedDB::CursorDirection direction)
</ins><span class="cx"> {
</span><span class="cx"> return { transaction, objectStoreIdentifier, range, direction, IndexedDB::CursorType::KeyAndValue };
</span><span class="cx"> }
</span><span class="cx">
</span><del>-IDBCursorInfo IDBCursorInfo::indexCursor(IDBClient::IDBTransaction& transaction, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, const IDBKeyRangeData& range, IndexedDB::CursorDirection direction, IndexedDB::CursorType type)
</del><ins>+IDBCursorInfo IDBCursorInfo::indexCursor(IDBTransaction& transaction, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, const IDBKeyRangeData& range, IndexedDB::CursorDirection direction, IndexedDB::CursorType type)
</ins><span class="cx"> {
</span><span class="cx"> return { transaction, objectStoreIdentifier, indexIdentifier, range, direction, type };
</span><span class="cx"> }
</span><span class="lines">@@ -47,7 +47,7 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><del>-IDBCursorInfo::IDBCursorInfo(IDBClient::IDBTransaction& transaction, uint64_t objectStoreIdentifier, const IDBKeyRangeData& range, IndexedDB::CursorDirection direction, IndexedDB::CursorType type)
</del><ins>+IDBCursorInfo::IDBCursorInfo(IDBTransaction& transaction, uint64_t objectStoreIdentifier, const IDBKeyRangeData& range, IndexedDB::CursorDirection direction, IndexedDB::CursorType type)
</ins><span class="cx"> : m_cursorIdentifier(transaction.serverConnection())
</span><span class="cx"> , m_transactionIdentifier(transaction.info().identifier())
</span><span class="cx"> , m_objectStoreIdentifier(objectStoreIdentifier)
</span><span class="lines">@@ -59,7 +59,7 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><del>-IDBCursorInfo::IDBCursorInfo(IDBClient::IDBTransaction& transaction, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, const IDBKeyRangeData& range, IndexedDB::CursorDirection direction, IndexedDB::CursorType type)
</del><ins>+IDBCursorInfo::IDBCursorInfo(IDBTransaction& transaction, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, const IDBKeyRangeData& range, IndexedDB::CursorDirection direction, IndexedDB::CursorType type)
</ins><span class="cx"> : m_cursorIdentifier(transaction.serverConnection())
</span><span class="cx"> , m_transactionIdentifier(transaction.info().identifier())
</span><span class="cx"> , m_objectStoreIdentifier(objectStoreIdentifier)
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbsharedIDBCursorInfoh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/shared/IDBCursorInfo.h (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/shared/IDBCursorInfo.h        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/IDBCursorInfo.h        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -33,9 +33,7 @@
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-namespace IDBClient {
</del><span class="cx"> class IDBTransaction;
</span><del>-}
</del><span class="cx">
</span><span class="cx"> namespace IndexedDB {
</span><span class="cx"> enum class CursorDirection;
</span><span class="lines">@@ -52,8 +50,8 @@
</span><span class="cx">
</span><span class="cx"> class IDBCursorInfo {
</span><span class="cx"> public:
</span><del>- static IDBCursorInfo objectStoreCursor(IDBClient::IDBTransaction&, uint64_t objectStoreIdentifier, const IDBKeyRangeData&, IndexedDB::CursorDirection);
- static IDBCursorInfo indexCursor(IDBClient::IDBTransaction&, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, const IDBKeyRangeData&, IndexedDB::CursorDirection, IndexedDB::CursorType);
</del><ins>+ static IDBCursorInfo objectStoreCursor(IDBTransaction&, uint64_t objectStoreIdentifier, const IDBKeyRangeData&, IndexedDB::CursorDirection);
+ static IDBCursorInfo indexCursor(IDBTransaction&, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, const IDBKeyRangeData&, IndexedDB::CursorDirection, IndexedDB::CursorType);
</ins><span class="cx">
</span><span class="cx"> IDBResourceIdentifier identifier() const { return m_cursorIdentifier; }
</span><span class="cx"> uint64_t sourceIdentifier() const { return m_sourceIdentifier; }
</span><span class="lines">@@ -74,8 +72,8 @@
</span><span class="cx"> template<class Decoder> static bool decode(Decoder&, IDBCursorInfo&);
</span><span class="cx">
</span><span class="cx"> private:
</span><del>- IDBCursorInfo(IDBClient::IDBTransaction&, uint64_t objectStoreIdentifier, const IDBKeyRangeData&, IndexedDB::CursorDirection, IndexedDB::CursorType);
- IDBCursorInfo(IDBClient::IDBTransaction&, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, const IDBKeyRangeData&, IndexedDB::CursorDirection, IndexedDB::CursorType);
</del><ins>+ IDBCursorInfo(IDBTransaction&, uint64_t objectStoreIdentifier, const IDBKeyRangeData&, IndexedDB::CursorDirection, IndexedDB::CursorType);
+ IDBCursorInfo(IDBTransaction&, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, const IDBKeyRangeData&, IndexedDB::CursorDirection, IndexedDB::CursorType);
</ins><span class="cx">
</span><span class="cx"> IDBCursorInfo(const IDBResourceIdentifier&, const IDBResourceIdentifier&, uint64_t, uint64_t, const IDBKeyRangeData&, IndexedDB::CursorSource, IndexedDB::CursorDirection, IndexedDB::CursorType);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbsharedIDBRequestDatacpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/shared/IDBRequestData.cpp (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/shared/IDBRequestData.cpp        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/IDBRequestData.cpp        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -29,7 +29,8 @@
</span><span class="cx"> #if ENABLE(INDEXED_DATABASE)
</span><span class="cx">
</span><span class="cx"> #include "IDBConnectionToServer.h"
</span><del>-#include "IDBOpenDBRequestImpl.h"
</del><ins>+#include "IDBDatabase.h"
+#include "IDBOpenDBRequest.h"
</ins><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="lines">@@ -37,7 +38,7 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><del>-IDBRequestData::IDBRequestData(const IDBClient::IDBConnectionToServer& connection, const IDBClient::IDBOpenDBRequest& request)
</del><ins>+IDBRequestData::IDBRequestData(const IDBClient::IDBConnectionToServer& connection, const IDBOpenDBRequest& request)
</ins><span class="cx"> : m_serverConnectionIdentifier(connection.identifier())
</span><span class="cx"> , m_requestIdentifier(std::make_unique<IDBResourceIdentifier>(connection, request))
</span><span class="cx"> , m_databaseIdentifier(request.databaseIdentifier())
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbsharedIDBRequestDatah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/shared/IDBRequestData.h (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/shared/IDBRequestData.h        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/IDBRequestData.h        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -34,20 +34,21 @@
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><ins>+class IDBOpenDBRequest;
+class IDBTransaction;
+
</ins><span class="cx"> namespace IndexedDB {
</span><span class="cx"> enum class IndexRecordType;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> namespace IDBClient {
</span><span class="cx"> class IDBConnectionToServer;
</span><del>-class IDBOpenDBRequest;
-class IDBTransaction;
</del><span class="cx"> class TransactionOperation;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> class IDBRequestData {
</span><span class="cx"> public:
</span><del>- IDBRequestData(const IDBClient::IDBConnectionToServer&, const IDBClient::IDBOpenDBRequest&);
</del><ins>+ IDBRequestData(const IDBClient::IDBConnectionToServer&, const IDBOpenDBRequest&);
</ins><span class="cx"> explicit IDBRequestData(IDBClient::TransactionOperation&);
</span><span class="cx"> IDBRequestData(const IDBRequestData&);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbsharedIDBResourceIdentifiercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/shared/IDBResourceIdentifier.cpp (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/shared/IDBResourceIdentifier.cpp        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/IDBResourceIdentifier.cpp        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -30,7 +30,7 @@
</span><span class="cx">
</span><span class="cx"> #include "IDBConnectionToClient.h"
</span><span class="cx"> #include "IDBConnectionToServer.h"
</span><del>-#include "IDBRequestImpl.h"
</del><ins>+#include "IDBRequest.h"
</ins><span class="cx"> #include <wtf/MainThread.h>
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -65,7 +65,7 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><del>-IDBResourceIdentifier::IDBResourceIdentifier(const IDBClient::IDBConnectionToServer& connection, const IDBClient::IDBRequest& request)
</del><ins>+IDBResourceIdentifier::IDBResourceIdentifier(const IDBClient::IDBConnectionToServer& connection, const IDBRequest& request)
</ins><span class="cx"> : m_idbConnectionIdentifier(connection.identifier())
</span><span class="cx"> , m_resourceNumber(request.resourceIdentifier().m_resourceNumber)
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbsharedIDBResourceIdentifierh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/shared/IDBResourceIdentifier.h (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/shared/IDBResourceIdentifier.h        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/IDBResourceIdentifier.h        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -32,9 +32,10 @@
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><ins>+class IDBRequest;
+
</ins><span class="cx"> namespace IDBClient {
</span><span class="cx"> class IDBConnectionToServer;
</span><del>-class IDBRequest;
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> namespace IDBServer {
</span><span class="lines">@@ -44,7 +45,7 @@
</span><span class="cx"> class IDBResourceIdentifier {
</span><span class="cx"> public:
</span><span class="cx"> explicit IDBResourceIdentifier(const IDBClient::IDBConnectionToServer&);
</span><del>- IDBResourceIdentifier(const IDBClient::IDBConnectionToServer&, const IDBClient::IDBRequest&);
</del><ins>+ IDBResourceIdentifier(const IDBClient::IDBConnectionToServer&, const IDBRequest&);
</ins><span class="cx"> explicit IDBResourceIdentifier(const IDBServer::IDBConnectionToClient&);
</span><span class="cx">
</span><span class="cx"> static IDBResourceIdentifier deletedValue();
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbsharedIDBTransactionInfocpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/shared/IDBTransactionInfo.cpp (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/shared/IDBTransactionInfo.cpp        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/IDBTransactionInfo.cpp        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -28,7 +28,7 @@
</span><span class="cx">
</span><span class="cx"> #if ENABLE(INDEXED_DATABASE)
</span><span class="cx">
</span><del>-#include "IDBTransactionImpl.h"
</del><ins>+#include "IDBTransaction.h"
</ins><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbsharedInProcessIDBServercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.cpp (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.cpp        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.cpp        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -32,7 +32,7 @@
</span><span class="cx"> #include "IDBConnectionToServer.h"
</span><span class="cx"> #include "IDBCursorInfo.h"
</span><span class="cx"> #include "IDBKeyRangeData.h"
</span><del>-#include "IDBOpenDBRequestImpl.h"
</del><ins>+#include "IDBOpenDBRequest.h"
</ins><span class="cx"> #include "IDBRequestData.h"
</span><span class="cx"> #include "IDBResultData.h"
</span><span class="cx"> #include "Logging.h"
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbsharedInProcessIDBServerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.h (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.h        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.h        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -30,7 +30,7 @@
</span><span class="cx">
</span><span class="cx"> #include "IDBConnectionToClient.h"
</span><span class="cx"> #include "IDBConnectionToServer.h"
</span><del>-#include "IDBOpenDBRequestImpl.h"
</del><ins>+#include "IDBOpenDBRequest.h"
</ins><span class="cx"> #include "IDBServer.h"
</span><span class="cx"> #include <wtf/HashMap.h>
</span><span class="cx"> #include <wtf/RefCounted.h>
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -1946,12 +1946,6 @@
</span><span class="cx">                 510192D218B6B9AB007FC7A1 /* ImageControlsRootElementMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 510192D018B6B9AB007FC7A1 /* ImageControlsRootElementMac.h */; };
</span><span class="cx">                 510192D518B6B9B7007FC7A1 /* ImageControlsRootElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 510192D318B6B9B7007FC7A1 /* ImageControlsRootElement.cpp */; };
</span><span class="cx">                 510192D618B6B9B7007FC7A1 /* ImageControlsRootElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 510192D418B6B9B7007FC7A1 /* ImageControlsRootElement.h */; };
</span><del>-                5103104F1BA8CC03003329C0 /* IDBFactoryImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5103104A1BA8C6A6003329C0 /* IDBFactoryImpl.cpp */; };
-                510310501BA8CC03003329C0 /* IDBFactoryImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 5103104B1BA8C6A6003329C0 /* IDBFactoryImpl.h */; };
-                5103105A1BA8DB56003329C0 /* IDBOpenDBRequestImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 510310561BA8DB30003329C0 /* IDBOpenDBRequestImpl.cpp */; };
-                5103105B1BA8DB56003329C0 /* IDBOpenDBRequestImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 510310571BA8DB30003329C0 /* IDBOpenDBRequestImpl.h */; settings = {ATTRIBUTES = (Private, ); }; };
-                5103105C1BA8DB56003329C0 /* IDBRequestImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 510310581BA8DB30003329C0 /* IDBRequestImpl.cpp */; };
-                5103105D1BA8DB56003329C0 /* IDBRequestImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 510310591BA8DB30003329C0 /* IDBRequestImpl.h */; settings = {ATTRIBUTES = (Private, ); }; };
</del><span class="cx">                 5106D7BD18BDB76F000AB166 /* ContextMenuContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5106D7BB18BDB76F000AB166 /* ContextMenuContext.cpp */; };
</span><span class="cx">                 5106D7BE18BDB76F000AB166 /* ContextMenuContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 5106D7BC18BDB76F000AB166 /* ContextMenuContext.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 510A58E41BAA40B100C19282 /* InProcessIDBServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 510A58E21BAA40AE00C19282 /* InProcessIDBServer.cpp */; };
</span><span class="lines">@@ -2047,8 +2041,6 @@
</span><span class="cx">                 5160306C0CC4362300C8AC25 /* FileSystemCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5160306B0CC4362300C8AC25 /* FileSystemCF.cpp */; };
</span><span class="cx">                 5160712E1BD8307800DBC4F2 /* IDBObjectStoreInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5160712C1BD8307200DBC4F2 /* IDBObjectStoreInfo.cpp */; };
</span><span class="cx">                 5160712F1BD8307800DBC4F2 /* IDBObjectStoreInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 5160712D1BD8307200DBC4F2 /* IDBObjectStoreInfo.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><del>-                516071301BD8308600DBC4F2 /* IDBObjectStoreImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 516071291BD8305300DBC4F2 /* IDBObjectStoreImpl.cpp */; };
-                516071311BD8308600DBC4F2 /* IDBObjectStoreImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 5160712A1BD8305300DBC4F2 /* IDBObjectStoreImpl.h */; settings = {ATTRIBUTES = (Private, ); }; };
</del><span class="cx">                 516071321BD8308B00DBC4F2 /* TransactionOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = 5160712B1BD8305300DBC4F2 /* TransactionOperation.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 5160F4980B0AA75F00C1D2AF /* HistoryItemMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5160F4970B0AA75F00C1D2AF /* HistoryItemMac.mm */; };
</span><span class="cx">                 5162C7F411F77EFB00612EFE /* SchemeRegistry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5162C7F211F77EFA00612EFE /* SchemeRegistry.cpp */; };
</span><span class="lines">@@ -2160,14 +2152,6 @@
</span><span class="cx">                 5198F7A91BBDD38500E2CC5F /* UniqueIDBDatabaseTransaction.h in Headers */ = {isa = PBXBuildFile; fileRef = 5198F7A71BBDD38100E2CC5F /* UniqueIDBDatabaseTransaction.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 5198F7AC1BBDD3EB00E2CC5F /* IDBTransactionInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5198F7AA1BBDD3E300E2CC5F /* IDBTransactionInfo.cpp */; };
</span><span class="cx">                 5198F7AD1BBDD3EB00E2CC5F /* IDBTransactionInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 5198F7AB1BBDD3E300E2CC5F /* IDBTransactionInfo.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><del>-                5198F7B01BBDF5C800E2CC5F /* IDBDatabaseImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5198F7AE1BBDF59200E2CC5F /* IDBDatabaseImpl.cpp */; };
-                5198F7B11BBDF5C800E2CC5F /* IDBDatabaseImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 5198F7AF1BBDF59200E2CC5F /* IDBDatabaseImpl.h */; settings = {ATTRIBUTES = (Private, ); }; };
-                5198F7B41BBE003C00E2CC5F /* IDBTransactionImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5198F7B21BBE001D00E2CC5F /* IDBTransactionImpl.cpp */; };
-                5198F7B51BBE003C00E2CC5F /* IDBTransactionImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 5198F7B31BBE001D00E2CC5F /* IDBTransactionImpl.h */; settings = {ATTRIBUTES = (Private, ); }; };
-                5198F7B81BC3145100E2CC5F /* IDBVersionChangeEventImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5198F7B61BC3141700E2CC5F /* IDBVersionChangeEventImpl.cpp */; };
-                5198F7B91BC3145100E2CC5F /* IDBVersionChangeEventImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 5198F7B71BC3141700E2CC5F /* IDBVersionChangeEventImpl.h */; };
-                5198F7BE1BC338AF00E2CC5F /* IDBAnyImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5198F7BC1BC338A900E2CC5F /* IDBAnyImpl.cpp */; };
-                5198F7BF1BC338AF00E2CC5F /* IDBAnyImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 5198F7BD1BC338A900E2CC5F /* IDBAnyImpl.h */; settings = {ATTRIBUTES = (Private, ); }; };
</del><span class="cx">                 5198F7C01BC4856700E2CC5F /* IDBConnectionToServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5185FCBC1BB5CB770012898F /* IDBConnectionToServer.cpp */; };
</span><span class="cx">                 5198F7C11BC4856700E2CC5F /* IDBConnectionToServer.h in Headers */ = {isa = PBXBuildFile; fileRef = 510A58FD1BB07A9600C19282 /* IDBConnectionToServer.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 51A052331058774F00CC9E95 /* CredentialStorage.h in Headers */ = {isa = PBXBuildFile; fileRef = 51A052311058774F00CC9E95 /* CredentialStorage.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="lines">@@ -2234,14 +2218,8 @@
</span><span class="cx">                 51EE7B3A1AA5123100F92B21 /* ResourceLoadInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51EE7B391AA5123100F92B21 /* ResourceLoadInfo.cpp */; };
</span><span class="cx">                 51EEAA731BEFFAB100218008 /* IndexValueEntry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51EEAA711BEFFA7900218008 /* IndexValueEntry.cpp */; };
</span><span class="cx">                 51EEAA741BEFFAB100218008 /* IndexValueEntry.h in Headers */ = {isa = PBXBuildFile; fileRef = 51EEAA721BEFFA7900218008 /* IndexValueEntry.h */; };
</span><del>-                51F798E51BE88092008AE491 /* IDBCursorImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51F798E11BE88084008AE491 /* IDBCursorImpl.cpp */; };
-                51F798E61BE88092008AE491 /* IDBCursorImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 51F798E21BE88084008AE491 /* IDBCursorImpl.h */; settings = {ATTRIBUTES = (Private, ); }; };
-                51F798E71BE88092008AE491 /* IDBIndexImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51F798E31BE88084008AE491 /* IDBIndexImpl.cpp */; };
-                51F798E81BE88092008AE491 /* IDBIndexImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 51F798E41BE88084008AE491 /* IDBIndexImpl.h */; settings = {ATTRIBUTES = (Private, ); }; };
</del><span class="cx">                 51F798EF1BE880E7008AE491 /* IDBIndexInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51F798EB1BE880D3008AE491 /* IDBIndexInfo.cpp */; };
</span><span class="cx">                 51F798F01BE880E7008AE491 /* IDBIndexInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 51F798EC1BE880D3008AE491 /* IDBIndexInfo.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><del>-                51F798F31BE88394008AE491 /* IDBCursorWithValueImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51F798F11BE8838D008AE491 /* IDBCursorWithValueImpl.cpp */; };
-                51F798F41BE88394008AE491 /* IDBCursorWithValueImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 51F798F21BE8838D008AE491 /* IDBCursorWithValueImpl.h */; settings = {ATTRIBUTES = (Private, ); }; };
</del><span class="cx">                 51FA2D78152132B300C1BA0B /* DOMWindowExtension.h in Headers */ = {isa = PBXBuildFile; fileRef = 517FBA18151AA71B00B57959 /* DOMWindowExtension.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 51FB5504113E3E9100821176 /* JSCloseEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 51FB5502113E3E9100821176 /* JSCloseEvent.h */; };
</span><span class="cx">                 51FB5505113E3E9100821176 /* JSCloseEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51FB5503113E3E9100821176 /* JSCloseEvent.cpp */; };
</span><span class="lines">@@ -9499,12 +9477,6 @@
</span><span class="cx">                 510192D318B6B9B7007FC7A1 /* ImageControlsRootElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ImageControlsRootElement.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 510192D418B6B9B7007FC7A1 /* ImageControlsRootElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageControlsRootElement.h; sourceTree = "<group>"; };
</span><span class="cx">                 510192D818B7D7AB007FC7A1 /* imageControlsMac.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; path = imageControlsMac.css; sourceTree = "<group>"; };
</span><del>-                5103104A1BA8C6A6003329C0 /* IDBFactoryImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBFactoryImpl.cpp; sourceTree = "<group>"; };
-                5103104B1BA8C6A6003329C0 /* IDBFactoryImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBFactoryImpl.h; sourceTree = "<group>"; };
-                510310561BA8DB30003329C0 /* IDBOpenDBRequestImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBOpenDBRequestImpl.cpp; sourceTree = "<group>"; };
-                510310571BA8DB30003329C0 /* IDBOpenDBRequestImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBOpenDBRequestImpl.h; sourceTree = "<group>"; };
-                510310581BA8DB30003329C0 /* IDBRequestImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBRequestImpl.cpp; sourceTree = "<group>"; };
-                510310591BA8DB30003329C0 /* IDBRequestImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBRequestImpl.h; sourceTree = "<group>"; };
</del><span class="cx">                 5103105E1BA8E090003329C0 /* IDBDatabaseIdentifier.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBDatabaseIdentifier.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 5103105F1BA8E090003329C0 /* IDBDatabaseIdentifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBDatabaseIdentifier.h; sourceTree = "<group>"; };
</span><span class="cx">                 5106D7BB18BDB76F000AB166 /* ContextMenuContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ContextMenuContext.cpp; sourceTree = "<group>"; };
</span><span class="lines">@@ -9612,8 +9584,6 @@
</span><span class="cx">                 515E5FEF195101470086CA5E /* PlatformGamepad.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PlatformGamepad.h; sourceTree = "<group>"; };
</span><span class="cx">                 5160300A0CC4251200C8AC25 /* FileSystemPOSIX.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileSystemPOSIX.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 5160306B0CC4362300C8AC25 /* FileSystemCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileSystemCF.cpp; sourceTree = "<group>"; };
</span><del>-                516071291BD8305300DBC4F2 /* IDBObjectStoreImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBObjectStoreImpl.cpp; sourceTree = "<group>"; };
-                5160712A1BD8305300DBC4F2 /* IDBObjectStoreImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBObjectStoreImpl.h; sourceTree = "<group>"; };
</del><span class="cx">                 5160712B1BD8305300DBC4F2 /* TransactionOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TransactionOperation.h; sourceTree = "<group>"; };
</span><span class="cx">                 5160712C1BD8307200DBC4F2 /* IDBObjectStoreInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBObjectStoreInfo.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 5160712D1BD8307200DBC4F2 /* IDBObjectStoreInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBObjectStoreInfo.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -9705,14 +9675,6 @@
</span><span class="cx">                 5198F7A71BBDD38100E2CC5F /* UniqueIDBDatabaseTransaction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UniqueIDBDatabaseTransaction.h; sourceTree = "<group>"; };
</span><span class="cx">                 5198F7AA1BBDD3E300E2CC5F /* IDBTransactionInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBTransactionInfo.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 5198F7AB1BBDD3E300E2CC5F /* IDBTransactionInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBTransactionInfo.h; sourceTree = "<group>"; };
</span><del>-                5198F7AE1BBDF59200E2CC5F /* IDBDatabaseImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBDatabaseImpl.cpp; sourceTree = "<group>"; };
-                5198F7AF1BBDF59200E2CC5F /* IDBDatabaseImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBDatabaseImpl.h; sourceTree = "<group>"; };
-                5198F7B21BBE001D00E2CC5F /* IDBTransactionImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBTransactionImpl.cpp; sourceTree = "<group>"; };
-                5198F7B31BBE001D00E2CC5F /* IDBTransactionImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBTransactionImpl.h; sourceTree = "<group>"; };
-                5198F7B61BC3141700E2CC5F /* IDBVersionChangeEventImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBVersionChangeEventImpl.cpp; sourceTree = "<group>"; };
-                5198F7B71BC3141700E2CC5F /* IDBVersionChangeEventImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBVersionChangeEventImpl.h; sourceTree = "<group>"; };
-                5198F7BC1BC338A900E2CC5F /* IDBAnyImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBAnyImpl.cpp; sourceTree = "<group>"; };
-                5198F7BD1BC338A900E2CC5F /* IDBAnyImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBAnyImpl.h; sourceTree = "<group>"; };
</del><span class="cx">                 519FE0A10DAD446E00A08F21 /* HTMLAttributeNames.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HTMLAttributeNames.in; sourceTree = "<group>"; };
</span><span class="cx">                 519FE0A20DAD446E00A08F21 /* HTMLTagNames.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HTMLTagNames.in; sourceTree = "<group>"; };
</span><span class="cx">                 51A052311058774F00CC9E95 /* CredentialStorage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CredentialStorage.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -9820,14 +9782,8 @@
</span><span class="cx">                 51EEAA721BEFFA7900218008 /* IndexValueEntry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IndexValueEntry.h; sourceTree = "<group>"; };
</span><span class="cx">                 51F6A3D50663BF04004D2919 /* HTMLCanvasElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLCanvasElement.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
</span><span class="cx">                 51F6A3D60663BF04004D2919 /* HTMLCanvasElement.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = HTMLCanvasElement.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
</span><del>-                51F798E11BE88084008AE491 /* IDBCursorImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBCursorImpl.cpp; sourceTree = "<group>"; };
-                51F798E21BE88084008AE491 /* IDBCursorImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBCursorImpl.h; sourceTree = "<group>"; };
-                51F798E31BE88084008AE491 /* IDBIndexImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBIndexImpl.cpp; sourceTree = "<group>"; };
-                51F798E41BE88084008AE491 /* IDBIndexImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBIndexImpl.h; sourceTree = "<group>"; };
</del><span class="cx">                 51F798EB1BE880D3008AE491 /* IDBIndexInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBIndexInfo.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 51F798EC1BE880D3008AE491 /* IDBIndexInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBIndexInfo.h; sourceTree = "<group>"; };
</span><del>-                51F798F11BE8838D008AE491 /* IDBCursorWithValueImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBCursorWithValueImpl.cpp; sourceTree = "<group>"; };
-                51F798F21BE8838D008AE491 /* IDBCursorWithValueImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBCursorWithValueImpl.h; sourceTree = "<group>"; };
</del><span class="cx">                 51FB5502113E3E9100821176 /* JSCloseEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCloseEvent.h; sourceTree = "<group>"; };
</span><span class="cx">                 51FB5503113E3E9100821176 /* JSCloseEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCloseEvent.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 51FB67D91AE6B5E400D06C5A /* ContentExtensionStyleSheet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ContentExtensionStyleSheet.cpp; sourceTree = "<group>"; };
</span><span class="lines">@@ -17226,31 +17182,9 @@
</span><span class="cx">                 510310421BA8C64C003329C0 /* client */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><del>-                                5198F7BC1BC338A900E2CC5F /* IDBAnyImpl.cpp */,
-                                5198F7BD1BC338A900E2CC5F /* IDBAnyImpl.h */,
</del><span class="cx">                                 5185FCBC1BB5CB770012898F /* IDBConnectionToServer.cpp */,
</span><span class="cx">                                 510A58FD1BB07A9600C19282 /* IDBConnectionToServer.h */,
</span><span class="cx">                                 5185FCBD1BB5CB770012898F /* IDBConnectionToServerDelegate.h */,
</span><del>-                                51F798E11BE88084008AE491 /* IDBCursorImpl.cpp */,
-                                51F798E21BE88084008AE491 /* IDBCursorImpl.h */,
-                                51F798F11BE8838D008AE491 /* IDBCursorWithValueImpl.cpp */,
-                                51F798F21BE8838D008AE491 /* IDBCursorWithValueImpl.h */,
-                                5198F7AE1BBDF59200E2CC5F /* IDBDatabaseImpl.cpp */,
-                                5198F7AF1BBDF59200E2CC5F /* IDBDatabaseImpl.h */,
-                                5103104A1BA8C6A6003329C0 /* IDBFactoryImpl.cpp */,
-                                5103104B1BA8C6A6003329C0 /* IDBFactoryImpl.h */,
-                                51F798E31BE88084008AE491 /* IDBIndexImpl.cpp */,
-                                51F798E41BE88084008AE491 /* IDBIndexImpl.h */,
-                                516071291BD8305300DBC4F2 /* IDBObjectStoreImpl.cpp */,
-                                5160712A1BD8305300DBC4F2 /* IDBObjectStoreImpl.h */,
-                                510310561BA8DB30003329C0 /* IDBOpenDBRequestImpl.cpp */,
-                                510310571BA8DB30003329C0 /* IDBOpenDBRequestImpl.h */,
-                                510310581BA8DB30003329C0 /* IDBRequestImpl.cpp */,
-                                510310591BA8DB30003329C0 /* IDBRequestImpl.h */,
-                                5198F7B21BBE001D00E2CC5F /* IDBTransactionImpl.cpp */,
-                                5198F7B31BBE001D00E2CC5F /* IDBTransactionImpl.h */,
-                                5198F7B61BC3141700E2CC5F /* IDBVersionChangeEventImpl.cpp */,
-                                5198F7B71BC3141700E2CC5F /* IDBVersionChangeEventImpl.h */,
</del><span class="cx">                                 51D7EFEB1BDEFA4700E93E10 /* TransactionOperation.cpp */,
</span><span class="cx">                                 5160712B1BD8305300DBC4F2 /* TransactionOperation.h */,
</span><span class="cx">                         );
</span><span class="lines">@@ -26318,7 +26252,6 @@
</span><span class="cx">                                 51E1ECC10C91C90400DC255B /* IconRecord.h in Headers */,
</span><span class="cx">                                 45BAC2B01360BBAB005DA258 /* IconURL.h in Headers */,
</span><span class="cx">                                 5185FC781BB4C4E80012898F /* IDBAny.h in Headers */,
</span><del>-                                5198F7BF1BC338AF00E2CC5F /* IDBAnyImpl.h in Headers */,
</del><span class="cx">                                 51BA4ACC1BBC5BDD00DF3D6D /* IDBBackingStore.h in Headers */,
</span><span class="cx">                                 C585A66311D4FAC5004C3E4B /* IDBBindingUtilities.h in Headers */,
</span><span class="cx">                                 5185FCB91BB4CBF80012898F /* IDBConnectionToClient.h in Headers */,
</span><span class="lines">@@ -26326,24 +26259,19 @@
</span><span class="cx">                                 5198F7C11BC4856700E2CC5F /* IDBConnectionToServer.h in Headers */,
</span><span class="cx">                                 516D7D701BB5F0BD00AF7C77 /* IDBConnectionToServerDelegate.h in Headers */,
</span><span class="cx">                                 5185FC7B1BB4C4E80012898F /* IDBCursor.h in Headers */,
</span><del>-                                51F798E61BE88092008AE491 /* IDBCursorImpl.h in Headers */,
</del><span class="cx">                                 517138FC1BF3ADF4000D5F01 /* IDBCursorInfo.h in Headers */,
</span><span class="cx">                                 5185FC7E1BB4C4E80012898F /* IDBCursorWithValue.h in Headers */,
</span><del>-                                51F798F41BE88394008AE491 /* IDBCursorWithValueImpl.h in Headers */,
</del><span class="cx">                                 5185FC811BB4C4E80012898F /* IDBDatabase.h in Headers */,
</span><span class="cx">                                 5185FC831BB4C4E80012898F /* IDBDatabaseError.h in Headers */,
</span><span class="cx">                                 5185FC851BB4C4E80012898F /* IDBDatabaseException.h in Headers */,
</span><span class="cx">                                 5185FC871BB4C4E80012898F /* IDBDatabaseIdentifier.h in Headers */,
</span><del>-                                5198F7B11BBDF5C800E2CC5F /* IDBDatabaseImpl.h in Headers */,
</del><span class="cx">                                 51BA4AC41BBB5CD800DF3D6D /* IDBDatabaseInfo.h in Headers */,
</span><span class="cx">                                 5148453F1BB9D07E006A72ED /* IDBError.h in Headers */,
</span><span class="cx">                                 5185FC8B1BB4C4E80012898F /* IDBEventDispatcher.h in Headers */,
</span><span class="cx">                                 5185FC8D1BB4C4E80012898F /* IDBFactory.h in Headers */,
</span><span class="cx">                                 69A6CBAD1C6BE42C00B836E9 /* AccessibilitySVGElement.h in Headers */,
</span><del>-                                510310501BA8CC03003329C0 /* IDBFactoryImpl.h in Headers */,
</del><span class="cx">                                 5185FC8F1BB4C4E80012898F /* IDBGetResult.h in Headers */,
</span><span class="cx">                                 5185FC911BB4C4E80012898F /* IDBIndex.h in Headers */,
</span><del>-                                51F798E81BE88092008AE491 /* IDBIndexImpl.h in Headers */,
</del><span class="cx">                                 51F798F01BE880E7008AE491 /* IDBIndexInfo.h in Headers */,
</span><span class="cx">                                 5185FC951BB4C4E80012898F /* IDBKey.h in Headers */,
</span><span class="cx">                                 5185FC971BB4C4E80012898F /* IDBKeyData.h in Headers */,
</span><span class="lines">@@ -26351,24 +26279,19 @@
</span><span class="cx">                                 5185FC9B1BB4C4E80012898F /* IDBKeyRange.h in Headers */,
</span><span class="cx">                                 5185FC9E1BB4C4E80012898F /* IDBKeyRangeData.h in Headers */,
</span><span class="cx">                                 5185FCA01BB4C4E80012898F /* IDBObjectStore.h in Headers */,
</span><del>-                                516071311BD8308600DBC4F2 /* IDBObjectStoreImpl.h in Headers */,
</del><span class="cx">                                 5160712F1BD8307800DBC4F2 /* IDBObjectStoreInfo.h in Headers */,
</span><span class="cx">                                 5185FCA41BB4C4E80012898F /* IDBOpenDBRequest.h in Headers */,
</span><del>-                                5103105B1BA8DB56003329C0 /* IDBOpenDBRequestImpl.h in Headers */,
</del><span class="cx">                                 5185FCA71BB4C4E80012898F /* IDBRecordIdentifier.h in Headers */,
</span><span class="cx">                                 5185FCA91BB4C4E80012898F /* IDBRequest.h in Headers */,
</span><span class="cx">                                 514129991C6976900059E714 /* IDBRequestCompletionEvent.h in Headers */,
</span><span class="cx">                                 510A58FA1BACC7F200C19282 /* IDBRequestData.h in Headers */,
</span><del>-                                5103105D1BA8DB56003329C0 /* IDBRequestImpl.h in Headers */,
</del><span class="cx">                                 5145B10A1BC48E2E00E86219 /* IDBResourceIdentifier.h in Headers */,
</span><span class="cx">                                 51D7236D1BB6174900478CA3 /* IDBResultData.h in Headers */,
</span><span class="cx">                                 511EC1281C50AACA0032F983 /* IDBSerialization.h in Headers */,
</span><span class="cx">                                 5185FCBB1BB4CBF80012898F /* IDBServer.h in Headers */,
</span><span class="cx">                                 5185FCAD1BB4C4E80012898F /* IDBTransaction.h in Headers */,
</span><del>-                                5198F7B51BBE003C00E2CC5F /* IDBTransactionImpl.h in Headers */,
</del><span class="cx">                                 5198F7AD1BBDD3EB00E2CC5F /* IDBTransactionInfo.h in Headers */,
</span><span class="cx">                                 5185FCB01BB4C4E80012898F /* IDBVersionChangeEvent.h in Headers */,
</span><del>-                                5198F7B91BC3145100E2CC5F /* IDBVersionChangeEventImpl.h in Headers */,
</del><span class="cx">                                 E4A814E01C7338EB00BF85AC /* IdChangeInvalidation.h in Headers */,
</span><span class="cx">                                 1A71D57C0F33819000F9CE4E /* IdentifierRep.h in Headers */,
</span><span class="cx">                                 49E911C50EF86D47009D0CAF /* IdentityTransformOperation.h in Headers */,
</span><span class="lines">@@ -30002,27 +29925,21 @@
</span><span class="cx">                                 B275358E0B053A66002CE64F /* IconMac.mm in Sources */,
</span><span class="cx">                                 51E1ECC00C91C90400DC255B /* IconRecord.cpp in Sources */,
</span><span class="cx">                                 5185FC771BB4C4E80012898F /* IDBAny.cpp in Sources */,
</span><del>-                                5198F7BE1BC338AF00E2CC5F /* IDBAnyImpl.cpp in Sources */,
</del><span class="cx">                                 C585A66211D4FAC5004C3E4B /* IDBBindingUtilities.cpp in Sources */,
</span><span class="cx">                                 516D7D711BB5F0BD00AF7C77 /* IDBConnectionToClient.cpp in Sources */,
</span><span class="cx">                                 5198F7C01BC4856700E2CC5F /* IDBConnectionToServer.cpp in Sources */,
</span><span class="cx">                                 5185FC7A1BB4C4E80012898F /* IDBCursor.cpp in Sources */,
</span><del>-                                51F798E51BE88092008AE491 /* IDBCursorImpl.cpp in Sources */,
</del><span class="cx">                                 517138FB1BF3ADF4000D5F01 /* IDBCursorInfo.cpp in Sources */,
</span><span class="cx">                                 5185FC7D1BB4C4E80012898F /* IDBCursorWithValue.cpp in Sources */,
</span><del>-                                51F798F31BE88394008AE491 /* IDBCursorWithValueImpl.cpp in Sources */,
</del><span class="cx">                                 5185FC801BB4C4E80012898F /* IDBDatabase.cpp in Sources */,
</span><span class="cx">                                 5185FC841BB4C4E80012898F /* IDBDatabaseException.cpp in Sources */,
</span><span class="cx">                                 5185FC861BB4C4E80012898F /* IDBDatabaseIdentifier.cpp in Sources */,
</span><del>-                                5198F7B01BBDF5C800E2CC5F /* IDBDatabaseImpl.cpp in Sources */,
</del><span class="cx">                                 51BA4AC31BBB5CD800DF3D6D /* IDBDatabaseInfo.cpp in Sources */,
</span><span class="cx">                                 5148453E1BB9D07E006A72ED /* IDBError.cpp in Sources */,
</span><span class="cx">                                 5185FC8A1BB4C4E80012898F /* IDBEventDispatcher.cpp in Sources */,
</span><span class="cx">                                 5185FC8C1BB4C4E80012898F /* IDBFactory.cpp in Sources */,
</span><del>-                                5103104F1BA8CC03003329C0 /* IDBFactoryImpl.cpp in Sources */,
</del><span class="cx">                                 512F1A781C07EB6600908239 /* IDBGetResult.cpp in Sources */,
</span><span class="cx">                                 5185FC901BB4C4E80012898F /* IDBIndex.cpp in Sources */,
</span><del>-                                51F798E71BE88092008AE491 /* IDBIndexImpl.cpp in Sources */,
</del><span class="cx">                                 51F798EF1BE880E7008AE491 /* IDBIndexInfo.cpp in Sources */,
</span><span class="cx">                                 5185FC941BB4C4E80012898F /* IDBKey.cpp in Sources */,
</span><span class="cx">                                 5185FC961BB4C4E80012898F /* IDBKeyData.cpp in Sources */,
</span><span class="lines">@@ -30030,23 +29947,18 @@
</span><span class="cx">                                 5185FC9A1BB4C4E80012898F /* IDBKeyRange.cpp in Sources */,
</span><span class="cx">                                 5185FC9D1BB4C4E80012898F /* IDBKeyRangeData.cpp in Sources */,
</span><span class="cx">                                 5185FC9F1BB4C4E80012898F /* IDBObjectStore.cpp in Sources */,
</span><del>-                                516071301BD8308600DBC4F2 /* IDBObjectStoreImpl.cpp in Sources */,
</del><span class="cx">                                 5160712E1BD8307800DBC4F2 /* IDBObjectStoreInfo.cpp in Sources */,
</span><span class="cx">                                 5185FCA31BB4C4E80012898F /* IDBOpenDBRequest.cpp in Sources */,
</span><del>-                                5103105A1BA8DB56003329C0 /* IDBOpenDBRequestImpl.cpp in Sources */,
</del><span class="cx">                                 5185FCA81BB4C4E80012898F /* IDBRequest.cpp in Sources */,
</span><span class="cx">                                 514129981C6976900059E714 /* IDBRequestCompletionEvent.cpp in Sources */,
</span><span class="cx">                                 510A58F91BACC7F200C19282 /* IDBRequestData.cpp in Sources */,
</span><del>-                                5103105C1BA8DB56003329C0 /* IDBRequestImpl.cpp in Sources */,
</del><span class="cx">                                 5145B1091BC48E2E00E86219 /* IDBResourceIdentifier.cpp in Sources */,
</span><span class="cx">                                 51D7236C1BB6174900478CA3 /* IDBResultData.cpp in Sources */,
</span><span class="cx">                                 511EC1271C50AACA0032F983 /* IDBSerialization.cpp in Sources */,
</span><span class="cx">                                 5185FCBA1BB4CBF80012898F /* IDBServer.cpp in Sources */,
</span><span class="cx">                                 5185FCAC1BB4C4E80012898F /* IDBTransaction.cpp in Sources */,
</span><del>-                                5198F7B41BBE003C00E2CC5F /* IDBTransactionImpl.cpp in Sources */,
</del><span class="cx">                                 5198F7AC1BBDD3EB00E2CC5F /* IDBTransactionInfo.cpp in Sources */,
</span><span class="cx">                                 5185FCAF1BB4C4E80012898F /* IDBVersionChangeEvent.cpp in Sources */,
</span><del>-                                5198F7B81BC3145100E2CC5F /* IDBVersionChangeEventImpl.cpp in Sources */,
</del><span class="cx">                                 E4A814DE1C7338D100BF85AC /* IdChangeInvalidation.cpp in Sources */,
</span><span class="cx">                                 1A71D57B0F33819000F9CE4E /* IdentifierRep.cpp in Sources */,
</span><span class="cx">                                 C3CF17A415B0063F00276D39 /* IdTargetObserver.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSIDBCursorCustomcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSIDBCursorCustom.cpp (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSIDBCursorCustom.cpp        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/bindings/js/JSIDBCursorCustom.cpp        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -28,7 +28,7 @@
</span><span class="cx">
</span><span class="cx"> #if ENABLE(INDEXED_DATABASE)
</span><span class="cx">
</span><del>-#include "IDBCursorImpl.h"
</del><ins>+#include "IDBCursor.h"
</ins><span class="cx">
</span><span class="cx"> using namespace JSC;
</span><span class="cx">
</span><span class="lines">@@ -36,11 +36,8 @@
</span><span class="cx">
</span><span class="cx"> void JSIDBCursor::visitAdditionalChildren(SlotVisitor& visitor)
</span><span class="cx"> {
</span><del>- if (!wrapped().isModernCursor())
- return;
-
- auto& modernCursor = static_cast<IDBClient::IDBCursor&>(wrapped());
- if (auto* request = modernCursor.request())
</del><ins>+ auto& cursor = static_cast<IDBCursor&>(wrapped());
+ if (auto* request = cursor.request())
</ins><span class="cx"> visitor.addOpaqueRoot(request);
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSIDBCursorWithValueCustomcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSIDBCursorWithValueCustom.cpp (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSIDBCursorWithValueCustom.cpp        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/bindings/js/JSIDBCursorWithValueCustom.cpp        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -28,7 +28,7 @@
</span><span class="cx">
</span><span class="cx"> #if ENABLE(INDEXED_DATABASE)
</span><span class="cx">
</span><del>-#include "IDBCursorWithValueImpl.h"
</del><ins>+#include "IDBCursorWithValue.h"
</ins><span class="cx">
</span><span class="cx"> using namespace JSC;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSIDBIndexCustomcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSIDBIndexCustom.cpp (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSIDBIndexCustom.cpp        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/bindings/js/JSIDBIndexCustom.cpp        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -28,7 +28,7 @@
</span><span class="cx">
</span><span class="cx"> #if ENABLE(INDEXED_DATABASE)
</span><span class="cx">
</span><del>-#include "IDBIndexImpl.h"
</del><ins>+#include "IDBIndex.h"
</ins><span class="cx">
</span><span class="cx"> using namespace JSC;
</span><span class="cx">
</span><span class="lines">@@ -36,10 +36,7 @@
</span><span class="cx">
</span><span class="cx"> void JSIDBIndex::visitAdditionalChildren(SlotVisitor& visitor)
</span><span class="cx"> {
</span><del>- if (!wrapped().isModern())
- return;
-
- visitor.addOpaqueRoot(&static_cast<IDBClient::IDBIndex&>(wrapped()).modernObjectStore());
</del><ins>+ visitor.addOpaqueRoot(&static_cast<IDBIndex&>(wrapped()).modernObjectStore());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSIDBObjectStoreCustomcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSIDBObjectStoreCustom.cpp (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSIDBObjectStoreCustom.cpp        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/bindings/js/JSIDBObjectStoreCustom.cpp        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -34,7 +34,7 @@
</span><span class="cx"> #include "IDBBindingUtilities.h"
</span><span class="cx"> #include "IDBDatabaseException.h"
</span><span class="cx"> #include "IDBKeyPath.h"
</span><del>-#include "IDBObjectStoreImpl.h"
</del><ins>+#include "IDBObjectStore.h"
</ins><span class="cx"> #include "JSDOMBinding.h"
</span><span class="cx"> #include "JSIDBIndex.h"
</span><span class="cx"> #include "JSIDBRequest.h"
</span><span class="lines">@@ -47,10 +47,7 @@
</span><span class="cx">
</span><span class="cx"> void JSIDBObjectStore::visitAdditionalChildren(SlotVisitor& visitor)
</span><span class="cx"> {
</span><del>- if (!wrapped().isModern())
- return;
-
- static_cast<IDBClient::IDBObjectStore&>(wrapped()).visitReferencedIndexes(visitor);
</del><ins>+ static_cast<IDBObjectStore&>(wrapped()).visitReferencedIndexes(visitor);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static JSValue putOrAdd(JSC::ExecState& state, bool overwrite)
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorIndexedDBAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -185,13 +185,10 @@
</span><span class="cx"> m_executableWithDatabase->requestCallback().sendFailure("Unexpected result type.");
</span><span class="cx"> return;
</span><span class="cx"> }
</span><del>- if (!requestResult->isLegacy()) {
- m_executableWithDatabase->requestCallback().sendFailure("Only Legacy IDB is supported right now.");
- return;
- }
</del><span class="cx">
</span><span class="cx"> // FIXME (webkit.org/b/154686) - Reimplement this.
</span><del>- m_executableWithDatabase->execute();
</del><ins>+ m_executableWithDatabase->requestCallback().sendFailure("Modern IDB is not supported yet");
+ return;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> private:
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebKit2/ChangeLog        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -1,3 +1,12 @@
</span><ins>+2016-03-28 Brady Eidson <beidson@apple.com>
+
+ Modern IDB: Remove abstract base classes for all IDB DOM classes.
+ https://bugs.webkit.org/show_bug.cgi?id=155951
+
+ Reviewed by Alex Christensen.
+
+ * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
+
</ins><span class="cx"> 2016-03-28 Brian Burg <bburg@apple.com>
</span><span class="cx">
</span><span class="cx"> Web Automation: add commands to move and resize a browsing context's window
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessDatabasesIndexedDBWebIDBConnectionToServercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp (198761 => 198762)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp        2016-03-28 22:41:48 UTC (rev 198761)
+++ trunk/Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp        2016-03-28 22:49:04 UTC (rev 198762)
</span><span class="lines">@@ -39,7 +39,7 @@
</span><span class="cx"> #include <WebCore/IDBIndexInfo.h>
</span><span class="cx"> #include <WebCore/IDBKeyRangeData.h>
</span><span class="cx"> #include <WebCore/IDBObjectStoreInfo.h>
</span><del>-#include <WebCore/IDBOpenDBRequestImpl.h>
</del><ins>+#include <WebCore/IDBOpenDBRequest.h>
</ins><span class="cx"> #include <WebCore/IDBRequestData.h>
</span><span class="cx"> #include <WebCore/IDBResourceIdentifier.h>
</span><span class="cx"> #include <WebCore/IDBResultData.h>
</span></span></pre>
</div>
</div>
</body>
</html>