Reviewed by Darin.
authormjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 14 Aug 2006 03:22:34 +0000 (03:22 +0000)
committermjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 14 Aug 2006 03:22:34 +0000 (03:22 +0000)
        - remove all non-Loader dependencies from WebLoader

        As part of this I moved WebDataProtocol to the loader directory
        and removed dependencies on the rest of WebKit from that too.

        * Loader/WebFrameLoader.h:
        * Loader/WebFrameLoader.m:
        (-[WebFrameLoader setDefersCallbacks:]):
        (-[WebFrameLoader stopLoading]):
        (-[WebFrameLoader cancelledErrorWithRequest:]):
        (-[WebFrameLoader clearArchivedResources]):
        (-[WebFrameLoader deliverArchivedResources]):
        (-[WebFrameLoader deliverArchivedResourcesAfterDelay]):
        (isCaseSensitiveEqual):
        (-[WebFrameLoader _canUseResourceForRequest:]):
        (-[WebFrameLoader _canUseResourceWithResponse:]):
        (-[WebFrameLoader pendingArchivedResources]):
        (-[WebFrameLoader willUseArchiveForRequest:originalURL:loader:]):
        (-[WebFrameLoader archiveLoadPendingForLoader:]):
        (-[WebFrameLoader cancelPendingArchiveLoadForLoader:]):
        * Loader/WebLoader.h:
        * Loader/WebLoader.m:
        (-[NSURLProtocol releaseResources]):
        (-[NSURLProtocol loadWithRequest:]):
        (-[NSURLProtocol setDefersCallbacks:]):
        (-[NSURLProtocol addData:allAtOnce:]):
        (-[NSURLProtocol resourceData]):
        (-[NSURLProtocol didReceiveData:lengthReceived:allAtOnce:]):
        (-[NSURLProtocol connection:didReceiveData:lengthReceived:]):
        (-[NSURLProtocol cancelWithError:]):
        (-[NSURLProtocol cancelledError]):
        * Loader/WebMainResourceLoader.m:
        (-[WebMainResourceLoader addData:allAtOnce:]):
        (-[WebMainResourceLoader didReceiveData:lengthReceived:allAtOnce:]):
        * Loader/WebNetscapePlugInStreamLoader.m:
        (-[WebNetscapePlugInStreamLoader didReceiveData:lengthReceived:allAtOnce:]):
        * Loader/WebSubresourceLoader.m:
        (-[WebSubresourceLoader didReceiveData:lengthReceived:allAtOnce:]):
        * WebKit.xcodeproj/project.pbxproj:
        * WebView/WebDataProtocol.h: Removed.
        * WebView/WebDataProtocol.m: Removed.

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

WebKit/ChangeLog
WebKit/Loader/WebDataProtocol.h [moved from WebKit/WebView/WebDataProtocol.h with 100% similarity]
WebKit/Loader/WebDataProtocol.m [moved from WebKit/WebView/WebDataProtocol.m with 100% similarity]
WebKit/Loader/WebFrameLoader.h
WebKit/Loader/WebFrameLoader.m
WebKit/Loader/WebLoader.h
WebKit/Loader/WebLoader.m
WebKit/Loader/WebMainResourceLoader.m
WebKit/Loader/WebNetscapePlugInStreamLoader.m
WebKit/Loader/WebSubresourceLoader.m
WebKit/WebKit.xcodeproj/project.pbxproj

