WebCore:
authorandersca <andersca@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 28 Aug 2007 19:05:56 +0000 (19:05 +0000)
committerandersca <andersca@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 28 Aug 2007 19:05:56 +0000 (19:05 +0000)
        Reviewed by Darin.

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

        Add a shouldContentSniff flag to ResourceLoader and ResourceHandle and have XMLHttpRequest
        pass in false when creating its subresource loader.

        * WebCore.exp:
        * loader/MainResourceLoader.cpp:
        (WebCore::MainResourceLoader::MainResourceLoader):
        (WebCore::MainResourceLoader::loadNow):
        * loader/ResourceLoader.cpp:
        (WebCore::ResourceLoader::ResourceLoader):
        (WebCore::ResourceLoader::load):
        * loader/ResourceLoader.h:
        * loader/SubresourceLoader.cpp:
        (WebCore::SubresourceLoader::SubresourceLoader):
        (WebCore::SubresourceLoader::create):
        * loader/SubresourceLoader.h:
        * loader/mac/NetscapePlugInStreamLoaderMac.mm:
        (WebCore::NetscapePlugInStreamLoader::NetscapePlugInStreamLoader):
        * platform/mac/WebCoreSystemInterface.h:
        * platform/mac/WebCoreSystemInterface.mm:
        * platform/network/ResourceHandle.cpp:
        (WebCore::ResourceHandle::ResourceHandle):
        (WebCore::ResourceHandle::create):
        * platform/network/ResourceHandle.h:
        * platform/network/ResourceHandleInternal.h:
        (WebCore::ResourceHandleInternal::ResourceHandleInternal):
        * platform/network/mac/ResourceHandleMac.mm:
        (WebCore::ResourceHandle::start):
        * xml/XMLHttpRequest.cpp:
        (WebCore::XMLHttpRequest::send):

WebKit:

        Reviewed by Darin.

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

        Expose WKSetNSURLRequestShouldContentSniff to WebCore.

        * WebCoreSupport/WebSystemInterface.m:
        (InitWebCoreSystemInterface):

LayoutTests:

        Reviewed by Darin.

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

        * http/tests/xmlhttprequest/resources/small-chunks.cgi: Added.
        * http/tests/xmlhttprequest/small-chunks-response-text-expected.txt: Added.
        * http/tests/xmlhttprequest/small-chunks-response-text.html: Added.
        * platform/mac-leopard/Skipped:
        * platform/mac-tiger/Skipped:

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

23 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/xmlhttprequest/resources/small-chunks.cgi [new file with mode: 0755]
LayoutTests/http/tests/xmlhttprequest/small-chunks-response-text-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/xmlhttprequest/small-chunks-response-text.html [new file with mode: 0644]
LayoutTests/platform/mac-leopard/Skipped
LayoutTests/platform/mac-tiger/Skipped
WebCore/ChangeLog
WebCore/WebCore.exp
WebCore/loader/MainResourceLoader.cpp
WebCore/loader/ResourceLoader.cpp
WebCore/loader/ResourceLoader.h
WebCore/loader/SubresourceLoader.cpp
WebCore/loader/SubresourceLoader.h
WebCore/loader/mac/NetscapePlugInStreamLoaderMac.mm
WebCore/platform/mac/WebCoreSystemInterface.h
WebCore/platform/mac/WebCoreSystemInterface.mm
WebCore/platform/network/ResourceHandle.cpp
WebCore/platform/network/ResourceHandle.h
WebCore/platform/network/ResourceHandleInternal.h
WebCore/platform/network/mac/ResourceHandleMac.mm
WebCore/xml/XMLHttpRequest.cpp
WebKit/ChangeLog
WebKit/WebCoreSupport/WebSystemInterface.m

