Commit 67d1929c authored by mjs's avatar mjs

Reviewed by Darin.

        
        - move a big slice of data and logic from WebDataSource to WebDocumentLoadState
        
        * Loader/WebDocumentLoadState.h:
        * Loader/WebDocumentLoadState.m:
        (-[WebDocumentLoadState initWithRequest:]):
        (-[WebDocumentLoadState dealloc]):
        (-[WebDocumentLoadState originalRequestCopy]):
        (-[WebDocumentLoadState request]):
        (-[WebDocumentLoadState replaceRequestURLForAnchorScrollWithURL:]):
        (-[WebDocumentLoadState setRequest:]):
        (-[WebDocumentLoadState setResponse:]):
        (-[WebDocumentLoadState isStopping]):
        (-[WebDocumentLoadState bridge]):
        (-[WebDocumentLoadState setMainDocumentError:]):
        (-[WebDocumentLoadState mainDocumentError]):
        (-[WebDocumentLoadState clearErrors]):
        (-[WebDocumentLoadState mainReceivedError:complete:]):
        (-[WebDocumentLoadState stopLoading]):
        (-[WebDocumentLoadState setupForReplace]):
        (-[WebDocumentLoadState commitIfReady]):
        (-[WebDocumentLoadState finishedLoading]):
        (-[WebDocumentLoadState setCommitted:]):
        (-[WebDocumentLoadState isCommitted]):
        (-[WebDocumentLoadState setLoading:]):
        (-[WebDocumentLoadState isLoading]):
        (-[WebDocumentLoadState commitLoadWithData:]):
        (-[WebDocumentLoadState doesProgressiveLoadWithMIMEType:]):
        (-[WebDocumentLoadState receivedData:]):
        (-[WebDocumentLoadState setupForReplaceByMIMEType:]):
        (-[WebDocumentLoadState updateLoading]):
        (-[WebDocumentLoadState response]):
        * Loader/WebFrameLoader.h:
        * Loader/WebFrameLoader.m:
        (-[WebFrameLoader activeDocumentLoadState]):
        (-[WebFrameLoader activeDataSource]):
        (-[WebFrameLoader _archivedSubresourceForURL:]):
        (-[WebFrameLoader addPlugInStreamLoader:]):
        (-[WebFrameLoader removePlugInStreamLoader:]):
        (-[WebFrameLoader addSubresourceLoader:]):
        (-[WebFrameLoader removeSubresourceLoader:]):
        (-[WebFrameLoader documentLoadState]):
        (-[WebFrameLoader provisionalDocumentLoadState]):
        (-[WebFrameLoader stopLoading]):
        (-[WebFrameLoader _originalRequest]):
        (-[WebFrameLoader _receivedData:]):
        (-[WebFrameLoader _setRequest:]):
        (-[WebFrameLoader bridge]):
        (-[WebFrameLoader _handleFallbackContent]):
        (-[WebFrameLoader _isStopping]):
        (-[WebFrameLoader _setupForReplaceByMIMEType:]):
        (-[WebFrameLoader _setResponse:]):
        (-[WebFrameLoader _mainReceivedError:complete:]):
        (-[WebFrameLoader _finishedLoading]):
        (-[WebFrameLoader didReceiveServerRedirectForProvisionalLoadForFrame]):
        (-[WebFrameLoader finishedLoadingDocumentLoadState:]):
        (-[WebFrameLoader commitProvisitionalLoad]):
        (-[WebFrameLoader committedLoadWithDocumentLoadState:data:]):
        (-[WebFrameLoader isReplacing]):
        (-[WebFrameLoader setReplacing]):
        (-[WebFrameLoader revertToProvisionalWithDocumentLoadState:]):
        (-[WebFrameLoader documentLoadState:setMainDocumentError:]):
        (-[WebFrameLoader documentLoadState:mainReceivedCompleteError:]):
        (-[WebFrameLoader finalSetupForReplaceWithDocumentLoadState:]):
        * WebView/WebDataSource.m:
        (-[WebDataSourcePrivate dealloc]):
        (-[WebDataSource _prepareForLoadStart]):
        (-[WebDataSource _mainDocumentError]):
        (-[WebDataSource _finishedLoading]):
        (-[WebDataSource _receivedData:]):
        (-[WebDataSource _setMainDocumentError:]):
        (-[WebDataSource _clearUnarchivingState]):
        (-[WebDataSource _revertToProvisionalState]):
        (-[WebDataSource _receivedMainResourceError:complete:]):
        (-[WebDataSource _startLoading]):
        (-[WebDataSource _loadFromPageCache:]):
        (-[WebDataSource _bridge]):
        (-[WebDataSource _setPrimaryLoadComplete:]):
        (-[WebDataSource _URLForHistory]):
        (-[WebDataSource _setTitle:]):
        (-[WebDataSource _initWithDocumentLoadState:]):
        (-[WebDataSource request]):
        (-[WebDataSource response]):
        (-[WebDataSource isLoading]):
        (-[WebDataSource webArchive]):
        * WebView/WebDataSourceInternal.h:
        * WebView/WebDocumentLoadStateMac.m:
        (-[WebDocumentLoadStateMac initWithRequest:]):
        * WebView/WebFrame.m:
        (-[WebFrame _createItem:]):
        (-[WebFrame _receivedMainResourceError:]):
        (-[WebFrame _transitionToCommitted:]):
        (-[WebFrame _commitProvisionalLoad:]):
        (-[WebFrame _checkLoadCompleteForThisFrame]):
        (-[WebFrame _loadItem:withLoadType:]):
        (-[WebFrame _continueFragmentScrollAfterNavigationPolicy:formState:]):
        (-[WebFrame _didReceiveServerRedirectForProvisionalLoadForFrame]):
        (-[WebFrame _provisionalLoadStarted]):
        * WebView/WebFrameInternal.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@16725 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 8f6e64c7
