Commit 64e6db90 authored by mjs's avatar mjs

Reviewed by Brady and Oliver.

        
        - move things around so that WebDataSource and WebDocumentLoadState know about each other in
        the right way. This lines things up to move nearly all functionality down to WebDocumentLoadState.

        * Loader/WebDocumentLoadState.h:
        * Loader/WebDocumentLoadState.m:
        (-[WebDocumentLoadState initWithRequest:]):
        (-[WebDocumentLoadState dealloc]):
        (-[WebDocumentLoadState originalRequest]):
        * Loader/WebFrameLoader.h:
        * Loader/WebFrameLoader.m:
        (-[WebFrameLoader dealloc]):
        (-[WebFrameLoader addSubresourceLoader:]):
        (-[WebFrameLoader startLoadingMainResourceWithRequest:identifier:]):
        (-[WebFrameLoader dataSource]):
        (-[WebFrameLoader _setDocumentLoadState:]):
        (-[WebFrameLoader policyDataSource]):
        (-[WebFrameLoader _setPolicyDocumentLoadState:]):
        (-[WebFrameLoader clearDataSource]):
        (-[WebFrameLoader provisionalDataSource]):
        (-[WebFrameLoader _setProvisionalDocumentLoadState:]):
        (-[WebFrameLoader _clearProvisionalDataSource]):
        (-[WebFrameLoader _setState:]):
        (-[WebFrameLoader clearProvisionalLoad]):
        (-[WebFrameLoader commitProvisionalLoad]):
        (-[WebFrameLoader stopLoading]):
        (-[WebFrameLoader startLoading]):
        (-[WebFrameLoader startProvisionalLoad:]):
        (-[WebFrameLoader setupForReplace]):
        (-[WebFrameLoader activeDocumentLoadState]):
        (-[WebFrameLoader activeDataSource]):
        (-[WebFrameLoader _loadRequest:archive:]):
        (-[WebFrameLoader _loadRequest:triggeringAction:loadType:formState:]):
        (-[WebFrameLoader _reloadAllowingStaleDataWithOverrideEncoding:]):
        (-[WebFrameLoader reload]):
        * WebKit.xcodeproj/project.pbxproj:
        * WebView/WebDataSource.m:
        (-[WebDataSourcePrivate dealloc]):
        (-[WebDataSource _startLoading]):
        (-[WebDataSource _setWebFrame:]):
        (-[WebDataSource _documentLoadState]):
        (-[WebDataSource _initWithDocumentLoadState:]):
        (-[WebDataSource initWithRequest:]):
        (-[WebDataSource initialRequest]):
        (-[WebDataSource unreachableURL]):
        * WebView/WebDataSourceInternal.h:
        * WebView/WebFrame.m:
        (-[WebFramePrivate dealloc]):
        (-[WebFrame _continueLoadRequestAfterNavigationPolicy:formState:]):
        (-[WebFrame _loadDataSource:withLoadType:formState:]):
        (-[WebFrame _policyDataSource]):
        (-[WebFrame _shouldReloadToHandleUnreachableURLFromRequest:]):
        (-[WebFrame _dataSourceForDocumentLoadState:]):
        (-[WebFrame _createDocumentLoadStateWithRequest:]):
        * WebView/WebFrameInternal.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@16707 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 07d17dc5
