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

<h3>Log Message</h3>
<pre>Web Inspector: Test and address issues in IndexedDB.requestData
https://bugs.webkit.org/show_bug.cgi?id=161178
&lt;rdar://problem/28002467&gt;

Reviewed by Brian Burg.

Source/WebCore:

Test: inspector/indexeddb/requestData.html

* inspector/InspectorIndexedDBAgent.cpp:
(idbKeyRangeFromKeyRange):
Parsing was too strict. &quot;lower&quot; and &quot;upper&quot; keys are optional.

(WebCore::DataLoader::execute):
Ensure the skip count is passed forward.

LayoutTests:

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

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorIndexedDBAgentcpp">trunk/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsinspectorindexeddbrequestDataexpectedtxt">trunk/LayoutTests/inspector/indexeddb/requestData-expected.txt</a></li>
<li><a href="#trunkLayoutTestsinspectorindexeddbrequestDatahtml">trunk/LayoutTests/inspector/indexeddb/requestData.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (205041 => 205042)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-08-26 20:59:09 UTC (rev 205041)
+++ trunk/LayoutTests/ChangeLog        2016-08-26 20:59:13 UTC (rev 205042)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2016-08-26  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
+
+        Web Inspector: Test and address issues in IndexedDB.requestData
+        https://bugs.webkit.org/show_bug.cgi?id=161178
+        &lt;rdar://problem/28002467&gt;
+
+        Reviewed by Brian Burg.
+
+        * inspector/indexeddb/requestData-expected.txt: Added.
+        * inspector/indexeddb/requestData.html: Added.
+
</ins><span class="cx"> 2016-08-25  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Web Inspector: Provide a way to clear an IndexedDB object store
</span></span></pre></div>
<a id="trunkLayoutTestsinspectorindexeddbrequestDataexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/inspector/indexeddb/requestData-expected.txt (0 => 205042)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/indexeddb/requestData-expected.txt                                (rev 0)
+++ trunk/LayoutTests/inspector/indexeddb/requestData-expected.txt        2016-08-26 20:59:13 UTC (rev 205042)
</span><span class="lines">@@ -0,0 +1,128 @@
</span><ins>+CONSOLE MESSAGE: line 18: Created Database 'Database1'
+CONSOLE MESSAGE: line 18: Created Database 'Database2'
+CONSOLE MESSAGE: line 18: Created Database 'Database3'
+
+== Running test suite: IndexedDB.requestData
+-- Running test case: ClearDatabases
+-- Running test case: RequestDataBasic
+-- No Index
+PASS: Should be 4 entries.
+PASS: Should not have more entries.
+PASS: Primary key should be ordered by primary key: 1
+PASS: Value should be a remote object for: 'Thirsty Hampster'
+PASS: Primary key should be ordered by primary key: 2
+PASS: Value should be a remote object for: 'Jamming Peacock'
+PASS: Primary key should be ordered by primary key: 3
+PASS: Value should be a remote object for: 'Bustling Badger'
+PASS: Primary key should be ordered by primary key: 4
+PASS: Value should be a remote object for: 'Monstrous Beaver'
+-- Name Index
+PASS: Should be 4 entries.
+PASS: Should not have more entries.
+PASS: Primary key should be ordered by name: 3
+PASS: Key should be ordered by name: 'Bustling Badger'
+PASS: Value should be a remote object for: 'Bustling Badger'
+PASS: Primary key should be ordered by name: 2
+PASS: Key should be ordered by name: 'Jamming Peacock'
+PASS: Value should be a remote object for: 'Jamming Peacock'
+PASS: Primary key should be ordered by name: 4
+PASS: Key should be ordered by name: 'Monstrous Beaver'
+PASS: Value should be a remote object for: 'Monstrous Beaver'
+PASS: Primary key should be ordered by name: 1
+PASS: Key should be ordered by name: 'Thirsty Hampster'
+PASS: Value should be a remote object for: 'Thirsty Hampster'
+-- Email Index
+PASS: Should be 4 entries.
+PASS: Should not have more entries.
+PASS: Primary key should be ordered by email: 3
+PASS: Key should be ordered by email: 'badger@webkit.org'
+PASS: Value should be a remote object for: 'Bustling Badger'
+PASS: Primary key should be ordered by email: 4
+PASS: Key should be ordered by email: 'beaver@webkit.org'
+PASS: Value should be a remote object for: 'Monstrous Beaver'
+FAIL: Primary key should be ordered by email: 2
+PASS: Key should be ordered by email: 'hampster@webkit.org'
+PASS: Value should be a remote object for: 'Thirsty Hampster'
+FAIL: Primary key should be ordered by email: 1
+PASS: Key should be ordered by email: 'peacock@webkit.org'
+PASS: Value should be a remote object for: 'Jamming Peacock'
+
+-- Running test case: RequestDataPagination
+-- Page 1
+PASS: Entries length should match page size.
+PASS: Should have more entries.
+PASS: Primary key should be ordered by primary key: 1
+PASS: Value should be a remote object for: 'Thirsty Hampster'
+PASS: Primary key should be ordered by primary key: 2
+PASS: Value should be a remote object for: 'Jamming Peacock'
+-- Page 2
+PASS: Entries length should match page size.
+PASS: Should not have more entries.
+PASS: Primary key should be ordered by primary key: 3
+PASS: Value should be a remote object for: 'Bustling Badger'
+PASS: Primary key should be ordered by primary key: 4
+PASS: Value should be a remote object for: 'Monstrous Beaver'
+
+-- Running test case: RequestDataKeyRangeBounds
+-- Keys &gt;= 'M'
+-- Lower Bound: 'M' (closed)
+-- Upper Bound: -
+PASS: Should be 2 entries.
+PASS: Should not have more entries.
+PASS: Primary key should be ordered by primary key: 4
+PASS: Value should be a remote object for: 'Monstrous Beaver'
+PASS: Primary key should be ordered by primary key: 1
+PASS: Value should be a remote object for: 'Thirsty Hampster'
+-- Keys &gt; 'M'
+-- Lower Bound: 'M' (open)
+-- Upper Bound: -
+PASS: Should be 2 entries.
+PASS: Should not have more entries.
+PASS: Primary key should be ordered by primary key: 4
+PASS: Value should be a remote object for: 'Monstrous Beaver'
+PASS: Primary key should be ordered by primary key: 1
+PASS: Value should be a remote object for: 'Thirsty Hampster'
+-- Keys &gt; 'Monstrous Beaver'
+-- Lower Bound: 'Monstrous Beaver' (open)
+-- Upper Bound: -
+PASS: Should be 1 entry.
+PASS: Should not have more entries.
+PASS: Primary key should be ordered by primary key: 1
+PASS: Value should be a remote object for: 'Thirsty Hampster'
+-- Keys &lt;= 'M'
+-- Lower Bound: -
+-- Upper Bound: 'M' (closed)
+PASS: Should be 2 entries.
+PASS: Should not have more entries.
+PASS: Primary key should be ordered by primary key: 3
+PASS: Value should be a remote object for: 'Bustling Badger'
+PASS: Primary key should be ordered by primary key: 2
+PASS: Value should be a remote object for: 'Jamming Peacock'
+-- Keys &lt;= 'Monstrous Beaver'
+-- Lower Bound: -
+-- Upper Bound: 'Monstrous Beaver' (closed)
+PASS: Should be 3 entries.
+PASS: Should not have more entries.
+PASS: Primary key should be ordered by primary key: 3
+PASS: Value should be a remote object for: 'Bustling Badger'
+PASS: Primary key should be ordered by primary key: 2
+PASS: Value should be a remote object for: 'Jamming Peacock'
+PASS: Primary key should be ordered by primary key: 4
+PASS: Value should be a remote object for: 'Monstrous Beaver'
+-- Keys &lt; 'M'
+-- Lower Bound: -
+-- Upper Bound: 'M' (open)
+PASS: Should be 2 entries.
+PASS: Should not have more entries.
+PASS: Primary key should be ordered by primary key: 3
+PASS: Value should be a remote object for: 'Bustling Badger'
+PASS: Primary key should be ordered by primary key: 2
+PASS: Value should be a remote object for: 'Jamming Peacock'
+-- 'Monstrous Beaver' &lt;= Key &lt;= 'Monstrous Beaver'
+-- Lower Bound: 'Monstrous Beaver' (closed)
+-- Upper Bound: 'Monstrous Beaver' (closed)
+PASS: Should be 1 entry.
+PASS: Should not have more entries.
+PASS: Primary key should be ordered by primary key: 4
+PASS: Value should be a remote object for: 'Monstrous Beaver'
+
</ins></span></pre></div>
<a id="trunkLayoutTestsinspectorindexeddbrequestDatahtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/inspector/indexeddb/requestData.html (0 => 205042)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/indexeddb/requestData.html                                (rev 0)
+++ trunk/LayoutTests/inspector/indexeddb/requestData.html        2016-08-26 20:59:13 UTC (rev 205042)
</span><span class="lines">@@ -0,0 +1,343 @@
</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()
+{
+    function objectPropertyPreview(remoteObject, name) {
+        for (let propertyPreview of remoteObject.preview.propertyPreviews) {
+            if (propertyPreview.name === name)
+                return propertyPreview;
+        }
+        return null;
+    }
+
+    let suite = InspectorTest.createAsyncSuite(&quot;IndexedDB.requestData&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;RequestDataBasic&quot;,
+        description: &quot;Request data for an object store with different indexes.&quot;,
+        test: (resolve, reject) =&gt; {
+            InspectorTest.evaluateInPage(&quot;createDatabaseWithStores('Database1', 1)&quot;);
+            IndexedDBAgent.requestDatabase(WebInspector.frameResourceManager.mainFrame.securityOrigin, &quot;Database1&quot;, (error, database) =&gt; {
+                InspectorTest.expectNoError(error);
+
+                let [emptyObjectStore, reviewersObjectStore, statsObjectStore] = database.objectStores;
+                const securityOrigin = WebInspector.frameResourceManager.mainFrame.securityOrigin;
+                const skipCount = 0;
+                const pageSize = 10;
+
+                let indexName = &quot;&quot;;
+                IndexedDBAgent.requestData(securityOrigin, database.name, reviewersObjectStore.name, indexName, skipCount, pageSize, (error, entries, hasMore) =&gt; {
+                    InspectorTest.log(&quot;-- No Index&quot;);
+                    InspectorTest.expectNoError(error);
+                    InspectorTest.expectThat(entries.length === 4, &quot;Should be 4 entries.&quot;);
+                    InspectorTest.expectThat(!hasMore, &quot;Should not have more entries.&quot;);
+
+                    let expectedPrimaryKeyOrder = [1, 2, 3, 4];
+                    let expectedNamesOrderedByPrimaryKey = [&quot;Thirsty Hampster&quot;, &quot;Jamming Peacock&quot;, &quot;Bustling Badger&quot;, &quot;Monstrous Beaver&quot;];
+                    for (let i = 0; i &lt; entries.length; ++i) {
+                        let entryPayload = entries[i];
+                        let primaryKey = WebInspector.RemoteObject.fromPayload(entryPayload.primaryKey);
+                        let value = WebInspector.RemoteObject.fromPayload(entryPayload.value);
+                        InspectorTest.expectThat(primaryKey.value === expectedPrimaryKeyOrder[i], `Primary key should be ordered by primary key: ${expectedPrimaryKeyOrder[i]}`);
+                        InspectorTest.expectThat(objectPropertyPreview(value, &quot;name&quot;).value === expectedNamesOrderedByPrimaryKey[i], `Value should be a remote object for: '${expectedNamesOrderedByPrimaryKey[i]}'`);
+                    }
+                });
+
+                indexName = &quot;Name Index&quot;;
+                IndexedDBAgent.requestData(securityOrigin, database.name, reviewersObjectStore.name, indexName, skipCount, pageSize, (error, entries, hasMore) =&gt; {
+                    InspectorTest.log(&quot;-- Name Index&quot;);
+                    InspectorTest.expectNoError(error);
+                    InspectorTest.expectThat(entries.length === 4, &quot;Should be 4 entries.&quot;);
+                    InspectorTest.expectThat(!hasMore, &quot;Should not have more entries.&quot;);
+
+                    let expectedPrimaryKeyOrder = [3, 2, 4, 1];
+                    let expectedKeysOrderedByName = [&quot;Bustling Badger&quot;, &quot;Jamming Peacock&quot;, &quot;Monstrous Beaver&quot;, &quot;Thirsty Hampster&quot;];
+                    let expectedNamesOrderedByName = expectedKeysOrderedByName;
+                    for (let i = 0; i &lt; entries.length; ++i) {
+                        let entryPayload = entries[i];
+                        let primaryKey = WebInspector.RemoteObject.fromPayload(entryPayload.primaryKey);
+                        let key = WebInspector.RemoteObject.fromPayload(entryPayload.key);
+                        let value = WebInspector.RemoteObject.fromPayload(entryPayload.value);
+                        InspectorTest.expectThat(primaryKey.value === expectedPrimaryKeyOrder[i], `Primary key should be ordered by name: ${expectedPrimaryKeyOrder[i]}`);
+                        InspectorTest.expectThat(key.value === expectedKeysOrderedByName[i], `Key should be ordered by name: '${expectedKeysOrderedByName[i]}'`);
+                        InspectorTest.expectThat(objectPropertyPreview(value, &quot;name&quot;).value === expectedNamesOrderedByName[i], `Value should be a remote object for: '${expectedNamesOrderedByName[i]}'`);
+                    }
+                });
+
+                indexName = &quot;Email Index&quot;;
+                IndexedDBAgent.requestData(securityOrigin, database.name, reviewersObjectStore.name, indexName, skipCount, pageSize, (error, entries, hasMore) =&gt; {
+                    InspectorTest.log(&quot;-- Email Index&quot;);
+                    InspectorTest.expectNoError(error);
+                    InspectorTest.expectThat(entries.length === 4, &quot;Should be 4 entries.&quot;);
+                    InspectorTest.expectThat(!hasMore, &quot;Should not have more entries.&quot;);
+
+                    let expectedPrimaryKeyOrder = [3, 4, 2, 1];
+                    let expectedKeysOrderedByEmail = [&quot;badger@webkit.org&quot;, &quot;beaver@webkit.org&quot;, &quot;hampster@webkit.org&quot;, &quot;peacock@webkit.org&quot;];
+                    let expectedNamesOrderedByEmail = [&quot;Bustling Badger&quot;, &quot;Monstrous Beaver&quot;, &quot;Thirsty Hampster&quot;, &quot;Jamming Peacock&quot;];
+                    for (let i = 0; i &lt; entries.length; ++i) {
+                        let entryPayload = entries[i];
+                        let primaryKey = WebInspector.RemoteObject.fromPayload(entryPayload.primaryKey);
+                        let key = WebInspector.RemoteObject.fromPayload(entryPayload.key);
+                        let value = WebInspector.RemoteObject.fromPayload(entryPayload.value);
+                        InspectorTest.expectThat(primaryKey.value === expectedPrimaryKeyOrder[i], `Primary key should be ordered by email: ${expectedPrimaryKeyOrder[i]}`);
+                        InspectorTest.expectThat(key.value === expectedKeysOrderedByEmail[i], `Key should be ordered by email: '${expectedKeysOrderedByEmail[i]}'`);
+                        InspectorTest.expectThat(objectPropertyPreview(value, &quot;name&quot;).value === expectedNamesOrderedByEmail[i], `Value should be a remote object for: '${expectedNamesOrderedByEmail[i]}'`);
+                    }
+                });
+
+                InspectorBackend.runAfterPendingDispatches(resolve);
+            });
+        }
+    });
+
+    suite.addTestCase({
+        name: &quot;RequestDataPagination&quot;,
+        description: &quot;Request data for an object store with paginated requests.&quot;,
+        test: (resolve, reject) =&gt; {
+            InspectorTest.evaluateInPage(&quot;createDatabaseWithStores('Database2', 1)&quot;);
+            IndexedDBAgent.requestDatabase(WebInspector.frameResourceManager.mainFrame.securityOrigin, &quot;Database2&quot;, (error, database) =&gt; {
+                InspectorTest.expectNoError(error);
+
+                let [emptyObjectStore, reviewersObjectStore, statsObjectStore] = database.objectStores;
+                const securityOrigin = WebInspector.frameResourceManager.mainFrame.securityOrigin;
+                const indexName = &quot;&quot;;
+                const pageSize = 2;
+
+                let skipCount = 0;
+                IndexedDBAgent.requestData(securityOrigin, database.name, reviewersObjectStore.name, indexName, skipCount, pageSize, (error, entries, hasMore) =&gt; {
+                    InspectorTest.log(&quot;-- Page 1&quot;);
+                    InspectorTest.expectNoError(error);
+                    InspectorTest.expectThat(entries.length === 2, &quot;Entries length should match page size.&quot;);
+                    InspectorTest.expectThat(hasMore, &quot;Should have more entries.&quot;);
+
+                    let expectedPrimaryKeyOrder = [1, 2];
+                    let expectedNamesOrderedByPrimaryKey = [&quot;Thirsty Hampster&quot;, &quot;Jamming Peacock&quot;];
+                    for (let i = 0; i &lt; entries.length; ++i) {
+                        let entryPayload = entries[i];
+                        let primaryKey = WebInspector.RemoteObject.fromPayload(entryPayload.primaryKey);
+                        let value = WebInspector.RemoteObject.fromPayload(entryPayload.value);
+                        InspectorTest.expectThat(primaryKey.value === expectedPrimaryKeyOrder[i], `Primary key should be ordered by primary key: ${expectedPrimaryKeyOrder[i]}`);
+                        InspectorTest.expectThat(objectPropertyPreview(value, &quot;name&quot;).value === expectedNamesOrderedByPrimaryKey[i], `Value should be a remote object for: '${expectedNamesOrderedByPrimaryKey[i]}'`);
+                    }
+                });
+
+                skipCount = 2;
+                IndexedDBAgent.requestData(securityOrigin, database.name, reviewersObjectStore.name, indexName, skipCount, pageSize, (error, entries, hasMore) =&gt; {
+                    InspectorTest.log(&quot;-- Page 2&quot;);
+                    InspectorTest.expectNoError(error);
+                    InspectorTest.expectThat(entries.length === 2, &quot;Entries length should match page size.&quot;);
+                    InspectorTest.expectThat(!hasMore, &quot;Should not have more entries.&quot;);
+
+                    let expectedPrimaryKeyOrder = [3, 4];
+                    let expectedNamesOrderedByPrimaryKey = [&quot;Bustling Badger&quot;, &quot;Monstrous Beaver&quot;];
+                    for (let i = 0; i &lt; entries.length; ++i) {
+                        let entryPayload = entries[i];
+                        let primaryKey = WebInspector.RemoteObject.fromPayload(entryPayload.primaryKey);
+                        let value = WebInspector.RemoteObject.fromPayload(entryPayload.value);
+                        InspectorTest.expectThat(primaryKey.value === expectedPrimaryKeyOrder[i], `Primary key should be ordered by primary key: ${expectedPrimaryKeyOrder[i]}`);
+                        InspectorTest.expectThat(objectPropertyPreview(value, &quot;name&quot;).value === expectedNamesOrderedByPrimaryKey[i], `Value should be a remote object for: '${expectedNamesOrderedByPrimaryKey[i]}'`);
+                    }
+                });
+
+                InspectorBackend.runAfterPendingDispatches(resolve);
+            });
+        }
+    });
+
+    suite.addTestCase({
+        name: &quot;RequestDataKeyRangeBounds&quot;,
+        description: &quot;Request key range bounded data for an object store.&quot;,
+        test: (resolve, reject) =&gt; {
+            InspectorTest.evaluateInPage(&quot;createDatabaseWithStores('Database3', 1)&quot;);
+            IndexedDBAgent.requestDatabase(WebInspector.frameResourceManager.mainFrame.securityOrigin, &quot;Database3&quot;, (error, database) =&gt; {
+                InspectorTest.expectNoError(error);
+
+                let [emptyObjectStore, reviewersObjectStore, statsObjectStore] = database.objectStores;
+                const securityOrigin = WebInspector.frameResourceManager.mainFrame.securityOrigin;
+                const indexName = &quot;Name Index&quot;;
+                const skipCount = 0;
+                const pageSize = 10;
+
+                function stringKeyWithString(string) {
+                    return {type: &quot;string&quot;, string};
+                }
+
+                // Index: Name Index
+                // Keys: [3, 2, 4, 1]
+                // Values: [&quot;Bustling Badger&quot;, &quot;Jamming Peacock&quot;, &quot;Monstrous Beaver&quot;, &quot;Thirsty Hampster&quot;];
+
+                // Keys &gt;= &quot;M&quot;
+                let keyRange = {lower: stringKeyWithString(&quot;M&quot;), lowerOpen: false, upperOpen: true};
+                IndexedDBAgent.requestData(securityOrigin, database.name, reviewersObjectStore.name, indexName, skipCount, pageSize, keyRange, (error, entries, hasMore) =&gt; {
+                    InspectorTest.log(&quot;-- Keys &gt;= 'M'&quot;);
+                    InspectorTest.log(&quot;-- Lower Bound: 'M' (closed)&quot;);
+                    InspectorTest.log(&quot;-- Upper Bound: -&quot;);
+                    InspectorTest.expectNoError(error);
+                    InspectorTest.expectThat(entries.length === 2, &quot;Should be 2 entries.&quot;);
+                    InspectorTest.expectThat(!hasMore, &quot;Should not have more entries.&quot;);
+
+                    let expectedPrimaryKeyOrder = [4, 1];
+                    let expectedNamesOrderedByPrimaryKey = [&quot;Monstrous Beaver&quot;, &quot;Thirsty Hampster&quot;];
+                    for (let i = 0; i &lt; entries.length; ++i) {
+                        let entryPayload = entries[i];
+                        let primaryKey = WebInspector.RemoteObject.fromPayload(entryPayload.primaryKey);
+                        let value = WebInspector.RemoteObject.fromPayload(entryPayload.value);
+                        InspectorTest.expectThat(primaryKey.value === expectedPrimaryKeyOrder[i], `Primary key should be ordered by primary key: ${expectedPrimaryKeyOrder[i]}`);
+                        InspectorTest.expectThat(objectPropertyPreview(value, &quot;name&quot;).value === expectedNamesOrderedByPrimaryKey[i], `Value should be a remote object for: '${expectedNamesOrderedByPrimaryKey[i]}'`);
+                    }
+                });
+
+                // Keys &gt; &quot;M&quot;
+                keyRange = {lower: stringKeyWithString(&quot;M&quot;), lowerOpen: true, upperOpen: true};
+                IndexedDBAgent.requestData(securityOrigin, database.name, reviewersObjectStore.name, indexName, skipCount, pageSize, keyRange, (error, entries, hasMore) =&gt; {
+                    InspectorTest.log(&quot;-- Keys &gt; 'M'&quot;);
+                    InspectorTest.log(&quot;-- Lower Bound: 'M' (open)&quot;);
+                    InspectorTest.log(&quot;-- Upper Bound: -&quot;);
+                    InspectorTest.expectNoError(error);
+                    InspectorTest.expectThat(entries.length === 2, &quot;Should be 2 entries.&quot;);
+                    InspectorTest.expectThat(!hasMore, &quot;Should not have more entries.&quot;);
+
+                    let expectedPrimaryKeyOrder = [4, 1];
+                    let expectedNamesOrderedByPrimaryKey = [&quot;Monstrous Beaver&quot;, &quot;Thirsty Hampster&quot;];
+                    for (let i = 0; i &lt; entries.length; ++i) {
+                        let entryPayload = entries[i];
+                        let primaryKey = WebInspector.RemoteObject.fromPayload(entryPayload.primaryKey);
+                        let value = WebInspector.RemoteObject.fromPayload(entryPayload.value);
+                        InspectorTest.expectThat(primaryKey.value === expectedPrimaryKeyOrder[i], `Primary key should be ordered by primary key: ${expectedPrimaryKeyOrder[i]}`);
+                        InspectorTest.expectThat(objectPropertyPreview(value, &quot;name&quot;).value === expectedNamesOrderedByPrimaryKey[i], `Value should be a remote object for: '${expectedNamesOrderedByPrimaryKey[i]}'`);
+                    }
+                });
+
+                // Keys &gt; &quot;Monstrous Beaver&quot;
+                keyRange = {lower: stringKeyWithString(&quot;Monstrous Beaver&quot;), lowerOpen: true, upperOpen: true};
+                IndexedDBAgent.requestData(securityOrigin, database.name, reviewersObjectStore.name, indexName, skipCount, pageSize, keyRange, (error, entries, hasMore) =&gt; {
+                    InspectorTest.log(&quot;-- Keys &gt; 'Monstrous Beaver'&quot;);
+                    InspectorTest.log(&quot;-- Lower Bound: 'Monstrous Beaver' (open)&quot;);
+                    InspectorTest.log(&quot;-- Upper Bound: -&quot;);
+                    InspectorTest.expectNoError(error);
+                    InspectorTest.expectThat(entries.length === 1, &quot;Should be 1 entry.&quot;);
+                    InspectorTest.expectThat(!hasMore, &quot;Should not have more entries.&quot;);
+
+                    let expectedPrimaryKeyOrder = [1];
+                    let expectedNamesOrderedByPrimaryKey = [&quot;Thirsty Hampster&quot;];
+                    for (let i = 0; i &lt; entries.length; ++i) {
+                        let entryPayload = entries[i];
+                        let primaryKey = WebInspector.RemoteObject.fromPayload(entryPayload.primaryKey);
+                        let value = WebInspector.RemoteObject.fromPayload(entryPayload.value);
+                        InspectorTest.expectThat(primaryKey.value === expectedPrimaryKeyOrder[i], `Primary key should be ordered by primary key: ${expectedPrimaryKeyOrder[i]}`);
+                        InspectorTest.expectThat(objectPropertyPreview(value, &quot;name&quot;).value === expectedNamesOrderedByPrimaryKey[i], `Value should be a remote object for: '${expectedNamesOrderedByPrimaryKey[i]}'`);
+                    }
+                });
+
+                // Keys &lt;= &quot;M&quot;
+                keyRange = {upper: stringKeyWithString(&quot;M&quot;), lowerOpen: true, upperOpen: false};
+                IndexedDBAgent.requestData(securityOrigin, database.name, reviewersObjectStore.name, indexName, skipCount, pageSize, keyRange, (error, entries, hasMore) =&gt; {
+                    InspectorTest.log(&quot;-- Keys &lt;= 'M'&quot;);
+                    InspectorTest.log(&quot;-- Lower Bound: -&quot;);
+                    InspectorTest.log(&quot;-- Upper Bound: 'M' (closed)&quot;);
+                    InspectorTest.expectNoError(error);
+                    InspectorTest.expectThat(entries.length === 2, &quot;Should be 2 entries.&quot;);
+                    InspectorTest.expectThat(!hasMore, &quot;Should not have more entries.&quot;);
+
+                    let expectedPrimaryKeyOrder = [3, 2];
+                    let expectedNamesOrderedByPrimaryKey = [&quot;Bustling Badger&quot;, &quot;Jamming Peacock&quot;];
+                    for (let i = 0; i &lt; entries.length; ++i) {
+                        let entryPayload = entries[i];
+                        let primaryKey = WebInspector.RemoteObject.fromPayload(entryPayload.primaryKey);
+                        let value = WebInspector.RemoteObject.fromPayload(entryPayload.value);
+                        InspectorTest.expectThat(primaryKey.value === expectedPrimaryKeyOrder[i], `Primary key should be ordered by primary key: ${expectedPrimaryKeyOrder[i]}`);
+                        InspectorTest.expectThat(objectPropertyPreview(value, &quot;name&quot;).value === expectedNamesOrderedByPrimaryKey[i], `Value should be a remote object for: '${expectedNamesOrderedByPrimaryKey[i]}'`);
+                    }
+                });
+
+                // Keys &lt;= &quot;Monstrous Beaver&quot;
+                keyRange = {upper: stringKeyWithString(&quot;Monstrous Beaver&quot;), lowerOpen: true, upperOpen: false};
+                IndexedDBAgent.requestData(securityOrigin, database.name, reviewersObjectStore.name, indexName, skipCount, pageSize, keyRange, (error, entries, hasMore) =&gt; {
+                    InspectorTest.log(&quot;-- Keys &lt;= 'Monstrous Beaver'&quot;);
+                    InspectorTest.log(&quot;-- Lower Bound: -&quot;);
+                    InspectorTest.log(&quot;-- Upper Bound: 'Monstrous Beaver' (closed)&quot;);
+                    InspectorTest.expectNoError(error);
+                    InspectorTest.expectThat(entries.length === 3, &quot;Should be 3 entries.&quot;);
+                    InspectorTest.expectThat(!hasMore, &quot;Should not have more entries.&quot;);
+
+                    let expectedPrimaryKeyOrder = [3, 2, 4];
+                    let expectedNamesOrderedByPrimaryKey = [&quot;Bustling Badger&quot;, &quot;Jamming Peacock&quot;, &quot;Monstrous Beaver&quot;];
+                    for (let i = 0; i &lt; entries.length; ++i) {
+                        let entryPayload = entries[i];
+                        let primaryKey = WebInspector.RemoteObject.fromPayload(entryPayload.primaryKey);
+                        let value = WebInspector.RemoteObject.fromPayload(entryPayload.value);
+                        InspectorTest.expectThat(primaryKey.value === expectedPrimaryKeyOrder[i], `Primary key should be ordered by primary key: ${expectedPrimaryKeyOrder[i]}`);
+                        InspectorTest.expectThat(objectPropertyPreview(value, &quot;name&quot;).value === expectedNamesOrderedByPrimaryKey[i], `Value should be a remote object for: '${expectedNamesOrderedByPrimaryKey[i]}'`);
+                    }
+                });
+
+                // Keys &lt; &quot;M&quot;
+                keyRange = {upper: stringKeyWithString(&quot;M&quot;), lowerOpen: true, upperOpen: true};
+                IndexedDBAgent.requestData(securityOrigin, database.name, reviewersObjectStore.name, indexName, skipCount, pageSize, keyRange, (error, entries, hasMore) =&gt; {
+                    InspectorTest.log(&quot;-- Keys &lt; 'M'&quot;);
+                    InspectorTest.log(&quot;-- Lower Bound: -&quot;);
+                    InspectorTest.log(&quot;-- Upper Bound: 'M' (open)&quot;);
+                    InspectorTest.expectNoError(error);
+                    InspectorTest.expectThat(entries.length === 2, &quot;Should be 2 entries.&quot;);
+                    InspectorTest.expectThat(!hasMore, &quot;Should not have more entries.&quot;);
+
+                    let expectedPrimaryKeyOrder = [3, 2];
+                    let expectedNamesOrderedByPrimaryKey = [&quot;Bustling Badger&quot;, &quot;Jamming Peacock&quot;];
+                    for (let i = 0; i &lt; entries.length; ++i) {
+                        let entryPayload = entries[i];
+                        let primaryKey = WebInspector.RemoteObject.fromPayload(entryPayload.primaryKey);
+                        let value = WebInspector.RemoteObject.fromPayload(entryPayload.value);
+                        InspectorTest.expectThat(primaryKey.value === expectedPrimaryKeyOrder[i], `Primary key should be ordered by primary key: ${expectedPrimaryKeyOrder[i]}`);
+                        InspectorTest.expectThat(objectPropertyPreview(value, &quot;name&quot;).value === expectedNamesOrderedByPrimaryKey[i], `Value should be a remote object for: '${expectedNamesOrderedByPrimaryKey[i]}'`);
+                    }
+                });
+
+                // &quot;Monstrous Beaver&quot; &lt;= Key &lt;= &quot;Monstrous Beaver&quot;
+                keyRange = {lower: stringKeyWithString(&quot;Monstrous Beaver&quot;), upper: stringKeyWithString(&quot;Monstrous Beaver&quot;), lowerOpen: false, upperOpen: false};
+                IndexedDBAgent.requestData(securityOrigin, database.name, reviewersObjectStore.name, indexName, skipCount, pageSize, keyRange, (error, entries, hasMore) =&gt; {
+                    InspectorTest.log(&quot;-- 'Monstrous Beaver' &lt;= Key &lt;= 'Monstrous Beaver'&quot;);
+                    InspectorTest.log(&quot;-- Lower Bound: 'Monstrous Beaver' (closed)&quot;);
+                    InspectorTest.log(&quot;-- Upper Bound: 'Monstrous Beaver' (closed)&quot;);
+                    InspectorTest.expectNoError(error);
+                    InspectorTest.expectThat(entries.length === 1, &quot;Should be 1 entry.&quot;);
+                    InspectorTest.expectThat(!hasMore, &quot;Should not have more entries.&quot;);
+
+                    let expectedPrimaryKeyOrder = [4];
+                    let expectedNamesOrderedByPrimaryKey = [&quot;Monstrous Beaver&quot;];
+                    for (let i = 0; i &lt; entries.length; ++i) {
+                        let entryPayload = entries[i];
+                        let primaryKey = WebInspector.RemoteObject.fromPayload(entryPayload.primaryKey);
+                        let value = WebInspector.RemoteObject.fromPayload(entryPayload.value);
+                        InspectorTest.expectThat(primaryKey.value === expectedPrimaryKeyOrder[i], `Primary key should be ordered by primary key: ${expectedPrimaryKeyOrder[i]}`);
+                        InspectorTest.expectThat(objectPropertyPreview(value, &quot;name&quot;).value === expectedNamesOrderedByPrimaryKey[i], `Value should be a remote object for: '${expectedNamesOrderedByPrimaryKey[i]}'`);
+                    }
+                });
+
+                InspectorBackend.runAfterPendingDispatches(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="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (205041 => 205042)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-08-26 20:59:09 UTC (rev 205041)
+++ trunk/Source/WebCore/ChangeLog        2016-08-26 20:59:13 UTC (rev 205042)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2016-08-26  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
+
+        Web Inspector: Test and address issues in IndexedDB.requestData
+        https://bugs.webkit.org/show_bug.cgi?id=161178
+        &lt;rdar://problem/28002467&gt;
+
+        Reviewed by Brian Burg.
+
+        Test: inspector/indexeddb/requestData.html
+
+        * inspector/InspectorIndexedDBAgent.cpp:
+        (idbKeyRangeFromKeyRange):
+        Parsing was too strict. &quot;lower&quot; and &quot;upper&quot; keys are optional.
+
+        (WebCore::DataLoader::execute):
+        Ensure the skip count is passed forward.
+
</ins><span class="cx"> 2016-08-25  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Web Inspector: Provide a way to clear an IndexedDB object store
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorIndexedDBAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp (205041 => 205042)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp        2016-08-26 20:59:09 UTC (rev 205041)
+++ trunk/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp        2016-08-26 20:59:13 UTC (rev 205042)
</span><span class="lines">@@ -335,19 +335,21 @@
</span><span class="cx"> 
</span><span class="cx"> static RefPtr&lt;IDBKeyRange&gt; idbKeyRangeFromKeyRange(const InspectorObject* keyRange)
</span><span class="cx"> {
</span><ins>+    RefPtr&lt;IDBKey&gt; idbLower;
</ins><span class="cx">     RefPtr&lt;InspectorObject&gt; lower;
</span><del>-    if (!keyRange-&gt;getObject(ASCIILiteral(&quot;lower&quot;), lower))
-        return nullptr;
-    RefPtr&lt;IDBKey&gt; idbLower = idbKeyFromInspectorObject(lower.get());
-    if (!idbLower)
-        return nullptr;
</del><ins>+    if (keyRange-&gt;getObject(ASCIILiteral(&quot;lower&quot;), lower)) {
+        idbLower = idbKeyFromInspectorObject(lower.get());
+        if (!idbLower)
+            return nullptr;
+    }
</ins><span class="cx"> 
</span><ins>+    RefPtr&lt;IDBKey&gt; idbUpper;
</ins><span class="cx">     RefPtr&lt;InspectorObject&gt; upper;
</span><del>-    if (!keyRange-&gt;getObject(ASCIILiteral(&quot;upper&quot;), upper))
-        return nullptr;
-    RefPtr&lt;IDBKey&gt; idbUpper = idbKeyFromInspectorObject(upper.get());
-    if (!idbUpper)
-        return nullptr;
</del><ins>+    if (keyRange-&gt;getObject(ASCIILiteral(&quot;upper&quot;), upper)) {
+        idbUpper = idbKeyFromInspectorObject(upper.get());
+        if (!idbUpper)
+            return nullptr;
+    }
</ins><span class="cx"> 
</span><span class="cx">     bool lowerOpen;
</span><span class="cx">     if (!keyRange-&gt;getBoolean(ASCIILiteral(&quot;lowerOpen&quot;), lowerOpen))
</span><span class="lines">@@ -504,7 +506,7 @@
</span><span class="cx">             return;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        Ref&lt;OpenCursorCallback&gt; openCursorCallback = OpenCursorCallback::create(m_injectedScript, m_requestCallback.copyRef(), 0, m_pageSize);
</del><ins>+        Ref&lt;OpenCursorCallback&gt; openCursorCallback = OpenCursorCallback::create(m_injectedScript, m_requestCallback.copyRef(), m_skipCount, m_pageSize);
</ins><span class="cx">         idbRequest-&gt;addEventListener(eventNames().successEvent, WTFMove(openCursorCallback), false);
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>