2006-10-02 Maciej Stachowiak <mjs@apple.com>
Reviewed by Darin.
- move a big slice of data and logic from WebDataSource to WebDocumentLoadState
* Loader/WebDocumentLoadState.h:
* Loader/WebDocumentLoadState.m:
(-[WebDocumentLoadState initWithRequest:]):
(-[WebDocumentLoadState dealloc]):
(-[WebDocumentLoadState originalRequestCopy]):
(-[WebDocumentLoadState request]):
(-[WebDocumentLoadState replaceRequestURLForAnchorScrollWithURL:]):
(-[WebDocumentLoadState setRequest:]):
(-[WebDocumentLoadState setResponse:]):
(-[WebDocumentLoadState isStopping]):
(-[WebDocumentLoadState bridge]):
(-[WebDocumentLoadState setMainDocumentError:]):
(-[WebDocumentLoadState mainDocumentError]):
(-[WebDocumentLoadState clearErrors]):
(-[WebDocumentLoadState mainReceivedError:complete:]):
(-[WebDocumentLoadState stopLoading]):
(-[WebDocumentLoadState setupForReplace]):
(-[WebDocumentLoadState commitIfReady]):
(-[WebDocumentLoadState finishedLoading]):
(-[WebDocumentLoadState setCommitted:]):
(-[WebDocumentLoadState isCommitted]):
(-[WebDocumentLoadState setLoading:]):
(-[WebDocumentLoadState isLoading]):
(-[WebDocumentLoadState commitLoadWithData:]):
(-[WebDocumentLoadState doesProgressiveLoadWithMIMEType:]):
(-[WebDocumentLoadState receivedData:]):
(-[WebDocumentLoadState setupForReplaceByMIMEType:]):
(-[WebDocumentLoadState updateLoading]):
(-[WebDocumentLoadState response]):
* Loader/WebFrameLoader.h:
* Loader/WebFrameLoader.m:
(-[WebFrameLoader activeDocumentLoadState]):
(-[WebFrameLoader activeDataSource]):
(-[WebFrameLoader _archivedSubresourceForURL:]):
(-[WebFrameLoader addPlugInStreamLoader:]):
(-[WebFrameLoader removePlugInStreamLoader:]):
(-[WebFrameLoader addSubresourceLoader:]):
(-[WebFrameLoader removeSubresourceLoader:]):
(-[WebFrameLoader documentLoadState]):
(-[WebFrameLoader provisionalDocumentLoadState]):
(-[WebFrameLoader stopLoading]):
(-[WebFrameLoader _originalRequest]):
(-[WebFrameLoader _receivedData:]):
(-[WebFrameLoader _setRequest:]):
(-[WebFrameLoader bridge]):
(-[WebFrameLoader _handleFallbackContent]):
(-[WebFrameLoader _isStopping]):
(-[WebFrameLoader _setupForReplaceByMIMEType:]):
(-[WebFrameLoader _setResponse:]):
(-[WebFrameLoader _mainReceivedError:complete:]):
(-[WebFrameLoader _finishedLoading]):
(-[WebFrameLoader didReceiveServerRedirectForProvisionalLoadForFrame]):
(-[WebFrameLoader finishedLoadingDocumentLoadState:]):
(-[WebFrameLoader commitProvisitionalLoad]):
(-[WebFrameLoader committedLoadWithDocumentLoadState:data:]):
(-[WebFrameLoader isReplacing]):
(-[WebFrameLoader setReplacing]):
(-[WebFrameLoader revertToProvisionalWithDocumentLoadState:]):
(-[WebFrameLoader documentLoadState:setMainDocumentError:]):
(-[WebFrameLoader documentLoadState:mainReceivedCompleteError:]):
(-[WebFrameLoader finalSetupForReplaceWithDocumentLoadState:]):
* WebView/WebDataSource.m:
(-[WebDataSourcePrivate dealloc]):
(-[WebDataSource _prepareForLoadStart]):
(-[WebDataSource _mainDocumentError]):
(-[WebDataSource _finishedLoading]):
(-[WebDataSource _receivedData:]):
(-[WebDataSource _setMainDocumentError:]):
(-[WebDataSource _clearUnarchivingState]):
(-[WebDataSource _revertToProvisionalState]):
(-[WebDataSource _receivedMainResourceError:complete:]):
(-[WebDataSource _startLoading]):
(-[WebDataSource _loadFromPageCache:]):
(-[WebDataSource _bridge]):
(-[WebDataSource _setPrimaryLoadComplete:]):
(-[WebDataSource _URLForHistory]):
(-[WebDataSource _setTitle:]):
(-[WebDataSource _initWithDocumentLoadState:]):
(-[WebDataSource request]):
(-[WebDataSource response]):
(-[WebDataSource isLoading]):
(-[WebDataSource webArchive]):
* WebView/WebDataSourceInternal.h:
* WebView/WebDocumentLoadStateMac.m:
(-[WebDocumentLoadStateMac initWithRequest:]):
* WebView/WebFrame.m:
(-[WebFrame _createItem:]):
(-[WebFrame _receivedMainResourceError:]):
(-[WebFrame _transitionToCommitted:]):
(-[WebFrame _commitProvisionalLoad:]):
(-[WebFrame _checkLoadCompleteForThisFrame]):
(-[WebFrame _loadItem:withLoadType:]):
(-[WebFrame _continueFragmentScrollAfterNavigationPolicy:formState:]):
(-[WebFrame _didReceiveServerRedirectForProvisionalLoadForFrame]):
(-[WebFrame _provisionalLoadStarted]):
* WebView/WebFrameInternal.h:
2006-10-02 Justin Garcia <justin.garcia@apple.com>
Reviewed by john
......
......@@ -42,6 +42,24 @@
// 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;
// The 'working' request for this datasource. It may be mutated
// several times from the original request to include additional
// headers, cookie information, canonicalization and redirects.
NSMutableURLRequest *request;
NSURLResponse *response;
NSError *mainDocumentError;
BOOL committed; // This data source has been committed
BOOL stopping;
BOOL loading; // self and webView are retained while loading
BOOL gotFirstByte; // got first byte
}
- (id)initWithRequest:(NSURLRequest *)request;
......@@ -50,5 +68,26 @@
- (void)setMainResourceData:(NSData *)data;
- (NSData *)mainResourceData;
- (NSURLRequest *)originalRequest;
- (NSURLRequest *)originalRequestCopy;
- (NSMutableURLRequest *)request;
- (void)setRequest:(NSURLRequest *)request;
- (void)replaceRequestURLForAnchorScrollWithURL:(NSURL *)URL;
- (BOOL)isStopping;
- (void)stopLoading;
- (void)setupForReplace;
- (void)commitIfReady;
- (void)setCommitted:(BOOL)f;
- (BOOL)isCommitted;
- (BOOL)isLoading;
- (void)setLoading:(BOOL)f;
- (void)updateLoading;
- (void)receivedData:(NSData *)data;
- (void)setupForReplaceByMIMEType:(NSString *)newMIMEType;
- (void)finishedLoading;
- (NSURLResponse *)response;
- (void)clearErrors;
- (NSError *)mainDocumentError;
- (void)mainReceivedError:(NSError *)error complete:(BOOL)isComplete;
- (void)setResponse:(NSURLResponse *)resp;
@end
......@@ -31,18 +31,21 @@
#import <JavaScriptCore/Assertions.h>
#import "WebFrameLoader.h"
#import "WebDataProtocol.h"
#import "WebFrameBridge.h"
#import <WebKitSystemInterface.h>
@implementation WebDocumentLoadState
- (id)initWithRequest:(NSURLRequest *)request
- (id)initWithRequest:(NSURLRequest *)req
{
self = [super init];
if (!self)
return nil;
originalRequest = [request retain];
originalRequest = [req retain];
originalRequestCopy = [originalRequest copy];
request = [originalRequest mutableCopy];
return self;
}
......@@ -51,6 +54,10 @@ - (void)dealloc
{
[mainResourceData release];
[originalRequest release];
[originalRequestCopy release];
[request release];
[response release];
[mainDocumentError release];
[super dealloc];
}
......@@ -85,5 +92,256 @@ - (NSURLRequest *)originalRequest
return originalRequest;
}
- (NSURLRequest *)originalRequestCopy
{
return originalRequestCopy;
}
- (NSMutableURLRequest *)request
{
NSMutableURLRequest *clientRequest = [request _webDataRequestExternalRequest];
if (!clientRequest)
clientRequest = request;
return clientRequest;
}
- (void)replaceRequestURLForAnchorScrollWithURL:(NSURL *)URL
{
// assert that URLs differ only by fragment ID
NSMutableURLRequest *newOriginalRequest = [originalRequestCopy mutableCopy];
[originalRequestCopy release];
[newOriginalRequest setURL:URL];
originalRequestCopy = newOriginalRequest;
NSMutableURLRequest *newRequest = [request mutableCopy];
[request release];
[newRequest setURL:URL];
request = newRequest;
}
- (void)setRequest:(NSURLRequest *)req
{
ASSERT_ARG(req, req != request);
// Replacing an unreachable URL with alternate content looks like a server-side
// redirect at this point, but we can replace a committed dataSource.
BOOL handlingUnreachableURL = [req _webDataRequestUnreachableURL] != nil;
if (handlingUnreachableURL)
committed = NO;
// We should never be getting a redirect callback after the data
// source is committed, except in the unreachable URL case. It
// would be a WebFoundation bug if it sent a redirect callback after commit.
ASSERT(!committed);
NSURLRequest *oldRequest = request;
request = [req mutableCopy];
// Only send webView:didReceiveServerRedirectForProvisionalLoadForFrame: if URL changed.
// Also, don't send it when replacing unreachable URLs with alternate content.
if (!handlingUnreachableURL && ![[oldRequest URL] isEqual:[req URL]])
[frameLoader didReceiveServerRedirectForProvisionalLoadForFrame];
[oldRequest release];
}
- (void)setResponse:(NSURLResponse *)resp
{
[resp retain];
[response release];
response = resp;
}
- (BOOL)isStopping
{
return stopping;
}
- (WebFrameBridge *)bridge
{
return [frameLoader bridge];
}
- (void)setMainDocumentError:(NSError *)error
{
[error retain];
[mainDocumentError release];
mainDocumentError = error;
[frameLoader documentLoadState:self setMainDocumentError:error];
}
- (NSError *)mainDocumentError
{
return mainDocumentError;
}
- (void)clearErrors
{
[mainDocumentError release];
mainDocumentError = nil;
}
- (void)mainReceivedError:(NSError *)error complete:(BOOL)isComplete
{
if (!frameLoader)
return;
[self setMainDocumentError:error];
if (isComplete) {
[frameLoader documentLoadState:self mainReceivedCompleteError:error];
}
}
// Cancels the data source's pending loads. Conceptually, a data source only loads
// one document at a time, but one document may have many related resources.
// stopLoading will stop all loads initiated by the data source,
// but not loads initiated by child frames' data sources -- that's the WebFrame's job.
- (void)stopLoading
{
// Always attempt to stop the bridge/part because it may still be loading/parsing after the data source
// is done loading and not stopping it can cause a world leak.
if (committed)
[[self bridge] stopLoading];
if (!loading)
return;
[self retain];
stopping = YES;
if ([frameLoader isLoadingMainResource]) {
// Stop the main resource loader and let it send the cancelled message.
[frameLoader cancelMainResourceLoad];
} else if ([frameLoader isLoadingSubresources]) {
// The main resource loader already finished loading. Set the cancelled error on the
// document and let the subresourceLoaders send individual cancelled messages below.
[self setMainDocumentError:[frameLoader cancelledErrorWithRequest:request]];
} else {
// If there are no resource loaders, we need to manufacture a cancelled message.
// (A back/forward navigation has no resource loaders because its resources are cached.)
[self mainReceivedError:[frameLoader cancelledErrorWithRequest:request] complete:YES];
}
[frameLoader stopLoadingSubresources];
[frameLoader stopLoadingPlugIns];
stopping = NO;
[self release];
}
- (void)setupForReplace
{
[frameLoader setupForReplace];
committed = NO;
}
- (void)commitIfReady
{
if (gotFirstByte && !committed) {
committed = YES;
[frameLoader commitProvisitionalLoad];
}
}
- (void)finishedLoading
{
gotFirstByte = YES;
[self commitIfReady];
[frameLoader finishedLoadingDocumentLoadState:self];
[[self bridge] end];
}
- (void)setCommitted:(BOOL)f
{
committed = f;
}
- (BOOL)isCommitted
{
return committed;
}
- (void)setLoading:(BOOL)f
{
loading = f;
}
- (BOOL)isLoading
{
return loading;
}
- (void)commitLoadWithData:(NSData *)data
{
// Both unloading the old page and parsing the new page may execute JavaScript which destroys the datasource
// by starting a new load, so retain temporarily.
[self retain];
[self commitIfReady];
[frameLoader committedLoadWithDocumentLoadState:self data:data];
[self release];
}
- (BOOL)doesProgressiveLoadWithMIMEType:(NSString *)MIMEType
{
return ![frameLoader isReplacing] || [MIMEType isEqualToString:@"text/html"];
}
- (void)receivedData:(NSData *)data
{
gotFirstByte = YES;
if ([self doesProgressiveLoadWithMIMEType:[response MIMEType]])
[self commitLoadWithData:data];
}
- (void)setupForReplaceByMIMEType:(NSString *)newMIMEType
{
if (!gotFirstByte)
return;
NSString *oldMIMEType = [response MIMEType];
if (![self doesProgressiveLoadWithMIMEType:oldMIMEType]) {
[frameLoader revertToProvisionalWithDocumentLoadState:self];
[self setupForReplace];
[self commitLoadWithData:[self mainResourceData]];
}
[frameLoader finishedLoadingDocumentLoadState:self];
[[self bridge] end];
[frameLoader setReplacing];
gotFirstByte = NO;
if ([self doesProgressiveLoadWithMIMEType:newMIMEType]) {
[frameLoader revertToProvisionalWithDocumentLoadState:self];
[self setupForReplace];
}
[frameLoader stopLoadingSubresources];
[frameLoader stopLoadingPlugIns];
[frameLoader finalSetupForReplaceWithDocumentLoadState:self];
}
- (void)updateLoading
{
ASSERT(self == [frameLoader activeDocumentLoadState]);
[self setLoading:[frameLoader isLoading]];
}
- (NSURLResponse *)response
{
return response;
}
@end
......@@ -102,6 +102,9 @@ typedef enum {
- (WebDataSource *)provisionalDataSource;
- (WebDataSource *)policyDataSource;
- (WebDataSource *)activeDataSource;
- (WebDocumentLoadState *)activeDocumentLoadState;
- (WebDocumentLoadState *)documentLoadState;
- (WebDocumentLoadState *)provisionalDocumentLoadState;
- (void)_setPolicyDocumentLoadState:(WebDocumentLoadState *)loadState;
- (WebFrameState)state;
- (void)clearDataSource;
......@@ -109,7 +112,8 @@ typedef enum {
+ (CFAbsoluteTime)timeOfLastCompletedLoad;
- (WebResource *)_archivedSubresourceForURL:(NSURL *)URL;
- (BOOL)_defersCallbacks;
- (BOOL)defersCallbacks;
- (void)defersCallbacksChanged;
- (id)_identifierForInitialRequest:(NSURLRequest *)clientRequest;
- (NSURLRequest *)_willSendRequest:(NSMutableURLRequest *)clientRequest forResource:(id)identifier redirectResponse:(NSURLResponse *)redirectResponse;
- (void)_didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)currentWebChallenge forResource:(id)identifier;
......@@ -161,4 +165,16 @@ typedef enum {
- (void)_reloadAllowingStaleDataWithOverrideEncoding:(NSString *)encoding;
- (void)_loadRequest:(NSURLRequest *)request triggeringAction:(NSDictionary *)action loadType:(WebFrameLoadType)loadType formState:(WebFormState *)formState;
- (void)didReceiveServerRedirectForProvisionalLoadForFrame;
- (WebFrameBridge *)bridge;
- (void)finishedLoadingDocumentLoadState:(WebDocumentLoadState *)loadState;
- (void)commitProvisitionalLoad;
- (void)committedLoadWithDocumentLoadState:(WebDocumentLoadState *)loadState data:(NSData *)data;
- (BOOL)isReplacing;
- (void)setReplacing;
- (void)revertToProvisionalWithDocumentLoadState:(WebDocumentLoadState *)loadState;
- (void)documentLoadState:(WebDocumentLoadState *)loadState setMainDocumentError:(NSError *)error;
- (void)documentLoadState:(WebDocumentLoadState *)loadState mainReceivedCompleteError:(NSError *)error;
- (void)finalSetupForReplaceWithDocumentLoadState:(WebDocumentLoadState *)loadState;
@end
......@@ -72,20 +72,48 @@ - (void)dealloc
[super dealloc];
}
- (WebDocumentLoadState *)activeDocumentLoadState
{
if (state == WebFrameStateProvisional)
return provisionalDocumentLoadState;
return documentLoadState;
}
- (WebDataSource *)activeDataSource
{
return [webFrame _dataSourceForDocumentLoadState:[self activeDocumentLoadState]];
}
- (WebResource *)_archivedSubresourceForURL:(NSURL *)URL
{
return [[self activeDataSource] _archivedSubresourceForURL:URL];
}
- (void)addPlugInStreamLoader:(WebLoader *)loader
{
if (!plugInStreamLoaders)
plugInStreamLoaders = [[NSMutableArray alloc] init];
[plugInStreamLoaders addObject:loader];
[[self activeDataSource] _setLoading:YES];
[[self activeDocumentLoadState] setLoading:YES];
}
- (void)removePlugInStreamLoader:(WebLoader *)loader
{
[plugInStreamLoaders removeObject:loader];
[[self activeDataSource] _updateLoading];
[[self activeDocumentLoadState] updateLoading];
}
- (void)defersCallbacksChanged
{
[self setDefersCallbacks:[[webFrame webView] defersCallbacks]];
}
- (BOOL)defersCallbacks
{
return [[webFrame webView] defersCallbacks];
}
- (void)setDefersCallbacks:(BOOL)defers
{
[mainResourceLoader setDefersCallbacks:defers];
......@@ -142,13 +170,13 @@ - (void)addSubresourceLoader:(WebLoader *)loader
if (subresourceLoaders == nil)
subresourceLoaders = [[NSMutableArray alloc] init];
[subresourceLoaders addObject:loader];
[[self activeDataSource] _setLoading:YES];
[[self activeDocumentLoadState] setLoading:YES];
}
- (void)removeSubresourceLoader:(WebLoader *)loader
{
[subresourceLoaders removeObject:loader];
[[self activeDataSource] _updateLoading];
[[self activeDocumentLoadState] updateLoading];
}
- (NSData *)mainResourceData
......@@ -210,6 +238,11 @@ - (void)_setDocumentLoadState:(WebDocumentLoadState *)loadState
documentLoadState = loadState;
}
- (WebDocumentLoadState *)documentLoadState
{
return documentLoadState;
}
- (WebDataSource *)policyDataSource
{
return [webFrame _dataSourceForDocumentLoadState:policyDocumentLoadState];
......@@ -232,6 +265,11 @@ - (WebDataSource *)provisionalDataSource
return [webFrame _dataSourceForDocumentLoadState:provisionalDocumentLoadState];
}
- (WebDocumentLoadState *)provisionalDocumentLoadState
{
return provisionalDocumentLoadState;
}
- (void)_setProvisionalDocumentLoadState:(WebDocumentLoadState *)loadState
{
ASSERT(!loadState || !provisionalDocumentLoadState);
......@@ -313,8 +351,8 @@ - (void)commitProvisionalLoad
- (void)stopLoading
{
[[self provisionalDataSource] _stopLoading];
[[self dataSource] _stopLoading];
[[self provisionalDocumentLoadState] stopLoading];
[[self documentLoadState] stopLoading];
[self _clearProvisionalDataSource];
[self clearArchivedResources];
}
......@@ -342,29 +380,6 @@ - (void)setupForReplace
[webFrame _detachChildren];
}
- (WebDocumentLoadState *)activeDocumentLoadState
{
if (state == WebFrameStateProvisional)
return provisionalDocumentLoadState;
return documentLoadState;
}
- (WebDataSource *)activeDataSource
{
return [webFrame _dataSourceForDocumentLoadState:[self activeDocumentLoadState]];
}
- (WebResource *)_archivedSubresourceForURL:(NSURL *)URL
{
return [[self activeDataSource] _archivedSubresourceForURL:URL];
}
- (BOOL)_defersCallbacks
{
return [[self activeDataSource] _defersCallbacks];
}
- (id)_identifierForInitialRequest:(NSURLRequest *)clientRequest
{
return [[self activeDataSource] _identifierForInitialRequest:clientRequest];
......@@ -422,7 +437,7 @@ - (void)_receivedError:(NSError *)error
- (NSURLRequest *)_originalRequest
{
return [[self activeDataSource] _originalRequest];
return [[self activeDocumentLoadState] originalRequestCopy];
}
- (WebFrame *)webFrame
......@@ -445,12 +460,12 @@ - (NSURLRequest *)initialRequest
- (void)_receivedData:(NSData *)data
{
[[self activeDataSource] _receivedData:data];
[[self activeDocumentLoadState] receivedData:data];
}
- (void)_setRequest:(NSURLRequest *)request
{
[[self activeDataSource] _setRequest:request];
[[self activeDocumentLoadState] setRequest:request];
}