index 8dcf8280eff4c1cfe44ba10ffb1eef3989d77d26..65623177651392b8ba31a8d54552b90821979abd 100644 (file)
@@ -1,3 +1,15 @@
+2007-08-28  Anders Carlsson  <andersca@apple.com>
+
+        Reviewed by Darin.
+
+        <rdar://problem/5298296> XMLHttpRequest readyState 3 & responseText buffer issues
+        
+        * http/tests/xmlhttprequest/resources/small-chunks.cgi: Added.
+        * http/tests/xmlhttprequest/small-chunks-response-text-expected.txt: Added.
+        * http/tests/xmlhttprequest/small-chunks-response-text.html: Added.
+        * platform/mac-leopard/Skipped:
+        * platform/mac-tiger/Skipped:
+
 2007-08-27  Oliver Hunt  <oliver@apple.com>
 
         Reviewed by NOBODY (layout test result fix).
diff --git a/LayoutTests/http/tests/xmlhttprequest/resources/small-chunks.cgi b/LayoutTests/http/tests/xmlhttprequest/resources/small-chunks.cgi
new file mode 100755 (executable)
index 0000000..0225a4c
--- /dev/null
@@ -0,0 +1,14 @@
+#!/usr/bin/perl
+
+use IO::Socket;
+
+$| = 1;
+
+autoflush STDOUT 1;
+
+print "Content-Type: text/html; charset=ISO-8859-1\n\n";
+
+for (my $i = 0; $i < 5; $i++) {
+    print "This is chunk number $i";
+    sleep 1;
+}
diff --git a/LayoutTests/http/tests/xmlhttprequest/small-chunks-response-text-expected.txt b/LayoutTests/http/tests/xmlhttprequest/small-chunks-response-text-expected.txt
new file mode 100644 (file)
index 0000000..b758802
--- /dev/null
@@ -0,0 +1,6 @@
+This tests that an open XMLHttpRequest connection will call onreadystatechange correctly when data is sent over an open connection.
+0 responseText: This is chunk number 0
+1 responseText: This is chunk number 0This is chunk number 1
+2 responseText: This is chunk number 0This is chunk number 1This is chunk number 2
+3 responseText: This is chunk number 0This is chunk number 1This is chunk number 2This is chunk number 3
+4 responseText: This is chunk number 0This is chunk number 1This is chunk number 2This is chunk number 3This is chunk number 4
diff --git a/LayoutTests/http/tests/xmlhttprequest/small-chunks-response-text.html b/LayoutTests/http/tests/xmlhttprequest/small-chunks-response-text.html
new file mode 100644 (file)
index 0000000..28d2ca6
--- /dev/null
@@ -0,0 +1,37 @@
+<html>
+<script>
+if (window.layoutTestController) {
+    layoutTestController.dumpAsText();
+    layoutTestController.waitUntilDone();
+}
+
+function debug(str) {
+   var li = document.createElement('li');
+   li.appendChild(document.createTextNode(str));
+   document.getElementById('console').appendChild(li);
+}
+
+function processStateChange() {
+    if (req.readyState == 3) {
+        debug(count++ + ' responseText: ' + req.responseText);
+    } else if (req.readyState == 4) {
+        if (window.layoutTestController)
+            layoutTestController.notifyDone();
+    }
+}
+
+function runTest() {
+    count = 0;
+    
+    req = new XMLHttpRequest();
+    
+    req.open('GET', 'resources/small-chunks.cgi', true);
+    req.onreadystatechange = processStateChange;
+    req.send(null);
+}
+</script>
+<body onload="runTest()">
+<div>This tests that an open XMLHttpRequest connection will call onreadystatechange correctly when data is sent over an open connection.</div>
+<ul id="console"></li>
+</body>
+</html>
index 942a028ab45faffc6abc1d2034d406758422ff83..d36872bdad7cebeb4aa3aa03e68ef414b3f210f4 100644 (file)
@@ -32,3 +32,6 @@ http/tests/security/frame-loading-via-document-write.html
 # <rdar://problem/5338680> fast/forms/hidden-listbox and fast/forms/hidden-input-file are missing empty RenderText on Leopard
 fast/forms/hidden-listbox.html
 fast/forms/hidden-input-file.html