2006-10-01 Maciej Stachowiak <mjs@apple.com>
Reviewed by Brady and Oliver.
- move things around so that WebDataSource and WebDocumentLoadState know about each other in
the right way. This lines things up to move nearly all functionality down to WebDocumentLoadState.
* Loader/WebDocumentLoadState.h:
* Loader/WebDocumentLoadState.m:
(-[WebDocumentLoadState initWithRequest:]):
(-[WebDocumentLoadState dealloc]):
(-[WebDocumentLoadState originalRequest]):
* Loader/WebFrameLoader.h:
* Loader/WebFrameLoader.m:
(-[WebFrameLoader dealloc]):
(-[WebFrameLoader addSubresourceLoader:]):
(-[WebFrameLoader startLoadingMainResourceWithRequest:identifier:]):
(-[WebFrameLoader dataSource]):
(-[WebFrameLoader _setDocumentLoadState:]):
(-[WebFrameLoader policyDataSource]):
(-[WebFrameLoader _setPolicyDocumentLoadState:]):
(-[WebFrameLoader clearDataSource]):
(-[WebFrameLoader provisionalDataSource]):
(-[WebFrameLoader _setProvisionalDocumentLoadState:]):
(-[WebFrameLoader _clearProvisionalDataSource]):
(-[WebFrameLoader _setState:]):
(-[WebFrameLoader clearProvisionalLoad]):
(-[WebFrameLoader commitProvisionalLoad]):
(-[WebFrameLoader stopLoading]):
(-[WebFrameLoader startLoading]):
(-[WebFrameLoader startProvisionalLoad:]):
(-[WebFrameLoader setupForReplace]):
(-[WebFrameLoader activeDocumentLoadState]):
(-[WebFrameLoader activeDataSource]):
(-[WebFrameLoader _loadRequest:archive:]):
(-[WebFrameLoader _loadRequest:triggeringAction:loadType:formState:]):
(-[WebFrameLoader _reloadAllowingStaleDataWithOverrideEncoding:]):
(-[WebFrameLoader reload]):
* WebKit.xcodeproj/project.pbxproj:
* WebView/WebDataSource.m:
(-[WebDataSourcePrivate dealloc]):
(-[WebDataSource _startLoading]):
(-[WebDataSource _setWebFrame:]):
(-[WebDataSource _documentLoadState]):
(-[WebDataSource _initWithDocumentLoadState:]):
(-[WebDataSource initWithRequest:]):
(-[WebDataSource initialRequest]):
(-[WebDataSource unreachableURL]):
* WebView/WebDataSourceInternal.h:
* WebView/WebFrame.m:
(-[WebFramePrivate dealloc]):
(-[WebFrame _continueLoadRequestAfterNavigationPolicy:formState:]):
(-[WebFrame _loadDataSource:withLoadType:formState:]):
(-[WebFrame _policyDataSource]):
(-[WebFrame _shouldReloadToHandleUnreachableURLFromRequest:]):
(-[WebFrame _dataSourceForDocumentLoadState:]):
(-[WebFrame _createDocumentLoadStateWithRequest:]):
* WebView/WebFrameInternal.h:
2006-09-29 David Hyatt <hyatt@apple.com>
Change the default minimum font size pref to 0 in order to allow
......
......@@ -36,11 +36,18 @@
WebFrameLoader *frameLoader;
NSData *mainResourceData;
// A reference to actual request used to create the data source.
// This should only be used by the resourceLoadDelegate's
// identifierForInitialRequest:fromDatasource: method. It is
// not guaranteed to remain unchanged, as requests are mutable.
NSURLRequest *originalRequest;
}
- (id)initWithRequest:(NSURLRequest *)request;
- (void)setFrameLoader:(WebFrameLoader *)fl;
- (void)setMainResourceData:(NSData *)data;
- (NSData *)mainResourceData;
- (NSURLRequest *)originalRequest;
@end
......@@ -42,7 +42,7 @@ - (id)initWithRequest:(NSURLRequest *)request
if (!self)
return nil;
// ignore request for now
originalRequest = [request retain];
return self;
}
......@@ -50,7 +50,8 @@ - (id)initWithRequest:(NSURLRequest *)request
- (void)dealloc
{
[mainResourceData release];
[originalRequest release];
[super dealloc];
}
......@@ -74,4 +75,10 @@ - (NSData *)mainResourceData
return mainResourceData != nil ? mainResourceData : [frameLoader mainResourceData];
}
- (NSURLRequest *)originalRequest
{
return originalRequest;
}
@end
......@@ -30,6 +30,8 @@
#import <WebKit/WebFramePrivate.h>
#import <WebKit/WebDocumentLoadState.h>
@class WebArchive;
@class WebDataSource;
@class WebMainResourceLoader;
......@@ -63,8 +65,10 @@ typedef enum {
NSMutableArray *plugInStreamLoaders;
WebFrame *webFrame;
WebDataSource *dataSource;
WebDataSource *provisionalDataSource;
WebDocumentLoadState *documentLoadState;
WebDocumentLoadState *provisionalDocumentLoadState;
WebDocumentLoadState *policyDocumentLoadState;
WebFrameState state;
WebPolicyDecisionListener *listener;
......@@ -96,7 +100,9 @@ typedef enum {
- (void)startProvisionalLoad:(WebDataSource *)dataSource;
- (WebDataSource *)dataSource;
- (WebDataSource *)provisionalDataSource;
- (WebDataSource *)policyDataSource;
- (WebDataSource *)activeDataSource;
- (void)_setPolicyDocumentLoadState:(WebDocumentLoadState *)loadState;
- (WebFrameState)state;
- (void)clearDataSource;
- (void)setupForReplace;
......
......@@ -64,8 +64,10 @@ - (void)dealloc
[mainResourceLoader release];
[subresourceLoaders release];
[plugInStreamLoaders release];
[dataSource release];
[provisionalDataSource release];
[documentLoadState release];
[provisionalDocumentLoadState release];
ASSERT(!policyDocumentLoadState);
[super dealloc];
}
......@@ -136,7 +138,7 @@ - (void)stopLoadingSubresources
- (void)addSubresourceLoader:(WebLoader *)loader
{
ASSERT(!provisionalDataSource);
ASSERT(!provisionalDocumentLoadState);
if (subresourceLoaders == nil)
subresourceLoaders = [[NSMutableArray alloc] init];
[subresourceLoaders addObject:loader];
......@@ -170,7 +172,7 @@ - (BOOL)startLoadingMainResourceWithRequest:(NSMutableURLRequest *)request ident
mainResourceLoader = [[WebMainResourceLoader alloc] initWithFrameLoader:self];
[mainResourceLoader setIdentifier:identifier];
[[provisionalDataSource webFrame] _addExtraFieldsToRequest:request mainResource:YES alwaysFromRequest:NO];
[webFrame _addExtraFieldsToRequest:request mainResource:YES alwaysFromRequest:NO];
if (![mainResourceLoader loadWithRequest:request]) {
// FIXME: if this should really be caught, we should just ASSERT this doesn't happen;
// should it be caught by other parts of WebKit or other parts of the app?
......@@ -190,49 +192,61 @@ - (void)stopLoadingWithError:(NSError *)error
- (WebDataSource *)dataSource
{
return dataSource;
return [webFrame _dataSourceForDocumentLoadState:documentLoadState];
}
- (void)_setDataSource:(WebDataSource *)ds
- (void)_setDocumentLoadState:(WebDocumentLoadState *)loadState
{
if (ds == nil && dataSource == nil)
if (loadState == nil && documentLoadState == nil)
return;
ASSERT(ds != dataSource);
ASSERT(loadState != documentLoadState);
[webFrame _prepareForDataSourceReplacement];
[dataSource _setWebFrame:nil];
[[self dataSource] _setWebFrame:nil];
[ds retain];
[dataSource release];
dataSource = ds;
[loadState retain];
[documentLoadState release];
documentLoadState = loadState;
}
- (WebDataSource *)policyDataSource
{
return [webFrame _dataSourceForDocumentLoadState:policyDocumentLoadState];
}
- (void)_setPolicyDocumentLoadState:(WebDocumentLoadState *)loadState
{
[loadState retain];
[policyDocumentLoadState release];
policyDocumentLoadState = loadState;
}
- (void)clearDataSource
{
[self _setDataSource:nil];
[self _setDocumentLoadState:nil];
}
- (WebDataSource *)provisionalDataSource
{
return provisionalDataSource;
return [webFrame _dataSourceForDocumentLoadState:provisionalDocumentLoadState];
}
- (void)_setProvisionalDataSource: (WebDataSource *)d
- (void)_setProvisionalDocumentLoadState:(WebDocumentLoadState *)loadState
{
ASSERT(!d || !provisionalDataSource);
ASSERT(!loadState || !provisionalDocumentLoadState);
if (provisionalDataSource != dataSource)
[provisionalDataSource _setWebFrame:nil];
if (provisionalDocumentLoadState != documentLoadState)
[[self provisionalDataSource] _setWebFrame:nil];
[d retain];
[provisionalDataSource release];
provisionalDataSource = d;
[loadState retain];
[provisionalDocumentLoadState release];
provisionalDocumentLoadState = loadState;
}
- (void)_clearProvisionalDataSource
{
[self _setProvisionalDataSource:nil];
[self _setProvisionalDocumentLoadState:nil];
}
- (WebFrameState)state
......@@ -271,13 +285,13 @@ - (void)_setState:(WebFrameState)newState
else if (state == WebFrameStateComplete) {
[webFrame _frameLoadCompleted];
_timeOfLastCompletedLoad = CFAbsoluteTimeGetCurrent();
[dataSource _stopRecordingResponses];
[[self dataSource] _stopRecordingResponses];
}
}
- (void)clearProvisionalLoad
{
[self _setProvisionalDataSource:nil];
[self _setProvisionalDocumentLoadState:nil];
[[webFrame webView] _progressCompleted:webFrame];
[self _setState:WebFrameStateComplete];
}
......@@ -292,15 +306,15 @@ - (void)commitProvisionalLoad
[self stopLoadingSubresources];
[self stopLoadingPlugIns];
[self _setDataSource:provisionalDataSource];
[self _setProvisionalDataSource:nil];
[self _setDocumentLoadState:provisionalDocumentLoadState];
[self _setProvisionalDocumentLoadState:nil];
[self _setState:WebFrameStateCommittedPage];
}
- (void)stopLoading
{
[provisionalDataSource _stopLoading];
[dataSource _stopLoading];
[[self provisionalDataSource] _stopLoading];
[[self dataSource] _stopLoading];
[self _clearProvisionalDataSource];
[self clearArchivedResources];
}
......@@ -308,32 +322,37 @@ - (void)stopLoading
// FIXME: poor method name; also why is this not part of startProvisionalLoad:?
- (void)startLoading
{
[provisionalDataSource _startLoading];
[[self provisionalDataSource] _startLoading];
}
- (void)startProvisionalLoad:(WebDataSource *)ds
{
[self _setProvisionalDataSource:ds];
[self _setProvisionalDocumentLoadState:[ds _documentLoadState]];
[self _setState:WebFrameStateProvisional];
}
- (void)setupForReplace
{
[self _setState:WebFrameStateProvisional];
WebDataSource *old = provisionalDataSource;
provisionalDataSource = dataSource;
dataSource = nil;
WebDocumentLoadState *old = provisionalDocumentLoadState;
provisionalDocumentLoadState = documentLoadState;
documentLoadState = nil;
[old release];
[webFrame _detachChildren];
}
- (WebDataSource *)activeDataSource
- (WebDocumentLoadState *)activeDocumentLoadState
{
if (state == WebFrameStateProvisional)
return provisionalDataSource;
return provisionalDocumentLoadState;
return documentLoadState;
}
return dataSource;
- (WebDataSource *)activeDataSource
{
return [webFrame _dataSourceForDocumentLoadState:[self activeDocumentLoadState]];
}
- (WebResource *)_archivedSubresourceForURL:(NSURL *)URL
......@@ -699,8 +718,9 @@ - (void)_loadRequest:(NSURLRequest *)request archive:(WebArchive *)archive
{
WebFrameLoadType loadType;
// note this copies request
WebDataSource *newDataSource = [[WebDataSource alloc] initWithRequest:request];
policyDocumentLoadState = [webFrame _createDocumentLoadStateWithRequest:request];
WebDataSource *newDataSource = [webFrame _dataSourceForDocumentLoadState:policyDocumentLoadState];
NSMutableURLRequest *r = [newDataSource request];
[webFrame _addExtraFieldsToRequest:r mainResource:YES alwaysFromRequest:NO];
if ([webFrame _shouldTreatURLAsSameAsCurrent:[request URL]]) {
......@@ -721,19 +741,18 @@ - (void)_loadRequest:(NSURLRequest *)request archive:(WebArchive *)archive
}
[webFrame _loadDataSource:newDataSource withLoadType:loadType formState:nil];
[newDataSource release];
}
- (void)_loadRequest:(NSURLRequest *)request triggeringAction:(NSDictionary *)action loadType:(WebFrameLoadType)loadType formState:(WebFormState *)formState
{
WebDataSource *newDataSource = [[WebDataSource alloc] initWithRequest:request];
policyDocumentLoadState = [webFrame _createDocumentLoadStateWithRequest:request];
WebDataSource *newDataSource = [webFrame _dataSourceForDocumentLoadState:policyDocumentLoadState];
[newDataSource _setTriggeringAction:action];
[newDataSource _setOverrideEncoding:[[self dataSource] _overrideEncoding]];
[webFrame _loadDataSource:newDataSource withLoadType:loadType formState:formState];
[newDataSource release];
}
- (void)_reloadAllowingStaleDataWithOverrideEncoding:(NSString *)encoding
......@@ -748,14 +767,13 @@ - (void)_reloadAllowingStaleDataWithOverrideEncoding:(NSString *)encoding
[request setURL:unreachableURL];
[request setCachePolicy:NSURLRequestReturnCacheDataElseLoad];
WebDataSource *newDataSource = [[WebDataSource alloc] initWithRequest:request];
policyDocumentLoadState = [webFrame _createDocumentLoadStateWithRequest:request];
WebDataSource *newDataSource = [webFrame _dataSourceForDocumentLoadState:policyDocumentLoadState];
[request release];
[newDataSource _setOverrideEncoding:encoding];
[webFrame _loadDataSource:newDataSource withLoadType:WebFrameLoadTypeReloadAllowingStaleData formState:nil];
[newDataSource release];
}
- (void)reload
......@@ -776,8 +794,8 @@ - (void)reload
if (unreachableURL != nil)
initialRequest = [NSURLRequest requestWithURL:unreachableURL];
// initWithRequest copies the request
WebDataSource *newDataSource = [[WebDataSource alloc] initWithRequest:initialRequest];
policyDocumentLoadState = [webFrame _createDocumentLoadStateWithRequest:initialRequest];
WebDataSource *newDataSource = [webFrame _dataSourceForDocumentLoadState:policyDocumentLoadState];
NSMutableURLRequest *request = [newDataSource request];
[request setCachePolicy:NSURLRequestReloadIgnoringCacheData];
......@@ -791,8 +809,6 @@ - (void)reload
[newDataSource _setOverrideEncoding:[ds _overrideEncoding]];
[webFrame _loadDataSource:newDataSource withLoadType:WebFrameLoadTypeReload formState:nil];
[newDataSource release];
}
@end
......@@ -71,6 +71,8 @@
65EEDE54084FFB920002DB25 /* WebNSCalendarDateExtras.m in Sources */ = {isa = PBXBuildFile; fileRef = 65EEDE52084FFB920002DB25 /* WebNSCalendarDateExtras.m */; };
65EEDE57084FFC9E0002DB25 /* WebNSFileManagerExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = 65EEDE55084FFC9E0002DB25 /* WebNSFileManagerExtras.h */; };
65EEDE58084FFC9E0002DB25 /* WebNSFileManagerExtras.m in Sources */ = {isa = PBXBuildFile; fileRef = 65EEDE56084FFC9E0002DB25 /* WebNSFileManagerExtras.m */; };
65FFB7FC0AD0B7D30048CD05 /* WebDocumentLoadStateMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 65FFB7FA0AD0B7D30048CD05 /* WebDocumentLoadStateMac.h */; };
65FFB7FD0AD0B7D30048CD05 /* WebDocumentLoadStateMac.m in Sources */ = {isa = PBXBuildFile; fileRef = 65FFB7FB0AD0B7D30048CD05 /* WebDocumentLoadStateMac.m */; };
7E6FEF0108985A3E00C44C3F /* WebDefaultScriptDebugDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E6FEEFF08985A3E00C44C3F /* WebDefaultScriptDebugDelegate.h */; };
7E6FEF0208985A3E00C44C3F /* WebDefaultScriptDebugDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7E6FEF0008985A3E00C44C3F /* WebDefaultScriptDebugDelegate.m */; };
7E6FEF0808985A7200C44C3F /* WebScriptDebugDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E6FEF0508985A7200C44C3F /* WebScriptDebugDelegate.h */; settings = {ATTRIBUTES = (Private, ); }; };
......@@ -404,6 +406,8 @@
65EEDE52084FFB920002DB25 /* WebNSCalendarDateExtras.m */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebNSCalendarDateExtras.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
65EEDE55084FFC9E0002DB25 /* WebNSFileManagerExtras.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebNSFileManagerExtras.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
65EEDE56084FFC9E0002DB25 /* WebNSFileManagerExtras.m */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebNSFileManagerExtras.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
65FFB7FA0AD0B7D30048CD05 /* WebDocumentLoadStateMac.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebDocumentLoadStateMac.h; sourceTree = "<group>"; };
65FFB7FB0AD0B7D30048CD05 /* WebDocumentLoadStateMac.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = WebDocumentLoadStateMac.m; sourceTree = "<group>"; };
700BC50B04144DA100A80182 /* WebDefaultResourceLoadDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebDefaultResourceLoadDelegate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
700BC50C04144DA100A80182 /* WebDefaultResourceLoadDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebDefaultResourceLoadDelegate.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
7082F56F038EADAA00A80180 /* WebKitNSStringExtras.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebKitNSStringExtras.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
......@@ -862,6 +866,8 @@
9C7CABBB0190A37C0ECA16EA /* WebView */ = {
isa = PBXGroup;
children = (
65FFB7FA0AD0B7D30048CD05 /* WebDocumentLoadStateMac.h */,
65FFB7FB0AD0B7D30048CD05 /* WebDocumentLoadStateMac.m */,
F52CA6BD02DF9D0F018635CA /* HTML */,
51E94C0706C02CA300A9B09E /* PDF */,
8373435A0624EE0D00F3B289 /* WebArchive.h */,
......@@ -1214,6 +1220,7 @@
65A734610A923948001B57E8 /* WebPlugInStreamLoaderDelegate.h in Headers */,
659044280A9D3B4200E89459 /* WebDocumentLoadState.h in Headers */,
1C0D40870AC1C8F40009C113 /* WebKitVersionChecks.h in Headers */,
65FFB7FC0AD0B7D30048CD05 /* WebDocumentLoadStateMac.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -1248,7 +1255,6 @@
0867D690FE84028FC02AAC07 /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 149C283208902B0F008A9EFC /* Build configuration list for PBXProject "WebKit" */;
compatibilityVersion = "Xcode 2.4";
hasScannedForEncodings = 1;
knownRegions = (
English,
......@@ -1262,8 +1268,6 @@
mainGroup = 0867D691FE84028FC02AAC07 /* WebKit */;
productRefGroup = 034768DFFF38A50411DB9C8B /* Products */;
projectDirPath = "";
projectRoot = "";
shouldCheckCompatibility = 1;
targets = (
9398100A0824BF01008DF038 /* WebKit */,
);
......@@ -1444,6 +1448,7 @@
6538B1C90A90596E00A07522 /* WebFormDataStream.m in Sources */,
659044290A9D3B4200E89459 /* WebDocumentLoadState.m in Sources */,
1C0D40880AC1C8F40009C113 /* WebKitVersionChecks.m in Sources */,
65FFB7FD0AD0B7D30048CD05 /* WebDocumentLoadStateMac.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -1539,6 +1544,7 @@
isa = XCBuildConfiguration;
buildSettings = {
DEBUG_DEFINES = NDEBUG;
DEBUG_INFORMATION_FORMAT = stabs;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
EXPORTED_SYMBOLS_FILE = "$(EXPORTED_SYMBOLS_FILE_$(CURRENT_ARCH))";
......
......@@ -76,12 +76,6 @@ @interface WebDataSourcePrivate : NSObject
id <WebDocumentRepresentation> representation;
// A reference to actual request used to create the data source.
// This should only be used by the resourceLoadDelegate's
// identifierForInitialRequest:fromDatasource: method. It is
// not guaranteed to remain unchanged, as requests are mutable.
NSURLRequest *originalRequest;
// A copy of the original request used to create the data source.
// We have to copy the request because requests are mutable.
NSURLRequest *originalRequestCopy;
......@@ -156,7 +150,6 @@ - (void)dealloc
[representation release];
[request release];
[originalRequest release];
[originalRequestCopy release];
[pageTitle release];
[response release];
......@@ -615,9 +608,9 @@ - (void)_startLoading
id identifier;
id resourceLoadDelegate = [[self _webView] resourceLoadDelegate];
if ([resourceLoadDelegate respondsToSelector:@selector(webView:identifierForInitialRequest:fromDataSource:)])
identifier = [resourceLoadDelegate webView:[self _webView] identifierForInitialRequest:_private->originalRequest fromDataSource:self];
identifier = [resourceLoadDelegate webView:[self _webView] identifierForInitialRequest:[_private->loadState originalRequest] fromDataSource:self];
else
identifier = [[WebDefaultResourceLoadDelegate sharedResourceLoadDelegate] webView:[self _webView] identifierForInitialRequest:_private->originalRequest fromDataSource:self];
identifier = [[WebDefaultResourceLoadDelegate sharedResourceLoadDelegate] webView:[self _webView] identifierForInitialRequest:[_private->loadState originalRequest] fromDataSource:self];
if (![[_private->webFrame _frameLoader] startLoadingMainResourceWithRequest:_private->request identifier:identifier])
[self _updateLoading];
......@@ -699,6 +692,8 @@ - (BOOL)_isStopping
- (void)_setWebFrame:(WebFrame *)frame
{
[self retain];
[frame retain];
[_private->webFrame release];
_private->webFrame = frame;
......@@ -708,6 +703,8 @@ - (void)_setWebFrame:(WebFrame *)frame
[self _defersCallbacksChanged];
// no need to do _defersCallbacksChanged for subframes since they too
// will be or have been told of their WebFrame
[self release];
}
// May return nil if not initialized with a URL.
......@@ -983,11 +980,12 @@ - (void)_setTitle:(NSString *)title
}
}
@end
@implementation WebDataSource
- (WebDocumentLoadState *)_documentLoadState
{
return _private->loadState;
}
-(id)initWithRequest:(NSURLRequest *)request
- (id)_initWithDocumentLoadState:(WebDocumentLoadState *)loadState
{
self = [super init];
if (!self) {
......@@ -996,18 +994,27 @@ -(id)initWithRequest:(NSURLRequest *)request
_private = [[WebDataSourcePrivate alloc] init];
_private->loadState = [[WebDocumentLoadState alloc] initWithRequest:request];
_private->loadState = [loadState retain];
_private->originalRequest = [request retain];
_private->originalRequestCopy = [request copy];
_private->originalRequestCopy = [[_private->loadState originalRequest] copy];
LOG(Loading, "creating datasource for %@", [request URL]);
_private->request = [_private->originalRequest mutableCopy];
LOG(Loading, "creating datasource for %@", [_private->originalRequestCopy URL]);
_private->request = [[_private->loadState originalRequest] mutableCopy];
_private->supportsMultipartContent = WKSupportsMultipartXMixedReplace(_private->request);
++WebDataSourceCount;
return self;
}
@end
@implementation WebDataSource
-(id)initWithRequest:(NSURLRequest *)request
{
return [self _initWithDocumentLoadState:[[WebDocumentLoadState alloc] initWithRequest:request]];
}
- (void)dealloc
......@@ -1045,9 +1052,9 @@ - (WebFrame *)webFrame
-(NSURLRequest *)initialRequest
{
NSURLRequest *clientRequest = [_private->originalRequest _webDataRequestExternalRequest];
NSURLRequest *clientRequest = [[_private->loadState originalRequest] _webDataRequestExternalRequest];
if (!clientRequest)
clientRequest = _private->originalRequest;
clientRequest = [_private->loadState originalRequest];
return clientRequest;
}
......@@ -1099,7 +1106,7 @@ - (NSString *)pageTitle
- (NSURL *)unreachableURL
{
return [_private->originalRequest _webDataRequestUnreachableURL];
return [[_private->loadState originalRequest] _webDataRequestUnreachableURL];
}
- (WebArchive *)webArchive
......
......@@ -46,6 +46,8 @@
@class WebResource;
@class WebUnarchivingState;
@class WebView;
@class WebDocumentLoadState;
@protocol WebDocumentRepresentation;
@interface WebDataSource (WebInternal)
......@@ -113,4 +115,6 @@
- (void)_decidePolicyForMIMEType:(NSString *)MIMEType decisionListener:(WebPolicyDecisionListener *)listener;
- (void)_setLoading:(BOOL)loading;
- (void)_updateLoading;
- (WebDocumentLoadState *)_documentLoadState;
- (id)_initWithDocumentLoadState:(WebDocumentLoadState *)loadState;
@end
......@@ -37,6 +37,7 @@
#import <WebKit/WebDefaultResourceLoadDelegate.h>
#import <WebKit/WebDefaultUIDelegate.h>
#import <WebKit/WebDocumentInternal.h>
#import <WebKit/WebDocumentLoadStateMac.h>
#import <WebKit/WebFormDataStream.h>
#import <WebKit/WebFrameLoadDelegate.h>
#import <WebKit/WebFrameLoader.h>
......@@ -135,6 +136,7 @@ - (WebFrame *)sourceFrame;
@end
@interface WebFrame (ForwardDecls)
- (WebDataSource *)_policyDataSource;
- (void)_loadHTMLString:(NSString *)string baseURL:(NSURL *)URL unreachableURL:(NSURL *)unreachableURL;
- (NSDictionary *)_actionInformationForLoadType:(WebFrameLoadType)loadType isFormSubmission:(BOOL)isFormSubmission event:(NSEvent *)event originalURL:(NSURL *)URL;
......@@ -180,7 +182,7 @@ @interface WebFramePrivate : NSObject
id policyTarget;
SEL policySelector;
WebFormState *policyFormState;
WebDataSource *policyDataSource;
WebFrameLoadType policyLoadType;