[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
mjs
mjs at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 06:25:17 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 40c41aa4d03110bb3099b678eb14227b07e711dc
Author: mjs <mjs at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Jul 19 04:13:54 2002 +0000
Even more exciting refactoring. Change the rules for committing
the data source and creating the representation so that both
happen when the first byte has been received _and_ the content
policy has been set to show. Previously these actions happened at
different times. Now we maintain the invariant that the data
source has a representation if and only if it is committed.
* WebView.subproj/WebController.m:
(-[WebController haveContentPolicy:andPath:forDataSource:]): Simplify
further by putting more of the work in WebDataSource.
* WebView.subproj/WebControllerPrivate.m:
(-[WebController _mainReceivedProgress:forResourceHandle:fromDataSource:complete:]):
* WebView.subproj/WebDataSource.h, WebView.subproj/WebDataSource.m: Move
makeRepresentation method to private file.
* WebView.subproj/WebDataSourcePrivate.h:
* WebView.subproj/WebDataSourcePrivate.m:
(-[WebDataSource _setContentPolicy:]): If the policy is set to show,
commit if we have already gotten the first byte.
(-[WebDataSource _commitIfReady]): Create representation and
commit if we have the first byte and have a policy of show.
(-[WebDataSource _gotFirstByte]): Method to check if this data source
has gotten the first byte yet. Commit here if ready.
(-[WebDataSource _setGotFirstByte]): Method to report that some
data has been received.
(-[WebDataSource _makeRepresentation]): Make and set up teh document view too.
(-[WebDataSource _isReadyForData]): Return TRUE if policy is set (and if the policy
is Show, if we have also received the first byte.
* WebView.subproj/WebFramePrivate.m:
(-[WebFrame _transitionProvisionalToCommitted]): Don't call the datasource (it now
calls us)
* WebView.subproj/WebMainResourceClient.m:
(-[WebMainResourceClient WebResourceHandle:resourceDataDidBecomeAvailable:]):
* WebView.subproj/WebView.h, WebView.subproj/WebView.m: move
makeDocumentViewForDataSource...
* WebView.subproj/WebViewPrivate.h, WebView.subproj/WebViewPrivate.m:
(-[WebView _makeDocumentViewForDataSource:]): To here.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1592 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 131bece..f6884fe 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,5 +1,46 @@
2002-07-18 Maciej Stachowiak <mjs at apple.com>
+ Even more exciting refactoring. Change the rules for committing
+ the data source and creating the representation so that both
+ happen when the first byte has been received _and_ the content
+ policy has been set to show. Previously these actions happened at
+ different times. Now we maintain the invariant that the data
+ source has a representation if and only if it is committed.
+
+ * WebView.subproj/WebController.m:
+ (-[WebController haveContentPolicy:andPath:forDataSource:]): Simplify
+ further by putting more of the work in WebDataSource.
+ * WebView.subproj/WebControllerPrivate.m:
+ (-[WebController _mainReceivedProgress:forResourceHandle:fromDataSource:complete:]):
+
+ * WebView.subproj/WebDataSource.h, WebView.subproj/WebDataSource.m: Move
+ makeRepresentation method to private file.
+ * WebView.subproj/WebDataSourcePrivate.h:
+ * WebView.subproj/WebDataSourcePrivate.m:
+ (-[WebDataSource _setContentPolicy:]): If the policy is set to show,
+ commit if we have already gotten the first byte.
+ (-[WebDataSource _commitIfReady]): Create representation and
+ commit if we have the first byte and have a policy of show.
+ (-[WebDataSource _gotFirstByte]): Method to check if this data source
+ has gotten the first byte yet. Commit here if ready.
+ (-[WebDataSource _setGotFirstByte]): Method to report that some
+ data has been received.
+ (-[WebDataSource _makeRepresentation]): Make and set up teh document view too.
+ (-[WebDataSource _isReadyForData]): Return TRUE if policy is set (and if the policy
+ is Show, if we have also received the first byte.
+ * WebView.subproj/WebFramePrivate.m:
+ (-[WebFrame _transitionProvisionalToCommitted]): Don't call the datasource (it now
+ calls us)
+ * WebView.subproj/WebMainResourceClient.m:
+ (-[WebMainResourceClient WebResourceHandle:resourceDataDidBecomeAvailable:]):
+
+ * WebView.subproj/WebView.h, WebView.subproj/WebView.m: move
+ makeDocumentViewForDataSource...
+ * WebView.subproj/WebViewPrivate.h, WebView.subproj/WebViewPrivate.m:
+ (-[WebView _makeDocumentViewForDataSource:]): To here.
+
+2002-07-18 Maciej Stachowiak <mjs at apple.com>
+
Avoid throwing an exception while stopping animations. Image
renders were getting into the array multiple times, which means
the code that iterated over the array backwards could throw an
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index 131bece..f6884fe 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,5 +1,46 @@
2002-07-18 Maciej Stachowiak <mjs at apple.com>
+ Even more exciting refactoring. Change the rules for committing
+ the data source and creating the representation so that both
+ happen when the first byte has been received _and_ the content
+ policy has been set to show. Previously these actions happened at
+ different times. Now we maintain the invariant that the data
+ source has a representation if and only if it is committed.
+
+ * WebView.subproj/WebController.m:
+ (-[WebController haveContentPolicy:andPath:forDataSource:]): Simplify
+ further by putting more of the work in WebDataSource.
+ * WebView.subproj/WebControllerPrivate.m:
+ (-[WebController _mainReceivedProgress:forResourceHandle:fromDataSource:complete:]):
+
+ * WebView.subproj/WebDataSource.h, WebView.subproj/WebDataSource.m: Move
+ makeRepresentation method to private file.
+ * WebView.subproj/WebDataSourcePrivate.h:
+ * WebView.subproj/WebDataSourcePrivate.m:
+ (-[WebDataSource _setContentPolicy:]): If the policy is set to show,
+ commit if we have already gotten the first byte.
+ (-[WebDataSource _commitIfReady]): Create representation and
+ commit if we have the first byte and have a policy of show.
+ (-[WebDataSource _gotFirstByte]): Method to check if this data source
+ has gotten the first byte yet. Commit here if ready.
+ (-[WebDataSource _setGotFirstByte]): Method to report that some
+ data has been received.
+ (-[WebDataSource _makeRepresentation]): Make and set up teh document view too.
+ (-[WebDataSource _isReadyForData]): Return TRUE if policy is set (and if the policy
+ is Show, if we have also received the first byte.
+ * WebView.subproj/WebFramePrivate.m:
+ (-[WebFrame _transitionProvisionalToCommitted]): Don't call the datasource (it now
+ calls us)
+ * WebView.subproj/WebMainResourceClient.m:
+ (-[WebMainResourceClient WebResourceHandle:resourceDataDidBecomeAvailable:]):
+
+ * WebView.subproj/WebView.h, WebView.subproj/WebView.m: move
+ makeDocumentViewForDataSource...
+ * WebView.subproj/WebViewPrivate.h, WebView.subproj/WebViewPrivate.m:
+ (-[WebView _makeDocumentViewForDataSource:]): To here.
+
+2002-07-18 Maciej Stachowiak <mjs at apple.com>
+
Avoid throwing an exception while stopping animations. Image
renders were getting into the array multiple times, which means
the code that iterated over the array backwards could throw an
diff --git a/WebKit/WebView.subproj/WebController.m b/WebKit/WebView.subproj/WebController.m
index 5f072ea..f255d94 100644
--- a/WebKit/WebView.subproj/WebController.m
+++ b/WebKit/WebView.subproj/WebController.m
@@ -235,17 +235,15 @@
[NSException raise:NSGenericException format:@"Content policy can only be set once on for a dataSource."];
}
- [dataSource _setContentPolicy:policy];
- [dataSource _setDownloadPath:path];
-
- if (policy == WebContentPolicyShow){
- if ([[self class] canShowMIMEType:[dataSource contentType]]){
- [dataSource makeRepresentation];
- } else {
- WebError *error = [[WebError alloc] initWithErrorCode:WebErrorCannotShowMIMEType
+ if (policy == WebContentPolicyShow &&
+ ![[self class] canShowMIMEType:[dataSource contentType]]) {
+
+ WebError *error = [[WebError alloc] initWithErrorCode:WebErrorCannotShowMIMEType
inDomain:WebErrorDomainWebKit failingURL: [dataSource inputURL]];
- [[self policyHandler] unableToImplementContentPolicy:error forDataSource:dataSource];
- }
+ [[self policyHandler] unableToImplementContentPolicy:error forDataSource:dataSource];
+ } else {
+ [dataSource _setContentPolicy:policy];
+ [dataSource _setDownloadPath:path];
}
}
diff --git a/WebKit/WebView.subproj/WebControllerPrivate.m b/WebKit/WebView.subproj/WebControllerPrivate.m
index a47cd0b..a32ea07 100644
--- a/WebKit/WebView.subproj/WebControllerPrivate.m
+++ b/WebKit/WebView.subproj/WebControllerPrivate.m
@@ -94,14 +94,6 @@
if (frame == nil)
return;
- // Check to see if this is these are the first bits of a provisional data source,
- // if so we need to transition the data source from provisional to committed.
- // This transition is only done for the WebContentPolicyShow policy.
- if([frame provisionalDataSource] == dataSource && [dataSource contentPolicy] == WebContentPolicyShow){
- WEBKITDEBUGLEVEL (WEBKIT_LOG_LOADING, "committing resource = %s\n", [[[dataSource inputURL] absoluteString] cString]);
- [frame _transitionProvisionalToCommitted];
- }
-
// This resouce has completed, so check if the load is complete for all frames.
if (isComplete){
// If the load is complete, mark the primary load as done. The primary load is the load
diff --git a/WebKit/WebView.subproj/WebDataSource.h b/WebKit/WebView.subproj/WebDataSource.h
index e9159e3..1e38a1c 100644
--- a/WebKit/WebView.subproj/WebDataSource.h
+++ b/WebKit/WebView.subproj/WebDataSource.h
@@ -173,6 +173,4 @@
+ (void) registerRepresentationClass:(Class)repClass forMIMEType:(NSString *)MIMEType;
-- (void) makeRepresentation;
-
@end
diff --git a/WebKit/WebView.subproj/WebDataSource.m b/WebKit/WebView.subproj/WebDataSource.m
index 3ed0c6a..11df412 100644
--- a/WebKit/WebView.subproj/WebDataSource.m
+++ b/WebKit/WebView.subproj/WebDataSource.m
@@ -346,16 +346,4 @@
[[self _repTypes] setObject:repClass forKey:MIMEType];
}
-- (void) makeRepresentation
-{
- Class repClass = [self _representationClass];
-
- // Check if the data source was already bound?
- if (![[self representation] isKindOfClass:repClass]) {
- [self _setRepresentation:repClass != nil ? [[repClass alloc] init] : nil];
- }
-
- [[[self webFrame] webView] makeDocumentViewForDataSource:self];
-}
-
@end
diff --git a/WebKit/WebView.subproj/WebDataSourcePrivate.h b/WebKit/WebView.subproj/WebDataSourcePrivate.h
index 2f201ad..e1af454 100644
--- a/WebKit/WebView.subproj/WebDataSourcePrivate.h
+++ b/WebKit/WebView.subproj/WebDataSourcePrivate.h
@@ -68,6 +68,7 @@
BOOL loading; // self and controller are retained while loading
+ BOOL gotFirstByte; // got first byte
BOOL committed; // This data source has been committed
}
@@ -107,5 +108,9 @@
// This returns nil if the representation is not an WebHTMLRepresentation.
- (WebBridge *)_bridge;
-- (void)_commit;
+- (void)_commitIfReady;
+- (void)_makeRepresentation;
+- (void)_setGotFirstByte;
+- (BOOL)_gotFirstByte;
+- (BOOL)_isReadyForData;
@end
diff --git a/WebKit/WebView.subproj/WebDataSourcePrivate.m b/WebKit/WebView.subproj/WebDataSourcePrivate.m
index fdafd56..e26cd57 100644
--- a/WebKit/WebView.subproj/WebDataSourcePrivate.m
+++ b/WebKit/WebView.subproj/WebDataSourcePrivate.m
@@ -19,7 +19,7 @@
#import <WebKit/WebController.h>
#import <WebKit/WebBridge.h>
#import <WebKit/WebFramePrivate.h>
-#import <WebKit/WebView.h>
+#import <WebKit/WebViewPrivate.h>
#import <WebKit/WebKitDebug.h>
#import <WebFoundation/WebError.h>
@@ -293,6 +293,7 @@
- (void) _setContentPolicy:(WebContentPolicy)policy
{
_private->contentPolicy = policy;
+ [self _commitIfReady];
}
- (void)_setContentType:(NSString *)type
@@ -411,9 +412,48 @@
return [representation respondsToSelector:@selector(_bridge)] ? [representation _bridge] : nil;
}
--(void)_commit
+-(void)_commitIfReady
{
- _private->committed = TRUE;
+ if (_private->contentPolicy == WebContentPolicyShow && _private->gotFirstByte) {
+ WEBKITDEBUGLEVEL (WEBKIT_LOG_LOADING, "committed resource = %s\n", [[[self inputURL] absoluteString] cString]);
+ _private->committed = TRUE;
+ [self _makeRepresentation];
+ [[self webFrame] _transitionProvisionalToCommitted];
+ }
+}
+
+-(BOOL)_gotFirstByte
+{
+ return _private->gotFirstByte;
+}
+
+-(void)_setGotFirstByte
+{
+ _private->gotFirstByte = TRUE;
+ [self _commitIfReady];
+}
+
+
+-(void)_makeRepresentation
+{
+ Class repClass = [self _representationClass];
+
+ // Check if the data source was already bound?
+ if (![[self representation] isKindOfClass:repClass]) {
+ [self _setRepresentation:(id<WebDocumentRepresentation>)(repClass != nil ? [[repClass alloc] init] : nil)];
+ }
+
+ [[[self webFrame] webView] _makeDocumentViewForDataSource:self];
+}
+
+-(BOOL)_isReadyForData
+{
+ // The data source is ready for data when the content policy is
+ // determined, and if the policy is show, if it has been committed
+ // (so that we know it's representation and such are ready).
+
+ return _private->contentPolicy != WebContentPolicyNone &&
+ (_private->committed || _private->contentPolicy != WebContentPolicyShow);
}
@end
diff --git a/WebKit/WebView.subproj/WebFramePrivate.m b/WebKit/WebView.subproj/WebFramePrivate.m
index 6dbf212..dadecc9 100644
--- a/WebKit/WebView.subproj/WebFramePrivate.m
+++ b/WebKit/WebView.subproj/WebFramePrivate.m
@@ -224,8 +224,6 @@ static const char * const stateNames[6] = {
// Set the committed data source on the frame.
[self _setDataSource: _private->provisionalDataSource];
- [_private->provisionalDataSource _commit];
-
// provisionalDataSourceCommitted: will reset the view and begin trying to
// display the new new datasource.
[documentView provisionalDataSourceCommitted: _private->provisionalDataSource];
diff --git a/WebKit/WebView.subproj/WebFrameView.h b/WebKit/WebView.subproj/WebFrameView.h
index 751f921..54092d3 100644
--- a/WebKit/WebView.subproj/WebFrameView.h
+++ b/WebKit/WebView.subproj/WebFrameView.h
@@ -40,6 +40,4 @@
// The view must conform to the WebDocumentLoading protocol
+ (void)registerViewClass:(Class)viewClass forMIMEType:(NSString *)MIMEType;
--(void)makeDocumentViewForDataSource:(WebDataSource *)dataSource;
-
@end
diff --git a/WebKit/WebView.subproj/WebFrameView.m b/WebKit/WebView.subproj/WebFrameView.m
index 8d5bcf8..4937b15 100644
--- a/WebKit/WebView.subproj/WebFrameView.m
+++ b/WebKit/WebView.subproj/WebFrameView.m
@@ -200,14 +200,6 @@ enum {
[[self _viewTypes] setObject:viewClass forKey:MIMEType];
}
--(void)makeDocumentViewForDataSource:(WebDataSource *)dataSource
-{
- Class viewClass = [[[self class] _viewTypes] _web_objectForMIMEType:[dataSource contentType]];
- [self _setDocumentView: (id<WebDocumentLoading>)(viewClass ? [[[viewClass alloc] init] autorelease] : nil)];
-
- [[self documentView] provisionalDataSourceChanged:dataSource];
-}
-
-(BOOL)acceptsFirstResponder
{
return YES;
diff --git a/WebKit/WebView.subproj/WebFrameViewInternal.h b/WebKit/WebView.subproj/WebFrameViewInternal.h
index 3f68e21..945711e 100644
--- a/WebKit/WebView.subproj/WebFrameViewInternal.h
+++ b/WebKit/WebView.subproj/WebFrameViewInternal.h
@@ -29,6 +29,7 @@
@interface WebView (WebPrivate)
- (void)_setDocumentView:(id <WebDocumentLoading>)view;
+- (void)_makeDocumentViewForDataSource:(WebDataSource *)dataSource;
- (void)_setController:(WebController *)controller;
- (WebController *)_controller;
- (int)_marginWidth;
diff --git a/WebKit/WebView.subproj/WebFrameViewPrivate.h b/WebKit/WebView.subproj/WebFrameViewPrivate.h
index 3f68e21..945711e 100644
--- a/WebKit/WebView.subproj/WebFrameViewPrivate.h
+++ b/WebKit/WebView.subproj/WebFrameViewPrivate.h
@@ -29,6 +29,7 @@
@interface WebView (WebPrivate)
- (void)_setDocumentView:(id <WebDocumentLoading>)view;
+- (void)_makeDocumentViewForDataSource:(WebDataSource *)dataSource;
- (void)_setController:(WebController *)controller;
- (WebController *)_controller;
- (int)_marginWidth;
diff --git a/WebKit/WebView.subproj/WebFrameViewPrivate.m b/WebKit/WebView.subproj/WebFrameViewPrivate.m
index 7fe10f0..54a5b02 100644
--- a/WebKit/WebView.subproj/WebFrameViewPrivate.m
+++ b/WebKit/WebView.subproj/WebFrameViewPrivate.m
@@ -9,6 +9,8 @@
#import <WebKit/WebViewPrivate.h>
#import <WebKit/WebKitDebug.h>
+#import <WebKit/WebDataSource.h>
+#import <WebKit/WebDocument.h>
#import <WebKit/WebDynamicScrollBarsView.h>
#import <WebKit/WebController.h>
#import <WebKit/WebHTMLView.h>
@@ -65,6 +67,14 @@
[[self frameScrollView] setDocumentView: view];
}
+-(void)_makeDocumentViewForDataSource:(WebDataSource *)dataSource
+{
+ Class viewClass = [[[self class] _viewTypes] _web_objectForMIMEType:[dataSource contentType]];
+ [self _setDocumentView: (id<WebDocumentLoading>)(viewClass ? [[[viewClass alloc] init] autorelease] : nil)];
+
+ [[self documentView] provisionalDataSourceChanged:dataSource];
+}
+
- (void)_setController: (WebController *)controller
{
// Not retained; the controller owns the view.
diff --git a/WebKit/WebView.subproj/WebMainResourceClient.m b/WebKit/WebView.subproj/WebMainResourceClient.m
index 09f99fd..595f20a 100644
--- a/WebKit/WebView.subproj/WebMainResourceClient.m
+++ b/WebKit/WebView.subproj/WebMainResourceClient.m
@@ -190,46 +190,53 @@
WEBKITDEBUGLEVEL(WEBKIT_LOG_DOWNLOAD, "main content type: %s", DEBUG_OBJECT(contentType));
}
+
+ // Check to see if this is these are the first bits of a provisional data source,
+ // if so we need to tell the data source it got the first byte.
+ // It will transition from provisional to committed when and if it gets a policy of
+ // WebContentPolicyShow policy.
+ if(![dataSource _gotFirstByte]) {
+ WEBKITDEBUGLEVEL (WEBKIT_LOG_LOADING, "got first byte for resource = %s\n", [[[dataSource inputURL] absoluteString] cString]);
+ [dataSource _setGotFirstByte];
+ }
WebContentPolicy contentPolicy = [dataSource contentPolicy];
- if(contentPolicy != WebContentPolicyNone){
- if(!processedBufferedData){
- // Process all data that has been received now that we have a content policy
- // and don't call resourceData if this is the first chunk since resourceData is a copy
- if(isFirstChunk){
- data = incomingData;
- }else{
- data = [handle resourceData];
- }
- processedBufferedData = YES;
- }else{
+ if([dataSource _isReadyForData]){
+ if (!processedBufferedData && !isFirstChunk) {
+ // Process all data that has been received now that we are ready for data
+ data = [handle resourceData];
+ } else {
data = incomingData;
}
+
+ processedBufferedData = YES;
+
+ switch (contentPolicy) {
+ case WebContentPolicyShow:
+ [[dataSource representation] receivedData:data withDataSource:dataSource];
+ [[view documentView] dataSourceUpdated:dataSource];
+ break;
+ case WebContentPolicySave:
+ case WebContentPolicySaveAndOpenExternally:
+ if (!downloadHandler) {
+ [frame _setProvisionalDataSource:nil];
+ [[dataSource _locationChangeHandler] locationChangeDone:nil forDataSource:dataSource];
+ downloadHandler = [[WebDownloadHandler alloc] initWithDataSource:dataSource];
+ }
+ [downloadHandler receivedData:data];
+ break;
+ case WebContentPolicyIgnore:
+ [handle cancelLoadInBackground];
+ [frame _setProvisionalDataSource:nil];
+ [[dataSource _locationChangeHandler] locationChangeDone:nil forDataSource:dataSource];
+ break;
+ default:
+ [NSException raise:NSInvalidArgumentException format:
+ @"haveContentPolicy: andPath:path forDataSource: set an invalid content policy."];
+ }
}
-
- if(contentPolicy == WebContentPolicyShow){
- [[dataSource representation] receivedData:data withDataSource:dataSource];
- [[view documentView] dataSourceUpdated:dataSource];
- }
- else if(contentPolicy == WebContentPolicySave || contentPolicy == WebContentPolicySaveAndOpenExternally){
- if(!downloadHandler){
- [frame _setProvisionalDataSource:nil];
- [[dataSource _locationChangeHandler] locationChangeDone:nil forDataSource:dataSource];
- downloadHandler = [[WebDownloadHandler alloc] initWithDataSource:dataSource];
- }
- [downloadHandler receivedData:data];
- }
- else if(contentPolicy == WebContentPolicyIgnore){
- [handle cancelLoadInBackground];
- [frame _setProvisionalDataSource:nil];
- [[dataSource _locationChangeHandler] locationChangeDone:nil forDataSource:dataSource];
- }
- else{
- [NSException raise:NSInvalidArgumentException format:
- @"haveContentPolicy: andPath:path forDataSource: set an invalid content policy."];
- }
-
+
[self receivedProgressWithHandle:handle complete:NO];
WEBKITDEBUGLEVEL(WEBKIT_LOG_DOWNLOAD, "%d of %d", [handle contentLengthReceived], [handle contentLength]);
diff --git a/WebKit/WebView.subproj/WebMainResourceLoader.m b/WebKit/WebView.subproj/WebMainResourceLoader.m
index 09f99fd..595f20a 100644
--- a/WebKit/WebView.subproj/WebMainResourceLoader.m
+++ b/WebKit/WebView.subproj/WebMainResourceLoader.m
@@ -190,46 +190,53 @@
WEBKITDEBUGLEVEL(WEBKIT_LOG_DOWNLOAD, "main content type: %s", DEBUG_OBJECT(contentType));
}
+
+ // Check to see if this is these are the first bits of a provisional data source,
+ // if so we need to tell the data source it got the first byte.
+ // It will transition from provisional to committed when and if it gets a policy of
+ // WebContentPolicyShow policy.
+ if(![dataSource _gotFirstByte]) {
+ WEBKITDEBUGLEVEL (WEBKIT_LOG_LOADING, "got first byte for resource = %s\n", [[[dataSource inputURL] absoluteString] cString]);
+ [dataSource _setGotFirstByte];
+ }
WebContentPolicy contentPolicy = [dataSource contentPolicy];
- if(contentPolicy != WebContentPolicyNone){
- if(!processedBufferedData){
- // Process all data that has been received now that we have a content policy
- // and don't call resourceData if this is the first chunk since resourceData is a copy
- if(isFirstChunk){
- data = incomingData;
- }else{
- data = [handle resourceData];
- }
- processedBufferedData = YES;
- }else{
+ if([dataSource _isReadyForData]){
+ if (!processedBufferedData && !isFirstChunk) {
+ // Process all data that has been received now that we are ready for data
+ data = [handle resourceData];
+ } else {
data = incomingData;
}
+
+ processedBufferedData = YES;
+
+ switch (contentPolicy) {
+ case WebContentPolicyShow:
+ [[dataSource representation] receivedData:data withDataSource:dataSource];
+ [[view documentView] dataSourceUpdated:dataSource];
+ break;
+ case WebContentPolicySave:
+ case WebContentPolicySaveAndOpenExternally:
+ if (!downloadHandler) {
+ [frame _setProvisionalDataSource:nil];
+ [[dataSource _locationChangeHandler] locationChangeDone:nil forDataSource:dataSource];
+ downloadHandler = [[WebDownloadHandler alloc] initWithDataSource:dataSource];
+ }
+ [downloadHandler receivedData:data];
+ break;
+ case WebContentPolicyIgnore:
+ [handle cancelLoadInBackground];
+ [frame _setProvisionalDataSource:nil];
+ [[dataSource _locationChangeHandler] locationChangeDone:nil forDataSource:dataSource];
+ break;
+ default:
+ [NSException raise:NSInvalidArgumentException format:
+ @"haveContentPolicy: andPath:path forDataSource: set an invalid content policy."];
+ }
}
-
- if(contentPolicy == WebContentPolicyShow){
- [[dataSource representation] receivedData:data withDataSource:dataSource];
- [[view documentView] dataSourceUpdated:dataSource];
- }
- else if(contentPolicy == WebContentPolicySave || contentPolicy == WebContentPolicySaveAndOpenExternally){
- if(!downloadHandler){
- [frame _setProvisionalDataSource:nil];
- [[dataSource _locationChangeHandler] locationChangeDone:nil forDataSource:dataSource];
- downloadHandler = [[WebDownloadHandler alloc] initWithDataSource:dataSource];
- }
- [downloadHandler receivedData:data];
- }
- else if(contentPolicy == WebContentPolicyIgnore){
- [handle cancelLoadInBackground];
- [frame _setProvisionalDataSource:nil];
- [[dataSource _locationChangeHandler] locationChangeDone:nil forDataSource:dataSource];
- }
- else{
- [NSException raise:NSInvalidArgumentException format:
- @"haveContentPolicy: andPath:path forDataSource: set an invalid content policy."];
- }
-
+
[self receivedProgressWithHandle:handle complete:NO];
WEBKITDEBUGLEVEL(WEBKIT_LOG_DOWNLOAD, "%d of %d", [handle contentLengthReceived], [handle contentLength]);
diff --git a/WebKit/WebView.subproj/WebView.m b/WebKit/WebView.subproj/WebView.m
index 5f072ea..f255d94 100644
--- a/WebKit/WebView.subproj/WebView.m
+++ b/WebKit/WebView.subproj/WebView.m
@@ -235,17 +235,15 @@
[NSException raise:NSGenericException format:@"Content policy can only be set once on for a dataSource."];
}
- [dataSource _setContentPolicy:policy];
- [dataSource _setDownloadPath:path];
-
- if (policy == WebContentPolicyShow){
- if ([[self class] canShowMIMEType:[dataSource contentType]]){
- [dataSource makeRepresentation];
- } else {
- WebError *error = [[WebError alloc] initWithErrorCode:WebErrorCannotShowMIMEType
+ if (policy == WebContentPolicyShow &&
+ ![[self class] canShowMIMEType:[dataSource contentType]]) {
+
+ WebError *error = [[WebError alloc] initWithErrorCode:WebErrorCannotShowMIMEType
inDomain:WebErrorDomainWebKit failingURL: [dataSource inputURL]];
- [[self policyHandler] unableToImplementContentPolicy:error forDataSource:dataSource];
- }
+ [[self policyHandler] unableToImplementContentPolicy:error forDataSource:dataSource];
+ } else {
+ [dataSource _setContentPolicy:policy];
+ [dataSource _setDownloadPath:path];
}
}
diff --git a/WebKit/WebView.subproj/WebViewPrivate.m b/WebKit/WebView.subproj/WebViewPrivate.m
index a47cd0b..a32ea07 100644
--- a/WebKit/WebView.subproj/WebViewPrivate.m
+++ b/WebKit/WebView.subproj/WebViewPrivate.m
@@ -94,14 +94,6 @@
if (frame == nil)
return;
- // Check to see if this is these are the first bits of a provisional data source,
- // if so we need to transition the data source from provisional to committed.
- // This transition is only done for the WebContentPolicyShow policy.
- if([frame provisionalDataSource] == dataSource && [dataSource contentPolicy] == WebContentPolicyShow){
- WEBKITDEBUGLEVEL (WEBKIT_LOG_LOADING, "committing resource = %s\n", [[[dataSource inputURL] absoluteString] cString]);
- [frame _transitionProvisionalToCommitted];
- }
-
// This resouce has completed, so check if the load is complete for all frames.
if (isComplete){
// If the load is complete, mark the primary load as done. The primary load is the load
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list