index 4dc166b0135e23b1b34ef0d8181a91b30353def1..918a84a9ac0e6647ca73ab41de1d1a45eb591a2f 100644 (file)
@@ -1,3 +1,49 @@
+2006-08-13  Maciej Stachowiak  <mjs@apple.com>
+
+        Reviewed by Darin.
+        
+        - remove all non-Loader dependencies from WebLoader
+        
+        As part of this I moved WebDataProtocol to the loader directory
+        and removed dependencies on the rest of WebKit from that too.
+
+        * Loader/WebFrameLoader.h:
+        * Loader/WebFrameLoader.m:
+        (-[WebFrameLoader setDefersCallbacks:]):
+        (-[WebFrameLoader stopLoading]):
+        (-[WebFrameLoader cancelledErrorWithRequest:]):
+        (-[WebFrameLoader clearArchivedResources]):
+        (-[WebFrameLoader deliverArchivedResources]):
+        (-[WebFrameLoader deliverArchivedResourcesAfterDelay]):
+        (isCaseSensitiveEqual):
+        (-[WebFrameLoader _canUseResourceForRequest:]):
+        (-[WebFrameLoader _canUseResourceWithResponse:]):
+        (-[WebFrameLoader pendingArchivedResources]):
+        (-[WebFrameLoader willUseArchiveForRequest:originalURL:loader:]):
+        (-[WebFrameLoader archiveLoadPendingForLoader:]):
+        (-[WebFrameLoader cancelPendingArchiveLoadForLoader:]):
+        * Loader/WebLoader.h:
+        * Loader/WebLoader.m:
+        (-[NSURLProtocol releaseResources]):
+        (-[NSURLProtocol loadWithRequest:]):
+        (-[NSURLProtocol setDefersCallbacks:]):
+        (-[NSURLProtocol addData:allAtOnce:]):
+        (-[NSURLProtocol resourceData]):
+        (-[NSURLProtocol didReceiveData:lengthReceived:allAtOnce:]):
+        (-[NSURLProtocol connection:didReceiveData:lengthReceived:]):
+        (-[NSURLProtocol cancelWithError:]):
+        (-[NSURLProtocol cancelledError]):
+        * Loader/WebMainResourceLoader.m:
+        (-[WebMainResourceLoader addData:allAtOnce:]):
+        (-[WebMainResourceLoader didReceiveData:lengthReceived:allAtOnce:]):
+        * Loader/WebNetscapePlugInStreamLoader.m:
+        (-[WebNetscapePlugInStreamLoader didReceiveData:lengthReceived:allAtOnce:]):
+        * Loader/WebSubresourceLoader.m:
+        (-[WebSubresourceLoader didReceiveData:lengthReceived:allAtOnce:]):
+        * WebKit.xcodeproj/project.pbxproj:
+        * WebView/WebDataProtocol.h: Removed.
+        * WebView/WebDataProtocol.m: Removed.
+
 2006-08-11  Tim Omernick  <timo@apple.com>
 
         Reviewed by Darin.
index 8ed40a13480fcc5e4e058f2379651e4da0f5d3ae..e4ab4466cb8fbe578127f937ab33e5585f5fcf31 100644 (file)
 @interface WebFrameLoader : NSObject
 {
 @public
-    // Client for main resource.
     WebMainResourceLoader *mainResourceLoader;
     
-    // Clients for other resources.
     NSMutableArray *subresourceLoaders;
     NSMutableArray *plugInStreamLoaders;
     WebIconLoader *iconLoader;
@@ -51,6 +49,8 @@
     WebDataSource *dataSource;
     WebDataSource *provisionalDataSource;
     WebFrameState state;
+    
+    NSMutableDictionary *pendingArchivedResources;
 }
 
 - (id)initWithWebFrame:(WebFrame *)wf;
 - (void)_iconLoaderReceivedPageIcon:(WebIconLoader *)iconLoader;
 - (NSURL *)_URL;
 
+- (NSError *)cancelledErrorWithRequest:(NSURLRequest *)request;
+- (BOOL)willUseArchiveForRequest:(NSURLRequest *)r originalURL:(NSURL *)originalURL loader:(WebLoader *)loader;
+- (BOOL)archiveLoadPendingForLoader:(WebLoader *)loader;
+- (void)deliverArchivedResourcesAfterDelay;
+- (void)cancelPendingArchiveLoadForLoader:(WebLoader *)loader;
+- (void)clearArchivedResources;
+
 @end
index 66ac749d5ce7db17a424e90c844a3c2f45dcb07a..22918abd21e7b965e35ee72168c7639d585aefa6 100644 (file)
@@ -35,6 +35,8 @@
 #import <WebKit/WebMainResourceLoader.h>
 #import <WebKit/WebKitLogging.h>
 #import <WebKit/WebViewInternal.h>
+#import <WebKit/WebKitErrorsPrivate.h>
+#import <WebKit/WebResourcePrivate.h>
 
 @implementation WebFrameLoader
 
     e = [plugInStreamLoaders objectEnumerator];
     while ((loader = [e nextObject]))
         [loader setDefersCallbacks:defers];
+
+    [self deliverArchivedResourcesAfterDelay];
 }
 
 - (void)stopLoadingPlugIns
@@ -315,6 +319,7 @@ static CFAbsoluteTime _timeOfLastCompletedLoad;
     [provisionalDataSource _stopLoading];
     [dataSource _stopLoading];
     [self _clearProvisionalDataSource];
+    [self clearArchivedResources];
 }
 
 // FIXME: poor method name; also why is this not part of startProvisionalLoad:?
@@ -522,4 +527,121 @@ static CFAbsoluteTime _timeOfLastCompletedLoad;
     return [[self activeDataSource] _URL];
 }
 