+
+# Once <rdar://problem/5343008> is in a released build we can remove this.
+tests/xmlhttprequest/small-chunks-response-text.html
\ No newline at end of file
index 982f2f4e74fbfc45e41c84d390b9478b609c382b..0ddbb9b358f24f79d357419801cfa9136e337a48 100644 (file)
@@ -1,3 +1,5 @@
 # 
 fast/cookies/local-file-can-set-cookies.html
 
+# For this test to work on Tiger we'd need a new Foundation
+tests/xmlhttprequest/small-chunks-response-text.html
\ No newline at end of file
index 2028686dbb0a32b4d6557e054b4414af6b47366d..f53946cb7adb41fad05fcac54960bb3dd26d7da4 100644 (file)
@@ -1,3 +1,39 @@
+2007-08-28  Anders Carlsson  <andersca@apple.com>
+
+        Reviewed by Darin.
+
+        <rdar://problem/5298296> XMLHttpRequest readyState 3 & responseText buffer issues
+        
+        Add a shouldContentSniff flag to ResourceLoader and ResourceHandle and have XMLHttpRequest 
+        pass in false when creating its subresource loader.
+        
+        * WebCore.exp:
+        * loader/MainResourceLoader.cpp:
+        (WebCore::MainResourceLoader::MainResourceLoader):
+        (WebCore::MainResourceLoader::loadNow):
+        * loader/ResourceLoader.cpp:
+        (WebCore::ResourceLoader::ResourceLoader):
+        (WebCore::ResourceLoader::load):
+        * loader/ResourceLoader.h:
+        * loader/SubresourceLoader.cpp:
+        (WebCore::SubresourceLoader::SubresourceLoader):
+        (WebCore::SubresourceLoader::create):
+        * loader/SubresourceLoader.h:
+        * loader/mac/NetscapePlugInStreamLoaderMac.mm:
+        (WebCore::NetscapePlugInStreamLoader::NetscapePlugInStreamLoader):
+        * platform/mac/WebCoreSystemInterface.h:
+        * platform/mac/WebCoreSystemInterface.mm:
+        * platform/network/ResourceHandle.cpp:
+        (WebCore::ResourceHandle::ResourceHandle):
+        (WebCore::ResourceHandle::create):
+        * platform/network/ResourceHandle.h:
+        * platform/network/ResourceHandleInternal.h:
+        (WebCore::ResourceHandleInternal::ResourceHandleInternal):
+        * platform/network/mac/ResourceHandleMac.mm:
+        (WebCore::ResourceHandle::start):
+        * xml/XMLHttpRequest.cpp:
+        (WebCore::XMLHttpRequest::send):
+
 2007-08-27  Steve Falkenburg  <sfalken@apple.com>
 
         Added getter for committedFirstRealDocumentLoad.
index 7f654c6b605a267a26422172c2f2ff01d3940a0e..9d2366dbab8446383dea69f93115ac61045bd3fe 100644 (file)
@@ -721,6 +721,7 @@ _wkSecondsSinceLastInputEvent
 _wkSetCGFontRenderingMode
 _wkSetDragImage
 _wkSetNSURLConnectionDefersCallbacks
+_wkSetNSURLRequestShouldContentSniff
 _wkSetPatternPhaseInUserSpace
 _wkSetUpFontCache
 _wkSignalCFReadStreamEnd
