REGRESSION(r173272): Two blob tests failing on WK1
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 5 Sep 2014 18:15:59 +0000 (18:15 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 5 Sep 2014 18:15:59 +0000 (18:15 +0000)
https://bugs.webkit.org/show_bug.cgi?id=136573

Reviewed by Alexey Proskuryakov.

http/tests/fileapi/blob-url-in-subframe.html
http/tests/security/mixedContent/blob-url-in-iframe.html

* platform/network/BlobResourceHandle.cpp:
(WebCore::BlobResourceHandle::notifyResponseOnSuccess):

    No need to set this twice.

* platform/network/mac/ResourceResponseMac.mm:
(WebCore::ResourceResponse::initNSURLResponse):

    Also test that it is an HTTP URL before using NSHTTPURLResponse. Blobs create non-HTTP URLs with status codes.
    Pass the accidentally lost expected content length.

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

Source/WebCore/ChangeLog
Source/WebCore/platform/network/BlobResourceHandle.cpp
Source/WebCore/platform/network/mac/ResourceResponseMac.mm

index c27b8f4..dc2c6f2 100644 (file)
@@ -1,3 +1,24 @@
+2014-09-05  Antti Koivisto  <antti@apple.com>
+
+        REGRESSION(r173272): Two blob tests failing on WK1
+        https://bugs.webkit.org/show_bug.cgi?id=136573
+
+        Reviewed by Alexey Proskuryakov.
+
+        http/tests/fileapi/blob-url-in-subframe.html
+        http/tests/security/mixedContent/blob-url-in-iframe.html
+
+        * platform/network/BlobResourceHandle.cpp:
+        (WebCore::BlobResourceHandle::notifyResponseOnSuccess):
+
+            No need to set this twice.
+
+        * platform/network/mac/ResourceResponseMac.mm:
+        (WebCore::ResourceResponse::initNSURLResponse):
+
+            Also test that it is an HTTP URL before using NSHTTPURLResponse. Blobs create non-HTTP URLs with status codes.
+            Pass the accidentally lost expected content length.
+
 2014-09-05  Zalan Bujtas  <zalan@apple.com>
 
         Move computeInlinePreferredLogicalWidths() from RenderBlock to RenderBlockFlow
index a0fe37d..c494e52 100644 (file)
@@ -597,7 +597,6 @@ void BlobResourceHandle::notifyResponseOnSuccess()
 
     bool isRangeRequest = m_rangeOffset != positionNotSpecified;
     ResourceResponse response(firstRequest().url(), m_blobData->contentType(), m_totalRemainingSize, String());
-    response.setExpectedContentLength(m_totalRemainingSize);
     response.setHTTPStatusCode(isRangeRequest ? httpPartialContent : httpOK);
     response.setHTTPStatusText(isRangeRequest ? httpPartialContentText : httpOKText);
     // FIXME: If a resource identified with a blob: URL is a File object, user agents must use that file's name attribute,
index aa465dd..8fbe016 100644 (file)
@@ -45,7 +45,7 @@ namespace WebCore {
 
 void ResourceResponse::initNSURLResponse() const
 {
-    if (!m_httpStatusCode) {
+    if (!m_httpStatusCode || !m_url.protocolIsInHTTPFamily()) {
         // Work around a mistake in the NSURLResponse class - <rdar://problem/6875219>.
         // The init function takes an NSInteger, even though the accessor returns a long long.
         // For values that won't fit in an NSInteger, pass -1 instead.
@@ -55,7 +55,7 @@ void ResourceResponse::initNSURLResponse() const
         else
             expectedContentLength = static_cast<NSInteger>(m_expectedContentLength);
 
-        m_nsResponse = adoptNS([[NSURLResponse alloc] initWithURL:m_url MIMEType:m_mimeType expectedContentLength:-1 textEncodingName:m_textEncodingName]);
+        m_nsResponse = adoptNS([[NSURLResponse alloc] initWithURL:m_url MIMEType:m_mimeType expectedContentLength:expectedContentLength textEncodingName:m_textEncodingName]);
         return;
     }
     NSMutableDictionary* headerDictionary = [NSMutableDictionary dictionary];