[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
cblu
cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:27:29 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 2d17fd852ee789af09b3fcadb8cc44726d3a9f5a
Author: cblu <cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Feb 25 01:30:14 2004 +0000
Tests:
Added support for WebHTMLPboardType.
Reviewed by rjw.
* PasteboardViewer/PasteboardViewer.xcode/project.pbxproj:
* PasteboardViewer/WindowController.m:
(-[WindowController pasteboardTypes]):
(-[WindowController reflectSelection]):
WebKit:
Fixed: <rdar://problem/3565476>: design/implement new pasteboard type for HTML that includes subresources
Reviewed by rjw.
* Plugins.subproj/WebNetscapePluginStream.m:
(-[WebNetscapePluginConnectionDelegate initWithStream:view:]): don't manage buffer, WebBaseResourceHandleDelegate does this now
(-[WebNetscapePluginConnectionDelegate releaseResources]): ditto
(-[WebNetscapePluginConnectionDelegate connection:didReceiveData:lengthReceived:]): ditto
(-[WebNetscapePluginConnectionDelegate connectionDidFinishLoading:]): ditto
* WebKit.exp:
* WebKit.pbproj/project.pbxproj:
* WebView.subproj/WebBaseResourceHandleDelegate.h:
* WebView.subproj/WebBaseResourceHandleDelegate.m:
(-[WebBaseResourceHandleDelegate releaseResources]): release resourceData and resource
(-[WebBaseResourceHandleDelegate loadWithRequest:]): check the dataSource for a resource, load that if we have one
(-[WebBaseResourceHandleDelegate addData:]): new, adds data to resourceData
(-[WebBaseResourceHandleDelegate saveResource]): new, saves data as a resource on the dataSource
(-[WebBaseResourceHandleDelegate saveResourceWithCachedResponse:]): new, replaces the resource on the dataSource to save memory
(-[WebBaseResourceHandleDelegate resourceData]): new
(-[WebBaseResourceHandleDelegate connection:didReceiveData:lengthReceived:]): call addData:
(-[WebBaseResourceHandleDelegate connectionDidFinishLoading:]): call saveResource
(-[WebBaseResourceHandleDelegate connection:willCacheResponse:]): new, calls saveResourceWithCachedResponse:
* WebView.subproj/WebDataSource.m:
(-[WebDataSourcePrivate dealloc]): release subresources
(-[WebDataSource subresources]): new, returns the subresources of the data source
(-[WebDataSource subresourceForURL:]): new, returns a resource for a URL
(-[WebDataSource addSubresource:]): new
(-[WebDataSource addSubresources:]): new
(-[WebDataSource _receivedData:]): added an assert
(-[WebDataSource _setData:]): replaces the data of the data source
(-[WebDataSource initWithRequest:]): create subresources
* WebView.subproj/WebDataSourcePrivate.h:
* WebView.subproj/WebFrame.m:
(-[WebFrame loadHTMLPropertyList:]): new, loads a frame from an HTML plist
(-[WebFrame _webDataRequestForData:MIMEType:textEncodingName:baseURL:]): new, factored out from loadData:MIMEType:textEncodingName:baseURL:
(-[WebFrame _loadRequest:subresources:]): new, factored out from loadRequest:, handles subresources
(-[WebFrame loadRequest:]): now just calls _loadRequest:subresources:
* WebView.subproj/WebFramePrivate.h:
* WebView.subproj/WebHTMLView.m:
(-[WebHTMLView _dataSource]): new internal convenience
(+[WebHTMLView _selectionPasteboardTypes]): renamed from _pasteboardTypes to be more precise
(-[WebHTMLView _selectedHTMLPropertyList:]): new, constructs an HTML plist from the selection
(-[WebHTMLView _writeSelectionToPasteboard:]): calls _selectedHTMLPropertyList to support WebHTMLPboardType
(-[WebHTMLView _pasteHTMLFromPasteboard:]): added support for pasting WebHTMLPboardType
(+[WebHTMLView initialize]): call renamed _selectionPasteboardTypes
(-[WebHTMLView initWithFrame:]): allow WebHTMLPboardType to be dragged in
(-[WebHTMLView validRequestorForSendType:returnType:]): call renamed _selectionPasteboardTypes
* WebView.subproj/WebHTMLViewPrivate.h:
* WebView.subproj/WebMainResourceClient.m:
(-[WebMainResourceClient addData:]): override since the main resource does it's own buffering
(-[WebMainResourceClient saveResource]): override to do nothing since the main resource is not saved as a subresource
(-[WebMainResourceClient saveResourceWithCachedResponse:]): override, calls _setData on the data source to
(-[WebMainResourceClient connection:didReceiveData:lengthReceived:]):
* WebView.subproj/WebResource.h: Added.
* WebView.subproj/WebResource.m: Added. New class the represents the data, URL, MIME type and textEncodingName of a resource.
(-[WebResourcePrivate dealloc]):
(-[WebResource initWithData:URL:MIMEType:textEncodingName:]):
(-[WebResource dealloc]):
(-[WebResource data]):
(-[WebResource URL]):
(-[WebResource MIMEType]):
(-[WebResource textEncodingName]):
(-[WebResource description]):
(+[WebResource _resourcesFromPropertyLists:]):
(+[WebResource _propertyListsFromResources:]):
(-[WebResource _initWithPropertyList:]):
(-[WebResource _propertyListRepresentation]):
(-[WebResource _initWithCachedResponse:originalURL:]):
(-[WebResource _cachedResponseRepresentation]):
* WebView.subproj/WebResourcePrivate.h: Added.
* WebView.subproj/WebView.m:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@6114 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 9811249..8d3ee26 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,77 @@
+2004-02-24 Chris Blumenberg <cblu at apple.com>
+
+ Fixed: <rdar://problem/3565476>: design/implement new pasteboard type for HTML that includes subresources
+
+ Reviewed by rjw.
+
+ * Plugins.subproj/WebNetscapePluginStream.m:
+ (-[WebNetscapePluginConnectionDelegate initWithStream:view:]): don't manage buffer, WebBaseResourceHandleDelegate does this now
+ (-[WebNetscapePluginConnectionDelegate releaseResources]): ditto
+ (-[WebNetscapePluginConnectionDelegate connection:didReceiveData:lengthReceived:]): ditto
+ (-[WebNetscapePluginConnectionDelegate connectionDidFinishLoading:]): ditto
+ * WebKit.exp:
+ * WebKit.pbproj/project.pbxproj:
+ * WebView.subproj/WebBaseResourceHandleDelegate.h:
+ * WebView.subproj/WebBaseResourceHandleDelegate.m:
+ (-[WebBaseResourceHandleDelegate releaseResources]): release resourceData and resource
+ (-[WebBaseResourceHandleDelegate loadWithRequest:]): check the dataSource for a resource, load that if we have one
+ (-[WebBaseResourceHandleDelegate addData:]): new, adds data to resourceData
+ (-[WebBaseResourceHandleDelegate saveResource]): new, saves data as a resource on the dataSource
+ (-[WebBaseResourceHandleDelegate saveResourceWithCachedResponse:]): new, replaces the resource on the dataSource to save memory
+ (-[WebBaseResourceHandleDelegate resourceData]): new
+ (-[WebBaseResourceHandleDelegate connection:didReceiveData:lengthReceived:]): call addData:
+ (-[WebBaseResourceHandleDelegate connectionDidFinishLoading:]): call saveResource
+ (-[WebBaseResourceHandleDelegate connection:willCacheResponse:]): new, calls saveResourceWithCachedResponse:
+ * WebView.subproj/WebDataSource.m:
+ (-[WebDataSourcePrivate dealloc]): release subresources
+ (-[WebDataSource subresources]): new, returns the subresources of the data source
+ (-[WebDataSource subresourceForURL:]): new, returns a resource for a URL
+ (-[WebDataSource addSubresource:]): new
+ (-[WebDataSource addSubresources:]): new
+ (-[WebDataSource _receivedData:]): added an assert
+ (-[WebDataSource _setData:]): replaces the data of the data source
+ (-[WebDataSource initWithRequest:]): create subresources
+ * WebView.subproj/WebDataSourcePrivate.h:
+ * WebView.subproj/WebFrame.m:
+ (-[WebFrame loadHTMLPropertyList:]): new, loads a frame from an HTML plist
+ (-[WebFrame _webDataRequestForData:MIMEType:textEncodingName:baseURL:]): new, factored out from loadData:MIMEType:textEncodingName:baseURL:
+ (-[WebFrame _loadRequest:subresources:]): new, factored out from loadRequest:, handles subresources
+ (-[WebFrame loadRequest:]): now just calls _loadRequest:subresources:
+ * WebView.subproj/WebFramePrivate.h:
+ * WebView.subproj/WebHTMLView.m:
+ (-[WebHTMLView _dataSource]): new internal convenience
+ (+[WebHTMLView _selectionPasteboardTypes]): renamed from _pasteboardTypes to be more precise
+ (-[WebHTMLView _selectedHTMLPropertyList:]): new, constructs an HTML plist from the selection
+ (-[WebHTMLView _writeSelectionToPasteboard:]): calls _selectedHTMLPropertyList to support WebHTMLPboardType
+ (-[WebHTMLView _pasteHTMLFromPasteboard:]): added support for pasting WebHTMLPboardType
+ (+[WebHTMLView initialize]): call renamed _selectionPasteboardTypes
+ (-[WebHTMLView initWithFrame:]): allow WebHTMLPboardType to be dragged in
+ (-[WebHTMLView validRequestorForSendType:returnType:]): call renamed _selectionPasteboardTypes
+ * WebView.subproj/WebHTMLViewPrivate.h:
+ * WebView.subproj/WebMainResourceClient.m:
+ (-[WebMainResourceClient addData:]): override since the main resource does it's own buffering
+ (-[WebMainResourceClient saveResource]): override to do nothing since the main resource is not saved as a subresource
+ (-[WebMainResourceClient saveResourceWithCachedResponse:]): override, calls _setData on the data source to
+ (-[WebMainResourceClient connection:didReceiveData:lengthReceived:]):
+ * WebView.subproj/WebResource.h: Added.
+ * WebView.subproj/WebResource.m: Added. New class the represents the data, URL, MIME type and textEncodingName of a resource.
+ (-[WebResourcePrivate dealloc]):
+ (-[WebResource initWithData:URL:MIMEType:textEncodingName:]):
+ (-[WebResource dealloc]):
+ (-[WebResource data]):
+ (-[WebResource URL]):
+ (-[WebResource MIMEType]):
+ (-[WebResource textEncodingName]):
+ (-[WebResource description]):
+ (+[WebResource _resourcesFromPropertyLists:]):
+ (+[WebResource _propertyListsFromResources:]):
+ (-[WebResource _initWithPropertyList:]):
+ (-[WebResource _propertyListRepresentation]):
+ (-[WebResource _initWithCachedResponse:originalURL:]):
+ (-[WebResource _cachedResponseRepresentation]):
+ * WebView.subproj/WebResourcePrivate.h: Added.
+ * WebView.subproj/WebView.m:
+
=== Safari-129 ===
2004-02-20 Darin Adler <darin at apple.com>
diff --git a/WebKit/Plugins.subproj/WebNetscapePluginStream.m b/WebKit/Plugins.subproj/WebNetscapePluginStream.m
index 28d1bde..74b5ebe 100644
--- a/WebKit/Plugins.subproj/WebNetscapePluginStream.m
+++ b/WebKit/Plugins.subproj/WebNetscapePluginStream.m
@@ -21,7 +21,6 @@
{
WebNetscapePluginStream *stream;
WebBaseNetscapePluginView *view;
- NSMutableData *resourceData;
}
- initWithStream:(WebNetscapePluginStream *)theStream view:(WebBaseNetscapePluginView *)theView;
@end
@@ -93,7 +92,6 @@
[super init];
stream = [theStream retain];
view = [theView retain];
- resourceData = [[NSMutableData alloc] init];
return self;
}
@@ -103,8 +101,6 @@
stream = nil;
[view release];
view = nil;
- [resourceData release];
- resourceData = nil;
[super releaseResources];
}
@@ -137,10 +133,6 @@
// 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];
- if ([stream transferMode] == NP_ASFILE || [stream transferMode] == NP_ASFILEONLY) {
- [resourceData appendData:data];
- }
-
[stream receivedData:data];
[super connection:con didReceiveData:data lengthReceived:lengthReceived];
[self release];
@@ -153,7 +145,7 @@
[[self dataSource] _removePlugInStreamClient:self];
[[view webView] _finishedLoadingResourceFromDataSource:[self dataSource]];
- [stream finishedLoadingWithData:resourceData];
+ [stream finishedLoadingWithData:[self resourceData]];
[super connectionDidFinishLoading:con];
[self release];
diff --git a/WebKit/WebKit.exp b/WebKit/WebKit.exp
index 2fcea20..e41413c 100644
--- a/WebKit/WebKit.exp
+++ b/WebKit/WebKit.exp
@@ -50,6 +50,7 @@ _WebHistoryItemsRemovedNotification
_WebHistoryLoadedNotification
_WebHistorySavedNotification
_WebHistoryItemChangedNotification
+_WebHTMLPboardType
_WebIconDatabaseDidAddIconNotification
_WebIconDatabaseDirectoryDefaultsKey
_WebIconLargeSize
diff --git a/WebKit/WebKit.pbproj/project.pbxproj b/WebKit/WebKit.pbproj/project.pbxproj
index e96d967..505fa46 100644
--- a/WebKit/WebKit.pbproj/project.pbxproj
+++ b/WebKit/WebKit.pbproj/project.pbxproj
@@ -328,6 +328,8 @@
84723BE5056D719E0044BFEA,
830E81850585375700AD0891,
EDD1A5C805C83987008E3150,
+ 84311A1405EAAAF00088EDA4,
+ 84311AF205EAB12B0088EDA4,
);
isa = PBXHeadersBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
@@ -446,6 +448,7 @@
84723BE6056D719E0044BFEA,
830E81860585375700AD0891,
EDD1A5C905C83987008E3150,
+ 84311A1505EAAAF00088EDA4,
);
isa = PBXSourcesBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
@@ -2111,6 +2114,54 @@
//842
//843
//844
+ 84311A1205EAAAF00088EDA4 = {
+ fileEncoding = 4;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = WebResource.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ 84311A1305EAAAF00088EDA4 = {
+ fileEncoding = 4;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.objc;
+ path = WebResource.m;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ 84311A1405EAAAF00088EDA4 = {
+ fileRef = 84311A1205EAAAF00088EDA4;
+ isa = PBXBuildFile;
+ settings = {
+ ATTRIBUTES = (
+ Private,
+ );
+ };
+ };
+ 84311A1505EAAAF00088EDA4 = {
+ fileRef = 84311A1305EAAAF00088EDA4;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ 84311AF105EAB12B0088EDA4 = {
+ fileEncoding = 4;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = WebResourcePrivate.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ 84311AF205EAB12B0088EDA4 = {
+ fileRef = 84311AF105EAB12B0088EDA4;
+ isa = PBXBuildFile;
+ settings = {
+ ATTRIBUTES = (
+ Private,
+ );
+ };
+ };
8467275C0367158500CA2ACA = {
fileEncoding = 30;
isa = PBXFileReference;
@@ -2639,10 +2690,10 @@
3944606C020F50ED0ECA1767,
2D81DAB203EB0B2D00A80166,
2D81DAB303EB0B2D00A80166,
+ 5152FAE5033FC52200CA2ACD,
2D36FD5E03F78F9E00A80166,
39446074020F50ED0ECA1767,
F5143A370221DCCE01A80181,
- 5152FAE5033FC52200CA2ACD,
9CF0E249021361B00ECA16EA,
51A8B52E04282B5900CA2D3A,
51A8B52F04282B5900CA2D3A,
@@ -2655,6 +2706,9 @@
3944606E020F50ED0ECA1767,
F5AEBB3D024A527601C1A526,
9CAE9D070252A4130ECA16EA,
+ 84311A1205EAAAF00088EDA4,
+ 84311A1305EAAAF00088EDA4,
+ 84311AF105EAB12B0088EDA4,
513D422E034CF55A00CA2ACD,
515E27CC0458C86500CA2D3A,
65A7D44A0568AB2600E70EF6,
diff --git a/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.h b/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.h
index c184a47..a54f024 100644
--- a/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.h
+++ b/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.h
@@ -15,6 +15,7 @@
@class NSURLRequest;
@class NSURLResponse;
@class WebDataSource;
+ at class WebResource;
@class WebView;
@interface WebBaseResourceHandleDelegate : NSObject
@@ -35,6 +36,9 @@
BOOL reachedTerminalState;
BOOL defersCallbacks;
WebResourceDelegateImplementationCache implementations;
+ NSURL *originalURL;
+ WebResource *resource;
+ NSMutableData *resourceData;
}
- (BOOL)loadWithRequest:(NSURLRequest *)request;
@@ -58,6 +62,8 @@
- (void)releaseResources;
- (NSURLResponse *)response;
+- (NSData *)resourceData;
+
@end
// Note: This interface can be removed once this method is declared
diff --git a/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.m b/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.m
index b70005d..9aa8ef9 100644
--- a/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.m
+++ b/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.m
@@ -12,15 +12,16 @@
#import <Foundation/NSURLRequestPrivate.h>
#import <Foundation/NSURLResponse.h>
#import <Foundation/NSURLResponsePrivate.h>
-#import <WebKit/WebAssertions.h>
#import <Foundation/NSError_NSURLExtras.h>
+#import <WebKit/WebAssertions.h>
#import <WebKit/WebDataProtocol.h>
#import <WebKit/WebDataSourcePrivate.h>
#import <WebKit/WebDefaultResourceLoadDelegate.h>
#import <WebKit/WebKitErrors.h>
#import <WebKit/WebKitErrorsPrivate.h>
#import <WebKit/WebResourceLoadDelegate.h>
+#import <WebKit/WebResourcePrivate.h>
#import <WebKit/WebViewPrivate.h>
@interface WebBaseResourceHandleDelegate (WebNSURLAuthenticationChallengeSender) <NSURLAuthenticationChallengeSender>
@@ -100,6 +101,12 @@
[downloadDelegate release];
downloadDelegate = nil;
+ [resource release];
+ resource = nil;
+
+ [resourceData release];
+ resourceData = nil;
+
reachedTerminalState = YES;
[self release];
@@ -110,14 +117,30 @@
ASSERT(reachedTerminalState);
[request release];
[response release];
+ [originalURL release];
[super dealloc];
}
- (BOOL)loadWithRequest:(NSURLRequest *)r
{
ASSERT(connection == nil);
+ ASSERT(resource == nil);
+ NSURL *URL = [[r URL] retain];
+ [originalURL release];
+ originalURL = URL;
+
r = [self connection:connection willSendRequest:r redirectResponse:nil];
+
+ if ([[r URL] isEqual:originalURL]) {
+ resource = [dataSource subresourceForURL:originalURL];
+ if (resource) {
+ // FIXME: This is a hack to make Foundation hand us back the data that we're caching. We need something more direct.
+ [resource retain];
+ [[NSURLCache sharedURLCache] storeCachedResponse:[resource _cachedResponseRepresentation] forRequest:r];
+ }
+ }
+
connection = [[NSURLConnection alloc] initWithRequest:r delegate:self];
if (defersCallbacks) {
[connection setDefersCallbacks:YES];
@@ -174,6 +197,43 @@
return downloadDelegate;
}
+- (void)addData:(NSData *)data
+{
+ if (!resource) {
+ if (!resourceData) {
+ resourceData = [[NSMutableData alloc] init];
+ }
+ [resourceData appendData:data];
+ }
+}
+
+- (void)saveResource
+{
+ if (!resource && [resourceData length] > 0) {
+ WebResource *newResource = [[WebResource alloc] initWithData:resourceData
+ URL:originalURL
+ MIMEType:[response MIMEType]
+ textEncodingName:[response textEncodingName]];
+ [dataSource addSubresource:newResource];
+ [newResource release];
+ }
+}
+
+- (void)saveResourceWithCachedResponse:(NSCachedURLResponse *)cachedResponse
+{
+ if (!resource) {
+ // Overwrite the resource saved with saveResource with the cache version to save memory.
+ WebResource *newResource = [[WebResource alloc] _initWithCachedResponse:cachedResponse originalURL:originalURL];
+ [dataSource addSubresource:newResource];
+ [newResource release];
+ }
+}
+
+- (NSData *)resourceData
+{
+ return resource ? [resource data] : resourceData;
+}
+
- (NSURLRequest *)connection:(NSURLConnection *)con willSendRequest:(NSURLRequest *)newRequest redirectResponse:(NSURLResponse *)redirectResponse
{
ASSERT(con == connection);
@@ -327,6 +387,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];
+
+ [self addData:data];
+
[webView _incrementProgressForConnection:con data:data];
if (implementations.delegateImplementsDidReceiveContentLength)
@@ -347,6 +410,8 @@
ASSERT(con == connection);
ASSERT(!reachedTerminalState);
+ [self saveResource];
+
[webView _completeProgressForConnection:con];
if (implementations.delegateImplementsDidFinishLoadingFromDataSource)
@@ -373,6 +438,12 @@
[self release];
}
+- (NSCachedURLResponse *)connection:(NSURLConnection *)connection willCacheResponse:(NSCachedURLResponse *)cachedResponse
+{
+ [self saveResourceWithCachedResponse:cachedResponse];
+ return cachedResponse;
+}
+
- (void)cancelWithError:(NSError *)error
{
ASSERT(!reachedTerminalState);
diff --git a/WebKit/WebView.subproj/WebDataSource.m b/WebKit/WebView.subproj/WebDataSource.m
index b53ebb1..cdb2956 100644
--- a/WebKit/WebView.subproj/WebDataSource.m
+++ b/WebKit/WebView.subproj/WebDataSource.m
@@ -13,6 +13,7 @@
#import <WebKit/WebKitLogging.h>
#import <WebKit/WebKitStatisticsPrivate.h>
#import <WebKit/WebMainResourceClient.h>
+#import <WebKit/WebResourcePrivate.h>
#import <WebKit/WebView.h>
#import <WebKit/WebAssertions.h>
@@ -70,6 +71,7 @@
[lastCheckedRequest release];
[responses release];
[webFrame release];
+ [subresources release];
[super dealloc];
}
@@ -78,6 +80,30 @@
@implementation WebDataSource (WebPrivate)
+- (NSArray *)subresources
+{
+ return [_private->subresources allValues];
+}
+
+- (WebResource *)subresourceForURL:(NSURL *)URL
+{
+ return [_private->subresources objectForKey:[URL _web_originalDataAsString]];
+}
+
+- (void)addSubresource:(WebResource *)subresource
+{
+ [_private->subresources setObject:subresource forKey:[[subresource URL] _web_originalDataAsString]];
+}
+
+- (void)addSubresources:(NSArray *)subresources
+{
+ NSEnumerator *enumerator = [subresources objectEnumerator];
+ WebResource *subresource;
+ while ((subresource = [enumerator nextObject]) != nil) {
+ [self addSubresource:subresource];
+ }
+}
+
- (WebView *)_webView
{
return _private->webView;
@@ -566,6 +592,7 @@
if (!_private->resourceData) {
_private->resourceData = [[NSMutableData alloc] init];
}
+ ASSERT([_private->resourceData isKindOfClass:[NSMutableData class]]);
[_private->resourceData appendData:data];
_private->gotFirstByte = YES;
@@ -580,6 +607,13 @@
[self release];
}
+- (void)_setData:(NSData *)data
+{
+ [data retain];
+ [_private->resourceData release];
+ _private->resourceData = (NSMutableData *)data;
+}
+
- (void)_finishedLoading
{
_private->gotFirstByte = YES;
@@ -826,6 +860,8 @@
_private->originalRequest = [request retain];
_private->originalRequestCopy = [request copy];
+ _private->subresources = [[NSMutableDictionary alloc] init];
+
LOG(Loading, "creating datasource for %@", [request URL]);
_private->request = [_private->originalRequest mutableCopy];
diff --git a/WebKit/WebView.subproj/WebDataSourcePrivate.h b/WebKit/WebView.subproj/WebDataSourcePrivate.h
index a7620b2..7eab448 100644
--- a/WebKit/WebView.subproj/WebDataSourcePrivate.h
+++ b/WebKit/WebView.subproj/WebDataSourcePrivate.h
@@ -16,6 +16,7 @@
@class WebHistoryItem;
@class WebIconLoader;
@class WebMainResourceClient;
+ at class WebResource;
@class WebView;
@protocol WebDocumentRepresentation;
@@ -106,12 +107,20 @@
BOOL loadingFromPageCache;
WebFrame *webFrame;
+
+ NSMutableDictionary *subresources;
}
@end
@interface WebDataSource (WebPrivate)
+// API Considerations:
+- (NSArray *)subresources;
+- (WebResource *)subresourceForURL:(NSURL *)URL;
+- (void)addSubresource:(WebResource *)subresource;
+- (void)addSubresources:(NSArray *)subresources;
+
- (NSError *)_mainDocumentError;
- (NSString *)_stringWithData:(NSData *)data;
- (void)_startLoading;
@@ -158,6 +167,7 @@
- (void)_commitIfReady:(NSDictionary *)pageCache;
- (void)_makeRepresentation;
- (void)_receivedData:(NSData *)data;
+- (void)_setData:(NSData *)data;
- (void)_finishedLoading;
- (void)_receivedError:(NSError *)error complete:(BOOL)isComplete;
- (void)_defersCallbacksChanged;
diff --git a/WebKit/WebView.subproj/WebFrame.m b/WebKit/WebView.subproj/WebFrame.m
index a11795c..2aa67f8 100644
--- a/WebKit/WebView.subproj/WebFrame.m
+++ b/WebKit/WebView.subproj/WebFrame.m
@@ -22,11 +22,12 @@
#import <WebKit/WebNetscapePluginEmbeddedView.h>
#import <WebKit/WebNullPluginView.h>
#import <WebKit/WebPlugin.h>
+#import <WebKit/WebResourcePrivate.h>
#import <WebKit/WebViewPrivate.h>
#import <WebKit/WebUIDelegate.h>
+#import <Foundation/NSDictionary_NSURLExtras.h>
#import <Foundation/NSURLRequest.h>
-
#import <Foundation/NSString_NSURLExtras.h>
#import <objc/objc-runtime.h>
@@ -255,6 +256,57 @@ NSString *WebPageCacheDocumentViewKey = @"WebPageCacheDocumentViewKey";
@implementation WebFrame (WebPrivate)
+- (void)loadHTMLPropertyList:(id)HTMLPropertyList
+{
+ if ([HTMLPropertyList isKindOfClass:[NSDictionary class]]) {
+ NSDictionary *resourcePropertyList = [HTMLPropertyList objectForKey:WebMainResourceKey];
+ if (resourcePropertyList) {
+ WebResource *resource = [[WebResource alloc] _initWithPropertyList:resourcePropertyList];
+ if (resource) {
+ NSURLRequest *request = [self _webDataRequestForData:[resource data]
+ MIMEType:[resource MIMEType]
+ textEncodingName:[resource textEncodingName]
+ baseURL:[resource URL]];
+ NSArray *subresourcePropertyLists = [HTMLPropertyList objectForKey:WebSubresourcesKey];
+ [self _loadRequest:request subresources:subresourcePropertyLists ? [WebResource _resourcesFromPropertyLists:subresourcePropertyLists] : nil];
+ }
+ }
+ }
+}
+
+- (NSURLRequest *)_webDataRequestForData:(NSData *)data MIMEType:(NSString *)MIMEType textEncodingName: (NSString *)encodingName baseURL:(NSURL *)URL
+{
+ NSURL *fakeURL = [NSURLRequest _webDataRequestURLForData: data];
+ NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] initWithURL: fakeURL] autorelease];
+ [request _webDataRequestSetData:data];
+ [request _webDataRequestSetEncoding:encodingName];
+ [request _webDataRequestSetBaseURL:URL];
+ [request _webDataRequestSetMIMEType:MIMEType?MIMEType:@"text/html"];
+ return request;
+}
+
+- (void)_loadRequest:(NSURLRequest *)request subresources:(NSArray *)subresources
+{
+ WebFrameLoadType loadType;
+
+ // note this copies request
+ WebDataSource *newDataSource = [[WebDataSource alloc] initWithRequest:request];
+ NSMutableURLRequest *r = [newDataSource request];
+ [self _addExtraFieldsToRequest:r alwaysFromRequest: NO];
+ if ([self _shouldTreatURLAsSameAsCurrent:[request URL]]) {
+ [r setCachePolicy:NSURLRequestReloadIgnoringCacheData];
+ loadType = WebFrameLoadTypeSame;
+ } else {
+ loadType = WebFrameLoadTypeStandard;
+ }
+
+ [newDataSource _setOverrideEncoding:[[self dataSource] _overrideEncoding]];
+ [newDataSource addSubresources:subresources];
+
+ [self _loadDataSource:newDataSource withLoadType:loadType formState:nil];
+ [newDataSource release];
+}
+
- (void)_setWebView:(WebView *)v
{
// To set to nil, we have to use _detachFromParent, not this.
@@ -2440,33 +2492,15 @@ static CFAbsoluteTime _timeOfLastCompletedLoad;
- (void)loadRequest:(NSURLRequest *)request
{
- WebFrameLoadType loadType;
-
- // note this copies request
- WebDataSource *newDataSource = [[WebDataSource alloc] initWithRequest:request];
- NSMutableURLRequest *r = [newDataSource request];
- [self _addExtraFieldsToRequest:r alwaysFromRequest: NO];
- if ([self _shouldTreatURLAsSameAsCurrent:[request URL]]) {
- [r setCachePolicy:NSURLRequestReloadIgnoringCacheData];
- loadType = WebFrameLoadTypeSame;
- } else {
- loadType = WebFrameLoadTypeStandard;
- }
-
- [newDataSource _setOverrideEncoding:[[self dataSource] _overrideEncoding]];
-
- [self _loadDataSource:newDataSource withLoadType:loadType formState:nil];
- [newDataSource release];
+ [self _loadRequest:request subresources:nil];
}
-- (void)loadData:(NSData *)data MIMEType:(NSString *)MIMEType textEncodingName: (NSString *)encodingName baseURL:(NSURL *)URL;
+- (void)loadData:(NSData *)data MIMEType:(NSString *)MIMEType textEncodingName:(NSString *)encodingName baseURL:(NSURL *)URL;
{
- NSURL *fakeURL = [NSURLRequest _webDataRequestURLForData: data];
- NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] initWithURL: fakeURL] autorelease];
- [request _webDataRequestSetData:data];
- [request _webDataRequestSetEncoding:encodingName];
- [request _webDataRequestSetBaseURL:URL];
- [request _webDataRequestSetMIMEType:MIMEType?MIMEType:@"text/html"];
+ NSURLRequest *request = [self _webDataRequestForData:data
+ MIMEType:MIMEType
+ textEncodingName:encodingName
+ baseURL:URL];
[self loadRequest:request];
}
diff --git a/WebKit/WebView.subproj/WebFramePrivate.h b/WebKit/WebView.subproj/WebFramePrivate.h
index cebed04..d57f10a 100644
--- a/WebKit/WebView.subproj/WebFramePrivate.h
+++ b/WebKit/WebView.subproj/WebFramePrivate.h
@@ -114,6 +114,13 @@ extern NSString *WebPageCacheDocumentViewKey;
@end
@interface WebFrame (WebPrivate)
+
+// API Considerations:
+- (void)loadHTMLPropertyList:(id)HTMLPropertyList;
+
+- (NSURLRequest *)_webDataRequestForData:(NSData *)data MIMEType:(NSString *)MIMEType textEncodingName:(NSString *)encodingName baseURL:(NSURL *)URL;
+- (void)_loadRequest:(NSURLRequest *)request subresources:(NSArray *)subresources;
+
- (void)_setWebView:(WebView *)webView;
- (void)_setName:(NSString *)name;
- (WebFrame *)_descendantFrameNamed:(NSString *)name;
diff --git a/WebKit/WebView.subproj/WebHTMLView.m b/WebKit/WebView.subproj/WebHTMLView.m
index 685f929..6756cfa 100644
--- a/WebKit/WebView.subproj/WebHTMLView.m
+++ b/WebKit/WebView.subproj/WebHTMLView.m
@@ -21,6 +21,7 @@
#import "WebNSPrintOperationExtras.h"
#import <WebKit/WebNSViewExtras.h>
#import <WebKit/WebPluginController.h>
+#import <WebKit/WebResourcePrivate.h>
#import <WebKit/WebTextRenderer.h>
#import <WebKit/WebTextRendererFactory.h>
#import <WebKit/WebUIDelegatePrivate.h>
@@ -154,6 +155,11 @@ static BOOL forceRealHitTest = NO;
return [[self _frame] _bridge];
}
+- (WebDataSource *)_dataSource
+{
+ return [[self _frame] dataSource];
+}
+
+ (void)_postFlagsChangedEvent:(NSEvent *)flagsChangedEvent
{
NSEvent *fakeEvent = [NSEvent mouseEventWithType:NSMouseMoved
@@ -508,17 +514,57 @@ static WebHTMLView *lastHitView = nil;
[self _setToolTip:[element objectForKey:WebCoreElementTitleKey]];
}
-+ (NSArray *)_pasteboardTypes
++ (NSArray *)_selectionPasteboardTypes
{
- return [NSArray arrayWithObjects:NSHTMLPboardType, NSRTFPboardType, NSRTFDPboardType, NSStringPboardType, nil];
+ return [NSArray arrayWithObjects:WebHTMLPboardType, NSHTMLPboardType, NSRTFPboardType, NSRTFDPboardType, NSStringPboardType, nil];
+}
+
+- (NSDictionary *)_selectedHTMLPropertyList:(NSString **)HTMLString
+{
+ NSArray *subresourceURLStrings;
+ *HTMLString = [[self _bridge] selectedHTMLString:&subresourceURLStrings];
+ NSMutableDictionary *HTMLPropertyList = [NSMutableDictionary dictionary];
+
+ WebDataSource *dataSource = [self _dataSource];
+ NSURLResponse *response = [dataSource response];
+ WebResource *resource = [[WebResource alloc] initWithData:[*HTMLString dataUsingEncoding:NSUTF8StringEncoding]
+ URL:[response URL]
+ MIMEType:[response MIMEType]
+ textEncodingName:[response textEncodingName]];
+ [HTMLPropertyList setObject:[resource _propertyListRepresentation] forKey:WebMainResourceKey];
+ [resource release];
+
+ NSEnumerator *enumerator = [subresourceURLStrings objectEnumerator];
+ NSMutableArray *subresources = [[NSMutableArray alloc] init];
+ NSString *URLString;
+ while ((URLString = [enumerator nextObject]) != nil) {
+ NSURL *URL = [NSURL _web_URLWithDataAsString:URLString];
+ resource = [dataSource subresourceForURL:URL];
+ if (resource) {
+ [subresources addObject:[resource _propertyListRepresentation]];
+ } else {
+ ERROR("Failed to copy subresource because data source does not have subresource for %@", URLString);
+ }
+ }
+
+ if ([subresources count] > 0) {
+ [HTMLPropertyList setObject:subresources forKey:WebSubresourcesKey];
+ }
+
+ [subresources release];
+
+ return HTMLPropertyList;
}
- (void)_writeSelectionToPasteboard:(NSPasteboard *)pasteboard
{
- [pasteboard declareTypes:[[self class] _pasteboardTypes] owner:nil];
+ [pasteboard declareTypes:[[self class] _selectionPasteboardTypes] owner:nil];
// Put HTML on the pasteboard.
- [pasteboard setString:[[self _bridge] selectedHTMLString:nil] forType:NSHTMLPboardType];
+ NSString *HTMLString;
+ NSDictionary *HTMLPropertyList = [self _selectedHTMLPropertyList:&HTMLString];
+ [pasteboard setString:HTMLString forType:NSHTMLPboardType];
+ [pasteboard setPropertyList:HTMLPropertyList forType:WebHTMLPboardType];
// Put attributed string on the pasteboard (RTF format).
NSAttributedString *attributedString = [self selectedAttributedString];
@@ -553,12 +599,28 @@ static WebHTMLView *lastHitView = nil;
NSArray *types = [pasteboard types];
NSString *HTMLString = nil;
- if ([types containsObject:NSHTMLPboardType]) {
- HTMLString = [pasteboard stringForType:NSHTMLPboardType];
- } else if ([types containsObject:NSStringPboardType]) {
- HTMLString = [pasteboard stringForType:NSStringPboardType];
- }
-
+ if ([types containsObject:WebHTMLPboardType]) {
+ NSDictionary *HTMLPropertyList = [pasteboard propertyListForType:WebHTMLPboardType];
+ if ([HTMLPropertyList isKindOfClass:[NSDictionary class]]) {
+ NSDictionary *resourcePropertyList = [HTMLPropertyList objectForKey:WebMainResourceKey];
+ WebResource *resource = [[WebResource alloc] _initWithPropertyList:resourcePropertyList];
+ if (resource && [WebView canShowMIMETypeAsHTML:[resource MIMEType]]) {
+ HTMLString = [[[NSString alloc] initWithData:[resource data] encoding:NSUTF8StringEncoding] autorelease];
+ [resource release];
+ NSArray *propertyLists = [HTMLPropertyList objectForKey:WebSubresourcesKey];
+ if (propertyLists) {
+ [[self _dataSource] addSubresources:[WebResource _resourcesFromPropertyLists:propertyLists]];
+ }
+ }
+ }
+ }
+
+ if (!HTMLString && [types containsObject:NSHTMLPboardType]) {
+ HTMLString = [pasteboard stringForType:NSHTMLPboardType];
+ }
+ if (!HTMLString && [types containsObject:NSStringPboardType]) {
+ HTMLString = [pasteboard stringForType:NSStringPboardType];
+ }
if (HTMLString) {
[[self _bridge] pasteHTMLString:HTMLString];
}
@@ -893,7 +955,7 @@ static WebHTMLView *lastHitView = nil;
+ (void)initialize
{
WebKitInitializeUnicode();
- [NSApp registerServicesMenuSendTypes:[[self class] _pasteboardTypes] returnTypes:nil];
+ [NSApp registerServicesMenuSendTypes:[[self class] _selectionPasteboardTypes] returnTypes:nil];
}
- (id)initWithFrame:(NSRect)frame
@@ -911,7 +973,7 @@ static WebHTMLView *lastHitView = nil;
_private->pluginController = [[WebPluginController alloc] initWithHTMLView:self];
_private->needsLayout = YES;
- [self registerForDraggedTypes:[NSArray arrayWithObjects:NSHTMLPboardType, NSStringPboardType, nil]];
+ [self registerForDraggedTypes:[NSArray arrayWithObjects:WebHTMLPboardType, NSHTMLPboardType, NSStringPboardType, nil]];
return self;
}
@@ -996,7 +1058,7 @@ static WebHTMLView *lastHitView = nil;
- (id)validRequestorForSendType:(NSString *)sendType returnType:(NSString *)returnType
{
- if (sendType && ([[[self class] _pasteboardTypes] containsObject:sendType]) && [self _haveSelection]){
+ if (sendType && ([[[self class] _selectionPasteboardTypes] containsObject:sendType]) && [self _haveSelection]){
return self;
}
diff --git a/WebKit/WebView.subproj/WebHTMLViewPrivate.h b/WebKit/WebView.subproj/WebHTMLViewPrivate.h
index 4d947d1..9d38189 100644
--- a/WebKit/WebView.subproj/WebHTMLViewPrivate.h
+++ b/WebKit/WebView.subproj/WebHTMLViewPrivate.h
@@ -54,6 +54,7 @@
- (WebView *)_webView;
- (WebFrame *)_frame;
- (WebBridge *)_bridge;
+- (WebDataSource *)_dataSource;
// Modifier (flagsChanged) tracking SPI
+ (void)_postFlagsChangedEvent:(NSEvent *)flagsChangedEvent;
@@ -68,7 +69,7 @@
- (void)_clearLastHitViewIfSelf;
- (void)_updateMouseoverWithEvent:(NSEvent *)event;
-+ (NSArray *)_pasteboardTypes;
++ (NSArray *)_selectionPasteboardTypes;
- (void)_writeSelectionToPasteboard:(NSPasteboard *)pasteboard;
- (BOOL)_canDelete;
diff --git a/WebKit/WebView.subproj/WebLoader.h b/WebKit/WebView.subproj/WebLoader.h
index c184a47..a54f024 100644
--- a/WebKit/WebView.subproj/WebLoader.h
+++ b/WebKit/WebView.subproj/WebLoader.h
@@ -15,6 +15,7 @@
@class NSURLRequest;
@class NSURLResponse;
@class WebDataSource;
+ at class WebResource;
@class WebView;
@interface WebBaseResourceHandleDelegate : NSObject
@@ -35,6 +36,9 @@
BOOL reachedTerminalState;
BOOL defersCallbacks;
WebResourceDelegateImplementationCache implementations;
+ NSURL *originalURL;
+ WebResource *resource;
+ NSMutableData *resourceData;
}
- (BOOL)loadWithRequest:(NSURLRequest *)request;
@@ -58,6 +62,8 @@
- (void)releaseResources;
- (NSURLResponse *)response;
+- (NSData *)resourceData;
+
@end
// Note: This interface can be removed once this method is declared
diff --git a/WebKit/WebView.subproj/WebLoader.m b/WebKit/WebView.subproj/WebLoader.m
index b70005d..9aa8ef9 100644
--- a/WebKit/WebView.subproj/WebLoader.m
+++ b/WebKit/WebView.subproj/WebLoader.m
@@ -12,15 +12,16 @@
#import <Foundation/NSURLRequestPrivate.h>
#import <Foundation/NSURLResponse.h>
#import <Foundation/NSURLResponsePrivate.h>
-#import <WebKit/WebAssertions.h>
#import <Foundation/NSError_NSURLExtras.h>
+#import <WebKit/WebAssertions.h>
#import <WebKit/WebDataProtocol.h>
#import <WebKit/WebDataSourcePrivate.h>
#import <WebKit/WebDefaultResourceLoadDelegate.h>
#import <WebKit/WebKitErrors.h>
#import <WebKit/WebKitErrorsPrivate.h>
#import <WebKit/WebResourceLoadDelegate.h>
+#import <WebKit/WebResourcePrivate.h>
#import <WebKit/WebViewPrivate.h>
@interface WebBaseResourceHandleDelegate (WebNSURLAuthenticationChallengeSender) <NSURLAuthenticationChallengeSender>
@@ -100,6 +101,12 @@
[downloadDelegate release];
downloadDelegate = nil;
+ [resource release];
+ resource = nil;
+
+ [resourceData release];
+ resourceData = nil;
+
reachedTerminalState = YES;
[self release];
@@ -110,14 +117,30 @@
ASSERT(reachedTerminalState);
[request release];
[response release];
+ [originalURL release];
[super dealloc];
}
- (BOOL)loadWithRequest:(NSURLRequest *)r
{
ASSERT(connection == nil);
+ ASSERT(resource == nil);
+ NSURL *URL = [[r URL] retain];
+ [originalURL release];
+ originalURL = URL;
+
r = [self connection:connection willSendRequest:r redirectResponse:nil];
+
+ if ([[r URL] isEqual:originalURL]) {
+ resource = [dataSource subresourceForURL:originalURL];
+ if (resource) {
+ // FIXME: This is a hack to make Foundation hand us back the data that we're caching. We need something more direct.
+ [resource retain];
+ [[NSURLCache sharedURLCache] storeCachedResponse:[resource _cachedResponseRepresentation] forRequest:r];
+ }
+ }
+
connection = [[NSURLConnection alloc] initWithRequest:r delegate:self];
if (defersCallbacks) {
[connection setDefersCallbacks:YES];
@@ -174,6 +197,43 @@
return downloadDelegate;
}
+- (void)addData:(NSData *)data
+{
+ if (!resource) {
+ if (!resourceData) {
+ resourceData = [[NSMutableData alloc] init];
+ }
+ [resourceData appendData:data];
+ }
+}
+
+- (void)saveResource
+{
+ if (!resource && [resourceData length] > 0) {
+ WebResource *newResource = [[WebResource alloc] initWithData:resourceData
+ URL:originalURL
+ MIMEType:[response MIMEType]
+ textEncodingName:[response textEncodingName]];
+ [dataSource addSubresource:newResource];
+ [newResource release];
+ }
+}
+
+- (void)saveResourceWithCachedResponse:(NSCachedURLResponse *)cachedResponse
+{
+ if (!resource) {
+ // Overwrite the resource saved with saveResource with the cache version to save memory.
+ WebResource *newResource = [[WebResource alloc] _initWithCachedResponse:cachedResponse originalURL:originalURL];
+ [dataSource addSubresource:newResource];
+ [newResource release];
+ }
+}
+
+- (NSData *)resourceData
+{
+ return resource ? [resource data] : resourceData;
+}
+
- (NSURLRequest *)connection:(NSURLConnection *)con willSendRequest:(NSURLRequest *)newRequest redirectResponse:(NSURLResponse *)redirectResponse
{
ASSERT(con == connection);
@@ -327,6 +387,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];
+
+ [self addData:data];
+
[webView _incrementProgressForConnection:con data:data];
if (implementations.delegateImplementsDidReceiveContentLength)
@@ -347,6 +410,8 @@
ASSERT(con == connection);
ASSERT(!reachedTerminalState);
+ [self saveResource];
+
[webView _completeProgressForConnection:con];
if (implementations.delegateImplementsDidFinishLoadingFromDataSource)
@@ -373,6 +438,12 @@
[self release];
}
+- (NSCachedURLResponse *)connection:(NSURLConnection *)connection willCacheResponse:(NSCachedURLResponse *)cachedResponse
+{
+ [self saveResourceWithCachedResponse:cachedResponse];
+ return cachedResponse;
+}
+
- (void)cancelWithError:(NSError *)error
{
ASSERT(!reachedTerminalState);
diff --git a/WebKit/WebView.subproj/WebMainResourceClient.m b/WebKit/WebView.subproj/WebMainResourceClient.m
index 4a5ec44..016832a 100644
--- a/WebKit/WebView.subproj/WebMainResourceClient.m
+++ b/WebKit/WebView.subproj/WebMainResourceClient.m
@@ -124,6 +124,24 @@
return result;
}
+- (void)addData:(NSData *)data
+{
+ // Override. We don't want to save the main resource as a subresource of the data source.
+ [dataSource _receivedData:data];
+}
+
+- (void)saveResource
+{
+ // Override. We don't want to save the main resource as a subresource of the data source.
+}
+
+- (void)saveResourceWithCachedResponse:(NSCachedURLResponse *)cachedResponse
+{
+ // Override. We don't want to save the main resource as a subresource of the data source.
+ // Replace the data on the data source with the cache copy to save memory.
+ [dataSource _setData:[cachedResponse data]];
+}
+
- (NSURLRequest *)connection:(NSURLConnection *)con willSendRequest:(NSURLRequest *)newRequest redirectResponse:(NSURLResponse *)redirectResponse
{
// Note that there are no asserts here as there are for the other callbacks. This is due to the
@@ -285,7 +303,6 @@
// 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];
- [dataSource _receivedData:data];
[[dataSource _webView] _mainReceivedBytesSoFar:[[dataSource data] length]
fromDataSource:dataSource
complete:NO];
diff --git a/WebKit/WebView.subproj/WebMainResourceLoader.m b/WebKit/WebView.subproj/WebMainResourceLoader.m
index 4a5ec44..016832a 100644
--- a/WebKit/WebView.subproj/WebMainResourceLoader.m
+++ b/WebKit/WebView.subproj/WebMainResourceLoader.m
@@ -124,6 +124,24 @@
return result;
}
+- (void)addData:(NSData *)data
+{
+ // Override. We don't want to save the main resource as a subresource of the data source.
+ [dataSource _receivedData:data];
+}
+
+- (void)saveResource
+{
+ // Override. We don't want to save the main resource as a subresource of the data source.
+}
+
+- (void)saveResourceWithCachedResponse:(NSCachedURLResponse *)cachedResponse
+{
+ // Override. We don't want to save the main resource as a subresource of the data source.
+ // Replace the data on the data source with the cache copy to save memory.
+ [dataSource _setData:[cachedResponse data]];
+}
+
- (NSURLRequest *)connection:(NSURLConnection *)con willSendRequest:(NSURLRequest *)newRequest redirectResponse:(NSURLResponse *)redirectResponse
{
// Note that there are no asserts here as there are for the other callbacks. This is due to the
@@ -285,7 +303,6 @@
// 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];
- [dataSource _receivedData:data];
[[dataSource _webView] _mainReceivedBytesSoFar:[[dataSource data] length]
fromDataSource:dataSource
complete:NO];
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list