<!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>[163627] trunk</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/163627">163627</a></dd>
<dt>Author</dt> <dd>beidson@apple.com</dd>
<dt>Date</dt> <dd>2014-02-07 10:26:48 -0800 (Fri, 07 Feb 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>IDB: storage/indexeddb/create-index-with-integer-keys.html fails
<rdar://problem/16002857> and https://bugs.webkit.org/show_bug.cgi?id=128316
Reviewed by Geoff Garen.
Source/WebCore:
Tested by storage/indexeddb/create-index-with-integer-keys.html (and probably some others)
* Modules/indexeddb/IDBCursor.cpp:
(WebCore::IDBCursor::update): Update createIDBKeyFromScriptValueAndKeyPath usage.
(WebCore::IDBCursor::setValueReady): Update createIDBKeyFromScriptValueAndKeyPath usage.
* Modules/indexeddb/IDBObjectStore.cpp:
(WebCore::IDBObjectStore::put): Update usage of binding utilities.
* Modules/indexeddb/IDBRequest.cpp:
(WebCore::IDBRequest::onSuccess): Update createIDBKeyFromScriptValueAndKeyPath usage.
* bindings/js/IDBBindingUtilities.cpp:
(WebCore::internalCreateIDBKeyFromScriptValueAndKeyPath):
(WebCore::createIDBKeyFromScriptValueAndKeyPath): Changed to take an ExecState*.
(WebCore::deserializeIDBValueBuffer): Added new version that starts with ExecState* and Vector<uint8_t>
instead of RequestState and SharedBuffer.
(WebCore::generateIndexKeysForValue): Moved from IDBObjectStore.cpp and changed to take an ExecState*
* bindings/js/IDBBindingUtilities.h:
Added new blob fetcher that works with uint8_t buffers:
* platform/sql/SQLiteStatement.cpp:
(WebCore::SQLiteStatement::getColumnBlobAsVector):
* platform/sql/SQLiteStatement.h:
* WebCore.exp.in:
Source/WebKit2:
Update Vector<char> to Vector<uint8_t> throughout:
* DatabaseProcess/IndexedDB/UniqueIDBDatabase.cpp:
(WebKit::UniqueIDBDatabase::openCursorInBackingStore):
(WebKit::UniqueIDBDatabase::didOpenCursorInBackingStore):
(WebKit::UniqueIDBDatabase::advanceCursorInBackingStore):
(WebKit::UniqueIDBDatabase::didAdvanceCursorInBackingStore):
(WebKit::UniqueIDBDatabase::iterateCursorInBackingStore):
(WebKit::UniqueIDBDatabase::didIterateCursorInBackingStore):
* DatabaseProcess/IndexedDB/UniqueIDBDatabase.h:
Update Vector<char> to Vector<uint8_t> throughout:
* DatabaseProcess/IndexedDB/sqlite/SQLiteIDBCursor.cpp:
(WebKit::SQLiteIDBCursor::advanceOnce):
* DatabaseProcess/IndexedDB/sqlite/SQLiteIDBCursor.h:
(WebKit::SQLiteIDBCursor::currentValueBuffer):
* DatabaseProcess/IndexedDB/UniqueIDBDatabaseBackingStore.h:
* DatabaseProcess/IndexedDB/sqlite/UniqueIDBDatabaseBackingStoreSQLite.cpp:
(WebKit::UniqueIDBDatabaseBackingStoreSQLite::createIndex): Create a script value from the value data, use
generateIndexKeysForValue to get the index keys, and then write the resulting index records.
(WebKit::UniqueIDBDatabaseBackingStoreSQLite::putIndexRecord): Call through to uncheckedPutIndexRecord.
(WebKit::UniqueIDBDatabaseBackingStoreSQLite::uncheckedPutIndexRecord): Version of putIndexRecord that doesn’t
validate the transaction or its mode.
(WebKit::UniqueIDBDatabaseBackingStoreSQLite::openCursor): Update Vector<char> to Vector<uint8_t>.
(WebKit::UniqueIDBDatabaseBackingStoreSQLite::advanceCursor): Ditto.
(WebKit::UniqueIDBDatabaseBackingStoreSQLite::iterateCursor): Ditto.
* DatabaseProcess/IndexedDB/sqlite/UniqueIDBDatabaseBackingStoreSQLite.h:
LayoutTests:
* platform/mac-wk2/TestExpectations: Enable the test.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformmacwk2TestExpectations">trunk/LayoutTests/platform/mac-wk2/TestExpectations</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBCursorcpp">trunk/Source/WebCore/Modules/indexeddb/IDBCursor.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBObjectStorecpp">trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBRequestcpp">trunk/Source/WebCore/Modules/indexeddb/IDBRequest.cpp</a></li>
<li><a href="#trunkSourceWebCoreWebCoreexpin">trunk/Source/WebCore/WebCore.exp.in</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCorebindingsjsIDBBindingUtilitiescpp">trunk/Source/WebCore/bindings/js/IDBBindingUtilities.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsjsIDBBindingUtilitiesh">trunk/Source/WebCore/bindings/js/IDBBindingUtilities.h</a></li>
<li><a href="#trunkSourceWebCoreplatformsqlSQLiteStatementcpp">trunk/Source/WebCore/platform/sql/SQLiteStatement.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformsqlSQLiteStatementh">trunk/Source/WebCore/platform/sql/SQLiteStatement.h</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2DatabaseProcessIndexedDBUniqueIDBDatabasecpp">trunk/Source/WebKit2/DatabaseProcess/IndexedDB/UniqueIDBDatabase.cpp</a></li>
<li><a href="#trunkSourceWebKit2DatabaseProcessIndexedDBUniqueIDBDatabaseh">trunk/Source/WebKit2/DatabaseProcess/IndexedDB/UniqueIDBDatabase.h</a></li>
<li><a href="#trunkSourceWebKit2DatabaseProcessIndexedDBUniqueIDBDatabaseBackingStoreh">trunk/Source/WebKit2/DatabaseProcess/IndexedDB/UniqueIDBDatabaseBackingStore.h</a></li>
<li><a href="#trunkSourceWebKit2DatabaseProcessIndexedDBsqliteSQLiteIDBCursorcpp">trunk/Source/WebKit2/DatabaseProcess/IndexedDB/sqlite/SQLiteIDBCursor.cpp</a></li>
<li><a href="#trunkSourceWebKit2DatabaseProcessIndexedDBsqliteSQLiteIDBCursorh">trunk/Source/WebKit2/DatabaseProcess/IndexedDB/sqlite/SQLiteIDBCursor.h</a></li>
<li><a href="#trunkSourceWebKit2DatabaseProcessIndexedDBsqliteUniqueIDBDatabaseBackingStoreSQLitecpp">trunk/Source/WebKit2/DatabaseProcess/IndexedDB/sqlite/UniqueIDBDatabaseBackingStoreSQLite.cpp</a></li>
<li><a href="#trunkSourceWebKit2DatabaseProcessIndexedDBsqliteUniqueIDBDatabaseBackingStoreSQLiteh">trunk/Source/WebKit2/DatabaseProcess/IndexedDB/sqlite/UniqueIDBDatabaseBackingStoreSQLite.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (163626 => 163627)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-02-07 18:20:01 UTC (rev 163626)
+++ trunk/LayoutTests/ChangeLog        2014-02-07 18:26:48 UTC (rev 163627)
</span><span class="lines">@@ -1,3 +1,12 @@
</span><ins>+2014-02-06 Brady Eidson <beidson@apple.com>
+
+ IDB: storage/indexeddb/create-index-with-integer-keys.html fails
+ <rdar://problem/16002857> and https://bugs.webkit.org/show_bug.cgi?id=128316
+
+ Reviewed by Geoff Garen.
+
+ * platform/mac-wk2/TestExpectations: Enable the test.
+
</ins><span class="cx"> 2014-02-07 Frédéric Wang <fred.wang@free.fr>
</span><span class="cx">
</span><span class="cx"> childShouldCreateRenderer should return false for the mspace element
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacwk2TestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac-wk2/TestExpectations (163626 => 163627)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac-wk2/TestExpectations        2014-02-07 18:20:01 UTC (rev 163626)
+++ trunk/LayoutTests/platform/mac-wk2/TestExpectations        2014-02-07 18:26:48 UTC (rev 163627)
</span><span class="lines">@@ -474,6 +474,7 @@
</span><span class="cx"> storage/indexeddb/mozilla/add-twice-failure.html [ Pass ]
</span><span class="cx"> storage/indexeddb/mozilla/autoincrement-indexes.html [ Pass ]
</span><span class="cx"> storage/indexeddb/mozilla/clear.html [ Pass ]
</span><ins>+storage/indexeddb/mozilla/create-index-with-integer-keys.html [ Pass ]
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx"> ### END OF (5) Features that are not supported in WebKit1, so skipped in mac/TestExpectations then re-enabled here
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (163626 => 163627)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-02-07 18:20:01 UTC (rev 163626)
+++ trunk/Source/WebCore/ChangeLog        2014-02-07 18:26:48 UTC (rev 163627)
</span><span class="lines">@@ -1,3 +1,37 @@
</span><ins>+2014-02-06 Brady Eidson <beidson@apple.com>
+
+ IDB: storage/indexeddb/create-index-with-integer-keys.html fails
+ <rdar://problem/16002857> and https://bugs.webkit.org/show_bug.cgi?id=128316
+
+ Reviewed by Geoff Garen.
+
+ Tested by storage/indexeddb/create-index-with-integer-keys.html (and probably some others)
+
+ * Modules/indexeddb/IDBCursor.cpp:
+ (WebCore::IDBCursor::update): Update createIDBKeyFromScriptValueAndKeyPath usage.
+ (WebCore::IDBCursor::setValueReady): Update createIDBKeyFromScriptValueAndKeyPath usage.
+
+ * Modules/indexeddb/IDBObjectStore.cpp:
+ (WebCore::IDBObjectStore::put): Update usage of binding utilities.
+
+ * Modules/indexeddb/IDBRequest.cpp:
+ (WebCore::IDBRequest::onSuccess): Update createIDBKeyFromScriptValueAndKeyPath usage.
+
+ * bindings/js/IDBBindingUtilities.cpp:
+ (WebCore::internalCreateIDBKeyFromScriptValueAndKeyPath):
+ (WebCore::createIDBKeyFromScriptValueAndKeyPath): Changed to take an ExecState*.
+ (WebCore::deserializeIDBValueBuffer): Added new version that starts with ExecState* and Vector<uint8_t>
+ instead of RequestState and SharedBuffer.
+ (WebCore::generateIndexKeysForValue): Moved from IDBObjectStore.cpp and changed to take an ExecState*
+ * bindings/js/IDBBindingUtilities.h:
+
+ Added new blob fetcher that works with uint8_t buffers:
+ * platform/sql/SQLiteStatement.cpp:
+ (WebCore::SQLiteStatement::getColumnBlobAsVector):
+ * platform/sql/SQLiteStatement.h:
+
+ * WebCore.exp.in:
+
</ins><span class="cx"> 2014-02-07 Frédéric Wang <fred.wang@free.fr>
</span><span class="cx">
</span><span class="cx"> childShouldCreateRenderer should return false for the mspace element
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBCursorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBCursor.cpp (163626 => 163627)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBCursor.cpp        2014-02-07 18:20:01 UTC (rev 163626)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBCursor.cpp        2014-02-07 18:26:48 UTC (rev 163627)
</span><span class="lines">@@ -142,7 +142,7 @@
</span><span class="cx"> const IDBKeyPath& keyPath = objectStore->metadata().keyPath;
</span><span class="cx"> const bool usesInLineKeys = !keyPath.isNull();
</span><span class="cx"> if (usesInLineKeys) {
</span><del>- RefPtr<IDBKey> keyPathKey = createIDBKeyFromScriptValueAndKeyPath(m_request->requestState(), value, keyPath);
</del><ins>+ RefPtr<IDBKey> keyPathKey = createIDBKeyFromScriptValueAndKeyPath(m_request->requestState()->exec(), value, keyPath);
</ins><span class="cx"> if (!keyPathKey || !keyPathKey->isEqual(m_currentPrimaryKey.get())) {
</span><span class="cx"> ec = IDBDatabaseException::DataError;
</span><span class="cx"> return 0;
</span><span class="lines">@@ -276,7 +276,7 @@
</span><span class="cx"> const IDBObjectStoreMetadata metadata = objectStore->metadata();
</span><span class="cx"> if (metadata.autoIncrement && !metadata.keyPath.isNull()) {
</span><span class="cx"> #ifndef NDEBUG
</span><del>- RefPtr<IDBKey> expectedKey = createIDBKeyFromScriptValueAndKeyPath(m_request->requestState(), value, metadata.keyPath);
</del><ins>+ RefPtr<IDBKey> expectedKey = createIDBKeyFromScriptValueAndKeyPath(m_request->requestState()->exec(), value, metadata.keyPath);
</ins><span class="cx"> ASSERT(!expectedKey || expectedKey->isEqual(m_currentPrimaryKey.get()));
</span><span class="cx"> #endif
</span><span class="cx"> bool injected = injectIDBKeyIntoScriptValue(m_request->requestState(), m_currentPrimaryKey, value, metadata.keyPath);
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBObjectStorecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp (163626 => 163627)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp        2014-02-07 18:20:01 UTC (rev 163626)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp        2014-02-07 18:26:48 UTC (rev 163627)
</span><span class="lines">@@ -36,6 +36,7 @@
</span><span class="cx"> #include "IDBDatabaseException.h"
</span><span class="cx"> #include "IDBIndex.h"
</span><span class="cx"> #include "IDBKey.h"
</span><ins>+#include "IDBKeyData.h"
</ins><span class="cx"> #include "IDBKeyPath.h"
</span><span class="cx"> #include "IDBKeyRange.h"
</span><span class="cx"> #include "IDBTransaction.h"
</span><span class="lines">@@ -94,29 +95,6 @@
</span><span class="cx"> return get(context, keyRange.release(), ec);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static void generateIndexKeysForValue(DOMRequestState* requestState, const IDBIndexMetadata& indexMetadata, const Deprecated::ScriptValue& objectValue, IDBObjectStore::IndexKeys* indexKeys)
-{
- ASSERT(indexKeys);
- RefPtr<IDBKey> indexKey = createIDBKeyFromScriptValueAndKeyPath(requestState, objectValue, indexMetadata.keyPath);
-
- if (!indexKey)
- return;
-
- if (!indexMetadata.multiEntry || indexKey->type() != IDBKey::ArrayType) {
- if (!indexKey->isValid())
- return;
-
- indexKeys->append(indexKey);
- } else {
- ASSERT(indexMetadata.multiEntry);
- ASSERT(indexKey->type() == IDBKey::ArrayType);
- indexKey = IDBKey::createMultiEntryArray(indexKey->array());
-
- for (size_t i = 0; i < indexKey->array().size(); ++i)
- indexKeys->append(indexKey->array()[i]);
- }
-}
-
</del><span class="cx"> PassRefPtr<IDBRequest> IDBObjectStore::add(JSC::ExecState* state, Deprecated::ScriptValue& value, const Deprecated::ScriptValue& key, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> LOG(StorageAPI, "IDBObjectStore::add");
</span><span class="lines">@@ -195,7 +173,7 @@
</span><span class="cx"> return 0;
</span><span class="cx"> }
</span><span class="cx"> if (usesInLineKeys) {
</span><del>- RefPtr<IDBKey> keyPathKey = createIDBKeyFromScriptValueAndKeyPath(&requestState, value, keyPath);
</del><ins>+ RefPtr<IDBKey> keyPathKey = createIDBKeyFromScriptValueAndKeyPath(requestState.exec(), value, keyPath);
</ins><span class="cx"> if (keyPathKey && !keyPathKey->isValid()) {
</span><span class="cx"> ec = IDBDatabaseException::DataError;
</span><span class="cx"> return 0;
</span><span class="lines">@@ -221,9 +199,17 @@
</span><span class="cx"> Vector<int64_t> indexIds;
</span><span class="cx"> Vector<IndexKeys> indexKeys;
</span><span class="cx"> for (IDBObjectStoreMetadata::IndexMap::const_iterator it = m_metadata.indexes.begin(); it != m_metadata.indexes.end(); ++it) {
</span><del>- IndexKeys keys;
- generateIndexKeysForValue(&requestState, it->value, value, &keys);
</del><ins>+ Vector<IDBKeyData> keyDatas;
+ generateIndexKeysForValue(requestState.exec(), it->value, value, keyDatas);
</ins><span class="cx"> indexIds.append(it->key);
</span><ins>+
+ // FIXME: Much of the Indexed DB code needs to use IDBKeyData directly to avoid wasteful conversions like this.
+ Vector<RefPtr<IDBKey>> keys;
+ for (auto& i : keyDatas) {
+ RefPtr<IDBKey> key = i.maybeCreateIDBKey();
+ if (key)
+ keys.append(key.release());
+ }
</ins><span class="cx"> indexKeys.append(keys);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -338,9 +324,15 @@
</span><span class="cx"> RefPtr<IDBKey> primaryKey = cursor->idbPrimaryKey();
</span><span class="cx"> Deprecated::ScriptValue value = cursor->value();
</span><span class="cx">
</span><del>- IDBObjectStore::IndexKeys indexKeys;
- generateIndexKeysForValue(request->requestState(), m_indexMetadata, value, &indexKeys);
</del><ins>+ Vector<IDBKeyData> indexKeyDatas;
+ generateIndexKeysForValue(request->requestState()->exec(), m_indexMetadata, value, indexKeyDatas);
</ins><span class="cx">
</span><ins>+ Vector<RefPtr<IDBKey>> indexKeys;
+ for (auto& i : indexKeyDatas) {
+ RefPtr<IDBKey> key = i.maybeCreateIDBKey();
+ if (key)
+ indexKeys.append(key.release());
+ }
</ins><span class="cx"> Vector<IDBObjectStore::IndexKeys, 1> indexKeysList;
</span><span class="cx"> indexKeysList.append(indexKeys);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBRequestcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBRequest.cpp (163626 => 163627)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBRequest.cpp        2014-02-07 18:20:01 UTC (rev 163626)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBRequest.cpp        2014-02-07 18:26:48 UTC (rev 163627)
</span><span class="lines">@@ -364,7 +364,7 @@
</span><span class="cx">
</span><span class="cx"> RefPtr<IDBKey> primaryKey = prpPrimaryKey;
</span><span class="cx"> #ifndef NDEBUG
</span><del>- RefPtr<IDBKey> expectedKey = createIDBKeyFromScriptValueAndKeyPath(requestState(), value, keyPath);
</del><ins>+ RefPtr<IDBKey> expectedKey = createIDBKeyFromScriptValueAndKeyPath(requestState()->exec(), value, keyPath);
</ins><span class="cx"> ASSERT(!expectedKey || expectedKey->isEqual(primaryKey.get()));
</span><span class="cx"> #endif
</span><span class="cx"> bool injected = injectIDBKeyIntoScriptValue(requestState(), primaryKey, value, keyPath);
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.exp.in (163626 => 163627)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.exp.in        2014-02-07 18:20:01 UTC (rev 163626)
+++ trunk/Source/WebCore/WebCore.exp.in        2014-02-07 18:26:48 UTC (rev 163627)
</span><span class="lines">@@ -84,6 +84,7 @@
</span><span class="cx"> __ZN7WebCore10RenderView7hitTestERKNS_14HitTestRequestERNS_13HitTestResultE
</span><span class="cx"> __ZN7WebCore15SQLiteStatement14getColumnInt64Ei
</span><span class="cx"> __ZN7WebCore15SQLiteStatement21getColumnBlobAsVectorEiRN3WTF6VectorIcLm0ENS1_15CrashOnOverflowEEE
</span><ins>+__ZN7WebCore15SQLiteStatement21getColumnBlobAsVectorEiRN3WTF6VectorIhLm0ENS1_15CrashOnOverflowEEE
</ins><span class="cx"> __ZN7WebCore10ScrollView16setParentVisibleEb
</span><span class="cx"> __ZN7WebCore10ScrollView17setUseFixedLayoutEb
</span><span class="cx"> __ZN7WebCore10ScrollView18setFixedLayoutSizeERKNS_7IntSizeE
</span><span class="lines">@@ -3155,5 +3156,7 @@
</span><span class="cx"> __ZN7WebCore21CrossThreadCopierBaseILb0ELb0ENS_9IndexedDB10CursorTypeEE4copyERKS2_
</span><span class="cx"> __ZN7WebCore21CrossThreadCopierBaseILb0ELb0ENS_9IndexedDB15CursorDirectionEE4copyERKS2_
</span><span class="cx"> __ZN7WebCore21CrossThreadCopierBaseILb0ELb0ENS_9IndexedDB15TransactionModeEE4copyERKS2_
</span><ins>+__ZN7WebCore25deserializeIDBValueBufferEPN3JSC9ExecStateERKN3WTF6VectorIhLm0ENS3_15CrashOnOverflowEEEb
+__ZN7WebCore25generateIndexKeysForValueEPN3JSC9ExecStateERKNS_16IDBIndexMetadataERKN10Deprecated11ScriptValueERN3WTF6VectorINS_10IDBKeyDataELm0ENSA_15CrashOnOverflowEEE
</ins><span class="cx"> __ZN7WebCore6IDBKeyD1Ev
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (163626 => 163627)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-02-07 18:20:01 UTC (rev 163626)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-02-07 18:26:48 UTC (rev 163627)
</span><span class="lines">@@ -1449,10 +1449,10 @@
</span><span class="cx">                 439046E612DA25E800AF80A2 /* RenderMathMLSquareRoot.h in Headers */ = {isa = PBXBuildFile; fileRef = 439046D212DA25E800AF80A2 /* RenderMathMLSquareRoot.h */; };
</span><span class="cx">                 439046E712DA25E800AF80A2 /* RenderMathMLScripts.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 439046D312DA25E800AF80A2 /* RenderMathMLScripts.cpp */; };
</span><span class="cx">                 439046E812DA25E800AF80A2 /* RenderMathMLScripts.h in Headers */ = {isa = PBXBuildFile; fileRef = 439046D412DA25E800AF80A2 /* RenderMathMLScripts.h */; };
</span><ins>+                439046E912DA25E800AF80A2 /* RenderMathMLUnderOver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 439046D512DA25E800AF80A2 /* RenderMathMLUnderOver.cpp */; };
+                439046EA12DA25E800AF80A2 /* RenderMathMLUnderOver.h in Headers */ = {isa = PBXBuildFile; fileRef = 439046D612DA25E800AF80A2 /* RenderMathMLUnderOver.h */; };
</ins><span class="cx">                 439046EB12DA25E800AF80A9 /* RenderMathMLToken.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 439046D712DA25E800AF80A9 /* RenderMathMLToken.cpp */; };
</span><span class="cx">                 439046EC12DA25E800AF80A9 /* RenderMathMLToken.h in Headers */ = {isa = PBXBuildFile; fileRef = 439046D812DA25E800AF80A9 /* RenderMathMLToken.h */; };
</span><del>-                439046E912DA25E800AF80A2 /* RenderMathMLUnderOver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 439046D512DA25E800AF80A2 /* RenderMathMLUnderOver.cpp */; };
-                439046EA12DA25E800AF80A2 /* RenderMathMLUnderOver.h in Headers */ = {isa = PBXBuildFile; fileRef = 439046D612DA25E800AF80A2 /* RenderMathMLUnderOver.h */; };
</del><span class="cx">                 439D334313A6911C00C20F4F /* SVGAnimatedType.h in Headers */ = {isa = PBXBuildFile; fileRef = 439D334013A6911C00C20F4F /* SVGAnimatedType.h */; };
</span><span class="cx">                 439D334413A6911C00C20F4F /* SVGAnimatedTypeAnimator.h in Headers */ = {isa = PBXBuildFile; fileRef = 439D334113A6911C00C20F4F /* SVGAnimatedTypeAnimator.h */; };
</span><span class="cx">                 439D334513A6911C00C20F4F /* SVGAnimatorFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 439D334213A6911C00C20F4F /* SVGAnimatorFactory.h */; };
</span><span class="lines">@@ -5389,7 +5389,7 @@
</span><span class="cx">                 C58361A91744523F00173511 /* FontServicesIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = C58361A71744523F00173511 /* FontServicesIOS.h */; };
</span><span class="cx">                 C58361AA1744523F00173511 /* FontServicesIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = C58361A81744523F00173511 /* FontServicesIOS.mm */; };
</span><span class="cx">                 C585A66211D4FAC5004C3E4B /* IDBBindingUtilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C585A66011D4FAC5004C3E4B /* IDBBindingUtilities.cpp */; };
</span><del>-                C585A66311D4FAC5004C3E4B /* IDBBindingUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = C585A66111D4FAC5004C3E4B /* IDBBindingUtilities.h */; };
</del><ins>+                C585A66311D4FAC5004C3E4B /* IDBBindingUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = C585A66111D4FAC5004C3E4B /* IDBBindingUtilities.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 C585A67D11D4FB08004C3E4B /* JSIDBAny.h in Headers */ = {isa = PBXBuildFile; fileRef = C585A66511D4FB07004C3E4B /* JSIDBAny.h */; };
</span><span class="cx">                 C585A68311D4FB08004C3E4B /* JSIDBDatabase.h in Headers */ = {isa = PBXBuildFile; fileRef = C585A66B11D4FB07004C3E4B /* JSIDBDatabase.h */; };
</span><span class="cx">                 C585A68D11D4FB08004C3E4B /* JSIDBKeyRange.h in Headers */ = {isa = PBXBuildFile; fileRef = C585A67511D4FB07004C3E4B /* JSIDBKeyRange.h */; };
</span><span class="lines">@@ -8302,10 +8302,10 @@
</span><span class="cx">                 439046D212DA25E800AF80A2 /* RenderMathMLSquareRoot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RenderMathMLSquareRoot.h; path = mathml/RenderMathMLSquareRoot.h; sourceTree = "<group>"; };
</span><span class="cx">                 439046D312DA25E800AF80A2 /* RenderMathMLScripts.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RenderMathMLScripts.cpp; path = mathml/RenderMathMLScripts.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 439046D412DA25E800AF80A2 /* RenderMathMLScripts.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RenderMathMLScripts.h; path = mathml/RenderMathMLScripts.h; sourceTree = "<group>"; };
</span><ins>+                439046D512DA25E800AF80A2 /* RenderMathMLUnderOver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RenderMathMLUnderOver.cpp; path = mathml/RenderMathMLUnderOver.cpp; sourceTree = "<group>"; };
+                439046D612DA25E800AF80A2 /* RenderMathMLUnderOver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RenderMathMLUnderOver.h; path = mathml/RenderMathMLUnderOver.h; sourceTree = "<group>"; };
</ins><span class="cx">                 439046D712DA25E800AF80A9 /* RenderMathMLToken.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RenderMathMLToken.cpp; path = mathml/RenderMathMLToken.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 439046D812DA25E800AF80A9 /* RenderMathMLToken.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RenderMathMLToken.h; path = mathml/RenderMathMLToken.h; sourceTree = "<group>"; };
</span><del>-                439046D512DA25E800AF80A2 /* RenderMathMLUnderOver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RenderMathMLUnderOver.cpp; path = mathml/RenderMathMLUnderOver.cpp; sourceTree = "<group>"; };
-                439046D612DA25E800AF80A2 /* RenderMathMLUnderOver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RenderMathMLUnderOver.h; path = mathml/RenderMathMLUnderOver.h; sourceTree = "<group>"; };
</del><span class="cx">                 439D334013A6911C00C20F4F /* SVGAnimatedType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedType.h; sourceTree = "<group>"; };
</span><span class="cx">                 439D334113A6911C00C20F4F /* SVGAnimatedTypeAnimator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedTypeAnimator.h; sourceTree = "<group>"; };
</span><span class="cx">                 439D334213A6911C00C20F4F /* SVGAnimatorFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatorFactory.h; sourceTree = "<group>"; };
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsIDBBindingUtilitiescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/IDBBindingUtilities.cpp (163626 => 163627)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/IDBBindingUtilities.cpp        2014-02-07 18:20:01 UTC (rev 163626)
+++ trunk/Source/WebCore/bindings/js/IDBBindingUtilities.cpp        2014-02-07 18:26:48 UTC (rev 163627)
</span><span class="lines">@@ -30,7 +30,9 @@
</span><span class="cx"> #include "IDBBindingUtilities.h"
</span><span class="cx">
</span><span class="cx"> #include "DOMRequestState.h"
</span><ins>+#include "IDBIndexMetadata.h"
</ins><span class="cx"> #include "IDBKey.h"
</span><ins>+#include "IDBKeyData.h"
</ins><span class="cx"> #include "IDBKeyPath.h"
</span><span class="cx"> #include "Logging.h"
</span><span class="cx"> #include "SharedBuffer.h"
</span><span class="lines">@@ -178,7 +180,7 @@
</span><span class="cx"> return currentValue;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static PassRefPtr<IDBKey> createIDBKeyFromScriptValueAndKeyPath(ExecState* exec, const Deprecated::ScriptValue& value, const String& keyPath)
</del><ins>+static PassRefPtr<IDBKey> internalCreateIDBKeyFromScriptValueAndKeyPath(ExecState* exec, const Deprecated::ScriptValue& value, const String& keyPath)
</ins><span class="cx"> {
</span><span class="cx"> Vector<String> keyPathElements;
</span><span class="cx"> IDBKeyPathParseError error;
</span><span class="lines">@@ -254,18 +256,16 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-PassRefPtr<IDBKey> createIDBKeyFromScriptValueAndKeyPath(DOMRequestState* requestState, const Deprecated::ScriptValue& value, const IDBKeyPath& keyPath)
</del><ins>+PassRefPtr<IDBKey> createIDBKeyFromScriptValueAndKeyPath(ExecState* exec, const Deprecated::ScriptValue& value, const IDBKeyPath& keyPath)
</ins><span class="cx"> {
</span><span class="cx"> LOG(StorageAPI, "createIDBKeyFromScriptValueAndKeyPath");
</span><span class="cx"> ASSERT(!keyPath.isNull());
</span><span class="cx">
</span><del>- ExecState* exec = requestState->exec();
-
</del><span class="cx"> if (keyPath.type() == IDBKeyPath::ArrayType) {
</span><span class="cx"> IDBKey::KeyArray result;
</span><span class="cx"> const Vector<String>& array = keyPath.array();
</span><span class="cx"> for (size_t i = 0; i < array.size(); i++) {
</span><del>- RefPtr<IDBKey> key = createIDBKeyFromScriptValueAndKeyPath(exec, value, array[i]);
</del><ins>+ RefPtr<IDBKey> key = internalCreateIDBKeyFromScriptValueAndKeyPath(exec, value, array[i]);
</ins><span class="cx"> if (!key)
</span><span class="cx"> return 0;
</span><span class="cx"> result.append(key);
</span><span class="lines">@@ -274,7 +274,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> ASSERT(keyPath.type() == IDBKeyPath::StringType);
</span><del>- return createIDBKeyFromScriptValueAndKeyPath(exec, value, keyPath.string());
</del><ins>+ return internalCreateIDBKeyFromScriptValueAndKeyPath(exec, value, keyPath.string());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool canInjectIDBKeyIntoScriptValue(DOMRequestState* requestState, const Deprecated::ScriptValue& scriptValue, const IDBKeyPath& keyPath)
</span><span class="lines">@@ -305,21 +305,26 @@
</span><span class="cx">
</span><span class="cx"> Deprecated::ScriptValue deserializeIDBValueBuffer(DOMRequestState* requestState, PassRefPtr<SharedBuffer> prpBuffer, bool keyIsDefined)
</span><span class="cx"> {
</span><del>- ExecState* exec = requestState->exec();
- RefPtr<SharedBuffer> buffer = prpBuffer;
</del><ins>+ if (prpBuffer) {
+ Vector<uint8_t> value;
+ value.append(prpBuffer->data(), prpBuffer->size());
+ return deserializeIDBValueBuffer(requestState->exec(), value, keyIsDefined);
+ }
</ins><span class="cx">
</span><ins>+ return Deprecated::ScriptValue(requestState->exec()->vm(), jsNull());
+}
+
+Deprecated::ScriptValue deserializeIDBValueBuffer(JSC::ExecState* exec, const Vector<uint8_t>& buffer, bool keyIsDefined)
+{
</ins><span class="cx"> // If the key doesn't exist, then the value must be undefined (as opposed to null).
</span><span class="cx"> if (!keyIsDefined) {
</span><span class="cx"> // We either shouldn't have a buffer or it should be of size 0.
</span><del>- ASSERT(!buffer || !buffer->size());
</del><ins>+ ASSERT(!buffer.size());
</ins><span class="cx"> return Deprecated::ScriptValue(exec->vm(), jsUndefined());
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (buffer) {
- // FIXME: The extra copy here can be eliminated by allowing SerializedScriptValue to take a raw const char* or const uint8_t*.
- Vector<uint8_t> value;
- value.append(buffer->data(), buffer->size());
- RefPtr<SerializedScriptValue> serializedValue = SerializedScriptValue::createFromWireBytes(value);
</del><ins>+ if (buffer.size()) {
+ RefPtr<SerializedScriptValue> serializedValue = SerializedScriptValue::createFromWireBytes(buffer);
</ins><span class="cx"> return SerializedScriptValue::deserialize(exec, serializedValue.get(), NonThrowing);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -338,6 +343,31 @@
</span><span class="cx"> return createIDBKeyFromValue(exec, scriptValue.jsValue());
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void generateIndexKeysForValue(ExecState* exec, const IDBIndexMetadata& indexMetadata, const Deprecated::ScriptValue& objectValue, Vector<IDBKeyData>& indexKeys)
+{
+ RefPtr<IDBKey> indexKey = createIDBKeyFromScriptValueAndKeyPath(exec, objectValue, indexMetadata.keyPath);
+
+ if (!indexKey)
+ return;
+
+ if (!indexMetadata.multiEntry || indexKey->type() != IDBKey::ArrayType) {
+ if (!indexKey->isValid())
+ return;
+
+ indexKeys.append(IDBKeyData(indexKey.get()));
+ } else {
+ ASSERT(indexMetadata.multiEntry);
+ ASSERT(indexKey->type() == IDBKey::ArrayType);
+ indexKey = IDBKey::createMultiEntryArray(indexKey->array());
+
+ if (!indexKey->isValid())
+ return;
+
+ for (auto& i : indexKey->array())
+ indexKeys.append(IDBKeyData(i.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="trunkSourceWebCorebindingsjsIDBBindingUtilitiesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/IDBBindingUtilities.h (163626 => 163627)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/IDBBindingUtilities.h        2014-02-07 18:20:01 UTC (rev 163626)
+++ trunk/Source/WebCore/bindings/js/IDBBindingUtilities.h        2014-02-07 18:26:48 UTC (rev 163627)
</span><span class="lines">@@ -39,15 +39,20 @@
</span><span class="cx"> class IDBKeyPath;
</span><span class="cx"> class SharedBuffer;
</span><span class="cx">
</span><ins>+struct IDBIndexMetadata;
+struct IDBKeyData;
+
</ins><span class="cx"> IDBKeyPath idbKeyPathFromValue(JSC::ExecState*, JSC::JSValue);
</span><span class="cx">
</span><span class="cx"> bool injectIDBKeyIntoScriptValue(DOMRequestState*, PassRefPtr<IDBKey>, Deprecated::ScriptValue&, const IDBKeyPath&);
</span><del>-PassRefPtr<IDBKey> createIDBKeyFromScriptValueAndKeyPath(DOMRequestState*, const Deprecated::ScriptValue&, const IDBKeyPath&);
</del><ins>+PassRefPtr<IDBKey> createIDBKeyFromScriptValueAndKeyPath(JSC::ExecState*, const Deprecated::ScriptValue&, const IDBKeyPath&);
</ins><span class="cx"> bool canInjectIDBKeyIntoScriptValue(DOMRequestState*, const Deprecated::ScriptValue&, const IDBKeyPath&);
</span><span class="cx"> Deprecated::ScriptValue deserializeIDBValue(DOMRequestState*, PassRefPtr<SerializedScriptValue>);
</span><span class="cx"> Deprecated::ScriptValue deserializeIDBValueBuffer(DOMRequestState*, PassRefPtr<SharedBuffer>, bool keyIsDefined);
</span><ins>+Deprecated::ScriptValue deserializeIDBValueBuffer(JSC::ExecState*, const Vector<uint8_t>&, bool keyIsDefined);
</ins><span class="cx"> Deprecated::ScriptValue idbKeyToScriptValue(DOMRequestState*, PassRefPtr<IDBKey>);
</span><span class="cx"> PassRefPtr<IDBKey> scriptValueToIDBKey(DOMRequestState*, const Deprecated::ScriptValue&);
</span><ins>+void generateIndexKeysForValue(JSC::ExecState*, const IDBIndexMetadata&, const Deprecated::ScriptValue& objectValue, Vector<IDBKeyData>& indexKeys);
</ins><span class="cx">
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformsqlSQLiteStatementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/sql/SQLiteStatement.cpp (163626 => 163627)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/sql/SQLiteStatement.cpp        2014-02-07 18:20:01 UTC (rev 163626)
+++ trunk/Source/WebCore/platform/sql/SQLiteStatement.cpp        2014-02-07 18:26:48 UTC (rev 163627)
</span><span class="lines">@@ -428,6 +428,32 @@
</span><span class="cx"> result[i] = (static_cast<const unsigned char*>(blob))[i];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void SQLiteStatement::getColumnBlobAsVector(int col, Vector<uint8_t>& result)
+{
+ ASSERT(col >= 0);
+
+ if (!m_statement && prepareAndStep() != SQLITE_ROW) {
+ result.clear();
+ return;
+ }
+
+ if (columnCount() <= col) {
+ result.clear();
+ return;
+ }
+
+ const void* blob = sqlite3_column_blob(m_statement, col);
+ if (!blob) {
+ result.clear();
+ return;
+ }
+
+ int size = sqlite3_column_bytes(m_statement, col);
+ result.resize((size_t)size);
+ for (int i = 0; i < size; ++i)
+ result[i] = (static_cast<const uint8_t*>(blob))[i];
+}
+
</ins><span class="cx"> bool SQLiteStatement::returnTextResults(int col, Vector<String>& v)
</span><span class="cx"> {
</span><span class="cx"> ASSERT(col >= 0);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformsqlSQLiteStatementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/sql/SQLiteStatement.h (163626 => 163627)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/sql/SQLiteStatement.h        2014-02-07 18:20:01 UTC (rev 163626)
+++ trunk/Source/WebCore/platform/sql/SQLiteStatement.h        2014-02-07 18:26:48 UTC (rev 163627)
</span><span class="lines">@@ -83,6 +83,7 @@
</span><span class="cx"> int64_t getColumnInt64(int col);
</span><span class="cx"> String getColumnBlobAsString(int col);
</span><span class="cx"> void getColumnBlobAsVector(int col, Vector<char>&);
</span><ins>+ void getColumnBlobAsVector(int col, Vector<uint8_t>&);
</ins><span class="cx">
</span><span class="cx"> bool returnTextResults(int col, Vector<String>&);
</span><span class="cx"> bool returnIntResults(int col, Vector<int>&);
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (163626 => 163627)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-02-07 18:20:01 UTC (rev 163626)
+++ trunk/Source/WebKit2/ChangeLog        2014-02-07 18:26:48 UTC (rev 163627)
</span><span class="lines">@@ -1,3 +1,38 @@
</span><ins>+2014-02-06 Brady Eidson <beidson@apple.com>
+
+ IDB: storage/indexeddb/create-index-with-integer-keys.html fails
+ <rdar://problem/16002857> and https://bugs.webkit.org/show_bug.cgi?id=128316
+
+ Reviewed by Geoff Garen.
+
+ Update Vector<char> to Vector<uint8_t> throughout:
+ * DatabaseProcess/IndexedDB/UniqueIDBDatabase.cpp:
+ (WebKit::UniqueIDBDatabase::openCursorInBackingStore):
+ (WebKit::UniqueIDBDatabase::didOpenCursorInBackingStore):
+ (WebKit::UniqueIDBDatabase::advanceCursorInBackingStore):
+ (WebKit::UniqueIDBDatabase::didAdvanceCursorInBackingStore):
+ (WebKit::UniqueIDBDatabase::iterateCursorInBackingStore):
+ (WebKit::UniqueIDBDatabase::didIterateCursorInBackingStore):
+ * DatabaseProcess/IndexedDB/UniqueIDBDatabase.h:
+
+ Update Vector<char> to Vector<uint8_t> throughout:
+ * DatabaseProcess/IndexedDB/sqlite/SQLiteIDBCursor.cpp:
+ (WebKit::SQLiteIDBCursor::advanceOnce):
+ * DatabaseProcess/IndexedDB/sqlite/SQLiteIDBCursor.h:
+ (WebKit::SQLiteIDBCursor::currentValueBuffer):
+
+ * DatabaseProcess/IndexedDB/UniqueIDBDatabaseBackingStore.h:
+ * DatabaseProcess/IndexedDB/sqlite/UniqueIDBDatabaseBackingStoreSQLite.cpp:
+ (WebKit::UniqueIDBDatabaseBackingStoreSQLite::createIndex): Create a script value from the value data, use
+ generateIndexKeysForValue to get the index keys, and then write the resulting index records.
+ (WebKit::UniqueIDBDatabaseBackingStoreSQLite::putIndexRecord): Call through to uncheckedPutIndexRecord.
+ (WebKit::UniqueIDBDatabaseBackingStoreSQLite::uncheckedPutIndexRecord): Version of putIndexRecord that doesn’t
+ validate the transaction or its mode.
+ (WebKit::UniqueIDBDatabaseBackingStoreSQLite::openCursor): Update Vector<char> to Vector<uint8_t>.
+ (WebKit::UniqueIDBDatabaseBackingStoreSQLite::advanceCursor): Ditto.
+ (WebKit::UniqueIDBDatabaseBackingStoreSQLite::iterateCursor): Ditto.
+ * DatabaseProcess/IndexedDB/sqlite/UniqueIDBDatabaseBackingStoreSQLite.h:
+
</ins><span class="cx"> 2014-02-07 Jinwoo Song <jinwoo7.song@samsung.com>
</span><span class="cx">
</span><span class="cx"> [EFL][WK2] WebView should be able to configure to set fixed layout
</span></span></pre></div>
<a id="trunkSourceWebKit2DatabaseProcessIndexedDBUniqueIDBDatabasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/DatabaseProcess/IndexedDB/UniqueIDBDatabase.cpp (163626 => 163627)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/DatabaseProcess/IndexedDB/UniqueIDBDatabase.cpp        2014-02-07 18:20:01 UTC (rev 163626)
+++ trunk/Source/WebKit2/DatabaseProcess/IndexedDB/UniqueIDBDatabase.cpp        2014-02-07 18:26:48 UTC (rev 163627)
</span><span class="lines">@@ -951,7 +951,7 @@
</span><span class="cx"> int64_t cursorID = 0;
</span><span class="cx"> IDBKeyData key;
</span><span class="cx"> IDBKeyData primaryKey;
</span><del>- Vector<char> valueBuffer;
</del><ins>+ Vector<uint8_t> valueBuffer;
</ins><span class="cx"> int32_t errorCode = 0;
</span><span class="cx"> String errorMessage;
</span><span class="cx"> bool success = m_backingStore->openCursor(transactionIdentifier, objectStoreID, indexID, cursorDirection, cursorType, taskType, keyRange, cursorID, key, primaryKey, valueBuffer);
</span><span class="lines">@@ -964,7 +964,7 @@
</span><span class="cx"> postMainThreadTask(createAsyncTask(*this, &UniqueIDBDatabase::didOpenCursorInBackingStore, requestID, cursorID, key, primaryKey, valueBuffer, errorCode, errorMessage));
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void UniqueIDBDatabase::didOpenCursorInBackingStore(uint64_t requestID, int64_t cursorID, const IDBKeyData& key, const IDBKeyData& primaryKey, const Vector<char>& valueBuffer, uint32_t errorCode, const String& errorMessage)
</del><ins>+void UniqueIDBDatabase::didOpenCursorInBackingStore(uint64_t requestID, int64_t cursorID, const IDBKeyData& key, const IDBKeyData& primaryKey, const Vector<uint8_t>& valueBuffer, uint32_t errorCode, const String& errorMessage)
</ins><span class="cx"> {
</span><span class="cx"> RefPtr<AsyncRequest> request = m_pendingDatabaseTasks.take(requestID);
</span><span class="cx"> ASSERT(request);
</span><span class="lines">@@ -976,7 +976,7 @@
</span><span class="cx"> {
</span><span class="cx"> IDBKeyData key;
</span><span class="cx"> IDBKeyData primaryKey;
</span><del>- Vector<char> valueBuffer;
</del><ins>+ Vector<uint8_t> valueBuffer;
</ins><span class="cx"> int32_t errorCode = 0;
</span><span class="cx"> String errorMessage;
</span><span class="cx"> bool success = m_backingStore->advanceCursor(cursorIdentifier, count, key, primaryKey, valueBuffer);
</span><span class="lines">@@ -989,7 +989,7 @@
</span><span class="cx"> postMainThreadTask(createAsyncTask(*this, &UniqueIDBDatabase::didAdvanceCursorInBackingStore, requestID, key, primaryKey, valueBuffer, errorCode, errorMessage));
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void UniqueIDBDatabase::didAdvanceCursorInBackingStore(uint64_t requestID, const IDBKeyData& key, const IDBKeyData& primaryKey, const Vector<char>& valueBuffer, uint32_t errorCode, const String& errorMessage)
</del><ins>+void UniqueIDBDatabase::didAdvanceCursorInBackingStore(uint64_t requestID, const IDBKeyData& key, const IDBKeyData& primaryKey, const Vector<uint8_t>& valueBuffer, uint32_t errorCode, const String& errorMessage)
</ins><span class="cx"> {
</span><span class="cx"> RefPtr<AsyncRequest> request = m_pendingDatabaseTasks.take(requestID);
</span><span class="cx"> ASSERT(request);
</span><span class="lines">@@ -1001,7 +1001,7 @@
</span><span class="cx"> {
</span><span class="cx"> IDBKeyData key;
</span><span class="cx"> IDBKeyData primaryKey;
</span><del>- Vector<char> valueBuffer;
</del><ins>+ Vector<uint8_t> valueBuffer;
</ins><span class="cx"> int32_t errorCode = 0;
</span><span class="cx"> String errorMessage;
</span><span class="cx"> bool success = m_backingStore->iterateCursor(cursorIdentifier, iterateKey, key, primaryKey, valueBuffer);
</span><span class="lines">@@ -1014,7 +1014,7 @@
</span><span class="cx"> postMainThreadTask(createAsyncTask(*this, &UniqueIDBDatabase::didIterateCursorInBackingStore, requestID, key, primaryKey, valueBuffer, errorCode, errorMessage));
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void UniqueIDBDatabase::didIterateCursorInBackingStore(uint64_t requestID, const IDBKeyData& key, const IDBKeyData& primaryKey, const Vector<char>& valueBuffer, uint32_t errorCode, const String& errorMessage)
</del><ins>+void UniqueIDBDatabase::didIterateCursorInBackingStore(uint64_t requestID, const IDBKeyData& key, const IDBKeyData& primaryKey, const Vector<uint8_t>& valueBuffer, uint32_t errorCode, const String& errorMessage)
</ins><span class="cx"> {
</span><span class="cx"> RefPtr<AsyncRequest> request = m_pendingDatabaseTasks.take(requestID);
</span><span class="cx"> ASSERT(request);
</span></span></pre></div>
<a id="trunkSourceWebKit2DatabaseProcessIndexedDBUniqueIDBDatabaseh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/DatabaseProcess/IndexedDB/UniqueIDBDatabase.h (163626 => 163627)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/DatabaseProcess/IndexedDB/UniqueIDBDatabase.h        2014-02-07 18:20:01 UTC (rev 163626)
+++ trunk/Source/WebKit2/DatabaseProcess/IndexedDB/UniqueIDBDatabase.h        2014-02-07 18:26:48 UTC (rev 163627)
</span><span class="lines">@@ -175,9 +175,9 @@
</span><span class="cx"> void didDeleteIndex(uint64_t requestID, bool success);
</span><span class="cx"> void didPutRecordInBackingStore(uint64_t requestID, const WebCore::IDBKeyData&, uint32_t errorCode, const String& errorMessage);
</span><span class="cx"> void didGetRecordFromBackingStore(uint64_t requestID, const WebCore::IDBGetResult&, uint32_t errorCode, const String& errorMessage);
</span><del>- void didOpenCursorInBackingStore(uint64_t requestID, int64_t cursorID, const WebCore::IDBKeyData&, const WebCore::IDBKeyData&, const Vector<char>&, uint32_t errorCode, const String& errorMessage);
- void didAdvanceCursorInBackingStore(uint64_t requestID, const WebCore::IDBKeyData&, const WebCore::IDBKeyData&, const Vector<char>&, uint32_t errorCode, const String& errorMessage);
- void didIterateCursorInBackingStore(uint64_t requestID, const WebCore::IDBKeyData&, const WebCore::IDBKeyData&, const Vector<char>&, uint32_t errorCode, const String& errorMessage);
</del><ins>+ void didOpenCursorInBackingStore(uint64_t requestID, int64_t cursorID, const WebCore::IDBKeyData&, const WebCore::IDBKeyData&, const Vector<uint8_t>&, uint32_t errorCode, const String& errorMessage);
+ void didAdvanceCursorInBackingStore(uint64_t requestID, const WebCore::IDBKeyData&, const WebCore::IDBKeyData&, const Vector<uint8_t>&, uint32_t errorCode, const String& errorMessage);
+ void didIterateCursorInBackingStore(uint64_t requestID, const WebCore::IDBKeyData&, const WebCore::IDBKeyData&, const Vector<uint8_t>&, uint32_t errorCode, const String& errorMessage);
</ins><span class="cx"> void didCountInBackingStore(uint64_t requestID, int64_t count, uint32_t errorCode, const String& errorMessage);
</span><span class="cx"> void didDeleteRangeInBackingStore(uint64_t requestID, uint32_t errorCode, const String& errorMessage);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2DatabaseProcessIndexedDBUniqueIDBDatabaseBackingStoreh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/DatabaseProcess/IndexedDB/UniqueIDBDatabaseBackingStore.h (163626 => 163627)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/DatabaseProcess/IndexedDB/UniqueIDBDatabaseBackingStore.h        2014-02-07 18:20:01 UTC (rev 163626)
+++ trunk/Source/WebKit2/DatabaseProcess/IndexedDB/UniqueIDBDatabaseBackingStore.h        2014-02-07 18:26:48 UTC (rev 163627)
</span><span class="lines">@@ -79,9 +79,9 @@
</span><span class="cx"> virtual bool getKeyRangeRecordFromObjectStore(const IDBIdentifier& transactionIdentifier, int64_t objectStoreID, const WebCore::IDBKeyRange&, RefPtr<WebCore::SharedBuffer>& result, RefPtr<WebCore::IDBKey>& resultKey) = 0;
</span><span class="cx"> virtual bool count(const IDBIdentifier& transactionIdentifier, int64_t objectStoreID, int64_t indexID, const WebCore::IDBKeyRangeData&, int64_t& count) = 0;
</span><span class="cx">
</span><del>- virtual bool openCursor(const IDBIdentifier& transactionIdentifier, int64_t objectStoreID, int64_t indexID, WebCore::IndexedDB::CursorDirection, WebCore::IndexedDB::CursorType, WebCore::IDBDatabaseBackend::TaskType, const WebCore::IDBKeyRangeData&, int64_t& cursorID, WebCore::IDBKeyData&, WebCore::IDBKeyData&, Vector<char>&) = 0;
- virtual bool advanceCursor(const IDBIdentifier& cursorIdentifier, uint64_t count, WebCore::IDBKeyData&, WebCore::IDBKeyData&, Vector<char>&) = 0;
- virtual bool iterateCursor(const IDBIdentifier& cursorIdentifier, const WebCore::IDBKeyData&, WebCore::IDBKeyData&, WebCore::IDBKeyData&, Vector<char>&) = 0;
</del><ins>+ virtual bool openCursor(const IDBIdentifier& transactionIdentifier, int64_t objectStoreID, int64_t indexID, WebCore::IndexedDB::CursorDirection, WebCore::IndexedDB::CursorType, WebCore::IDBDatabaseBackend::TaskType, const WebCore::IDBKeyRangeData&, int64_t& cursorID, WebCore::IDBKeyData&, WebCore::IDBKeyData&, Vector<uint8_t>&) = 0;
+ virtual bool advanceCursor(const IDBIdentifier& cursorIdentifier, uint64_t count, WebCore::IDBKeyData&, WebCore::IDBKeyData&, Vector<uint8_t>&) = 0;
+ virtual bool iterateCursor(const IDBIdentifier& cursorIdentifier, const WebCore::IDBKeyData&, WebCore::IDBKeyData&, WebCore::IDBKeyData&, Vector<uint8_t>&) = 0;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2DatabaseProcessIndexedDBsqliteSQLiteIDBCursorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/DatabaseProcess/IndexedDB/sqlite/SQLiteIDBCursor.cpp (163626 => 163627)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/DatabaseProcess/IndexedDB/sqlite/SQLiteIDBCursor.cpp        2014-02-07 18:20:01 UTC (rev 163626)
+++ trunk/Source/WebKit2/DatabaseProcess/IndexedDB/sqlite/SQLiteIDBCursor.cpp        2014-02-07 18:26:48 UTC (rev 163627)
</span><span class="lines">@@ -283,10 +283,10 @@
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- Vector<char> keyData;
</del><ins>+ Vector<uint8_t> keyData;
</ins><span class="cx"> m_statement->getColumnBlobAsVector(0, keyData);
</span><span class="cx">
</span><del>- if (!deserializeIDBKeyData(reinterpret_cast<const uint8_t*>(keyData.data()), keyData.size(), m_currentKey)) {
</del><ins>+ if (!deserializeIDBKeyData(keyData.data(), keyData.size(), m_currentKey)) {
</ins><span class="cx"> LOG_ERROR("Unable to deserialize key data from database while advancing cursor");
</span><span class="cx"> m_completed = true;
</span><span class="cx"> m_errored = true;
</span><span class="lines">@@ -297,7 +297,7 @@
</span><span class="cx"> m_currentValueBuffer = keyData;
</span><span class="cx">
</span><span class="cx"> if (m_indexID != IDBIndexMetadata::InvalidId) {
</span><del>- if (!deserializeIDBKeyData(reinterpret_cast<const uint8_t*>(keyData.data()), keyData.size(), m_currentPrimaryKey)) {
</del><ins>+ if (!deserializeIDBKeyData(keyData.data(), keyData.size(), m_currentPrimaryKey)) {
</ins><span class="cx"> LOG_ERROR("Unable to deserialize value data from database while advancing index cursor");
</span><span class="cx"> m_completed = true;
</span><span class="cx"> m_errored = true;
</span></span></pre></div>
<a id="trunkSourceWebKit2DatabaseProcessIndexedDBsqliteSQLiteIDBCursorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/DatabaseProcess/IndexedDB/sqlite/SQLiteIDBCursor.h (163626 => 163627)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/DatabaseProcess/IndexedDB/sqlite/SQLiteIDBCursor.h        2014-02-07 18:20:01 UTC (rev 163626)
+++ trunk/Source/WebKit2/DatabaseProcess/IndexedDB/sqlite/SQLiteIDBCursor.h        2014-02-07 18:26:48 UTC (rev 163627)
</span><span class="lines">@@ -58,7 +58,7 @@
</span><span class="cx">
</span><span class="cx"> const WebCore::IDBKeyData& currentKey() const { return m_currentKey; }
</span><span class="cx"> const WebCore::IDBKeyData& currentPrimaryKey() const { return m_currentPrimaryKey; }
</span><del>- const Vector<char>& currentValueBuffer() const { return m_currentValueBuffer; }
</del><ins>+ const Vector<uint8_t>& currentValueBuffer() const { return m_currentValueBuffer; }
</ins><span class="cx">
</span><span class="cx"> bool advance(uint64_t count);
</span><span class="cx"> bool iterate(const WebCore::IDBKeyData& targetKey);
</span><span class="lines">@@ -83,7 +83,7 @@
</span><span class="cx">
</span><span class="cx"> WebCore::IDBKeyData m_currentKey;
</span><span class="cx"> WebCore::IDBKeyData m_currentPrimaryKey;
</span><del>- Vector<char> m_currentValueBuffer;
</del><ins>+ Vector<uint8_t> m_currentValueBuffer;
</ins><span class="cx">
</span><span class="cx"> std::unique_ptr<WebCore::SQLiteStatement> m_statement;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2DatabaseProcessIndexedDBsqliteUniqueIDBDatabaseBackingStoreSQLitecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/DatabaseProcess/IndexedDB/sqlite/UniqueIDBDatabaseBackingStoreSQLite.cpp (163626 => 163627)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/DatabaseProcess/IndexedDB/sqlite/UniqueIDBDatabaseBackingStoreSQLite.cpp        2014-02-07 18:20:01 UTC (rev 163626)
+++ trunk/Source/WebKit2/DatabaseProcess/IndexedDB/sqlite/UniqueIDBDatabaseBackingStoreSQLite.cpp        2014-02-07 18:26:48 UTC (rev 163627)
</span><span class="lines">@@ -34,6 +34,7 @@
</span><span class="cx"> #include "SQLiteIDBCursor.h"
</span><span class="cx"> #include "SQLiteIDBTransaction.h"
</span><span class="cx"> #include <WebCore/FileSystem.h>
</span><ins>+#include <WebCore/IDBBindingUtilities.h>
</ins><span class="cx"> #include <WebCore/IDBDatabaseMetadata.h>
</span><span class="cx"> #include <WebCore/IDBGetResult.h>
</span><span class="cx"> #include <WebCore/IDBKeyData.h>
</span><span class="lines">@@ -43,6 +44,7 @@
</span><span class="cx"> #include <WebCore/SharedBuffer.h>
</span><span class="cx"> #include <wtf/MainThread.h>
</span><span class="cx">
</span><ins>+using namespace JSC;
</ins><span class="cx"> using namespace WebCore;
</span><span class="cx">
</span><span class="cx"> namespace WebKit {
</span><span class="lines">@@ -612,6 +614,50 @@
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ // Write index records for any records that already exist in this object store.
+ SQLiteIDBCursor* cursor = transaction->openCursor(objectStoreID, IDBIndexMetadata::InvalidId, IndexedDB::CursorDirection::Next, IndexedDB::CursorType::KeyAndValue, IDBDatabaseBackend::NormalTask, IDBKeyRangeData());
+
+ if (!cursor) {
+ LOG_ERROR("Cannot open cursor to populate indexes in database");
+ return false;
+ }
+
+ m_cursors.set(cursor->identifier(), cursor);
+
+ OwnPtr<JSLockHolder> lockHolder;
+ while (!cursor->currentKey().isNull) {
+ const IDBKeyData& key = cursor->currentKey();
+ const Vector<uint8_t>& valueBuffer = cursor->currentValueBuffer();
+
+ if (!m_globalObject) {
+ ASSERT(!m_vm);
+ m_vm = VM::create();
+ lockHolder = adoptPtr(new JSLockHolder(m_vm.get()));
+ m_globalObject.set(*m_vm, JSGlobalObject::create(*m_vm, JSGlobalObject::createStructure(*m_vm, jsNull())));
+ }
+
+ if (!lockHolder)
+ lockHolder = adoptPtr(new JSLockHolder(m_vm.get()));
+
+ Deprecated::ScriptValue value = deserializeIDBValueBuffer(m_globalObject->globalExec(), valueBuffer, true);
+ Vector<IDBKeyData> indexKeys;
+ generateIndexKeysForValue(m_globalObject->globalExec(), metadata, value, indexKeys);
+
+ for (auto& indexKey : indexKeys) {
+ if (!uncheckedPutIndexRecord(objectStoreID, metadata.id, key, indexKey)) {
+ LOG_ERROR("Unable to put index record for newly created index");
+ return false;
+ }
+ }
+
+ if (!cursor->advance(1)) {
+ LOG_ERROR("Error advancing cursor while indexing existing records for new index.");
+ return false;
+ }
+ }
+
+ transaction->closeCursor(*cursor);
+
</ins><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -825,6 +871,11 @@
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ return uncheckedPutIndexRecord(objectStoreID, indexID, keyValue, indexKey);
+}
+
+bool UniqueIDBDatabaseBackingStoreSQLite::uncheckedPutIndexRecord(int64_t objectStoreID, int64_t indexID, const WebCore::IDBKeyData& keyValue, const WebCore::IDBKeyData& indexKey)
+{
</ins><span class="cx"> RefPtr<SharedBuffer> indexKeyBuffer = serializeIDBKeyData(indexKey);
</span><span class="cx"> if (!indexKeyBuffer) {
</span><span class="cx"> LOG_ERROR("Unable to serialize index key to be stored in the database");
</span><span class="lines">@@ -1135,7 +1186,7 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool UniqueIDBDatabaseBackingStoreSQLite::openCursor(const IDBIdentifier& transactionIdentifier, int64_t objectStoreID, int64_t indexID, IndexedDB::CursorDirection cursorDirection, IndexedDB::CursorType cursorType, IDBDatabaseBackend::TaskType taskType, const IDBKeyRangeData& keyRange, int64_t& cursorID, IDBKeyData& key, IDBKeyData& primaryKey, Vector<char>& valueBuffer)
</del><ins>+bool UniqueIDBDatabaseBackingStoreSQLite::openCursor(const IDBIdentifier& transactionIdentifier, int64_t objectStoreID, int64_t indexID, IndexedDB::CursorDirection cursorDirection, IndexedDB::CursorType cursorType, IDBDatabaseBackend::TaskType taskType, const IDBKeyRangeData& keyRange, int64_t& cursorID, IDBKeyData& key, IDBKeyData& primaryKey, Vector<uint8_t>& valueBuffer)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(!isMainThread());
</span><span class="cx"> ASSERT(m_sqliteDB);
</span><span class="lines">@@ -1160,7 +1211,7 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool UniqueIDBDatabaseBackingStoreSQLite::advanceCursor(const IDBIdentifier& cursorIdentifier, uint64_t count, IDBKeyData& key, IDBKeyData& primaryKey, Vector<char>& valueBuffer)
</del><ins>+bool UniqueIDBDatabaseBackingStoreSQLite::advanceCursor(const IDBIdentifier& cursorIdentifier, uint64_t count, IDBKeyData& key, IDBKeyData& primaryKey, Vector<uint8_t>& valueBuffer)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(!isMainThread());
</span><span class="cx"> ASSERT(m_sqliteDB);
</span><span class="lines">@@ -1188,7 +1239,7 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool UniqueIDBDatabaseBackingStoreSQLite::iterateCursor(const IDBIdentifier& cursorIdentifier, const IDBKeyData& targetKey, IDBKeyData& key, IDBKeyData& primaryKey, Vector<char>& valueBuffer)
</del><ins>+bool UniqueIDBDatabaseBackingStoreSQLite::iterateCursor(const IDBIdentifier& cursorIdentifier, const IDBKeyData& targetKey, IDBKeyData& key, IDBKeyData& primaryKey, Vector<uint8_t>& valueBuffer)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(!isMainThread());
</span><span class="cx"> ASSERT(m_sqliteDB);
</span></span></pre></div>
<a id="trunkSourceWebKit2DatabaseProcessIndexedDBsqliteUniqueIDBDatabaseBackingStoreSQLiteh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/DatabaseProcess/IndexedDB/sqlite/UniqueIDBDatabaseBackingStoreSQLite.h (163626 => 163627)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/DatabaseProcess/IndexedDB/sqlite/UniqueIDBDatabaseBackingStoreSQLite.h        2014-02-07 18:20:01 UTC (rev 163626)
+++ trunk/Source/WebKit2/DatabaseProcess/IndexedDB/sqlite/UniqueIDBDatabaseBackingStoreSQLite.h        2014-02-07 18:26:48 UTC (rev 163627)
</span><span class="lines">@@ -30,10 +30,16 @@
</span><span class="cx">
</span><span class="cx"> #include "UniqueIDBDatabase.h"
</span><span class="cx"> #include "UniqueIDBDatabaseBackingStore.h"
</span><ins>+#include <JavaScriptCore/Strong.h>
</ins><span class="cx"> #include <wtf/OwnPtr.h>
</span><span class="cx"> #include <wtf/PassRefPtr.h>
</span><span class="cx"> #include <wtf/text/WTFString.h>
</span><span class="cx">
</span><ins>+namespace JSC {
+class JSGlobalObject;
+class VM;
+}
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx"> class SQLiteDatabase;
</span><span class="cx"> struct IDBDatabaseMetadata;
</span><span class="lines">@@ -82,9 +88,9 @@
</span><span class="cx"> virtual bool getKeyRangeRecordFromObjectStore(const IDBIdentifier& transactionIdentifier, int64_t objectStoreID, const WebCore::IDBKeyRange&, RefPtr<WebCore::SharedBuffer>& result, RefPtr<WebCore::IDBKey>& resultKey) override;
</span><span class="cx"> virtual bool count(const IDBIdentifier& transactionIdentifier, int64_t objectStoreID, int64_t indexID, const WebCore::IDBKeyRangeData&, int64_t& count) override;
</span><span class="cx">
</span><del>- virtual bool openCursor(const IDBIdentifier& transactionIdentifier, int64_t objectStoreID, int64_t indexID, WebCore::IndexedDB::CursorDirection, WebCore::IndexedDB::CursorType, WebCore::IDBDatabaseBackend::TaskType, const WebCore::IDBKeyRangeData&, int64_t& cursorID, WebCore::IDBKeyData&, WebCore::IDBKeyData&, Vector<char>&) override;
- virtual bool advanceCursor(const IDBIdentifier& cursorIdentifier, uint64_t count, WebCore::IDBKeyData&, WebCore::IDBKeyData&, Vector<char>&) override;
- virtual bool iterateCursor(const IDBIdentifier& cursorIdentifier, const WebCore::IDBKeyData&, WebCore::IDBKeyData&, WebCore::IDBKeyData&, Vector<char>&) override;
</del><ins>+ virtual bool openCursor(const IDBIdentifier& transactionIdentifier, int64_t objectStoreID, int64_t indexID, WebCore::IndexedDB::CursorDirection, WebCore::IndexedDB::CursorType, WebCore::IDBDatabaseBackend::TaskType, const WebCore::IDBKeyRangeData&, int64_t& cursorID, WebCore::IDBKeyData&, WebCore::IDBKeyData&, Vector<uint8_t>&) override;
+ virtual bool advanceCursor(const IDBIdentifier& cursorIdentifier, uint64_t count, WebCore::IDBKeyData&, WebCore::IDBKeyData&, Vector<uint8_t>&) override;
+ virtual bool iterateCursor(const IDBIdentifier& cursorIdentifier, const WebCore::IDBKeyData&, WebCore::IDBKeyData&, WebCore::IDBKeyData&, Vector<uint8_t>&) override;
</ins><span class="cx">
</span><span class="cx"> void unregisterCursor(SQLiteIDBCursor*);
</span><span class="cx">
</span><span class="lines">@@ -96,6 +102,7 @@
</span><span class="cx"> std::unique_ptr<WebCore::IDBDatabaseMetadata> createAndPopulateInitialMetadata();
</span><span class="cx">
</span><span class="cx"> bool deleteRecord(SQLiteIDBTransaction&, int64_t objectStoreID, const WebCore::IDBKeyData&);
</span><ins>+ bool uncheckedPutIndexRecord(int64_t objectStoreID, int64_t indexID, const WebCore::IDBKeyData& keyValue, const WebCore::IDBKeyData& indexKey);
</ins><span class="cx">
</span><span class="cx"> int idbKeyCollate(int aLength, const void* a, int bLength, const void* b);
</span><span class="cx">
</span><span class="lines">@@ -106,6 +113,9 @@
</span><span class="cx">
</span><span class="cx"> HashMap<IDBIdentifier, std::unique_ptr<SQLiteIDBTransaction>> m_transactions;
</span><span class="cx"> HashMap<IDBIdentifier, SQLiteIDBCursor*> m_cursors;
</span><ins>+
+ RefPtr<JSC::VM> m_vm;
+ JSC::Strong<JSC::JSGlobalObject> m_globalObject;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebKit
</span></span></pre>
</div>
</div>
</body>
</html>