index 3a69d0688fe4b2838b1cb6f2e22fd8e4e1499dfa..8efc3d18a2d999cad5d8f98681c6cc1cf9c9502d 100644 (file)
@@ -42,7 +42,7 @@
 namespace WebCore {
 
 MainResourceLoader::MainResourceLoader(Frame* frame)
-    : ResourceLoader(frame, true)
+    : ResourceLoader(frame, true, true)
     , m_dataLoadTimer(this, &MainResourceLoader::handleDataLoadNow)
     , m_loadingMultipartContent(false)
     , m_waitingForContentPolicy(false)
@@ -374,7 +374,7 @@ bool MainResourceLoader::loadNow(ResourceRequest& r)
     else if (shouldLoadEmpty || frameLoader()->representationExistsForURLScheme(url.protocol()))
         handleEmptyLoad(url, !shouldLoadEmpty);
     else
-        m_handle = ResourceHandle::create(r, this, m_frame.get(), false, true);
+        m_handle = ResourceHandle::create(r, this, m_frame.get(), false, true, true);
 
     return false;
 }
index 81fceb1414b5486eb690dd55351914e8857bdcad..5b2cda67b70c5484d843701d8c6818be7a6bbe37 100644 (file)
@@ -52,11 +52,12 @@ PassRefPtr<SharedBuffer> ResourceLoader::resourceData()
     return 0;
 }
 
-ResourceLoader::ResourceLoader(Frame* frame, bool sendResourceLoadCallbacks)
+ResourceLoader::ResourceLoader(Frame* frame, bool sendResourceLoadCallbacks, bool shouldContentSniff)
     : m_reachedTerminalState(false)
     , m_cancelled(false)
     , m_calledDidFinishLoad(false)
     , m_sendResourceLoadCallbacks(sendResourceLoadCallbacks)
+    , m_shouldContentSniff(shouldContentSniff)
     , m_shouldBufferData(true)
     , m_frame(frame)
     , m_documentLoader(frame->loader()->activeDocumentLoader())
@@ -123,7 +124,7 @@ bool ResourceLoader::load(const ResourceRequest& r)
         return true;
     }
     
-    m_handle = ResourceHandle::create(clientRequest, this, m_frame.get(), m_defersLoading);
+    m_handle = ResourceHandle::create(clientRequest, this, m_frame.get(), m_defersLoading, m_shouldContentSniff, true);
 
     return true;
 }
