Commit 7a17f0c4 authored by mjs's avatar mjs

Refactor things a bit so all loads bottleneck through a single

	method (_loadDataSource:withLoadType:).

        * WebView.subproj/WebFrame.m:
        (-[WebFrame loadRequest:]):
        (-[WebFrame reload]):
        * WebView.subproj/WebFramePrivate.h:
        * WebView.subproj/WebFramePrivate.m:
        (-[WebFrame _loadItem:fromItem:withLoadType:]):
        (-[WebFrame _loadRequest:triggeringAction:loadType:]):
        (-[WebFrame _loadURL:loadType:triggeringEvent:isFormSubmission:]):
        (-[WebFrame _postWithURL:data:contentType:triggeringEvent:]):
        (-[WebFrame _reloadAllowingStaleDataWithOverrideEncoding:]):
        (-[WebFrame _loadDataSource:withLoadType:]):
        (-[WebFrame _downloadRequest:toPath:]):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2684 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 6a96e2b0
2002-11-14 Maciej Stachowiak <mjs@apple.com>
Refactor things a bit so all loads bottleneck through a single
method (_loadDataSource:withLoadType:).
* WebView.subproj/WebFrame.m:
(-[WebFrame loadRequest:]):
(-[WebFrame reload]):
* WebView.subproj/WebFramePrivate.h:
* WebView.subproj/WebFramePrivate.m:
(-[WebFrame _loadItem:fromItem:withLoadType:]):
(-[WebFrame _loadRequest:triggeringAction:loadType:]):
(-[WebFrame _loadURL:loadType:triggeringEvent:isFormSubmission:]):
(-[WebFrame _postWithURL:data:contentType:triggeringEvent:]):
(-[WebFrame _reloadAllowingStaleDataWithOverrideEncoding:]):
(-[WebFrame _loadDataSource:withLoadType:]):
(-[WebFrame _downloadRequest:toPath:]):
2002-11-14 Maciej Stachowiak <mjs@apple.com>
Change things so the public interface to loading is loadRequest:
......
2002-11-14 Maciej Stachowiak <mjs@apple.com>
Refactor things a bit so all loads bottleneck through a single
method (_loadDataSource:withLoadType:).
* WebView.subproj/WebFrame.m:
(-[WebFrame loadRequest:]):
(-[WebFrame reload]):
* WebView.subproj/WebFramePrivate.h:
* WebView.subproj/WebFramePrivate.m:
(-[WebFrame _loadItem:fromItem:withLoadType:]):
(-[WebFrame _loadRequest:triggeringAction:loadType:]):
(-[WebFrame _loadURL:loadType:triggeringEvent:isFormSubmission:]):
(-[WebFrame _postWithURL:data:contentType:triggeringEvent:]):
(-[WebFrame _reloadAllowingStaleDataWithOverrideEncoding:]):
(-[WebFrame _loadDataSource:withLoadType:]):
(-[WebFrame _downloadRequest:toPath:]):
2002-11-14 Maciej Stachowiak <mjs@apple.com>
Change things so the public interface to loading is loadRequest:
......
......@@ -106,9 +106,7 @@ - (WebDataSource *)dataSource
- (void)loadRequest:(WebResourceRequest *)request
{
WebDataSource *newDataSource = [[WebDataSource alloc] initWithRequest:request];
if ([self _setProvisionalDataSource:newDataSource]) {
[self _startLoading];
}
[self _loadDataSource:newDataSource withLoadType:WebFrameLoadTypeStandard];
[newDataSource release];
}
......@@ -137,11 +135,8 @@ - (void)reload
[newDataSource _setOverrideEncoding:[dataSource _overrideEncoding]];
if ([self _setProvisionalDataSource:newDataSource]) {
[self _setLoadType:WebFrameLoadTypeReload];
[self _startLoading];
}
[self _loadDataSource:newDataSource withLoadType:WebFrameLoadTypeReload];
[newDataSource release];
}
......
......@@ -139,8 +139,9 @@ typedef enum {
- (WebHistoryItem *)_itemForRestoringDocState;
- (void)_handleUnimplementablePolicy:(WebPolicyAction)policy errorCode:(int)code forURL:(NSURL *)URL;
- (BOOL)_setProvisionalDataSource: (WebDataSource *)dataSource;
- (void)_startLoading;
- (void)_loadDataSource:(WebDataSource *)dataSource withLoadType:(WebFrameLoadType)type;
- (void)_downloadRequest:(WebResourceRequest *)request toPath:(NSString *)path;
@end
......@@ -812,13 +812,12 @@ - (void)_loadItem:(WebHistoryItem *)item fromItem:(WebHistoryItem *)fromItem wit
}
}
WebDataSource *newDataSource = [[WebDataSource alloc] initWithRequest:request];
[request release];
[self _setProvisionalDataSource:newDataSource];
// Remember this item so we can traverse any child items as child frames load
[_private setProvisionalItem:item];
[self _setLoadType:type];
[self _startLoading];
WebDataSource *newDataSource = [[WebDataSource alloc] initWithRequest:request];
[request release];
[self _loadDataSource:newDataSource withLoadType:type];
[newDataSource release];
}
}
......@@ -889,14 +888,11 @@ - (void)_goToItem: (WebHistoryItem *)item withLoadType: (WebFrameLoadType)type
[self _recursiveGoToItem:item fromItem:currItem withLoadType:type];
}
- (void)_loadRequest:(WebResourceRequest *)request triggeringAction:(NSDictionary *)action
- (void)_loadRequest:(WebResourceRequest *)request triggeringAction:(NSDictionary *)action loadType:(WebFrameLoadType)loadType
{
WebDataSource *newDataSource = [[WebDataSource alloc] initWithRequest:request];
[newDataSource _setTriggeringAction:action];
if ([self _setProvisionalDataSource:newDataSource]) {
[self _startLoading];
}
[self _loadDataSource:newDataSource withLoadType:loadType];
[newDataSource release];
}
......@@ -1041,10 +1037,7 @@ - (void)_loadURL:(NSURL *)URL loadType:(WebFrameLoadType)loadType triggeringEven
WebFrameLoadType previousLoadType = [self _loadType];
WebDataSource *oldDataSource = [[self dataSource] retain];
[self _loadRequest:request triggeringAction:action];
// NB: must be done after loadRequest:, which sets the provDataSource, which
// inits the load type to Standard
[self _setLoadType:loadType];
[self _loadRequest:request triggeringAction:action loadType:loadType];
if (_private->instantRedirectComing) {
_private->instantRedirectComing = NO;
......@@ -1115,7 +1108,7 @@ - (void)_postWithURL:(NSURL *)URL data:(NSData *)data contentType:(NSString *)co
NSDictionary *action = [self _actionInformationForNavigationType:WebNavigationTypeFormSubmitted event:event];
[self _loadRequest:request triggeringAction:action];
[self _loadRequest:request triggeringAction:action loadType:WebFrameLoadTypeStandard];
[request release];
}
......@@ -1187,10 +1180,8 @@ - (void)_reloadAllowingStaleDataWithOverrideEncoding:(NSString *)encoding
[newDataSource _setOverrideEncoding:encoding];
if ([self _setProvisionalDataSource:newDataSource]) {
[self _setLoadType:WebFrameLoadTypeReloadAllowingStaleData];
[self _startLoading];
}
[self _loadDataSource:newDataSource
withLoadType:WebFrameLoadTypeReloadAllowingStaleData];
[newDataSource release];
}
......@@ -1268,10 +1259,7 @@ - (WebHistoryItem *)_itemForRestoringDocState
return [_private currentItem];
}
// Will return NO and not set the provisional data source if the controller
// disallows by returning a WebURLPolicyIgnore.
- (BOOL)_setProvisionalDataSource: (WebDataSource *)newDataSource
- (void)_loadDataSource:(WebDataSource *)newDataSource withLoadType: (WebFrameLoadType)loadType
{
ASSERT([self controller] != nil);
......@@ -1291,7 +1279,7 @@ - (BOOL)_setProvisionalDataSource: (WebDataSource *)newDataSource
// returns YES if we should show the data source
if (![self _continueAfterNavigationPolicyForRequest:[newDataSource request] dataSource:newDataSource]) {
return NO;
return;
}
if ([self parent]) {
......@@ -1307,12 +1295,8 @@ - (BOOL)_setProvisionalDataSource: (WebDataSource *)newDataSource
[self _setState: WebFrameStateProvisional];
return YES;
}
[self _setLoadType:loadType];
- (void)_startLoading
{
if (self == [[self controller] mainFrame])
LOG(DocumentLoad, "loading %@", [[[self provisionalDataSource] request] URL]);
......@@ -1322,12 +1306,11 @@ - (void)_startLoading
- (void)_downloadRequest:(WebResourceRequest *)request toPath:(NSString *)path
{
WebDataSource *dataSource = [[WebDataSource alloc] initWithRequest:request];
[dataSource _setIsDownloading:YES];
[dataSource _setDownloadPath:path];
if([self _setProvisionalDataSource:dataSource]){
[self _startLoading];
}
[self _loadDataSource:dataSource withLoadType:WebFrameLoadTypeStandard];
[dataSource release];
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment