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

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

<h3>Log Message</h3>
<pre>Modern IDB (Blob support): When reading Blobs from the database, grant the Networking process sandbox access to the files.
https://bugs.webkit.org/show_bug.cgi?id=156640

Reviewed by Alex Christensen.

Source/WebCore:

No new tests (No change in behavior, as blobs in IDB are not yet enabled,
              but when they are enabled testing will cover this).

* Modules/indexeddb/shared/IDBResultData.h: Export some stuff

* fileapi/ThreadableBlobRegistry.cpp:
(WebCore::ThreadableBlobRegistry::registerBlobURLOptionallyFileBacked): Account for
  BlobRegistry change described below.

* platform/network/BlobRegistry.h: Change registerBlobURLOptionallyFileBacked to take a
  BlobDataFileReference instead of a raw path, to allow WK2 to include a sandbox extension.

* platform/network/BlobRegistryImpl.cpp:
(WebCore::BlobRegistryImpl::registerBlobURL): Account for BlobRegistry change described above.
(WebCore::BlobRegistryImpl::registerBlobURLOptionallyFileBacked): Use the passed in
  BlobDataFileHandle, and also register the BlobResourceHandle constructor.
* platform/network/BlobRegistryImpl.h:

Source/WebKit2:

* DatabaseProcess/DatabaseProcess.cpp:
(WebKit::DatabaseProcess::getSandboxExtensionsForBlobFiles): Utility function to ask the UI process for
  SandboxExtensions for a list of files.
(WebKit::DatabaseProcess::didGetSandboxExtensionsForBlobFiles): Take the SandboxExtensions from the UI process
  and pass them along to the completion handler.
* DatabaseProcess/DatabaseProcess.h:
* DatabaseProcess/DatabaseProcess.messages.in:

* DatabaseProcess/IndexedDB/WebIDBConnectionToClient.cpp:
(WebKit::WebIDBConnectionToClient::didGetRecord): If the value returned from the database doesn't have Blob files,
  pass the result directly on to WebCore. If it does, ask the UI process for SandboxExtensions first.

* NetworkProcess/FileAPI/NetworkBlobRegistry.cpp:
(WebKit::NetworkBlobRegistry::registerBlobURLOptionallyFileBacked): Grab the BlobDataFileReference from the
  NetworkConnectionToWebProcess to pass along to the BlobRegistry.

* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::preregisterSandboxExtensionsForOptionallyFileBackedBlob): Add this message
  so the WebProcess can preflight the creation of some blob URLs by passing along the SandboxExtensions for their files.
(WebKit::NetworkConnectionToWebProcess::takeBlobDataFileReferenceForPath):
* NetworkProcess/NetworkConnectionToWebProcess.h:
* NetworkProcess/NetworkConnectionToWebProcess.messages.in:

* UIProcess/Databases/DatabaseProcessProxy.cpp:
(WebKit::DatabaseProcessProxy::getSandboxExtensionsForBlobFiles): Create SandboxExtensions for the passed in files and
  return them to the DatabaseProcess.
* UIProcess/Databases/DatabaseProcessProxy.h:
* UIProcess/Databases/DatabaseProcessProxy.messages.in:

* WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
(WebKit::WebIDBConnectionToServer::didGetRecordWithSandboxExtensions): New form of &quot;didGetRecord&quot; that handles passing
  the SandboxExtensions to the Networking process before they are needed.
* WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h:
* WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.messages.in:

