<!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
&lt;rdar://problem/16002857&gt; 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&lt;uint8_t&gt;
  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&lt;char&gt; to Vector&lt;uint8_t&gt; 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&lt;char&gt; to Vector&lt;uint8_t&gt; 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&lt;char&gt; to Vector&lt;uint8_t&gt;.
(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  &lt;beidson@apple.com&gt;
+
+        IDB: storage/indexeddb/create-index-with-integer-keys.html fails
+        &lt;rdar://problem/16002857&gt; 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  &lt;fred.wang@free.fr&gt;
</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  &lt;beidson@apple.com&gt;
+
+        IDB: storage/indexeddb/create-index-with-integer-keys.html fails
+        &lt;rdar://problem/16002857&gt; 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&lt;uint8_t&gt;
+          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  &lt;fred.wang@free.fr&gt;
</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&amp; keyPath = objectStore-&gt;metadata().keyPath;
</span><span class="cx">     const bool usesInLineKeys = !keyPath.isNull();
</span><span class="cx">     if (usesInLineKeys) {
</span><del>-        RefPtr&lt;IDBKey&gt; keyPathKey = createIDBKeyFromScriptValueAndKeyPath(m_request-&gt;requestState(), value, keyPath);
</del><ins>+        RefPtr&lt;IDBKey&gt; keyPathKey = createIDBKeyFromScriptValueAndKeyPath(m_request-&gt;requestState()-&gt;exec(), value, keyPath);
</ins><span class="cx">         if (!keyPathKey || !keyPathKey-&gt;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-&gt;metadata();
</span><span class="cx">         if (metadata.autoIncrement &amp;&amp; !metadata.keyPath.isNull()) {
</span><span class="cx"> #ifndef NDEBUG
</span><del>-            RefPtr&lt;IDBKey&gt; expectedKey = createIDBKeyFromScriptValueAndKeyPath(m_request-&gt;requestState(), value, metadata.keyPath);
</del><ins>+            RefPtr&lt;IDBKey&gt; expectedKey = createIDBKeyFromScriptValueAndKeyPath(m_request-&gt;requestState()-&gt;exec(), value, metadata.keyPath);
</ins><span class="cx">             ASSERT(!expectedKey || expectedKey-&gt;isEqual(m_currentPrimaryKey.get()));
</span><span class="cx"> #endif
</span><span class="cx">             bool injected = injectIDBKeyIntoScriptValue(m_request-&gt;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 &quot;IDBDatabaseException.h&quot;
</span><span class="cx"> #include &quot;IDBIndex.h&quot;
</span><span class="cx"> #include &quot;IDBKey.h&quot;
</span><ins>+#include &quot;IDBKeyData.h&quot;
</ins><span class="cx"> #include &quot;IDBKeyPath.h&quot;
</span><span class="cx"> #include &quot;IDBKeyRange.h&quot;
</span><span class="cx"> #include &quot;IDBTransaction.h&quot;
</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&amp; indexMetadata, const Deprecated::ScriptValue&amp; objectValue, IDBObjectStore::IndexKeys* indexKeys)
-{
-    ASSERT(indexKeys);
-    RefPtr&lt;IDBKey&gt; indexKey = createIDBKeyFromScriptValueAndKeyPath(requestState, objectValue, indexMetadata.keyPath);
-
-    if (!indexKey)
-        return;
-
-    if (!indexMetadata.multiEntry || indexKey-&gt;type() != IDBKey::ArrayType) {
-        if (!indexKey-&gt;isValid())
-            return;
-
-        indexKeys-&gt;append(indexKey);
-    } else {
-        ASSERT(indexMetadata.multiEntry);
-        ASSERT(indexKey-&gt;type() == IDBKey::ArrayType);
-        indexKey = IDBKey::createMultiEntryArray(indexKey-&gt;array());
-
-        for (size_t i = 0; i &lt; indexKey-&gt;array().size(); ++i)
-            indexKeys-&gt;append(indexKey-&gt;array()[i]);
-    }
-}
-
</del><span class="cx"> PassRefPtr&lt;IDBRequest&gt; IDBObjectStore::add(JSC::ExecState* state, Deprecated::ScriptValue&amp; value, const Deprecated::ScriptValue&amp; key, ExceptionCode&amp; ec)
</span><span class="cx"> {
</span><span class="cx">     LOG(StorageAPI, &quot;IDBObjectStore::add&quot;);
</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&lt;IDBKey&gt; keyPathKey = createIDBKeyFromScriptValueAndKeyPath(&amp;requestState, value, keyPath);
</del><ins>+        RefPtr&lt;IDBKey&gt; keyPathKey = createIDBKeyFromScriptValueAndKeyPath(requestState.exec(), value, keyPath);
</ins><span class="cx">         if (keyPathKey &amp;&amp; !keyPathKey-&gt;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&lt;int64_t&gt; indexIds;
</span><span class="cx">     Vector&lt;IndexKeys&gt; 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(&amp;requestState, it-&gt;value, value, &amp;keys);
</del><ins>+        Vector&lt;IDBKeyData&gt; keyDatas;
+        generateIndexKeysForValue(requestState.exec(), it-&gt;value, value, keyDatas);
</ins><span class="cx">         indexIds.append(it-&gt;key);
</span><ins>+
+        // FIXME: Much of the Indexed DB code needs to use IDBKeyData directly to avoid wasteful conversions like this.
+        Vector&lt;RefPtr&lt;IDBKey&gt;&gt; keys;
+        for (auto&amp; i : keyDatas) {
+            RefPtr&lt;IDBKey&gt; 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&lt;IDBKey&gt; primaryKey = cursor-&gt;idbPrimaryKey();
</span><span class="cx">             Deprecated::ScriptValue value = cursor-&gt;value();
</span><span class="cx"> 
</span><del>-            IDBObjectStore::IndexKeys indexKeys;
-            generateIndexKeysForValue(request-&gt;requestState(), m_indexMetadata, value, &amp;indexKeys);
</del><ins>+            Vector&lt;IDBKeyData&gt; indexKeyDatas;
+            generateIndexKeysForValue(request-&gt;requestState()-&gt;exec(), m_indexMetadata, value, indexKeyDatas);
</ins><span class="cx"> 
</span><ins>+            Vector&lt;RefPtr&lt;IDBKey&gt;&gt; indexKeys;
+            for (auto&amp; i : indexKeyDatas) {
+                RefPtr&lt;IDBKey&gt; key = i.maybeCreateIDBKey();
+                if (key)
+                    indexKeys.append(key.release());
+            }
</ins><span class="cx">             Vector&lt;IDBObjectStore::IndexKeys, 1&gt; 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&lt;IDBKey&gt; primaryKey = prpPrimaryKey;
</span><span class="cx"> #ifndef NDEBUG
</span><del>-    RefPtr&lt;IDBKey&gt; expectedKey = createIDBKeyFromScriptValueAndKeyPath(requestState(), value, keyPath);
</del><ins>+    RefPtr&lt;IDBKey&gt; expectedKey = createIDBKeyFromScriptValueAndKeyPath(requestState()-&gt;exec(), value, keyPath);
</ins><span class="cx">     ASSERT(!expectedKey || expectedKey-&gt;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 = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 439046D312DA25E800AF80A2 /* RenderMathMLScripts.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RenderMathMLScripts.cpp; path = mathml/RenderMathMLScripts.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 439046D412DA25E800AF80A2 /* RenderMathMLScripts.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RenderMathMLScripts.h; path = mathml/RenderMathMLScripts.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                439046D512DA25E800AF80A2 /* RenderMathMLUnderOver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RenderMathMLUnderOver.cpp; path = mathml/RenderMathMLUnderOver.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                439046D612DA25E800AF80A2 /* RenderMathMLUnderOver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RenderMathMLUnderOver.h; path = mathml/RenderMathMLUnderOver.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 439046D712DA25E800AF80A9 /* RenderMathMLToken.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RenderMathMLToken.cpp; path = mathml/RenderMathMLToken.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 439046D812DA25E800AF80A9 /* RenderMathMLToken.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RenderMathMLToken.h; path = mathml/RenderMathMLToken.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                439046D512DA25E800AF80A2 /* RenderMathMLUnderOver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RenderMathMLUnderOver.cpp; path = mathml/RenderMathMLUnderOver.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
-                439046D612DA25E800AF80A2 /* RenderMathMLUnderOver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RenderMathMLUnderOver.h; path = mathml/RenderMathMLUnderOver.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><span class="cx">                 439D334013A6911C00C20F4F /* SVGAnimatedType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedType.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 439D334113A6911C00C20F4F /* SVGAnimatedTypeAnimator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedTypeAnimator.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 439D334213A6911C00C20F4F /* SVGAnimatorFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatorFactory.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</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 &quot;IDBBindingUtilities.h&quot;
</span><span class="cx"> 
</span><span class="cx"> #include &quot;DOMRequestState.h&quot;
</span><ins>+#include &quot;IDBIndexMetadata.h&quot;
</ins><span class="cx"> #include &quot;IDBKey.h&quot;
</span><ins>+#include &quot;IDBKeyData.h&quot;
</ins><span class="cx"> #include &quot;IDBKeyPath.h&quot;
</span><span class="cx"> #include &quot;Logging.h&quot;
</span><span class="cx"> #include &quot;SharedBuffer.h&quot;
</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&lt;IDBKey&gt; createIDBKeyFromScriptValueAndKeyPath(ExecState* exec, const Deprecated::ScriptValue&amp; value, const String&amp; keyPath)
</del><ins>+static PassRefPtr&lt;IDBKey&gt; internalCreateIDBKeyFromScriptValueAndKeyPath(ExecState* exec, const Deprecated::ScriptValue&amp; value, const String&amp; keyPath)
</ins><span class="cx"> {
</span><span class="cx">     Vector&lt;String&gt; 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&lt;IDBKey&gt; createIDBKeyFromScriptValueAndKeyPath(DOMRequestState* requestState, const Deprecated::ScriptValue&amp; value, const IDBKeyPath&amp; keyPath)
</del><ins>+PassRefPtr&lt;IDBKey&gt; createIDBKeyFromScriptValueAndKeyPath(ExecState* exec, const Deprecated::ScriptValue&amp; value, const IDBKeyPath&amp; keyPath)
</ins><span class="cx"> {
</span><span class="cx">     LOG(StorageAPI, &quot;createIDBKeyFromScriptValueAndKeyPath&quot;);
</span><span class="cx">     ASSERT(!keyPath.isNull());
</span><span class="cx"> 
</span><del>-    ExecState* exec = requestState-&gt;exec();
-
</del><span class="cx">     if (keyPath.type() == IDBKeyPath::ArrayType) {
</span><span class="cx">         IDBKey::KeyArray result;
</span><span class="cx">         const Vector&lt;String&gt;&amp; array = keyPath.array();
</span><span class="cx">         for (size_t i = 0; i &lt; array.size(); i++) {
</span><del>-            RefPtr&lt;IDBKey&gt; key = createIDBKeyFromScriptValueAndKeyPath(exec, value, array[i]);
</del><ins>+            RefPtr&lt;IDBKey&gt; 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&amp; scriptValue, const IDBKeyPath&amp; keyPath)
</span><span class="lines">@@ -305,21 +305,26 @@
</span><span class="cx"> 
</span><span class="cx"> Deprecated::ScriptValue deserializeIDBValueBuffer(DOMRequestState* requestState, PassRefPtr&lt;SharedBuffer&gt; prpBuffer, bool keyIsDefined)
</span><span class="cx"> {
</span><del>-    ExecState* exec = requestState-&gt;exec();
-    RefPtr&lt;SharedBuffer&gt; buffer = prpBuffer;
</del><ins>+    if (prpBuffer) {
+        Vector&lt;uint8_t&gt; value;
+        value.append(prpBuffer-&gt;data(), prpBuffer-&gt;size());
+        return deserializeIDBValueBuffer(requestState-&gt;exec(), value, keyIsDefined);
+    }
</ins><span class="cx"> 
</span><ins>+    return Deprecated::ScriptValue(requestState-&gt;exec()-&gt;vm(), jsNull());
+}
+
+Deprecated::ScriptValue deserializeIDBValueBuffer(JSC::ExecState* exec, const Vector&lt;uint8_t&gt;&amp; 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-&gt;size());
</del><ins>+        ASSERT(!buffer.size());
</ins><span class="cx">         return Deprecated::ScriptValue(exec-&gt;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&lt;uint8_t&gt; value;
-        value.append(buffer-&gt;data(), buffer-&gt;size());
-        RefPtr&lt;SerializedScriptValue&gt; serializedValue = SerializedScriptValue::createFromWireBytes(value);
</del><ins>+    if (buffer.size()) {
+        RefPtr&lt;SerializedScriptValue&gt; 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&amp; indexMetadata, const Deprecated::ScriptValue&amp; objectValue, Vector&lt;IDBKeyData&gt;&amp; indexKeys)
+{
+    RefPtr&lt;IDBKey&gt; indexKey = createIDBKeyFromScriptValueAndKeyPath(exec, objectValue, indexMetadata.keyPath);
+
+    if (!indexKey)
+        return;
+
+    if (!indexMetadata.multiEntry || indexKey-&gt;type() != IDBKey::ArrayType) {
+        if (!indexKey-&gt;isValid())
+            return;
+
+        indexKeys.append(IDBKeyData(indexKey.get()));
+    } else {
+        ASSERT(indexMetadata.multiEntry);
+        ASSERT(indexKey-&gt;type() == IDBKey::ArrayType);
+        indexKey = IDBKey::createMultiEntryArray(indexKey-&gt;array());
+
+        if (!indexKey-&gt;isValid())
+            return;
+
+        for (auto&amp; i : indexKey-&gt;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&lt;IDBKey&gt;, Deprecated::ScriptValue&amp;, const IDBKeyPath&amp;);
</span><del>-PassRefPtr&lt;IDBKey&gt; createIDBKeyFromScriptValueAndKeyPath(DOMRequestState*, const Deprecated::ScriptValue&amp;, const IDBKeyPath&amp;);
</del><ins>+PassRefPtr&lt;IDBKey&gt; createIDBKeyFromScriptValueAndKeyPath(JSC::ExecState*, const Deprecated::ScriptValue&amp;, const IDBKeyPath&amp;);
</ins><span class="cx"> bool canInjectIDBKeyIntoScriptValue(DOMRequestState*, const Deprecated::ScriptValue&amp;, const IDBKeyPath&amp;);
</span><span class="cx"> Deprecated::ScriptValue deserializeIDBValue(DOMRequestState*, PassRefPtr&lt;SerializedScriptValue&gt;);
</span><span class="cx"> Deprecated::ScriptValue deserializeIDBValueBuffer(DOMRequestState*, PassRefPtr&lt;SharedBuffer&gt;, bool keyIsDefined);
</span><ins>+Deprecated::ScriptValue deserializeIDBValueBuffer(JSC::ExecState*, const Vector&lt;uint8_t&gt;&amp;, bool keyIsDefined);
</ins><span class="cx"> Deprecated::ScriptValue idbKeyToScriptValue(DOMRequestState*, PassRefPtr&lt;IDBKey&gt;);
</span><span class="cx"> PassRefPtr&lt;IDBKey&gt; scriptValueToIDBKey(DOMRequestState*, const Deprecated::ScriptValue&amp;);
</span><ins>+void generateIndexKeysForValue(JSC::ExecState*, const IDBIndexMetadata&amp;, const Deprecated::ScriptValue&amp; objectValue, Vector&lt;IDBKeyData&gt;&amp; 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&lt;const unsigned char*&gt;(blob))[i];
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void SQLiteStatement::getColumnBlobAsVector(int col, Vector&lt;uint8_t&gt;&amp; result)
+{
+    ASSERT(col &gt;= 0);
+
+    if (!m_statement &amp;&amp; prepareAndStep() != SQLITE_ROW) {
+        result.clear();
+        return;
+    }
+
+    if (columnCount() &lt;= 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 &lt; size; ++i)
+        result[i] = (static_cast&lt;const uint8_t*&gt;(blob))[i];
+}
+
</ins><span class="cx"> bool SQLiteStatement::returnTextResults(int col, Vector&lt;String&gt;&amp; v)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(col &gt;= 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&lt;char&gt;&amp;);
</span><ins>+    void getColumnBlobAsVector(int col, Vector&lt;uint8_t&gt;&amp;);
</ins><span class="cx"> 
</span><span class="cx">     bool returnTextResults(int col, Vector&lt;String&gt;&amp;);
</span><span class="cx">     bool returnIntResults(int col, Vector&lt;int&gt;&amp;);
</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  &lt;beidson@apple.com&gt;
+
+        IDB: storage/indexeddb/create-index-with-integer-keys.html fails
+        &lt;rdar://problem/16002857&gt; and https://bugs.webkit.org/show_bug.cgi?id=128316
+
+        Reviewed by Geoff Garen.
+
+        Update Vector&lt;char&gt; to Vector&lt;uint8_t&gt; 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&lt;char&gt; to Vector&lt;uint8_t&gt; 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&lt;char&gt; to Vector&lt;uint8_t&gt;.
+        (WebKit::UniqueIDBDatabaseBackingStoreSQLite::advanceCursor): Ditto.
+        (WebKit::UniqueIDBDatabaseBackingStoreSQLite::iterateCursor): Ditto.
+        * DatabaseProcess/IndexedDB/sqlite/UniqueIDBDatabaseBackingStoreSQLite.h:
+
</ins><span class="cx"> 2014-02-07  Jinwoo Song  &lt;jinwoo7.song@samsung.com&gt;
</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&lt;char&gt; valueBuffer;
</del><ins>+    Vector&lt;uint8_t&gt; valueBuffer;
</ins><span class="cx">     int32_t errorCode = 0;
</span><span class="cx">     String errorMessage;
</span><span class="cx">     bool success = m_backingStore-&gt;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, &amp;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&amp; key, const IDBKeyData&amp; primaryKey, const Vector&lt;char&gt;&amp; valueBuffer, uint32_t errorCode, const String&amp; errorMessage)
</del><ins>+void UniqueIDBDatabase::didOpenCursorInBackingStore(uint64_t requestID, int64_t cursorID, const IDBKeyData&amp; key, const IDBKeyData&amp; primaryKey, const Vector&lt;uint8_t&gt;&amp; valueBuffer, uint32_t errorCode, const String&amp; errorMessage)
</ins><span class="cx"> {
</span><span class="cx">     RefPtr&lt;AsyncRequest&gt; 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&lt;char&gt; valueBuffer;
</del><ins>+    Vector&lt;uint8_t&gt; valueBuffer;
</ins><span class="cx">     int32_t errorCode = 0;
</span><span class="cx">     String errorMessage;
</span><span class="cx">     bool success = m_backingStore-&gt;advanceCursor(cursorIdentifier, count, key, primaryKey, valueBuffer);
</span><span class="lines">@@ -989,7 +989,7 @@
</span><span class="cx">     postMainThreadTask(createAsyncTask(*this, &amp;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&amp; key, const IDBKeyData&amp; primaryKey, const Vector&lt;char&gt;&amp; valueBuffer, uint32_t errorCode, const String&amp; errorMessage)
</del><ins>+void UniqueIDBDatabase::didAdvanceCursorInBackingStore(uint64_t requestID, const IDBKeyData&amp; key, const IDBKeyData&amp; primaryKey, const Vector&lt;uint8_t&gt;&amp; valueBuffer, uint32_t errorCode, const String&amp; errorMessage)
</ins><span class="cx"> {
</span><span class="cx">     RefPtr&lt;AsyncRequest&gt; 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&lt;char&gt; valueBuffer;
</del><ins>+    Vector&lt;uint8_t&gt; valueBuffer;
</ins><span class="cx">     int32_t errorCode = 0;
</span><span class="cx">     String errorMessage;
</span><span class="cx">     bool success = m_backingStore-&gt;iterateCursor(cursorIdentifier, iterateKey, key, primaryKey, valueBuffer);
</span><span class="lines">@@ -1014,7 +1014,7 @@
</span><span class="cx">     postMainThreadTask(createAsyncTask(*this, &amp;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&amp; key, const IDBKeyData&amp; primaryKey, const Vector&lt;char&gt;&amp; valueBuffer, uint32_t errorCode, const String&amp; errorMessage)
</del><ins>+void UniqueIDBDatabase::didIterateCursorInBackingStore(uint64_t requestID, const IDBKeyData&amp; key, const IDBKeyData&amp; primaryKey, const Vector&lt;uint8_t&gt;&amp; valueBuffer, uint32_t errorCode, const String&amp; errorMessage)
</ins><span class="cx"> {
</span><span class="cx">     RefPtr&lt;AsyncRequest&gt; 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&amp;, uint32_t errorCode, const String&amp; errorMessage);
</span><span class="cx">     void didGetRecordFromBackingStore(uint64_t requestID, const WebCore::IDBGetResult&amp;, uint32_t errorCode, const String&amp; errorMessage);
</span><del>-    void didOpenCursorInBackingStore(uint64_t requestID, int64_t cursorID, const WebCore::IDBKeyData&amp;, const WebCore::IDBKeyData&amp;, const Vector&lt;char&gt;&amp;, uint32_t errorCode, const String&amp; errorMessage);
-    void didAdvanceCursorInBackingStore(uint64_t requestID, const WebCore::IDBKeyData&amp;, const WebCore::IDBKeyData&amp;, const Vector&lt;char&gt;&amp;, uint32_t errorCode, const String&amp; errorMessage);
-    void didIterateCursorInBackingStore(uint64_t requestID, const WebCore::IDBKeyData&amp;, const WebCore::IDBKeyData&amp;, const Vector&lt;char&gt;&amp;, uint32_t errorCode, const String&amp; errorMessage);
</del><ins>+    void didOpenCursorInBackingStore(uint64_t requestID, int64_t cursorID, const WebCore::IDBKeyData&amp;, const WebCore::IDBKeyData&amp;, const Vector&lt;uint8_t&gt;&amp;, uint32_t errorCode, const String&amp; errorMessage);
+    void didAdvanceCursorInBackingStore(uint64_t requestID, const WebCore::IDBKeyData&amp;, const WebCore::IDBKeyData&amp;, const Vector&lt;uint8_t&gt;&amp;, uint32_t errorCode, const String&amp; errorMessage);
+    void didIterateCursorInBackingStore(uint64_t requestID, const WebCore::IDBKeyData&amp;, const WebCore::IDBKeyData&amp;, const Vector&lt;uint8_t&gt;&amp;, uint32_t errorCode, const String&amp; errorMessage);
</ins><span class="cx">     void didCountInBackingStore(uint64_t requestID, int64_t count, uint32_t errorCode, const String&amp; errorMessage);
</span><span class="cx">     void didDeleteRangeInBackingStore(uint64_t requestID, uint32_t errorCode, const String&amp; 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&amp; transactionIdentifier, int64_t objectStoreID, const WebCore::IDBKeyRange&amp;, RefPtr&lt;WebCore::SharedBuffer&gt;&amp; result, RefPtr&lt;WebCore::IDBKey&gt;&amp; resultKey) = 0;
</span><span class="cx">     virtual bool count(const IDBIdentifier&amp; transactionIdentifier, int64_t objectStoreID, int64_t indexID, const WebCore::IDBKeyRangeData&amp;, int64_t&amp; count) = 0;
</span><span class="cx"> 
</span><del>-    virtual bool openCursor(const IDBIdentifier&amp; transactionIdentifier, int64_t objectStoreID, int64_t indexID, WebCore::IndexedDB::CursorDirection, WebCore::IndexedDB::CursorType, WebCore::IDBDatabaseBackend::TaskType, const WebCore::IDBKeyRangeData&amp;, int64_t&amp; cursorID, WebCore::IDBKeyData&amp;, WebCore::IDBKeyData&amp;, Vector&lt;char&gt;&amp;) = 0;
-    virtual bool advanceCursor(const IDBIdentifier&amp; cursorIdentifier, uint64_t count, WebCore::IDBKeyData&amp;, WebCore::IDBKeyData&amp;, Vector&lt;char&gt;&amp;) = 0;
-    virtual bool iterateCursor(const IDBIdentifier&amp; cursorIdentifier, const WebCore::IDBKeyData&amp;, WebCore::IDBKeyData&amp;, WebCore::IDBKeyData&amp;, Vector&lt;char&gt;&amp;) = 0;
</del><ins>+    virtual bool openCursor(const IDBIdentifier&amp; transactionIdentifier, int64_t objectStoreID, int64_t indexID, WebCore::IndexedDB::CursorDirection, WebCore::IndexedDB::CursorType, WebCore::IDBDatabaseBackend::TaskType, const WebCore::IDBKeyRangeData&amp;, int64_t&amp; cursorID, WebCore::IDBKeyData&amp;, WebCore::IDBKeyData&amp;, Vector&lt;uint8_t&gt;&amp;) = 0;
+    virtual bool advanceCursor(const IDBIdentifier&amp; cursorIdentifier, uint64_t count, WebCore::IDBKeyData&amp;, WebCore::IDBKeyData&amp;, Vector&lt;uint8_t&gt;&amp;) = 0;
+    virtual bool iterateCursor(const IDBIdentifier&amp; cursorIdentifier, const WebCore::IDBKeyData&amp;, WebCore::IDBKeyData&amp;, WebCore::IDBKeyData&amp;, Vector&lt;uint8_t&gt;&amp;) = 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&lt;char&gt; keyData;
</del><ins>+    Vector&lt;uint8_t&gt; keyData;
</ins><span class="cx">     m_statement-&gt;getColumnBlobAsVector(0, keyData);
</span><span class="cx"> 
</span><del>-    if (!deserializeIDBKeyData(reinterpret_cast&lt;const uint8_t*&gt;(keyData.data()), keyData.size(), m_currentKey)) {
</del><ins>+    if (!deserializeIDBKeyData(keyData.data(), keyData.size(), m_currentKey)) {
</ins><span class="cx">         LOG_ERROR(&quot;Unable to deserialize key data from database while advancing cursor&quot;);
</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&lt;const uint8_t*&gt;(keyData.data()), keyData.size(), m_currentPrimaryKey)) {
</del><ins>+        if (!deserializeIDBKeyData(keyData.data(), keyData.size(), m_currentPrimaryKey)) {
</ins><span class="cx">             LOG_ERROR(&quot;Unable to deserialize value data from database while advancing index cursor&quot;);
</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&amp; currentKey() const { return m_currentKey; }
</span><span class="cx">     const WebCore::IDBKeyData&amp; currentPrimaryKey() const { return m_currentPrimaryKey; }
</span><del>-    const Vector&lt;char&gt;&amp; currentValueBuffer() const { return m_currentValueBuffer; }
</del><ins>+    const Vector&lt;uint8_t&gt;&amp; 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&amp; 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&lt;char&gt; m_currentValueBuffer;
</del><ins>+    Vector&lt;uint8_t&gt; m_currentValueBuffer;
</ins><span class="cx"> 
</span><span class="cx">     std::unique_ptr&lt;WebCore::SQLiteStatement&gt; 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 &quot;SQLiteIDBCursor.h&quot;
</span><span class="cx"> #include &quot;SQLiteIDBTransaction.h&quot;
</span><span class="cx"> #include &lt;WebCore/FileSystem.h&gt;
</span><ins>+#include &lt;WebCore/IDBBindingUtilities.h&gt;
</ins><span class="cx"> #include &lt;WebCore/IDBDatabaseMetadata.h&gt;
</span><span class="cx"> #include &lt;WebCore/IDBGetResult.h&gt;
</span><span class="cx"> #include &lt;WebCore/IDBKeyData.h&gt;
</span><span class="lines">@@ -43,6 +44,7 @@
</span><span class="cx"> #include &lt;WebCore/SharedBuffer.h&gt;
</span><span class="cx"> #include &lt;wtf/MainThread.h&gt;
</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-&gt;openCursor(objectStoreID, IDBIndexMetadata::InvalidId, IndexedDB::CursorDirection::Next, IndexedDB::CursorType::KeyAndValue, IDBDatabaseBackend::NormalTask, IDBKeyRangeData());
+
+    if (!cursor) {
+        LOG_ERROR(&quot;Cannot open cursor to populate indexes in database&quot;);
+        return false;
+    }
+
+    m_cursors.set(cursor-&gt;identifier(), cursor);
+
+    OwnPtr&lt;JSLockHolder&gt; lockHolder;
+    while (!cursor-&gt;currentKey().isNull) {
+        const IDBKeyData&amp; key = cursor-&gt;currentKey();
+        const Vector&lt;uint8_t&gt;&amp; valueBuffer = cursor-&gt;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-&gt;globalExec(), valueBuffer, true);
+        Vector&lt;IDBKeyData&gt; indexKeys;
+        generateIndexKeysForValue(m_globalObject-&gt;globalExec(), metadata, value, indexKeys);
+
+        for (auto&amp; indexKey : indexKeys) {
+            if (!uncheckedPutIndexRecord(objectStoreID, metadata.id, key, indexKey)) {
+                LOG_ERROR(&quot;Unable to put index record for newly created index&quot;);
+                return false;
+            }
+        }
+
+        if (!cursor-&gt;advance(1)) {
+            LOG_ERROR(&quot;Error advancing cursor while indexing existing records for new index.&quot;);
+            return false;
+        }
+    }
+
+    transaction-&gt;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&amp; keyValue, const WebCore::IDBKeyData&amp; indexKey)
+{
</ins><span class="cx">     RefPtr&lt;SharedBuffer&gt; indexKeyBuffer = serializeIDBKeyData(indexKey);
</span><span class="cx">     if (!indexKeyBuffer) {
</span><span class="cx">         LOG_ERROR(&quot;Unable to serialize index key to be stored in the database&quot;);
</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&amp; transactionIdentifier, int64_t objectStoreID, int64_t indexID, IndexedDB::CursorDirection cursorDirection, IndexedDB::CursorType cursorType, IDBDatabaseBackend::TaskType taskType, const IDBKeyRangeData&amp; keyRange, int64_t&amp; cursorID, IDBKeyData&amp; key, IDBKeyData&amp; primaryKey, Vector&lt;char&gt;&amp; valueBuffer)
</del><ins>+bool UniqueIDBDatabaseBackingStoreSQLite::openCursor(const IDBIdentifier&amp; transactionIdentifier, int64_t objectStoreID, int64_t indexID, IndexedDB::CursorDirection cursorDirection, IndexedDB::CursorType cursorType, IDBDatabaseBackend::TaskType taskType, const IDBKeyRangeData&amp; keyRange, int64_t&amp; cursorID, IDBKeyData&amp; key, IDBKeyData&amp; primaryKey, Vector&lt;uint8_t&gt;&amp; 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&amp; cursorIdentifier, uint64_t count, IDBKeyData&amp; key, IDBKeyData&amp; primaryKey, Vector&lt;char&gt;&amp; valueBuffer)
</del><ins>+bool UniqueIDBDatabaseBackingStoreSQLite::advanceCursor(const IDBIdentifier&amp; cursorIdentifier, uint64_t count, IDBKeyData&amp; key, IDBKeyData&amp; primaryKey, Vector&lt;uint8_t&gt;&amp; 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&amp; cursorIdentifier, const IDBKeyData&amp; targetKey, IDBKeyData&amp; key, IDBKeyData&amp; primaryKey, Vector&lt;char&gt;&amp; valueBuffer)
</del><ins>+bool UniqueIDBDatabaseBackingStoreSQLite::iterateCursor(const IDBIdentifier&amp; cursorIdentifier, const IDBKeyData&amp; targetKey, IDBKeyData&amp; key, IDBKeyData&amp; primaryKey, Vector&lt;uint8_t&gt;&amp; 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 &quot;UniqueIDBDatabase.h&quot; 
</span><span class="cx"> #include &quot;UniqueIDBDatabaseBackingStore.h&quot;
</span><ins>+#include &lt;JavaScriptCore/Strong.h&gt;
</ins><span class="cx"> #include &lt;wtf/OwnPtr.h&gt;
</span><span class="cx"> #include &lt;wtf/PassRefPtr.h&gt;
</span><span class="cx"> #include &lt;wtf/text/WTFString.h&gt;
</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&amp; transactionIdentifier, int64_t objectStoreID, const WebCore::IDBKeyRange&amp;, RefPtr&lt;WebCore::SharedBuffer&gt;&amp; result, RefPtr&lt;WebCore::IDBKey&gt;&amp; resultKey) override;
</span><span class="cx">     virtual bool count(const IDBIdentifier&amp; transactionIdentifier, int64_t objectStoreID, int64_t indexID, const WebCore::IDBKeyRangeData&amp;, int64_t&amp; count) override;
</span><span class="cx"> 
</span><del>-    virtual bool openCursor(const IDBIdentifier&amp; transactionIdentifier, int64_t objectStoreID, int64_t indexID, WebCore::IndexedDB::CursorDirection, WebCore::IndexedDB::CursorType, WebCore::IDBDatabaseBackend::TaskType, const WebCore::IDBKeyRangeData&amp;, int64_t&amp; cursorID, WebCore::IDBKeyData&amp;, WebCore::IDBKeyData&amp;, Vector&lt;char&gt;&amp;) override;
-    virtual bool advanceCursor(const IDBIdentifier&amp; cursorIdentifier, uint64_t count, WebCore::IDBKeyData&amp;, WebCore::IDBKeyData&amp;, Vector&lt;char&gt;&amp;) override;
-    virtual bool iterateCursor(const IDBIdentifier&amp; cursorIdentifier, const WebCore::IDBKeyData&amp;, WebCore::IDBKeyData&amp;, WebCore::IDBKeyData&amp;, Vector&lt;char&gt;&amp;) override;
</del><ins>+    virtual bool openCursor(const IDBIdentifier&amp; transactionIdentifier, int64_t objectStoreID, int64_t indexID, WebCore::IndexedDB::CursorDirection, WebCore::IndexedDB::CursorType, WebCore::IDBDatabaseBackend::TaskType, const WebCore::IDBKeyRangeData&amp;, int64_t&amp; cursorID, WebCore::IDBKeyData&amp;, WebCore::IDBKeyData&amp;, Vector&lt;uint8_t&gt;&amp;) override;
+    virtual bool advanceCursor(const IDBIdentifier&amp; cursorIdentifier, uint64_t count, WebCore::IDBKeyData&amp;, WebCore::IDBKeyData&amp;, Vector&lt;uint8_t&gt;&amp;) override;
+    virtual bool iterateCursor(const IDBIdentifier&amp; cursorIdentifier, const WebCore::IDBKeyData&amp;, WebCore::IDBKeyData&amp;, WebCore::IDBKeyData&amp;, Vector&lt;uint8_t&gt;&amp;) 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&lt;WebCore::IDBDatabaseMetadata&gt; createAndPopulateInitialMetadata();
</span><span class="cx"> 
</span><span class="cx">     bool deleteRecord(SQLiteIDBTransaction&amp;, int64_t objectStoreID, const WebCore::IDBKeyData&amp;);
</span><ins>+    bool uncheckedPutIndexRecord(int64_t objectStoreID, int64_t indexID, const WebCore::IDBKeyData&amp; keyValue, const WebCore::IDBKeyData&amp; 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&lt;IDBIdentifier, std::unique_ptr&lt;SQLiteIDBTransaction&gt;&gt; m_transactions;
</span><span class="cx">     HashMap&lt;IDBIdentifier, SQLiteIDBCursor*&gt; m_cursors;
</span><ins>+
+    RefPtr&lt;JSC::VM&gt; m_vm;
+    JSC::Strong&lt;JSC::JSGlobalObject&gt; m_globalObject;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span></span></pre>
</div>
</div>

</body>
</html>