+- (NSError *)cancelledErrorWithRequest:(NSURLRequest *)request
+{
+    return [NSError _webKitErrorWithDomain:NSURLErrorDomain
+                                      code:NSURLErrorCancelled
+                                       URL:[request URL]];
+}
+
+- (void)clearArchivedResources
+{
+    [pendingArchivedResources removeAllObjects];
+    [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(deliverArchivedResources) object:nil];
+}
+
+- (void)deliverArchivedResources
+{
+    if (![pendingArchivedResources count] || [self _defersCallbacks])
+        return;
+        
+    NSEnumerator *keyEnum = [pendingArchivedResources keyEnumerator];
+    WebLoader *loader;
+    while ((loader = [keyEnum nextObject])) {
+        WebResource *resource = [pendingArchivedResources objectForKey:loader];
+        [loader didReceiveResponse:[resource _response]];
+        NSData *data = [resource data];
+        [loader didReceiveData:data lengthReceived:[data length] allAtOnce:YES];
+        [loader didFinishLoading];
+    }
+    
+    [pendingArchivedResources removeAllObjects];
+}
+
+- (void)deliverArchivedResourcesAfterDelay
+{
+    if (![pendingArchivedResources count] || [self _defersCallbacks])
+        return;
+    
+    [self performSelector:@selector(deliverArchivedResources) withObject:nil afterDelay:0];
+}
+
+static BOOL isCaseSensitiveEqual(NSString *a, NSString *b)
+{
+    return [a caseInsensitiveCompare:b] == NSOrderedSame;
+}
+
+// The following 2 methods are copied from [NSHTTPURLProtocol _cachedResponsePassesValidityChecks] and modified for our needs.
+// FIXME: It would be nice to eventually to share this code somehow.
+- (BOOL)_canUseResourceForRequest:(NSURLRequest *)theRequest
+{
+    NSURLRequestCachePolicy policy = [theRequest cachePolicy];
+    
+    if (policy == NSURLRequestReturnCacheDataElseLoad) {
+        return YES;
+    } else if (policy == NSURLRequestReturnCacheDataDontLoad) {
+        return YES;
+    } else if (policy == NSURLRequestReloadIgnoringCacheData) {
+        return NO;
+    } else if ([theRequest valueForHTTPHeaderField:@"must-revalidate"] != nil) {
+        return NO;
+    } else if ([theRequest valueForHTTPHeaderField:@"proxy-revalidate"] != nil) {
+        return NO;
+    } else if ([theRequest valueForHTTPHeaderField:@"If-Modified-Since"] != nil) {
+        return NO;
+    } else if ([theRequest valueForHTTPHeaderField:@"Cache-Control"] != nil) {
+        return NO;
+    } else if (isCaseSensitiveEqual(@"POST", [theRequest HTTPMethod])) {
+        return NO;
+    } else {
+        return YES;
+    }
+}
+
+- (BOOL)_canUseResourceWithResponse:(NSURLResponse *)theResponse
+{
+    if (WKGetNSURLResponseMustRevalidate(theResponse)) {
+        return NO;
+    } else if (WKGetNSURLResponseCalculatedExpiration(theResponse) - CFAbsoluteTimeGetCurrent() < 1) {
+        return NO;
+    } else {
+        return YES;
+    }
+}
+
+- (NSMutableDictionary *)pendingArchivedResources
+{
+    if (!pendingArchivedResources)
+        pendingArchivedResources = [[NSMutableDictionary alloc] init];
+    
+    return pendingArchivedResources;
+}
+
+- (BOOL)willUseArchiveForRequest:(NSURLRequest *)r originalURL:(NSURL *)originalURL loader:(WebLoader *)loader
+{
+    if ([[r URL] isEqual:originalURL] && [self _canUseResourceForRequest:r]) {
+        WebResource *resource = [self _archivedSubresourceForURL:originalURL];
+        if (resource && [self _canUseResourceWithResponse:[resource _response]]) {
+            [[self pendingArchivedResources] setObject:resource forKey:loader];
+            // Deliver the resource after a delay because callers don't expect to receive callbacks while calling this method.
+            [self deliverArchivedResourcesAfterDelay];
+            return YES;
+        }
+    }
+    return NO;
+}
+
+- (BOOL)archiveLoadPendingForLoader:(WebLoader *)loader
+{
+    return [pendingArchivedResources objectForKey:loader] != nil;
+}
+
+- (void)cancelPendingArchiveLoadForLoader:(WebLoader *)loader
+{
+    [pendingArchivedResources removeObjectForKey:loader];
+    
+    if (![pendingArchivedResources count])
+        [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(deliverArchivedResources) object:nil];
+}
+
 @end
index af8d1b56a4fa0b5e2587a32a284f39c328f1448a..923ef3cd1c9ed0a5df66a6bb19340d486fa2055f 100644 (file)
@@ -35,8 +35,6 @@
 @class NSURLCredential;
 @class NSURLRequest;
 @class NSURLResponse;