index 2daf0333e900a9d11691e1dfc1e3480b01d7dae1..475347219b9a162c126bcf50f0c0554846bae3cc 100644 (file)
@@ -108,7 +108,7 @@ namespace WebCore {
         void setShouldBufferData(bool shouldBufferData) { m_shouldBufferData = shouldBufferData; }
 
     protected:
-        ResourceLoader(Frame*, bool sendResourceLoadCallbacks);
+        ResourceLoader(Frame*, bool sendResourceLoadCallbacks, bool shouldContentSniff);
 
         virtual void didCancel(const ResourceError&);
         void didFinishLoadingOnePart();
@@ -129,6 +129,7 @@ namespace WebCore {
         bool m_calledDidFinishLoad;
 
         bool m_sendResourceLoadCallbacks;
+        bool m_shouldContentSniff;
         bool m_shouldBufferData;
 protected:
         // FIXME: Once everything is made cross platform, these can be private instead of protected
index b75951a7e9936d0b8b9f9535abda9cae8924810a..56990199911c3dcf576e76e1d537abac21392575 100644 (file)
@@ -57,8 +57,8 @@ unsigned SubresourceLoaderCounter::count = 0;
 static SubresourceLoaderCounter subresourceLoaderCounter;
 #endif
 
-SubresourceLoader::SubresourceLoader(Frame* frame, SubresourceLoaderClient* client, bool sendResourceLoadCallbacks)
-    : ResourceLoader(frame, sendResourceLoadCallbacks)
+SubresourceLoader::SubresourceLoader(Frame* frame, SubresourceLoaderClient* client, bool sendResourceLoadCallbacks, bool shouldContentSniff)
+    : ResourceLoader(frame, sendResourceLoadCallbacks, shouldContentSniff)
     , m_client(client)
     , m_loadingMultipartContent(false)
 {
@@ -82,7 +82,7 @@ bool SubresourceLoader::load(const ResourceRequest& r)
     return ResourceLoader::load(r);
 }
 
-PassRefPtr<SubresourceLoader> SubresourceLoader::create(Frame* frame, SubresourceLoaderClient* client, const ResourceRequest& request, bool skipCanLoadCheck, bool sendResourceLoadCallbacks)
+PassRefPtr<SubresourceLoader> SubresourceLoader::create(Frame* frame, SubresourceLoaderClient* client, const ResourceRequest& request, bool skipCanLoadCheck, bool sendResourceLoadCallbacks, bool shouldContentSniff)
 {
     if (!frame)
         return 0;
@@ -118,7 +118,7 @@ PassRefPtr<SubresourceLoader> SubresourceLoader::create(Frame* frame, Subresourc
 
     fl->addExtraFieldsToRequest(newRequest, false, false);
 
-    RefPtr<SubresourceLoader> subloader(new SubresourceLoader(frame, client, sendResourceLoadCallbacks));
+    RefPtr<SubresourceLoader> subloader(new SubresourceLoader(frame, client, sendResourceLoadCallbacks, shouldContentSniff));
     if (!subloader->load(newRequest))
         return 0;
 
index 9b4fc0d76034b6c392e168380e8be415fed89534..bca910e27f1cea44d61d0d7985586047ec350c7a 100644 (file)
@@ -49,7 +49,7 @@ namespace WebCore {
     
     class SubresourceLoader : public ResourceLoader {
     public:
-        static PassRefPtr<SubresourceLoader> create(Frame*, SubresourceLoaderClient*, const ResourceRequest&, bool skipCanLoadCheck = false, bool sendResourceLoadCallbacks = true);
+        static PassRefPtr<SubresourceLoader> create(Frame*, SubresourceLoaderClient*, const ResourceRequest&, bool skipCanLoadCheck = false, bool sendResourceLoadCallbacks = true, bool shouldContentSniff = true);
         
         virtual ~SubresourceLoader();
 
@@ -63,7 +63,7 @@ namespace WebCore {
         virtual void receivedCancellation(const AuthenticationChallenge&);
 
     private:
-        SubresourceLoader(Frame*, SubresourceLoaderClient*, bool sendResourceLoadCallbacks);
+        SubresourceLoader(Frame*, SubresourceLoaderClient*, bool sendResourceLoadCallbacks, bool shouldContentSniff);
 
         virtual void didCancel(const ResourceError&);
         SubresourceLoaderClient* m_client;
index a5e0d9b2632ff2f116e435a7d5cc6af1a53ef459..143c4204a860bd41aa289e29e5904bce1ea34dde 100644 (file)
@@ -39,7 +39,7 @@
 namespace WebCore {
 
 NetscapePlugInStreamLoader::NetscapePlugInStreamLoader(Frame* frame, id <WebPlugInStreamLoaderDelegate> stream)
-    : ResourceLoader(frame, true)
+    : ResourceLoader(frame, true, true)
     , m_stream(stream)
 {
 }
index 8479c93cd2f356877e4de1db7469830e24eae965..53dc52df1bdf76518b15952ab67e59c882f73e89 100644 (file)
@@ -114,6 +114,7 @@ extern void (*wkReleaseStyleGroup)(void* group);
 extern void (*wkSetCGFontRenderingMode)(CGContextRef, NSFont*);
 extern void (*wkSetDragImage)(NSImage*, NSPoint offset);
 extern void (*wkSetNSURLConnectionDefersCallbacks)(NSURLConnection *, BOOL);
+extern void (*wkSetNSURLRequestShouldContentSniff)(NSMutableURLRequest *, BOOL);
 extern void (*wkSetPatternPhaseInUserSpace)(CGContextRef, CGPoint);
 extern void (*wkSetUpFontCache)(size_t);
 extern void (*wkSignalCFReadStreamEnd)(CFReadStreamRef stream);
index 0b465dc7ff18b847913b68af2a0696ef8d83c089..5444e91509313b82b8c8e0f3dd39fc834c86394f 100644 (file)
@@ -75,6 +75,7 @@ CFReadStreamRef (*wkCreateCustomCFReadStream)(void *(*formCreate)(CFReadStreamRe
     void (*formUnschedule)(CFReadStreamRef, CFRunLoopRef, CFStringRef, void *),
     void *context);
 void (*wkSetNSURLConnectionDefersCallbacks)(NSURLConnection *, BOOL);
+void (*wkSetNSURLRequestShouldContentSniff)(NSMutableURLRequest *, BOOL);
 id (*wkCreateNSURLConnectionDelegateProxy)(void);
 BOOL (*wkSupportsMultipartXMixedReplace)(NSMutableURLRequest *);
 Class (*wkNSURLProtocolClassForReqest)(NSURLRequest *);
index 80e6ea6f6b02ab59b5aae5adc02f2f12be21813d..f1c0477ece86a8c57be13f0709acffc86f1bbf74 100644 (file)
 namespace WebCore {
 
 ResourceHandle::ResourceHandle(const ResourceRequest& request, ResourceHandleClient* client, bool defersLoading,
-        bool mightDownloadFromHandle)
-    : d(new ResourceHandleInternal(this, request, client, defersLoading, mightDownloadFromHandle))
+         bool shouldContentSniff, bool mightDownloadFromHandle)
+    : d(new ResourceHandleInternal(this, request, client, defersLoading, shouldContentSniff, mightDownloadFromHandle))
 {
 }
 
 PassRefPtr<ResourceHandle> ResourceHandle::create(const ResourceRequest& request, ResourceHandleClient* client,
-    Frame* frame, bool defersLoading, bool mightDownloadFromHandle)
+    Frame* frame, bool defersLoading, bool shouldContentSniff, bool mightDownloadFromHandle)
 {
-    RefPtr<ResourceHandle> newHandle(new ResourceHandle(request, client, defersLoading, mightDownloadFromHandle));
+    RefPtr<ResourceHandle> newHandle(new ResourceHandle(request, client, defersLoading, shouldContentSniff, mightDownloadFromHandle));
 
     if (!portAllowed(request)) {
         newHandle->scheduleBlockedFailure();
index f24f85c7418697cf23844aa78c7b038acdc1822a..988bdfa1242efdac60e5e424c26e4f0ee0cff8f2 100644 (file)
@@ -86,11 +86,11 @@ template <typename T> class Timer;
 
 class ResourceHandle : public Shared<ResourceHandle> {
 private:
-    ResourceHandle(const ResourceRequest&, ResourceHandleClient*, bool defersLoading, bool mightDownloadFromHandle);
+    ResourceHandle(const ResourceRequest&, ResourceHandleClient*, bool defersLoading, bool shouldContentSniff, bool mightDownloadFromHandle);
 
 public:
     // FIXME: should not need the Frame
-    static PassRefPtr<ResourceHandle> create(const ResourceRequest&, ResourceHandleClient*, Frame*, bool defersLoading, bool mightDownloadFromHandle = false);
+    static PassRefPtr<ResourceHandle> create(const ResourceRequest&, ResourceHandleClient*, Frame*, bool defersLoading, bool shouldContentSniff, bool mightDownloadFromHandle = false);
 
     static void loadResourceSynchronously(const ResourceRequest&, ResourceError&, ResourceResponse&, Vector<char>& data);
     static bool willLoadFromCache(ResourceRequest&);
index 498729e319e2cff84cb246f542130e856fcceea3..263d9d1edd420125b843e94f403deb3dd9c7a571 100644 (file)
@@ -66,11 +66,12 @@ namespace WebCore {
 
     class ResourceHandleInternal : Noncopyable {
     public:
-        ResourceHandleInternal(ResourceHandle* loader, const ResourceRequest& request, ResourceHandleClient* c, bool defersLoading, bool mightDownloadFromHandle)
+        ResourceHandleInternal(ResourceHandle* loader, const ResourceRequest& request, ResourceHandleClient* c, bool defersLoading, bool shouldContentSniff, bool mightDownloadFromHandle)
             : m_client(c)
             , m_request(request)
             , status(0)
             , m_defersLoading(defersLoading)
+            , m_shouldContentSniff(shouldContentSniff)
             , m_mightDownloadFromHandle(mightDownloadFromHandle)
 #if USE(CFNETWORK)
             , m_connection(0)
@@ -117,6 +118,7 @@ namespace WebCore {
         int status;
 
         bool m_defersLoading;
+        bool m_shouldContentSniff;
         bool m_mightDownloadFromHandle;
 #if USE(CFNETWORK)
         RetainPtr<CFURLConnectionRef> m_connection;
index 1ea636ed82ed5db659153ff9ed5acd65108fdfd2..8be5892eec45137964758435d265e01e8a3a93d6 100644 (file)
@@ -119,7 +119,19 @@ bool ResourceHandle::start(Frame* frame)
     } else 
         delegate = ResourceHandle::delegate();
     
-    NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:d->m_request.nsURLRequest() delegate:delegate];
+
+    NSURLConnection *connection;
+    
+    if (d->m_shouldContentSniff) 
+        connection = [[NSURLConnection alloc] initWithRequest:d->m_request.nsURLRequest() delegate:delegate];
+    else {
+        NSMutableURLRequest *request = [d->m_request.nsURLRequest() mutableCopy];
+        wkSetNSURLRequestShouldContentSniff(request, NO);
+        connection = [[NSURLConnection alloc] initWithRequest:request delegate:delegate];
+        [request release];
+    }
+    
+    
 #ifndef NDEBUG
     isInitializingConnection = NO;
 #endif
index 92d043fedb88067300ea6a20616034a9ae20d338..5a58bfff37280075828aa3b5aa730a3f04968a3a 100644 (file)
@@ -458,7 +458,7 @@ void XMLHttpRequest::send(const String& body, ExceptionCode& ec)
     // create can return null here, for example if we're no longer attached to a page.
     // this is true while running onunload handlers
     // FIXME: Maybe create can return false for other reasons too?
-    m_loader = SubresourceLoader::create(m_doc->frame(), this, request);
+    m_loader = SubresourceLoader::create(m_doc->frame(), this, request, false, true, false);
 }
 
 void XMLHttpRequest::abort()
index b79f542b2ba0e87020e3521ffcb82c67790e03cf..2ce5ed49f029b1948268a7ef85b174abcae93b3c 100644 (file)
@@ -1,3 +1,14 @@
+2007-08-28  Anders Carlsson  <andersca@apple.com>
+
+        Reviewed by Darin.
+
+        <rdar://problem/5298296> XMLHttpRequest readyState 3 & responseText buffer issues
+        
+        Expose WKSetNSURLRequestShouldContentSniff to WebCore.
+        
+        * WebCoreSupport/WebSystemInterface.m:
+        (InitWebCoreSystemInterface):
+
 2007-08-24  Kevin McCullough  <kmccullough@apple.com>
 
         Reviewed by Darin.
index e8fdb4e90716d598a56e0d783ed8f91fe130005e..34890a8c5df275f79a2149a590245ba652757e5b 100644 (file)
@@ -78,6 +78,7 @@ void InitWebCoreSystemInterface(void)
     INIT(SetCGFontRenderingMode);
     INIT(SetDragImage);
     INIT(SetNSURLConnectionDefersCallbacks);
+    INIT(SetNSURLRequestShouldContentSniff);
     INIT(SetPatternPhaseInUserSpace);
     INIT(SetUpFontCache);
     INIT(SignalCFReadStreamEnd);