<!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 & 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 <timothy@apple.com>
+
+ Enable inspection of recently used IndexedDB databases.
+
+ https://bugs.webkit.org/show_bug.cgi?id=128687
+
+ Reviewed by Brady Eidson & 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 <cshu@webkit.org>
</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<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), 0);
</span><del>- m_backend->getDatabaseNames(request, context->securityOrigin(), context, getIndexedDBDatabasePath(context));
</del><ins>+ m_backend->getDatabaseNames(request, *(context->securityOrigin()), *(context->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<IDBFactoryBackendInterface> create(const String& databaseDirectoryIdentifier);
</span><span class="cx"> virtual ~IDBFactoryBackendInterface() { }
</span><span class="cx">
</span><del>- virtual void getDatabaseNames(PassRefPtr<IDBCallbacks>, PassRefPtr<SecurityOrigin>, ScriptExecutionContext*, const String& dataDir) = 0;
</del><ins>+ virtual void getDatabaseNames(PassRefPtr<IDBCallbacks>, const SecurityOrigin& openingOrigin, const SecurityOrigin& mainFrameOrigin, ScriptExecutionContext*, const String& dataDir) = 0;
</ins><span class="cx"> virtual void open(const String& name, uint64_t version, int64_t transactionId, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBDatabaseCallbacks>, const SecurityOrigin& openingOrigin, const SecurityOrigin& mainFrameOrigin) = 0;
</span><span class="cx"> virtual void deleteDatabase(const String& name, const SecurityOrigin& openingOrigin, const SecurityOrigin& mainFrameOrigin, PassRefPtr<IDBCallbacks>, ScriptExecutionContext*, const String& 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<IDBCallbacks> callbacks, PassRefPtr<SecurityOrigin> securityOrigin, ScriptExecutionContext*, const String& dataDirectory)
</del><ins>+void IDBFactoryBackendLevelDB::getDatabaseNames(PassRefPtr<IDBCallbacks> callbacks, const SecurityOrigin& openingOrigin, const SecurityOrigin&, ScriptExecutionContext*, const String& dataDirectory)
</ins><span class="cx"> {
</span><del>- ASSERT(securityOrigin);
</del><span class="cx"> LOG(StorageAPI, "IDBFactoryBackendLevelDB::getDatabaseNames");
</span><del>- RefPtr<IDBBackingStoreLevelDB> backingStore = openBackingStore(*securityOrigin, dataDirectory);
</del><ins>+ RefPtr<IDBBackingStoreLevelDB> backingStore = openBackingStore(*openingOrigin, dataDirectory);
</ins><span class="cx"> if (!backingStore) {
</span><span class="cx"> callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::UnknownError, "Internal error opening backing store for indexedDB.webkitGetDatabaseNames."));
</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& uniqueIdentifier) override final;
</span><span class="cx">
</span><del>- virtual void getDatabaseNames(PassRefPtr<IDBCallbacks>, PassRefPtr<SecurityOrigin>, ScriptExecutionContext*, const String& dataDir) override final;
</del><ins>+ virtual void getDatabaseNames(PassRefPtr<IDBCallbacks>, const SecurityOrigin& openingOrigin, const SecurityOrigin& mainFrameOrigin, ScriptExecutionContext*, const String& dataDir) override final;
</ins><span class="cx"> virtual void open(const String& name, uint64_t version, int64_t transactionId, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBDatabaseCallbacks>, const SecurityOrigin& openingOrigin, const SecurityOrigin& mainFrameOrigin) override final;
</span><span class="cx">
</span><span class="cx"> virtual void deleteDatabase(const String& name, const SecurityOrigin& openingOrigin, const SecurityOrigin& mainFrameOrigin, PassRefPtr<IDBCallbacks>, ScriptExecutionContext*, const String& 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<KeyPath> keyPathFromIDBKeyPath(const IDBKeyPath& idbKeyPath)
</span><span class="cx"> {
</span><span class="cx"> RefPtr<KeyPath> 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<IDBDatabase> prpDatabase) override
</span><span class="cx"> {
</span><del>-#if PLATFORM(COCOA)
- ASSERT_UNUSED(prpDatabase, prpDatabase);
-#else
</del><span class="cx"> RefPtr<IDBDatabase> idbDatabase = prpDatabase;
</span><span class="cx"> if (!requestCallback()->isActive())
</span><span class="cx"> return;
</span><span class="lines">@@ -289,14 +284,10 @@
</span><span class="cx">
</span><span class="cx"> RefPtr<Inspector::TypeBuilder::Array<Inspector::TypeBuilder::IndexedDB::ObjectStore>> objectStores = Inspector::TypeBuilder::Array<Inspector::TypeBuilder::IndexedDB::ObjectStore>::create();
</span><span class="cx">
</span><del>- for (IDBDatabaseMetadata::ObjectStoreMap::const_iterator it = databaseMetadata.objectStores.begin(); it != databaseMetadata.objectStores.end(); ++it) {
- const IDBObjectStoreMetadata& objectStoreMetadata = it->value;
-
</del><ins>+ for (const IDBObjectStoreMetadata& objectStoreMetadata : databaseMetadata.objectStores.values()) {
</ins><span class="cx"> RefPtr<Inspector::TypeBuilder::Array<Inspector::TypeBuilder::IndexedDB::ObjectStoreIndex>> indexes = Inspector::TypeBuilder::Array<Inspector::TypeBuilder::IndexedDB::ObjectStoreIndex>::create();
</span><span class="cx">
</span><del>- for (IDBObjectStoreMetadata::IndexMap::const_iterator it = objectStoreMetadata.indexes.begin(); it != objectStoreMetadata.indexes.end(); ++it) {
- const IDBIndexMetadata& indexMetadata = it->value;
-
</del><ins>+ for (const IDBIndexMetadata& indexMetadata : objectStoreMetadata.indexes.values()) {
</ins><span class="cx"> RefPtr<ObjectStoreIndex> 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->addItem(objectStore);
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> RefPtr<DatabaseWithObjectStores> 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->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"> "description": "Database with an array of object stores.",
</span><span class="cx"> "properties": [
</span><span class="cx"> { "name": "name", "type": "string", "description": "Database name." },
</span><del>- { "name": "version", "type": "string", "description": "Deprecated string database version." },
- { "name": "intVersion", "type": "integer", "description": "Integer database version." },
</del><ins>+ { "name": "version", "type": "number", "description": "Database version." },
</ins><span class="cx"> { "name": "objectStores", "type": "array", "items": { "$ref": "ObjectStore" }, "description": "Object stores in this database." }
</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 <timothy@apple.com>
+
+ Enable inspection of recently used IndexedDB databases.
+
+ https://bugs.webkit.org/show_bug.cgi?id=128687
+
+ Reviewed by Brady Eidson & 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 <andersca@apple.com>
</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 "WebIDBServerConnection.h"
</span><span class="cx"> #include "WebProcess.h"
</span><span class="cx"> #include "WebToDatabaseProcessConnection.h"
</span><ins>+#include <WebCore/DOMStringList.h>
</ins><span class="cx"> #include <WebCore/IDBCallbacks.h>
</span><span class="cx"> #include <WebCore/IDBCursorBackend.h>
</span><span class="cx"> #include <WebCore/IDBDatabaseCallbacks.h>
</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<String, HashSet<String>>& sharedRecentDatabaseNameMap()
+{
+ static NeverDestroyed<HashMap<String, HashSet<String>>> recentDatabaseNameMap;
+ return recentDatabaseNameMap;
+}
+
+static String combinedSecurityOriginIdentifier(const WebCore::SecurityOrigin& openingOrigin, const WebCore::SecurityOrigin& mainFrameOrigin)
+{
+ StringBuilder stringBuilder;
+
+ String originString = openingOrigin.toString();
+ if (originString == "null")
+ return String();
+ stringBuilder.append(originString);
+ stringBuilder.append("_");
+
+ originString = mainFrameOrigin.toString();
+ if (originString == "null")
+ return String();
+ stringBuilder.append(originString);
+
+ return stringBuilder.toString();
+}
+
</ins><span class="cx"> WebIDBFactoryBackend::WebIDBFactoryBackend(const String&)
</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<IDBCallbacks>, PassRefPtr<SecurityOrigin>, ScriptExecutionContext*, const String&)
</del><ins>+void WebIDBFactoryBackend::getDatabaseNames(PassRefPtr<IDBCallbacks> callbacks, const SecurityOrigin& openingOrigin, const SecurityOrigin& mainFrameOrigin, ScriptExecutionContext* context, const String&)
</ins><span class="cx"> {
</span><del>- LOG_ERROR("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.");
- notImplemented();
</del><ins>+ LOG(IDB, "WebIDBFactoryBackend::getDatabaseNames");
+
+ String securityOriginIdentifier = combinedSecurityOriginIdentifier(openingOrigin, mainFrameOrigin);
+ if (securityOriginIdentifier.isEmpty()) {
+ callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::InvalidAccessError, ASCIILiteral("Document is not allowed to use Indexed Databases")));
+ return;
+ }
+
+ auto recentNameIterator = sharedRecentDatabaseNameMap().find(securityOriginIdentifier);
+ if (recentNameIterator == sharedRecentDatabaseNameMap().end())
+ return;
+
+ RefPtr<DOMStringList> databaseNames = DOMStringList::create();
+
+ HashSet<String>& foundNames = recentNameIterator->value;
+ for (const String& name : foundNames)
+ databaseNames->append(name);
+
+ callbacks->onSuccess(databaseNames.release());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebIDBFactoryBackend::open(const String& databaseName, uint64_t version, int64_t transactionId, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<IDBDatabaseCallbacks> databaseCallbacks, const SecurityOrigin& openingOrigin, const SecurityOrigin& 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<String> names;
+ names.add(databaseName);
+ sharedRecentDatabaseNameMap().set(securityOriginIdentifier, names);
+ } else
+ recentNameIterator->value.add(databaseName);
+
</ins><span class="cx"> IDBDatabaseBackendMap::iterator it = sharedDatabaseBackendMap().find(databaseIdentifier);
</span><span class="cx">
</span><span class="cx"> RefPtr<IDBDatabaseBackend> 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->value.remove(databaseName);
+ if (recentNameIterator->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<WebCore::IDBCallbacks>, PassRefPtr<WebCore::SecurityOrigin>, WebCore::ScriptExecutionContext*, const String& dataDir) override;
</del><ins>+ virtual void getDatabaseNames(PassRefPtr<WebCore::IDBCallbacks>, const WebCore::SecurityOrigin& openingOrigin, const WebCore::SecurityOrigin& mainFrameOrigin, WebCore::ScriptExecutionContext*, const String& dataDir) override;
</ins><span class="cx"> virtual void open(const String& name, uint64_t version, int64_t transactionId, PassRefPtr<WebCore::IDBCallbacks>, PassRefPtr<WebCore::IDBDatabaseCallbacks>, const WebCore::SecurityOrigin& openingOrigin, const WebCore::SecurityOrigin& mainFrameOrigin) override;
</span><span class="cx"> virtual void deleteDatabase(const String& name, const WebCore::SecurityOrigin& openingOrigin, const WebCore::SecurityOrigin& mainFrameOrigin, PassRefPtr<WebCore::IDBCallbacks>, WebCore::ScriptExecutionContext*, const String& dataDir) override;
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>