-@class WebDataSource;
-@class WebResource;
 @class WebFrameLoader;
 
 @interface WebLoader : NSObject
     NSURLAuthenticationChallenge *currentConnectionChallenge;
     NSURLAuthenticationChallenge *currentWebChallenge;
     BOOL defersCallbacks;
-    BOOL waitingToDeliverResource;
-    BOOL deliveredResource;
     NSURL *originalURL;
     NSMutableData *resourceData;
-    WebResource *resource;
 #ifndef NDEBUG
     BOOL isInitializingConnection;
 #endif
 
 - (void)cancel;
 - (void)cancelWithError:(NSError *)error;
+- (NSError *)cancelledError;
 
 - (void)setDefersCallbacks:(BOOL)defers;
 - (BOOL)defersCallbacks;
 
-- (NSError *)cancelledError;
-
 - (void)setIdentifier:(id)ident;
 
 - (void)releaseResources;
 - (NSURLResponse *)response;
 
-- (void)addData:(NSData *)data;
+- (void)addData:(NSData *)data allAtOnce:(BOOL)allAtOnce;
 - (NSData *)resourceData;
 - (void)clearResourceData;
 
 - (void)didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge;
 - (void)didCancelAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge;
 - (void)didReceiveResponse:(NSURLResponse *)r;
-- (void)didReceiveData:(NSData *)data lengthReceived:(long long)lengthReceived;
+- (void)didReceiveData:(NSData *)data lengthReceived:(long long)lengthReceived allAtOnce:(BOOL)allAtOnce;
 - (void)willStopBufferingData:(NSData *)data;
 - (void)didFinishLoading;
 - (void)didFailWithError:(NSError *)error;
 - (NSCachedURLResponse *)willCacheResponse:(NSCachedURLResponse *)cachedResponse;
 
+
 // Used to work around the fact that you don't get any more NSURLConnection callbacks until you return from the first one.
 + (BOOL)inConnectionCallback;
 
index a10544d5265186d4d6fcc255cb862c7c9991782c..7883969709f258ba0689c35d719505df34127598 100644 (file)
 
 #import <JavaScriptCore/Assertions.h>
 #import <WebKit/WebDataProtocol.h>
-#import <WebKit/WebKitErrors.h>
-#import <WebKit/WebKitErrorsPrivate.h>
 #import <WebKit/WebFrameLoader.h>
 
-#import <WebKit/WebNSURLRequestExtras.h>
-#import <WebKit/WebKitNSStringExtras.h>
-#import <WebKit/WebResourcePrivate.h>
-#import <WebKitSystemInterface.h>
-
 static unsigned inNSURLConnectionCallback;
 static BOOL NSURLConnectionSupportsBufferedData;
 
@@ -135,9 +128,6 @@ static BOOL NSURLConnectionSupportsBufferedData;
     [frameLoader release];
     frameLoader = nil;
     
-    [resource release];
-    resource = nil;
-    
     [resourceData release];
     resourceData = nil;
 
@@ -153,102 +143,25 @@ static BOOL NSURLConnectionSupportsBufferedData;
     [super dealloc];
 }
 
-- (void)deliverResource
-{
-    ASSERT(resource);
-    ASSERT(waitingToDeliverResource);
-    
-    if (!defersCallbacks) {
-        [self didReceiveResponse:[resource _response]];
-        NSData *data = [resource data];
-        [self didReceiveData:data lengthReceived:[data length]];
-        [self didFinishLoading];
-        deliveredResource = YES;
-        waitingToDeliverResource = NO;
-    }
-}
-
-- (void)deliverResourceAfterDelay
-{
-    if (resource && !defersCallbacks && !waitingToDeliverResource && !deliveredResource) {
-        [self performSelector:@selector(deliverResource) withObject:nil afterDelay:0];
-        waitingToDeliverResource = YES;
-    }
-}
-
-// The following 2 methods are copied from [NSHTTPURLProtocol _cachedResponsePassesValidityChecks] and modified for our needs.
-// FIXME: It would be nice to eventually to share this code somehow.
-- (BOOL)_canUseResourceForRequest:(NSURLRequest *)theRequest
-{
-    NSURLRequestCachePolicy policy = [theRequest cachePolicy];
-        
-    if (policy == NSURLRequestReturnCacheDataElseLoad) {
-        return YES;
-    } else if (policy == NSURLRequestReturnCacheDataDontLoad) {
-        return YES;
-    } else if (policy == NSURLRequestReloadIgnoringCacheData) {
-        return NO;
-    } else if ([theRequest valueForHTTPHeaderField:@"must-revalidate"] != nil) {
-        return NO;
-    } else if ([theRequest valueForHTTPHeaderField:@"proxy-revalidate"] != nil) {
-        return NO;
-    } else if ([theRequest valueForHTTPHeaderField:@"If-Modified-Since"] != nil) {
-        return NO;
-    } else if ([theRequest valueForHTTPHeaderField:@"Cache-Control"] != nil) {
-        return NO;
-    } else if ([[theRequest HTTPMethod] _webkit_isCaseInsensitiveEqualToString:@"POST"]) {
-        return NO;
-    } else {
-        return YES;
-    }
-}
-
-- (BOOL)_canUseResourceWithResponse:(NSURLResponse *)theResponse
-{
-    if (WKGetNSURLResponseMustRevalidate(theResponse)) {
-        return NO;
-    } else if (WKGetNSURLResponseCalculatedExpiration(theResponse) - CFAbsoluteTimeGetCurrent() < 1) {
-        return NO;
-    } else {
-        return YES;
-    }
-}
-
 - (BOOL)loadWithRequest:(NSURLRequest *)r
 {
     ASSERT(connection == nil);
-    ASSERT(resource == nil);
+    ASSERT(![frameLoader archiveLoadPendingForLoader:self]);
     
     NSURL *URL = [[r URL] retain];
     [originalURL release];
     originalURL = URL;
     
-    deliveredResource = NO;
-    waitingToDeliverResource = NO;
-
     NSURLRequest *clientRequest = [self willSendRequest:r redirectResponse:nil];
     if (clientRequest == nil) {
-        NSError *badURLError = [NSError _webKitErrorWithDomain:NSURLErrorDomain 
-                                                          code:NSURLErrorCancelled
-                                                           URL:[r URL]];
-        [self didFailWithError:badURLError];
+        NSError *cancelledError = [frameLoader cancelledErrorWithRequest:r];
+        [self didFailWithError:cancelledError];
         return NO;
     }
     r = clientRequest;
     
-    if ([[r URL] isEqual:originalURL] && [self _canUseResourceForRequest:r]) {
-        resource = [frameLoader _archivedSubresourceForURL:originalURL];
-        if (resource != nil) {
-            if ([self _canUseResourceWithResponse:[resource _response]]) {
-                [resource retain];
-                // Deliver the resource after a delay because callers don't expect to receive callbacks while calling this method.
-                [self deliverResourceAfterDelay];
-                return YES;
-            } else {
-                resource = nil;
-            }
-        }
-    }
+    if ([frameLoader willUseArchiveForRequest:r originalURL:originalURL loader:self])
+        return YES;
     
 #ifndef NDEBUG
     isInitializingConnection = YES;
@@ -269,7 +182,6 @@ static BOOL NSURLConnectionSupportsBufferedData;
     defersCallbacks = defers;
     WKSetNSURLConnectionDefersCallbacks(connection, defers);
     // Deliver the resource after a delay because callers don't expect to receive callbacks while calling this method.
-    [self deliverResourceAfterDelay];
 }
 
 - (BOOL)defersCallbacks
@@ -293,37 +205,34 @@ static BOOL NSURLConnectionSupportsBufferedData;
     return frameLoader;
 }
 
-- (void)addData:(NSData *)data
+- (void)addData:(NSData *)data allAtOnce:(BOOL)allAtOnce
 {
-    // Don't buffer data if we're loading it from a WebResource.
-    if (resource == nil) {
-        if (NSURLConnectionSupportsBufferedData) {
-            // Buffer data only if the connection has handed us the data because is has stopped buffering it.
-            if (resourceData != nil) {
-                [resourceData appendData:data];
-            }
-        } else {
-            if (resourceData == nil) {
-                resourceData = [[NSMutableData alloc] init];
-            }
+    if (allAtOnce) {
+        resourceData = [data copy];
+        return;
+    }
+        
+    if (NSURLConnectionSupportsBufferedData) {
+        // Buffer data only if the connection has handed us the data because is has stopped buffering it.
+        if (resourceData != nil)
             [resourceData appendData:data];
-        }
+    } else {
+        if (resourceData == nil)
+            resourceData = [[NSMutableData alloc] init];
+        [resourceData appendData:data];
     }
 }
 
 - (NSData *)resourceData
 {
-    if (resource != nil) {
-        return [resource data];
-    }
-    if (resourceData != nil) {
+    if (resourceData)
         // Retain and autorelease resourceData since releaseResources (which releases resourceData) may be called 
         // before the caller of this method has an opporuntity to retain the returned data (4070729).
         return [[resourceData retain] autorelease];
-    }
-    if (NSURLConnectionSupportsBufferedData) {
+
+    if (NSURLConnectionSupportsBufferedData)
         return [connection _bufferedData];
-    }
+
     return nil;
 }
 
@@ -440,7 +349,7 @@ static BOOL NSURLConnectionSupportsBufferedData;
     [self release];
 }
 
-- (void)didReceiveData:(NSData *)data lengthReceived:(long long)lengthReceived
+- (void)didReceiveData:(NSData *)data lengthReceived:(long long)lengthReceived allAtOnce:(BOOL)allAtOnce
 {
     // The following assertions are not quite valid here, since a subclass
     // might override didReceiveData: in a way that invalidates them. This
@@ -452,7 +361,7 @@ static BOOL NSURLConnectionSupportsBufferedData;
     // anything including possibly releasing self; one example of this is 3266216
     [self retain];
     
-    [self addData:data];
+    [self addData:data allAtOnce:allAtOnce];
     
     [frameLoader _didReceiveData:data contentLength:lengthReceived forResource:identifier];
 
@@ -553,7 +462,7 @@ static BOOL NSURLConnectionSupportsBufferedData;
 {
     ASSERT(con == connection);
     ++inNSURLConnectionCallback;
-    [self didReceiveData:data lengthReceived:lengthReceived];
+    [self didReceiveData:data lengthReceived:lengthReceived allAtOnce:NO];
     --inNSURLConnectionCallback;
 }
 
@@ -613,7 +522,7 @@ static BOOL NSURLConnectionSupportsBufferedData;
     [currentWebChallenge release];
     currentWebChallenge = nil;
 
-    [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(deliverResource) object:nil];
+    [frameLoader cancelPendingArchiveLoadForLoader:self];
     [connection cancel];
 
     [frameLoader _didFailLoadingWithError:error forResource:identifier];
@@ -628,13 +537,6 @@ static BOOL NSURLConnectionSupportsBufferedData;
     }
 }
 
-- (NSError *)cancelledError
-{
-    return [NSError _webKitErrorWithDomain:NSURLErrorDomain
-                                      code:NSURLErrorCancelled
-                                       URL:[request URL]];
-}
-
 - (void)setIdentifier: ident
 {
     if (identifier != ident){
@@ -653,4 +555,9 @@ static BOOL NSURLConnectionSupportsBufferedData;
     return inNSURLConnectionCallback != 0;
 }
 
+- (NSError *)cancelledError
+{
+    return [frameLoader cancelledErrorWithRequest:request];
+}
+
 @end
index 03653781d615b3914c88fe811e474d161b9c9b86..0c90ffad06a3c0f040f15222beb5ea8c8057c310 100644 (file)
     return result;
 }
 
-- (void)addData:(NSData *)data
+- (void)addData:(NSData *)data allAtOnce:(BOOL)allAtOnce
 {
-    [super addData:data];
+    [super addData:data allAtOnce:allAtOnce];
     [frameLoader _receivedData:data];
 }
 
     [self release];
 }
 
-- (void)didReceiveData:(NSData *)data lengthReceived:(long long)lengthReceived
+- (void)didReceiveData:(NSData *)data lengthReceived:(long long)lengthReceived allAtOnce:(BOOL)allAtOnce
 {
     ASSERT(data);
     ASSERT([data length] != 0);
     [self retain];
     [frameLoader _mainReceivedBytesSoFar:_bytesReceived complete:NO];
     
-    [super didReceiveData:data lengthReceived:lengthReceived];
+    [super didReceiveData:data lengthReceived:lengthReceived allAtOnce:allAtOnce];
     _bytesReceived += [data length];
 
     LOG(Loading, "%d of %d", _bytesReceived, _contentLength);
index f272752b052a2df36d95420cc4020c1e9292f04a..ae2a32edf049448ee01c1e5bb655f4998e0b2183 100644 (file)
     [self release];
 }
 
-- (void)didReceiveData:(NSData *)data lengthReceived:(long long)lengthReceived
+- (void)didReceiveData:(NSData *)data lengthReceived:(long long)lengthReceived allAtOnce:(BOOL)allAtOnce
 {
     // 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];
     [stream receivedData:data];
-    [super didReceiveData:data lengthReceived:lengthReceived];
+    [super didReceiveData:data lengthReceived:lengthReceived allAtOnce:(BOOL)allAtOnce];
     [self release];
 }
 
index 59541e57d890dc0624fd8dde1364c3c2f8141988..3ffa4aece85935580e1fb01c4f5ef9eba003bdad 100644 (file)
     }
 }
 
-- (void)didReceiveData:(NSData *)data lengthReceived:(long long)lengthReceived
+- (void)didReceiveData:(NSData *)data lengthReceived:(long long)lengthReceived allAtOnce:(BOOL)allAtOnce
 {
     // retain/release self in this delegate method since the additional processing can do
     // anything including possibly releasing self; one example of this is 3266216
     // 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];
+    [super didReceiveData:data lengthReceived:lengthReceived allAtOnce:allAtOnce];
     [self release];
 }
 