* WebProcess/FileAPI/BlobRegistryProxy.cpp:
(WebKit::BlobRegistryProxy::registerBlobURLOptionallyFileBacked):
* WebProcess/FileAPI/BlobRegistryProxy.h:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbsharedIDBResultDatah">trunk/Source/WebCore/Modules/indexeddb/shared/IDBResultData.h</a></li>
<li><a href="#trunkSourceWebCorefileapiThreadableBlobRegistrycpp">trunk/Source/WebCore/fileapi/ThreadableBlobRegistry.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkBlobRegistryh">trunk/Source/WebCore/platform/network/BlobRegistry.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkBlobRegistryImplcpp">trunk/Source/WebCore/platform/network/BlobRegistryImpl.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkBlobRegistryImplh">trunk/Source/WebCore/platform/network/BlobRegistryImpl.h</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="#trunkSourceWebKit2DatabaseProcessDatabaseProcessmessagesin">trunk/Source/WebKit2/DatabaseProcess/DatabaseProcess.messages.in</a></li>
<li><a href="#trunkSourceWebKit2DatabaseProcessIndexedDBWebIDBConnectionToClientcpp">trunk/Source/WebKit2/DatabaseProcess/IndexedDB/WebIDBConnectionToClient.cpp</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcessFileAPINetworkBlobRegistrycpp">trunk/Source/WebKit2/NetworkProcess/FileAPI/NetworkBlobRegistry.cpp</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcessNetworkConnectionToWebProcesscpp">trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcessNetworkConnectionToWebProcessh">trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.h</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcessNetworkConnectionToWebProcessmessagesin">trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.messages.in</a></li>
<li><a href="#trunkSourceWebKit2UIProcessDatabasesDatabaseProcessProxycpp">trunk/Source/WebKit2/UIProcess/Databases/DatabaseProcessProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessDatabasesDatabaseProcessProxyh">trunk/Source/WebKit2/UIProcess/Databases/DatabaseProcessProxy.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessDatabasesDatabaseProcessProxymessagesin">trunk/Source/WebKit2/UIProcess/Databases/DatabaseProcessProxy.messages.in</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>
<li><a href="#trunkSourceWebKit2WebProcessFileAPIBlobRegistryProxycpp">trunk/Source/WebKit2/WebProcess/FileAPI/BlobRegistryProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessFileAPIBlobRegistryProxyh">trunk/Source/WebKit2/WebProcess/FileAPI/BlobRegistryProxy.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (199707 => 199708)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-04-19 05:08:53 UTC (rev 199707)
+++ trunk/Source/WebCore/ChangeLog        2016-04-19 06:02:04 UTC (rev 199708)
</span><span class="lines">@@ -1,3 +1,28 @@
</span><ins>+2016-04-18  Brady Eidson  &lt;beidson@apple.com&gt;
+
+        Modern IDB (Blob support): When reading Blobs from the database, grant the Networking process sandbox access to the files.
+        https://bugs.webkit.org/show_bug.cgi?id=156640
+
+        Reviewed by Alex Christensen.
+
+        No new tests (No change in behavior, as blobs in IDB are not yet enabled,
+                      but when they are enabled testing will cover this).
+
+        * Modules/indexeddb/shared/IDBResultData.h: Export some stuff
+        
+        * fileapi/ThreadableBlobRegistry.cpp:
+        (WebCore::ThreadableBlobRegistry::registerBlobURLOptionallyFileBacked): Account for 
+          BlobRegistry change described below.
+        
+        * platform/network/BlobRegistry.h: Change registerBlobURLOptionallyFileBacked to take a 
+          BlobDataFileReference instead of a raw path, to allow WK2 to include a sandbox extension.
+        
+        * platform/network/BlobRegistryImpl.cpp:
+        (WebCore::BlobRegistryImpl::registerBlobURL): Account for BlobRegistry change described above.
+        (WebCore::BlobRegistryImpl::registerBlobURLOptionallyFileBacked): Use the passed in 
+          BlobDataFileHandle, and also register the BlobResourceHandle constructor.
+        * platform/network/BlobRegistryImpl.h:
+
</ins><span class="cx"> 2016-04-18  Alex Christensen  &lt;achristensen@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Fix iOS build after r199701
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbsharedIDBResultDatah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/shared/IDBResultData.h (199707 => 199708)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/shared/IDBResultData.h        2016-04-19 05:08:53 UTC (rev 199707)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/IDBResultData.h        2016-04-19 06:02:04 UTC (rev 199708)
</span><span class="lines">@@ -82,7 +82,7 @@
</span><span class="cx">     static IDBResultData openCursorSuccess(const IDBResourceIdentifier&amp;, const IDBGetResult&amp;);
</span><span class="cx">     static IDBResultData iterateCursorSuccess(const IDBResourceIdentifier&amp;, const IDBGetResult&amp;);
</span><span class="cx"> 
</span><del>-    IDBResultData(const IDBResultData&amp;);
</del><ins>+    WEBCORE_EXPORT IDBResultData(const IDBResultData&amp;);
</ins><span class="cx"> 
</span><span class="cx">     IDBResultType type() const { return m_type; }
</span><span class="cx">     IDBResourceIdentifier requestIdentifier() const { return m_requestIdentifier; }
</span><span class="lines">@@ -96,7 +96,7 @@
</span><span class="cx">     const IDBKeyData* resultKey() const { return m_resultKey.get(); }
</span><span class="cx">     uint64_t resultInteger() const { return m_resultInteger; }
</span><span class="cx"> 
</span><del>-    const IDBGetResult&amp; getResult() const;
</del><ins>+    WEBCORE_EXPORT const IDBGetResult&amp; getResult() const;
</ins><span class="cx"> 
</span><span class="cx">     WEBCORE_EXPORT IDBResultData();
</span><span class="cx">     template&lt;class Encoder&gt; void encode(Encoder&amp;) const;
</span></span></pre></div>
<a id="trunkSourceWebCorefileapiThreadableBlobRegistrycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/fileapi/ThreadableBlobRegistry.cpp (199707 => 199708)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/fileapi/ThreadableBlobRegistry.cpp        2016-04-19 05:08:53 UTC (rev 199707)
+++ trunk/Source/WebCore/fileapi/ThreadableBlobRegistry.cpp        2016-04-19 06:02:04 UTC (rev 199708)
</span><span class="lines">@@ -160,7 +160,7 @@
</span><span class="cx"> void ThreadableBlobRegistry::registerBlobURLOptionallyFileBacked(const URL&amp; url, const URL&amp; srcURL, const String&amp; fileBackedPath)
</span><span class="cx"> {
</span><span class="cx">     if (isMainThread())
</span><del>-        blobRegistry().registerBlobURLOptionallyFileBacked(url, srcURL, fileBackedPath);
</del><ins>+        blobRegistry().registerBlobURLOptionallyFileBacked(url, srcURL, BlobDataFileReference::create(fileBackedPath));
</ins><span class="cx">     else {
</span><span class="cx">         threadableQueue().append(createCrossThreadTask(ThreadableBlobRegistry::registerBlobURLOptionallyFileBacked, url, srcURL, fileBackedPath));
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkBlobRegistryh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/BlobRegistry.h (199707 => 199708)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/BlobRegistry.h        2016-04-19 05:08:53 UTC (rev 199707)
+++ trunk/Source/WebCore/platform/network/BlobRegistry.h        2016-04-19 06:02:04 UTC (rev 199708)
</span><span class="lines">@@ -58,7 +58,7 @@
</span><span class="cx">     virtual void registerBlobURL(const URL&amp;, const URL&amp; srcURL) = 0;
</span><span class="cx"> 
</span><span class="cx">     // Registers a new blob URL referring to the blob data identified by the specified srcURL or, if none found, referring to the file found at the given path.
</span><del>-    virtual void registerBlobURLOptionallyFileBacked(const URL&amp;, const URL&amp; srcURL, const String&amp; fileBackedPath) = 0;
</del><ins>+    virtual void registerBlobURLOptionallyFileBacked(const URL&amp;, const URL&amp; srcURL, RefPtr&lt;BlobDataFileReference&gt;&amp;&amp;) = 0;
</ins><span class="cx"> 
</span><span class="cx">     // Negative start and end values select from the end.
</span><span class="cx">     virtual void registerBlobURLForSlice(const URL&amp;, const URL&amp; srcURL, long long start, long long end) = 0;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkBlobRegistryImplcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/BlobRegistryImpl.cpp (199707 => 199708)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/BlobRegistryImpl.cpp        2016-04-19 05:08:53 UTC (rev 199707)
+++ trunk/Source/WebCore/platform/network/BlobRegistryImpl.cpp        2016-04-19 06:02:04 UTC (rev 199708)
</span><span class="lines">@@ -160,12 +160,13 @@
</span><span class="cx"> 
</span><span class="cx"> void BlobRegistryImpl::registerBlobURL(const URL&amp; url, const URL&amp; srcURL)
</span><span class="cx"> {
</span><del>-    registerBlobURLOptionallyFileBacked(url, srcURL, { });
</del><ins>+    registerBlobURLOptionallyFileBacked(url, srcURL, nullptr);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void BlobRegistryImpl::registerBlobURLOptionallyFileBacked(const URL&amp; url, const URL&amp; srcURL, const String&amp; fileBackedPath)
</del><ins>+void BlobRegistryImpl::registerBlobURLOptionallyFileBacked(const URL&amp; url, const URL&amp; srcURL, RefPtr&lt;BlobDataFileReference&gt;&amp;&amp; file)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(isMainThread());
</span><ins>+    registerBlobResourceHandleConstructor();
</ins><span class="cx"> 
</span><span class="cx">     BlobData* src = getBlobDataFromURL(srcURL);
</span><span class="cx">     if (src) {
</span><span class="lines">@@ -173,11 +174,11 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (fileBackedPath.isEmpty())
</del><ins>+    if (file == nullptr || file-&gt;path().isEmpty())
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     RefPtr&lt;BlobData&gt; backingFile = BlobData::create({ });
</span><del>-    backingFile-&gt;appendFile(BlobDataFileReference::create(fileBackedPath));
</del><ins>+    backingFile-&gt;appendFile(WTFMove(file));
</ins><span class="cx"> 
</span><span class="cx">     m_blobs.set(url.string(), backingFile.release());
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkBlobRegistryImplh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/BlobRegistryImpl.h (199707 => 199708)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/BlobRegistryImpl.h        2016-04-19 05:08:53 UTC (rev 199707)
+++ trunk/Source/WebCore/platform/network/BlobRegistryImpl.h        2016-04-19 06:02:04 UTC (rev 199708)
</span><span class="lines">@@ -61,7 +61,7 @@
</span><span class="cx">     void registerFileBlobURL(const URL&amp;, RefPtr&lt;BlobDataFileReference&gt;&amp;&amp;, const String&amp; contentType) override;
</span><span class="cx">     void registerBlobURL(const URL&amp;, Vector&lt;BlobPart&gt;, const String&amp; contentType) override;
</span><span class="cx">     void registerBlobURL(const URL&amp;, const URL&amp; srcURL) override;
</span><del>-    void registerBlobURLOptionallyFileBacked(const URL&amp;, const URL&amp; srcURL, const String&amp; fileBackedPath) override;
</del><ins>+    void registerBlobURLOptionallyFileBacked(const URL&amp;, const URL&amp; srcURL, RefPtr&lt;BlobDataFileReference&gt;&amp;&amp;) override;
</ins><span class="cx">     void registerBlobURLForSlice(const URL&amp;, const URL&amp; srcURL, long long start, long long end) override;
</span><span class="cx">     void unregisterBlobURL(const URL&amp;) override;
</span><span class="cx">     bool isBlobRegistryImpl() const override { return true; }
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (199707 => 199708)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2016-04-19 05:08:53 UTC (rev 199707)
+++ trunk/Source/WebKit2/ChangeLog        2016-04-19 06:02:04 UTC (rev 199708)
</span><span class="lines">@@ -1,3 +1,49 @@
</span><ins>+2016-04-18  Brady Eidson  &lt;beidson@apple.com&gt;
+
+        Modern IDB (Blob support): When reading Blobs from the database, grant the Networking process sandbox access to the files.
+        https://bugs.webkit.org/show_bug.cgi?id=156640
+
+        Reviewed by Alex Christensen.
+
+        * DatabaseProcess/DatabaseProcess.cpp:
+        (WebKit::DatabaseProcess::getSandboxExtensionsForBlobFiles): Utility function to ask the UI process for
+          SandboxExtensions for a list of files.
+        (WebKit::DatabaseProcess::didGetSandboxExtensionsForBlobFiles): Take the SandboxExtensions from the UI process
+          and pass them along to the completion handler.
+        * DatabaseProcess/DatabaseProcess.h:
+        * DatabaseProcess/DatabaseProcess.messages.in:
+
+        * DatabaseProcess/IndexedDB/WebIDBConnectionToClient.cpp:
+        (WebKit::WebIDBConnectionToClient::didGetRecord): If the value returned from the database doesn't have Blob files,
+          pass the result directly on to WebCore. If it does, ask the UI process for SandboxExtensions first.
+
+        * NetworkProcess/FileAPI/NetworkBlobRegistry.cpp:
+        (WebKit::NetworkBlobRegistry::registerBlobURLOptionallyFileBacked): Grab the BlobDataFileReference from the 
+          NetworkConnectionToWebProcess to pass along to the BlobRegistry.
+
+        * NetworkProcess/NetworkConnectionToWebProcess.cpp:
+        (WebKit::NetworkConnectionToWebProcess::preregisterSandboxExtensionsForOptionallyFileBackedBlob): Add this message
+          so the WebProcess can preflight the creation of some blob URLs by passing along the SandboxExtensions for their files.
+        (WebKit::NetworkConnectionToWebProcess::takeBlobDataFileReferenceForPath):
+        * NetworkProcess/NetworkConnectionToWebProcess.h:
+        * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
+
+        * UIProcess/Databases/DatabaseProcessProxy.cpp:
+        (WebKit::DatabaseProcessProxy::getSandboxExtensionsForBlobFiles): Create SandboxExtensions for the passed in files and
+          return them to the DatabaseProcess.
+        * UIProcess/Databases/DatabaseProcessProxy.h:
+        * UIProcess/Databases/DatabaseProcessProxy.messages.in:
+
+        * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
+        (WebKit::WebIDBConnectionToServer::didGetRecordWithSandboxExtensions): New form of &quot;didGetRecord&quot; that handles passing
+          the SandboxExtensions to the Networking process before they are needed.
+        * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h:
+        * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.messages.in:
+
+        * WebProcess/FileAPI/BlobRegistryProxy.cpp:
+        (WebKit::BlobRegistryProxy::registerBlobURLOptionallyFileBacked):
+        * WebProcess/FileAPI/BlobRegistryProxy.h:
+
</ins><span class="cx"> 2016-04-18  Dean Jackson  &lt;dino@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         New SPI to export a dictionary of runtime features
</span></span></pre></div>
<a id="trunkSourceWebKit2DatabaseProcessDatabaseProcesscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/DatabaseProcess/DatabaseProcess.cpp (199707 => 199708)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/DatabaseProcess/DatabaseProcess.cpp        2016-04-19 05:08:53 UTC (rev 199707)
+++ trunk/Source/WebKit2/DatabaseProcess/DatabaseProcess.cpp        2016-04-19 06:02:04 UTC (rev 199708)
</span><span class="lines">@@ -32,6 +32,7 @@
</span><span class="cx"> #include &quot;DatabaseProcessMessages.h&quot;
</span><span class="cx"> #include &quot;DatabaseProcessProxyMessages.h&quot;
</span><span class="cx"> #include &quot;DatabaseToWebProcessConnection.h&quot;
</span><ins>+#include &quot;WebCoreArgumentCoders.h&quot;
</ins><span class="cx"> #include &quot;WebCrossThreadCopier.h&quot;
</span><span class="cx"> #include &quot;WebsiteData.h&quot;
</span><span class="cx"> #include &lt;WebCore/CrossThreadTask.h&gt;
</span><span class="lines">@@ -348,9 +349,7 @@
</span><span class="cx"> 
</span><span class="cx">     return securityOrigins;
</span><span class="cx"> }
</span><del>-#endif
</del><span class="cx"> 
</span><del>-#if ENABLE(INDEXED_DATABASE)
</del><span class="cx"> static void removeAllDatabasesForOriginPath(const String&amp; originPath, std::chrono::system_clock::time_point modifiedSince)
</span><span class="cx"> {
</span><span class="cx">     // FIXME: We should also close/invalidate any live handles to the database files we are about to delete.
</span><span class="lines">@@ -406,6 +405,21 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+void DatabaseProcess::getSandboxExtensionsForBlobFiles(const Vector&lt;String&gt;&amp; filenames, std::function&lt;void (const SandboxExtension::HandleArray&amp;)&gt; completionHandler)
+{
+    static uint64_t lastRequestID;
+
+    uint64_t requestID = ++lastRequestID;
+    m_sandboxExtensionForBlobsCompletionHandlers.set(requestID, completionHandler);
+    parentProcessConnection()-&gt;send(Messages::DatabaseProcessProxy::GetSandboxExtensionsForBlobFiles(requestID, filenames), 0);
+}
+
+void DatabaseProcess::didGetSandboxExtensionsForBlobFiles(uint64_t requestID, const SandboxExtension::HandleArray&amp; handles)
+{
+    if (auto handler = m_sandboxExtensionForBlobsCompletionHandlers.take(requestID))
+        handler(handles);
+}
+
</ins><span class="cx"> #if !PLATFORM(COCOA)
</span><span class="cx"> void DatabaseProcess::initializeProcess(const ChildProcessInitializationParameters&amp;)
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebKit2DatabaseProcessDatabaseProcessh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/DatabaseProcess/DatabaseProcess.h (199707 => 199708)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/DatabaseProcess/DatabaseProcess.h        2016-04-19 05:08:53 UTC (rev 199707)
+++ trunk/Source/WebKit2/DatabaseProcess/DatabaseProcess.h        2016-04-19 06:02:04 UTC (rev 199708)
</span><span class="lines">@@ -77,6 +77,8 @@
</span><span class="cx">     void accessToTemporaryFileComplete(const String&amp; path) final;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+    void getSandboxExtensionsForBlobFiles(const Vector&lt;String&gt;&amp; filenames, std::function&lt;void (const SandboxExtension::HandleArray&amp;)&gt; completionHandler);
+
</ins><span class="cx"> private:
</span><span class="cx">     DatabaseProcess();
</span><span class="cx"> 
</span><span class="lines">@@ -104,6 +106,8 @@
</span><span class="cx">     void deleteWebsiteDataForOrigins(WebCore::SessionID, OptionSet&lt;WebsiteDataType&gt; websiteDataTypes, const Vector&lt;WebCore::SecurityOriginData&gt;&amp; origins, uint64_t callbackID);
</span><span class="cx">     void grantSandboxExtensionsForBlobs(const Vector&lt;String&gt;&amp; paths, const SandboxExtension::HandleArray&amp;);
</span><span class="cx"> 
</span><ins>+    void didGetSandboxExtensionsForBlobFiles(uint64_t requestID, const SandboxExtension::HandleArray&amp;);
+
</ins><span class="cx"> #if ENABLE(INDEXED_DATABASE)
</span><span class="cx">     Vector&lt;RefPtr&lt;WebCore::SecurityOrigin&gt;&gt; indexedDatabaseOrigins();
</span><span class="cx">     void deleteIndexedDatabaseEntriesForOrigins(const Vector&lt;RefPtr&lt;WebCore::SecurityOrigin&gt;&gt;&amp;);
</span><span class="lines">@@ -123,6 +127,7 @@
</span><span class="cx">     RefPtr&lt;WebCore::IDBServer::IDBServer&gt; m_idbServer;
</span><span class="cx"> #endif
</span><span class="cx">     HashMap&lt;String, RefPtr&lt;SandboxExtension&gt;&gt; m_blobTemporaryFileSandboxExtensions;
</span><ins>+    HashMap&lt;uint64_t, std::function&lt;void (const SandboxExtension::HandleArray&amp;)&gt;&gt; m_sandboxExtensionForBlobsCompletionHandlers;
</ins><span class="cx"> 
</span><span class="cx">     Deque&lt;std::unique_ptr&lt;WebCore::CrossThreadTask&gt;&gt; m_databaseTasks;
</span><span class="cx">     Lock m_databaseTaskMutex;
</span></span></pre></div>
<a id="trunkSourceWebKit2DatabaseProcessDatabaseProcessmessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/DatabaseProcess/DatabaseProcess.messages.in (199707 => 199708)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/DatabaseProcess/DatabaseProcess.messages.in        2016-04-19 05:08:53 UTC (rev 199707)
+++ trunk/Source/WebKit2/DatabaseProcess/DatabaseProcess.messages.in        2016-04-19 06:02:04 UTC (rev 199708)
</span><span class="lines">@@ -33,6 +33,8 @@
</span><span class="cx">     DeleteWebsiteData(WebCore::SessionID sessionID, OptionSet&lt;WebKit::WebsiteDataType&gt; websiteDataTypes, std::chrono::system_clock::time_point modifiedSince, uint64_t callbackID)
</span><span class="cx">     DeleteWebsiteDataForOrigins(WebCore::SessionID sessionID, OptionSet&lt;WebKit::WebsiteDataType&gt; websiteDataTypes, Vector&lt;WebCore::SecurityOriginData&gt; origins, uint64_t callbackID)
</span><span class="cx">     GrantSandboxExtensionsForBlobs(Vector&lt;String&gt; paths, WebKit::SandboxExtension::HandleArray extensions)
</span><ins>+
+    DidGetSandboxExtensionsForBlobFiles(uint64_t requestID, WebKit::SandboxExtension::HandleArray extensions)
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(DATABASE_PROCESS)
</span></span></pre></div>
<a id="trunkSourceWebKit2DatabaseProcessIndexedDBWebIDBConnectionToClientcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/DatabaseProcess/IndexedDB/WebIDBConnectionToClient.cpp (199707 => 199708)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/DatabaseProcess/IndexedDB/WebIDBConnectionToClient.cpp        2016-04-19 05:08:53 UTC (rev 199707)
+++ trunk/Source/WebKit2/DatabaseProcess/IndexedDB/WebIDBConnectionToClient.cpp        2016-04-19 06:02:04 UTC (rev 199708)
</span><span class="lines">@@ -127,7 +127,16 @@
</span><span class="cx"> 
</span><span class="cx"> void WebIDBConnectionToClient::didGetRecord(const WebCore::IDBResultData&amp; resultData)
</span><span class="cx"> {
</span><del>-    send(Messages::WebIDBConnectionToServer::DidGetRecord(resultData));
</del><ins>+    auto&amp; blobFilePaths = resultData.getResult().value().blobFilePaths();
+    if (blobFilePaths.isEmpty()) {
+        send(Messages::WebIDBConnectionToServer::DidGetRecord(resultData));
+        return;
+    }
+
+    RefPtr&lt;WebIDBConnectionToClient&gt; protector(this);
+    DatabaseProcess::singleton().getSandboxExtensionsForBlobFiles(blobFilePaths, [protector, this, resultData](const SandboxExtension::HandleArray&amp; handles) {
+        send(Messages::WebIDBConnectionToServer::DidGetRecordWithSandboxExtensions(resultData, handles));
+    });
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebIDBConnectionToClient::didGetCount(const WebCore::IDBResultData&amp; resultData)
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcessFileAPINetworkBlobRegistrycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/FileAPI/NetworkBlobRegistry.cpp (199707 => 199708)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/FileAPI/NetworkBlobRegistry.cpp        2016-04-19 05:08:53 UTC (rev 199707)
+++ trunk/Source/WebKit2/NetworkProcess/FileAPI/NetworkBlobRegistry.cpp        2016-04-19 06:02:04 UTC (rev 199708)
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx"> #include &quot;NetworkBlobRegistry.h&quot;
</span><span class="cx"> 
</span><span class="cx"> #include &quot;BlobDataFileReferenceWithSandboxExtension.h&quot;
</span><ins>+#include &quot;NetworkConnectionToWebProcess.h&quot;
</ins><span class="cx"> #include &quot;SandboxExtension.h&quot;
</span><span class="cx"> #include &lt;WebCore/BlobPart.h&gt;
</span><span class="cx"> #include &lt;WebCore/BlobRegistryImpl.h&gt;
</span><span class="lines">@@ -85,8 +86,11 @@
</span><span class="cx"> 
</span><span class="cx"> void NetworkBlobRegistry::registerBlobURLOptionallyFileBacked(NetworkConnectionToWebProcess* connection, const URL&amp; url, const URL&amp; srcURL, const String&amp; fileBackedPath)
</span><span class="cx"> {
</span><del>-    blobRegistry().registerBlobURLOptionallyFileBacked(url, srcURL, fileBackedPath);
</del><ins>+    auto fileReference = connection-&gt;takeBlobDataFileReferenceForPath(fileBackedPath);
+    ASSERT(fileReference);
</ins><span class="cx"> 
</span><ins>+    blobRegistry().registerBlobURLOptionallyFileBacked(url, srcURL, WTFMove(fileReference));
+
</ins><span class="cx">     ASSERT(!m_blobsForConnection.get(connection).contains(url));
</span><span class="cx">     BlobForConnectionMap::iterator mapIterator = m_blobsForConnection.find(connection);
</span><span class="cx">     if (mapIterator == m_blobsForConnection.end())
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcessNetworkConnectionToWebProcesscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp (199707 => 199708)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp        2016-04-19 05:08:53 UTC (rev 199707)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp        2016-04-19 06:02:04 UTC (rev 199708)
</span><span class="lines">@@ -26,6 +26,7 @@
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #include &quot;NetworkConnectionToWebProcess.h&quot;
</span><span class="cx"> 
</span><ins>+#include &quot;BlobDataFileReferenceWithSandboxExtension.h&quot;
</ins><span class="cx"> #include &quot;NetworkBlobRegistry.h&quot;
</span><span class="cx"> #include &quot;NetworkConnectionToWebProcessMessages.h&quot;
</span><span class="cx"> #include &quot;NetworkLoad.h&quot;
</span><span class="lines">@@ -271,6 +272,23 @@
</span><span class="cx">     NetworkBlobRegistry::singleton().registerBlobURL(this, url, srcURL);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void NetworkConnectionToWebProcess::preregisterSandboxExtensionsForOptionallyFileBackedBlob(const Vector&lt;String&gt;&amp; filePaths, const SandboxExtension::HandleArray&amp; handles)
+{
+    ASSERT(filePaths.size() == handles.size());
+
+    for (size_t i = 0; i &lt; filePaths.size(); ++i) {
+        auto result = m_blobDataFileReferences.add(filePaths[i], BlobDataFileReferenceWithSandboxExtension::create(filePaths[i], SandboxExtension::create(handles[i])));
+        ASSERT_UNUSED(result, result.isNewEntry);
+    }
+}
+
+RefPtr&lt;WebCore::BlobDataFileReference&gt; NetworkConnectionToWebProcess::takeBlobDataFileReferenceForPath(const String&amp; path)
+{
+    auto fileReference = m_blobDataFileReferences.take(path);
+    ASSERT(fileReference);
+    return fileReference;
+}
+
</ins><span class="cx"> void NetworkConnectionToWebProcess::registerBlobURLOptionallyFileBacked(const URL&amp; url, const URL&amp; srcURL, const String&amp; fileBackedPath)
</span><span class="cx"> {
</span><span class="cx">     NetworkBlobRegistry::singleton().registerBlobURLOptionallyFileBacked(this, url, srcURL, fileBackedPath);
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcessNetworkConnectionToWebProcessh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.h (199707 => 199708)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.h        2016-04-19 05:08:53 UTC (rev 199707)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.h        2016-04-19 06:02:04 UTC (rev 199708)
</span><span class="lines">@@ -35,6 +35,7 @@
</span><span class="cx"> #include &lt;wtf/RefCounted.h&gt;
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><ins>+class BlobDataFileReference;
</ins><span class="cx"> class ResourceRequest;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -54,6 +55,8 @@
</span><span class="cx"> 
</span><span class="cx">     void didCleanupResourceLoader(NetworkResourceLoader&amp;);
</span><span class="cx"> 
</span><ins>+    RefPtr&lt;WebCore::BlobDataFileReference&gt; takeBlobDataFileReferenceForPath(const String&amp; path);
+
</ins><span class="cx"> private:
</span><span class="cx">     NetworkConnectionToWebProcess(IPC::Connection::Identifier);
</span><span class="cx"> 
</span><span class="lines">@@ -91,6 +94,7 @@
</span><span class="cx">     void registerFileBlobURL(const WebCore::URL&amp;, const String&amp; path, const SandboxExtension::Handle&amp;, const String&amp; contentType);
</span><span class="cx">     void registerBlobURL(const WebCore::URL&amp;, Vector&lt;WebCore::BlobPart&gt;, const String&amp; contentType);
</span><span class="cx">     void registerBlobURLFromURL(const WebCore::URL&amp;, const WebCore::URL&amp; srcURL);
</span><ins>+    void preregisterSandboxExtensionsForOptionallyFileBackedBlob(const Vector&lt;String&gt;&amp; fileBackedPath, const SandboxExtension::HandleArray&amp;);
</ins><span class="cx">     void registerBlobURLOptionallyFileBacked(const WebCore::URL&amp;, const WebCore::URL&amp; srcURL, const String&amp; fileBackedPath);
</span><span class="cx">     void registerBlobURLForSlice(const WebCore::URL&amp;, const WebCore::URL&amp; srcURL, int64_t start, int64_t end);
</span><span class="cx">     void blobSize(const WebCore::URL&amp;, uint64_t&amp; resultSize);
</span><span class="lines">@@ -102,6 +106,7 @@
</span><span class="cx">     RefPtr&lt;IPC::Connection&gt; m_connection;
</span><span class="cx"> 
</span><span class="cx">     HashMap&lt;ResourceLoadIdentifier, RefPtr&lt;NetworkResourceLoader&gt;&gt; m_networkResourceLoaders;
</span><ins>+    HashMap&lt;String, RefPtr&lt;WebCore::BlobDataFileReference&gt;&gt; m_blobDataFileReferences;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcessNetworkConnectionToWebProcessmessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.messages.in (199707 => 199708)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.messages.in        2016-04-19 05:08:53 UTC (rev 199707)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.messages.in        2016-04-19 06:02:04 UTC (rev 199708)
</span><span class="lines">@@ -43,6 +43,7 @@
</span><span class="cx">     RegisterFileBlobURL(WebCore::URL url, String path, WebKit::SandboxExtension::Handle extensionHandle, String contentType)
</span><span class="cx">     RegisterBlobURL(WebCore::URL url, Vector&lt;WebCore::BlobPart&gt; blobParts, String contentType)
</span><span class="cx">     RegisterBlobURLFromURL(WebCore::URL url, WebCore::URL srcURL)
</span><ins>+    PreregisterSandboxExtensionsForOptionallyFileBackedBlob(Vector&lt;String&gt; filePaths, WebKit::SandboxExtension::HandleArray extensionHandles)
</ins><span class="cx">     RegisterBlobURLOptionallyFileBacked(WebCore::URL url, WebCore::URL srcURL, String fileBackedPath)
</span><span class="cx">     RegisterBlobURLForSlice(WebCore::URL url, WebCore::URL srcURL, int64_t start, int64_t end)
</span><span class="cx">     UnregisterBlobURL(WebCore::URL url)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessDatabasesDatabaseProcessProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Databases/DatabaseProcessProxy.cpp (199707 => 199708)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Databases/DatabaseProcessProxy.cpp        2016-04-19 05:08:53 UTC (rev 199707)
+++ trunk/Source/WebKit2/UIProcess/Databases/DatabaseProcessProxy.cpp        2016-04-19 06:02:04 UTC (rev 199708)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;DatabaseProcessMessages.h&quot;
</span><span class="cx"> #include &quot;DatabaseProcessProxyMessages.h&quot;
</span><ins>+#include &quot;NetworkProcessMessages.h&quot;
</ins><span class="cx"> #include &quot;WebProcessPool.h&quot;
</span><span class="cx"> #include &quot;WebsiteData.h&quot;
</span><span class="cx"> #include &lt;WebCore/NotImplemented.h&gt;
</span><span class="lines">@@ -195,6 +196,18 @@
</span><span class="cx">     callback();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void DatabaseProcessProxy::getSandboxExtensionsForBlobFiles(uint64_t requestID, const Vector&lt;String&gt;&amp; paths)
+{
+    SandboxExtension::HandleArray extensions;
+    extensions.allocate(paths.size());
+    for (size_t i = 0; i &lt; paths.size(); ++i) {
+        // ReadWrite is required for creating hard links, which is something that might be done with these extensions.
+        SandboxExtension::createHandle(paths[i], SandboxExtension::ReadWrite, extensions[i]);
+    }
+
+    send(Messages::DatabaseProcess::DidGetSandboxExtensionsForBlobFiles(requestID, extensions), 0);
+}
+
</ins><span class="cx"> void DatabaseProcessProxy::didFinishLaunching(ProcessLauncher* launcher, IPC::Connection::Identifier connectionIdentifier)
</span><span class="cx"> {
</span><span class="cx">     ChildProcessProxy::didFinishLaunching(launcher, connectionIdentifier);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessDatabasesDatabaseProcessProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Databases/DatabaseProcessProxy.h (199707 => 199708)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Databases/DatabaseProcessProxy.h        2016-04-19 05:08:53 UTC (rev 199707)
+++ trunk/Source/WebKit2/UIProcess/Databases/DatabaseProcessProxy.h        2016-04-19 06:02:04 UTC (rev 199708)
</span><span class="lines">@@ -76,6 +76,7 @@
</span><span class="cx">     void didFetchWebsiteData(uint64_t callbackID, const WebsiteData&amp;);
</span><span class="cx">     void didDeleteWebsiteData(uint64_t callbackID);
</span><span class="cx">     void didDeleteWebsiteDataForOrigins(uint64_t callbackID);
</span><ins>+    void getSandboxExtensionsForBlobFiles(uint64_t requestID, const Vector&lt;String&gt;&amp; paths);
</ins><span class="cx"> 
</span><span class="cx">     // ProcessLauncher::Client
</span><span class="cx">     void didFinishLaunching(ProcessLauncher*, IPC::Connection::Identifier) override;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessDatabasesDatabaseProcessProxymessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Databases/DatabaseProcessProxy.messages.in (199707 => 199708)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Databases/DatabaseProcessProxy.messages.in        2016-04-19 05:08:53 UTC (rev 199707)
+++ trunk/Source/WebKit2/UIProcess/Databases/DatabaseProcessProxy.messages.in        2016-04-19 06:02:04 UTC (rev 199708)
</span><span class="lines">@@ -28,6 +28,8 @@
</span><span class="cx">     DidFetchWebsiteData(uint64_t callbackID, struct WebKit::WebsiteData websiteData)
</span><span class="cx">     DidDeleteWebsiteData(uint64_t callbackID)
</span><span class="cx">     DidDeleteWebsiteDataForOrigins(uint64_t callbackID)
</span><ins>+
+    GetSandboxExtensionsForBlobFiles(uint64_t requestID, Vector&lt;String&gt; paths)
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(DATABASE_PROCESS)
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessDatabasesIndexedDBWebIDBConnectionToServercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp (199707 => 199708)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp        2016-04-19 05:08:53 UTC (rev 199707)
+++ trunk/Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp        2016-04-19 06:02:04 UTC (rev 199708)
</span><span class="lines">@@ -30,6 +30,8 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;DataReference.h&quot;
</span><span class="cx"> #include &quot;DatabaseToWebProcessConnectionMessages.h&quot;
</span><ins>+#include &quot;NetworkConnectionToWebProcessMessages.h&quot;
+#include &quot;NetworkProcessConnection.h&quot;
</ins><span class="cx"> #include &quot;WebIDBConnectionToClientMessages.h&quot;
</span><span class="cx"> #include &quot;WebProcess.h&quot;
</span><span class="cx"> #include &quot;WebToDatabaseProcessConnection.h&quot;
</span><span class="lines">@@ -235,6 +237,17 @@
</span><span class="cx">     m_connectionToServer-&gt;didGetRecord(result);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void WebIDBConnectionToServer::didGetRecordWithSandboxExtensions(const WebCore::IDBResultData&amp; result, const SandboxExtension::HandleArray&amp; handles)
+{
+    const auto&amp; filePaths = result.getResult().value().blobFilePaths();
+
+    ASSERT(filePaths.size() == handles.size());
+
+    WebProcess::singleton().networkConnection()-&gt;connection()-&gt;send(Messages::NetworkConnectionToWebProcess::PreregisterSandboxExtensionsForOptionallyFileBackedBlob(filePaths, handles), 0);
+
+    m_connectionToServer-&gt;didGetRecord(result);
+}
+
</ins><span class="cx"> void WebIDBConnectionToServer::didGetCount(const IDBResultData&amp; result)
</span><span class="cx"> {
</span><span class="cx">     m_connectionToServer-&gt;didGetCount(result);
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessDatabasesIndexedDBWebIDBConnectionToServerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h (199707 => 199708)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h        2016-04-19 05:08:53 UTC (rev 199707)
+++ trunk/Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h        2016-04-19 06:02:04 UTC (rev 199708)
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx"> #if ENABLE(INDEXED_DATABASE)
</span><span class="cx"> 
</span><span class="cx"> #include &quot;MessageSender.h&quot;
</span><ins>+#include &quot;SandboxExtension.h&quot;
</ins><span class="cx"> #include &lt;WebCore/IDBConnectionToServer.h&gt;
</span><span class="cx"> 
</span><span class="cx"> namespace WebKit {
</span><span class="lines">@@ -80,6 +81,7 @@
</span><span class="cx">     void didDeleteIndex(const WebCore::IDBResultData&amp;);
</span><span class="cx">     void didPutOrAdd(const WebCore::IDBResultData&amp;);
</span><span class="cx">     void didGetRecord(const WebCore::IDBResultData&amp;);
</span><ins>+    void didGetRecordWithSandboxExtensions(const WebCore::IDBResultData&amp;, const SandboxExtension::HandleArray&amp;);
</ins><span class="cx">     void didGetCount(const WebCore::IDBResultData&amp;);
</span><span class="cx">     void didDeleteRecord(const WebCore::IDBResultData&amp;);
</span><span class="cx">     void didOpenCursor(const WebCore::IDBResultData&amp;);
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessDatabasesIndexedDBWebIDBConnectionToServermessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.messages.in (199707 => 199708)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.messages.in        2016-04-19 05:08:53 UTC (rev 199707)
+++ trunk/Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.messages.in        2016-04-19 06:02:04 UTC (rev 199708)
</span><span class="lines">@@ -34,6 +34,7 @@
</span><span class="cx">     DidDeleteIndex(WebCore::IDBResultData result)
</span><span class="cx">     DidPutOrAdd(WebCore::IDBResultData result)
</span><span class="cx">     DidGetRecord(WebCore::IDBResultData result)
</span><ins>+    DidGetRecordWithSandboxExtensions(WebCore::IDBResultData result, WebKit::SandboxExtension::HandleArray extensions)
</ins><span class="cx">     DidGetCount(WebCore::IDBResultData result)
</span><span class="cx">     DidDeleteRecord(WebCore::IDBResultData result)
</span><span class="cx">     DidOpenCursor(WebCore::IDBResultData result)
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessFileAPIBlobRegistryProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/FileAPI/BlobRegistryProxy.cpp (199707 => 199708)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/FileAPI/BlobRegistryProxy.cpp        2016-04-19 05:08:53 UTC (rev 199707)
+++ trunk/Source/WebKit2/WebProcess/FileAPI/BlobRegistryProxy.cpp        2016-04-19 06:02:04 UTC (rev 199708)
</span><span class="lines">@@ -57,9 +57,10 @@
</span><span class="cx">     WebProcess::singleton().networkConnection()-&gt;connection()-&gt;send(Messages::NetworkConnectionToWebProcess::RegisterBlobURLFromURL(url, srcURL), 0);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void BlobRegistryProxy::registerBlobURLOptionallyFileBacked(const URL&amp; url, const URL&amp; srcURL, const String&amp; fileBackedPath)
</del><ins>+void BlobRegistryProxy::registerBlobURLOptionallyFileBacked(const URL&amp; url, const URL&amp; srcURL, RefPtr&lt;WebCore::BlobDataFileReference&gt;&amp;&amp; file)
</ins><span class="cx"> {
</span><del>-    WebProcess::singleton().networkConnection()-&gt;connection()-&gt;send(Messages::NetworkConnectionToWebProcess::RegisterBlobURLOptionallyFileBacked(url, srcURL, fileBackedPath), 0);
</del><ins>+    ASSERT(file);
+    WebProcess::singleton().networkConnection()-&gt;connection()-&gt;send(Messages::NetworkConnectionToWebProcess::RegisterBlobURLOptionallyFileBacked(url, srcURL, file-&gt;path()), 0);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void BlobRegistryProxy::unregisterBlobURL(const URL&amp; url)
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessFileAPIBlobRegistryProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/FileAPI/BlobRegistryProxy.h (199707 => 199708)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/FileAPI/BlobRegistryProxy.h        2016-04-19 05:08:53 UTC (rev 199707)
+++ trunk/Source/WebKit2/WebProcess/FileAPI/BlobRegistryProxy.h        2016-04-19 06:02:04 UTC (rev 199708)
</span><span class="lines">@@ -35,7 +35,7 @@
</span><span class="cx">     void registerFileBlobURL(const WebCore::URL&amp;, RefPtr&lt;WebCore::BlobDataFileReference&gt;&amp;&amp;, const String&amp; contentType) override;
</span><span class="cx">     void registerBlobURL(const WebCore::URL&amp;, Vector&lt;WebCore::BlobPart&gt;, const String&amp; contentType) override;
</span><span class="cx">     void registerBlobURL(const WebCore::URL&amp;, const WebCore::URL&amp; srcURL) override;
</span><del>-    void registerBlobURLOptionallyFileBacked(const WebCore::URL&amp;, const WebCore::URL&amp; srcURL, const String&amp; fileBackedPath) override;
</del><ins>+    void registerBlobURLOptionallyFileBacked(const WebCore::URL&amp;, const WebCore::URL&amp; srcURL, RefPtr&lt;WebCore::BlobDataFileReference&gt;&amp;&amp;) override;
</ins><span class="cx">     void unregisterBlobURL(const WebCore::URL&amp;) override;
</span><span class="cx">     void registerBlobURLForSlice(const WebCore::URL&amp;, const WebCore::URL&amp; srcURL, long long start, long long end) override;
</span><span class="cx">     unsigned long long blobSize(const WebCore::URL&amp;) override;
</span></span></pre>
</div>
</div>

</body>
</html>