WebCore:
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 17 Nov 2007 01:32:01 +0000 (01:32 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 17 Nov 2007 01:32:01 +0000 (01:32 +0000)
        Reviewed by Adam.

        <rdar://problem/5603832>
        XMLHttpRequest readyState 3 & responseText buffer issues.

        * platform/network/cf/ResourceHandleCFNet.cpp:
        (WebCore::makeFinalRequest):
        Add new parameter which controls whether content sniffing should be turned off.

        (WebCore::ResourceHandle::loadResourceSynchronously):
        Always content sniff sync loads.

        * platform/network/cf/ResourceRequestCFNet.cpp:
        (WebCore::ResourceRequest::doUpdatePlatformRequest):
        If the ResourceRequest already has a backing CFURLRequest, make a copy of it. This preserves
        any properties set on the CFURLRequest.

LayoutTests:

        Reviewed by Adam.

        <rdar://problem/5603832>
        XMLHttpRequest readyState 3 & responseText buffer issues.

        Remove http/tests/xmlhttprequest/small-chunks-response-text.html from the Skipped list.

        * platform/win/Skipped:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@27865 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/platform/win/Skipped
WebCore/ChangeLog
WebCore/platform/network/cf/ResourceHandleCFNet.cpp
WebCore/platform/network/cf/ResourceRequestCFNet.cpp

index 3bcff51..592eb7f 100644 (file)
@@ -1,3 +1,14 @@
+2007-11-16  Anders Carlsson  <andersca@apple.com>
+
+        Reviewed by Adam.
+
+        <rdar://problem/5603832>
+        XMLHttpRequest readyState 3 & responseText buffer issues.
+
+        Remove http/tests/xmlhttprequest/small-chunks-response-text.html from the Skipped list.
+        
+        * platform/win/Skipped:
+    
 2007-11-16  Dan Bernstein  <mitz@apple.com>
 
         Reviewed by Darin Adler and Sam Weinig.
 2007-11-16  Dan Bernstein  <mitz@apple.com>
 
         Reviewed by Darin Adler and Sam Weinig.
         * fast/xpath/preceding-axis-expected.txt: Added.
         * fast/xpath/preceding-axis.xhtml: Added.
 
         * fast/xpath/preceding-axis-expected.txt: Added.
         * fast/xpath/preceding-axis.xhtml: Added.
 
+>>>>>>> .r27862
 2007-11-15  Justin Garcia  <justin.garcia@apple.com>
 
         Reviewed by Adele Peterson.
 2007-11-15  Justin Garcia  <justin.garcia@apple.com>
 
         Reviewed by Adele Peterson.
index 3fe9dff..d5f2a12 100644 (file)
@@ -598,6 +598,5 @@ http/tests/plugins/npapi-response-headers.html
 http/tests/security/dataURL/xss-DENIED-to-data-url-sub-frame-uppercase.html
 http/tests/xmlhttprequest/connection-error-sync.html
 http/tests/xmlhttprequest/failed-auth.html
 http/tests/security/dataURL/xss-DENIED-to-data-url-sub-frame-uppercase.html
 http/tests/xmlhttprequest/connection-error-sync.html
 http/tests/xmlhttprequest/failed-auth.html
-http/tests/xmlhttprequest/small-chunks-response-text.html
 plugins/netscape-plugin-setwindow-size.html
 svg/custom/gradient-stop-style-change.svg
 plugins/netscape-plugin-setwindow-size.html
 svg/custom/gradient-stop-style-change.svg
index 1bfabcd..c92504b 100644 (file)
@@ -1,3 +1,22 @@
+2007-11-16  Anders Carlsson  <andersca@apple.com>
+
+        Reviewed by Adam.
+
+        <rdar://problem/5603832>
+        XMLHttpRequest readyState 3 & responseText buffer issues.
+
+        * platform/network/cf/ResourceHandleCFNet.cpp:
+        (WebCore::makeFinalRequest):
+        Add new parameter which controls whether content sniffing should be turned off.
+        
+        (WebCore::ResourceHandle::loadResourceSynchronously):
+        Always content sniff sync loads.
+        
+        * platform/network/cf/ResourceRequestCFNet.cpp:
+        (WebCore::ResourceRequest::doUpdatePlatformRequest):
+        If the ResourceRequest already has a backing CFURLRequest, make a copy of it. This preserves
+        any properties set on the CFURLRequest.
+
 2007-11-16  Jon Honeycutt  <jhoneycutt@apple.com>
 
         Reviewed by Ollie.
 2007-11-16  Jon Honeycutt  <jhoneycutt@apple.com>
 
         Reviewed by Ollie.
index 9b99aa3..d9293a8 100644 (file)
@@ -221,10 +221,13 @@ CFRunLoopRef ResourceHandle::loaderRunLoop()
     return loaderRL;
 }
 
     return loaderRL;
 }
 
