<!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>[164051] trunk/Source</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/164051">164051</a></dd>
<dt>Author</dt> <dd>timothy@apple.com</dd>
<dt>Date</dt> <dd>2014-02-13 13:37:59 -0800 (Thu, 13 Feb 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Enable inspection of recently used IndexedDB databases.

https://bugs.webkit.org/show_bug.cgi?id=128687

Reviewed by Brady Eidson &amp; Joseph Pecoraro.

Source/WebCore:

* Modules/indexeddb/IDBFactory.cpp:
(WebCore::IDBFactory::getDatabaseNames):
* Modules/indexeddb/IDBFactoryBackendInterface.h:
* Modules/indexeddb/leveldb/IDBFactoryBackendLevelDB.cpp:
(WebCore::IDBFactoryBackendLevelDB::getDatabaseNames):
* Modules/indexeddb/leveldb/IDBFactoryBackendLevelDB.h:
Fix up the arguments passed to getDatabaseNames.

* WebCore.xcodeproj/project.pbxproj:
Make DOMStringList.h private so WebKit2 can use it.

* inspector/InspectorIndexedDBAgent.cpp:
Modernize the loops and remove some PLATFORM(COCOA) ifdefs to
compile the code.

* inspector/protocol/IndexedDB.json: Use number for version to
allow larger values instead of clamping to int.

Source/WebKit2:

* WebProcess/Databases/IndexedDB/WebIDBFactoryBackend.cpp:
(WebKit::sharedRecentDatabaseNameMap):
(WebKit::combinedSecurityOriginIdentifier):
(WebKit::WebIDBFactoryBackend::WebIDBFactoryBackend):
(WebKit::WebIDBFactoryBackend::getDatabaseNames):
(WebKit::WebIDBFactoryBackend::open):
(WebKit::WebIDBFactoryBackend::deleteDatabase):
Keep track of recently used database names per security-origin pair.
Implement getDatabaseNames to return the recently used names.

* WebProcess/Databases/IndexedDB/WebIDBFactoryBackend.h:
Fix up the arguments passed to getDatabaseNames.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBFactorycpp">trunk/Source/WebCore/Modules/indexeddb/IDBFactory.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBFactoryBackendInterfaceh">trunk/Source/WebCore/Modules/indexeddb/IDBFactoryBackendInterface.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbleveldbIDBFactoryBackendLevelDBcpp">trunk/Source/WebCore/Modules/indexeddb/leveldb/IDBFactoryBackendLevelDB.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbleveldbIDBFactoryBackendLevelDBh">trunk/Source/WebCore/Modules/indexeddb/leveldb/IDBFactoryBackendLevelDB.h</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorIndexedDBAgentcpp">trunk/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorprotocolIndexedDBjson">trunk/Source/WebCore/inspector/protocol/IndexedDB.json</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2WebProcessDatabasesIndexedDBWebIDBFactoryBackendcpp">trunk/Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBFactoryBackend.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessDatabasesIndexedDBWebIDBFactoryBackendh">trunk/Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBFactoryBackend.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (164050 => 164051)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-02-13 21:26:01 UTC (rev 164050)
+++ trunk/Source/WebCore/ChangeLog        2014-02-13 21:37:59 UTC (rev 164051)
</span><span class="lines">@@ -1,3 +1,29 @@
</span><ins>+2014-02-12  Timothy Hatcher  &lt;timothy@apple.com&gt;
+
+        Enable inspection of recently used IndexedDB databases.
+
+        https://bugs.webkit.org/show_bug.cgi?id=128687
+
+        Reviewed by Brady Eidson &amp; Joseph Pecoraro.
+
+        * Modules/indexeddb/IDBFactory.cpp:
+        (WebCore::IDBFactory::getDatabaseNames):
+        * Modules/indexeddb/IDBFactoryBackendInterface.h:
+        * Modules/indexeddb/leveldb/IDBFactoryBackendLevelDB.cpp:
+        (WebCore::IDBFactoryBackendLevelDB::getDatabaseNames):
+        * Modules/indexeddb/leveldb/IDBFactoryBackendLevelDB.h:
+        Fix up the arguments passed to getDatabaseNames.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        Make DOMStringList.h private so WebKit2 can use it.
+
+        * inspector/InspectorIndexedDBAgent.cpp:
+        Modernize the loops and remove some PLATFORM(COCOA) ifdefs to
+        compile the code. 
+
+        * inspector/protocol/IndexedDB.json: Use number for version to
+        allow larger values instead of clamping to int.
+
</ins><span class="cx"> 2014-02-13  Chang Shu  &lt;cshu@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Copying (createMarkup) wrapping text results in space between wrapped lines stripped.
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBFactorycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBFactory.cpp (164050 => 164051)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBFactory.cpp        2014-02-13 21:26:01 UTC (rev 164050)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBFactory.cpp        2014-02-13 21:37:59 UTC (rev 164051)
</span><span class="lines">@@ -103,7 +103,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     RefPtr&lt;IDBRequest&gt; request = IDBRequest::create(context, IDBAny::create(this), 0);
</span><del>-    m_backend-&gt;getDatabaseNames(request, context-&gt;securityOrigin(), context, getIndexedDBDatabasePath(context));
</del><ins>+    m_backend-&gt;getDatabaseNames(request, *(context-&gt;securityOrigin()), *(context-&gt;topOrigin()), context, getIndexedDBDatabasePath(context));
</ins><span class="cx">     return request;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBFactoryBackendInterfaceh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBFactoryBackendInterface.h (164050 => 164051)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBFactoryBackendInterface.h        2014-02-13 21:26:01 UTC (rev 164050)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBFactoryBackendInterface.h        2014-02-13 21:37:59 UTC (rev 164051)
</span><span class="lines">@@ -59,7 +59,7 @@
</span><span class="cx">     static PassRefPtr&lt;IDBFactoryBackendInterface&gt; create(const String&amp; databaseDirectoryIdentifier);
</span><span class="cx">     virtual ~IDBFactoryBackendInterface() { }
</span><span class="cx"> 
</span><del>-    virtual void getDatabaseNames(PassRefPtr&lt;IDBCallbacks&gt;, PassRefPtr&lt;SecurityOrigin&gt;, ScriptExecutionContext*, const String&amp; dataDir) = 0;
</del><ins>+    virtual void getDatabaseNames(PassRefPtr&lt;IDBCallbacks&gt;, const SecurityOrigin&amp; openingOrigin, const SecurityOrigin&amp; mainFrameOrigin, ScriptExecutionContext*, const String&amp; dataDir) = 0;
</ins><span class="cx">     virtual void open(const String&amp; name, uint64_t version, int64_t transactionId, PassRefPtr&lt;IDBCallbacks&gt;, PassRefPtr&lt;IDBDatabaseCallbacks&gt;, const SecurityOrigin&amp; openingOrigin, const SecurityOrigin&amp; mainFrameOrigin) = 0;
</span><span class="cx">     virtual void deleteDatabase(const String&amp; name, const SecurityOrigin&amp; openingOrigin, const SecurityOrigin&amp; mainFrameOrigin, PassRefPtr&lt;IDBCallbacks&gt;, ScriptExecutionContext*, const String&amp; dataDir) = 0;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbleveldbIDBFactoryBackendLevelDBcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/leveldb/IDBFactoryBackendLevelDB.cpp (164050 => 164051)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/leveldb/IDBFactoryBackendLevelDB.cpp        2014-02-13 21:26:01 UTC (rev 164050)
+++ trunk/Source/WebCore/Modules/indexeddb/leveldb/IDBFactoryBackendLevelDB.cpp        2014-02-13 21:37:59 UTC (rev 164051)
</span><span class="lines">@@ -84,11 +84,10 @@
</span><span class="cx">     m_databaseBackendMap.remove(uniqueIdentifier);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void IDBFactoryBackendLevelDB::getDatabaseNames(PassRefPtr&lt;IDBCallbacks&gt; callbacks, PassRefPtr&lt;SecurityOrigin&gt; securityOrigin, ScriptExecutionContext*, const String&amp; dataDirectory)
</del><ins>+void IDBFactoryBackendLevelDB::getDatabaseNames(PassRefPtr&lt;IDBCallbacks&gt; callbacks, const SecurityOrigin&amp; openingOrigin, const SecurityOrigin&amp;, ScriptExecutionContext*, const String&amp; dataDirectory)
</ins><span class="cx"> {
</span><del>-    ASSERT(securityOrigin);
</del><span class="cx">     LOG(StorageAPI, &quot;IDBFactoryBackendLevelDB::getDatabaseNames&quot;);
</span><del>-    RefPtr&lt;IDBBackingStoreLevelDB&gt; backingStore = openBackingStore(*securityOrigin, dataDirectory);
</del><ins>+    RefPtr&lt;IDBBackingStoreLevelDB&gt; backingStore = openBackingStore(*openingOrigin, dataDirectory);
</ins><span class="cx">     if (!backingStore) {
</span><span class="cx">         callbacks-&gt;onError(IDBDatabaseError::create(IDBDatabaseException::UnknownError, &quot;Internal error opening backing store for indexedDB.webkitGetDatabaseNames.&quot;));
</span><span class="cx">         return;
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbleveldbIDBFactoryBackendLevelDBh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/leveldb/IDBFactoryBackendLevelDB.h (164050 => 164051)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/leveldb/IDBFactoryBackendLevelDB.h        2014-02-13 21:26:01 UTC (rev 164050)
+++ trunk/Source/WebCore/Modules/indexeddb/leveldb/IDBFactoryBackendLevelDB.h        2014-02-13 21:37:59 UTC (rev 164051)
</span><span class="lines">@@ -58,7 +58,7 @@
</span><span class="cx">     // Notifications from weak pointers.
</span><span class="cx">     virtual void removeIDBDatabaseBackend(const String&amp; uniqueIdentifier) override final;
</span><span class="cx"> 
</span><del>-    virtual void getDatabaseNames(PassRefPtr&lt;IDBCallbacks&gt;, PassRefPtr&lt;SecurityOrigin&gt;, ScriptExecutionContext*, const String&amp; dataDir) override final;
</del><ins>+    virtual void getDatabaseNames(PassRefPtr&lt;IDBCallbacks&gt;, const SecurityOrigin&amp; openingOrigin, const SecurityOrigin&amp; mainFrameOrigin, ScriptExecutionContext*, const String&amp; dataDir) override final;
</ins><span class="cx">     virtual void open(const String&amp; name, uint64_t version, int64_t transactionId, PassRefPtr&lt;IDBCallbacks&gt;, PassRefPtr&lt;IDBDatabaseCallbacks&gt;, const SecurityOrigin&amp; openingOrigin, const SecurityOrigin&amp; mainFrameOrigin) override final;
</span><span class="cx"> 
</span><span class="cx">     virtual void deleteDatabase(const String&amp; name, const SecurityOrigin&amp; openingOrigin, const SecurityOrigin&amp; mainFrameOrigin, PassRefPtr&lt;IDBCallbacks&gt;, ScriptExecutionContext*, const String&amp; dataDir) override final;
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (164050 => 164051)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-02-13 21:26:01 UTC (rev 164050)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-02-13 21:37:59 UTC (rev 164051)
</span><span class="lines">@@ -5388,7 +5388,7 @@
</span><span class="cx">                 C5160EEA1004543A00A7CEE2 /* StorageAreaImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C5160EE81004543A00A7CEE2 /* StorageAreaImpl.cpp */; };
</span><span class="cx">                 C5160EEB1004543A00A7CEE2 /* StorageAreaImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = C5160EE91004543A00A7CEE2 /* StorageAreaImpl.h */; };
</span><span class="cx">                 C5278B0C17F212EA003A2998 /* PlatformPasteboardIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = C5278B0B17F212EA003A2998 /* PlatformPasteboardIOS.mm */; };
</span><del>-                C544274B11A57E7A0063A749 /* DOMStringList.h in Headers */ = {isa = PBXBuildFile; fileRef = C544274911A57E7A0063A749 /* DOMStringList.h */; };
</del><ins>+                C544274B11A57E7A0063A749 /* DOMStringList.h in Headers */ = {isa = PBXBuildFile; fileRef = C544274911A57E7A0063A749 /* DOMStringList.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 C55610F111A704EB00B82D27 /* DOMStringList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C55610F011A704EB00B82D27 /* DOMStringList.cpp */; };
</span><span class="cx">                 C55C7BA11718AFBA001327E4 /* RenderThemeIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = C55C7BA01718AFBA001327E4 /* RenderThemeIOS.mm */; };
</span><span class="cx">                 C55E38BF10040D5D00A56BDB /* StorageNamespaceImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = C55E38BB10040D5D00A56BDB /* StorageNamespaceImpl.h */; };
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorIndexedDBAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp (164050 => 164051)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp        2014-02-13 21:26:01 UTC (rev 164050)
+++ trunk/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp        2014-02-13 21:37:59 UTC (rev 164051)
</span><span class="lines">@@ -238,7 +238,6 @@
</span><span class="cx">     return idbIndex;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#if !PLATFORM(COCOA)
</del><span class="cx"> static PassRefPtr&lt;KeyPath&gt; keyPathFromIDBKeyPath(const IDBKeyPath&amp; idbKeyPath)
</span><span class="cx"> {
</span><span class="cx">     RefPtr&lt;KeyPath&gt; keyPath;
</span><span class="lines">@@ -265,7 +264,6 @@
</span><span class="cx"> 
</span><span class="cx">     return keyPath.release();
</span><span class="cx"> }
</span><del>-#endif // !PLATFORM(COCOA)
</del><span class="cx"> 
</span><span class="cx"> class DatabaseLoader : public ExecutableWithDatabase {
</span><span class="cx"> public:
</span><span class="lines">@@ -278,9 +276,6 @@
</span><span class="cx"> 
</span><span class="cx">     virtual void execute(PassRefPtr&lt;IDBDatabase&gt; prpDatabase) override
</span><span class="cx">     {
</span><del>-#if PLATFORM(COCOA)
-        ASSERT_UNUSED(prpDatabase, prpDatabase);
-#else
</del><span class="cx">         RefPtr&lt;IDBDatabase&gt; idbDatabase = prpDatabase;
</span><span class="cx">         if (!requestCallback()-&gt;isActive())
</span><span class="cx">             return;
</span><span class="lines">@@ -289,14 +284,10 @@
</span><span class="cx"> 
</span><span class="cx">         RefPtr&lt;Inspector::TypeBuilder::Array&lt;Inspector::TypeBuilder::IndexedDB::ObjectStore&gt;&gt; objectStores = Inspector::TypeBuilder::Array&lt;Inspector::TypeBuilder::IndexedDB::ObjectStore&gt;::create();
</span><span class="cx"> 
</span><del>-        for (IDBDatabaseMetadata::ObjectStoreMap::const_iterator it = databaseMetadata.objectStores.begin(); it != databaseMetadata.objectStores.end(); ++it) {
-            const IDBObjectStoreMetadata&amp; objectStoreMetadata = it-&gt;value;
-
</del><ins>+        for (const IDBObjectStoreMetadata&amp; objectStoreMetadata : databaseMetadata.objectStores.values()) {
</ins><span class="cx">             RefPtr&lt;Inspector::TypeBuilder::Array&lt;Inspector::TypeBuilder::IndexedDB::ObjectStoreIndex&gt;&gt; indexes = Inspector::TypeBuilder::Array&lt;Inspector::TypeBuilder::IndexedDB::ObjectStoreIndex&gt;::create();
</span><span class="cx"> 
</span><del>-            for (IDBObjectStoreMetadata::IndexMap::const_iterator it = objectStoreMetadata.indexes.begin(); it != objectStoreMetadata.indexes.end(); ++it) {
-                const IDBIndexMetadata&amp; indexMetadata = it-&gt;value;
-
</del><ins>+            for (const IDBIndexMetadata&amp; indexMetadata : objectStoreMetadata.indexes.values()) {
</ins><span class="cx">                 RefPtr&lt;ObjectStoreIndex&gt; objectStoreIndex = ObjectStoreIndex::create()
</span><span class="cx">                     .setName(indexMetadata.name)
</span><span class="cx">                     .setKeyPath(keyPathFromIDBKeyPath(indexMetadata.keyPath))
</span><span class="lines">@@ -310,16 +301,16 @@
</span><span class="cx">                 .setKeyPath(keyPathFromIDBKeyPath(objectStoreMetadata.keyPath))
</span><span class="cx">                 .setAutoIncrement(objectStoreMetadata.autoIncrement)
</span><span class="cx">                 .setIndexes(indexes);
</span><ins>+
</ins><span class="cx">             objectStores-&gt;addItem(objectStore);
</span><span class="cx">         }
</span><ins>+
</ins><span class="cx">         RefPtr&lt;DatabaseWithObjectStores&gt; result = DatabaseWithObjectStores::create()
</span><span class="cx">             .setName(databaseMetadata.name)
</span><del>-            .setIntVersion(databaseMetadata.version)
-            .setVersion(String::number(databaseMetadata.version))
</del><ins>+            .setVersion(databaseMetadata.version)
</ins><span class="cx">             .setObjectStores(objectStores);
</span><span class="cx"> 
</span><span class="cx">         m_requestCallback-&gt;sendSuccess(result);
</span><del>-#endif // PLATFORM(COCOA)
</del><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     virtual RequestCallback* requestCallback() override { return m_requestCallback.get(); }
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorprotocolIndexedDBjson"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/protocol/IndexedDB.json (164050 => 164051)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/protocol/IndexedDB.json        2014-02-13 21:26:01 UTC (rev 164050)
+++ trunk/Source/WebCore/inspector/protocol/IndexedDB.json        2014-02-13 21:37:59 UTC (rev 164051)
</span><span class="lines">@@ -7,8 +7,7 @@
</span><span class="cx">             &quot;description&quot;: &quot;Database with an array of object stores.&quot;,
</span><span class="cx">             &quot;properties&quot;: [
</span><span class="cx">                 { &quot;name&quot;: &quot;name&quot;, &quot;type&quot;: &quot;string&quot;, &quot;description&quot;: &quot;Database name.&quot; },
</span><del>-                { &quot;name&quot;: &quot;version&quot;, &quot;type&quot;: &quot;string&quot;, &quot;description&quot;: &quot;Deprecated string database version.&quot; },
-                { &quot;name&quot;: &quot;intVersion&quot;, &quot;type&quot;: &quot;integer&quot;, &quot;description&quot;: &quot;Integer database version.&quot; },
</del><ins>+                { &quot;name&quot;: &quot;version&quot;, &quot;type&quot;: &quot;number&quot;, &quot;description&quot;: &quot;Database version.&quot; },
</ins><span class="cx">                 { &quot;name&quot;: &quot;objectStores&quot;, &quot;type&quot;: &quot;array&quot;, &quot;items&quot;: { &quot;$ref&quot;: &quot;ObjectStore&quot; }, &quot;description&quot;: &quot;Object stores in this database.&quot; }
</span><span class="cx">             ]
</span><span class="cx">         },
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (164050 => 164051)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-02-13 21:26:01 UTC (rev 164050)
+++ trunk/Source/WebKit2/ChangeLog        2014-02-13 21:37:59 UTC (rev 164051)
</span><span class="lines">@@ -1,3 +1,24 @@
</span><ins>+2014-02-12  Timothy Hatcher  &lt;timothy@apple.com&gt;
+
+        Enable inspection of recently used IndexedDB databases.
+
+        https://bugs.webkit.org/show_bug.cgi?id=128687
+
+        Reviewed by Brady Eidson &amp; Joseph Pecoraro.
+
+        * WebProcess/Databases/IndexedDB/WebIDBFactoryBackend.cpp:
+        (WebKit::sharedRecentDatabaseNameMap):
+        (WebKit::combinedSecurityOriginIdentifier):
+        (WebKit::WebIDBFactoryBackend::WebIDBFactoryBackend):
+        (WebKit::WebIDBFactoryBackend::getDatabaseNames):
+        (WebKit::WebIDBFactoryBackend::open):
+        (WebKit::WebIDBFactoryBackend::deleteDatabase):
+        Keep track of recently used database names per security-origin pair.
+        Implement getDatabaseNames to return the recently used names.
+
+        * WebProcess/Databases/IndexedDB/WebIDBFactoryBackend.h:
+        Fix up the arguments passed to getDatabaseNames.
+
</ins><span class="cx"> 2014-02-13  Anders Carlsson  &lt;andersca@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Fix build.
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessDatabasesIndexedDBWebIDBFactoryBackendcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBFactoryBackend.cpp (164050 => 164051)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBFactoryBackend.cpp        2014-02-13 21:26:01 UTC (rev 164050)
+++ trunk/Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBFactoryBackend.cpp        2014-02-13 21:37:59 UTC (rev 164051)
</span><span class="lines">@@ -32,6 +32,7 @@
</span><span class="cx"> #include &quot;WebIDBServerConnection.h&quot;
</span><span class="cx"> #include &quot;WebProcess.h&quot;
</span><span class="cx"> #include &quot;WebToDatabaseProcessConnection.h&quot;
</span><ins>+#include &lt;WebCore/DOMStringList.h&gt;
</ins><span class="cx"> #include &lt;WebCore/IDBCallbacks.h&gt;
</span><span class="cx"> #include &lt;WebCore/IDBCursorBackend.h&gt;
</span><span class="cx"> #include &lt;WebCore/IDBDatabaseCallbacks.h&gt;
</span><span class="lines">@@ -56,19 +57,59 @@
</span><span class="cx">     return databaseBackendMap;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static HashMap&lt;String, HashSet&lt;String&gt;&gt;&amp; sharedRecentDatabaseNameMap()
+{
+    static NeverDestroyed&lt;HashMap&lt;String, HashSet&lt;String&gt;&gt;&gt; recentDatabaseNameMap;
+    return recentDatabaseNameMap;
+}
+
+static String combinedSecurityOriginIdentifier(const WebCore::SecurityOrigin&amp; openingOrigin, const WebCore::SecurityOrigin&amp; mainFrameOrigin)
+{
+    StringBuilder stringBuilder;
+
+    String originString = openingOrigin.toString();
+    if (originString == &quot;null&quot;)
+        return String();
+    stringBuilder.append(originString);
+    stringBuilder.append(&quot;_&quot;);
+
+    originString = mainFrameOrigin.toString();
+    if (originString == &quot;null&quot;)
+        return String();
+    stringBuilder.append(originString);
+
+    return stringBuilder.toString();
+}
+
</ins><span class="cx"> WebIDBFactoryBackend::WebIDBFactoryBackend(const String&amp;)
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-
</del><span class="cx"> WebIDBFactoryBackend::~WebIDBFactoryBackend()
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebIDBFactoryBackend::getDatabaseNames(PassRefPtr&lt;IDBCallbacks&gt;, PassRefPtr&lt;SecurityOrigin&gt;, ScriptExecutionContext*, const String&amp;)
</del><ins>+void WebIDBFactoryBackend::getDatabaseNames(PassRefPtr&lt;IDBCallbacks&gt; callbacks, const SecurityOrigin&amp; openingOrigin, const SecurityOrigin&amp; mainFrameOrigin, ScriptExecutionContext* context, const String&amp;)
</ins><span class="cx"> {
</span><del>-    LOG_ERROR(&quot;IDBFactory::getDatabaseNames is no longer exposed to the web as javascript API and should be removed. It will be once we move the Web Inspector away of of it.&quot;);
-    notImplemented();
</del><ins>+    LOG(IDB, &quot;WebIDBFactoryBackend::getDatabaseNames&quot;);
+
+    String securityOriginIdentifier = combinedSecurityOriginIdentifier(openingOrigin, mainFrameOrigin);
+    if (securityOriginIdentifier.isEmpty()) {
+        callbacks-&gt;onError(IDBDatabaseError::create(IDBDatabaseException::InvalidAccessError, ASCIILiteral(&quot;Document is not allowed to use Indexed Databases&quot;)));
+        return;
+    }
+
+    auto recentNameIterator = sharedRecentDatabaseNameMap().find(securityOriginIdentifier);
+    if (recentNameIterator == sharedRecentDatabaseNameMap().end())
+        return;
+
+    RefPtr&lt;DOMStringList&gt; databaseNames = DOMStringList::create();
+
+    HashSet&lt;String&gt;&amp; foundNames = recentNameIterator-&gt;value;
+    for (const String&amp; name : foundNames)
+        databaseNames-&gt;append(name);
+
+    callbacks-&gt;onSuccess(databaseNames.release());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebIDBFactoryBackend::open(const String&amp; databaseName, uint64_t version, int64_t transactionId, PassRefPtr&lt;IDBCallbacks&gt; callbacks, PassRefPtr&lt;IDBDatabaseCallbacks&gt; databaseCallbacks, const SecurityOrigin&amp; openingOrigin, const SecurityOrigin&amp; mainFrameOrigin)
</span><span class="lines">@@ -82,6 +123,17 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    String securityOriginIdentifier = combinedSecurityOriginIdentifier(openingOrigin, mainFrameOrigin);
+    ASSERT(!securityOriginIdentifier.isEmpty());
+
+    auto recentNameIterator = sharedRecentDatabaseNameMap().find(securityOriginIdentifier);
+    if (recentNameIterator == sharedRecentDatabaseNameMap().end()) {
+        HashSet&lt;String&gt; names;
+        names.add(databaseName);
+        sharedRecentDatabaseNameMap().set(securityOriginIdentifier, names);
+    } else
+        recentNameIterator-&gt;value.add(databaseName);
+
</ins><span class="cx">     IDBDatabaseBackendMap::iterator it = sharedDatabaseBackendMap().find(databaseIdentifier);
</span><span class="cx"> 
</span><span class="cx">     RefPtr&lt;IDBDatabaseBackend&gt; databaseBackend;
</span><span class="lines">@@ -106,6 +158,16 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    String securityOriginIdentifier = combinedSecurityOriginIdentifier(openingOrigin, mainFrameOrigin);
+    ASSERT(!securityOriginIdentifier.isEmpty());
+
+    auto recentNameIterator = sharedRecentDatabaseNameMap().find(securityOriginIdentifier);
+    if (recentNameIterator != sharedRecentDatabaseNameMap().end()) {
+        recentNameIterator-&gt;value.remove(databaseName);
+        if (recentNameIterator-&gt;value.isEmpty())
+            sharedRecentDatabaseNameMap().remove(recentNameIterator);
+    }
+
</ins><span class="cx">     // If there's already a connection to the database, delete it directly.
</span><span class="cx">     IDBDatabaseBackendMap::iterator it = sharedDatabaseBackendMap().find(databaseIdentifier);
</span><span class="cx">     if (it != sharedDatabaseBackendMap().end()) {
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessDatabasesIndexedDBWebIDBFactoryBackendh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBFactoryBackend.h (164050 => 164051)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBFactoryBackend.h        2014-02-13 21:26:01 UTC (rev 164050)
+++ trunk/Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBFactoryBackend.h        2014-02-13 21:37:59 UTC (rev 164051)
</span><span class="lines">@@ -39,7 +39,7 @@
</span><span class="cx"> 
</span><span class="cx">     virtual ~WebIDBFactoryBackend();
</span><span class="cx"> 
</span><del>-    virtual void getDatabaseNames(PassRefPtr&lt;WebCore::IDBCallbacks&gt;, PassRefPtr&lt;WebCore::SecurityOrigin&gt;, WebCore::ScriptExecutionContext*, const String&amp; dataDir) override;
</del><ins>+    virtual void getDatabaseNames(PassRefPtr&lt;WebCore::IDBCallbacks&gt;, const WebCore::SecurityOrigin&amp; openingOrigin, const WebCore::SecurityOrigin&amp; mainFrameOrigin, WebCore::ScriptExecutionContext*, const String&amp; dataDir) override;
</ins><span class="cx">     virtual void open(const String&amp; name, uint64_t version, int64_t transactionId, PassRefPtr&lt;WebCore::IDBCallbacks&gt;, PassRefPtr&lt;WebCore::IDBDatabaseCallbacks&gt;, const WebCore::SecurityOrigin&amp; openingOrigin, const WebCore::SecurityOrigin&amp; mainFrameOrigin) override;
</span><span class="cx">     virtual void deleteDatabase(const String&amp; name, const WebCore::SecurityOrigin&amp; openingOrigin, const WebCore::SecurityOrigin&amp; mainFrameOrigin, PassRefPtr&lt;WebCore::IDBCallbacks&gt;, WebCore::ScriptExecutionContext*, const String&amp; dataDir) override;
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>