<!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>[210129] trunk/Source/WebCore</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/210129">210129</a></dd>
<dt>Author</dt> <dd>aestes@apple.com</dd>
<dt>Date</dt> <dd>2016-12-22 18:24:28 -0800 (Thu, 22 Dec 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>[iOS] Move QuickLook from WebCore/platform to WebCore/loader
https://bugs.webkit.org/show_bug.cgi?id=166449

Reviewed by Darin Adler.

QuickLook.mm knows about ResourceLoader, so it's a layering violation to have it in
platform/. Move it to loader/ios/.

* WebCore.xcodeproj/project.pbxproj:
* loader/ios/QuickLook.h: Renamed from Source/WebCore/platform/network/ios/QuickLook.h.
* loader/ios/QuickLook.mm: Renamed from Source/WebCore/platform/network/ios/QuickLook.mm.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li>trunk/Source/WebCore/loader/ios/</li>
<li><a href="#trunkSourceWebCoreloaderiosQuickLookh">trunk/Source/WebCore/loader/ios/QuickLook.h</a></li>
<li><a href="#trunkSourceWebCoreloaderiosQuickLookmm">trunk/Source/WebCore/loader/ios/QuickLook.mm</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreplatformnetworkiosQuickLookh">trunk/Source/WebCore/platform/network/ios/QuickLook.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkiosQuickLookmm">trunk/Source/WebCore/platform/network/ios/QuickLook.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (210128 => 210129)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-12-23 02:21:02 UTC (rev 210128)
+++ trunk/Source/WebCore/ChangeLog        2016-12-23 02:24:28 UTC (rev 210129)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2016-12-22  Andy Estes  &lt;aestes@apple.com&gt;
+
+        [iOS] Move QuickLook from WebCore/platform to WebCore/loader
+        https://bugs.webkit.org/show_bug.cgi?id=166449
+
+        Reviewed by Darin Adler.
+
+        QuickLook.mm knows about ResourceLoader, so it's a layering violation to have it in
+        platform/. Move it to loader/ios/.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * loader/ios/QuickLook.h: Renamed from Source/WebCore/platform/network/ios/QuickLook.h.
+        * loader/ios/QuickLook.mm: Renamed from Source/WebCore/platform/network/ios/QuickLook.mm.
+
</ins><span class="cx"> 2016-12-22  Michael Catanzaro  &lt;mcatanzaro@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, fix unused parameter warning in GLES build
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (210128 => 210129)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-12-23 02:21:02 UTC (rev 210128)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-12-23 02:24:28 UTC (rev 210129)
</span><span class="lines">@@ -1690,8 +1690,6 @@
</span><span class="cx">                 4415292E0E1AE8A000C4A2D0 /* HTMLPlugInImageElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 4415292C0E1AE8A000C4A2D0 /* HTMLPlugInImageElement.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 4415292F0E1AE8A000C4A2D0 /* HTMLPlugInImageElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4415292D0E1AE8A000C4A2D0 /* HTMLPlugInImageElement.cpp */; };
</span><span class="cx">                 442ABCD617D9262F00D30715 /* SynchronousLoaderClientCFNet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 442ABCD517D9262F00D30715 /* SynchronousLoaderClientCFNet.cpp */; };
</span><del>-                442AF7A9102CDDEA008FD4D3 /* QuickLook.h in Headers */ = {isa = PBXBuildFile; fileRef = 442AF7A7102CDDEA008FD4D3 /* QuickLook.h */; settings = {ATTRIBUTES = (Private, ); }; };
-                442AF7AA102CDDEA008FD4D3 /* QuickLook.mm in Sources */ = {isa = PBXBuildFile; fileRef = 442AF7A8102CDDEA008FD4D3 /* QuickLook.mm */; };
</del><span class="cx">                 443817FF1A91B2F8006E04F2 /* CoreMediaSoftLink.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 443817FD1A91B2F8006E04F2 /* CoreMediaSoftLink.cpp */; };
</span><span class="cx">                 443818001A91B2F8006E04F2 /* CoreMediaSoftLink.h in Headers */ = {isa = PBXBuildFile; fileRef = 443817FE1A91B2F8006E04F2 /* CoreMediaSoftLink.h */; };
</span><span class="cx">                 443917FF1A91B2F8006E04F2 /* QuickLookSoftLink.mm in Sources */ = {isa = PBXBuildFile; fileRef = 443917FD1A91B2F8006E04F2 /* QuickLookSoftLink.mm */; };
</span><span class="lines">@@ -3928,6 +3926,8 @@
</span><span class="cx">                 A149786E1ABAF33800CEF7E4 /* ContentFilter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A149786C1ABAF33800CEF7E4 /* ContentFilter.cpp */; };
</span><span class="cx">                 A149786F1ABAF33800CEF7E4 /* ContentFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = A149786D1ABAF33800CEF7E4 /* ContentFilter.h */; };
</span><span class="cx">                 A14978711ABAF3A500CEF7E4 /* PlatformContentFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = A14978701ABAF3A500CEF7E4 /* PlatformContentFilter.h */; };
</span><ins>+                A15E31F31E0CB0B2004B371C /* QuickLook.mm in Sources */ = {isa = PBXBuildFile; fileRef = A15E31F21E0CB0AA004B371C /* QuickLook.mm */; };
+                A15E31F41E0CB0B5004B371C /* QuickLook.h in Headers */ = {isa = PBXBuildFile; fileRef = A15E31F11E0CB0AA004B371C /* QuickLook.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 A17C81220F2A5CF7005DAAEB /* HTMLElementFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A17C81200F2A5CF7005DAAEB /* HTMLElementFactory.cpp */; };
</span><span class="cx">                 A17C81230F2A5CF7005DAAEB /* HTMLElementFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = A17C81210F2A5CF7005DAAEB /* HTMLElementFactory.h */; };
</span><span class="cx">                 A182D5B71BE722670087A7CC /* SettingsCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = A182D5B61BE722620087A7CC /* SettingsCocoa.mm */; };
</span><span class="lines">@@ -8891,8 +8891,6 @@
</span><span class="cx">                 4415292C0E1AE8A000C4A2D0 /* HTMLPlugInImageElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLPlugInImageElement.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 4415292D0E1AE8A000C4A2D0 /* HTMLPlugInImageElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLPlugInImageElement.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 442ABCD517D9262F00D30715 /* SynchronousLoaderClientCFNet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SynchronousLoaderClientCFNet.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                442AF7A7102CDDEA008FD4D3 /* QuickLook.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QuickLook.h; sourceTree = &quot;&lt;group&gt;&quot;; };
-                442AF7A8102CDDEA008FD4D3 /* QuickLook.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = QuickLook.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><span class="cx">                 443817FD1A91B2F8006E04F2 /* CoreMediaSoftLink.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CoreMediaSoftLink.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 443817FE1A91B2F8006E04F2 /* CoreMediaSoftLink.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CoreMediaSoftLink.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 443917FD1A91B2F8006E04F2 /* QuickLookSoftLink.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = QuickLookSoftLink.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -11600,6 +11598,8 @@
</span><span class="cx">                 A149786C1ABAF33800CEF7E4 /* ContentFilter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ContentFilter.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 A149786D1ABAF33800CEF7E4 /* ContentFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContentFilter.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 A14978701ABAF3A500CEF7E4 /* PlatformContentFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformContentFilter.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                A15E31F11E0CB0AA004B371C /* QuickLook.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QuickLook.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                A15E31F21E0CB0AA004B371C /* QuickLook.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = QuickLook.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 A17C81200F2A5CF7005DAAEB /* HTMLElementFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLElementFactory.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 A17C81210F2A5CF7005DAAEB /* HTMLElementFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLElementFactory.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 A182D5B61BE722620087A7CC /* SettingsCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SettingsCocoa.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -16817,8 +16817,6 @@
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><span class="cx">                                 443F04260E75C8FB007E5407 /* NetworkStateNotifierIOS.mm */,
</span><del>-                                442AF7A7102CDDEA008FD4D3 /* QuickLook.h */,
-                                442AF7A8102CDDEA008FD4D3 /* QuickLook.mm */,
</del><span class="cx">                                 A10DBF4618F92317000D70C6 /* QuickLookHandleClient.h */,
</span><span class="cx">                                 7E428CE413E3407F003B661C /* ResourceHandleIOS.mm */,
</span><span class="cx">                                 7E7DE201195CEFCD0035363B /* ResourceRequestIOS.mm */,
</span><span class="lines">@@ -19636,6 +19634,15 @@
</span><span class="cx">                         path = wak;
</span><span class="cx">                         sourceTree = &quot;&lt;group&gt;&quot;;
</span><span class="cx">                 };
</span><ins>+                A15E31F01E0CB075004B371C /* ios */ = {
+                        isa = PBXGroup;
+                        children = (
+                                A15E31F11E0CB0AA004B371C /* QuickLook.h */,
+                                A15E31F21E0CB0AA004B371C /* QuickLook.mm */,
+                        );
+                        path = ios;
+                        sourceTree = &quot;&lt;group&gt;&quot;;
+                };
</ins><span class="cx">                 A172182419DE182B00464D17 /* ios */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><span class="lines">@@ -22335,6 +22342,7 @@
</span><span class="cx">                                 7EE6847312D26E5500E79415 /* cf */,
</span><span class="cx">                                 7E4DE10B198B10810051CB02 /* cocoa */,
</span><span class="cx">                                 5126E6B60A2E3AEF005C29FA /* icon */,
</span><ins>+                                A15E31F01E0CB075004B371C /* ios */,
</ins><span class="cx">                                 93A1EAA20A5634D8006960A0 /* mac */,
</span><span class="cx">                                 A149786C1ABAF33800CEF7E4 /* ContentFilter.cpp */,
</span><span class="cx">                                 A149786D1ABAF33800CEF7E4 /* ContentFilter.h */,
</span><span class="lines">@@ -26049,6 +26057,7 @@
</span><span class="cx">                                 1221E06D1C03D224006A1A00 /* JSAnimationTimeline.h in Headers */,
</span><span class="cx">                                 1AE96A8B1D1A0DDD00B86768 /* JSApplePayPaymentAuthorizedEvent.h in Headers */,
</span><span class="cx">                                 CDF4B7301E03CA4A00E235A2 /* JSMockCDMFactory.h in Headers */,
</span><ins>+                                A15E31F41E0CB0B5004B371C /* QuickLook.h in Headers */,
</ins><span class="cx">                                 1AE96A8D1D1A0DDD00B86768 /* JSApplePayPaymentMethodSelectedEvent.h in Headers */,
</span><span class="cx">                                 1AE96A8F1D1A0DDD00B86768 /* JSApplePaySession.h in Headers */,
</span><span class="cx">                                 1AE96A911D1A0DDD00B86768 /* JSApplePayShippingContactSelectedEvent.h in Headers */,
</span><span class="lines">@@ -27180,7 +27189,6 @@
</span><span class="cx">                                 10FB084B14E15C7E00A3DB98 /* PublicURLManager.h in Headers */,
</span><span class="cx">                                 550A0BCA085F6039007353D6 /* QualifiedName.h in Headers */,
</span><span class="cx">                                 CE12523D1A1676CD00864480 /* QuartzCoreSPI.h in Headers */,
</span><del>-                                442AF7A9102CDDEA008FD4D3 /* QuickLook.h in Headers */,
</del><span class="cx">                                 A10DBF4718F92317000D70C6 /* QuickLookHandleClient.h in Headers */,
</span><span class="cx">                                 937F4CCC1A2D48C100BB39F5 /* QuickLookMacSPI.h in Headers */,
</span><span class="cx">                                 443918001A91B2F8006E04F2 /* QuickLookSoftLink.h in Headers */,
</span><span class="lines">@@ -30891,7 +30899,6 @@
</span><span class="cx">                                 0081FEFF16B0A2B6008AAA7A /* PublicSuffixMac.mm in Sources */,
</span><span class="cx">                                 CDEE393717974259001D7580 /* PublicURLManager.cpp in Sources */,
</span><span class="cx">                                 550A0BC9085F6039007353D6 /* QualifiedName.cpp in Sources */,
</span><del>-                                442AF7AA102CDDEA008FD4D3 /* QuickLook.mm in Sources */,
</del><span class="cx">                                 443917FF1A91B2F8006E04F2 /* QuickLookSoftLink.mm in Sources */,
</span><span class="cx">                                 072AE1E6183C0741000A5988 /* QuickTimePluginReplacement.mm in Sources */,
</span><span class="cx">                                 379E371613736A6600B9E919 /* QuotedPrintable.cpp in Sources */,
</span><span class="lines">@@ -31515,6 +31522,7 @@
</span><span class="cx">                                 CDA07FBD18E0A16A004699FA /* SystemSleepListener.cpp in Sources */,
</span><span class="cx">                                 CDA07FC118E0A22B004699FA /* SystemSleepListenerMac.mm in Sources */,
</span><span class="cx">                                 5D5975B419635F1100D00878 /* SystemVersion.mm in Sources */,
</span><ins>+                                A15E31F31E0CB0B2004B371C /* QuickLook.mm in Sources */,
</ins><span class="cx">                                 463EB6221B8789E00096ED51 /* TagCollection.cpp in Sources */,
</span><span class="cx">                                 F55B3DD51251F12D003EF269 /* TelephoneInputType.cpp in Sources */,
</span><span class="cx">                                 7CC564BA18BAC720001B9652 /* TelephoneNumberDetectorCocoa.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderiosQuickLookhfromrev210128trunkSourceWebCoreplatformnetworkiosQuickLookh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/loader/ios/QuickLook.h (from rev 210128, trunk/Source/WebCore/platform/network/ios/QuickLook.h) (0 => 210129)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/ios/QuickLook.h                                (rev 0)
+++ trunk/Source/WebCore/loader/ios/QuickLook.h        2016-12-23 02:24:28 UTC (rev 210129)
</span><span class="lines">@@ -0,0 +1,126 @@
</span><ins>+/*
+ * Copyright (C) 2009 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.
+ */
+
+#ifndef QuickLook_h
+#define QuickLook_h
+
+#if USE(QUICK_LOOK)
+
+#import &quot;QuickLookHandleClient.h&quot;
+#import &quot;ResourceRequest.h&quot;
+#import &lt;objc/objc-runtime.h&gt;
+#import &lt;wtf/RefPtr.h&gt;
+
+#if USE(CFURLCONNECTION)
+#include &quot;CFNetworkSPI.h&quot;
+#endif
+
+OBJC_CLASS NSData;
+OBJC_CLASS NSDictionary;
+OBJC_CLASS NSFileHandle;
+OBJC_CLASS NSSet;
+OBJC_CLASS NSString;
+OBJC_CLASS NSURL;
+OBJC_CLASS NSURLConnection;
+OBJC_CLASS NSURLRequest;
+OBJC_CLASS NSURLResponse;
+OBJC_CLASS QLPreviewConverter;
+
+namespace WebCore {
+
+class QuickLookHandleClient;
+class ResourceHandle;
+class ResourceLoader;
+class ResourceResponse;
+class SynchronousResourceHandleCFURLConnectionDelegate;
+
+WEBCORE_EXPORT NSSet *QLPreviewGetSupportedMIMETypesSet();
+
+// Used for setting the permissions on the saved QL content
+NSDictionary *QLFileAttributes();
+NSDictionary *QLDirectoryAttributes();
+
+WEBCORE_EXPORT void addQLPreviewConverterWithFileForURL(NSURL *, id converter, NSString *fileName);
+WEBCORE_EXPORT NSString *qlPreviewConverterFileNameForURL(NSURL *);
+WEBCORE_EXPORT NSString *qlPreviewConverterUTIForURL(NSURL *);
+WEBCORE_EXPORT void removeQLPreviewConverterForURL(NSURL *);
+
+WEBCORE_EXPORT RetainPtr&lt;NSURLRequest&gt; registerQLPreviewConverterIfNeeded(NSURL *, NSString *mimeType, NSData *);
+
+const URL safeQLURLForDocumentURLAndResourceURL(const URL&amp; documentURL, const String&amp; resourceURL);
+
+WEBCORE_EXPORT const char* QLPreviewProtocol();
+
+WEBCORE_EXPORT NSString *createTemporaryFileForQuickLook(NSString *fileName);
+
+class QuickLookHandle {
+    WTF_MAKE_NONCOPYABLE(QuickLookHandle);
+public:
+    WEBCORE_EXPORT static bool shouldCreateForMIMEType(const String&amp;);
+
+    static std::unique_ptr&lt;QuickLookHandle&gt; create(ResourceHandle*, NSURLConnection *, NSURLResponse *, id delegate);
+#if USE(CFURLCONNECTION)
+    static std::unique_ptr&lt;QuickLookHandle&gt; create(ResourceHandle*, SynchronousResourceHandleCFURLConnectionDelegate*, CFURLResponseRef);
+#endif
+    // FIXME: Use of ResourceLoader here is a platform violation.
+    WEBCORE_EXPORT static std::unique_ptr&lt;QuickLookHandle&gt; create(ResourceLoader&amp;, const ResourceResponse&amp;);
+
+    WEBCORE_EXPORT ~QuickLookHandle();
+
+    WEBCORE_EXPORT bool didReceiveDataArray(CFArrayRef);
+    WEBCORE_EXPORT bool didReceiveData(CFDataRef);
+    WEBCORE_EXPORT bool didFinishLoading();
+    WEBCORE_EXPORT void didFail();
+
+    WEBCORE_EXPORT NSURLResponse *nsResponse();
+#if USE(CFURLCONNECTION)
+    CFURLResponseRef cfResponse();
+#endif
+
+    void setClient(PassRefPtr&lt;QuickLookHandleClient&gt; client) { m_client = client; }
+
+    WEBCORE_EXPORT String previewFileName() const;
+    WEBCORE_EXPORT String previewUTI() const;
+    NSURL *firstRequestURL() const { return m_firstRequestURL.get(); }
+    WEBCORE_EXPORT NSURL *previewRequestURL() const;
+    QLPreviewConverter *converter() const { return m_converter.get(); }
+
+private:
+    QuickLookHandle(NSURL *, NSURLConnection *, NSURLResponse *, id delegate);
+
+    RetainPtr&lt;NSURL&gt; m_firstRequestURL;
+    RetainPtr&lt;QLPreviewConverter&gt; m_converter;
+    RetainPtr&lt;id&gt; m_delegate;
+    bool m_finishedLoadingDataIntoConverter;
+    RetainPtr&lt;NSFileHandle *&gt; m_quicklookFileHandle;
+    RetainPtr&lt;NSURLResponse&gt; m_nsResponse;
+    RefPtr&lt;QuickLookHandleClient&gt; m_client;
+};
+
+} // namespace WebCore
+
+#endif // USE(QUICK_LOOK)
+
+#endif // QuickLook_h
</ins></span></pre></div>
<a id="trunkSourceWebCoreloaderiosQuickLookmmfromrev210128trunkSourceWebCoreplatformnetworkiosQuickLookmm"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/loader/ios/QuickLook.mm (from rev 210128, trunk/Source/WebCore/platform/network/ios/QuickLook.mm) (0 => 210129)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/ios/QuickLook.mm                                (rev 0)
+++ trunk/Source/WebCore/loader/ios/QuickLook.mm        2016-12-23 02:24:28 UTC (rev 210129)
</span><span class="lines">@@ -0,0 +1,522 @@
</span><ins>+/*
+ * Copyright (C) 2009-2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import &quot;config.h&quot;
+#import &quot;QuickLook.h&quot;
+
+#if USE(QUICK_LOOK)
+
+#import &quot;DocumentLoader.h&quot;
+#import &quot;FileSystemIOS.h&quot;
+#import &quot;Logging.h&quot;
+#import &quot;NSFileManagerSPI.h&quot;
+#import &quot;ResourceError.h&quot;
+#import &quot;ResourceHandle.h&quot;
+#import &quot;ResourceLoader.h&quot;
+#import &quot;RuntimeApplicationChecks.h&quot;
+#import &quot;SynchronousResourceHandleCFURLConnectionDelegate.h&quot;
+#import &quot;WebCoreResourceHandleAsDelegate.h&quot;
+#import &quot;WebCoreURLResponseIOS.h&quot;
+#import &lt;Foundation/Foundation.h&gt;
+#import &lt;wtf/NeverDestroyed.h&gt;
+#import &lt;wtf/StdLibExtras.h&gt;
+#import &lt;wtf/Threading.h&gt;
+#import &lt;wtf/Vector.h&gt;
+#import &lt;wtf/text/WTFString.h&gt;
+
+#import &quot;QuickLookSoftLink.h&quot;
+
+using namespace WebCore;
+
+NSSet *WebCore::QLPreviewGetSupportedMIMETypesSet()
+{
+    static NeverDestroyed&lt;RetainPtr&lt;NSSet&gt;&gt; set = QLPreviewGetSupportedMIMETypes();
+    return set.get().get();
+}
+
+NSDictionary *WebCore::QLFileAttributes()
+{
+    // Set file perms to owner read/write only
+    NSNumber *filePOSIXPermissions = [NSNumber numberWithInteger:(WEB_UREAD | WEB_UWRITE)];
+    static NSDictionary *dictionary = adoptNS([[NSDictionary alloc] initWithObjectsAndKeys:
+                                        NSUserName(), NSFileOwnerAccountName,
+                                        filePOSIXPermissions, NSFilePosixPermissions,
+                                        nullptr]).leakRef();
+    return dictionary;
+}
+
+NSDictionary *WebCore::QLDirectoryAttributes()
+{
+    // Set file perms to owner read/write/execute only
+    NSNumber *directoryPOSIXPermissions = [NSNumber numberWithInteger:(WEB_UREAD | WEB_UWRITE | WEB_UEXEC)];
+    static NSDictionary *dictionary = adoptNS([[NSDictionary alloc] initWithObjectsAndKeys:
+                                                NSUserName(), NSFileOwnerAccountName,
+                                                directoryPOSIXPermissions, NSFilePosixPermissions,
+                                                nullptr]).leakRef();
+    return dictionary;
+}
+
+static Lock&amp; qlPreviewConverterDictionaryMutex()
+{
+    static NeverDestroyed&lt;Lock&gt; mutex;
+    return mutex;
+}
+
+static NSMutableDictionary *QLPreviewConverterDictionary()
+{
+    static NSMutableDictionary *dictionary = [[NSMutableDictionary alloc] init];
+    return dictionary;
+}
+
+static NSMutableDictionary *QLContentDictionary()
+{
+    static NSMutableDictionary *contentDictionary = [[NSMutableDictionary alloc] init];
+    return contentDictionary;
+}
+
+void WebCore::addQLPreviewConverterWithFileForURL(NSURL *url, id converter, NSString *fileName)
+{
+    ASSERT(url);
+    ASSERT(converter);
+    LockHolder lock(qlPreviewConverterDictionaryMutex());
+    [QLPreviewConverterDictionary() setObject:converter forKey:url];
+    [QLContentDictionary() setObject:(fileName ? fileName : @&quot;&quot;) forKey:url];
+}
+
+NSString *WebCore::qlPreviewConverterFileNameForURL(NSURL *url)
+{
+    return [QLContentDictionary() objectForKey:url];
+}
+
+NSString *WebCore::qlPreviewConverterUTIForURL(NSURL *url)
+{
+    id converter = nil;
+    {
+        LockHolder lock(qlPreviewConverterDictionaryMutex());
+        converter = [QLPreviewConverterDictionary() objectForKey:url];
+    }
+    if (!converter)
+        return nil;
+    return [converter previewUTI];
+}
+
+void WebCore::removeQLPreviewConverterForURL(NSURL *url)
+{
+    LockHolder lock(qlPreviewConverterDictionaryMutex());
+    [QLPreviewConverterDictionary() removeObjectForKey:url];
+
+    // Delete the file when we remove the preview converter
+    NSString *filename = qlPreviewConverterFileNameForURL(url);
+    if ([filename length])
+        [[NSFileManager defaultManager] _web_removeFileOnlyAtPath:filename];
+    [QLContentDictionary() removeObjectForKey:url];
+}
+
+RetainPtr&lt;NSURLRequest&gt; WebCore::registerQLPreviewConverterIfNeeded(NSURL *url, NSString *mimeType, NSData *data)
+{
+    RetainPtr&lt;NSString&gt; updatedMIMEType = adoptNS(QLTypeCopyBestMimeTypeForURLAndMimeType(url, mimeType));
+
+    if ([QLPreviewGetSupportedMIMETypesSet() containsObject:updatedMIMEType.get()]) {
+        RetainPtr&lt;NSString&gt; uti = adoptNS(QLTypeCopyUTIForURLAndMimeType(url, updatedMIMEType.get()));
+
+        RetainPtr&lt;QLPreviewConverter&gt; converter = adoptNS([allocQLPreviewConverterInstance() initWithData:data name:nil uti:uti.get() options:nil]);
+        NSURLRequest *request = [converter previewRequest];
+
+        // We use [request URL] here instead of url since it will be
+        // the URL that the WebDataSource will see during -dealloc.
+        addQLPreviewConverterWithFileForURL([request URL], converter.get(), nil);
+
+        return request;
+    }
+
+    return nil;
+}
+
+const URL WebCore::safeQLURLForDocumentURLAndResourceURL(const URL&amp; documentURL, const String&amp; resourceURL)
+{
+    id converter = nil;
+    NSURL *nsDocumentURL = documentURL;
+    {
+        LockHolder lock(qlPreviewConverterDictionaryMutex());
+        converter = [QLPreviewConverterDictionary() objectForKey:nsDocumentURL];
+    }
+
+    if (!converter)
+        return URL(ParsedURLString, resourceURL);
+
+    RetainPtr&lt;NSURLRequest&gt; request = adoptNS([[NSURLRequest alloc] initWithURL:[NSURL URLWithString:resourceURL]]);
+    NSURLRequest *safeRequest = [converter safeRequestForRequest:request.get()];
+    return [safeRequest URL];
+}
+
+static Vector&lt;char&gt; createQLPreviewProtocol()
+{
+    Vector&lt;char&gt; previewProtocol;
+    const char* qlPreviewScheme = [QLPreviewScheme UTF8String];
+    previewProtocol.append(qlPreviewScheme, strlen(qlPreviewScheme) + 1);
+    return previewProtocol;
+}
+
+const char* WebCore::QLPreviewProtocol()
+{
+    static NeverDestroyed&lt;Vector&lt;char&gt;&gt; previewProtocol(createQLPreviewProtocol());
+    return previewProtocol.get().data();
+}
+
+#if USE(CFURLCONNECTION)
+// The way QuickLook works is we pass it an NSURLConnectionDelegate callback object at creation
+// time. Then we pass it all the data as we receive it. Once we've downloaded the full URL,
+// QuickLook turns around and send us, through this delegate, the HTML version of the file which we
+// pass on to WebCore. The flag m_finishedLoadingDataIntoConverter in QuickLookHandle decides
+// whether to pass the data to QuickLook or WebCore.
+//
+// This works fine when using NS APIs, but when using CFNetwork, we don't have a NSURLConnectionDelegate.
+// So we create WebQuickLookHandleAsDelegate as an intermediate delegate object and pass it to
+// QLPreviewConverter. The proxy delegate then forwards the messages on to the CFNetwork code.
+@interface WebQuickLookHandleAsDelegate : NSObject &lt;NSURLConnectionDelegate, WebCoreResourceLoaderDelegate&gt; {
+    RefPtr&lt;SynchronousResourceHandleCFURLConnectionDelegate&gt; m_connectionDelegate;
+}
+
+- (id)initWithConnectionDelegate:(SynchronousResourceHandleCFURLConnectionDelegate*)connectionDelegate;
+@end
+
+@implementation WebQuickLookHandleAsDelegate
+- (id)initWithConnectionDelegate:(SynchronousResourceHandleCFURLConnectionDelegate*)connectionDelegate
+{
+    self = [super init];
+    if (!self)
+        return nil;
+    m_connectionDelegate = connectionDelegate;
+    return self;
+}
+
+- (void)connection:(NSURLConnection *)connection didReceiveDataArray:(NSArray *)dataArray
+{
+    UNUSED_PARAM(connection);
+    if (!m_connectionDelegate)
+        return;
+    LOG(Network, &quot;WebQuickLookHandleAsDelegate::didReceiveDataArray()&quot;);
+    m_connectionDelegate-&gt;didReceiveDataArray(reinterpret_cast&lt;CFArrayRef&gt;(dataArray));
+}
+
+- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data lengthReceived:(long long)lengthReceived
+{
+    UNUSED_PARAM(connection);
+    if (!m_connectionDelegate)
+        return;
+    LOG(Network, &quot;WebQuickLookHandleAsDelegate::didReceiveData() - data length = %ld&quot;, (long)[data length]);
+
+    // QuickLook code sends us a nil data at times. The check below is the same as the one in
+    // ResourceHandleMac.cpp added for a different bug.
+    if (![data length])
+        return;
+    m_connectionDelegate-&gt;didReceiveData(reinterpret_cast&lt;CFDataRef&gt;(data), static_cast&lt;int&gt;(lengthReceived));
+}
+
+- (void)connectionDidFinishLoading:(NSURLConnection *)connection
+{
+    UNUSED_PARAM(connection);
+    if (!m_connectionDelegate)
+        return;
+    LOG(Network, &quot;WebQuickLookHandleAsDelegate::didFinishLoading()&quot;);
+    m_connectionDelegate-&gt;didFinishLoading();
+}
+
+- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
+{
+    UNUSED_PARAM(connection);
+    if (!m_connectionDelegate)
+        return;
+    LOG(Network, &quot;WebQuickLookHandleAsDelegate::didFail()&quot;);
+    m_connectionDelegate-&gt;didFail(reinterpret_cast&lt;CFErrorRef&gt;(error));
+}
+
+- (void)detachHandle
+{
+    m_connectionDelegate = nullptr;
+}
+@end
+#endif
+
+@interface WebResourceLoaderQuickLookDelegate : NSObject &lt;NSURLConnectionDelegate, WebCoreResourceLoaderDelegate&gt; {
+    RefPtr&lt;ResourceLoader&gt; _resourceLoader;
+    BOOL _hasSentDidReceiveResponse;
+    BOOL _hasFailed;
+}
+@property (nonatomic) QuickLookHandle* quickLookHandle;
+@end
+
+@implementation WebResourceLoaderQuickLookDelegate
+
+- (id)initWithResourceLoader:(PassRefPtr&lt;ResourceLoader&gt;)resourceLoader
+{
+    self = [super init];
+    if (!self)
+        return nil;
+
+    _resourceLoader = resourceLoader;
+    return self;
+}
+
+- (void)_sendDidReceiveResponseIfNecessary
+{
+    if (_hasSentDidReceiveResponse || _hasFailed || !_quickLookHandle)
+        return;
+
+    // QuickLook might fail to convert a document without calling connection:didFailWithError: (see &lt;rdar://problem/17927972&gt;).
+    // A nil MIME type is an indication of such a failure, so stop loading the resource and ignore subsequent delegate messages.
+    NSURLResponse *nsResponse = _quickLookHandle-&gt;nsResponse();
+    if (![nsResponse MIMEType]) {
+        _hasFailed = YES;
+        _resourceLoader-&gt;didFail(_resourceLoader-&gt;cannotShowURLError());
+        return;
+    }
+
+    ResourceResponse response(nsResponse);
+    response.setIsQuickLook(true);
+
+    _hasSentDidReceiveResponse = YES;
+    _resourceLoader-&gt;didReceiveResponse(response);
+}
+
+#if USE(NETWORK_CFDATA_ARRAY_CALLBACK)
+- (void)connection:(NSURLConnection *)connection didReceiveDataArray:(NSArray *)dataArray
+{
+    UNUSED_PARAM(connection);
+    if (!_resourceLoader)
+        return;
+
+    [self _sendDidReceiveResponseIfNecessary];
+    if (_hasFailed)
+        return;
+
+    if (_resourceLoader)
+        _resourceLoader-&gt;didReceiveDataArray(reinterpret_cast&lt;CFArrayRef&gt;(dataArray));
+}
+#endif
+
+- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data lengthReceived:(long long)lengthReceived
+{
+    UNUSED_PARAM(connection);
+    if (!_resourceLoader)
+        return;
+
+    [self _sendDidReceiveResponseIfNecessary];
+    if (_hasFailed)
+        return;
+
+    // QuickLook code sends us a nil data at times. The check below is the same as the one in
+    // ResourceHandleMac.cpp added for a different bug.
+    if (![data length])
+        return;
+
+    if (_resourceLoader)
+        _resourceLoader-&gt;didReceiveData(reinterpret_cast&lt;const char*&gt;([data bytes]), [data length], lengthReceived, DataPayloadBytes);
+}
+
+- (void)connectionDidFinishLoading:(NSURLConnection *)connection
+{
+    UNUSED_PARAM(connection);
+    if (!_resourceLoader || _hasFailed)
+        return;
+
+    ASSERT(_hasSentDidReceiveResponse);
+    _resourceLoader-&gt;didFinishLoading(0);
+}
+
+- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
+{
+    UNUSED_PARAM(connection);
+
+    [self _sendDidReceiveResponseIfNecessary];
+    if (_hasFailed)
+        return;
+
+    if (_resourceLoader)
+        _resourceLoader-&gt;didFail(ResourceError(error));
+}
+
+- (void)detachHandle
+{
+    _resourceLoader = nullptr;
+    _quickLookHandle = nullptr;
+}
+
+@end
+
+namespace WebCore {
+
+NSString *createTemporaryFileForQuickLook(NSString *fileName)
+{
+    NSString *downloadDirectory = createTemporaryDirectory(@&quot;QuickLookContent&quot;);
+    if (!downloadDirectory)
+        return nil;
+
+    NSString *contentPath = [downloadDirectory stringByAppendingPathComponent:fileName];
+    NSFileManager *fileManager = [NSFileManager defaultManager];
+    NSString *uniqueContentPath = [fileManager _web_pathWithUniqueFilenameForPath:contentPath];
+
+    BOOL success = [fileManager _web_createFileAtPathWithIntermediateDirectories:uniqueContentPath
+                                                                        contents:nil
+                                                                      attributes:QLFileAttributes()
+                                                             directoryAttributes:QLDirectoryAttributes()];
+
+    return success ? uniqueContentPath : nil;
+}
+
+static inline QuickLookHandleClient* emptyClient()
+{
+    static NeverDestroyed&lt;QuickLookHandleClient&gt; emptyClient;
+    return &amp;emptyClient.get();
+}
+
+QuickLookHandle::QuickLookHandle(NSURL *firstRequestURL, NSURLConnection *connection, NSURLResponse *nsResponse, id delegate)
+    : m_firstRequestURL(firstRequestURL)
+    , m_converter(adoptNS([allocQLPreviewConverterInstance() initWithConnection:connection delegate:delegate response:nsResponse options:nil]))
+    , m_delegate(delegate)
+    , m_finishedLoadingDataIntoConverter(false)
+    , m_nsResponse([m_converter previewResponse])
+    , m_client(emptyClient())
+{
+    LOG(Network, &quot;QuickLookHandle::QuickLookHandle() - previewFileName: %s&quot;, [m_converter previewFileName]);
+}
+
+std::unique_ptr&lt;QuickLookHandle&gt; QuickLookHandle::create(ResourceHandle* handle, NSURLConnection *connection, NSURLResponse *nsResponse, id delegate)
+{
+    ASSERT_ARG(handle, handle);
+    if (handle-&gt;firstRequest().requester() != ResourceRequest::Requester::Main || ![QLPreviewGetSupportedMIMETypesSet() containsObject:[nsResponse MIMEType]])
+        return nullptr;
+
+    std::unique_ptr&lt;QuickLookHandle&gt; quickLookHandle(new QuickLookHandle([handle-&gt;firstRequest().nsURLRequest(DoNotUpdateHTTPBody) URL], connection, nsResponse, delegate));
+    handle-&gt;client()-&gt;didCreateQuickLookHandle(*quickLookHandle);
+    return quickLookHandle;
+}
+
+#if USE(CFURLCONNECTION)
+std::unique_ptr&lt;QuickLookHandle&gt; QuickLookHandle::create(ResourceHandle* handle, SynchronousResourceHandleCFURLConnectionDelegate* connectionDelegate, CFURLResponseRef cfResponse)
+{
+    ASSERT_ARG(handle, handle);
+    if (handle-&gt;firstRequest().requester() != ResourceRequest::Requester::Main || ![QLPreviewGetSupportedMIMETypesSet() containsObject:(NSString *)CFURLResponseGetMIMEType(cfResponse)])
+        return nullptr;
+
+    NSURLResponse *nsResponse = [NSURLResponse _responseWithCFURLResponse:cfResponse];
+    WebQuickLookHandleAsDelegate *delegate = [[[WebQuickLookHandleAsDelegate alloc] initWithConnectionDelegate:connectionDelegate] autorelease];
+    std::unique_ptr&lt;QuickLookHandle&gt; quickLookHandle(new QuickLookHandle([handle-&gt;firstRequest().nsURLRequest(DoNotUpdateHTTPBody) URL], nil, nsResponse, delegate));
+    handle-&gt;client()-&gt;didCreateQuickLookHandle(*quickLookHandle);
+    return quickLookHandle;
+}
+
+CFURLResponseRef QuickLookHandle::cfResponse()
+{
+    return [m_nsResponse _CFURLResponse];
+}
+#endif
+
+bool QuickLookHandle::shouldCreateForMIMEType(const String&amp; mimeType)
+{
+    return [QLPreviewGetSupportedMIMETypesSet() containsObject:mimeType];
+}
+
+std::unique_ptr&lt;QuickLookHandle&gt; QuickLookHandle::create(ResourceLoader&amp; loader, const ResourceResponse&amp; response)
+{
+    ASSERT(shouldCreateForMIMEType(response.mimeType()));
+
+    RetainPtr&lt;WebResourceLoaderQuickLookDelegate&gt; delegate = adoptNS([[WebResourceLoaderQuickLookDelegate alloc] initWithResourceLoader:&amp;loader]);
+    std::unique_ptr&lt;QuickLookHandle&gt; quickLookHandle(new QuickLookHandle([loader.originalRequest().nsURLRequest(DoNotUpdateHTTPBody) URL], nil, response.nsURLResponse(), delegate.get()));
+    [delegate setQuickLookHandle:quickLookHandle.get()];
+    loader.didCreateQuickLookHandle(*quickLookHandle);
+    return quickLookHandle;
+}
+
+NSURLResponse *QuickLookHandle::nsResponse()
+{
+    return m_nsResponse.get();
+}
+
+bool QuickLookHandle::didReceiveDataArray(CFArrayRef cfDataArray)
+{
+    if (m_finishedLoadingDataIntoConverter)
+        return false;
+
+    LOG(Network, &quot;QuickLookHandle::didReceiveDataArray()&quot;);
+    [m_converter appendDataArray:(NSArray *)cfDataArray];
+    m_client-&gt;didReceiveDataArray(cfDataArray);
+    return true;
+}
+
+bool QuickLookHandle::didReceiveData(CFDataRef cfData)
+{
+    if (m_finishedLoadingDataIntoConverter)
+        return false;
+    
+    return didReceiveDataArray(adoptCF(CFArrayCreate(kCFAllocatorDefault, (const void**)&amp;cfData, 1, &amp;kCFTypeArrayCallBacks)).get());
+}
+
+bool QuickLookHandle::didFinishLoading()
+{
+    if (m_finishedLoadingDataIntoConverter)
+        return false;
+
+    LOG(Network, &quot;QuickLookHandle::didFinishLoading()&quot;);
+    m_finishedLoadingDataIntoConverter = YES;
+    [m_converter finishedAppendingData];
+    m_client-&gt;didFinishLoading();
+    return true;
+}
+
+void QuickLookHandle::didFail()
+{
+    LOG(Network, &quot;QuickLookHandle::didFail()&quot;);
+    m_client-&gt;didFail();
+    [m_converter finishConverting];
+    m_converter = nullptr;
+}
+
+QuickLookHandle::~QuickLookHandle()
+{
+    LOG(Network, &quot;QuickLookHandle::~QuickLookHandle()&quot;);
+    m_converter = nullptr;
+
+    [m_delegate detachHandle];
+}
+
+String QuickLookHandle::previewFileName() const
+{
+    return [m_converter previewFileName];
+}
+
+String QuickLookHandle::previewUTI() const
+{
+    return [m_converter previewUTI];
+}
+
+NSURL *QuickLookHandle::previewRequestURL() const
+{
+    return [[m_converter previewRequest] URL];
+}
+
+}
+
+#endif // USE(QUICK_LOOK)
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkiosQuickLookh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/platform/network/ios/QuickLook.h (210128 => 210129)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/ios/QuickLook.h        2016-12-23 02:21:02 UTC (rev 210128)
+++ trunk/Source/WebCore/platform/network/ios/QuickLook.h        2016-12-23 02:24:28 UTC (rev 210129)
</span><span class="lines">@@ -1,126 +0,0 @@
</span><del>-/*
- * Copyright (C) 2009 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.
- */
-
-#ifndef QuickLook_h
-#define QuickLook_h
-
-#if USE(QUICK_LOOK)
-
-#import &quot;QuickLookHandleClient.h&quot;
-#import &quot;ResourceRequest.h&quot;
-#import &lt;objc/objc-runtime.h&gt;
-#import &lt;wtf/RefPtr.h&gt;
-
-#if USE(CFURLCONNECTION)
-#include &quot;CFNetworkSPI.h&quot;
-#endif
-
-OBJC_CLASS NSData;
-OBJC_CLASS NSDictionary;
-OBJC_CLASS NSFileHandle;
-OBJC_CLASS NSSet;
-OBJC_CLASS NSString;
-OBJC_CLASS NSURL;
-OBJC_CLASS NSURLConnection;
-OBJC_CLASS NSURLRequest;
-OBJC_CLASS NSURLResponse;
-OBJC_CLASS QLPreviewConverter;
-
-namespace WebCore {
-
-class QuickLookHandleClient;
-class ResourceHandle;
-class ResourceLoader;
-class ResourceResponse;
-class SynchronousResourceHandleCFURLConnectionDelegate;
-
-WEBCORE_EXPORT NSSet *QLPreviewGetSupportedMIMETypesSet();
-
-// Used for setting the permissions on the saved QL content
-NSDictionary *QLFileAttributes();
-NSDictionary *QLDirectoryAttributes();
-
-WEBCORE_EXPORT void addQLPreviewConverterWithFileForURL(NSURL *, id converter, NSString *fileName);
-WEBCORE_EXPORT NSString *qlPreviewConverterFileNameForURL(NSURL *);
-WEBCORE_EXPORT NSString *qlPreviewConverterUTIForURL(NSURL *);
-WEBCORE_EXPORT void removeQLPreviewConverterForURL(NSURL *);
-
-WEBCORE_EXPORT RetainPtr&lt;NSURLRequest&gt; registerQLPreviewConverterIfNeeded(NSURL *, NSString *mimeType, NSData *);
-
-const URL safeQLURLForDocumentURLAndResourceURL(const URL&amp; documentURL, const String&amp; resourceURL);
-
-WEBCORE_EXPORT const char* QLPreviewProtocol();
-
-WEBCORE_EXPORT NSString *createTemporaryFileForQuickLook(NSString *fileName);
-
-class QuickLookHandle {
-    WTF_MAKE_NONCOPYABLE(QuickLookHandle);
-public:
-    WEBCORE_EXPORT static bool shouldCreateForMIMEType(const String&amp;);
-
-    static std::unique_ptr&lt;QuickLookHandle&gt; create(ResourceHandle*, NSURLConnection *, NSURLResponse *, id delegate);
-#if USE(CFURLCONNECTION)
-    static std::unique_ptr&lt;QuickLookHandle&gt; create(ResourceHandle*, SynchronousResourceHandleCFURLConnectionDelegate*, CFURLResponseRef);
-#endif
-    // FIXME: Use of ResourceLoader here is a platform violation.
-    WEBCORE_EXPORT static std::unique_ptr&lt;QuickLookHandle&gt; create(ResourceLoader&amp;, const ResourceResponse&amp;);
-
-    WEBCORE_EXPORT ~QuickLookHandle();
-
-    WEBCORE_EXPORT bool didReceiveDataArray(CFArrayRef);
-    WEBCORE_EXPORT bool didReceiveData(CFDataRef);
-    WEBCORE_EXPORT bool didFinishLoading();
-    WEBCORE_EXPORT void didFail();
-
-    WEBCORE_EXPORT NSURLResponse *nsResponse();
-#if USE(CFURLCONNECTION)
-    CFURLResponseRef cfResponse();
-#endif
-
-    void setClient(PassRefPtr&lt;QuickLookHandleClient&gt; client) { m_client = client; }
-
-    WEBCORE_EXPORT String previewFileName() const;
-    WEBCORE_EXPORT String previewUTI() const;
-    NSURL *firstRequestURL() const { return m_firstRequestURL.get(); }
-    WEBCORE_EXPORT NSURL *previewRequestURL() const;
-    QLPreviewConverter *converter() const { return m_converter.get(); }
-
-private:
-    QuickLookHandle(NSURL *, NSURLConnection *, NSURLResponse *, id delegate);
-
-    RetainPtr&lt;NSURL&gt; m_firstRequestURL;
-    RetainPtr&lt;QLPreviewConverter&gt; m_converter;
-    RetainPtr&lt;id&gt; m_delegate;
-    bool m_finishedLoadingDataIntoConverter;
-    RetainPtr&lt;NSFileHandle *&gt; m_quicklookFileHandle;
-    RetainPtr&lt;NSURLResponse&gt; m_nsResponse;
-    RefPtr&lt;QuickLookHandleClient&gt; m_client;
-};
-
-} // namespace WebCore
-
-#endif // USE(QUICK_LOOK)
-
-#endif // QuickLook_h
</del></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkiosQuickLookmm"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/platform/network/ios/QuickLook.mm (210128 => 210129)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/ios/QuickLook.mm        2016-12-23 02:21:02 UTC (rev 210128)
+++ trunk/Source/WebCore/platform/network/ios/QuickLook.mm        2016-12-23 02:24:28 UTC (rev 210129)
</span><span class="lines">@@ -1,522 +0,0 @@
</span><del>-/*
- * Copyright (C) 2009-2016 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import &quot;config.h&quot;
-#import &quot;QuickLook.h&quot;
-
-#if USE(QUICK_LOOK)
-
-#import &quot;DocumentLoader.h&quot;
-#import &quot;FileSystemIOS.h&quot;
-#import &quot;Logging.h&quot;
-#import &quot;NSFileManagerSPI.h&quot;
-#import &quot;ResourceError.h&quot;
-#import &quot;ResourceHandle.h&quot;
-#import &quot;ResourceLoader.h&quot;
-#import &quot;RuntimeApplicationChecks.h&quot;
-#import &quot;SynchronousResourceHandleCFURLConnectionDelegate.h&quot;
-#import &quot;WebCoreResourceHandleAsDelegate.h&quot;
-#import &quot;WebCoreURLResponseIOS.h&quot;
-#import &lt;Foundation/Foundation.h&gt;
-#import &lt;wtf/NeverDestroyed.h&gt;
-#import &lt;wtf/StdLibExtras.h&gt;
-#import &lt;wtf/Threading.h&gt;
-#import &lt;wtf/Vector.h&gt;
-#import &lt;wtf/text/WTFString.h&gt;
-
-#import &quot;QuickLookSoftLink.h&quot;
-
-using namespace WebCore;
-
-NSSet *WebCore::QLPreviewGetSupportedMIMETypesSet()
-{
-    static NeverDestroyed&lt;RetainPtr&lt;NSSet&gt;&gt; set = QLPreviewGetSupportedMIMETypes();
-    return set.get().get();
-}
-
-NSDictionary *WebCore::QLFileAttributes()
-{
-    // Set file perms to owner read/write only
-    NSNumber *filePOSIXPermissions = [NSNumber numberWithInteger:(WEB_UREAD | WEB_UWRITE)];
-    static NSDictionary *dictionary = adoptNS([[NSDictionary alloc] initWithObjectsAndKeys:
-                                        NSUserName(), NSFileOwnerAccountName,
-                                        filePOSIXPermissions, NSFilePosixPermissions,
-                                        nullptr]).leakRef();
-    return dictionary;
-}
-
-NSDictionary *WebCore::QLDirectoryAttributes()
-{
-    // Set file perms to owner read/write/execute only
-    NSNumber *directoryPOSIXPermissions = [NSNumber numberWithInteger:(WEB_UREAD | WEB_UWRITE | WEB_UEXEC)];
-    static NSDictionary *dictionary = adoptNS([[NSDictionary alloc] initWithObjectsAndKeys:
-                                                NSUserName(), NSFileOwnerAccountName,
-                                                directoryPOSIXPermissions, NSFilePosixPermissions,
-                                                nullptr]).leakRef();
-    return dictionary;
-}
-
-static Lock&amp; qlPreviewConverterDictionaryMutex()
-{
-    static NeverDestroyed&lt;Lock&gt; mutex;
-    return mutex;
-}
-
-static NSMutableDictionary *QLPreviewConverterDictionary()
-{
-    static NSMutableDictionary *dictionary = [[NSMutableDictionary alloc] init];
-    return dictionary;
-}
-
-static NSMutableDictionary *QLContentDictionary()
-{
-    static NSMutableDictionary *contentDictionary = [[NSMutableDictionary alloc] init];
-    return contentDictionary;
-}
-
-void WebCore::addQLPreviewConverterWithFileForURL(NSURL *url, id converter, NSString *fileName)
-{
-    ASSERT(url);
-    ASSERT(converter);
-    LockHolder lock(qlPreviewConverterDictionaryMutex());
-    [QLPreviewConverterDictionary() setObject:converter forKey:url];
-    [QLContentDictionary() setObject:(fileName ? fileName : @&quot;&quot;) forKey:url];
-}
-
-NSString *WebCore::qlPreviewConverterFileNameForURL(NSURL *url)
-{
-    return [QLContentDictionary() objectForKey:url];
-}
-
-NSString *WebCore::qlPreviewConverterUTIForURL(NSURL *url)
-{
-    id converter = nil;
-    {
-        LockHolder lock(qlPreviewConverterDictionaryMutex());
-        converter = [QLPreviewConverterDictionary() objectForKey:url];
-    }
-    if (!converter)
-        return nil;
-    return [converter previewUTI];
-}
-
-void WebCore::removeQLPreviewConverterForURL(NSURL *url)
-{
-    LockHolder lock(qlPreviewConverterDictionaryMutex());
-    [QLPreviewConverterDictionary() removeObjectForKey:url];
-
-    // Delete the file when we remove the preview converter
-    NSString *filename = qlPreviewConverterFileNameForURL(url);
-    if ([filename length])
-        [[NSFileManager defaultManager] _web_removeFileOnlyAtPath:filename];
-    [QLContentDictionary() removeObjectForKey:url];
-}
-
-RetainPtr&lt;NSURLRequest&gt; WebCore::registerQLPreviewConverterIfNeeded(NSURL *url, NSString *mimeType, NSData *data)
-{
-    RetainPtr&lt;NSString&gt; updatedMIMEType = adoptNS(QLTypeCopyBestMimeTypeForURLAndMimeType(url, mimeType));
-
-    if ([QLPreviewGetSupportedMIMETypesSet() containsObject:updatedMIMEType.get()]) {
-        RetainPtr&lt;NSString&gt; uti = adoptNS(QLTypeCopyUTIForURLAndMimeType(url, updatedMIMEType.get()));
-
-        RetainPtr&lt;QLPreviewConverter&gt; converter = adoptNS([allocQLPreviewConverterInstance() initWithData:data name:nil uti:uti.get() options:nil]);
-        NSURLRequest *request = [converter previewRequest];
-
-        // We use [request URL] here instead of url since it will be
-        // the URL that the WebDataSource will see during -dealloc.
-        addQLPreviewConverterWithFileForURL([request URL], converter.get(), nil);
-
-        return request;
-    }
-
-    return nil;
-}
-
-const URL WebCore::safeQLURLForDocumentURLAndResourceURL(const URL&amp; documentURL, const String&amp; resourceURL)
-{
-    id converter = nil;
-    NSURL *nsDocumentURL = documentURL;
-    {
-        LockHolder lock(qlPreviewConverterDictionaryMutex());
-        converter = [QLPreviewConverterDictionary() objectForKey:nsDocumentURL];
-    }
-
-    if (!converter)
-        return URL(ParsedURLString, resourceURL);
-
-    RetainPtr&lt;NSURLRequest&gt; request = adoptNS([[NSURLRequest alloc] initWithURL:[NSURL URLWithString:resourceURL]]);
-    NSURLRequest *safeRequest = [converter safeRequestForRequest:request.get()];
-    return [safeRequest URL];
-}
-
-static Vector&lt;char&gt; createQLPreviewProtocol()
-{
-    Vector&lt;char&gt; previewProtocol;
-    const char* qlPreviewScheme = [QLPreviewScheme UTF8String];
-    previewProtocol.append(qlPreviewScheme, strlen(qlPreviewScheme) + 1);
-    return previewProtocol;
-}
-
-const char* WebCore::QLPreviewProtocol()
-{
-    static NeverDestroyed&lt;Vector&lt;char&gt;&gt; previewProtocol(createQLPreviewProtocol());
-    return previewProtocol.get().data();
-}
-
-#if USE(CFURLCONNECTION)
-// The way QuickLook works is we pass it an NSURLConnectionDelegate callback object at creation
-// time. Then we pass it all the data as we receive it. Once we've downloaded the full URL,
-// QuickLook turns around and send us, through this delegate, the HTML version of the file which we
-// pass on to WebCore. The flag m_finishedLoadingDataIntoConverter in QuickLookHandle decides
-// whether to pass the data to QuickLook or WebCore.
-//
-// This works fine when using NS APIs, but when using CFNetwork, we don't have a NSURLConnectionDelegate.
-// So we create WebQuickLookHandleAsDelegate as an intermediate delegate object and pass it to
-// QLPreviewConverter. The proxy delegate then forwards the messages on to the CFNetwork code.
-@interface WebQuickLookHandleAsDelegate : NSObject &lt;NSURLConnectionDelegate, WebCoreResourceLoaderDelegate&gt; {
-    RefPtr&lt;SynchronousResourceHandleCFURLConnectionDelegate&gt; m_connectionDelegate;
-}
-
-- (id)initWithConnectionDelegate:(SynchronousResourceHandleCFURLConnectionDelegate*)connectionDelegate;
-@end
-
-@implementation WebQuickLookHandleAsDelegate
-- (id)initWithConnectionDelegate:(SynchronousResourceHandleCFURLConnectionDelegate*)connectionDelegate
-{
-    self = [super init];
-    if (!self)
-        return nil;
-    m_connectionDelegate = connectionDelegate;
-    return self;
-}
-
-- (void)connection:(NSURLConnection *)connection didReceiveDataArray:(NSArray *)dataArray
-{
-    UNUSED_PARAM(connection);
-    if (!m_connectionDelegate)
-        return;
-    LOG(Network, &quot;WebQuickLookHandleAsDelegate::didReceiveDataArray()&quot;);
-    m_connectionDelegate-&gt;didReceiveDataArray(reinterpret_cast&lt;CFArrayRef&gt;(dataArray));
-}
-
-- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data lengthReceived:(long long)lengthReceived
-{
-    UNUSED_PARAM(connection);
-    if (!m_connectionDelegate)
-        return;
-    LOG(Network, &quot;WebQuickLookHandleAsDelegate::didReceiveData() - data length = %ld&quot;, (long)[data length]);
-
-    // QuickLook code sends us a nil data at times. The check below is the same as the one in
-    // ResourceHandleMac.cpp added for a different bug.
-    if (![data length])
-        return;
-    m_connectionDelegate-&gt;didReceiveData(reinterpret_cast&lt;CFDataRef&gt;(data), static_cast&lt;int&gt;(lengthReceived));
-}
-
-- (void)connectionDidFinishLoading:(NSURLConnection *)connection
-{
-    UNUSED_PARAM(connection);
-    if (!m_connectionDelegate)
-        return;
-    LOG(Network, &quot;WebQuickLookHandleAsDelegate::didFinishLoading()&quot;);
-    m_connectionDelegate-&gt;didFinishLoading();
-}
-
-- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
-{
-    UNUSED_PARAM(connection);
-    if (!m_connectionDelegate)
-        return;
-    LOG(Network, &quot;WebQuickLookHandleAsDelegate::didFail()&quot;);
-    m_connectionDelegate-&gt;didFail(reinterpret_cast&lt;CFErrorRef&gt;(error));
-}
-
-- (void)detachHandle
-{
-    m_connectionDelegate = nullptr;
-}
-@end
-#endif
-
-@interface WebResourceLoaderQuickLookDelegate : NSObject &lt;NSURLConnectionDelegate, WebCoreResourceLoaderDelegate&gt; {
-    RefPtr&lt;ResourceLoader&gt; _resourceLoader;
-    BOOL _hasSentDidReceiveResponse;
-    BOOL _hasFailed;
-}
-@property (nonatomic) QuickLookHandle* quickLookHandle;
-@end
-
-@implementation WebResourceLoaderQuickLookDelegate
-
-- (id)initWithResourceLoader:(PassRefPtr&lt;ResourceLoader&gt;)resourceLoader
-{
-    self = [super init];
-    if (!self)
-        return nil;
-
-    _resourceLoader = resourceLoader;
-    return self;
-}
-
-- (void)_sendDidReceiveResponseIfNecessary
-{
-    if (_hasSentDidReceiveResponse || _hasFailed || !_quickLookHandle)
-        return;
-
-    // QuickLook might fail to convert a document without calling connection:didFailWithError: (see &lt;rdar://problem/17927972&gt;).
-    // A nil MIME type is an indication of such a failure, so stop loading the resource and ignore subsequent delegate messages.
-    NSURLResponse *nsResponse = _quickLookHandle-&gt;nsResponse();
-    if (![nsResponse MIMEType]) {
-        _hasFailed = YES;
-        _resourceLoader-&gt;didFail(_resourceLoader-&gt;cannotShowURLError());
-        return;
-    }
-
-    ResourceResponse response(nsResponse);
-    response.setIsQuickLook(true);
-
-    _hasSentDidReceiveResponse = YES;
-    _resourceLoader-&gt;didReceiveResponse(response);
-}
-
-#if USE(NETWORK_CFDATA_ARRAY_CALLBACK)
-- (void)connection:(NSURLConnection *)connection didReceiveDataArray:(NSArray *)dataArray
-{
-    UNUSED_PARAM(connection);
-    if (!_resourceLoader)
-        return;
-
-    [self _sendDidReceiveResponseIfNecessary];
-    if (_hasFailed)
-        return;
-
-    if (_resourceLoader)
-        _resourceLoader-&gt;didReceiveDataArray(reinterpret_cast&lt;CFArrayRef&gt;(dataArray));
-}
-#endif
-
-- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data lengthReceived:(long long)lengthReceived
-{
-    UNUSED_PARAM(connection);
-    if (!_resourceLoader)
-        return;
-
-    [self _sendDidReceiveResponseIfNecessary];
-    if (_hasFailed)
-        return;
-
-    // QuickLook code sends us a nil data at times. The check below is the same as the one in
-    // ResourceHandleMac.cpp added for a different bug.
-    if (![data length])
-        return;
-
-    if (_resourceLoader)
-        _resourceLoader-&gt;didReceiveData(reinterpret_cast&lt;const char*&gt;([data bytes]), [data length], lengthReceived, DataPayloadBytes);
-}
-
-- (void)connectionDidFinishLoading:(NSURLConnection *)connection
-{
-    UNUSED_PARAM(connection);
-    if (!_resourceLoader || _hasFailed)
-        return;
-
-    ASSERT(_hasSentDidReceiveResponse);
-    _resourceLoader-&gt;didFinishLoading(0);
-}
-
-- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
-{
-    UNUSED_PARAM(connection);
-
-    [self _sendDidReceiveResponseIfNecessary];
-    if (_hasFailed)
-        return;
-
-    if (_resourceLoader)
-        _resourceLoader-&gt;didFail(ResourceError(error));
-}
-
-- (void)detachHandle
-{
-    _resourceLoader = nullptr;
-    _quickLookHandle = nullptr;
-}
-
-@end
-
-namespace WebCore {
-
-NSString *createTemporaryFileForQuickLook(NSString *fileName)
-{
-    NSString *downloadDirectory = createTemporaryDirectory(@&quot;QuickLookContent&quot;);
-    if (!downloadDirectory)
-        return nil;
-
-    NSString *contentPath = [downloadDirectory stringByAppendingPathComponent:fileName];
-    NSFileManager *fileManager = [NSFileManager defaultManager];
-    NSString *uniqueContentPath = [fileManager _web_pathWithUniqueFilenameForPath:contentPath];
-
-    BOOL success = [fileManager _web_createFileAtPathWithIntermediateDirectories:uniqueContentPath
-                                                                        contents:nil
-                                                                      attributes:QLFileAttributes()
-                                                             directoryAttributes:QLDirectoryAttributes()];
-
-    return success ? uniqueContentPath : nil;
-}
-
-static inline QuickLookHandleClient* emptyClient()
-{
-    static NeverDestroyed&lt;QuickLookHandleClient&gt; emptyClient;
-    return &amp;emptyClient.get();
-}
-
-QuickLookHandle::QuickLookHandle(NSURL *firstRequestURL, NSURLConnection *connection, NSURLResponse *nsResponse, id delegate)
-    : m_firstRequestURL(firstRequestURL)
-    , m_converter(adoptNS([allocQLPreviewConverterInstance() initWithConnection:connection delegate:delegate response:nsResponse options:nil]))
-    , m_delegate(delegate)
-    , m_finishedLoadingDataIntoConverter(false)
-    , m_nsResponse([m_converter previewResponse])
-    , m_client(emptyClient())
-{
-    LOG(Network, &quot;QuickLookHandle::QuickLookHandle() - previewFileName: %s&quot;, [m_converter previewFileName]);
-}
-
-std::unique_ptr&lt;QuickLookHandle&gt; QuickLookHandle::create(ResourceHandle* handle, NSURLConnection *connection, NSURLResponse *nsResponse, id delegate)
-{
-    ASSERT_ARG(handle, handle);
-    if (handle-&gt;firstRequest().requester() != ResourceRequest::Requester::Main || ![QLPreviewGetSupportedMIMETypesSet() containsObject:[nsResponse MIMEType]])
-        return nullptr;
-
-    std::unique_ptr&lt;QuickLookHandle&gt; quickLookHandle(new QuickLookHandle([handle-&gt;firstRequest().nsURLRequest(DoNotUpdateHTTPBody) URL], connection, nsResponse, delegate));
-    handle-&gt;client()-&gt;didCreateQuickLookHandle(*quickLookHandle);
-    return quickLookHandle;
-}
-
-#if USE(CFURLCONNECTION)
-std::unique_ptr&lt;QuickLookHandle&gt; QuickLookHandle::create(ResourceHandle* handle, SynchronousResourceHandleCFURLConnectionDelegate* connectionDelegate, CFURLResponseRef cfResponse)
-{
-    ASSERT_ARG(handle, handle);
-    if (handle-&gt;firstRequest().requester() != ResourceRequest::Requester::Main || ![QLPreviewGetSupportedMIMETypesSet() containsObject:(NSString *)CFURLResponseGetMIMEType(cfResponse)])
-        return nullptr;
-
-    NSURLResponse *nsResponse = [NSURLResponse _responseWithCFURLResponse:cfResponse];
-    WebQuickLookHandleAsDelegate *delegate = [[[WebQuickLookHandleAsDelegate alloc] initWithConnectionDelegate:connectionDelegate] autorelease];
-    std::unique_ptr&lt;QuickLookHandle&gt; quickLookHandle(new QuickLookHandle([handle-&gt;firstRequest().nsURLRequest(DoNotUpdateHTTPBody) URL], nil, nsResponse, delegate));
-    handle-&gt;client()-&gt;didCreateQuickLookHandle(*quickLookHandle);
-    return quickLookHandle;
-}
-
-CFURLResponseRef QuickLookHandle::cfResponse()
-{
-    return [m_nsResponse _CFURLResponse];
-}
-#endif
-
-bool QuickLookHandle::shouldCreateForMIMEType(const String&amp; mimeType)
-{
-    return [QLPreviewGetSupportedMIMETypesSet() containsObject:mimeType];
-}
-
-std::unique_ptr&lt;QuickLookHandle&gt; QuickLookHandle::create(ResourceLoader&amp; loader, const ResourceResponse&amp; response)
-{
-    ASSERT(shouldCreateForMIMEType(response.mimeType()));
-
-    RetainPtr&lt;WebResourceLoaderQuickLookDelegate&gt; delegate = adoptNS([[WebResourceLoaderQuickLookDelegate alloc] initWithResourceLoader:&amp;loader]);
-    std::unique_ptr&lt;QuickLookHandle&gt; quickLookHandle(new QuickLookHandle([loader.originalRequest().nsURLRequest(DoNotUpdateHTTPBody) URL], nil, response.nsURLResponse(), delegate.get()));
-    [delegate setQuickLookHandle:quickLookHandle.get()];
-    loader.didCreateQuickLookHandle(*quickLookHandle);
-    return quickLookHandle;
-}
-
-NSURLResponse *QuickLookHandle::nsResponse()
-{
-    return m_nsResponse.get();
-}
-
-bool QuickLookHandle::didReceiveDataArray(CFArrayRef cfDataArray)
-{
-    if (m_finishedLoadingDataIntoConverter)
-        return false;
-
-    LOG(Network, &quot;QuickLookHandle::didReceiveDataArray()&quot;);
-    [m_converter appendDataArray:(NSArray *)cfDataArray];
-    m_client-&gt;didReceiveDataArray(cfDataArray);
-    return true;
-}
-
-bool QuickLookHandle::didReceiveData(CFDataRef cfData)
-{
-    if (m_finishedLoadingDataIntoConverter)
-        return false;
-    
-    return didReceiveDataArray(adoptCF(CFArrayCreate(kCFAllocatorDefault, (const void**)&amp;cfData, 1, &amp;kCFTypeArrayCallBacks)).get());
-}
-
-bool QuickLookHandle::didFinishLoading()
-{
-    if (m_finishedLoadingDataIntoConverter)
-        return false;
-
-    LOG(Network, &quot;QuickLookHandle::didFinishLoading()&quot;);
-    m_finishedLoadingDataIntoConverter = YES;
-    [m_converter finishedAppendingData];
-    m_client-&gt;didFinishLoading();
-    return true;
-}
-
-void QuickLookHandle::didFail()
-{
-    LOG(Network, &quot;QuickLookHandle::didFail()&quot;);
-    m_client-&gt;didFail();
-    [m_converter finishConverting];
-    m_converter = nullptr;
-}
-
-QuickLookHandle::~QuickLookHandle()
-{
-    LOG(Network, &quot;QuickLookHandle::~QuickLookHandle()&quot;);
-    m_converter = nullptr;
-
-    [m_delegate detachHandle];
-}
-
-String QuickLookHandle::previewFileName() const
-{
-    return [m_converter previewFileName];
-}
-
-String QuickLookHandle::previewUTI() const
-{
-    return [m_converter previewUTI];
-}
-
-NSURL *QuickLookHandle::previewRequestURL() const
-{
-    return [[m_converter previewRequest] URL];
-}
-
-}
-
-#endif // USE(QUICK_LOOK)
</del></span></pre>
</div>
</div>

</body>
</html>