index 8b1b51506e28fe12740920dc3ccbde8f8134b798..4501d52c52c9ec4bb081e72370ff321977d94dda 100644 (file)
@@ -36,6 +36,8 @@
                51E4D39A0A886B5E00ECEE2C /* WebIconDatabaseBridge.m in Sources */ = {isa = PBXBuildFile; fileRef = 51E4D3980A886B5E00ECEE2C /* WebIconDatabaseBridge.m */; };
                650F74E409E488F70020118A /* WebUnarchivingState.h in Headers */ = {isa = PBXBuildFile; fileRef = 650F74E209E488F70020118A /* WebUnarchivingState.h */; };
                650F74E509E488F70020118A /* WebUnarchivingState.m in Sources */ = {isa = PBXBuildFile; fileRef = 650F74E309E488F70020118A /* WebUnarchivingState.m */; };
+               651A93870A83F883007FEDF0 /* WebDataProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 651A93850A83F883007FEDF0 /* WebDataProtocol.h */; };
+               651A93880A83F883007FEDF0 /* WebDataProtocol.m in Sources */ = {isa = PBXBuildFile; fileRef = 651A93860A83F883007FEDF0 /* WebDataProtocol.m */; };
                65488DA1084FBCCB00831AD0 /* WebNSDictionaryExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = 65488D9F084FBCCB00831AD0 /* WebNSDictionaryExtras.h */; };
                65488DA2084FBCCB00831AD0 /* WebNSDictionaryExtras.m in Sources */ = {isa = PBXBuildFile; fileRef = 65488DA0084FBCCB00831AD0 /* WebNSDictionaryExtras.m */; };
                654B3C330A82C47200E1AE3D /* WebFrameLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 654B3C290A82C47200E1AE3D /* WebFrameLoader.h */; };
                939810710824BF01008DF038 /* WebViewPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 51A8B57D0428353A00CA2D3A /* WebViewPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
                939810720824BF01008DF038 /* WebPolicyDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 51443F9A0429392B00CA2D3A /* WebPolicyDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };
                939810730824BF01008DF038 /* WebPolicyDelegatePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 51443F9C0429392B00CA2D3A /* WebPolicyDelegatePrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               939810740824BF01008DF038 /* WebDataProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 70ECD6CC043B727400A80181 /* WebDataProtocol.h */; };
                939810750824BF01008DF038 /* WebUIDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 515E27CC0458C86500CA2D3A /* WebUIDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };
                939810760824BF01008DF038 /* WebDefaultUIDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 515E27CF0458CA4B00CA2D3A /* WebDefaultUIDelegate.h */; };
                939810770824BF01008DF038 /* WebDownload.h in Headers */ = {isa = PBXBuildFile; fileRef = 6578F5DE045F817400000128 /* WebDownload.h */; settings = {ATTRIBUTES = (Public, ); }; };
                939811060824BF01008DF038 /* WebFrameView.m in Sources */ = {isa = PBXBuildFile; fileRef = 51A8B52F04282B5900CA2D3A /* WebFrameView.m */; };
                939811070824BF01008DF038 /* WebView.m in Sources */ = {isa = PBXBuildFile; fileRef = 51A8B57A042834F700CA2D3A /* WebView.m */; };
                939811080824BF01008DF038 /* WebPolicyDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 51443F9B0429392B00CA2D3A /* WebPolicyDelegate.m */; };
