<!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>[205041] 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/205041">205041</a></dd>
<dt>Author</dt> <dd>joepeck@webkit.org</dd>
<dt>Date</dt> <dd>2016-08-26 13:59:09 -0700 (Fri, 26 Aug 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Web Inspector: Provide a way to clear an IndexedDB object store
https://bugs.webkit.org/show_bug.cgi?id=161167
&lt;rdar://problem/27996932&gt;

Reviewed by Brian Burg.

Source/JavaScriptCore:

* inspector/protocol/IndexedDB.json:
Cleanup the protocol file.

Source/WebCore:

Test: inspector/indexeddb/clearObjectStore.html

* inspector/InspectorIndexedDBAgent.cpp:
Make the transaction for clearing an object store readwrite
instead of readonly, and activate it.

Source/WebInspectorUI:

* Localizations/en.lproj/localizedStrings.js:
&quot;Clear object store&quot;.

* UserInterface/Controllers/StorageManager.js:
(WebInspector.StorageManager.prototype.clearObjectStore):
Provide a wrapper for clearing an object store.

* UserInterface/Views/IndexedDatabaseObjectStoreContentView.js:
(WebInspector.IndexedDatabaseObjectStoreContentView):
(WebInspector.IndexedDatabaseObjectStoreContentView.prototype.get navigationItems):
(WebInspector.IndexedDatabaseObjectStoreContentView.prototype._clearButtonClicked):
Add a navigation button on ObjectStore content views to clear the object store.

LayoutTests:

* inspector/indexeddb/clearObjectStore-expected.txt: Added.
* inspector/indexeddb/clearObjectStore.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorprotocolIndexedDBjson">trunk/Source/JavaScriptCore/inspector/protocol/IndexedDB.json</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorIndexedDBAgentcpp">trunk/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp</a></li>
<li><a href="#trunkSourceWebInspectorUIChangeLog">trunk/Source/WebInspectorUI/ChangeLog</a></li>
<li><a href="#trunkSourceWebInspectorUILocalizationsenlprojlocalizedStringsjs">trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceControllersStorageManagerjs">trunk/Source/WebInspectorUI/UserInterface/Controllers/StorageManager.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsIndexedDatabaseObjectStoreContentViewjs">trunk/Source/WebInspectorUI/UserInterface/Views/IndexedDatabaseObjectStoreContentView.js</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsinspectorindexeddbclearObjectStoreexpectedtxt">trunk/LayoutTests/inspector/indexeddb/clearObjectStore-expected.txt</a></li>
<li><a href="#trunkLayoutTestsinspectorindexeddbclearObjectStorehtml">trunk/LayoutTests/inspector/indexeddb/clearObjectStore.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (205040 => 205041)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-08-26 20:59:04 UTC (rev 205040)
+++ trunk/LayoutTests/ChangeLog        2016-08-26 20:59:09 UTC (rev 205041)
</span><span class="lines">@@ -1,5 +1,16 @@
</span><span class="cx"> 2016-08-25  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Web Inspector: Provide a way to clear an IndexedDB object store
+        https://bugs.webkit.org/show_bug.cgi?id=161167
+        &lt;rdar://problem/27996932&gt;
+
+        Reviewed by Brian Burg.
+
+        * inspector/indexeddb/clearObjectStore-expected.txt: Added.
+        * inspector/indexeddb/clearObjectStore.html: Added.
+
+2016-08-25  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
+
</ins><span class="cx">         Web Inspector: Test IndexedDB.requestDatabase
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=161122
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsinspectorindexeddbclearObjectStoreexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/inspector/indexeddb/clearObjectStore-expected.txt (0 => 205041)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/indexeddb/clearObjectStore-expected.txt                                (rev 0)
+++ trunk/LayoutTests/inspector/indexeddb/clearObjectStore-expected.txt        2016-08-26 20:59:09 UTC (rev 205041)
</span><span class="lines">@@ -0,0 +1,19 @@
</span><ins>+CONSOLE MESSAGE: line 18: Created Database 'CompleteDatabase'
+CONSOLE MESSAGE: line 9: Created Database 'EmptyDatabase'
+
+== Running test suite: IndexedDB.clearObjectStore
+-- Running test case: ClearDatabases
+-- Running test case: CreateDatabaseAndClearObjectStore
+PASS: 'Empty' object store should always be empty.
+PASS: 'Reviewers' object store should start with 4 entries.
+PASS: 'Stats' object store should start with 4 entries.
+PASS: 'Empty' object store should always be empty.
+PASS: 'Reviewers' object store should have been cleared.
+PASS: 'Stats' object store remain unchanged with 4 entries.
+PASS: 'Empty' object store should always be empty.
+PASS: 'Reviewers' object store should have been cleared.
+PASS: 'Stats' object store should have been cleared.
+
+-- Running test case: NoSuchObjectStore
+PASS: Should be an error attempting to clear an object store that does not exist.
+
</ins></span></pre></div>
<a id="trunkLayoutTestsinspectorindexeddbclearObjectStorehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/inspector/indexeddb/clearObjectStore.html (0 => 205041)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/indexeddb/clearObjectStore.html                                (rev 0)
+++ trunk/LayoutTests/inspector/indexeddb/clearObjectStore.html        2016-08-26 20:59:09 UTC (rev 205041)
</span><span class="lines">@@ -0,0 +1,89 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../http/tests/inspector/resources/inspector-test.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;resources/utilities.js&quot;&gt;&lt;/script&gt;
+&lt;script&gt;
+function test()
+{
+    let suite = InspectorTest.createAsyncSuite(&quot;IndexedDB.clearObjectStore&quot;);
+
+    suite.addTestCase({
+        name: &quot;ClearDatabases&quot;,
+        description: &quot;Remove any existing IndexedDB databases.&quot;,
+        test: (resolve, reject) =&gt; {
+            // FIXME: Remove any existing IndexedDB databases that might exist to workaround:
+            // &lt;https://webkit.org/b/148006&gt; Each test should run with its own clean data store
+            IndexedDBAgent.requestDatabaseNames(WebInspector.frameResourceManager.mainFrame.securityOrigin, (error, names) =&gt; {
+                InspectorTest.evaluateInPage(&quot;deleteDatabaseNames(&quot; + JSON.stringify(names) + &quot;)&quot;, resolve);
+            });
+        }
+    });
+
+    suite.addTestCase({
+        name: &quot;CreateDatabaseAndClearObjectStore&quot;,
+        description: &quot;Ensure that clearing an object store clears entries in that object store.&quot;,
+        test: (resolve, reject) =&gt; {
+            InspectorTest.evaluateInPage(&quot;createDatabaseWithStores('CompleteDatabase', 1)&quot;);
+            IndexedDBAgent.requestDatabase(WebInspector.frameResourceManager.mainFrame.securityOrigin, &quot;CompleteDatabase&quot;, (error, database) =&gt; {
+                InspectorTest.expectNoError(error);
+
+                function expectObjectStoreEntryCount(objectStore, expectedCount, message) {
+                    const securityOrigin = WebInspector.frameResourceManager.mainFrame.securityOrigin;
+                    const indexName = &quot;&quot;;
+                    const skipCount = 0;
+                    const pageSize = 10;
+                    IndexedDBAgent.requestData(securityOrigin, database.name, objectStore.name, indexName, skipCount, pageSize, (error, entries, hasMore) =&gt; {
+                        InspectorTest.expectNoError(error);
+                        InspectorTest.expectThat(entries.length === expectedCount, message);
+                    });
+                }
+
+                let securityOrigin = WebInspector.frameResourceManager.mainFrame.securityOrigin;
+                let [emptyObjectStore, reviewersObjectStore, statsObjectStore] = database.objectStores;
+
+                expectObjectStoreEntryCount(emptyObjectStore, 0, &quot;'Empty' object store should always be empty.&quot;);
+                expectObjectStoreEntryCount(reviewersObjectStore, 4, &quot;'Reviewers' object store should start with 4 entries.&quot;);
+                expectObjectStoreEntryCount(statsObjectStore, 4, &quot;'Stats' object store should start with 4 entries.&quot;);
+
+                IndexedDBAgent.clearObjectStore(securityOrigin, database.name, reviewersObjectStore.name, (error) =&gt; {
+                    InspectorTest.expectNoError(error);
+                });
+
+                expectObjectStoreEntryCount(emptyObjectStore, 0, &quot;'Empty' object store should always be empty.&quot;);
+                expectObjectStoreEntryCount(reviewersObjectStore, 0, &quot;'Reviewers' object store should have been cleared.&quot;);
+                expectObjectStoreEntryCount(statsObjectStore, 4, &quot;'Stats' object store remain unchanged with 4 entries.&quot;);
+
+                IndexedDBAgent.clearObjectStore(securityOrigin, database.name, statsObjectStore.name, (error) =&gt; {
+                    InspectorTest.expectNoError(error);
+                });
+
+                expectObjectStoreEntryCount(emptyObjectStore, 0, &quot;'Empty' object store should always be empty.&quot;);
+                expectObjectStoreEntryCount(reviewersObjectStore, 0, &quot;'Reviewers' object store should have been cleared.&quot;);
+                expectObjectStoreEntryCount(statsObjectStore, 0, &quot;'Stats' object store should have been cleared.&quot;);
+
+                InspectorBackend.runAfterPendingDispatches(resolve);
+            });
+        }
+    });
+
+    suite.addTestCase({
+        name: &quot;NoSuchObjectStore&quot;,
+        test: (resolve, reject) =&gt; {
+            InspectorTest.evaluateInPage(&quot;createEmptyDatabase('EmptyDatabase', 1)&quot;);
+            IndexedDBAgent.requestDatabase(WebInspector.frameResourceManager.mainFrame.securityOrigin, &quot;EmptyDatabase&quot;, (error, database) =&gt; {
+                IndexedDBAgent.clearObjectStore(WebInspector.frameResourceManager.mainFrame.securityOrigin, database.name, &quot;NoSuchObjectStore&quot;, (error) =&gt; {
+                    InspectorTest.expectThat(error, &quot;Should be an error attempting to clear an object store that does not exist.&quot;);
+                    resolve();
+                });
+            });
+        }
+    });
+
+    suite.runTestCasesAndFinish();
+}
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;runTest()&quot;&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (205040 => 205041)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2016-08-26 20:59:04 UTC (rev 205040)
+++ trunk/Source/JavaScriptCore/ChangeLog        2016-08-26 20:59:09 UTC (rev 205041)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2016-08-25  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
+
+        Web Inspector: Provide a way to clear an IndexedDB object store
+        https://bugs.webkit.org/show_bug.cgi?id=161167
+        &lt;rdar://problem/27996932&gt;
+
+        Reviewed by Brian Burg.
+
+        * inspector/protocol/IndexedDB.json:
+        Cleanup the protocol file.
+
</ins><span class="cx"> 2016-08-26  Devin Rousso  &lt;dcrousso+webkit@gmail.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Web Inspector: Some CSS selectors in the UI aren't escaped
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorprotocolIndexedDBjson"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/protocol/IndexedDB.json (205040 => 205041)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/protocol/IndexedDB.json        2016-08-26 20:59:04 UTC (rev 205040)
+++ trunk/Source/JavaScriptCore/inspector/protocol/IndexedDB.json        2016-08-26 20:59:09 UTC (rev 205041)
</span><span class="lines">@@ -90,6 +90,7 @@
</span><span class="cx">         },
</span><span class="cx">         {
</span><span class="cx">             &quot;name&quot;: &quot;requestDatabaseNames&quot;,
</span><ins>+            &quot;description&quot;: &quot;Requests database names for given security origin.&quot;,
</ins><span class="cx">             &quot;async&quot;: true,
</span><span class="cx">             &quot;parameters&quot;: [
</span><span class="cx">                 { &quot;name&quot;: &quot;securityOrigin&quot;, &quot;type&quot;: &quot;string&quot;, &quot;description&quot;: &quot;Security origin.&quot; }
</span><span class="lines">@@ -96,11 +97,11 @@
</span><span class="cx">             ],
</span><span class="cx">             &quot;returns&quot;: [
</span><span class="cx">                 { &quot;name&quot;: &quot;databaseNames&quot;, &quot;type&quot;: &quot;array&quot;, &quot;items&quot;: { &quot;type&quot;: &quot;string&quot; }, &quot;description&quot;: &quot;Database names for origin.&quot; }
</span><del>-            ],
-            &quot;description&quot;: &quot;Requests database names for given security origin.&quot;
</del><ins>+            ]
</ins><span class="cx">         },
</span><span class="cx">         {
</span><span class="cx">             &quot;name&quot;: &quot;requestDatabase&quot;,
</span><ins>+            &quot;description&quot;: &quot;Requests database with given name in given frame.&quot;,
</ins><span class="cx">             &quot;async&quot;: true,
</span><span class="cx">             &quot;parameters&quot;: [
</span><span class="cx">                 { &quot;name&quot;: &quot;securityOrigin&quot;, &quot;type&quot;: &quot;string&quot;, &quot;description&quot;: &quot;Security origin.&quot; },
</span><span class="lines">@@ -108,11 +109,11 @@
</span><span class="cx">             ],
</span><span class="cx">             &quot;returns&quot;: [
</span><span class="cx">                 { &quot;name&quot;: &quot;databaseWithObjectStores&quot;, &quot;$ref&quot;: &quot;DatabaseWithObjectStores&quot;, &quot;description&quot;: &quot;Database with an array of object stores.&quot; }
</span><del>-            ],
-            &quot;description&quot;: &quot;Requests database with given name in given frame.&quot;
</del><ins>+            ]
</ins><span class="cx">         },
</span><span class="cx">         {
</span><span class="cx">             &quot;name&quot;: &quot;requestData&quot;,
</span><ins>+            &quot;description&quot;: &quot;Requests data from object store or index.&quot;,
</ins><span class="cx">             &quot;async&quot;: true,
</span><span class="cx">             &quot;parameters&quot;: [
</span><span class="cx">                 { &quot;name&quot;: &quot;securityOrigin&quot;, &quot;type&quot;: &quot;string&quot;, &quot;description&quot;: &quot;Security origin.&quot; },
</span><span class="lines">@@ -126,20 +127,17 @@
</span><span class="cx">             &quot;returns&quot;: [
</span><span class="cx">                 { &quot;name&quot;: &quot;objectStoreDataEntries&quot;, &quot;type&quot;: &quot;array&quot;, &quot;items&quot;: { &quot;$ref&quot;: &quot;DataEntry&quot; }, &quot;description&quot;: &quot;Array of object store data entries.&quot; },
</span><span class="cx">                 { &quot;name&quot;: &quot;hasMore&quot;, &quot;type&quot;: &quot;boolean&quot;, &quot;description&quot;: &quot;If true, there are more entries to fetch in the given range.&quot; }
</span><del>-            ],
-            &quot;description&quot;: &quot;Requests data from object store or index.&quot;
</del><ins>+            ]
</ins><span class="cx">         },
</span><span class="cx">         {
</span><span class="cx">             &quot;name&quot;: &quot;clearObjectStore&quot;,
</span><ins>+            &quot;description&quot;: &quot;Clears all entries from an object store.&quot;,
</ins><span class="cx">             &quot;async&quot;: true,
</span><span class="cx">             &quot;parameters&quot;: [
</span><span class="cx">                 { &quot;name&quot;: &quot;securityOrigin&quot;, &quot;type&quot;: &quot;string&quot;, &quot;description&quot;: &quot;Security origin.&quot; },
</span><span class="cx">                 { &quot;name&quot;: &quot;databaseName&quot;, &quot;type&quot;: &quot;string&quot;, &quot;description&quot;: &quot;Database name.&quot; },
</span><span class="cx">                 { &quot;name&quot;: &quot;objectStoreName&quot;, &quot;type&quot;: &quot;string&quot;, &quot;description&quot;: &quot;Object store name.&quot; }
</span><del>-            ],
-            &quot;returns&quot;: [
-            ],
-            &quot;description&quot;: &quot;Clears all entries from an object store.&quot;
</del><ins>+            ]
</ins><span class="cx">         }
</span><span class="cx">     ]
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (205040 => 205041)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-08-26 20:59:04 UTC (rev 205040)
+++ trunk/Source/WebCore/ChangeLog        2016-08-26 20:59:09 UTC (rev 205041)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2016-08-25  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
+
+        Web Inspector: Provide a way to clear an IndexedDB object store
+        https://bugs.webkit.org/show_bug.cgi?id=161167
+        &lt;rdar://problem/27996932&gt;
+
+        Reviewed by Brian Burg.
+
+        Test: inspector/indexeddb/clearObjectStore.html
+
+        * inspector/InspectorIndexedDBAgent.cpp:
+        Make the transaction for clearing an object store readwrite
+        instead of readonly, and activate it.
+
</ins><span class="cx"> 2016-08-26  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Calling crossOriginWindow.toString() should not be allowed
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorIndexedDBAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp (205040 => 205041)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp        2016-08-26 20:59:04 UTC (rev 205040)
+++ trunk/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp        2016-08-26 20:59:09 UTC (rev 205041)
</span><span class="lines">@@ -477,6 +477,7 @@
</span><span class="cx">             m_requestCallback-&gt;sendFailure(&quot;Could not get transaction&quot;);
</span><span class="cx">             return;
</span><span class="cx">         }
</span><ins>+
</ins><span class="cx">         RefPtr&lt;IDBObjectStore&gt; idbObjectStore = objectStoreForTransaction(idbTransaction.get(), m_objectStoreName);
</span><span class="cx">         if (!idbObjectStore) {
</span><span class="cx">             m_requestCallback-&gt;sendFailure(&quot;Could not get object store&quot;);
</span><span class="lines">@@ -706,7 +707,7 @@
</span><span class="cx">         if (!requestCallback().isActive())
</span><span class="cx">             return;
</span><span class="cx"> 
</span><del>-        RefPtr&lt;IDBTransaction&gt; idbTransaction = transactionForDatabase(&amp;database, m_objectStoreName);
</del><ins>+        RefPtr&lt;IDBTransaction&gt; idbTransaction = transactionForDatabase(&amp;database, m_objectStoreName, IDBTransaction::modeReadWrite());
</ins><span class="cx">         if (!idbTransaction) {
</span><span class="cx">             m_requestCallback-&gt;sendFailure(&quot;Could not get transaction&quot;);
</span><span class="cx">             return;
</span><span class="lines">@@ -718,6 +719,7 @@
</span><span class="cx">             return;
</span><span class="cx">         }
</span><span class="cx"> 
</span><ins>+        TransactionActivator activator(idbTransaction.get());
</ins><span class="cx">         ExceptionCodeWithMessage ec;
</span><span class="cx">         JSC::ExecState* exec = context() ? context()-&gt;execState() : nullptr;
</span><span class="cx">         RefPtr&lt;IDBRequest&gt; idbRequest = exec ? idbObjectStore-&gt;clear(*exec, ec) : nullptr;
</span><span class="lines">@@ -726,6 +728,7 @@
</span><span class="cx">             m_requestCallback-&gt;sendFailure(String::format(&quot;Could not clear object store '%s': %d&quot;, m_objectStoreName.utf8().data(), ec.code));
</span><span class="cx">             return;
</span><span class="cx">         }
</span><ins>+
</ins><span class="cx">         idbTransaction-&gt;addEventListener(eventNames().completeEvent, ClearObjectStoreListener::create(m_requestCallback.copyRef()), false);
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/ChangeLog (205040 => 205041)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/ChangeLog        2016-08-26 20:59:04 UTC (rev 205040)
+++ trunk/Source/WebInspectorUI/ChangeLog        2016-08-26 20:59:09 UTC (rev 205041)
</span><span class="lines">@@ -1,3 +1,24 @@
</span><ins>+2016-08-25  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
+
+        Web Inspector: Provide a way to clear an IndexedDB object store
+        https://bugs.webkit.org/show_bug.cgi?id=161167
+        &lt;rdar://problem/27996932&gt;
+
+        Reviewed by Brian Burg.
+
+        * Localizations/en.lproj/localizedStrings.js:
+        &quot;Clear object store&quot;.
+
+        * UserInterface/Controllers/StorageManager.js:
+        (WebInspector.StorageManager.prototype.clearObjectStore):
+        Provide a wrapper for clearing an object store.
+
+        * UserInterface/Views/IndexedDatabaseObjectStoreContentView.js:
+        (WebInspector.IndexedDatabaseObjectStoreContentView):
+        (WebInspector.IndexedDatabaseObjectStoreContentView.prototype.get navigationItems):
+        (WebInspector.IndexedDatabaseObjectStoreContentView.prototype._clearButtonClicked):
+        Add a navigation button on ObjectStore content views to clear the object store.
+
</ins><span class="cx"> 2016-08-26  Devin Rousso  &lt;dcrousso+webkit@gmail.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Web Inspector: Some CSS selectors in the UI aren't escaped
</span></span></pre></div>
<a id="trunkSourceWebInspectorUILocalizationsenlprojlocalizedStringsjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js (205040 => 205041)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js        2016-08-26 20:59:04 UTC (rev 205040)
+++ trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js        2016-08-26 20:59:09 UTC (rev 205041)
</span><span class="lines">@@ -144,6 +144,7 @@
</span><span class="cx"> localizedStrings[&quot;Clear Timeline&quot;] = &quot;Clear Timeline&quot;;
</span><span class="cx"> localizedStrings[&quot;Clear focus&quot;] = &quot;Clear focus&quot;;
</span><span class="cx"> localizedStrings[&quot;Clear log (%s or %s)&quot;] = &quot;Clear log (%s or %s)&quot;;
</span><ins>+localizedStrings[&quot;Clear object store&quot;] = &quot;Clear object store&quot;;
</ins><span class="cx"> localizedStrings[&quot;Clear samples&quot;] = &quot;Clear samples&quot;;
</span><span class="cx"> localizedStrings[&quot;Clear watch expressions&quot;] = &quot;Clear watch expressions&quot;;
</span><span class="cx"> localizedStrings[&quot;Click Listener&quot;] = &quot;Click Listener&quot;;
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceControllersStorageManagerjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/StorageManager.js (205040 => 205041)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Controllers/StorageManager.js        2016-08-26 20:59:04 UTC (rev 205040)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/StorageManager.js        2016-08-26 20:59:09 UTC (rev 205041)
</span><span class="lines">@@ -138,8 +138,6 @@
</span><span class="cx">         this.dispatchEventToListeners(WebInspector.StorageManager.Event.DOMStorageObjectWasInspected, {domStorage});
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    // Protected
-
</del><span class="cx">     requestIndexedDatabaseData(objectStore, objectStoreIndex, startEntryIndex, maximumEntryCount, callback)
</span><span class="cx">     {
</span><span class="cx">         console.assert(window.IndexedDBAgent);
</span><span class="lines">@@ -178,6 +176,15 @@
</span><span class="cx">         IndexedDBAgent.requestData.invoke(requestArguments, processData);
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    clearObjectStore(objectStore)
+    {
+        let securityOrigin = objectStore.parentDatabase.securityOrigin;
+        let databaseName = objectStore.parentDatabase.name;
+        let objectStoreName = objectStore.name;
+
+        IndexedDBAgent.clearObjectStore(securityOrigin, databaseName, objectStoreName);
+    }
+
</ins><span class="cx">     // Private
</span><span class="cx"> 
</span><span class="cx">     _domStorageForIdentifier(id)
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsIndexedDatabaseObjectStoreContentViewjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/IndexedDatabaseObjectStoreContentView.js (205040 => 205041)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/IndexedDatabaseObjectStoreContentView.js        2016-08-26 20:59:04 UTC (rev 205040)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/IndexedDatabaseObjectStoreContentView.js        2016-08-26 20:59:09 UTC (rev 205041)
</span><span class="lines">@@ -79,6 +79,9 @@
</span><span class="cx"> 
</span><span class="cx">         this._refreshButtonNavigationItem = new WebInspector.ButtonNavigationItem(&quot;indexed-database-object-store-refresh&quot;, WebInspector.UIString(&quot;Refresh&quot;), &quot;Images/ReloadFull.svg&quot;, 13, 13);
</span><span class="cx">         this._refreshButtonNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._refreshButtonClicked, this);
</span><ins>+
+        this._clearButtonNavigationItem = new WebInspector.ButtonNavigationItem(&quot;indexed-database-object-store-clear&quot;, WebInspector.UIString(&quot;Clear object store&quot;), &quot;Images/NavigationItemTrash.svg&quot;, 15, 15);
+        this._clearButtonNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._clearButtonClicked, this);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // Public
</span><span class="lines">@@ -85,7 +88,7 @@
</span><span class="cx"> 
</span><span class="cx">     get navigationItems()
</span><span class="cx">     {
</span><del>-        return [this._refreshButtonNavigationItem];
</del><ins>+        return [this._refreshButtonNavigationItem, this._clearButtonNavigationItem];
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     closed()
</span><span class="lines">@@ -160,4 +163,10 @@
</span><span class="cx">         this._reset();
</span><span class="cx">         this._fetchMoreData();
</span><span class="cx">     }
</span><ins>+
+    _clearButtonClicked()
+    {
+        WebInspector.storageManager.clearObjectStore(this._objectStore);
+        this._reset();
+    }
</ins><span class="cx"> };
</span></span></pre>
</div>
</div>

</body>
</html>