Changeset 26758 in webkit


Ignore:
Timestamp:
Oct 18, 2007 5:33:19 PM (17 years ago)
Author:
mitz
Message:

WebCore:

Reviewed by Adam Roben.

  • fix <rdar://problem/5313523> REGRESSION(Leopard): http/tests/incremental/slow-utf8-text.pl fails on Leopard
  • platform/network/mac/ResourceResponseMac.mm: (WebCore::ResourceResponse::doUpdateResourceResponse): Work around <rdar://problem/5321972> by testing for the case of a response with a MIME type of application/octet-stream and a Content-Type header starting with text/plain and setting the MIME type to text/plain in that case.

WebKit:

Reviewed by Adam Roben.

  • fix <rdar://problem/5313523> REGRESSION(Leopard): http/tests/incremental/slow-utf8-text.pl fails on Leopard
  • WebCoreSupport/WebFrameLoaderClient.mm: (WebFrameLoaderClient::makeDocumentView): Changed to use _responseMIMEType.
  • WebView/WebDataSource.mm: (-[WebDataSource _MIMETypeOfResponse:]): Added. Works around <rdar://problem/5321972> by testing for the case of an NSHTTPURLResponse with a MIMEType of application/octet-stream and a Content-Type header starting with text/plain and returning text/plain as the MIME type in that case. (-[WebDataSource _responseMIMEType]): Added. Used to get the correct response MIME type. (-[WebDataSource _isDocumentHTML]): Changed to use _responseMIMEType. (-[WebDataSource _makeRepresentation]): Ditto. (-[WebDataSource mainResource]): Ditto. (-[WebDataSource subresources]): Changed to use _MIMETypeOfResponse and pass the MIME type explicitly. (-[WebDataSource subresourceForURL:]): Ditto.
  • WebView/WebDataSourcePrivate.h:
  • WebView/WebFrameView.mm: (-[WebFrameView _makeDocumentViewForDataSource:]): Changed to use _responseMIMEType.
  • WebView/WebResource.mm: (-[WebResource _initWithData:URL:response:MIMEType:]): Changed this method to take a MIME type instead of extracting it from the response, so that WebDataSource could pass the correct MIME type.
  • WebView/WebResourcePrivate.h:

WebKitTools:

Reviewed by Adam Roben.

  • fix <rdar://problem/5313523> REGRESSION(Leopard): http/tests/incremental/slow-utf8-text.pl fails on Leopard
  • DumpRenderTree/mac/DumpRenderTree.mm: (dump): Changed to use _responseMIMEType.

LayoutTests:

Reviewed by Adam Roben.

  • removing fixed test
  • platform/mac-leopard/Skipped:
