<!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>[168518] 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/168518">168518</a></dd>
<dt>Author</dt> <dd>ap@apple.com</dd>
<dt>Date</dt> <dd>2014-05-08 21:37:25 -0700 (Thu, 08 May 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Automatically zip document bundles used via File API
https://bugs.webkit.org/show_bug.cgi?id=132713
&lt;rdar://problem/13397892&gt;

Reviewed by Anders Carlsson.

Source/WebCore:
Tests: fast/files/filereader-zip-bundle.html
       http/tests/local/fileapi/upload-zip-bundle-as-blob.html

* FileMac.mm: Added.
(WebCore::File::shouldReplaceFile):
(WebCore::File::computeNameAndContentTypeForReplacedFile):
Added code that decides what to do with a bundle. We need this to happen in
WebProcess, because HTML5 dropzone depends on this, it needs to know file type
even before a File object can be created.

* WebCore.exp.in: Export new functions.

* WebCore.xcodeproj/project.pbxproj: Added new files.

* dom/DataTransfer.cpp: (WebCore::DataTransfer::hasFileOfType): Updated for File
interface change.

* fileapi/File.h:
* fileapi/File.cpp:
(WebCore::File::File):
(WebCore::File::computeNameAndContentType):
(WebCore::File::contentTypeForFile):
(WebCore::File::contentTypeFromFilePathOrName): Deleted.
Make it possible for a subclass to affect file name and content type calculation.

* platform/network/BlobDataFileReference.cpp:
(WebCore::BlobDataFileReference::BlobDataFileReference):
(WebCore::BlobDataFileReference::~BlobDataFileReference):
(WebCore::BlobDataFileReference::path):
(WebCore::BlobDataFileReference::size):
(WebCore::BlobDataFileReference::expectedModificationTime):
(WebCore::BlobDataFileReference::startTrackingModifications):
* platform/network/BlobDataFileReference.h:
(WebCore::BlobDataFileReference::path): Deleted.
(WebCore::BlobDataFileReference::BlobDataFileReference): Deleted.
Use original or replaced file, as appropriate.

* platform/network/mac/BlobDataFileReferenceMac.mm: Added.
(WebCore::BlobDataFileReference::generateReplacementFile): Implements generateReplacementFile().

* platform/network/FormData.h: Added a FIXME.

* xml/XMLHttpRequest.cpp: (WebCore::XMLHttpRequest::send): Always use Blob code path
for blobs, don't unwrap them into a file path.

Source/WebKit2:
* NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in: NetworkProcess
now uses FileCoordination (WebProcess already had this allowed).

* Shared/BlobDataFileReferenceWithSandboxExtension.h: Added final to the class.

Source/WTF:
* wtf/FeatureDefines.h: Added ENABLE_FILE_REPLACEMENT for Mac.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWTFChangeLog">trunk/Source/WTF/ChangeLog</a></li>
<li><a href="#trunkSourceWTFwtfFeatureDefinesh">trunk/Source/WTF/wtf/FeatureDefines.h</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCoreexpin">trunk/Source/WebCore/WebCore.exp.in</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCoredomDataTransfercpp">trunk/Source/WebCore/dom/DataTransfer.cpp</a></li>
<li><a href="#trunkSourceWebCorefileapiFilecpp">trunk/Source/WebCore/fileapi/File.cpp</a></li>
<li><a href="#trunkSourceWebCorefileapiFileh">trunk/Source/WebCore/fileapi/File.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkBlobDataFileReferencecpp">trunk/Source/WebCore/platform/network/BlobDataFileReference.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkBlobDataFileReferenceh">trunk/Source/WebCore/platform/network/BlobDataFileReference.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkFormDatah">trunk/Source/WebCore/platform/network/FormData.h</a></li>
<li><a href="#trunkSourceWebCorexmlXMLHttpRequestcpp">trunk/Source/WebCore/xml/XMLHttpRequest.cpp</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcessmaccomappleWebKitNetworkProcesssbin">trunk/Source/WebKit2/NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in</a></li>
<li><a href="#trunkSourceWebKit2SharedBlobDataFileReferenceWithSandboxExtensionh">trunk/Source/WebKit2/Shared/BlobDataFileReferenceWithSandboxExtension.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCorefileapiFileMacmm">trunk/Source/WebCore/fileapi/FileMac.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkmacBlobDataFileReferenceMacmm">trunk/Source/WebCore/platform/network/mac/BlobDataFileReferenceMac.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/ChangeLog (168517 => 168518)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/ChangeLog        2014-05-09 04:11:28 UTC (rev 168517)
+++ trunk/Source/WTF/ChangeLog        2014-05-09 04:37:25 UTC (rev 168518)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2014-05-08  Alexey Proskuryakov  &lt;ap@apple.com&gt;
+
+        Automatically zip document bundles used via File API
+        https://bugs.webkit.org/show_bug.cgi?id=132713
+        &lt;rdar://problem/13397892&gt;
+
+        Reviewed by Anders Carlsson.
+
+        * wtf/FeatureDefines.h: Added ENABLE_FILE_REPLACEMENT for Mac.
+
</ins><span class="cx"> 2014-05-07  Filip Pizlo  &lt;fpizlo@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         UNREACHABLE_FOR_PLATFORM() is meant to be a release crash.
</span></span></pre></div>
<a id="trunkSourceWTFwtfFeatureDefinesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/FeatureDefines.h (168517 => 168518)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/FeatureDefines.h        2014-05-09 04:11:28 UTC (rev 168517)
+++ trunk/Source/WTF/wtf/FeatureDefines.h        2014-05-09 04:37:25 UTC (rev 168518)
</span><span class="lines">@@ -236,6 +236,10 @@
</span><span class="cx"> #define ENABLE_MEDIA_SOURCE 1
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if !defined(ENABLE_FILE_REPLACEMENT)
+#define ENABLE_FILE_REPLACEMENT 1
+#endif
+
</ins><span class="cx"> #endif /* PLATFORM(MAC) */
</span><span class="cx"> 
</span><span class="cx"> /* --------- Apple Windows port --------- */
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (168517 => 168518)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-05-09 04:11:28 UTC (rev 168517)
+++ trunk/Source/WebCore/ChangeLog        2014-05-09 04:37:25 UTC (rev 168518)
</span><span class="lines">@@ -1,3 +1,56 @@
</span><ins>+2014-05-08  Alexey Proskuryakov  &lt;ap@apple.com&gt;
+
+        Automatically zip document bundles used via File API
+        https://bugs.webkit.org/show_bug.cgi?id=132713
+        &lt;rdar://problem/13397892&gt;
+
+        Reviewed by Anders Carlsson.
+
+        Tests: fast/files/filereader-zip-bundle.html
+               http/tests/local/fileapi/upload-zip-bundle-as-blob.html
+
+        * FileMac.mm: Added.
+        (WebCore::File::shouldReplaceFile):
+        (WebCore::File::computeNameAndContentTypeForReplacedFile):
+        Added code that decides what to do with a bundle. We need this to happen in
+        WebProcess, because HTML5 dropzone depends on this, it needs to know file type
+        even before a File object can be created.
+
+        * WebCore.exp.in: Export new functions.
+
+        * WebCore.xcodeproj/project.pbxproj: Added new files.
+
+        * dom/DataTransfer.cpp: (WebCore::DataTransfer::hasFileOfType): Updated for File
+        interface change.
+
+        * fileapi/File.h:
+        * fileapi/File.cpp:
+        (WebCore::File::File):
+        (WebCore::File::computeNameAndContentType):
+        (WebCore::File::contentTypeForFile):
+        (WebCore::File::contentTypeFromFilePathOrName): Deleted.
+        Make it possible for a subclass to affect file name and content type calculation.
+
+        * platform/network/BlobDataFileReference.cpp:
+        (WebCore::BlobDataFileReference::BlobDataFileReference):
+        (WebCore::BlobDataFileReference::~BlobDataFileReference):
+        (WebCore::BlobDataFileReference::path):
+        (WebCore::BlobDataFileReference::size):
+        (WebCore::BlobDataFileReference::expectedModificationTime):
+        (WebCore::BlobDataFileReference::startTrackingModifications):
+        * platform/network/BlobDataFileReference.h:
+        (WebCore::BlobDataFileReference::path): Deleted.
+        (WebCore::BlobDataFileReference::BlobDataFileReference): Deleted.
+        Use original or replaced file, as appropriate. 
+
+        * platform/network/mac/BlobDataFileReferenceMac.mm: Added.
+        (WebCore::BlobDataFileReference::generateReplacementFile): Implements generateReplacementFile().
+
+        * platform/network/FormData.h: Added a FIXME.
+
+        * xml/XMLHttpRequest.cpp: (WebCore::XMLHttpRequest::send): Always use Blob code path
+        for blobs, don't unwrap them into a file path.
+
</ins><span class="cx"> 2014-05-08  Simon Fraser  &lt;simon.fraser@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Occasional crash under AsyncScrollingCoordinator::frameViewRootLayerDidChange() on history navigation
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.exp.in (168517 => 168518)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.exp.in        2014-05-09 04:11:28 UTC (rev 168517)
+++ trunk/Source/WebCore/WebCore.exp.in        2014-05-09 04:37:25 UTC (rev 168518)
</span><span class="lines">@@ -867,6 +867,8 @@
</span><span class="cx"> __ZN7WebCore21BackForwardController11itemAtIndexEi
</span><span class="cx"> __ZN7WebCore21BackForwardController6goBackEv
</span><span class="cx"> __ZN7WebCore21BackForwardController9goForwardEv
</span><ins>+__ZN7WebCore21BlobDataFileReference4pathEv
+__ZN7WebCore21BlobDataFileReferenceC2ERKN3WTF6StringE
</ins><span class="cx"> __ZN7WebCore21BlobDataFileReferenceD2Ev
</span><span class="cx"> __ZN7WebCore21CrossThreadCopierBaseILb0ELb0EN3WTF6StringEE4copyERKS2_
</span><span class="cx"> __ZN7WebCore21CrossThreadCopierBaseILb0ELb0ENS_19IDBDatabaseMetadataEE4copyERKS1_
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (168517 => 168518)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-05-09 04:11:28 UTC (rev 168517)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-05-09 04:37:25 UTC (rev 168518)
</span><span class="lines">@@ -5862,6 +5862,8 @@
</span><span class="cx">                 E15A36D71104572000B7B639 /* XMLNSNames.h in Headers */ = {isa = PBXBuildFile; fileRef = E15A36D61104572000B7B639 /* XMLNSNames.h */; };
</span><span class="cx">                 E15A36D91104572700B7B639 /* XMLNSNames.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E15A36D81104572700B7B639 /* XMLNSNames.cpp */; };
</span><span class="cx">                 E15FF7D518C9553800FE4C87 /* KeypressCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = E15FF7D418C9553800FE4C87 /* KeypressCommand.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><ins>+                E164A2E9191AC5BB0010737D /* FileMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = E164A2E7191AC5BB0010737D /* FileMac.mm */; };
+                E164A2ED191AE6350010737D /* BlobDataFileReferenceMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = E164A2EB191AE6350010737D /* BlobDataFileReferenceMac.mm */; };
</ins><span class="cx">                 E164FAA318315BF400DB4E61 /* CryptoKeyRSA.h in Headers */ = {isa = PBXBuildFile; fileRef = E164FAA218315BF400DB4E61 /* CryptoKeyRSA.h */; };
</span><span class="cx">                 E164FAA518315E1A00DB4E61 /* CryptoKeyRSAMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E164FAA418315E1A00DB4E61 /* CryptoKeyRSAMac.cpp */; };
</span><span class="cx">                 E169803D1133542D00894115 /* CRuntimeObject.h in Headers */ = {isa = PBXBuildFile; fileRef = E169803C1133542D00894115 /* CRuntimeObject.h */; };
</span><span class="lines">@@ -13258,6 +13260,8 @@
</span><span class="cx">                 E15A36D61104572000B7B639 /* XMLNSNames.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XMLNSNames.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E15A36D81104572700B7B639 /* XMLNSNames.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XMLNSNames.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E15FF7D418C9553800FE4C87 /* KeypressCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KeypressCommand.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                E164A2E7191AC5BB0010737D /* FileMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = FileMac.mm; path = fileapi/FileMac.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
+                E164A2EB191AE6350010737D /* BlobDataFileReferenceMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = BlobDataFileReferenceMac.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 E164FAA218315BF400DB4E61 /* CryptoKeyRSA.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CryptoKeyRSA.h; path = keys/CryptoKeyRSA.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E164FAA418315E1A00DB4E61 /* CryptoKeyRSAMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CryptoKeyRSAMac.cpp; path = mac/CryptoKeyRSAMac.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E169803C1133542D00894115 /* CRuntimeObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CRuntimeObject.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -16130,6 +16134,7 @@
</span><span class="cx">                         children = (
</span><span class="cx">                                 514C76420CE9234E007EF3CD /* AuthenticationMac.h */,
</span><span class="cx">                                 514C76430CE9234E007EF3CD /* AuthenticationMac.mm */,
</span><ins>+                                E164A2EB191AE6350010737D /* BlobDataFileReferenceMac.mm */,
</ins><span class="cx">                                 5F2DBBE8178E336900141486 /* CertificateInfo.h */,
</span><span class="cx">                                 5F2DBBE7178E332D00141486 /* CertificateInfoMac.mm */,
</span><span class="cx">                                 E1424C8F164B460B00F32D40 /* CookieJarMac.mm */,
</span><span class="lines">@@ -17868,6 +17873,7 @@
</span><span class="cx">                                 976D6C5F122B8A3D001FD1F7 /* BlobURL.cpp */,
</span><span class="cx">                                 976D6C60122B8A3D001FD1F7 /* BlobURL.h */,
</span><span class="cx">                                 976D6C61122B8A3D001FD1F7 /* File.cpp */,
</span><ins>+                                E164A2E7191AC5BB0010737D /* FileMac.mm */,
</ins><span class="cx">                                 976D6C62122B8A3D001FD1F7 /* File.h */,
</span><span class="cx">                                 E1AB1EB714E9E35800449E13 /* File.idl */,
</span><span class="cx">                                 976D6C64122B8A3D001FD1F7 /* FileError.h */,
</span><span class="lines">@@ -26701,6 +26707,7 @@
</span><span class="cx">                                 49E912AA0EFAC906009D0CAF /* Animation.cpp in Sources */,
</span><span class="cx">                                 316FE1110E6E1DA700BF6088 /* AnimationBase.cpp in Sources */,
</span><span class="cx">                                 316FE1130E6E1DA700BF6088 /* AnimationController.cpp in Sources */,
</span><ins>+                                E164A2ED191AE6350010737D /* BlobDataFileReferenceMac.mm in Sources */,
</ins><span class="cx">                                 49E912AC0EFAC906009D0CAF /* AnimationList.cpp in Sources */,
</span><span class="cx">                                 93309DD6099E64920056E581 /* AppendNodeCommand.cpp in Sources */,
</span><span class="cx">                                 1A8F6BBC0DB55CDC001DB794 /* ApplicationCache.cpp in Sources */,
</span><span class="lines">@@ -27997,6 +28004,7 @@
</span><span class="cx">                                 CDCFABBE18C0AF84006F8450 /* SelectionSubtreeRoot.cpp in Sources */,
</span><span class="cx">                                 CD27F6E51457685A0078207D /* JSMediaController.cpp in Sources */,
</span><span class="cx">                                 CDAB6D2D17C814EE00C60B34 /* JSMediaControlsHost.cpp in Sources */,
</span><ins>+                                E164A2E9191AC5BB0010737D /* FileMac.mm in Sources */,
</ins><span class="cx">                                 FD23A12513F5FA5900F67001 /* JSMediaElementAudioSourceNode.cpp in Sources */,
</span><span class="cx">                                 E44614180CD6826900FADA75 /* JSMediaError.cpp in Sources */,
</span><span class="cx">                                 CDA98DA31601464100FEA3B1 /* JSMediaKeyError.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCoredomDataTransfercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/DataTransfer.cpp (168517 => 168518)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/DataTransfer.cpp        2014-05-09 04:11:28 UTC (rev 168517)
+++ trunk/Source/WebCore/dom/DataTransfer.cpp        2014-05-09 04:37:25 UTC (rev 168518)
</span><span class="lines">@@ -188,8 +188,8 @@
</span><span class="cx"> {
</span><span class="cx">     ASSERT_WITH_SECURITY_IMPLICATION(canReadTypes());
</span><span class="cx"> 
</span><del>-    for (const String&amp; filename : m_pasteboard-&gt;readFilenames()) {
-        if (equalIgnoringCase(File::contentTypeFromFilePathOrName(filename), type))
</del><ins>+    for (const String&amp; path : m_pasteboard-&gt;readFilenames()) {
+        if (equalIgnoringCase(File::contentTypeForFile(path), type))
</ins><span class="cx">             return true;
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorefileapiFilecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/fileapi/File.cpp (168517 => 168518)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/fileapi/File.cpp        2014-05-09 04:11:28 UTC (rev 168517)
+++ trunk/Source/WebCore/fileapi/File.cpp        2014-05-09 04:37:25 UTC (rev 168518)
</span><span class="lines">@@ -40,22 +40,20 @@
</span><span class="cx"> File::File(const String&amp; path)
</span><span class="cx">     : Blob(uninitializedContructor)
</span><span class="cx">     , m_path(path)
</span><del>-    , m_name(pathGetFileName(path))
</del><span class="cx"> {
</span><span class="cx">     m_internalURL = BlobURL::createInternalURL();
</span><del>-    m_type = contentTypeFromFilePathOrName(path);
</del><span class="cx">     m_size = -1;
</span><ins>+    computeNameAndContentType(m_path, String(), m_name, m_type);
</ins><span class="cx">     ThreadableBlobRegistry::registerFileBlobURL(m_internalURL, path, m_type);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-File::File(const String&amp; path, const String&amp; name)
</del><ins>+File::File(const String&amp; path, const String&amp; nameOverride)
</ins><span class="cx">     : Blob(uninitializedContructor)
</span><span class="cx">     , m_path(path)
</span><del>-    , m_name(name)
</del><span class="cx"> {
</span><span class="cx">     m_internalURL = BlobURL::createInternalURL();
</span><del>-    m_type = contentTypeFromFilePathOrName(name);
</del><span class="cx">     m_size = -1;
</span><ins>+    computeNameAndContentType(m_path, nameOverride, m_name, m_type);
</ins><span class="cx">     ThreadableBlobRegistry::registerFileBlobURL(m_internalURL, path, m_type);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -63,9 +61,9 @@
</span><span class="cx">     : Blob(deserializationContructor, url, type, -1)
</span><span class="cx">     , m_path(path)
</span><span class="cx"> {
</span><del>-    m_name = pathGetFileName(path);
-    // FIXME: File object serialization/deserialization does not include m_name.
-    // See SerializedScriptValue.cpp
</del><ins>+    // FIXME: File object serialization/deserialization does not include m_name, see SerializedScriptValue.cpp.
+    // Once it does, we should take deserialized name verbatim, not compute it again.
+    computeNameAndContentType(m_path, String(), m_name, m_type);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> double File::lastModifiedDate() const
</span><span class="lines">@@ -77,13 +75,26 @@
</span><span class="cx">     return currentTime() * msPerSecond;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-String File::contentTypeFromFilePathOrName(const String&amp; name)
</del><ins>+void File::computeNameAndContentType(const String&amp; path, const String&amp; nameOverride, String&amp; effectiveName, String&amp; effectiveContentType)
</ins><span class="cx"> {
</span><ins>+#if ENABLE(FILE_REPLACEMENT)
+    if (shouldReplaceFile(path)) {
+        computeNameAndContentTypeForReplacedFile(path, nameOverride, effectiveName, effectiveContentType);
+        return;
+    }
+#endif
+    effectiveName = nameOverride.isNull() ? pathGetFileName(path) : nameOverride;
+    size_t index = effectiveName.reverseFind('.');
+    if (index != notFound)
+        effectiveContentType = MIMETypeRegistry::getMIMETypeForExtension(effectiveName.substring(index + 1));
+}
+
+String File::contentTypeForFile(const String&amp; path)
+{
+    String name;
</ins><span class="cx">     String type;
</span><del>-    int index = name.reverseFind('.');
-    if (index != -1) {
-        type = MIMETypeRegistry::getMIMETypeForExtension(name.substring(index + 1));
-    }
</del><ins>+    computeNameAndContentType(path, String(), name, type);
+
</ins><span class="cx">     return type;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorefileapiFileh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/fileapi/File.h (168517 => 168518)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/fileapi/File.h        2014-05-09 04:11:28 UTC (rev 168517)
+++ trunk/Source/WebCore/fileapi/File.h        2014-05-09 04:37:25 UTC (rev 168518)
</span><span class="lines">@@ -47,11 +47,11 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // Create a file with a name exposed to the author (via File.name and associated DOM properties) that differs from the one provided in the path.
</span><del>-    static PassRefPtr&lt;File&gt; createWithName(const String&amp; path, const String&amp; name)
</del><ins>+    static PassRefPtr&lt;File&gt; createWithName(const String&amp; path, const String&amp; nameOverride)
</ins><span class="cx">     {
</span><del>-        if (name.isEmpty())
</del><ins>+        if (nameOverride.isEmpty())
</ins><span class="cx">             return adoptRef(new File(path));
</span><del>-        return adoptRef(new File(path, name));
</del><ins>+        return adoptRef(new File(path, nameOverride));
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     virtual bool isFile() const override { return true; }
</span><span class="lines">@@ -62,14 +62,23 @@
</span><span class="cx">     // This returns the current date and time if the file's last modification date is not known (per spec: http://www.w3.org/TR/FileAPI/#dfn-lastModifiedDate).
</span><span class="cx">     double lastModifiedDate() const;
</span><span class="cx"> 
</span><del>-    static String contentTypeFromFilePathOrName(const String&amp;);
</del><ins>+    static String contentTypeForFile(const String&amp; path);
</ins><span class="cx"> 
</span><ins>+#if ENABLE(FILE_REPLACEMENT)
+    static bool shouldReplaceFile(const String&amp; path);
+#endif
+
</ins><span class="cx"> private:
</span><span class="cx">     explicit File(const String&amp; path);
</span><del>-    File(const String&amp; path, const String&amp; name);
</del><ins>+    File(const String&amp; path, const String&amp; nameOverride);
</ins><span class="cx"> 
</span><span class="cx">     File(DeserializationContructor, const String&amp; path, const URL&amp; srcURL, const String&amp; type);
</span><span class="cx"> 
</span><ins>+    static void computeNameAndContentType(const String&amp; path, const String&amp; nameOverride, String&amp; effectiveName, String&amp; effectiveContentType);
+#if ENABLE(FILE_REPLACEMENT)
+    static void computeNameAndContentTypeForReplacedFile(const String&amp; path, const String&amp; nameOverride, String&amp; effectiveName, String&amp; effectiveContentType);
+#endif
+
</ins><span class="cx">     String m_path;
</span><span class="cx">     String m_name;
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCorefileapiFileMacmm"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/fileapi/FileMac.mm (0 => 168518)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/fileapi/FileMac.mm                                (rev 0)
+++ trunk/Source/WebCore/fileapi/FileMac.mm        2014-05-09 04:37:25 UTC (rev 168518)
</span><span class="lines">@@ -0,0 +1,72 @@
</span><ins>+/*
+ * Copyright (C) 2014 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 &quot;config.h&quot;
+#include &quot;File.h&quot;
+
+#if ENABLE(FILE_REPLACEMENT)
+
+#include &quot;FileSystem.h&quot;
+
+namespace WebCore {
+
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored &quot;-Wdeprecated-declarations&quot;
+bool File::shouldReplaceFile(const String&amp; path)
+{
+    if (path.isEmpty())
+        return false;
+
+    FSRef pathRef;
+    Boolean targetIsFolder;
+    Boolean wasAliased;
+    NSString *aliasedPath = path;
+
+    // Determine if the file is an alias, and if so, get the target path.
+    if (FSPathMakeRef((UInt8 *)[path fileSystemRepresentation], &amp;pathRef, NULL) == noErr) {
+        if (FSResolveAliasFileWithMountFlags(&amp;pathRef, TRUE, &amp;targetIsFolder, &amp;wasAliased, kResolveAliasFileNoUI) == noErr &amp;&amp; wasAliased) {
+            char pathFromPathRef[PATH_MAX + 1]; // +1 is for \0 
+            if (FSRefMakePath(&amp;pathRef, (unsigned char *)pathFromPathRef, PATH_MAX) == noErr)
+                aliasedPath = [[NSFileManager defaultManager] stringWithFileSystemRepresentation:pathFromPathRef length:strlen(pathFromPathRef)];
+        }
+    }
+    
+    if (!aliasedPath)
+        return false;
+
+    return [[NSWorkspace sharedWorkspace] isFilePackageAtPath:aliasedPath];
+}
+#pragma clang diagnostic pop
+
+void File::computeNameAndContentTypeForReplacedFile(const String&amp; path, const String&amp; nameOverride, String&amp; effectiveName, String&amp; effectiveContentType)
+{
+    ASSERT(!pathGetFileName(path).endsWith('/')); // Expecting to get a path without trailing slash, even for directories.
+    effectiveContentType = ASCIILiteral(&quot;application/zip&quot;);
+    effectiveName = (nameOverride.isNull() ? pathGetFileName(path) : nameOverride) + ASCIILiteral(&quot;.zip&quot;);
+}
+
+}
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkBlobDataFileReferencecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/BlobDataFileReference.cpp (168517 => 168518)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/BlobDataFileReference.cpp        2014-05-09 04:11:28 UTC (rev 168517)
+++ trunk/Source/WebCore/platform/network/BlobDataFileReference.cpp        2014-05-09 04:37:25 UTC (rev 168518)
</span><span class="lines">@@ -26,21 +26,61 @@
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #include &quot;BlobDataFileReference.h&quot;
</span><span class="cx"> 
</span><ins>+#include &quot;File.h&quot;
</ins><span class="cx"> #include &quot;FileMetadata.h&quot;
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><ins>+BlobDataFileReference::BlobDataFileReference(const String&amp; path)
+    : m_path(path)
+#if ENABLE(FILE_REPLACEMENT)
+    , m_replacementShouldBeGenerated(false)
+#endif
+    , m_size(0)
+    , m_expectedModificationTime(invalidFileTime())
+{
+}
+
</ins><span class="cx"> BlobDataFileReference::~BlobDataFileReference()
</span><span class="cx"> {
</span><ins>+#if ENABLE(FILE_REPLACEMENT)
+    if (!m_replacementPath.isNull())
+        deleteFile(m_replacementPath);
+#endif
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-unsigned long long BlobDataFileReference::size() const
</del><ins>+const String&amp; BlobDataFileReference::path()
</ins><span class="cx"> {
</span><ins>+#if ENABLE(FILE_REPLACEMENT)
+    if (m_replacementShouldBeGenerated)
+        generateReplacementFile();
+
+    if (!m_replacementPath.isNull())
+        return m_replacementPath;
+#endif
+
+    return m_path;
+}
+
+unsigned long long BlobDataFileReference::size()
+{
+#if ENABLE(FILE_REPLACEMENT)
+    if (m_replacementShouldBeGenerated)
+        generateReplacementFile();
+#endif
+
</ins><span class="cx">     return m_size;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-double BlobDataFileReference::expectedModificationTime() const
</del><ins>+double BlobDataFileReference::expectedModificationTime()
</ins><span class="cx"> {
</span><ins>+#if ENABLE(FILE_REPLACEMENT)
+    // We do not currently track modifications for generated files, because we have a snapshot.
+    // Unfortunately, this is inconsistent with regular file handling - File objects should be invalidated when underlying files change.
+    if (m_replacementShouldBeGenerated || !m_replacementPath.isNull())
+        return invalidFileTime();
+#endif
+
</ins><span class="cx">     return m_expectedModificationTime;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -49,12 +89,26 @@
</span><span class="cx">     // This is not done automatically by the constructor, because BlobDataFileReference is
</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><ins>+
+    ASSERT(!isValidFileTime(m_expectedModificationTime));
+
+#if ENABLE(FILE_REPLACEMENT)
+    m_replacementShouldBeGenerated = File::shouldReplaceFile(m_path);
+#endif
+
+    // FIXME: Some platforms provide better ways to listen for file system object changes, consider using these.
</ins><span class="cx">     FileMetadata metadata;
</span><span class="cx">     if (!getFileMetadata(m_path, metadata))
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    m_expectedModificationTime = metadata.modificationTime;
+
+#if ENABLE(FILE_REPLACEMENT)
+    if (m_replacementShouldBeGenerated)
+        return;
+#endif
+
</ins><span class="cx">     m_size = metadata.length;
</span><del>-    m_expectedModificationTime = metadata.modificationTime;
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void BlobDataFileReference::prepareForFileAccess()
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkBlobDataFileReferenceh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/BlobDataFileReference.h (168517 => 168518)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/BlobDataFileReference.h        2014-05-09 04:11:28 UTC (rev 168517)
+++ trunk/Source/WebCore/platform/network/BlobDataFileReference.h        2014-05-09 04:37:25 UTC (rev 168518)
</span><span class="lines">@@ -43,23 +43,26 @@
</span><span class="cx"> 
</span><span class="cx">     void startTrackingModifications();
</span><span class="cx"> 
</span><del>-    const String&amp; path() const { return m_path; }
-    unsigned long long size() const;
-    double expectedModificationTime() const;
</del><ins>+    const String&amp; path();
+    unsigned long long size();
+    double expectedModificationTime();
</ins><span class="cx"> 
</span><span class="cx">     virtual void prepareForFileAccess();
</span><span class="cx">     virtual void revokeFileAccess();
</span><span class="cx"> 
</span><span class="cx"> protected:
</span><del>-    BlobDataFileReference(const String&amp; path)
-        : m_path(path)
-        , m_size(0)
-        , m_expectedModificationTime(invalidFileTime())
-    {
-    }
</del><ins>+    BlobDataFileReference(const String&amp; path);
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><ins>+#if ENABLE(FILE_REPLACEMENT)
+    void generateReplacementFile();
+#endif
+
</ins><span class="cx">     String m_path;
</span><ins>+#if ENABLE(FILE_REPLACEMENT)
+    String m_replacementPath;
+    bool m_replacementShouldBeGenerated;
+#endif
</ins><span class="cx">     unsigned long long m_size;
</span><span class="cx">     double m_expectedModificationTime;
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkFormDatah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/FormData.h (168517 => 168518)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/FormData.h        2014-05-09 04:11:28 UTC (rev 168517)
+++ trunk/Source/WebCore/platform/network/FormData.h        2014-05-09 04:37:25 UTC (rev 168518)
</span><span class="lines">@@ -91,6 +91,10 @@
</span><span class="cx">     long long m_fileLength;
</span><span class="cx">     double m_expectedFileModificationTime;
</span><span class="cx"> #endif
</span><ins>+    // FIXME: Generated file support in FormData is almost identical to Blob, they should be merged.
+    // We can't just switch to using Blobs for all files for two reasons:
+    // 1. Not all platforms enable BLOB support.
+    // 2. EncodedFile form data elements do not have a valid m_expectedFileModificationTime, meaning that we always upload the latest content from disk.
</ins><span class="cx">     String m_generatedFilename;
</span><span class="cx">     bool m_shouldGenerateFile;
</span><span class="cx">     bool m_ownsGeneratedFile;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkmacBlobDataFileReferenceMacmm"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/network/mac/BlobDataFileReferenceMac.mm (0 => 168518)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/mac/BlobDataFileReferenceMac.mm                                (rev 0)
+++ trunk/Source/WebCore/platform/network/mac/BlobDataFileReferenceMac.mm        2014-05-09 04:37:25 UTC (rev 168518)
</span><span class="lines">@@ -0,0 +1,94 @@
</span><ins>+/*
+ * Copyright (C) 2014 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 &quot;config.h&quot;
+#include &quot;BlobDataFileReference.h&quot;
+
+#if ENABLE(FILE_REPLACEMENT)
+
+#include &quot;FileMetadata.h&quot;
+#include &quot;SoftLinking.h&quot;
+#include &lt;wtf/text/CString.h&gt;
+
+#if defined(__has_include)
+#if __has_include(&lt;Bom/BOMCopier.h&gt;)
+#include &lt;Bom/BOMCopier.h&gt;
+#endif
+#endif
+
+typedef struct _BOMCopier* BOMCopier;
+
+SOFT_LINK_PRIVATE_FRAMEWORK(Bom)
+SOFT_LINK(Bom, BOMCopierNew, BOMCopier, (), ())
+SOFT_LINK(Bom, BOMCopierFree, void, (BOMCopier copier), (copier))
+SOFT_LINK(Bom, BOMCopierCopyWithOptions, int, (BOMCopier copier, const char* fromObj, const char* toObj, CFDictionaryRef options), (copier, fromObj, toObj, options))
+
+#define kBOMCopierOptionCreatePKZipKey CFSTR(&quot;createPKZip&quot;)
+#define kBOMCopierOptionSequesterResourcesKey CFSTR(&quot;sequesterResources&quot;)
+#define kBOMCopierOptionKeepParentKey CFSTR(&quot;keepParent&quot;)
+#define kBOMCopierOptionCopyResourcesKey CFSTR(&quot;copyResources&quot;)
+
+namespace WebCore {
+
+void BlobDataFileReference::generateReplacementFile()
+{
+    ASSERT(m_replacementPath.isNull());
+    ASSERT(m_replacementShouldBeGenerated);
+
+    prepareForFileAccess();
+
+    RetainPtr&lt;NSFileCoordinator&gt; coordinator = adoptNS([[NSFileCoordinator alloc] initWithFilePresenter:nil]);
+    [coordinator coordinateReadingItemAtURL:[NSURL fileURLWithPath:m_path] options:NSFileCoordinatorReadingWithoutChanges error:nullptr byAccessor:^(NSURL *newURL) {
+        // The archive is put into a subdirectory of temporary directory for historic reasons. Changing this will require WebCore to change at the same time.
+        CString archivePath([NSTemporaryDirectory() stringByAppendingPathComponent:@&quot;WebKitGeneratedFileXXXXXX&quot;].fileSystemRepresentation);
+        if (!mktemp(archivePath.mutableData()))
+            return;
+
+        NSDictionary *options = @{
+            (__bridge id)kBOMCopierOptionCreatePKZipKey : @YES,
+            (__bridge id)kBOMCopierOptionSequesterResourcesKey : @YES,
+            (__bridge id)kBOMCopierOptionKeepParentKey : @YES,
+            (__bridge id)kBOMCopierOptionCopyResourcesKey : @YES,
+        };
+
+        BOMCopier copier = BOMCopierNew();
+        if (!BOMCopierCopyWithOptions(copier, newURL.path.fileSystemRepresentation, archivePath.data(), (__bridge CFDictionaryRef)options))
+            m_replacementPath = String::fromUTF8(archivePath);
+        BOMCopierFree(copier);
+    }];
+
+    m_replacementShouldBeGenerated = false;
+    if (!m_replacementPath.isNull()) {
+        FileMetadata metadata;
+        if (getFileMetadata(m_replacementPath, metadata))
+            m_size = metadata.length;
+    }
+
+    revokeFileAccess();
+}
+
+}
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebCorexmlXMLHttpRequestcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/xml/XMLHttpRequest.cpp (168517 => 168518)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/xml/XMLHttpRequest.cpp        2014-05-09 04:11:28 UTC (rev 168517)
+++ trunk/Source/WebCore/xml/XMLHttpRequest.cpp        2014-05-09 04:37:25 UTC (rev 168518)
</span><span class="lines">@@ -659,13 +659,12 @@
</span><span class="cx">             }
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        // FIXME: add support for uploading bundles.
</del><span class="cx">         m_requestEntityBody = FormData::create();
</span><ins>+#if ENABLE(BLOB)
+        m_requestEntityBody-&gt;appendBlob(body-&gt;url());
+#else
</ins><span class="cx">         if (body-&gt;isFile())
</span><span class="cx">             m_requestEntityBody-&gt;appendFile(toFile(body)-&gt;path());
</span><del>-#if ENABLE(BLOB)
-        else
-            m_requestEntityBody-&gt;appendBlob(body-&gt;url());
</del><span class="cx"> #endif
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -680,8 +679,6 @@
</span><span class="cx">     if (m_method != &quot;GET&quot; &amp;&amp; m_method != &quot;HEAD&quot; &amp;&amp; m_url.protocolIsInHTTPFamily()) {
</span><span class="cx">         m_requestEntityBody = FormData::createMultiPart(*(static_cast&lt;FormDataList*&gt;(body)), body-&gt;encoding(), document());
</span><span class="cx"> 
</span><del>-        // We need to ask the client to provide the generated file names if needed. When FormData fills the element
-        // for the file, it could set a flag to use the generated file name, i.e. a package file on Mac.
</del><span class="cx">         m_requestEntityBody-&gt;generateFiles(document());
</span><span class="cx"> 
</span><span class="cx">         String contentType = getRequestHeader(&quot;Content-Type&quot;);
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (168517 => 168518)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-05-09 04:11:28 UTC (rev 168517)
+++ trunk/Source/WebKit2/ChangeLog        2014-05-09 04:37:25 UTC (rev 168518)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2014-05-08  Alexey Proskuryakov  &lt;ap@apple.com&gt;
+
+        Automatically zip document bundles used via File API
+        https://bugs.webkit.org/show_bug.cgi?id=132713
+        &lt;rdar://problem/13397892&gt;
+
+        Reviewed by Anders Carlsson.
+
+        * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in: NetworkProcess
+        now uses FileCoordination (WebProcess already had this allowed).
+
+        * Shared/BlobDataFileReferenceWithSandboxExtension.h: Added final to the class.
+
</ins><span class="cx"> 2014-05-08  Simon Fraser  &lt;simon.fraser@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [iOS WK2] Bottom-relative position:fixed elements are misplaced on page load
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcessmaccomappleWebKitNetworkProcesssbin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in (168517 => 168518)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in        2014-05-09 04:11:28 UTC (rev 168517)
+++ trunk/Source/WebKit2/NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in        2014-05-09 04:37:25 UTC (rev 168518)
</span><span class="lines">@@ -92,6 +92,7 @@
</span><span class="cx"> 
</span><span class="cx"> ;; Various services required by CFNetwork and other frameworks
</span><span class="cx"> (allow mach-lookup
</span><ins>+    (global-name &quot;com.apple.FileCoordination&quot;)
</ins><span class="cx">     (global-name &quot;com.apple.PowerManagement.control&quot;)
</span><span class="cx">     (global-name &quot;com.apple.SystemConfiguration.configd&quot;)
</span><span class="cx">     (global-name &quot;com.apple.cookied&quot;)
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedBlobDataFileReferenceWithSandboxExtensionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/BlobDataFileReferenceWithSandboxExtension.h (168517 => 168518)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/BlobDataFileReferenceWithSandboxExtension.h        2014-05-09 04:11:28 UTC (rev 168517)
+++ trunk/Source/WebKit2/Shared/BlobDataFileReferenceWithSandboxExtension.h        2014-05-09 04:37:25 UTC (rev 168518)
</span><span class="lines">@@ -32,7 +32,7 @@
</span><span class="cx"> 
</span><span class="cx"> class SandboxExtension;
</span><span class="cx"> 
</span><del>-class BlobDataFileReferenceWithSandboxExtension : public WebCore::BlobDataFileReference {
</del><ins>+class BlobDataFileReferenceWithSandboxExtension final : public WebCore::BlobDataFileReference {
</ins><span class="cx"> public:
</span><span class="cx">     static PassRefPtr&lt;BlobDataFileReference&gt; create(const String&amp; path, PassRefPtr&lt;SandboxExtension&gt; sandboxExtension)
</span><span class="cx">     {
</span></span></pre>
</div>
</div>

</body>
</html>