<!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>[202414] 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/202414">202414</a></dd>
<dt>Author</dt> <dd>beidson@apple.com</dd>
<dt>Date</dt> <dd>2016-06-23 21:08:48 -0700 (Thu, 23 Jun 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Retrieving Blobs from IndexedDB using cursors fails in WK2 (Sandboxing)
https://bugs.webkit.org/show_bug.cgi?id=158991
Reviewed by Alex Christensen.
Source/WebCore:
Test: storage/indexeddb/modern/blob-cursor.html
* platform/network/BlobDataFileReference.cpp:
(WebCore::BlobDataFileReference::startTrackingModifications): Deleted.
Source/WebKit2:
* CMakeLists.txt:
* WebKit2.xcodeproj/project.pbxproj:
* DatabaseProcess/DatabaseProcess.cpp:
(WebKit::DatabaseProcess::getSandboxExtensionsForBlobFiles):
(WebKit::DatabaseProcess::didGetSandboxExtensionsForBlobFiles):
* DatabaseProcess/DatabaseProcess.h:
* DatabaseProcess/IndexedDB/WebIDBConnectionToClient.cpp:
(WebKit::WebIDBConnectionToClient::handleGetResult): Handle creation of sandbox extensions
for any result that might contain blob values.
(WebKit::WebIDBConnectionToClient::didGetRecord):
(WebKit::WebIDBConnectionToClient::didOpenCursor):
(WebKit::WebIDBConnectionToClient::didIterateCursor):
* DatabaseProcess/IndexedDB/WebIDBConnectionToClient.h:
* Shared/Databases/IndexedDB/WebIDBResult.cpp: Added.
(WebKit::WebIDBResult::encode):
(WebKit::WebIDBResult::decode):
* Shared/Databases/IndexedDB/WebIDBResult.h: Added.
(WebKit::WebIDBResult::WebIDBResult):
(WebKit::WebIDBResult::resultData):
(WebKit::WebIDBResult::handles):
* Shared/SandboxExtension.h: Make SandboxExtension handles moveable.
* WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
(WebKit::preregisterSandboxExtensionsIfNecessary): Register sandbox extensions with the
Networking process for any result that might contain blob values.
(WebKit::WebIDBConnectionToServer::didGetRecord):
(WebKit::WebIDBConnectionToServer::didOpenCursor):
(WebKit::WebIDBConnectionToServer::didIterateCursor):
(WebKit::WebIDBConnectionToServer::didGetRecordWithSandboxExtensions): Deleted.
* WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h:
* WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.messages.in:
LayoutTests:
* storage/indexeddb/modern/blob-cursor-expected.txt: Added.
* storage/indexeddb/modern/blob-cursor.html: Added.
* storage/indexeddb/modern/resources/blob-cursor.js: Added.
* storage/indexeddb/modern/resources/blob-cursor1.html: Added.
* storage/indexeddb/modern/resources/blob-cursor2.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="#trunkSourceWebCoreplatformnetworkBlobDataFileReferencecpp">trunk/Source/WebCore/platform/network/BlobDataFileReference.cpp</a></li>
<li><a href="#trunkSourceWebKit2CMakeListstxt">trunk/Source/WebKit2/CMakeLists.txt</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2DatabaseProcessDatabaseProcesscpp">trunk/Source/WebKit2/DatabaseProcess/DatabaseProcess.cpp</a></li>
<li><a href="#trunkSourceWebKit2DatabaseProcessDatabaseProcessh">trunk/Source/WebKit2/DatabaseProcess/DatabaseProcess.h</a></li>
<li><a href="#trunkSourceWebKit2DatabaseProcessIndexedDBWebIDBConnectionToClientcpp">trunk/Source/WebKit2/DatabaseProcess/IndexedDB/WebIDBConnectionToClient.cpp</a></li>
<li><a href="#trunkSourceWebKit2DatabaseProcessIndexedDBWebIDBConnectionToClienth">trunk/Source/WebKit2/DatabaseProcess/IndexedDB/WebIDBConnectionToClient.h</a></li>
<li><a href="#trunkSourceWebKit2SharedSandboxExtensionh">trunk/Source/WebKit2/Shared/SandboxExtension.h</a></li>
<li><a href="#trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj">trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebKit2WebProcessDatabasesIndexedDBWebIDBConnectionToServercpp">trunk/Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessDatabasesIndexedDBWebIDBConnectionToServerh">trunk/Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessDatabasesIndexedDBWebIDBConnectionToServermessagesin">trunk/Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.messages.in</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsstorageindexeddbmodernblobcursorexpectedtxt">trunk/LayoutTests/storage/indexeddb/modern/blob-cursor-expected.txt</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmodernblobcursorhtml">trunk/LayoutTests/storage/indexeddb/modern/blob-cursor.html</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmodernresourcesblobcursorjs">trunk/LayoutTests/storage/indexeddb/modern/resources/blob-cursor.js</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmodernresourcesblobcursor1html">trunk/LayoutTests/storage/indexeddb/modern/resources/blob-cursor1.html</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmodernresourcesblobcursor2html">trunk/LayoutTests/storage/indexeddb/modern/resources/blob-cursor2.html</a></li>
<li><a href="#trunkSourceWebKit2SharedDatabasesIndexedDBWebIDBResultcpp">trunk/Source/WebKit2/Shared/Databases/IndexedDB/WebIDBResult.cpp</a></li>
<li><a href="#trunkSourceWebKit2SharedDatabasesIndexedDBWebIDBResulth">trunk/Source/WebKit2/Shared/Databases/IndexedDB/WebIDBResult.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (202413 => 202414)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-06-24 03:41:52 UTC (rev 202413)
+++ trunk/LayoutTests/ChangeLog        2016-06-24 04:08:48 UTC (rev 202414)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2016-06-23 Brady Eidson <beidson@apple.com>
+
+ Retrieving Blobs from IndexedDB using cursors fails in WK2 (Sandboxing)
+ https://bugs.webkit.org/show_bug.cgi?id=158991
+
+ Reviewed by Alex Christensen.
+
+ * storage/indexeddb/modern/blob-cursor-expected.txt: Added.
+ * storage/indexeddb/modern/blob-cursor.html: Added.
+ * storage/indexeddb/modern/resources/blob-cursor.js: Added.
+ * storage/indexeddb/modern/resources/blob-cursor1.html: Added.
+ * storage/indexeddb/modern/resources/blob-cursor2.html: Added.
+
</ins><span class="cx"> 2016-06-23 Joseph Pecoraro <pecoraro@apple.com> and Yusuke Suzuki <utatane.tea@gmail.com>
</span><span class="cx">
</span><span class="cx"> [JSC] Implement isFinite / isNaN in JS and make DFG ToNumber accept non number values
</span></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmodernblobcursorexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/storage/indexeddb/modern/blob-cursor-expected.txt (0 => 202414)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/blob-cursor-expected.txt         (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/modern/blob-cursor-expected.txt        2016-06-24 04:08:48 UTC (rev 202414)
</span><span class="lines">@@ -0,0 +1,13 @@
</span><ins>+Now let's retrieve the blobs using a cursor.
+Got item from cursor
+Got item from cursor
+Finished cursor
+blobResults.length is 2
+ Result 0 is [object Blob]
+ Result 1 is [object Blob]
+Image 0 loaded successfully
+Image 1 loaded successfully
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmodernblobcursorhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/storage/indexeddb/modern/blob-cursor.html (0 => 202414)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/blob-cursor.html         (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/modern/blob-cursor.html        2016-06-24 04:08:48 UTC (rev 202414)
</span><span class="lines">@@ -0,0 +1,13 @@
</span><ins>+<html>
+<body>
+<script>
+if (window.testRunner) {
+ testRunner.waitUntilDone();
+ testRunner.dumpAsText();
+ testRunner.setCanOpenWindows();
+ window.open("resources/blob-cursor1.html");
+}
+</script>
+<button id="button" onclick='window.open("resources/blob-cursor1.html", "childWindow");'>Click to start test in new window</button>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmodernresourcesblobcursorjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/storage/indexeddb/modern/resources/blob-cursor.js (0 => 202414)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/resources/blob-cursor.js         (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/modern/resources/blob-cursor.js        2016-06-24 04:08:48 UTC (rev 202414)
</span><span class="lines">@@ -0,0 +1,70 @@
</span><ins>+description("This tests that retrieving blobs via cursors works");
+
+indexedDBTest(prepareDatabase);
+
+var testGenerator;
+
+function continueWithEvent(event)
+{
+ testGenerator.next(event);
+}
+
+function asyncContinue()
+{
+ setTimeout("testGenerator.next();", 0);
+}
+
+function idbRequest(request)
+{
+ request.onerror = continueWithEvent;
+ request.onsuccess = continueWithEvent;
+}
+
+var db;
+
+function prepareDatabase(event)
+{
+ debug("Initial upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
+ debug(event.target.result.name);
+ db = event.target.result;
+ db.createObjectStore("TestObjectStore");
+ event.target.onsuccess = function() {
+ testGenerator = testSteps();
+ testGenerator.next();
+ };
+}
+
+function* testSteps()
+{
+ debug("Let's create an image blob and store it in IndexedDB.");
+
+ var imageURL = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAYAAABw4pVUAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCI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Xfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAALpJREFUeNrs0UEVABAURcHP5pcRSxpR9FHGhhycuQ3emxI9TnxQ7pxttfH6jhoCIiBABASIgAARECACIiBABASIgAARECACIiBABASIgAARECACIiBABASIgAARECACIiBABASIgAARECACIiBABASIgAARECACIiBABASIgAARECACIiBABASIgAARECACIiBABASIgAARECACAsQFQAQEiIAAERAgAgJEQAQEiIAAEZDPu
wAAAP//AwCf+AWUylJrCQAAAABJRU5ErkJggg==";
+
+ const [typePart, partRest] = imageURL.split(',');
+ const contentType = typePart.split(':')[1].split(';')[0];
+ const raw = atob(partRest);
+ const rawLength = raw.length;
+ const uInt8Array = new Uint8Array(rawLength);
+ for (let i = 0; i < rawLength; ++i)
+ uInt8Array[i] = raw.charCodeAt(i);
+
+ blob = new Blob([uInt8Array], { type: contentType });
+
+ var transaction = db.transaction("TestObjectStore", "readwrite");
+ transaction.oncomplete = continueWithEvent;
+
+ idbRequest(transaction.objectStore("TestObjectStore").add(blob, "foo"));
+ event = yield;
+ debug("Added blob to database once");
+
+ idbRequest(transaction.objectStore("TestObjectStore").add(blob, "bar"));
+ event = yield;
+ debug("Added blob to database twice");
+
+ event = yield;
+ debug("Transaction complete. Now let's navigate the original window to continue the test");
+
+ blob = null;
+
+ window.opener.location.href = "blob-cursor2.html";
+}
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmodernresourcesblobcursor1html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/storage/indexeddb/modern/resources/blob-cursor1.html (0 => 202414)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/resources/blob-cursor1.html         (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/modern/resources/blob-cursor1.html        2016-06-24 04:08:48 UTC (rev 202414)
</span><span class="lines">@@ -0,0 +1,9 @@
</span><ins>+<html>
+<head>
+<script src="../../../../resources/js-test.js"></script>
+<script src="../../resources/shared.js"></script>
+</head>
+<body>
+<script src="blob-cursor.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmodernresourcesblobcursor2html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/storage/indexeddb/modern/resources/blob-cursor2.html (0 => 202414)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/resources/blob-cursor2.html         (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/modern/resources/blob-cursor2.html        2016-06-24 04:08:48 UTC (rev 202414)
</span><span class="lines">@@ -0,0 +1,110 @@
</span><ins>+<script src="../../../../resources/js-test.js"></script>
+<script src="../../resources/shared.js"></script>
+<script>
+
+var child;
+
+function waitForChildToBeClosed()
+{
+ if (child && !child.closed) {
+ setTimeout(waitForChildToBeClosed, 0);
+ return;
+ }
+
+ if (window.testRunner) {
+ gc();
+ finishTheTest();
+ } else {
+ debug("The original blob object we created will go away after garbage collection. Since we can't reliably cause synchronous GC in the browser, we'll wait 5 seconds before continuing the test.");
+ setTimeout(finishTheTest, 5000);
+ }
+}
+
+child = window.open("", "childWindow");
+if (child) {
+ child.close();
+ setTimeout(waitForChildToBeClosed, 0);
+}
+
+var testGenerator;
+
+function continueWithEvent(event)
+{
+ testGenerator.next(event);
+}
+
+function asyncContinue()
+{
+ setTimeout("testGenerator.next();", 0);
+}
+
+function idbRequest(request)
+{
+ request.onerror = continueWithEvent;
+ request.onsuccess = continueWithEvent;
+}
+
+var db;
+
+function finishTheTest()
+{
+ request = window.indexedDB.open("blob-cursor1.html");
+ request.onsuccess = function(event) {
+ db = event.target.result;
+ testGenerator = testSteps();
+ testGenerator.next();
+ }
+}
+
+function* testSteps()
+{
+ debug("Now let's retrieve the blobs using a cursor.");
+
+ var blobResults = [];
+ objectStore = db.transaction("TestObjectStore").objectStore("TestObjectStore");
+ objectStore.openCursor().onsuccess = function(event) {
+ let cursor = event.target.result;
+ if (cursor) {
+ debug("Got item from cursor");
+ blobResults.push(cursor.value);
+ cursor.continue();
+ }
+ else {
+ debug("Finished cursor");
+ asyncContinue();
+ }
+ };
+
+ event = yield;
+ debug("blobResults.length is " + blobResults.length);
+
+ imageForBlob = function(index, blob) {
+ debug(" Result " + index + " is " + blob);
+
+ const url = URL.createObjectURL(blob);
+
+ img = document.createElement("img");
+ img.onload = function(event) {
+ debug("Image " + index + " loaded successfully");
+ URL.revokeObjectURL(url);
+ asyncContinue();
+ }
+ img.onerror = function(event) {
+ debug("Image " + index + " failed to load");
+ URL.revokeObjectURL(url);
+ asyncContinue();
+ }
+
+ img.src = url;
+ document.body.appendChild(img);
+ };
+
+ for (blob in blobResults)
+ imageForBlob(blob, blobResults[blob]);
+
+ yield;
+ yield;
+
+ finishJSTest();
+ }
+ </script>
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (202413 => 202414)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-06-24 03:41:52 UTC (rev 202413)
+++ trunk/Source/WebCore/ChangeLog        2016-06-24 04:08:48 UTC (rev 202414)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2016-06-23 Brady Eidson <beidson@apple.com>
+
+ Retrieving Blobs from IndexedDB using cursors fails in WK2 (Sandboxing)
+ https://bugs.webkit.org/show_bug.cgi?id=158991
+
+ Reviewed by Alex Christensen.
+
+ Test: storage/indexeddb/modern/blob-cursor.html
+
+ * platform/network/BlobDataFileReference.cpp:
+ (WebCore::BlobDataFileReference::startTrackingModifications): Deleted.
+
</ins><span class="cx"> 2016-06-23 Alex Christensen <achristensen@webkit.org>
</span><span class="cx">
</span><span class="cx"> Remove unused didCancelAuthenticationChallenge
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkBlobDataFileReferencecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/BlobDataFileReference.cpp (202413 => 202414)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/BlobDataFileReference.cpp        2016-06-24 03:41:52 UTC (rev 202413)
+++ trunk/Source/WebCore/platform/network/BlobDataFileReference.cpp        2016-06-24 04:08:48 UTC (rev 202414)
</span><span class="lines">@@ -90,8 +90,6 @@
</span><span class="cx"> // also used to pass paths around before registration. Only registered blobs need to pay
</span><span class="cx"> // the cost of tracking file modifications.
</span><span class="cx">
</span><del>- ASSERT(!isValidFileTime(m_expectedModificationTime));
-
</del><span class="cx"> #if ENABLE(FILE_REPLACEMENT)
</span><span class="cx"> m_replacementShouldBeGenerated = File::shouldReplaceFile(m_path);
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKit2CMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/CMakeLists.txt (202413 => 202414)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/CMakeLists.txt        2016-06-24 03:41:52 UTC (rev 202413)
+++ trunk/Source/WebKit2/CMakeLists.txt        2016-06-24 04:08:48 UTC (rev 202414)
</span><span class="lines">@@ -323,6 +323,7 @@
</span><span class="cx"> Shared/Databases/DatabaseProcessCreationParameters.cpp
</span><span class="cx">
</span><span class="cx"> Shared/Databases/IndexedDB/IDBUtilities.cpp
</span><ins>+ Shared/Databases/IndexedDB/WebIDBResult.cpp
</ins><span class="cx">
</span><span class="cx"> Shared/Plugins/NPIdentifierData.cpp
</span><span class="cx"> Shared/Plugins/NPObjectMessageReceiver.cpp
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (202413 => 202414)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2016-06-24 03:41:52 UTC (rev 202413)
+++ trunk/Source/WebKit2/ChangeLog        2016-06-24 04:08:48 UTC (rev 202414)
</span><span class="lines">@@ -1,3 +1,46 @@
</span><ins>+2016-06-23 Brady Eidson <beidson@apple.com>
+
+ Retrieving Blobs from IndexedDB using cursors fails in WK2 (Sandboxing)
+ https://bugs.webkit.org/show_bug.cgi?id=158991
+
+ Reviewed by Alex Christensen.
+
+ * CMakeLists.txt:
+ * WebKit2.xcodeproj/project.pbxproj:
+
+ * DatabaseProcess/DatabaseProcess.cpp:
+ (WebKit::DatabaseProcess::getSandboxExtensionsForBlobFiles):
+ (WebKit::DatabaseProcess::didGetSandboxExtensionsForBlobFiles):
+ * DatabaseProcess/DatabaseProcess.h:
+
+ * DatabaseProcess/IndexedDB/WebIDBConnectionToClient.cpp:
+ (WebKit::WebIDBConnectionToClient::handleGetResult): Handle creation of sandbox extensions
+ for any result that might contain blob values.
+ (WebKit::WebIDBConnectionToClient::didGetRecord):
+ (WebKit::WebIDBConnectionToClient::didOpenCursor):
+ (WebKit::WebIDBConnectionToClient::didIterateCursor):
+ * DatabaseProcess/IndexedDB/WebIDBConnectionToClient.h:
+
+ * Shared/Databases/IndexedDB/WebIDBResult.cpp: Added.
+ (WebKit::WebIDBResult::encode):
+ (WebKit::WebIDBResult::decode):
+ * Shared/Databases/IndexedDB/WebIDBResult.h: Added.
+ (WebKit::WebIDBResult::WebIDBResult):
+ (WebKit::WebIDBResult::resultData):
+ (WebKit::WebIDBResult::handles):
+
+ * Shared/SandboxExtension.h: Make SandboxExtension handles moveable.
+
+ * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
+ (WebKit::preregisterSandboxExtensionsIfNecessary): Register sandbox extensions with the
+ Networking process for any result that might contain blob values.
+ (WebKit::WebIDBConnectionToServer::didGetRecord):
+ (WebKit::WebIDBConnectionToServer::didOpenCursor):
+ (WebKit::WebIDBConnectionToServer::didIterateCursor):
+ (WebKit::WebIDBConnectionToServer::didGetRecordWithSandboxExtensions): Deleted.
+ * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h:
+ * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.messages.in:
+
</ins><span class="cx"> 2016-06-23 Alex Christensen <achristensen@webkit.org>
</span><span class="cx">
</span><span class="cx"> Remove unused didCancelAuthenticationChallenge
</span></span></pre></div>
<a id="trunkSourceWebKit2DatabaseProcessDatabaseProcesscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/DatabaseProcess/DatabaseProcess.cpp (202413 => 202414)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/DatabaseProcess/DatabaseProcess.cpp        2016-06-24 03:41:52 UTC (rev 202413)
+++ trunk/Source/WebKit2/DatabaseProcess/DatabaseProcess.cpp        2016-06-24 04:08:48 UTC (rev 202414)
</span><span class="lines">@@ -284,7 +284,7 @@
</span><span class="cx">
</span><span class="cx"> #endif
</span><span class="cx">
</span><del>-void DatabaseProcess::getSandboxExtensionsForBlobFiles(const Vector<String>& filenames, std::function<void (const SandboxExtension::HandleArray&)> completionHandler)
</del><ins>+void DatabaseProcess::getSandboxExtensionsForBlobFiles(const Vector<String>& filenames, std::function<void (SandboxExtension::HandleArray&&)> completionHandler)
</ins><span class="cx"> {
</span><span class="cx"> static uint64_t lastRequestID;
</span><span class="cx">
</span><span class="lines">@@ -293,10 +293,10 @@
</span><span class="cx"> parentProcessConnection()->send(Messages::DatabaseProcessProxy::GetSandboxExtensionsForBlobFiles(requestID, filenames), 0);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void DatabaseProcess::didGetSandboxExtensionsForBlobFiles(uint64_t requestID, const SandboxExtension::HandleArray& handles)
</del><ins>+void DatabaseProcess::didGetSandboxExtensionsForBlobFiles(uint64_t requestID, SandboxExtension::HandleArray&& handles)
</ins><span class="cx"> {
</span><span class="cx"> if (auto handler = m_sandboxExtensionForBlobsCompletionHandlers.take(requestID))
</span><del>- handler(handles);
</del><ins>+ handler(WTFMove(handles));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #if !PLATFORM(COCOA)
</span></span></pre></div>
<a id="trunkSourceWebKit2DatabaseProcessDatabaseProcessh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/DatabaseProcess/DatabaseProcess.h (202413 => 202414)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/DatabaseProcess/DatabaseProcess.h        2016-06-24 03:41:52 UTC (rev 202413)
+++ trunk/Source/WebKit2/DatabaseProcess/DatabaseProcess.h        2016-06-24 04:08:48 UTC (rev 202414)
</span><span class="lines">@@ -76,7 +76,7 @@
</span><span class="cx"> void accessToTemporaryFileComplete(const String& path) final;
</span><span class="cx"> #endif
</span><span class="cx">
</span><del>- void getSandboxExtensionsForBlobFiles(const Vector<String>& filenames, std::function<void (const SandboxExtension::HandleArray&)> completionHandler);
</del><ins>+ void getSandboxExtensionsForBlobFiles(const Vector<String>& filenames, std::function<void (SandboxExtension::HandleArray&&)> completionHandler);
</ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> DatabaseProcess();
</span><span class="lines">@@ -105,7 +105,7 @@
</span><span class="cx"> void deleteWebsiteDataForOrigins(WebCore::SessionID, OptionSet<WebsiteDataType> websiteDataTypes, const Vector<WebCore::SecurityOriginData>& origins, uint64_t callbackID);
</span><span class="cx"> void grantSandboxExtensionsForBlobs(const Vector<String>& paths, const SandboxExtension::HandleArray&);
</span><span class="cx">
</span><del>- void didGetSandboxExtensionsForBlobFiles(uint64_t requestID, const SandboxExtension::HandleArray&);
</del><ins>+ void didGetSandboxExtensionsForBlobFiles(uint64_t requestID, SandboxExtension::HandleArray&&);
</ins><span class="cx">
</span><span class="cx"> #if ENABLE(INDEXED_DATABASE)
</span><span class="cx"> Vector<RefPtr<WebCore::SecurityOrigin>> indexedDatabaseOrigins();
</span><span class="lines">@@ -124,7 +124,7 @@
</span><span class="cx"> RefPtr<WebCore::IDBServer::IDBServer> m_idbServer;
</span><span class="cx"> #endif
</span><span class="cx"> HashMap<String, RefPtr<SandboxExtension>> m_blobTemporaryFileSandboxExtensions;
</span><del>- HashMap<uint64_t, std::function<void (const SandboxExtension::HandleArray&)>> m_sandboxExtensionForBlobsCompletionHandlers;
</del><ins>+ HashMap<uint64_t, std::function<void (SandboxExtension::HandleArray&&)>> m_sandboxExtensionForBlobsCompletionHandlers;
</ins><span class="cx">
</span><span class="cx"> Deque<CrossThreadTask> m_databaseTasks;
</span><span class="cx"> Lock m_databaseTaskMutex;
</span></span></pre></div>
<a id="trunkSourceWebKit2DatabaseProcessIndexedDBWebIDBConnectionToClientcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/DatabaseProcess/IndexedDB/WebIDBConnectionToClient.cpp (202413 => 202414)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/DatabaseProcess/IndexedDB/WebIDBConnectionToClient.cpp        2016-06-24 03:41:52 UTC (rev 202413)
+++ trunk/Source/WebKit2/DatabaseProcess/IndexedDB/WebIDBConnectionToClient.cpp        2016-06-24 04:08:48 UTC (rev 202414)
</span><span class="lines">@@ -32,6 +32,7 @@
</span><span class="cx"> #include "DatabaseProcess.h"
</span><span class="cx"> #include "WebCoreArgumentCoders.h"
</span><span class="cx"> #include "WebIDBConnectionToServerMessages.h"
</span><ins>+#include "WebIDBResult.h"
</ins><span class="cx"> #include <WebCore/IDBError.h>
</span><span class="cx"> #include <WebCore/IDBResultData.h>
</span><span class="cx"> #include <WebCore/IDBValue.h>
</span><span class="lines">@@ -125,25 +126,30 @@
</span><span class="cx"> send(Messages::WebIDBConnectionToServer::DidPutOrAdd(resultData));
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void WebIDBConnectionToClient::didGetRecord(const WebCore::IDBResultData& resultData)
</del><ins>+template<class MessageType> void WebIDBConnectionToClient::handleGetResult(const WebCore::IDBResultData& resultData)
</ins><span class="cx"> {
</span><span class="cx"> if (resultData.type() == IDBResultType::Error) {
</span><del>- send(Messages::WebIDBConnectionToServer::DidGetRecord(resultData));
</del><ins>+ send(MessageType(resultData));
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> auto& blobFilePaths = resultData.getResult().value().blobFilePaths();
</span><span class="cx"> if (blobFilePaths.isEmpty()) {
</span><del>- send(Messages::WebIDBConnectionToServer::DidGetRecord(resultData));
</del><ins>+ send(MessageType(resultData));
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> RefPtr<WebIDBConnectionToClient> protector(this);
</span><del>- DatabaseProcess::singleton().getSandboxExtensionsForBlobFiles(blobFilePaths, [protector, this, resultData](const SandboxExtension::HandleArray& handles) {
- send(Messages::WebIDBConnectionToServer::DidGetRecordWithSandboxExtensions(resultData, handles));
</del><ins>+ DatabaseProcess::singleton().getSandboxExtensionsForBlobFiles(blobFilePaths, [protector, this, resultData](SandboxExtension::HandleArray&& handles) {
+ send(MessageType({ resultData, WTFMove(handles) }));
</ins><span class="cx"> });
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void WebIDBConnectionToClient::didGetRecord(const WebCore::IDBResultData& resultData)
+{
+ handleGetResult<Messages::WebIDBConnectionToServer::DidGetRecord>(resultData);
+}
+
</ins><span class="cx"> void WebIDBConnectionToClient::didGetCount(const WebCore::IDBResultData& resultData)
</span><span class="cx"> {
</span><span class="cx"> send(Messages::WebIDBConnectionToServer::DidGetCount(resultData));
</span><span class="lines">@@ -156,12 +162,12 @@
</span><span class="cx">
</span><span class="cx"> void WebIDBConnectionToClient::didOpenCursor(const WebCore::IDBResultData& resultData)
</span><span class="cx"> {
</span><del>- send(Messages::WebIDBConnectionToServer::DidOpenCursor(resultData));
</del><ins>+ handleGetResult<Messages::WebIDBConnectionToServer::DidOpenCursor>(resultData);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebIDBConnectionToClient::didIterateCursor(const WebCore::IDBResultData& resultData)
</span><span class="cx"> {
</span><del>- send(Messages::WebIDBConnectionToServer::DidIterateCursor(resultData));
</del><ins>+ handleGetResult<Messages::WebIDBConnectionToServer::DidIterateCursor>(resultData);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebIDBConnectionToClient::fireVersionChangeEvent(WebCore::IDBServer::UniqueIDBDatabaseConnection& connection, const WebCore::IDBResourceIdentifier& requestIdentifier, uint64_t requestedVersion)
</span></span></pre></div>
<a id="trunkSourceWebKit2DatabaseProcessIndexedDBWebIDBConnectionToClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/DatabaseProcess/IndexedDB/WebIDBConnectionToClient.h (202413 => 202414)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/DatabaseProcess/IndexedDB/WebIDBConnectionToClient.h        2016-06-24 03:41:52 UTC (rev 202413)
+++ trunk/Source/WebKit2/DatabaseProcess/IndexedDB/WebIDBConnectionToClient.h        2016-06-24 04:08:48 UTC (rev 202414)
</span><span class="lines">@@ -119,6 +119,8 @@
</span><span class="cx">
</span><span class="cx"> IPC::Connection* messageSenderConnection() final;
</span><span class="cx">
</span><ins>+ template<class MessageType> void handleGetResult(const WebCore::IDBResultData&);
+
</ins><span class="cx"> Ref<DatabaseToWebProcessConnection> m_connection;
</span><span class="cx">
</span><span class="cx"> uint64_t m_identifier;
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedDatabasesIndexedDBWebIDBResultcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/Shared/Databases/IndexedDB/WebIDBResult.cpp (0 => 202414)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/Databases/IndexedDB/WebIDBResult.cpp         (rev 0)
+++ trunk/Source/WebKit2/Shared/Databases/IndexedDB/WebIDBResult.cpp        2016-06-24 04:08:48 UTC (rev 202414)
</span><span class="lines">@@ -0,0 +1,54 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebIDBResult.h"
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include "ArgumentCoders.h"
+
+namespace WebKit {
+
+void WebIDBResult::encode(IPC::ArgumentEncoder& encoder) const
+{
+ m_resultData.encode(encoder);
+ m_handles.encode(encoder);
+}
+
+bool WebIDBResult::decode(IPC::ArgumentDecoder& decoder, WebIDBResult& result)
+{
+ if (!WebCore::IDBResultData::decode(decoder, result.m_resultData))
+ return false;
+
+ if (!SandboxExtension::HandleArray::decode(decoder, result.m_handles))
+ return false;
+
+ return true;
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(INDEXED_DATABASE)
</ins></span></pre></div>
<a id="trunkSourceWebKit2SharedDatabasesIndexedDBWebIDBResulth"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/Shared/Databases/IndexedDB/WebIDBResult.h (0 => 202414)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/Databases/IndexedDB/WebIDBResult.h         (rev 0)
+++ trunk/Source/WebKit2/Shared/Databases/IndexedDB/WebIDBResult.h        2016-06-24 04:08:48 UTC (rev 202414)
</span><span class="lines">@@ -0,0 +1,67 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include "SandboxExtension.h"
+#include <WebCore/IDBResultData.h>
+#include <wtf/Noncopyable.h>
+
+namespace WebKit {
+
+class WebIDBResult {
+ WTF_MAKE_NONCOPYABLE(WebIDBResult);
+public:
+ WebIDBResult()
+ {
+ }
+
+ WebIDBResult(const WebCore::IDBResultData& resultData)
+ : m_resultData(resultData)
+ {
+ }
+
+ WebIDBResult(const WebCore::IDBResultData& resultData, SandboxExtension::HandleArray&& handles)
+ : m_resultData(resultData)
+ , m_handles(WTFMove(handles))
+ {
+ }
+
+ const WebCore::IDBResultData& resultData() const { return m_resultData; }
+ const SandboxExtension::HandleArray& handles() const { return m_handles; }
+
+ void encode(IPC::ArgumentEncoder&) const;
+ static bool decode(IPC::ArgumentDecoder&, WebIDBResult&);
+
+private:
+ WebCore::IDBResultData m_resultData;
+ SandboxExtension::HandleArray m_handles;
+};
+
+} // namespace WebKit
+
+#endif // ENABLE(INDEXED_DATABASE)
</ins></span></pre></div>
<a id="trunkSourceWebKit2SharedSandboxExtensionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/SandboxExtension.h (202413 => 202414)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/SandboxExtension.h        2016-06-24 03:41:52 UTC (rev 202413)
+++ trunk/Source/WebKit2/Shared/SandboxExtension.h        2016-06-24 04:08:48 UTC (rev 202414)
</span><span class="lines">@@ -52,9 +52,9 @@
</span><span class="cx">
</span><span class="cx"> class Handle {
</span><span class="cx"> WTF_MAKE_NONCOPYABLE(Handle);
</span><del>-
</del><span class="cx"> public:
</span><span class="cx"> Handle();
</span><ins>+ Handle(Handle&&) = default;
</ins><span class="cx"> ~Handle();
</span><span class="cx">
</span><span class="cx"> void encode(IPC::ArgumentEncoder&) const;
</span><span class="lines">@@ -69,9 +69,9 @@
</span><span class="cx">
</span><span class="cx"> class HandleArray {
</span><span class="cx"> WTF_MAKE_NONCOPYABLE(HandleArray);
</span><del>-
</del><span class="cx"> public:
</span><span class="cx"> HandleArray();
</span><ins>+ HandleArray(HandleArray&&) = default;
</ins><span class="cx"> ~HandleArray();
</span><span class="cx"> void allocate(size_t);
</span><span class="cx"> Handle& operator[](size_t i);
</span></span></pre></div>
<a id="trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (202413 => 202414)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2016-06-24 03:41:52 UTC (rev 202413)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2016-06-24 04:08:48 UTC (rev 202414)
</span><span class="lines">@@ -958,6 +958,7 @@
</span><span class="cx">                 51A555F5128C6C47009ABCEC /* WKContextMenuItem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51A555F3128C6C47009ABCEC /* WKContextMenuItem.cpp */; };
</span><span class="cx">                 51A555F6128C6C47009ABCEC /* WKContextMenuItem.h in Headers */ = {isa = PBXBuildFile; fileRef = 51A555F4128C6C47009ABCEC /* WKContextMenuItem.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 51A55601128C6D92009ABCEC /* WKContextMenuItemTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 51A55600128C6D92009ABCEC /* WKContextMenuItemTypes.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><ins>+                51A587801D1C5081004BA9AF /* WebIDBResult.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51A5877E1D1C4CB9004BA9AF /* WebIDBResult.cpp */; };
</ins><span class="cx">                 51A728DE1B1BAD3800102EEE /* WKBundleNavigationActionPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 51A728DC1B1BAD2D00102EEE /* WKBundleNavigationActionPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 51A7F2F3125BF820008AEB1D /* Logging.h in Headers */ = {isa = PBXBuildFile; fileRef = 51A7F2F2125BF820008AEB1D /* Logging.h */; };
</span><span class="cx">                 51A7F2F5125BF8D4008AEB1D /* Logging.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51A7F2F4125BF8D4008AEB1D /* Logging.cpp */; };
</span><span class="lines">@@ -2975,6 +2976,8 @@
</span><span class="cx">                 51A555F3128C6C47009ABCEC /* WKContextMenuItem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKContextMenuItem.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 51A555F4128C6C47009ABCEC /* WKContextMenuItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKContextMenuItem.h; sourceTree = "<group>"; };
</span><span class="cx">                 51A55600128C6D92009ABCEC /* WKContextMenuItemTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKContextMenuItemTypes.h; sourceTree = "<group>"; };
</span><ins>+                51A5877E1D1C4CB9004BA9AF /* WebIDBResult.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebIDBResult.cpp; sourceTree = "<group>"; };
+                51A5877F1D1C4CB9004BA9AF /* WebIDBResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebIDBResult.h; sourceTree = "<group>"; };
</ins><span class="cx">                 51A60B29180CCD9000F3BF50 /* DatabaseService.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = DatabaseService.xcconfig; sourceTree = "<group>"; };
</span><span class="cx">                 51A728DC1B1BAD2D00102EEE /* WKBundleNavigationActionPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBundleNavigationActionPrivate.h; sourceTree = "<group>"; };
</span><span class="cx">                 51A7F2F2125BF820008AEB1D /* Logging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Logging.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -5450,6 +5453,8 @@
</span><span class="cx">                         children = (
</span><span class="cx">                                 51E351C8180F2CCC00E53BE9 /* IDBUtilities.cpp */,
</span><span class="cx">                                 51E351C9180F2CCC00E53BE9 /* IDBUtilities.h */,
</span><ins>+                                51A5877E1D1C4CB9004BA9AF /* WebIDBResult.cpp */,
+                                51A5877F1D1C4CB9004BA9AF /* WebIDBResult.h */,
</ins><span class="cx">                         );
</span><span class="cx">                         path = IndexedDB;
</span><span class="cx">                         sourceTree = "<group>";
</span><span class="lines">@@ -9284,6 +9289,7 @@
</span><span class="cx">                                 1A043A0A124D11A900FFBFB5 /* WebProcessConnection.cpp in Sources */,
</span><span class="cx">                                 1A043F6912514D8B00FFBFB5 /* WebProcessConnectionMessageReceiver.cpp in Sources */,
</span><span class="cx">                                 BC306825125A6B9400E71278 /* WebProcessCreationParameters.cpp in Sources */,
</span><ins>+                                51A587801D1C5081004BA9AF /* WebIDBResult.cpp in Sources */,
</ins><span class="cx">                                 1AFA4B8F1A65A9E2006C4AB4 /* WebProcessLifetimeObserver.cpp in Sources */,
</span><span class="cx">                                 1AFA4B8B1A65A1D0006C4AB4 /* WebProcessLifetimeTracker.cpp in Sources */,
</span><span class="cx">                                 BC3066BE125A442100E71278 /* WebProcessMessageReceiver.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessDatabasesIndexedDBWebIDBConnectionToServercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp (202413 => 202414)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp        2016-06-24 03:41:52 UTC (rev 202413)
+++ trunk/Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp        2016-06-24 04:08:48 UTC (rev 202414)
</span><span class="lines">@@ -33,6 +33,7 @@
</span><span class="cx"> #include "NetworkConnectionToWebProcessMessages.h"
</span><span class="cx"> #include "NetworkProcessConnection.h"
</span><span class="cx"> #include "WebIDBConnectionToClientMessages.h"
</span><ins>+#include "WebIDBResult.h"
</ins><span class="cx"> #include "WebProcess.h"
</span><span class="cx"> #include "WebToDatabaseProcessConnection.h"
</span><span class="cx"> #include <WebCore/IDBConnectionToServer.h>
</span><span class="lines">@@ -246,20 +247,20 @@
</span><span class="cx"> m_connectionToServer->didPutOrAdd(result);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void WebIDBConnectionToServer::didGetRecord(const IDBResultData& result)
</del><ins>+static void preregisterSandboxExtensionsIfNecessary(const WebIDBResult& result)
</ins><span class="cx"> {
</span><del>- m_connectionToServer->didGetRecord(result);
</del><ins>+ const auto& filePaths = result.resultData().getResult().value().blobFilePaths();
+
+ ASSERT(filePaths.size() == result.handles().size());
+
+ if (!filePaths.isEmpty())
+ WebProcess::singleton().networkConnection()->connection()->send(Messages::NetworkConnectionToWebProcess::PreregisterSandboxExtensionsForOptionallyFileBackedBlob(filePaths, result.handles()), 0);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void WebIDBConnectionToServer::didGetRecordWithSandboxExtensions(const WebCore::IDBResultData& result, const SandboxExtension::HandleArray& handles)
</del><ins>+void WebIDBConnectionToServer::didGetRecord(const WebIDBResult& result)
</ins><span class="cx"> {
</span><del>- const auto& filePaths = result.getResult().value().blobFilePaths();
-
- ASSERT(filePaths.size() == handles.size());
-
- WebProcess::singleton().networkConnection()->connection()->send(Messages::NetworkConnectionToWebProcess::PreregisterSandboxExtensionsForOptionallyFileBackedBlob(filePaths, handles), 0);
-
- m_connectionToServer->didGetRecord(result);
</del><ins>+ preregisterSandboxExtensionsIfNecessary(result);
+ m_connectionToServer->didGetRecord(result.resultData());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebIDBConnectionToServer::didGetCount(const IDBResultData& result)
</span><span class="lines">@@ -272,14 +273,16 @@
</span><span class="cx"> m_connectionToServer->didDeleteRecord(result);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void WebIDBConnectionToServer::didOpenCursor(const IDBResultData& result)
</del><ins>+void WebIDBConnectionToServer::didOpenCursor(const WebIDBResult& result)
</ins><span class="cx"> {
</span><del>- m_connectionToServer->didOpenCursor(result);
</del><ins>+ preregisterSandboxExtensionsIfNecessary(result);
+ m_connectionToServer->didOpenCursor(result.resultData());
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void WebIDBConnectionToServer::didIterateCursor(const IDBResultData& result)
</del><ins>+void WebIDBConnectionToServer::didIterateCursor(const WebIDBResult& result)
</ins><span class="cx"> {
</span><del>- m_connectionToServer->didIterateCursor(result);
</del><ins>+ preregisterSandboxExtensionsIfNecessary(result);
+ m_connectionToServer->didIterateCursor(result.resultData());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebIDBConnectionToServer::fireVersionChangeEvent(uint64_t uniqueDatabaseConnectionIdentifier, const IDBResourceIdentifier& requestIdentifier, uint64_t requestedVersion)
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessDatabasesIndexedDBWebIDBConnectionToServerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h (202413 => 202414)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h        2016-06-24 03:41:52 UTC (rev 202413)
+++ trunk/Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h        2016-06-24 04:08:48 UTC (rev 202414)
</span><span class="lines">@@ -33,6 +33,8 @@
</span><span class="cx">
</span><span class="cx"> namespace WebKit {
</span><span class="cx">
</span><ins>+class WebIDBResult;
+
</ins><span class="cx"> class WebIDBConnectionToServer final : public WebCore::IDBClient::IDBConnectionToServerDelegate, public IPC::MessageSender, public RefCounted<WebIDBConnectionToServer> {
</span><span class="cx"> public:
</span><span class="cx"> static Ref<WebIDBConnectionToServer> create();
</span><span class="lines">@@ -83,12 +85,11 @@
</span><span class="cx"> void didCreateIndex(const WebCore::IDBResultData&);
</span><span class="cx"> void didDeleteIndex(const WebCore::IDBResultData&);
</span><span class="cx"> void didPutOrAdd(const WebCore::IDBResultData&);
</span><del>- void didGetRecord(const WebCore::IDBResultData&);
- void didGetRecordWithSandboxExtensions(const WebCore::IDBResultData&, const SandboxExtension::HandleArray&);
</del><ins>+ void didGetRecord(const WebIDBResult&);
</ins><span class="cx"> void didGetCount(const WebCore::IDBResultData&);
</span><span class="cx"> void didDeleteRecord(const WebCore::IDBResultData&);
</span><del>- void didOpenCursor(const WebCore::IDBResultData&);
- void didIterateCursor(const WebCore::IDBResultData&);
</del><ins>+ void didOpenCursor(const WebIDBResult&);
+ void didIterateCursor(const WebIDBResult&);
</ins><span class="cx"> void fireVersionChangeEvent(uint64_t uniqueDatabaseConnectionIdentifier, const WebCore::IDBResourceIdentifier& requestIdentifier, uint64_t requestedVersion);
</span><span class="cx"> void didStartTransaction(const WebCore::IDBResourceIdentifier& transactionIdentifier, const WebCore::IDBError&);
</span><span class="cx"> void didCloseFromServer(uint64_t databaseConnectionIdentifier, const WebCore::IDBError&);
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessDatabasesIndexedDBWebIDBConnectionToServermessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.messages.in (202413 => 202414)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.messages.in        2016-06-24 03:41:52 UTC (rev 202413)
+++ trunk/Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.messages.in        2016-06-24 04:08:48 UTC (rev 202414)
</span><span class="lines">@@ -33,12 +33,11 @@
</span><span class="cx"> DidCreateIndex(WebCore::IDBResultData result)
</span><span class="cx"> DidDeleteIndex(WebCore::IDBResultData result)
</span><span class="cx"> DidPutOrAdd(WebCore::IDBResultData result)
</span><del>- DidGetRecord(WebCore::IDBResultData result)
- DidGetRecordWithSandboxExtensions(WebCore::IDBResultData result, WebKit::SandboxExtension::HandleArray extensions)
</del><ins>+ DidGetRecord(WebKit::WebIDBResult result)
</ins><span class="cx"> DidGetCount(WebCore::IDBResultData result)
</span><span class="cx"> DidDeleteRecord(WebCore::IDBResultData result)
</span><del>- DidOpenCursor(WebCore::IDBResultData result)
- DidIterateCursor(WebCore::IDBResultData result)
</del><ins>+ DidOpenCursor(WebKit::WebIDBResult result)
+ DidIterateCursor(WebKit::WebIDBResult result)
</ins><span class="cx">
</span><span class="cx"> FireVersionChangeEvent(uint64_t databaseConnectionIdentifier, WebCore::IDBResourceIdentifier requestIdentifier, uint64_t requestedVersion)
</span><span class="cx"> DidStartTransaction(WebCore::IDBResourceIdentifier transactionIdentifier, WebCore::IDBError error)
</span></span></pre>
</div>
</div>
</body>
</html>