-               939811090824BF01008DF038 /* WebDataProtocol.m in Sources */ = {isa = PBXBuildFile; fileRef = 70ECD6CD043B727400A80181 /* WebDataProtocol.m */; };
                9398110A0824BF01008DF038 /* WebDefaultUIDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 515E27D00458CA4B00CA2D3A /* WebDefaultUIDelegate.m */; };
                9398110B0824BF01008DF038 /* WebDownload.m in Sources */ = {isa = PBXBuildFile; fileRef = 6578F5DF045F817400000128 /* WebDownload.m */; };
                9398110D0824BF01008DF038 /* WebLocalizableStrings.m in Sources */ = {isa = PBXBuildFile; fileRef = BEE18F9A0472B73200CA289C /* WebLocalizableStrings.m */; };
                51E94C6906C0347500A9B09E /* WebPDFRepresentation.m */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebPDFRepresentation.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                650F74E209E488F70020118A /* WebUnarchivingState.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebUnarchivingState.h; sourceTree = "<group>"; };
                650F74E309E488F70020118A /* WebUnarchivingState.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = WebUnarchivingState.m; sourceTree = "<group>"; };
+               651A93850A83F883007FEDF0 /* WebDataProtocol.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebDataProtocol.h; sourceTree = "<group>"; };
+               651A93860A83F883007FEDF0 /* WebDataProtocol.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = WebDataProtocol.m; sourceTree = "<group>"; };
                65488D9F084FBCCB00831AD0 /* WebNSDictionaryExtras.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebNSDictionaryExtras.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                65488DA0084FBCCB00831AD0 /* WebNSDictionaryExtras.m */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebNSDictionaryExtras.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                654B3C290A82C47200E1AE3D /* WebFrameLoader.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebFrameLoader.h; sourceTree = "<group>"; };
                7082F570038EADAA00A80180 /* WebKitNSStringExtras.m */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebKitNSStringExtras.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                70BC9ED604144F3200A80182 /* WebDefaultFrameLoadDelegate.m */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebDefaultFrameLoadDelegate.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                70BC9ED804144FC500A80182 /* WebDefaultFrameLoadDelegate.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebDefaultFrameLoadDelegate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
-               70ECD6CC043B727400A80181 /* WebDataProtocol.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebDataProtocol.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
-               70ECD6CD043B727400A80181 /* WebDataProtocol.m */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebDataProtocol.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                7E6FEEFF08985A3E00C44C3F /* WebDefaultScriptDebugDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebDefaultScriptDebugDelegate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                7E6FEF0008985A3E00C44C3F /* WebDefaultScriptDebugDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebDefaultScriptDebugDelegate.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                7E6FEF0508985A7200C44C3F /* WebScriptDebugDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebScriptDebugDelegate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                654B3C280A82C47200E1AE3D /* Loader */ = {
                        isa = PBXGroup;
                        children = (
+                               651A93850A83F883007FEDF0 /* WebDataProtocol.h */,
+                               651A93860A83F883007FEDF0 /* WebDataProtocol.m */,
                                654B3C290A82C47200E1AE3D /* WebFrameLoader.h */,
                                654B3C2A0A82C47200E1AE3D /* WebFrameLoader.m */,
                                654B3C2B0A82C47200E1AE3D /* WebLoader.h */,
                                8373435B0624EE0D00F3B289 /* WebArchive.m */,
                                933D659903413FF2008635CE /* WebClipView.h */,
                                933D659A03413FF2008635CE /* WebClipView.m */,
-                               70ECD6CC043B727400A80181 /* WebDataProtocol.h */,
-                               70ECD6CD043B727400A80181 /* WebDataProtocol.m */,
                                39446070020F50ED0ECA1767 /* WebDataSource.h */,
                                39446071020F50ED0ECA1767 /* WebDataSource.m */,
                                39446072020F50ED0ECA1767 /* WebDataSourcePrivate.h */,
                                939810710824BF01008DF038 /* WebViewPrivate.h in Headers */,
                                939810720824BF01008DF038 /* WebPolicyDelegate.h in Headers */,
                                939810730824BF01008DF038 /* WebPolicyDelegatePrivate.h in Headers */,
-                               939810740824BF01008DF038 /* WebDataProtocol.h in Headers */,
                                939810750824BF01008DF038 /* WebUIDelegate.h in Headers */,
                                939810760824BF01008DF038 /* WebDefaultUIDelegate.h in Headers */,
                                939810770824BF01008DF038 /* WebDownload.h in Headers */,
                                654B3C370A82C47200E1AE3D /* WebMainResourceLoader.h in Headers */,
                                654B3C390A82C47200E1AE3D /* WebNetscapePlugInStreamLoader.h in Headers */,
                                654B3C3B0A82C47200E1AE3D /* WebSubresourceLoader.h in Headers */,
+                               651A93870A83F883007FEDF0 /* WebDataProtocol.h in Headers */,
                                51E4D3990A886B5E00ECEE2C /* WebIconDatabaseBridge.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                                939811060824BF01008DF038 /* WebFrameView.m in Sources */,
                                939811070824BF01008DF038 /* WebView.m in Sources */,
                                939811080824BF01008DF038 /* WebPolicyDelegate.m in Sources */,
-                               939811090824BF01008DF038 /* WebDataProtocol.m in Sources */,
                                9398110A0824BF01008DF038 /* WebDefaultUIDelegate.m in Sources */,
                                9398110B0824BF01008DF038 /* WebDownload.m in Sources */,
                                9398110D0824BF01008DF038 /* WebLocalizableStrings.m in Sources */,
                                654B3C380A82C47200E1AE3D /* WebMainResourceLoader.m in Sources */,
                                654B3C3A0A82C47200E1AE3D /* WebNetscapePlugInStreamLoader.m in Sources */,
                                654B3C3C0A82C47200E1AE3D /* WebSubresourceLoader.m in Sources */,
+                               651A93880A83F883007FEDF0 /* WebDataProtocol.m in Sources */,
                                51E4D39A0A886B5E00ECEE2C /* WebIconDatabaseBridge.m in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;