-static CFURLRequestRef makeFinalRequest(const ResourceRequest& request)
+static CFURLRequestRef makeFinalRequest(const ResourceRequest& request, bool shouldContentSniff)
 {
     CFMutableURLRequestRef newRequest = CFURLRequestCreateMutableCopy(kCFAllocatorDefault, request.cfURLRequest());
     
 {
     CFMutableURLRequestRef newRequest = CFURLRequestCreateMutableCopy(kCFAllocatorDefault, request.cfURLRequest());
     
+    if (!shouldContentSniff)
+        wkSetCFURLRequestShouldContentSniff(newRequest, false);
+
     if (allowsAnyHTTPSCertificateHosts().contains(request.url().host().lower())) {
         CFTypeRef keys[] = { kCFStreamSSLAllowsAnyRoot, kCFStreamSSLAllowsExpiredRoots };  
         CFTypeRef values[] = { kCFBooleanTrue, kCFBooleanTrue };
     if (allowsAnyHTTPSCertificateHosts().contains(request.url().host().lower())) {
         CFTypeRef keys[] = { kCFStreamSSLAllowsAnyRoot, kCFStreamSSLAllowsExpiredRoots };  
         CFTypeRef values[] = { kCFBooleanTrue, kCFBooleanTrue };
@@ -245,7 +248,7 @@ bool ResourceHandle::start(Frame* frame)
     if (!frame->page())
         return false;
 
     if (!frame->page())
         return false;
 
-    RetainPtr<CFURLRequestRef> request(AdoptCF, makeFinalRequest(d->m_request));
+    RetainPtr<CFURLRequestRef> request(AdoptCF, makeFinalRequest(d->m_request, d->m_shouldContentSniff));
 
     // CFURLConnection Callback API currently at version 1
     const int CFURLConnectionClientVersion = 1;
 
     // CFURLConnection Callback API currently at version 1
     const int CFURLConnectionClientVersion = 1;
@@ -351,7 +354,7 @@ void ResourceHandle::loadResourceSynchronously(const ResourceRequest& request, R
     ASSERT(!request.isEmpty());
     CFURLResponseRef cfResponse = 0;
     CFErrorRef cfError = 0;
     ASSERT(!request.isEmpty());
     CFURLResponseRef cfResponse = 0;
     CFErrorRef cfError = 0;
-    RetainPtr<CFURLRequestRef> cfRequest(AdoptCF, makeFinalRequest(request));
+    RetainPtr<CFURLRequestRef> cfRequest(AdoptCF, makeFinalRequest(request, true));
 
     CFDataRef data = CFURLConnectionSendSynchronousRequest(cfRequest.get(), &cfResponse, &cfError, request.timeoutInterval());
 
 
     CFDataRef data = CFURLConnectionSendSynchronousRequest(cfRequest.get(), &cfResponse, &cfError, request.timeoutInterval());
 
index 9651eba..1dfaf0d 100644 (file)
@@ -57,10 +57,16 @@ static inline void addHeadersFromHashMap(CFMutableURLRequestRef request, const H
 
 void ResourceRequest::doUpdatePlatformRequest()
 {
 
 void ResourceRequest::doUpdatePlatformRequest()
 {
-    RetainPtr<CFURLRef> url(AdoptCF, ResourceRequest::url().createCFURL());
-    RetainPtr<CFURLRef> mainDocumentURL(AdoptCF, ResourceRequest::mainDocumentURL().createCFURL());
+    CFMutableURLRequestRef cfRequest;
 
 
-    CFMutableURLRequestRef cfRequest = CFURLRequestCreateMutable(0, url.get(), (CFURLRequestCachePolicy)cachePolicy(), timeoutInterval(), mainDocumentURL.get());
+    if (m_cfRequest) 
+        cfRequest = CFURLRequestCreateMutableCopy(0, m_cfRequest.get());
+    else {
+        RetainPtr<CFURLRef> url(AdoptCF, ResourceRequest::url().createCFURL());
+        RetainPtr<CFURLRef> mainDocumentURL(AdoptCF, ResourceRequest::mainDocumentURL().createCFURL());
+
+        cfRequest = CFURLRequestCreateMutable(0, url.get(), (CFURLRequestCachePolicy)cachePolicy(), timeoutInterval(), mainDocumentURL.get());
+    }
 
     RetainPtr<CFStringRef> requestMethod(AdoptCF, httpMethod().createCFString());
     CFURLRequestSetHTTPRequestMethod(cfRequest, requestMethod.get());
 
     RetainPtr<CFStringRef> requestMethod(AdoptCF, httpMethod().createCFString());
     CFURLRequestSetHTTPRequestMethod(cfRequest, requestMethod.get());