[webkit-changes] cvs commit: WebCore/kwq KWQKJobClasses.h KWQKJobClasses.mm KWQLoader.h KWQLoader.mm KWQResourceLoader.h KWQResourceLoader.mm

Adele adele at opensource.apple.com
Fri Sep 9 10:17:12 PDT 2005


adele       05/09/09 10:17:11

  Modified:    .        Tag: Safari-2-0-branch ChangeLog
               WebCoreSupport.subproj Tag: Safari-2-0-branch
                        WebSubresourceClient.m
               WebView.subproj Tag: Safari-2-0-branch
                        WebBaseResourceHandleDelegate.h
                        WebBaseResourceHandleDelegate.m WebDataSource.m
                        WebDataSourcePrivate.h WebFrame.m
                        WebFrameInternal.h WebFramePrivate.h WebFrameView.m
                        WebMainResourceClient.m
               .        Tag: Safari-2-0-branch ChangeLog
               khtml/misc Tag: Safari-2-0-branch loader.cpp loader.h
               kwq      Tag: Safari-2-0-branch KWQKJobClasses.h
                        KWQKJobClasses.mm KWQLoader.h KWQLoader.mm
                        KWQResourceLoader.h KWQResourceLoader.mm
  Log:
  WebCore:
  
          Merged fix from TOT to Safari-2-0-branch
  
      2005-09-08  Justin Garcia  <justin.garcia at apple.com>
  
          Reviewed by darin
  
          WebCore portion of multipart/x-mixed-replace support
  
          * khtml/misc/loader.cpp:
          (Request::Request):
          (Loader::slotReceivedResponse):
          Only allow a multipart load for images, clear out the old multipart section to prepare for a replace
          (Loader::slotData):
          Multipart sections are delivered to the coreLoader by WebKit all at once, send eof to CachedImage::data
          * khtml/misc/loader.h:
          (khtml::CachedObject::isImage): Added
          (khtml::CachedImage::isImage):
          * kwq/KWQKJobClasses.h:
          * kwq/KWQKJobClasses.mm:
          (KIO::TransferJob::cancel):
          Added a way to cancel a subresource loader from WebCore
          * kwq/KWQLoader.h:
          * kwq/KWQLoader.mm:
          (KWQResponseIsMultipart):
          * kwq/KWQResourceLoader.h:
          * kwq/KWQResourceLoader.mm:
          (-[KWQResourceLoader jobCanceledLoad]):
  
  WebKit:
  
          Merged fix from TOT to Safari-2-0-branch
  
      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:]):
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.3118.4.66 +53 -0     WebKit/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebKit/ChangeLog,v
  retrieving revision 1.3118.4.65
  retrieving revision 1.3118.4.66
  diff -u -r1.3118.4.65 -r1.3118.4.66
  --- ChangeLog	2 Sep 2005 22:54:55 -0000	1.3118.4.65
  +++ ChangeLog	9 Sep 2005 17:16:51 -0000	1.3118.4.66
  @@ -1,3 +1,56 @@
  +2005-09-08  Adele Peterson  <adele at apple.com>
  +
  +        Merged fix from TOT to Safari-2-0-branch
  + 
  +    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:]):
  +
   === Safari-416.6 ===
   
   === Safari-416.5 ===
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.108.8.2 +39 -15    WebKit/WebCoreSupport.subproj/Attic/WebSubresourceClient.m
  
  Index: WebSubresourceClient.m
  ===================================================================
  RCS file: /cvs/root/WebKit/WebCoreSupport.subproj/Attic/WebSubresourceClient.m,v
  retrieving revision 1.108.8.1
  retrieving revision 1.108.8.2
  diff -u -r1.108.8.1 -r1.108.8.2
  --- WebSubresourceClient.m	11 Aug 2005 01:39:49 -0000	1.108.8.1
  +++ WebSubresourceClient.m	9 Sep 2005 17:17:00 -0000	1.108.8.2
  @@ -19,6 +19,13 @@
   
   #import <WebCore/WebCoreResourceLoader.h>
   
  +// We could include NSURLRequestPrivate.h if we knew it was a version new enough
  +// to have this (AppleInternal from 10.4.3 or newer), but for now we'd like to
  +// be able to compile even if we only have older headers, so declare this here.
  + at interface NSMutableURLRequest (WebKitSystemInterfaceSecrets) 
  +- (void)setHTTPShouldHandleMixedReplace:(BOOL)yorn;
  + at end
  +
   @implementation WebSubresourceClient
   
   - initWithLoader:(id <WebCoreResourceLoader>)l dataSource:(WebDataSource *)s
  @@ -46,9 +53,14 @@
   {
       WebSubresourceClient *client = [[[self alloc] initWithLoader:rLoader dataSource:source] autorelease];
       
  +    if ([newRequest respondsToSelector:@selector(setHTTPShouldHandleMixedReplace:)]) {
  +        [newRequest setHTTPShouldHandleMixedReplace:YES];
  +        [client setSupportsMultipartContent:YES]; 
  +    } else
  +        [client setSupportsMultipartContent:NO];
  +        
       [source _addSubresourceClient:client];
   
  -
       NSEnumerator *e = [customHeaders keyEnumerator];
       NSString *key;
       while ((key = (NSString *)[e nextObject]) != nil) {
  @@ -127,26 +139,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 _removeSubresourceClient:self];
  -        [[[dataSource _webView] mainFrame] _checkLoadComplete];
  -        [self cancelWithError:[NSError _webKitErrorWithDomain:NSURLErrorDomain
  -                                                         code:NSURLErrorUnsupportedURL
  -                                                          URL:[r URL]]];
  -        return;
  -    }    
  -    
  +        if (!supportsMultipartContent) {
  +            [dataSource _removeSubresourceClient: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];
       [loader 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
  +        [loader addData:[self resourceData]];
  +        [self clearResourceData];
  +    }
   }
   
   - (void)didReceiveData:(NSData *)data lengthReceived:(long long)lengthReceived
  @@ -154,7 +176,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];
  -    [loader addData:data];
  +    // A subresource loader does not load multipart sections progressively, don't deliver any data to the coreLoader yet
  +    if (!loadingMultipartContent)
  +        [loader addData:data];
       [super didReceiveData:data lengthReceived:lengthReceived];
       [self release];
   }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.38.10.4 +4 -0      WebKit/WebView.subproj/Attic/WebBaseResourceHandleDelegate.h
  
  Index: WebBaseResourceHandleDelegate.h
  ===================================================================
  RCS file: /cvs/root/WebKit/WebView.subproj/Attic/WebBaseResourceHandleDelegate.h,v
  retrieving revision 1.38.10.3
  retrieving revision 1.38.10.4
  diff -u -r1.38.10.3 -r1.38.10.4
  --- WebBaseResourceHandleDelegate.h	28 Aug 2005 16:09:54 -0000	1.38.10.3
  +++ WebBaseResourceHandleDelegate.h	9 Sep 2005 17:17:01 -0000	1.38.10.4
  @@ -25,6 +25,8 @@
       NSURLConnection *connection;
       NSURLRequest *request;
       BOOL reachedTerminalState;
  +    BOOL loadingMultipartContent;
  +    BOOL supportsMultipartContent;
   @private
       WebView *webView;
       NSURLResponse *response;
  @@ -45,6 +47,7 @@
       BOOL isInitializingConnection;
   #endif
   }
  +- (void)setSupportsMultipartContent:(BOOL)flag;
   
   - (BOOL)loadWithRequest:(NSURLRequest *)request;
   
  @@ -69,6 +72,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.83.4.4  +9 -0      WebKit/WebView.subproj/Attic/WebBaseResourceHandleDelegate.m
  
  Index: WebBaseResourceHandleDelegate.m
  ===================================================================
  RCS file: /cvs/root/WebKit/WebView.subproj/Attic/WebBaseResourceHandleDelegate.m,v
  retrieving revision 1.83.4.3
  retrieving revision 1.83.4.4
  diff -u -r1.83.4.3 -r1.83.4.4
  --- WebBaseResourceHandleDelegate.m	28 Aug 2005 16:09:54 -0000	1.83.4.3
  +++ WebBaseResourceHandleDelegate.m	9 Sep 2005 17:17:01 -0000	1.83.4.4
  @@ -354,6 +354,11 @@
       return nil;
   }
   
  +- (void)clearResourceData
  +{
  +    [resourceData setLength:0];
  +}
  +
   - (NSURLRequest *)willSendRequest:(NSURLRequest *)newRequest redirectResponse:(NSURLResponse *)redirectResponse
   {
       ASSERT(!reachedTerminalState);
  @@ -710,4 +715,8 @@
       return inNSURLConnectionCallback != 0;
   }
   
  +- (void)setSupportsMultipartContent:(BOOL)flag
  +{
  +    supportsMultipartContent = flag;
  +}
   @end
  
  
  
  1.198.8.3 +74 -17    WebKit/WebView.subproj/WebDataSource.m
  
  Index: WebDataSource.m
  ===================================================================
  RCS file: /cvs/root/WebKit/WebView.subproj/WebDataSource.m,v
  retrieving revision 1.198.8.2
  retrieving revision 1.198.8.3
  diff -u -r1.198.8.2 -r1.198.8.3
  --- WebDataSource.m	9 Aug 2005 23:53:22 -0000	1.198.8.2
  +++ WebDataSource.m	9 Sep 2005 17:17:01 -0000	1.198.8.3
  @@ -15,7 +15,7 @@
   #import <WebKit/WebDOMOperationsPrivate.h>
   #import <WebKit/WebException.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>
  @@ -46,6 +46,13 @@
   #import <Foundation/NSURLRequest.h>
   #import <Foundation/NSURLResponsePrivate.h>
   
  +// We could include NSURLRequestPrivate.h if we knew it was a version new enough
  +// to have this (AppleInternal from 10.4.3 or newer), but for now we'd like to
  +// be able to compile even if we only have older headers, so declare this here.
  + at interface NSMutableURLRequest (WebKitSystemInterfaceSecrets) 
  +- (void)setHTTPShouldHandleMixedReplace:(BOOL)yorn;
  + at end
  +
   @implementation WebDataSourcePrivate 
   
   - (void)dealloc
  @@ -379,6 +386,12 @@
               identifier = [[WebDefaultResourceLoadDelegate sharedResourceLoadDelegate] webView:_private->webView identifierForInitialRequest:_private->originalRequest fromDataSource:self];
               
           _private->mainClient = [[WebMainResourceClient alloc] initWithDataSource:self];
  +        if ([_private->request respondsToSelector:@selector(setHTTPShouldHandleMixedReplace:)]) {
  +            [_private->request setHTTPShouldHandleMixedReplace:YES];
  +            [_private->mainClient setSupportsMultipartContent:YES]; 
  +        } else
  +            [_private->mainClient setSupportsMultipartContent:NO];
  +            
           [_private->mainClient setIdentifier: identifier];
           [[self webFrame] _addExtraFieldsToRequest:_private->request alwaysFromRequest: NO];
           if (![_private->mainClient loadWithRequest:_private->request]) {
  @@ -676,6 +689,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];
  @@ -733,7 +747,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;
  @@ -743,12 +758,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
  @@ -788,15 +798,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
  @@ -1045,6 +1049,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->subresourceClients makeObjectsPerformSelector:@selector(cancel)];
  +    [_private->subresourceClients removeAllObjects];
  +    [_private->plugInStreamClients makeObjectsPerformSelector:@selector(cancel)];
  +    [_private->plugInStreamClients removeAllObjects];
  +    [_private->subresources removeAllObjects];
  +    [_private->pendingSubframeArchives removeAllObjects];
  +}
  +
   @end
   
   @implementation WebDataSource
  
  
  
  1.141.8.1 +3 -0      WebKit/WebView.subproj/WebDataSourcePrivate.h
  
  Index: WebDataSourcePrivate.h
  ===================================================================
  RCS file: /cvs/root/WebKit/WebView.subproj/WebDataSourcePrivate.h,v
  retrieving revision 1.141
  retrieving revision 1.141.8.1
  diff -u -r1.141 -r1.141.8.1
  --- WebDataSourcePrivate.h	18 Mar 2005 22:56:39 -0000	1.141
  +++ WebDataSourcePrivate.h	9 Sep 2005 17:17:01 -0000	1.141.8.1
  @@ -207,4 +207,7 @@
   - (BOOL)_isDocumentHTML;
   - (NSString *)_title;
   
  +- (void)_setupForReplaceByMIMEType:(NSString *)mimeType;
  +- (BOOL)_doesProgressiveLoadWithMIMEType:(NSString *)MIMEType;
  +- (void)_commitLoadWithData:(NSData *)data;
   @end
  
  
  
  1.223.8.10 +14 -0     WebKit/WebView.subproj/WebFrame.m
  
  Index: WebFrame.m
  ===================================================================
  RCS file: /cvs/root/WebKit/WebView.subproj/WebFrame.m,v
  retrieving revision 1.223.8.9
  retrieving revision 1.223.8.10
  diff -u -r1.223.8.9 -r1.223.8.10
  --- WebFrame.m	24 Aug 2005 00:45:16 -0000	1.223.8.9
  +++ WebFrame.m	9 Sep 2005 17:17:02 -0000	1.223.8.10
  @@ -785,6 +785,7 @@
   
               case WebFrameLoadTypeReload:
               case WebFrameLoadTypeSame:
  +            case WebFrameLoadTypeReplace:
               {
                   WebHistoryItem *currItem = [_private currentItem];
                   LOG(PageCache, "Clearing back/forward cache, %@\n", [currItem URL]);
  @@ -1174,6 +1175,7 @@
                       case WebFrameLoadTypeInternal:
                       case WebFrameLoadTypeReloadAllowingStaleData:
                       case WebFrameLoadTypeSame:
  +                    case WebFrameLoadTypeReplace:
                           // Do nothing.
                           break;
   
  @@ -2259,6 +2261,7 @@
           case WebFrameLoadTypeReload:
           case WebFrameLoadTypeReloadAllowingStaleData:
           case WebFrameLoadTypeSame:
  +        case WebFrameLoadTypeReplace:
               // Don't restore any form state on reload or loadSame
               return nil;
           case WebFrameLoadTypeBack:
  @@ -2677,6 +2680,17 @@
       [_private->children makeObjectsPerformSelector:@selector(_unmarkAllMisspellings)];
   }
   
  +- (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.7.8.3   +1 -0      WebKit/WebView.subproj/WebFrameInternal.h
  
  Index: WebFrameInternal.h
  ===================================================================
  RCS file: /cvs/root/WebKit/WebView.subproj/WebFrameInternal.h,v
  retrieving revision 1.7.8.2
  retrieving revision 1.7.8.3
  diff -u -r1.7.8.2 -r1.7.8.3
  --- WebFrameInternal.h	2 Aug 2005 16:58:01 -0000	1.7.8.2
  +++ WebFrameInternal.h	9 Sep 2005 17:17:03 -0000	1.7.8.3
  @@ -16,6 +16,7 @@
                                                            response:(NSURLResponse *)response 
                                                                data:(NSData *)data
                                                               error:(NSError *)error;
  +- (void)_setupForReplace;
   @end
   
   @interface NSObject (WebInternalFrameLoadDelegate)
  
  
  
  1.154.8.3 +3 -1      WebKit/WebView.subproj/WebFramePrivate.h
  
  Index: WebFramePrivate.h
  ===================================================================
  RCS file: /cvs/root/WebKit/WebView.subproj/WebFramePrivate.h,v
  retrieving revision 1.154.8.2
  retrieving revision 1.154.8.3
  diff -u -r1.154.8.2 -r1.154.8.3
  --- WebFramePrivate.h	24 Aug 2005 00:45:16 -0000	1.154.8.2
  +++ WebFramePrivate.h	9 Sep 2005 17:17:03 -0000	1.154.8.3
  @@ -49,7 +49,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.
  @@ -131,6 +132,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.179.6.3 +1 -0      WebKit/WebView.subproj/WebFrameView.m
  
  Index: WebFrameView.m
  ===================================================================
  RCS file: /cvs/root/WebKit/WebView.subproj/WebFrameView.m,v
  retrieving revision 1.179.6.2
  retrieving revision 1.179.6.3
  diff -u -r1.179.6.2 -r1.179.6.3
  --- WebFrameView.m	22 Jul 2005 01:18:49 -0000	1.179.6.2
  +++ WebFrameView.m	9 Sep 2005 17:17:03 -0000	1.179.6.3
  @@ -233,6 +233,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.260.8.4 +14 -10    WebKit/WebView.subproj/Attic/WebMainResourceClient.m
  
  Index: WebMainResourceClient.m
  ===================================================================
  RCS file: /cvs/root/WebKit/WebView.subproj/Attic/WebMainResourceClient.m,v
  retrieving revision 1.260.8.3
  retrieving revision 1.260.8.4
  diff -u -r1.260.8.3 -r1.260.8.4
  --- WebMainResourceClient.m	9 Aug 2005 23:53:23 -0000	1.260.8.3
  +++ WebMainResourceClient.m	9 Sep 2005 17:17:04 -0000	1.260.8.4
  @@ -297,17 +297,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
  -    // SubresourceClient 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 _removeSubresourceClient:self];
  -        [[[dataSource _webView] mainFrame] _checkLoadComplete];
  -        [self cancelWithError:[NSError _webKitErrorWithDomain:NSURLErrorDomain
  -                                                         code:NSURLErrorUnsupportedURL
  -                                                          URL:[r URL]]];
  -        return;
  +        if (!supportsMultipartContent) {
  +            [dataSource _removeSubresourceClient: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
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.21  +30 -0     WebCore/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebCore/ChangeLog,v
  retrieving revision 1.1.2.20
  retrieving revision 1.1.2.21
  diff -u -r1.1.2.20 -r1.1.2.21
  --- ChangeLog	2 Sep 2005 22:56:07 -0000	1.1.2.20
  +++ ChangeLog	9 Sep 2005 17:17:07 -0000	1.1.2.21
  @@ -1,3 +1,33 @@
  +2005-09-08  Adele Peterson  <adele at apple.com>
  +
  +        Merged fix from TOT to Safari-2-0-branch
  +
  +    2005-09-08  Justin Garcia  <justin.garcia at apple.com>
  +
  +        Reviewed by darin
  +
  +        WebCore portion of multipart/x-mixed-replace support
  +
  +        * khtml/misc/loader.cpp:
  +        (Request::Request):
  +        (Loader::slotReceivedResponse):
  +        Only allow a multipart load for images, clear out the old multipart section to prepare for a replace
  +        (Loader::slotData):
  +        Multipart sections are delivered to the coreLoader by WebKit all at once, send eof to CachedImage::data
  +        * khtml/misc/loader.h:
  +        (khtml::CachedObject::isImage): Added
  +        (khtml::CachedImage::isImage):
  +        * kwq/KWQKJobClasses.h:
  +        * kwq/KWQKJobClasses.mm:
  +        (KIO::TransferJob::cancel): 
  +        Added a way to cancel a subresource loader from WebCore
  +        * kwq/KWQLoader.h:
  +        * kwq/KWQLoader.mm:
  +        (KWQResponseIsMultipart):
  +        * kwq/KWQResourceLoader.h:
  +        * kwq/KWQResourceLoader.mm:
  +        (-[KWQResourceLoader jobCanceledLoad]):
  +
   === Safari-416.6 ===
   
   2005-09-02  Adele Peterson  <adele at apple.com>
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.67.8.3  +14 -1     WebCore/khtml/misc/loader.cpp
  
  Index: loader.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/misc/loader.cpp,v
  retrieving revision 1.67.8.2
  retrieving revision 1.67.8.3
  diff -u -r1.67.8.2 -r1.67.8.3
  --- loader.cpp	22 Jul 2005 01:18:32 -0000	1.67.8.2
  +++ loader.cpp	9 Sep 2005 17:17:08 -0000	1.67.8.3
  @@ -1240,6 +1240,7 @@
       object->setRequest(this);
       incremental = _incremental;
       m_docLoader = dl;
  +    multipart = false;
   }
   
   Request::~Request()
  @@ -1664,6 +1665,16 @@
       ASSERT(response);
       r->object->setResponse(response);
       r->object->setExpireDate(KWQCacheObjectExpiresTime(r->m_docLoader, response), false);
  +    
  +    if (r->multipart) {
  +        ASSERT(r->object->type() == CachedObject::Image);
  +        static_cast<CachedImage *>(r->object)->clear();
  +        r->m_buffer = QBuffer();
  +    } else if (KWQResponseIsMultipart(response)) {
  +        r->multipart = true;
  +        if (!r->object->type() == CachedObject::Image)
  +            static_cast<KIO::TransferJob*>(job)->cancel();
  +    }
   }
   
   #endif
  @@ -1689,7 +1700,9 @@
       r->m_buffer.writeBlock( data.data(), data.size() );
   #endif
   
  -    if(r->incremental)
  +    if (r->multipart)
  +        r->object->data( r->m_buffer, true ); // the loader delivers the data in a multipart section all at once, send eof
  +    else if(r->incremental)
           r->object->data( r->m_buffer, false );
   }
   
  
  
  
  1.38.10.2 +5 -1      WebCore/khtml/misc/loader.h
  
  Index: loader.h
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/misc/loader.h,v
  retrieving revision 1.38.10.1
  retrieving revision 1.38.10.2
  diff -u -r1.38.10.1 -r1.38.10.2
  --- loader.h	31 May 2005 16:57:08 -0000	1.38.10.1
  +++ loader.h	9 Sep 2005 17:17:08 -0000	1.38.10.2
  @@ -297,6 +297,8 @@
   	void checkNotify();
   
           bool isLoaded() const { return !m_loading; }
  +        
  +        virtual bool isImage() const { return false; }
   
       protected:
   	DOM::DOMString m_script;
  @@ -359,8 +361,9 @@
           virtual bool schedule() const { return true; }
   
   	void checkNotify();
  +        
  +        virtual bool isImage() const { return true; }
   
  -    protected:
   	void clear();
   
       private slots:
  @@ -524,6 +527,7 @@
   	QBuffer m_buffer;
   	CachedObject *object;
           DocLoader* m_docLoader;
  +        bool multipart;
        };
   
       /**
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.36.10.1 +1 -0      WebCore/kwq/KWQKJobClasses.h
  
  Index: KWQKJobClasses.h
  ===================================================================
  RCS file: /cvs/root/WebCore/kwq/KWQKJobClasses.h,v
  retrieving revision 1.36
  retrieving revision 1.36.10.1
  diff -u -r1.36 -r1.36.10.1
  --- KWQKJobClasses.h	9 Dec 2004 18:57:20 -0000	1.36
  +++ KWQKJobClasses.h	9 Sep 2005 17:17:10 -0000	1.36.10.1
  @@ -72,6 +72,7 @@
       void kill();
   
       void setLoader(KWQResourceLoader *);
  +    void cancel();
       
       KURL url() const;
   
  
  
  
  1.46.10.2 +5 -0      WebCore/kwq/KWQKJobClasses.mm
  
  Index: KWQKJobClasses.mm
  ===================================================================
  RCS file: /cvs/root/WebCore/kwq/KWQKJobClasses.mm,v
  retrieving revision 1.46.10.1
  retrieving revision 1.46.10.2
  diff -u -r1.46.10.1 -r1.46.10.2
  --- KWQKJobClasses.mm	22 Jul 2005 01:18:36 -0000	1.46.10.1
  +++ KWQKJobClasses.mm	9 Sep 2005 17:17:10 -0000	1.46.10.2
  @@ -207,6 +207,11 @@
       d->loader = loader;
   }
   
  +void TransferJob::cancel()
  +{
  +    [d->loader jobCanceledLoad];
  +}
  +
   KURL TransferJob::url() const
   {
       return d->URL;
  
  
  
  1.22.10.1 +1 -0      WebCore/kwq/KWQLoader.h
  
  Index: KWQLoader.h
  ===================================================================
  RCS file: /cvs/root/WebCore/kwq/KWQLoader.h,v
  retrieving revision 1.22
  retrieving revision 1.22.10.1
  diff -u -r1.22 -r1.22.10.1
  --- KWQLoader.h	4 Dec 2004 18:37:31 -0000	1.22
  +++ KWQLoader.h	9 Sep 2005 17:17:10 -0000	1.22.10.1
  @@ -61,6 +61,7 @@
   bool KWQIsResponseURLEqualToURL(NSURLResponse *response, const DOM::DOMString &m_url);
   QString KWQResponseURL(NSURLResponse *response);
   NSString *KWQResponseMIMEType(NSURLResponse *response);
  +bool KWQResponseIsMultipart(NSURLResponse *response);
   int KWQNumberOfPendingOrLoadingRequests(khtml::DocLoader *dl);
   time_t KWQCacheObjectExpiresTime(khtml::DocLoader *docLoader, NSURLResponse *response);
   NSString *KWQHeaderStringFromDictionary(NSDictionary *headers, int statusCode);
  
  
  
  1.120.8.1 +9 -0      WebCore/kwq/KWQLoader.mm
  
  Index: KWQLoader.mm
  ===================================================================
  RCS file: /cvs/root/WebCore/kwq/KWQLoader.mm,v
  retrieving revision 1.120
  retrieving revision 1.120.8.1
  diff -u -r1.120 -r1.120.8.1
  --- KWQLoader.mm	2 Mar 2005 02:17:59 -0000	1.120
  +++ KWQLoader.mm	9 Sep 2005 17:17:10 -0000	1.120.8.1
  @@ -317,6 +317,15 @@
       return NULL;
   }
   
  +bool KWQResponseIsMultipart(NSURLResponse *response)
  +{
  +    KWQ_BLOCK_EXCEPTIONS;
  +    return [[response MIMEType] isEqualToString:@"multipart/x-mixed-replace"];
  +    KWQ_UNBLOCK_EXCEPTIONS;
  +    
  +    return false;
  +}
  +
   time_t KWQCacheObjectExpiresTime(khtml::DocLoader *docLoader, NSURLResponse *response)
   {
       KWQ_BLOCK_EXCEPTIONS;
  
  
  
  1.3.28.1  +1 -0      WebCore/kwq/KWQResourceLoader.h
  
  Index: KWQResourceLoader.h
  ===================================================================
  RCS file: /cvs/root/WebCore/kwq/KWQResourceLoader.h,v
  retrieving revision 1.3
  retrieving revision 1.3.28.1
  diff -u -r1.3 -r1.3.28.1
  --- KWQResourceLoader.h	19 Nov 2003 18:55:18 -0000	1.3
  +++ KWQResourceLoader.h	9 Sep 2005 17:17:10 -0000	1.3.28.1
  @@ -42,5 +42,6 @@
   - (id)initWithJob:(KIO::TransferJob *)job;
   - (void)setHandle:(id <WebCoreResourceHandle>)handle;
   - (void)jobWillBeDeallocated;
  +- (void)jobCanceledLoad;
   
   @end
  
  
  
  1.14.8.1  +5 -0      WebCore/kwq/KWQResourceLoader.mm
  
  Index: KWQResourceLoader.mm
  ===================================================================
  RCS file: /cvs/root/WebCore/kwq/KWQResourceLoader.mm,v
  retrieving revision 1.14
  retrieving revision 1.14.8.1
  diff -u -r1.14 -r1.14.8.1
  --- KWQResourceLoader.mm	25 Feb 2005 00:00:43 -0000	1.14
  +++ KWQResourceLoader.mm	9 Sep 2005 17:17:10 -0000	1.14.8.1
  @@ -97,6 +97,11 @@
       job = 0;
   }
   
  +- (void)jobCanceledLoad
  +{
  +    [_handle cancel];
  +}
  +
   - (void)cancel
   {
       if (_job) {
  
  
  



More information about the webkit-changes mailing list