Changeset 174866 in webkit


Ignore:
Timestamp:
Oct 18, 2014 3:54:14 PM (10 years ago)
Author:
Antti Koivisto
Message:

REGRESSION (r173356): Safari can't install a profile, gets 'Download Failed error
https://bugs.webkit.org/show_bug.cgi?id=137855

Reviewed by Dan Bernstein.

Source/WebCore:

We lose the sniffed MIME type for the response when synthesizing an NSURLResponse. Sniffing requires
backchannel data that the synthesized response doesn't have.

Test: http/tests/mime/mime-type-sniff.html

  • platform/network/mac/ResourceResponseMac.mm:

(WebCore::ResourceResponse::initNSURLResponse):

When synthesizing NSURLResponse explicitly set the Content-type header to the sniffed type.

Tools:

Test and warn if the dumped response mime type differs from the platform response mime type.

  • WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:

(WTR::InjectedBundlePage::didReceiveResponseForResource):
(WTR::InjectedBundlePage::platformResponseMimeType):

  • WebKitTestRunner/InjectedBundle/InjectedBundlePage.h:
  • WebKitTestRunner/InjectedBundle/cocoa/InjectedBundlePageCocoa.mm:

(WTR::InjectedBundlePage::platformResponseMimeType):

LayoutTests:

  • http/tests/mime/mime-type-sniff-expected.txt: Added.
  • http/tests/mime/mime-type-sniff.html: Added.
  • http/tests/mime/resources/png-with-text-content-type.cgi: Added.
Location:
trunk
Files:
3 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r174860 r174866  
     12014-10-18  Antti Koivisto  <antti@apple.com>
     2
     3        REGRESSION (r173356): Safari can't install a profile, gets 'Download Failed error
     4        https://bugs.webkit.org/show_bug.cgi?id=137855
     5
     6        Reviewed by Dan Bernstein.
     7
     8        * http/tests/mime/mime-type-sniff-expected.txt: Added.
     9        * http/tests/mime/mime-type-sniff.html: Added.
     10        * http/tests/mime/resources/png-with-text-content-type.cgi: Added.
     11
    1122014-10-18  Chris Fleizach  <cfleizach@apple.com>
    213
  • trunk/Source/WebCore/ChangeLog

    r174862 r174866  
     12014-10-18  Antti Koivisto  <antti@apple.com>
     2
     3        REGRESSION (r173356): Safari can't install a profile, gets 'Download Failed error
     4        https://bugs.webkit.org/show_bug.cgi?id=137855
     5
     6        Reviewed by Dan Bernstein.
     7
     8        We lose the sniffed MIME type for the response when synthesizing an NSURLResponse. Sniffing requires
     9        backchannel data that the synthesized response doesn't have.
     10
     11        Test: http/tests/mime/mime-type-sniff.html
     12
     13        * platform/network/mac/ResourceResponseMac.mm:
     14        (WebCore::ResourceResponse::initNSURLResponse):
     15
     16            When synthesizing NSURLResponse explicitly set the Content-type header to the sniffed type.
     17
    1182014-10-18  Chris Dumez  <cdumez@apple.com>
    219
  • trunk/Source/WebCore/platform/network/mac/ResourceResponseMac.mm

    r174747 r174866  
    6767
    6868    m_nsResponse = adoptNS([[NSHTTPURLResponse alloc] initWithURL:m_url statusCode:m_httpStatusCode HTTPVersion:(NSString*)kCFHTTPVersion1_1 headerFields:headerDictionary]);
     69
     70    // Mime type sniffing doesn't work with a synthesized response.
     71    [m_nsResponse.get() _setMIMEType:(NSString *)m_mimeType];
    6972}
    7073
  • trunk/Tools/ChangeLog

    r174845 r174866  
     12014-10-18  Antti Koivisto  <antti@apple.com>
     2
     3        REGRESSION (r173356): Safari can't install a profile, gets 'Download Failed error
     4        https://bugs.webkit.org/show_bug.cgi?id=137855
     5
     6        Reviewed by Dan Bernstein.
     7
     8        Test and warn if the dumped response mime type differs from the platform response mime type.
     9
     10        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
     11        (WTR::InjectedBundlePage::didReceiveResponseForResource):
     12        (WTR::InjectedBundlePage::platformResponseMimeType):
     13        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.h:
     14        * WebKitTestRunner/InjectedBundle/cocoa/InjectedBundlePageCocoa.mm:
     15        (WTR::InjectedBundlePage::platformResponseMimeType):
     16
    1172014-10-17  Joseph Pecoraro  <pecoraro@apple.com>
    218
  • trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp

    r170330 r174866  
    11321132    stringBuilder.appendLiteral(" has MIME type ");
    11331133    stringBuilder.append(toWTFString(mimeTypeString));
     1134
     1135    String platformMimeType = platformResponseMimeType(response);
     1136    if (!platformMimeType.isEmpty() && platformMimeType != toWTFString(mimeTypeString)) {
     1137        stringBuilder.appendLiteral(" but platform response has ");
     1138        stringBuilder.append(platformMimeType);
     1139    }
     1140
    11341141    stringBuilder.append('\n');
     1142
    11351143    InjectedBundle::shared().outputText(stringBuilder.toString());
    11361144}
     
    18681876{
    18691877}
     1878
     1879String InjectedBundlePage::platformResponseMimeType(WKURLResponseRef)
     1880{
     1881    return String();
     1882}
    18701883#endif
    18711884
  • trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h

    r168961 r174866  
    170170
    171171    void platformDidStartProvisionalLoadForFrame(WKBundleFrameRef);
     172    String platformResponseMimeType(WKURLResponseRef);
    172173
    173174    void frameDidChangeLocation(WKBundleFrameRef, bool shouldDump = false);
  • trunk/Tools/WebKitTestRunner/InjectedBundle/cocoa/InjectedBundlePageCocoa.mm

    r169869 r174866  
    3131#import <WebKit/WKBundlePagePrivate.h>
    3232#import <WebKit/WKURLCF.h>
     33#import <WebKit/WKURLResponseNS.h>
    3334
    3435namespace WTR {
     
    4950}
    5051
     52String InjectedBundlePage::platformResponseMimeType(WKURLResponseRef response)
     53{
     54    RetainPtr<NSURLResponse> nsURLResponse = adoptNS(WKURLResponseCopyNSURLResponse(response));
     55    return [nsURLResponse.get() MIMEType];
     56}
     57
    5158} // namespace WTR
Note: See TracChangeset for help on using the changeset viewer.