Title: [172088] branches/safari-600.1.4-branch/Source

Diff

Modified: branches/safari-600.1.4-branch/Source/WebCore/ChangeLog (172087 => 172088)


--- branches/safari-600.1.4-branch/Source/WebCore/ChangeLog	2014-08-05 21:56:57 UTC (rev 172087)
+++ branches/safari-600.1.4-branch/Source/WebCore/ChangeLog	2014-08-05 22:12:52 UTC (rev 172088)
@@ -1,5 +1,41 @@
 2014-08-05  Matthew Hanson  <matthew_han...@apple.com>
 
+        Roll out r172035. <rdar://problem/17869353>
+
+    2014-08-05  Matthew Hanson  <matthew_han...@apple.com>
+
+            Merge r172035. <rdar://problem/17869353>
+
+        2014-08-04  Andy Estes  <aes...@apple.com>
+
+                [iOS] The raw bytes of an iWork document's PDF preview are displayed rather than the PDF itself
+                https://bugs.webkit.org/show_bug.cgi?id=135596
+
+                Reviewed by David Kilzer.
+
+                Some iWork documents contain pre-rendered PDF previews. When WebKit asks QuickLook to convert such a document,
+                QuickLook will return this PDF as the converted response. However, until WebKit has sent the document's data to
+                QuickLook, -[QLPreviewConverter previewResponse] will misleadingly tell WebKit that the converted resource will
+                be of type 'text/html'. This leads WebKit to render the PDF preview as HTML.
+
+                Instead of querying QLPreviewConverter for the previewResponse before we've sent it any data, postpone calling
+                ResourceLoader::didReceiveResponse until we've begun to receive data via the QLPreviewConverter delegate. At
+                that point -[QLPreviewConverter previewResponse] will have the correct MIME type and we can call didReceiveResponse.
+
+                No new tests. QuickLook is not testable from WebKit.
+
+                * platform/network/ios/QuickLook.mm:
+                (-[WebResourceLoaderQuickLookDelegate connection:didReceiveDataArray:]): If didReceiveResponse has yet to be
+                called, call it now with QuickLookHandle::nsResponse().
+                (-[WebResourceLoaderQuickLookDelegate connection:didReceiveData:lengthReceived:]): Ditto.
+                (-[WebResourceLoaderQuickLookDelegate connection:didFailWithError:]): Ditto.
+                (-[WebResourceLoaderQuickLookDelegate connectionDidFinishLoading:]): Assert that didReceiveResponse has been called.
+                (-[WebResourceLoaderQuickLookDelegate clearHandle]): Cleared the raw pointer to QuickLookHandle.
+                (WebCore::QuickLookHandle::create): Pointed WebResourceLoaderQuickLookDelegate's quickLookHandle property to
+                the newly created QuickLookHandle.
+
+2014-08-05  Matthew Hanson  <matthew_han...@apple.com>
+
         Merge r172053. <rdar://problem/17876385>
 
     2014-08-05  Antti Koivisto  <an...@apple.com>

Modified: branches/safari-600.1.4-branch/Source/WebCore/platform/network/ios/QuickLook.mm (172087 => 172088)


--- branches/safari-600.1.4-branch/Source/WebCore/platform/network/ios/QuickLook.mm	2014-08-05 21:56:57 UTC (rev 172087)
+++ branches/safari-600.1.4-branch/Source/WebCore/platform/network/ios/QuickLook.mm	2014-08-05 22:12:52 UTC (rev 172088)
@@ -323,9 +323,7 @@
 
 @interface WebResourceLoaderQuickLookDelegate : NSObject <NSURLConnectionDelegate> {
     RefPtr<ResourceLoader> _resourceLoader;
-    BOOL _hasSentDidReceiveResponse;
 }
-@property (nonatomic) QuickLookHandle* quickLookHandle;
 @end
 
 @implementation WebResourceLoaderQuickLookDelegate
@@ -346,12 +344,6 @@
     UNUSED_PARAM(connection);
     if (!_resourceLoader)
         return;
-
-    if (!_hasSentDidReceiveResponse && _quickLookHandle) {
-        _hasSentDidReceiveResponse = YES;
-        _resourceLoader->didReceiveResponse(_quickLookHandle->nsResponse());
-    }
-
     _resourceLoader->didReceiveDataArray(reinterpret_cast<CFArrayRef>(dataArray));
 }
 #endif
@@ -361,12 +353,7 @@
     UNUSED_PARAM(connection);
     if (!_resourceLoader)
         return;
-
-    if (!_hasSentDidReceiveResponse && _quickLookHandle) {
-        _hasSentDidReceiveResponse = YES;
-        _resourceLoader->didReceiveResponse(_quickLookHandle->nsResponse());
-    }
-
+    
     // 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])
@@ -379,27 +366,20 @@
     UNUSED_PARAM(connection);
     if (!_resourceLoader)
         return;