Location:
trunk
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r26750 r26758  
     12007-10-18  Dan Bernstein  <dan.bernstein@apple.com>
     2
     3        Reviewed by Adam Roben.
     4
     5        - removing fixed test
     6
     7        * platform/mac-leopard/Skipped:
     8
    192007-10-18  Darin Adler  <darin@apple.com>
    210
  • trunk/LayoutTests/platform/mac-leopard/Skipped

    r26556 r26758  
    11# <rdar://problem/5313520> editing/pasteboard/4076267-2.html fails on Leopard
    22editing/pasteboard/4076267-2.html
    3 
    4 # <rdar://problem/5313523> http/tests/incremental/slow-utf8-text.pl fails on Leopard
    5 http/tests/incremental/slow-utf8-text.pl
    63
    74# <rdar://problem/5228256> Leopard regression test failures: security/block-test
  • trunk/WebCore/ChangeLog

    r26757 r26758  
     12007-10-18  Dan Bernstein  <dan.bernstein@apple.com>
     2
     3        Reviewed by Adam Roben.
     4
     5        - fix <rdar://problem/5313523>
     6        REGRESSION(Leopard): http/tests/incremental/slow-utf8-text.pl fails on Leopard
     7
     8        * platform/network/mac/ResourceResponseMac.mm:
     9        (WebCore::ResourceResponse::doUpdateResourceResponse): Work around
     10        <rdar://problem/5321972> by testing for the case of a response
     11        with a MIME type of application/octet-stream and a Content-Type header
     12        starting with text/plain and setting the MIME type to text/plain in
     13        that case.
     14
    1152007-10-18  Mark Rowe  <mrowe@apple.com>
    216
  • trunk/WebCore/platform/network/mac/ResourceResponseMac.mm

    r23964 r26758  
    8888        while (NSString *name = [e nextObject])
    8989            m_httpHeaderFields.set(name, [headers objectForKey:name]);
     90#ifndef BUILDING_ON_TIGER
     91        // FIXME: This is part of a workaround for <rdar://problem/5321972> REGRESSION: Plain text document from HTTP server detected
     92        // as application/octet-stream
     93        if (m_mimeType == "application/octet-stream") {
     94            static const String textPlainMIMEType("text/plain");
     95            if (m_httpHeaderFields.get("Content-Type").startsWith(textPlainMIMEType))
     96                m_mimeType = textPlainMIMEType;
     97        }
     98#endif
    9099    } else {
    91100        m_httpStatusCode = 0;
  • trunk/WebKit/ChangeLog

    r26709 r26758  
     12007-10-18  Dan Bernstein  <dan.bernstein@apple.com>
     2
     3        Reviewed by Adam Roben.
     4
     5        - fix <rdar://problem/5313523>
     6        REGRESSION(Leopard): http/tests/incremental/slow-utf8-text.pl fails on Leopard
     7
     8        * WebCoreSupport/WebFrameLoaderClient.mm:
     9        (WebFrameLoaderClient::makeDocumentView): Changed to use _responseMIMEType.
     10        * WebView/WebDataSource.mm:
     11        (-[WebDataSource _MIMETypeOfResponse:]): Added. Works around
     12        <rdar://problem/5321972> by testing for the case of an NSHTTPURLResponse
     13        with a MIMEType of application/octet-stream and a Content-Type header
     14        starting with text/plain and returning text/plain as the MIME type in
     15        that case.
     16        (-[WebDataSource _responseMIMEType]): Added. Used to get the correct
     17        response MIME type.
     18        (-[WebDataSource _isDocumentHTML]): Changed to use _responseMIMEType.
     19        (-[WebDataSource _makeRepresentation]): Ditto.
     20        (-[WebDataSource mainResource]): Ditto.
     21        (-[WebDataSource subresources]): Changed to use _MIMETypeOfResponse and
     22        pass the MIME type explicitly.
     23        (-[WebDataSource subresourceForURL:]): Ditto.
     24        * WebView/WebDataSourcePrivate.h:
     25        * WebView/WebFrameView.mm:
     26        (-[WebFrameView _makeDocumentViewForDataSource:]): Changed to use
     27        _responseMIMEType.
     28        * WebView/WebResource.mm:
     29        (-[WebResource _initWithData:URL:response:MIMEType:]): Changed this
     30        method to take a MIME type instead of extracting it from the response,
     31        so that WebDataSource could pass the correct MIME type.
     32        * WebView/WebResourcePrivate.h:
     33
    1342007-10-17  Darin Adler  <darin@apple.com>
    235
  • trunk/WebKit/WebCoreSupport/WebFrameLoaderClient.mm

    r26694 r26758  
    157157    WebDataSource *ds = [m_webFrame.get() _dataSource];
    158158
    159     bool willProduceHTMLView = [[WebFrameView class] _viewClassForMIMEType:[[ds response] MIMEType]] == [WebHTMLView class];
     159    bool willProduceHTMLView = [[WebFrameView class] _viewClassForMIMEType:[ds _responseMIMEType]] == [WebHTMLView class];
    160160    bool canSkipCreation = [m_webFrame.get() _frameLoader]->committingFirstRealLoad() && willProduceHTMLView;
    161161    if (canSkipCreation) {
  • trunk/WebKit/WebView/WebDataSource.mm

    r24417 r26758  
    137137}
    138138
     139#ifndef BUILDING_ON_TIGER
     140- (NSString *)_MIMETypeOfResponse:(NSURLResponse *)response
     141{
     142    // FIXME: This is part of a workaround for <rdar://problem/5321972> REGRESSION: Plain text document from HTTP server detected
     143    // as application/octet-stream
     144    NSString *MIMEType = [response MIMEType];
     145    if ([MIMEType isEqualToString:@"application/octet-stream"] && [response isKindOfClass:[NSHTTPURLResponse class]] && [[[(NSHTTPURLResponse *)response allHeaderFields] objectForKey:@"Content-Type"] hasPrefix:@"text/plain"])
     146        return @"text/plain";
     147    return MIMEType;
     148}
     149#endif
    139150@end
    140151
     
    173184   
    174185    return nil;
     186}
     187
     188- (NSString *)_responseMIMEType
     189{
     190#ifdef BUILDING_ON_TIGER
     191    return [[self response] MIMEType];
     192#else
     193    return [self _MIMETypeOfResponse:[self response]];
     194#endif
    175195}
    176196
     
    320340- (BOOL)_isDocumentHTML
    321341{
    322     NSString *MIMEType = [[self response] MIMEType];
     342    NSString *MIMEType = [self _responseMIMEType];
    323343    return [WebView canShowMIMETypeAsHTML:MIMEType];
    324344}
     
    326346-(void)_makeRepresentation
    327347{
    328     Class repClass = [[self class] _representationClassForMIMEType:[[self response] MIMEType]];
     348    Class repClass = [[self class] _representationClassForMIMEType:[self _responseMIMEType]];
    329349   
    330350    // Check if the data source was already bound?
     
    472492    return [[[WebResource alloc] initWithData:[self data]
    473493                                          URL:[response URL]
    474                                      MIMEType:[response MIMEType]
     494                                     MIMEType:[self _responseMIMEType]
    475495                             textEncodingName:[response textEncodingName]
    476496                                    frameName:[[self webFrame] name]] autorelease];
     
    490510    for (unsigned i = 0; i < [datas count]; ++i) {
    491511        NSURLResponse *response = [responses objectAtIndex:i];
    492         [subresources addObject:[[[WebResource alloc] _initWithData:[datas objectAtIndex:i] URL:[response URL] response:response] autorelease]];
     512        [subresources addObject:[[[WebResource alloc] _initWithData:[datas objectAtIndex:i] URL:[response URL] response:response MIMEType:[self _MIMETypeOfResponse:response]] autorelease]];
    493513    }
    494514
     
    506526        return [self _archivedSubresourceForURL:URL];
    507527
    508     return [[[WebResource alloc] _initWithData:data URL:URL response:response] autorelease];
     528    return [[[WebResource alloc] _initWithData:data URL:URL response:response MIMEType:[self _MIMETypeOfResponse:response]] autorelease];
    509529}
    510530
  • trunk/WebKit/WebView/WebDataSourcePrivate.h

    r14999 r26758  
    3636
    3737- (NSError *)_mainDocumentError;
     38
     39- (NSString *)_responseMIMEType;
    3840@end
  • trunk/WebKit/WebView/WebFrameView.mm

    r25467 r26758  
    3030
    3131#import "WebClipView.h"
    32 #import "WebDataSource.h"
     32#import "WebDataSourcePrivate.h"
    3333#import "WebDocument.h"
    3434#import "WebDynamicScrollBarsView.h"
     
    188188-(NSView <WebDocumentView> *)_makeDocumentViewForDataSource:(WebDataSource *)dataSource
    189189{
    190     NSString* MIMEType = [[dataSource response] MIMEType];
     190    NSString* MIMEType = [dataSource _responseMIMEType];
    191191    if (!MIMEType)
    192192        MIMEType = @"text/html";
  • trunk/WebKit/WebView/WebResource.mm

    r25571 r26758  
    249249}
    250250
    251 - (id)_initWithData:(NSData *)data URL:(NSURL *)URL response:(NSURLResponse *)response
     251- (id)_initWithData:(NSData *)data URL:(NSURL *)URL response:(NSURLResponse *)response MIMEType:(NSString *)MIMEType
    252252{
    253253    // Pass NO for copyData since the data doesn't need to be copied since we know that callers will no longer modify it.
     
    255255    return [self _initWithData:data
    256256                           URL:URL
    257                       MIMEType:[response MIMEType]
     257                      MIMEType:MIMEType
    258258              textEncodingName:[response textEncodingName]
    259259                     frameName:nil
  • trunk/WebKit/WebView/WebResourcePrivate.h

    r20217 r26758  
    3939           copyData:(BOOL)copyData;
    4040
    41 - (id)_initWithData:(NSData *)data URL:(NSURL *)URL response:(NSURLResponse *)response;
     41- (id)_initWithData:(NSData *)data URL:(NSURL *)URL response:(NSURLResponse *)response MIMEType:(NSString *)MIMEType;
    4242
    4343- (BOOL)_shouldIgnoreWhenUnarchiving;
  • trunk/WebKitTools/ChangeLog

    r26734 r26758  
     12007-10-18  Dan Bernstein  <dan.bernstein@apple.com>
     2
     3        Reviewed by Adam Roben.
     4
     5        - fix <rdar://problem/5313523>
     6        REGRESSION(Leopard): http/tests/incremental/slow-utf8-text.pl fails on Leopard
     7
     8        * DumpRenderTree/mac/DumpRenderTree.mm:
     9        (dump): Changed to use _responseMIMEType.
     10
    1112007-10-17  Adam Roben  <aroben@apple.com>
    212
  • trunk/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm

    r25578 r26758  
    5252#import <WebKit/WebBackForwardList.h>
    5353#import <WebKit/WebCoreStatistics.h>
    54 #import <WebKit/WebDataSource.h>
     54#import <WebKit/WebDataSourcePrivate.h>
    5555#import <WebKit/WebDocumentPrivate.h>
    5656#import <WebKit/WebEditingDelegate.h>
     
    841841       
    842842        bool dumpAsText = layoutTestController->dumpAsText();
    843         dumpAsText |= [[[[mainFrame dataSource] response] MIMEType] isEqualToString:@"text/plain"];
     843        dumpAsText |= [[[mainFrame dataSource] _responseMIMEType] isEqualToString:@"text/plain"];
    844844        layoutTestController->setDumpAsText(dumpAsText);
    845845        if (layoutTestController->dumpAsText()) {
Note: See TracChangeset for help on using the changeset viewer.