[webkit-changes] cvs commit: WebKit/WebView.subproj WebDataSource.m WebDataSourcePrivate.h WebFrame.m WebFrameInternal.h WebFramePrivate.h WebFrameView.m WebLoader.h WebLoader.m WebMainResourceLoader.m

Justin justing at opensource.apple.com
Thu Sep 8 14:35:12 PDT 2005


justing     05/09/08 14:35:11

  Modified:    .        ChangeLog
               WebCoreSupport.subproj WebSubresourceLoader.m
               WebView.subproj WebDataSource.m WebDataSourcePrivate.h
                        WebFrame.m WebFrameInternal.h WebFramePrivate.h
                        WebFrameView.m WebLoader.h WebLoader.m
                        WebMainResourceLoader.m
  Log:
          Reviewed by darin
  
          WebKit portion of multipart/x-mixed-replace support
  
          * WebCoreSupport.subproj/WebSubresourceLoader.m:
          (+[WebSubresourceLoader startLoadingResource:withRequest:customHeaders:referrer:forDataSource:]):
          Subresource case: Check for Foundation level multipart support
          (-[WebSubresourceLoader didReceiveResponse:]):
          Send previously received data in a multipart section to the coreLoader
          (-[WebSubresourceLoader didReceiveData:lengthReceived:]):
          Don't send data to the coreLoader until it has been completely received
          * WebView.subproj/WebDataSource.m:
          (-[WebDataSource _startLoading:]):
          Main resource case: check for Foundation level multipart support
          (+[WebDataSource _repTypesAllowImageTypeOmission:]):
          Some server apps send data right after declaring content multipart/x-mixed-replace, and expect it to be treated as html
          (-[WebDataSource _commitIfReady:]):
          Don't ask the WebFrame to close its old WebDataSource when loading a multipart section, because we're going to reuse it
          (-[WebDataSource _receivedData:]):
          For non text/html multipart sections, we commit the data all at once, at the end
          (-[WebDataSource _doesProgressiveLoadWithMIMEType:]):
          Added heuristic for when to commit the load incrementally
          (-[WebDataSource _commitLoadWithData:]):
          Moved from _receivedData into its own function
          (-[WebDataSource _revertToProvisionalState]):
          (-[WebDataSource _setupForReplaceByMIMEType:]):
          Commits the data received for the previous multipart section if it wasn't loaded progresively, clears out the WebFrame and WebDatasource for the next multipart section
          * WebView.subproj/WebDataSourcePrivate.h:
          * WebView.subproj/WebFrame.m:
          (-[WebFrame _transitionToCommitted:]):
          The very first multipart section is treated as a normal load, so that the back/forward list and history are updated.
          All later sections have a new load type, WebFrameLoadTypeReplace, and are treated like reloads
          (-[WebFrame _checkLoadCompleteForThisFrame]): Ditto
          (-[WebFrame _itemForRestoringDocState]): Ditto
          (-[WebFrame _setupForReplace]):
          Clears out the WebFrame for the next multipart section
          * WebView.subproj/WebFrameInternal.h:
          * WebView.subproj/WebFramePrivate.h:
          * WebView.subproj/WebFrameView.m:
          (+[WebFrameView _viewTypesAllowImageTypeOmission:]): See above
          * WebView.subproj/WebLoader.h:
          * WebView.subproj/WebLoader.m:
          (-[NSURLProtocol clearResourceData]):
          (-[NSURLProtocol setSupportsMultipartContent:]):
          * WebView.subproj/WebMainResourceLoader.m: Straightforward
          (-[WebMainResourceLoader didReceiveResponse:]):
  
  Revision  Changes    Path
  1.3313    +49 -0     WebKit/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebKit/ChangeLog,v
  retrieving revision 1.3312
  retrieving revision 1.3313
  diff -u -r1.3312 -r1.3313
  --- ChangeLog	6 Sep 2005 23:46:33 -0000	1.3312
  +++ ChangeLog	8 Sep 2005 21:34:59 -0000	1.3313
  @@ -1,3 +1,52 @@
  +2005-09-08  Justin Garcia  <justin.garcia at apple.com>
  +
  +        Reviewed by darin
  +        
  +        WebKit portion of multipart/x-mixed-replace support
  +
  +        * WebCoreSupport.subproj/WebSubresourceLoader.m:
  +        (+[WebSubresourceLoader startLoadingResource:withRequest:customHeaders:referrer:forDataSource:]):
  +        Subresource case: Check for Foundation level multipart support
  +        (-[WebSubresourceLoader didReceiveResponse:]): 
  +        Send previously received data in a multipart section to the coreLoader
  +        (-[WebSubresourceLoader didReceiveData:lengthReceived:]): 
  +        Don't send data to the coreLoader until it has been completely received
  +        * WebView.subproj/WebDataSource.m:
  +        (-[WebDataSource _startLoading:]): 
  +        Main resource case: check for Foundation level multipart support 
  +        (+[WebDataSource _repTypesAllowImageTypeOmission:]):
  +        Some server apps send data right after declaring content multipart/x-mixed-replace, and expect it to be treated as html
  +        (-[WebDataSource _commitIfReady:]):
  +        Don't ask the WebFrame to close its old WebDataSource when loading a multipart section, because we're going to reuse it
  +        (-[WebDataSource _receivedData:]):
  +        For non text/html multipart sections, we commit the data all at once, at the end
  +        (-[WebDataSource _doesProgressiveLoadWithMIMEType:]):
  +        Added heuristic for when to commit the load incrementally
  +        (-[WebDataSource _commitLoadWithData:]):
  +        Moved from _receivedData into its own function
  +        (-[WebDataSource _revertToProvisionalState]):
  +        (-[WebDataSource _setupForReplaceByMIMEType:]):
  +        Commits the data received for the previous multipart section if it wasn't loaded progresively, clears out the WebFrame and WebDatasource for the next multipart section
  +        * WebView.subproj/WebDataSourcePrivate.h:
  +        * WebView.subproj/WebFrame.m:
  +        (-[WebFrame _transitionToCommitted:]): 
  +        The very first multipart section is treated as a normal load, so that the back/forward list and history are updated.
  +        All later sections have a new load type, WebFrameLoadTypeReplace, and are treated like reloads
  +        (-[WebFrame _checkLoadCompleteForThisFrame]): Ditto
  +        (-[WebFrame _itemForRestoringDocState]): Ditto
  +        (-[WebFrame _setupForReplace]):
  +        Clears out the WebFrame for the next multipart section
  +        * WebView.subproj/WebFrameInternal.h:
  +        * WebView.subproj/WebFramePrivate.h:
  +        * WebView.subproj/WebFrameView.m:
  +        (+[WebFrameView _viewTypesAllowImageTypeOmission:]): See above
  +        * WebView.subproj/WebLoader.h:
  +        * WebView.subproj/WebLoader.m:
  +        (-[NSURLProtocol clearResourceData]):
  +        (-[NSURLProtocol setSupportsMultipartContent:]):
  +        * WebView.subproj/WebMainResourceLoader.m: Straightforward
  +        (-[WebMainResourceLoader didReceiveResponse:]):
  +
   2005-09-06  Geoffrey Garen  <ggaren at apple.com>
   
           - fixed build bustage from last checkin.
  
  
  
  1.114     +28 -14    WebKit/WebCoreSupport.subproj/WebSubresourceLoader.m
  
  Index: WebSubresourceLoader.m
  ===================================================================
  RCS file: /cvs/root/WebKit/WebCoreSupport.subproj/WebSubresourceLoader.m,v
  retrieving revision 1.113
  retrieving revision 1.114
  diff -u -r1.113 -r1.114
  --- WebSubresourceLoader.m	30 Jul 2005 03:00:27 -0000	1.113
  +++ WebSubresourceLoader.m	8 Sep 2005 21:35:06 -0000	1.114
  @@ -40,6 +40,7 @@
   #import <Foundation/NSURLResponse.h>
   
   #import <WebCore/WebCoreResourceLoader.h>
  +#import <WebKitSystemInterface.h>
   
   @implementation WebSubresourceLoader
   
  @@ -68,6 +69,7 @@
   {
       WebSubresourceLoader *loader = [[[self alloc] initWithLoader:rLoader dataSource:source] autorelease];
       
  +    [loader setSupportsMultipartContent:WKSupportsMultipartXMixedReplace(newRequest)];
       [source _addSubresourceLoader:loader];
   
       NSEnumerator *e = [customHeaders keyEnumerator];
  @@ -148,26 +150,36 @@
   - (void)didReceiveResponse:(NSURLResponse *)r
   {
       ASSERT(r);
  -    
  -    // FIXME: Since we're not going to fix <rdar://problem/3087535> for Tiger, we should not 
  -    // load multipart/x-mixed-replace content.  Pages with such content contain what is 
  -    // essentially an infinite load and therefore a memory leak. Both this code and code in 
  -    // WebMainRecoureClient must be removed once multipart/x-mixed-replace is fully implemented. 
  +
       if ([[r MIMEType] isEqualToString:@"multipart/x-mixed-replace"]) {
  -        [dataSource _removeSubresourceLoader:self];
  -        [[[dataSource _webView] mainFrame] _checkLoadComplete];
  -        [self cancelWithError:[NSError _webKitErrorWithDomain:NSURLErrorDomain
  -                                                         code:NSURLErrorUnsupportedURL
  -                                                          URL:[r URL]]];
  -        return;
  -    }    
  -    
  +        if (!supportsMultipartContent) {
  +            [dataSource _removeSubresourceLoader:self];
  +            [[[dataSource _webView] mainFrame] _checkLoadComplete];
  +            [self cancelWithError:[NSError _webKitErrorWithDomain:NSURLErrorDomain
  +                                                             code:NSURLErrorUnsupportedURL
  +                                                              URL:[r URL]]];
  +            return;
  +        }   
  +        loadingMultipartContent = YES;
  +    }
  +
       // retain/release self in this delegate method since the additional processing can do
       // anything including possibly releasing self; one example of this is 3266216
       [self retain];
       [coreLoader receivedResponse:r];
  +    // The coreLoader can cancel a load if it receives a multipart response for a non-image
  +    if (reachedTerminalState) {
  +        [self release];
  +        return;
  +    }
       [super didReceiveResponse:r];
       [self release];
  +    
  +    if (loadingMultipartContent && [[self resourceData] length]) {
  +        // A subresource loader does not load multipart sections progressively, deliver the previously received data to the coreLoader all at once
  +        [coreLoader addData:[self resourceData]];
  +        [self clearResourceData];
  +    }
   }
   
   - (void)didReceiveData:(NSData *)data lengthReceived:(long long)lengthReceived
  @@ -175,7 +187,9 @@
       // retain/release self in this delegate method since the additional processing can do
       // anything including possibly releasing self; one example of this is 3266216
       [self retain];
  -    [coreLoader addData:data];
  +    // A subresource loader does not load multipart sections progressively, don't deliver any data to the coreLoader yet
  +    if (!loadingMultipartContent)
  +        [coreLoader addData:data];
       [super didReceiveData:data lengthReceived:lengthReceived];
       [self release];
   }
  
  
  
  1.210     +62 -17    WebKit/WebView.subproj/WebDataSource.m
  
  Index: WebDataSource.m
  ===================================================================
  RCS file: /cvs/root/WebKit/WebView.subproj/WebDataSource.m,v
  retrieving revision 1.209
  retrieving revision 1.210
  diff -u -r1.209 -r1.210
  --- WebDataSource.m	20 Aug 2005 01:13:49 -0000	1.209
  +++ WebDataSource.m	8 Sep 2005 21:35:06 -0000	1.210
  @@ -37,7 +37,7 @@
   #import <WebKit/WebDocument.h>
   #import <WebKit/WebDOMOperationsPrivate.h>
   #import <WebKit/WebFrameLoadDelegate.h>
  -#import <WebKit/WebFramePrivate.h>
  +#import <WebKit/WebFrameInternal.h>
   #import <WebKit/WebFrameView.h>
   #import <WebKit/WebHistory.h>
   #import <WebKit/WebHistoryItemPrivate.h>
  @@ -397,6 +397,7 @@
               identifier = [[WebDefaultResourceLoadDelegate sharedResourceLoadDelegate] webView:_private->webView identifierForInitialRequest:_private->originalRequest fromDataSource:self];
               
           _private->mainResourceLoader = [[WebMainResourceLoader alloc] initWithDataSource:self];
  +        [_private->mainResourceLoader setSupportsMultipartContent:WKSupportsMultipartXMixedReplace(_private->request)];
           [_private->mainResourceLoader setIdentifier: identifier];
           [[self webFrame] _addExtraFieldsToRequest:_private->request alwaysFromRequest: NO];
           if (![_private->mainResourceLoader loadWithRequest:_private->request]) {
  @@ -665,6 +666,7 @@
               [WebHTMLRepresentation class], @"application/rss+xml",
               [WebHTMLRepresentation class], @"application/atom+xml",
               [WebHTMLRepresentation class], @"application/x-webarchive",
  +            [WebHTMLRepresentation class], @"multipart/x-mixed-replace",
               [WebTextRepresentation class], @"text/",
               [WebTextRepresentation class], @"application/x-javascript",
               nil];
  @@ -720,7 +722,8 @@
           NSDictionary *headers = [_private->response isKindOfClass:[NSHTTPURLResponse class]]
               ? [(NSHTTPURLResponse *)_private->response allHeaderFields] : nil;
   
  -        [frame _closeOldDataSources];
  +        if (loadType != WebFrameLoadTypeReplace)
  +            [frame _closeOldDataSources];
   
           LOG(Loading, "committed resource = %@", [[self request] URL]);
   	_private->committed = TRUE;
  @@ -730,12 +733,7 @@
           [frame _transitionToCommitted: pageCache];
   
           NSURL *baseURL = [[self request] _webDataRequestBaseURL];        
  -        NSURL *URL = nil;
  -        
  -        if (baseURL)
  -            URL = baseURL;
  -        else
  -            URL = [_private->response URL];
  +        NSURL *URL = baseURL ? baseURL : [_private->response URL];
               
           // WebCore will crash if given an empty URL here.
           // FIXME: could use CFURL, when available, range API to save an allocation here
  @@ -775,15 +773,9 @@
   -(void)_receivedData:(NSData *)data
   {    
       _private->gotFirstByte = YES;
  -    [self _commitIfReady];
  -
  -    // parsing some of the page can result in running a script which
  -    // could possibly destroy the frame and data source. So retain
  -    // self temporarily.
  -    [self retain];
  -    [[self representation] receivedData:data withDataSource:self];
  -    [[[[self webFrame] frameView] documentView] dataSourceUpdated:self];
  -    [self release];
  +    
  +    if ([self _doesProgressiveLoadWithMIMEType:[[self response] MIMEType]])
  +        [self _commitLoadWithData:data];
   }
   
   - (void)_finishedLoading
  @@ -1022,6 +1014,59 @@
       return [WebView canShowMIMETypeAsHTML:MIMEType];
   }
   
  +- (BOOL)_doesProgressiveLoadWithMIMEType:(NSString *)MIMEType
  +{
  +    return [[self webFrame] _loadType] != WebFrameLoadTypeReplace || [MIMEType isEqualToString:@"text/html"];
  +}
  +
  +- (void)_commitLoadWithData:(NSData *)data
  +{
  +    [self _commitIfReady];
  +    // Parsing the page may result in running a script which could destroy the datasource, so retain temporarily
  +    [self retain];
  +    [[self representation] receivedData:data withDataSource:self];
  +    [[[[self webFrame] frameView] documentView] dataSourceUpdated:self];
  +    [self release];
  +}
  +
  +- (void)_revertToProvisionalState
  +{
  +    [self _setRepresentation:nil];
  +    [[self webFrame] _setupForReplace];
  +    _private->committed = NO;
  +}
  +
  +- (void)_setupForReplaceByMIMEType:(NSString *)newMIMEType
  +{
  +    if (!_private->gotFirstByte)
  +        return;
  +    
  +    WebFrame *frame = [self webFrame];
  +    NSString *oldMIMEType = [[self response] MIMEType];
  +    
  +    if (![self _doesProgressiveLoadWithMIMEType:oldMIMEType]) {
  +        [self _revertToProvisionalState];
  +        [self _commitLoadWithData:[self data]];
  +        [frame _transitionToLayoutAcceptable];
  +    }
  +    
  +    [[self representation] finishedLoadingWithDataSource:self];
  +    [[self _bridge] end];
  +
  +    [frame _setLoadType:WebFrameLoadTypeReplace];
  +    _private->gotFirstByte = NO;
  +
  +    if ([self _doesProgressiveLoadWithMIMEType:newMIMEType])
  +        [self _revertToProvisionalState];
  +
  +    [_private->subresourceLoaders makeObjectsPerformSelector:@selector(cancel)];
  +    [_private->subresourceLoaders removeAllObjects];
  +    [_private->plugInStreamLoaders makeObjectsPerformSelector:@selector(cancel)];
  +    [_private->plugInStreamLoaders removeAllObjects];
  +    [_private->subresources removeAllObjects];
  +    [_private->pendingSubframeArchives removeAllObjects];
  +}
  +
   @end
   
   @implementation WebDataSource
  
  
  
  1.146     +3 -0      WebKit/WebView.subproj/WebDataSourcePrivate.h
  
  Index: WebDataSourcePrivate.h
  ===================================================================
  RCS file: /cvs/root/WebKit/WebView.subproj/WebDataSourcePrivate.h,v
  retrieving revision 1.145
  retrieving revision 1.146
  diff -u -r1.145 -r1.146
  --- WebDataSourcePrivate.h	20 Aug 2005 01:13:49 -0000	1.145
  +++ WebDataSourcePrivate.h	8 Sep 2005 21:35:06 -0000	1.146
  @@ -217,4 +217,7 @@
   - (BOOL)_isDocumentHTML;
   - (NSString *)_title;
   
  +- (void)_setupForReplaceByMIMEType:(NSString *)mimeType;
  +- (BOOL)_doesProgressiveLoadWithMIMEType:(NSString *)MIMEType;
  +- (void)_commitLoadWithData:(NSData *)data;
   @end
  
  
  
  1.252     +14 -0     WebKit/WebView.subproj/WebFrame.m
  
  Index: WebFrame.m
  ===================================================================
  RCS file: /cvs/root/WebKit/WebView.subproj/WebFrame.m,v
  retrieving revision 1.251
  retrieving revision 1.252
  diff -u -r1.251 -r1.252
  --- WebFrame.m	20 Aug 2005 01:13:49 -0000	1.251
  +++ WebFrame.m	8 Sep 2005 21:35:07 -0000	1.252
  @@ -799,6 +799,7 @@
   
               case WebFrameLoadTypeReload:
               case WebFrameLoadTypeSame:
  +            case WebFrameLoadTypeReplace:
               {
                   WebHistoryItem *currItem = [_private currentItem];
                   LOG(PageCache, "Clearing back/forward cache, %@\n", [currItem URL]);
  @@ -1191,6 +1192,7 @@
                       case WebFrameLoadTypeInternal:
                       case WebFrameLoadTypeReloadAllowingStaleData:
                       case WebFrameLoadTypeSame:
  +                    case WebFrameLoadTypeReplace:
                           // Do nothing.
                           break;
   
  @@ -2305,6 +2307,7 @@
           case WebFrameLoadTypeReload:
           case WebFrameLoadTypeReloadAllowingStaleData:
           case WebFrameLoadTypeSame:
  +        case WebFrameLoadTypeReplace:
               // Don't restore any form state on reload or loadSame
               return nil;
           case WebFrameLoadTypeBack:
  @@ -2749,6 +2752,17 @@
       }
   }
   
  +- (void)_setupForReplace
  +{
  +    [self _setState:WebFrameStateProvisional];
  +    WebDataSource *old = _private->provisionalDataSource;
  +    _private->provisionalDataSource = _private->dataSource;
  +    _private->dataSource = nil;
  +    [old release];
  +        
  +    [self _detachChildren];
  +}
  +
   @end
   
   @implementation WebFormState : NSObject
  
  
  
  1.14      +1 -0      WebKit/WebView.subproj/WebFrameInternal.h
  
  Index: WebFrameInternal.h
  ===================================================================
  RCS file: /cvs/root/WebKit/WebView.subproj/WebFrameInternal.h,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- WebFrameInternal.h	27 Jul 2005 21:36:44 -0000	1.13
  +++ WebFrameInternal.h	8 Sep 2005 21:35:07 -0000	1.14
  @@ -48,6 +48,7 @@
                                                           response:(NSURLResponse *)response 
                                                               data:(NSData *)data
                                                              error:(NSError *)error;
  +- (void)_setupForReplace;
   @end
   
   @interface NSObject (WebInternalFrameLoadDelegate)
  
  
  
  1.161     +3 -1      WebKit/WebView.subproj/WebFramePrivate.h
  
  Index: WebFramePrivate.h
  ===================================================================
  RCS file: /cvs/root/WebKit/WebView.subproj/WebFramePrivate.h,v
  retrieving revision 1.160
  retrieving revision 1.161
  diff -u -r1.160 -r1.161
  --- WebFramePrivate.h	20 Aug 2005 01:13:49 -0000	1.160
  +++ WebFramePrivate.h	8 Sep 2005 21:35:07 -0000	1.161
  @@ -69,7 +69,8 @@
       WebFrameLoadTypeReload,
       WebFrameLoadTypeReloadAllowingStaleData,
       WebFrameLoadTypeSame,		// user loads same URL again (but not reload button)
  -    WebFrameLoadTypeInternal
  +    WebFrameLoadTypeInternal,
  +    WebFrameLoadTypeReplace
   } WebFrameLoadType;
   
   // Keys for accessing the values in the page cache dictionary.
  @@ -150,6 +151,7 @@
   - (void)_setName:(NSString *)name;
   - (WebFrame *)_descendantFrameNamed:(NSString *)name sourceFrame:(WebFrame *)source;
   - (void)_detachFromParent;
  +- (void)_detachChildren;
   - (void)_closeOldDataSources;
   - (void)_setDataSource:(WebDataSource *)d;
   - (void)_transitionToCommitted:(NSDictionary *)pageCache;
  
  
  
  1.187     +1 -0      WebKit/WebView.subproj/WebFrameView.m
  
  Index: WebFrameView.m
  ===================================================================
  RCS file: /cvs/root/WebKit/WebView.subproj/WebFrameView.m,v
  retrieving revision 1.186
  retrieving revision 1.187
  diff -u -r1.186 -r1.187
  --- WebFrameView.m	16 Aug 2005 19:03:34 -0000	1.186
  +++ WebFrameView.m	8 Sep 2005 21:35:08 -0000	1.187
  @@ -254,6 +254,7 @@
               [WebHTMLView class], @"application/rss+xml",
               [WebHTMLView class], @"application/atom+xml",
               [WebHTMLView class], @"application/x-webarchive",
  +            [WebHTMLView class], @"multipart/x-mixed-replace",
               [WebTextView class], @"text/",
               [WebTextView class], @"application/x-javascript",
               nil];
  
  
  
  1.44      +4 -0      WebKit/WebView.subproj/WebLoader.h
  
  Index: WebLoader.h
  ===================================================================
  RCS file: /cvs/root/WebKit/WebView.subproj/WebLoader.h,v
  retrieving revision 1.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- WebLoader.h	1 Jul 2005 05:20:48 -0000	1.43
  +++ WebLoader.h	8 Sep 2005 21:35:08 -0000	1.44
  @@ -48,6 +48,8 @@
       NSURLConnection *connection;
       NSURLRequest *request;
       BOOL reachedTerminalState;
  +    BOOL loadingMultipartContent;
  +    BOOL supportsMultipartContent;
   @private
       WebView *webView;
       NSURLResponse *response;
  @@ -68,6 +70,7 @@
       BOOL isInitializingConnection;
   #endif
   }
  +- (void)setSupportsMultipartContent:(BOOL)flag;
   
   - (BOOL)loadWithRequest:(NSURLRequest *)request;
   
  @@ -92,6 +95,7 @@
   
   - (void)addData:(NSData *)data;
   - (NSData *)resourceData;
  +- (void)clearResourceData;
   
   // Connection-less callbacks allow us to send callbacks using data attained from a WebResource instead of an NSURLConnection.
   - (NSURLRequest *)willSendRequest:(NSURLRequest *)newRequest redirectResponse:(NSURLResponse *)redirectResponse;
  
  
  
  1.96      +10 -0     WebKit/WebView.subproj/WebLoader.m
  
  Index: WebLoader.m
  ===================================================================
  RCS file: /cvs/root/WebKit/WebView.subproj/WebLoader.m,v
  retrieving revision 1.95
  retrieving revision 1.96
  diff -u -r1.95 -r1.96
  --- WebLoader.m	1 Jul 2005 05:20:48 -0000	1.95
  +++ WebLoader.m	8 Sep 2005 21:35:08 -0000	1.96
  @@ -377,6 +377,11 @@
       return nil;
   }
   
  +- (void)clearResourceData
  +{
  +    [resourceData setLength:0];
  +}
  +
   - (NSURLRequest *)willSendRequest:(NSURLRequest *)newRequest redirectResponse:(NSURLResponse *)redirectResponse
   {
       ASSERT(!reachedTerminalState);
  @@ -732,4 +737,9 @@
       return inNSURLConnectionCallback != 0;
   }
   
  +- (void)setSupportsMultipartContent:(BOOL)flag
  +{
  +    supportsMultipartContent = flag;
  +}
  +
   @end
  
  
  
  1.273     +14 -10    WebKit/WebView.subproj/WebMainResourceLoader.m
  
  Index: WebMainResourceLoader.m
  ===================================================================
  RCS file: /cvs/root/WebKit/WebView.subproj/WebMainResourceLoader.m,v
  retrieving revision 1.272
  retrieving revision 1.273
  diff -u -r1.272 -r1.273
  --- WebMainResourceLoader.m	18 Aug 2005 00:25:04 -0000	1.272
  +++ WebMainResourceLoader.m	8 Sep 2005 21:35:08 -0000	1.273
  @@ -320,17 +320,21 @@
   
       LOG(Loading, "main content type: %@", [r MIMEType]);
       
  -    // FIXME: Since we're not going to fix <rdar://problem/3087535> for Tiger, we should not 
  -    // load multipart/x-mixed-replace content.  Pages with such content contain what is 
  -    // essentially an infinite load and therefore a memory leak. Both this code and code in
  -    // SubresourceLoader must be removed once multipart/x-mixed-replace is fully implemented. 
  +    if (loadingMultipartContent) {
  +        [[self dataSource] _setupForReplaceByMIMEType:[r MIMEType]];
  +        [self clearResourceData];
  +    }
  +    
       if ([[r MIMEType] isEqualToString:@"multipart/x-mixed-replace"]) {
  -        [dataSource _removeSubresourceLoader:self];
  -        [[[dataSource _webView] mainFrame] _checkLoadComplete];
  -        [self cancelWithError:[NSError _webKitErrorWithDomain:NSURLErrorDomain
  -                                                         code:NSURLErrorUnsupportedURL
  -                                                          URL:[r URL]]];
  -        return;
  +        if (!supportsMultipartContent) {
  +            [dataSource _removeSubresourceLoader:self];
  +            [[[dataSource _webView] mainFrame] _checkLoadComplete];
  +            [self cancelWithError:[NSError _webKitErrorWithDomain:NSURLErrorDomain
  +                                                             code:NSURLErrorUnsupportedURL
  +                                                              URL:[r URL]]];
  +            return;
  +        }
  +        loadingMultipartContent = YES;
       }
           
       // FIXME: This is a workaround to make web archive files work with Foundations that
  
  
  



More information about the webkit-changes mailing list