-
-    ASSERT(_hasSentDidReceiveResponse);
+    
     _resourceLoader->didFinishLoading(0);
 }
 
 - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
 {
     UNUSED_PARAM(connection);
-
-    if (!_hasSentDidReceiveResponse && _quickLookHandle) {
-        _hasSentDidReceiveResponse = YES;
-        _resourceLoader->didReceiveResponse(_quickLookHandle->nsResponse());
-    }
-
+    
     _resourceLoader->didFail(ResourceError(error));
 }
 
 - (void)clearHandle
 {
     _resourceLoader = nullptr;
-    _quickLookHandle = nullptr;
 }
 
 @end
@@ -485,7 +465,6 @@
 
     RetainPtr<WebResourceLoaderQuickLookDelegate> delegate = adoptNS([[WebResourceLoaderQuickLookDelegate alloc] initWithResourceLoader:loader]);
     std::unique_ptr<QuickLookHandle> quickLookHandle(new QuickLookHandle([loader->originalRequest().nsURLRequest(DoNotUpdateHTTPBody) URL], nil, response, delegate.get()));
-    [delegate setQuickLookHandle:quickLookHandle.get()];
     loader->didCreateQuickLookHandle(*quickLookHandle);
     return WTF::move(quickLookHandle);
 }

Modified: branches/safari-600.1.4-branch/Source/WebKit2/ChangeLog (172087 => 172088)


--- branches/safari-600.1.4-branch/Source/WebKit2/ChangeLog	2014-08-05 21:56:57 UTC (rev 172087)
+++ branches/safari-600.1.4-branch/Source/WebKit2/ChangeLog	2014-08-05 22:12:52 UTC (rev 172088)
@@ -1,5 +1,25 @@
 2014-08-05  Matthew Hanson  <matthew_han...@apple.com>
 
+        Roll out r172034. <rdar://problem/17864079>
+
+    2014-08-05  Matthew Hanson  <matthew_han...@apple.com>
+
+            Merge r172035. <rdar://problem/17869353>
+
+        2014-08-04  Andy Estes  <aes...@apple.com>
+
+                [iOS] The raw bytes of an iWork document's PDF preview are displayed rather than the PDF itself
+                https://bugs.webkit.org/show_bug.cgi?id=135596
+
+                Reviewed by David Kilzer.
+
+                * WebProcess/Network/WebResourceLoader.cpp:
+                (WebKit::WebResourceLoader::didReceiveResponseWithCertificateInfo): If the response will be handled by
+                QuickLook, do not call ResourceLoader::didReceiveResponse. It will be called later by
+                WebResourceLoaderQuickLookDelegate once converted data is received.
+
+2014-08-05  Matthew Hanson  <matthew_han...@apple.com>
+
         Merge r172034. <rdar://problem/17864079>
 
     2014-08-05  Alexey Proskuryakov  <a...@apple.com>

Modified: branches/safari-600.1.4-branch/Source/WebKit2/WebProcess/Network/WebResourceLoader.cpp (172087 => 172088)


--- branches/safari-600.1.4-branch/Source/WebKit2/WebProcess/Network/WebResourceLoader.cpp	2014-08-05 21:56:57 UTC (rev 172087)
+++ branches/safari-600.1.4-branch/Source/WebKit2/WebProcess/Network/WebResourceLoader.cpp	2014-08-05 22:12:52 UTC (rev 172088)
@@ -110,6 +110,12 @@
 
     ResourceResponse responseCopy(response);
 
+#if USE(QUICK_LOOK)
+    m_quickLookHandle = QuickLookHandle::create(resourceLoader(), response.nsURLResponse());
+    if (m_quickLookHandle)
+        responseCopy = ResourceResponse(m_quickLookHandle->nsResponse());
+#endif
+
     // FIXME: This should use CertificateInfo to avoid the platform ifdefs. See https://bugs.webkit.org/show_bug.cgi?id=124724.
 #if PLATFORM(COCOA)
     responseCopy.setCertificateChain(certificateInfo.certificateChain());
@@ -117,19 +123,10 @@
     responseCopy.setSoupMessageCertificate(certificateInfo.certificate());
     responseCopy.setSoupMessageTLSErrors(certificateInfo.tlsErrors());
 #endif
-
     if (m_coreLoader->documentLoader()->applicationCacheHost()->maybeLoadFallbackForResponse(m_coreLoader.get(), responseCopy))
         return;
+    m_coreLoader->didReceiveResponse(responseCopy);
 
-#if USE(QUICK_LOOK)
-    // Refrain from calling didReceiveResponse if QuickLook will convert this response, since the MIME type of the
-    // converted resource isn't yet known. WebResourceLoaderQuickLookDelegate will later call didReceiveResponse upon
-    // receiving the converted data.
-    m_quickLookHandle = QuickLookHandle::create(resourceLoader(), responseCopy.nsURLResponse());
-    if (!m_quickLookHandle)
-#endif
-        m_coreLoader->didReceiveResponse(responseCopy);
-
     // If m_coreLoader becomes null as a result of the didReceiveResponse callback, we can't use the send function(). 
     if (!m_coreLoader)
         return;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to