Changeset 90873 in webkit


Ignore:
Timestamp:
Jul 12, 2011 5:24:03 PM (13 years ago)
Author:
psolanki@apple.com
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.

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r90872 r90873  
     12011-07-12  Pratik Solanki  <psolanki@apple.com>
     2
     3        Get webkit to compile with USE(CFNETWORK) enabled on Mac
     4        https://bugs.webkit.org/show_bug.cgi?id=63674
     5
     6        Reviewed by David Kilzer.
     7
     8        Changes to ResourceHandle class to get it to compile with USE(CFNETWORK).
     9
     10        No new tests because no change in functionality and option is not enabled on Mac.
     11
     12        * platform/network/ResourceHandle.h:
     13        * platform/network/ResourceHandleInternal.h:
     14        * platform/network/cf/ResourceHandleCFNet.cpp:
     15        (WebCore::didReceiveResponse):
     16        (WebCore::ResourceHandleInternal::~ResourceHandleInternal):
     17        (WebCore::ResourceHandle::start):
     18        (WebCore::WebCoreSynchronousLoaderClient::willSendRequest): Call adjustMIMETypeIfNecessary
     19        on Mac. Also port over fix for <rdar://problem/6901522> added in r43993 which forces the
     20        MIME type to text/html if the request is annotated with a "ForceHTMLMIMEType" property.
     21
    1222011-07-12  James Robinson  <jamesr@chromium.org>
    223
  • trunk/Source/WebCore/platform/network/ResourceHandle.h

    r90834 r90873  
    235235    virtual void derefAuthenticationClient() { deref(); }
    236236
    237 #if PLATFORM(MAC)
     237#if PLATFORM(MAC) && !USE(CFNETWORK)
    238238    void createNSURLConnection(id delegate, bool shouldUseCredentialStorage, bool shouldContentSniff);
    239239#elif USE(CF)
  • trunk/Source/WebCore/platform/network/ResourceHandleInternal.h

    r83587 r90873  
    156156#if USE(CFNETWORK)
    157157        RetainPtr<CFURLConnectionRef> m_connection;
    158 #elif PLATFORM(MAC)
     158#endif
     159#if PLATFORM(MAC) && !USE(CFNETWORK)
    159160        RetainPtr<NSURLConnection> m_connection;
    160161        RetainPtr<WebCoreResourceHandleAsDelegate> m_delegate;
    161162        RetainPtr<id> m_proxy;
     163#endif
     164#if PLATFORM(MAC)
    162165        bool m_startWhenScheduled;
    163166        bool m_needsSiteSpecificQuirks;
  • trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp

    r90834 r90873  
    206206        return;
    207207
     208#if PLATFORM(MAC)
     209    // Avoid MIME type sniffing if the response comes back as 304 Not Modified.
     210    CFHTTPMessageRef msg = wkGetCFURLResponseHTTPResponse(cfResponse);
     211    int statusCode = msg ? CFHTTPMessageGetResponseStatusCode(msg) : 0;
     212
     213    if (statusCode != 304)
     214        adjustMIMETypeIfNecessary(cfResponse);
     215
     216    if (_CFURLRequestCopyProtocolPropertyForKey(handle->firstRequest().cfURLRequest(), CFSTR("ForceHTMLMIMEType")))
     217        wkSetCFURLResponseMIMEType(cfResponse, CFSTR("text/html"));
     218#else
    208219    if (!CFURLResponseGetMIMEType(cfResponse)) {
    209220        // We should never be applying the default MIMEType if we told the networking layer to do content sniffing for handle.
     
    211222        setDefaultMIMEType(cfResponse);
    212223    }
     224#endif
    213225   
    214226    handle->client()->didReceiveResponse(handle, cfResponse);
     
    339351{
    340352    if (m_connection) {
    341         LOG(Network, "CFNet - Cancelling connection %p (%s)", m_connection, m_firstRequest.url().string().utf8().data());
     353        LOG(Network, "CFNet - Cancelling connection %p (%s)", m_connection.get(), m_firstRequest.url().string().utf8().data());
    342354        CFURLConnectionCancel(m_connection.get());
    343355    }
     
    470482    createCFURLConnection(shouldUseCredentialStorage, d->m_shouldContentSniff);
    471483
     484#if PLATFORM(WIN)
    472485    CFURLConnectionScheduleWithCurrentMessageQueue(d->m_connection.get());
     486#else
     487    CFURLConnectionScheduleWithRunLoop(d->m_connection.get(), CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
     488#endif
    473489    CFURLConnectionScheduleDownloadWithRunLoop(d->m_connection.get(), loaderRunLoop(), kCFRunLoopDefaultMode);
    474490    CFURLConnectionStart(d->m_connection.get());
    475491
    476     LOG(Network, "CFNet - Starting URL %s (handle=%p, conn=%p)", firstRequest().url().string().utf8().data(), this, d->m_connection);
     492    LOG(Network, "CFNet - Starting URL %s (handle=%p, conn=%p)", firstRequest().url().string().utf8().data(), this, d->m_connection.get());
    477493
    478494    return true;
     
    829845        m_error = cfError.get();
    830846        m_isDone = true;
    831         request = 0;
     847        CFURLRequestRef nullRequest = 0;
     848        request = nullRequest;
    832849        return;
    833850    }
Note: See TracChangeset for help on using the changeset viewer.