Title: [90873] trunk/Source/WebCore
Revision
90873
Author
psola...@apple.com
Date
2011-07-12 17:24:03 -0700 (Tue, 12 Jul 2011)

Log Message

Get webkit to compile with USE(CFNETWORK) enabled on Mac
https://bugs.webkit.org/show_bug.cgi?id=63674

Reviewed by David Kilzer.

Changes to ResourceHandle class to get it to compile with USE(CFNETWORK).

No new tests because no change in functionality and option is not enabled on Mac.

* platform/network/ResourceHandle.h:
* platform/network/ResourceHandleInternal.h:
* platform/network/cf/ResourceHandleCFNet.cpp:
(WebCore::didReceiveResponse):
(WebCore::ResourceHandleInternal::~ResourceHandleInternal):
(WebCore::ResourceHandle::start):
(WebCore::WebCoreSynchronousLoaderClient::willSendRequest): Call adjustMIMETypeIfNecessary
on Mac. Also port over fix for <rdar://problem/6901522> added in r43993 which forces the
MIME type to text/html if the request is annotated with a "ForceHTMLMIMEType" property.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (90872 => 90873)


--- trunk/Source/WebCore/ChangeLog	2011-07-13 00:20:04 UTC (rev 90872)
+++ trunk/Source/WebCore/ChangeLog	2011-07-13 00:24:03 UTC (rev 90873)
@@ -1,3 +1,24 @@
+2011-07-12  Pratik Solanki  <psola...@apple.com>
+
+        Get webkit to compile with USE(CFNETWORK) enabled on Mac
+        https://bugs.webkit.org/show_bug.cgi?id=63674
+
+        Reviewed by David Kilzer.
+
+        Changes to ResourceHandle class to get it to compile with USE(CFNETWORK).
+
+        No new tests because no change in functionality and option is not enabled on Mac.
+
+        * platform/network/ResourceHandle.h:
+        * platform/network/ResourceHandleInternal.h:
+        * platform/network/cf/ResourceHandleCFNet.cpp:
+        (WebCore::didReceiveResponse):
+        (WebCore::ResourceHandleInternal::~ResourceHandleInternal):
+        (WebCore::ResourceHandle::start):
+        (WebCore::WebCoreSynchronousLoaderClient::willSendRequest): Call adjustMIMETypeIfNecessary
+        on Mac. Also port over fix for <rdar://problem/6901522> added in r43993 which forces the
+        MIME type to text/html if the request is annotated with a "ForceHTMLMIMEType" property.
+
 2011-07-12  James Robinson  <jam...@chromium.org>
 
         [chromium] Delete the unused legacy accelerated canvas 2d code

Modified: trunk/Source/WebCore/platform/network/ResourceHandle.h (90872 => 90873)


--- trunk/Source/WebCore/platform/network/ResourceHandle.h	2011-07-13 00:20:04 UTC (rev 90872)
+++ trunk/Source/WebCore/platform/network/ResourceHandle.h	2011-07-13 00:24:03 UTC (rev 90873)
@@ -234,7 +234,7 @@
     virtual void refAuthenticationClient() { ref(); }
     virtual void derefAuthenticationClient() { deref(); }
 
-#if PLATFORM(MAC)
+#if PLATFORM(MAC) && !USE(CFNETWORK)
     void createNSURLConnection(id delegate, bool shouldUseCredentialStorage, bool shouldContentSniff);
 #elif USE(CF)
     void createCFURLConnection(bool shouldUseCredentialStorage, bool shouldContentSniff);

Modified: trunk/Source/WebCore/platform/network/ResourceHandleInternal.h (90872 => 90873)


--- trunk/Source/WebCore/platform/network/ResourceHandleInternal.h	2011-07-13 00:20:04 UTC (rev 90872)
+++ trunk/Source/WebCore/platform/network/ResourceHandleInternal.h	2011-07-13 00:24:03 UTC (rev 90873)
@@ -155,10 +155,13 @@
         bool m_shouldContentSniff;
 #if USE(CFNETWORK)
         RetainPtr<CFURLConnectionRef> m_connection;
-#elif PLATFORM(MAC)
+#endif
+#if PLATFORM(MAC) && !USE(CFNETWORK)
         RetainPtr<NSURLConnection> m_connection;
         RetainPtr<WebCoreResourceHandleAsDelegate> m_delegate;
         RetainPtr<id> m_proxy;
+#endif
+#if PLATFORM(MAC)
         bool m_startWhenScheduled;
         bool m_needsSiteSpecificQuirks;
 #endif

Modified: trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp (90872 => 90873)


--- trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp	2011-07-13 00:20:04 UTC (rev 90872)
+++ trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp	2011-07-13 00:24:03 UTC (rev 90873)
@@ -205,11 +205,23 @@
     if (!handle->client())
         return;
 
+#if PLATFORM(MAC)
+    // Avoid MIME type sniffing if the response comes back as 304 Not Modified.
+    CFHTTPMessageRef msg = wkGetCFURLResponseHTTPResponse(cfResponse);
+    int statusCode = msg ? CFHTTPMessageGetResponseStatusCode(msg) : 0;
+
+    if (statusCode != 304)
+        adjustMIMETypeIfNecessary(cfResponse);
+
+    if (_CFURLRequestCopyProtocolPropertyForKey(handle->firstRequest().cfURLRequest(), CFSTR("ForceHTMLMIMEType")))
+        wkSetCFURLResponseMIMEType(cfResponse, CFSTR("text/html"));
+#else
     if (!CFURLResponseGetMIMEType(cfResponse)) {
         // We should never be applying the default MIMEType if we told the networking layer to do content sniffing for handle.
         ASSERT(!handle->shouldContentSniff());
         setDefaultMIMEType(cfResponse);
     }
+#endif
     
     handle->client()->didReceiveResponse(handle, cfResponse);
 }
@@ -338,7 +350,7 @@
 ResourceHandleInternal::~ResourceHandleInternal()
 {
     if (m_connection) {
-        LOG(Network, "CFNet - Cancelling connection %p (%s)", m_connection, m_firstRequest.url().string().utf8().data());
+        LOG(Network, "CFNet - Cancelling connection %p (%s)", m_connection.get(), m_firstRequest.url().string().utf8().data());
         CFURLConnectionCancel(m_connection.get());
     }
 }
@@ -469,11 +481,15 @@
 
     createCFURLConnection(shouldUseCredentialStorage, d->m_shouldContentSniff);
 
+#if PLATFORM(WIN)
     CFURLConnectionScheduleWithCurrentMessageQueue(d->m_connection.get());
+#else
+    CFURLConnectionScheduleWithRunLoop(d->m_connection.get(), CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
+#endif
     CFURLConnectionScheduleDownloadWithRunLoop(d->m_connection.get(), loaderRunLoop(), kCFRunLoopDefaultMode);
     CFURLConnectionStart(d->m_connection.get());
 
-    LOG(Network, "CFNet - Starting URL %s (handle=%p, conn=%p)", firstRequest().url().string().utf8().data(), this, d->m_connection);
+    LOG(Network, "CFNet - Starting URL %s (handle=%p, conn=%p)", firstRequest().url().string().utf8().data(), this, d->m_connection.get());
 
     return true;
 }
@@ -828,7 +844,8 @@
         RetainPtr<CFErrorRef> cfError(AdoptCF, CFErrorCreate(kCFAllocatorDefault, kCFErrorDomainCFNetwork, kCFURLErrorBadServerResponse, 0));
         m_error = cfError.get();
         m_isDone = true;
-        request = 0;
+        CFURLRequestRef nullRequest = 0;
+        request = nullRequest;
         return;
     }
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to