Commit 4f7065eb authored by cblu's avatar cblu

Real fix for: 3104183 - Assert loading www.louisvuitton.com

	Since we don't consider plug-in content as a subresource, attaching plug-in streams to the datasource has no affect on the loading state of the datasource. Both stopLoading on WebFrame and _stopLoading datasource, would not stop plug-ins streams after the data source was done loading. Because of this, I've decided to not keep a list of plug-in streams attached to the data source and pulled my previous change. To fix this bug, WebBaseResourceHandleDelegate now retains the controller.

        * Plugins.subproj/WebNetscapePluginStream.m:
        (-[WebNetscapePluginStream start]):
        (-[WebNetscapePluginStream cancel]):
        (-[WebNetscapePluginStream handleDidFinishLoading:]):
        (-[WebNetscapePluginStream handle:didFailLoadingWithError:]):
        * WebView.subproj/WebBaseResourceHandleDelegate.h:
        * WebView.subproj/WebBaseResourceHandleDelegate.m:
        (-[WebBaseResourceHandleDelegate _releaseResources]):
        (-[WebBaseResourceHandleDelegate setDataSource:]):
        (-[WebBaseResourceHandleDelegate handle:willSendRequest:]):
        (-[WebBaseResourceHandleDelegate handleDidFinishLoading:]):
        (-[WebBaseResourceHandleDelegate handle:didFailLoadingWithError:]):
        (-[WebBaseResourceHandleDelegate _cancelWithError:]):
        * WebView.subproj/WebDataSourcePrivate.h:
        * WebView.subproj/WebDataSourcePrivate.m:
        (-[WebDataSourcePrivate dealloc]):
        (-[WebDataSource _stopLoading]):
        (-[WebDataSource _makeHandleDelegates:deferCallbacks:]):
        (-[WebDataSource _defersCallbacksChanged]):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2742 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent effd7e1c
2002-11-18 Chris Blumenberg <cblu@apple.com>
Real fix for: 3104183 - Assert loading www.louisvuitton.com
Since we don't consider plug-in content as a subresource, attaching plug-in streams to the datasource has no affect on the loading state of the datasource. Both stopLoading on WebFrame and _stopLoading datasource, would not stop plug-ins streams after the data source was done loading. Because of this, I've decided to not keep a list of plug-in streams attached to the data source and pulled my previous change. To fix this bug, WebBaseResourceHandleDelegate now retains the controller.
* Plugins.subproj/WebNetscapePluginStream.m:
(-[WebNetscapePluginStream start]):
(-[WebNetscapePluginStream cancel]):
(-[WebNetscapePluginStream handleDidFinishLoading:]):
(-[WebNetscapePluginStream handle:didFailLoadingWithError:]):
* WebView.subproj/WebBaseResourceHandleDelegate.h:
* WebView.subproj/WebBaseResourceHandleDelegate.m:
(-[WebBaseResourceHandleDelegate _releaseResources]):
(-[WebBaseResourceHandleDelegate setDataSource:]):
(-[WebBaseResourceHandleDelegate handle:willSendRequest:]):
(-[WebBaseResourceHandleDelegate handleDidFinishLoading:]):
(-[WebBaseResourceHandleDelegate handle:didFailLoadingWithError:]):
(-[WebBaseResourceHandleDelegate _cancelWithError:]):
* WebView.subproj/WebDataSourcePrivate.h:
* WebView.subproj/WebDataSourcePrivate.m:
(-[WebDataSourcePrivate dealloc]):
(-[WebDataSource _stopLoading]):
(-[WebDataSource _makeHandleDelegates:deferCallbacks:]):
(-[WebDataSource _defersCallbacksChanged]):
2002-11-18 Chris Blumenberg <cblu@apple.com>
Fixed: 3104183 - Assert loading www.louisvuitton.com
......
2002-11-18 Chris Blumenberg <cblu@apple.com>
Real fix for: 3104183 - Assert loading www.louisvuitton.com
Since we don't consider plug-in content as a subresource, attaching plug-in streams to the datasource has no affect on the loading state of the datasource. Both stopLoading on WebFrame and _stopLoading datasource, would not stop plug-ins streams after the data source was done loading. Because of this, I've decided to not keep a list of plug-in streams attached to the data source and pulled my previous change. To fix this bug, WebBaseResourceHandleDelegate now retains the controller.
* Plugins.subproj/WebNetscapePluginStream.m:
(-[WebNetscapePluginStream start]):
(-[WebNetscapePluginStream cancel]):
(-[WebNetscapePluginStream handleDidFinishLoading:]):
(-[WebNetscapePluginStream handle:didFailLoadingWithError:]):
* WebView.subproj/WebBaseResourceHandleDelegate.h:
* WebView.subproj/WebBaseResourceHandleDelegate.m:
(-[WebBaseResourceHandleDelegate _releaseResources]):
(-[WebBaseResourceHandleDelegate setDataSource:]):
(-[WebBaseResourceHandleDelegate handle:willSendRequest:]):
(-[WebBaseResourceHandleDelegate handleDidFinishLoading:]):
(-[WebBaseResourceHandleDelegate handle:didFailLoadingWithError:]):
(-[WebBaseResourceHandleDelegate _cancelWithError:]):
* WebView.subproj/WebDataSourcePrivate.h:
* WebView.subproj/WebDataSourcePrivate.m:
(-[WebDataSourcePrivate dealloc]):
(-[WebDataSource _stopLoading]):
(-[WebDataSource _makeHandleDelegates:deferCallbacks:]):
(-[WebDataSource _defersCallbacksChanged]):
2002-11-18 Chris Blumenberg <cblu@apple.com>
Fixed: 3104183 - Assert loading www.louisvuitton.com
......
......@@ -47,9 +47,7 @@ - (void)dealloc
- (void)start
{
ASSERT(_startingRequest);
if([self loadWithRequest:_startingRequest]){
[[view dataSource] _addPluginStream:self];
}
[self loadWithRequest:_startingRequest];
[_startingRequest release];
_startingRequest = nil;
}
......@@ -63,7 +61,6 @@ - (void)stop
- (void)cancel
{
[[view dataSource] _removePluginStream:self];
[view release];
view = nil;
......@@ -94,12 +91,9 @@ - (void)handle:(WebResourceHandle *)h didReceiveData:(NSData *)data
- (void)handleDidFinishLoading:(WebResourceHandle *)h
{
WebController *controller = [view controller];
[controller _finishedLoadingResourceFromDataSource:[view dataSource]];
[[view controller] _finishedLoadingResourceFromDataSource:[view dataSource]];
[self finishedLoadingWithData:resourceData];
[[view dataSource] _removePluginStream:self];
[view release];
view = nil;
......@@ -108,13 +102,10 @@ - (void)handleDidFinishLoading:(WebResourceHandle *)h
- (void)handle:(WebResourceHandle *)h didFailLoadingWithError:(WebError *)result
{
WebController *controller = [view controller];
[controller _receivedError:result fromDataSource:[view dataSource]];
[[view controller] _receivedError:result fromDataSource:[view dataSource]];
[self receivedError:NPRES_NETWORK_ERR];
[[view dataSource] _removePluginStream:self];
[view release];
view = nil;
......
......@@ -5,6 +5,7 @@
#import <Foundation/Foundation.h>
@class WebController;
@class WebDataSource;
@class WebError;
@class WebResourceHandle;
......@@ -20,6 +21,7 @@
WebDataSource *dataSource;
WebResourceHandle *handle;
@private
WebController *controller;
WebResourceRequest *request;
WebResourceResponse *response;
id identifier;
......
......@@ -35,6 +35,9 @@ - (void)_releaseResources
[handle release];
handle = nil;
[controller release];
controller = nil;
[dataSource release];
dataSource = nil;
......@@ -84,12 +87,15 @@ - (void)setDataSource:(WebDataSource *)d
[d retain];
[dataSource release];
dataSource = d;
[controller release];
controller = [[dataSource controller] retain];
[resourceLoadDelegate release];
resourceLoadDelegate = [[[dataSource controller] resourceLoadDelegate] retain];
resourceLoadDelegate = [[controller resourceLoadDelegate] retain];
[downloadDelegate release];
downloadDelegate = [[[dataSource controller] downloadDelegate] retain];
downloadDelegate = [[controller downloadDelegate] retain];
}
- (WebDataSource *)dataSource
......@@ -122,7 +128,7 @@ -(WebResourceRequest *)handle:(WebResourceHandle *)h willSendRequest:(WebResourc
ASSERT(handle == h);
ASSERT(!reachedTerminalState);
[newRequest setUserAgent:[[dataSource controller] userAgentForURL:[newRequest URL]]];
[newRequest setUserAgent:[controller userAgentForURL:[newRequest URL]]];
if (identifier == nil) {
// The identifier is released after the last callback, rather than in dealloc
......@@ -139,11 +145,11 @@ -(WebResourceRequest *)handle:(WebResourceHandle *)h willSendRequest:(WebResourc
request = [newRequest copy];
if (currentURL) {
[[WebStandardPanels sharedStandardPanels] _didStopLoadingURL:currentURL inController:[dataSource controller]];
[[WebStandardPanels sharedStandardPanels] _didStopLoadingURL:currentURL inController:controller];
}
[currentURL release];
currentURL = [[request URL] retain];
[[WebStandardPanels sharedStandardPanels] _didStartLoadingURL:currentURL inController:[dataSource controller]];
[[WebStandardPanels sharedStandardPanels] _didStartLoadingURL:currentURL inController:controller];
return request;
}
......@@ -184,7 +190,7 @@ - (void)handleDidFinishLoading:(WebResourceHandle *)h
else
[resourceLoadDelegate resource:identifier didFinishLoadingFromDataSource:dataSource];
[[WebStandardPanels sharedStandardPanels] _didStopLoadingURL:currentURL inController:[dataSource controller]];
[[WebStandardPanels sharedStandardPanels] _didStopLoadingURL:currentURL inController:controller];
[self _releaseResources];
}
......@@ -199,7 +205,7 @@ - (void)handle:(WebResourceHandle *)h didFailLoadingWithError:(WebError *)result
else
[resourceLoadDelegate resource:identifier didFailLoadingWithError:result fromDataSource:dataSource];
[[WebStandardPanels sharedStandardPanels] _didStopLoadingURL:currentURL inController:[dataSource controller]];
[[WebStandardPanels sharedStandardPanels] _didStopLoadingURL:currentURL inController:controller];
[self _releaseResources];
}
......@@ -210,7 +216,7 @@ - (void)_cancelWithError:(WebError *)error
[handle cancel];
[[WebStandardPanels sharedStandardPanels] _didStopLoadingURL:currentURL inController:[dataSource controller]];
[[WebStandardPanels sharedStandardPanels] _didStopLoadingURL:currentURL inController:controller];
if (error) {
[resourceLoadDelegate resource:identifier didFailLoadingWithError:error fromDataSource:dataSource];
......
......@@ -38,9 +38,6 @@
// Clients for other resources.
NSMutableArray *subresourceClients;
// Plugin streams are like subresources except that they don't affect the loading state of the datasource.
NSMutableArray *pluginStreams;
// The time when the data source was told to start loading.
double loadingStartedTime;
......@@ -104,8 +101,6 @@
- (void)_recursiveStopLoading;
- (void)_addSubresourceClient:(WebSubresourceClient *)client;
- (void)_removeSubresourceClient:(WebSubresourceClient *)client;
- (void)_addPluginStream:(WebNetscapePluginStream *)stream;
- (void)_removePluginStream:(WebNetscapePluginStream *)stream;
- (void)_setPrimaryLoadComplete:(BOOL)flag;
- (double)_loadingStartedTime;
- (void)_setTitle:(NSString *)title;
......
......@@ -52,7 +52,6 @@ - (void)dealloc
[originalRequest release];
[mainClient release];
[subresourceClients release];
[pluginStreams release];
[pageTitle release];
[response release];
[mainDocumentError release];
......@@ -191,24 +190,6 @@ - (void)_removeSubresourceClient:(WebSubresourceClient *)client
[self _updateLoading];
}
// Plugin streams are like subresources except that they don't affect the loading state of the datasource.
- (void)_addPluginStream:(WebNetscapePluginStream *)stream
{
if (_private->pluginStreams == nil) {
_private->pluginStreams = [[NSMutableArray alloc] init];
}
if ([_private->controller _defersCallbacks]) {
[stream setDefersCallbacks:YES];
}
[_private->pluginStreams addObject:stream];
}
- (void)_removePluginStream:(WebNetscapePluginStream *)stream
{
[_private->pluginStreams removeObject:stream];
}
- (BOOL)_isStopping
{
return _private->stopping;
......@@ -227,10 +208,6 @@ - (void)_stopLoading
NSArray *clients = [_private->subresourceClients copy];
[clients makeObjectsPerformSelector:@selector(cancel)];
[clients release];
NSArray *streams = [_private->pluginStreams copy];
[streams makeObjectsPerformSelector:@selector(cancel)];
[streams release];
if (_private->committed) {
[[self _bridge] closeURL];
......@@ -546,11 +523,7 @@ - (void)_setIconURL:(NSURL *)URL withType:(NSString *)iconType
- (void)_makeHandleDelegates:(NSArray *)handleDelegates deferCallbacks:(BOOL)deferCallbacks
{
NSEnumerator *e = [handleDelegates objectEnumerator];
WebBaseResourceHandleDelegate *delegate;
while ((delegate = [e nextObject])) {
[delegate setDefersCallbacks:deferCallbacks];
}
}
- (void)_defersCallbacksChanged
......@@ -564,8 +537,11 @@ - (void)_defersCallbacksChanged
_private->defersCallbacks = defers;
[_private->mainClient setDefersCallbacks:defers];
[self _makeHandleDelegates:_private->subresourceClients deferCallbacks:defers];
[self _makeHandleDelegates:_private->pluginStreams deferCallbacks:defers];
NSEnumerator *e = [_private->subresourceClients objectEnumerator];
WebSubresourceClient *client;
while ((client = [e nextObject])) {
[client setDefersCallbacks:defers];
}
[[[self webFrame] children] makeObjectsPerformSelector:@selector(_defersCallbacksChanged)];
}
......
......@@ -5,6 +5,7 @@
#import <Foundation/Foundation.h>
@class WebController;
@class WebDataSource;
@class WebError;
@class WebResourceHandle;
......@@ -20,6 +21,7 @@
WebDataSource *dataSource;
WebResourceHandle *handle;
@private
WebController *controller;
WebResourceRequest *request;
WebResourceResponse *response;
id identifier;
......
......@@ -35,6 +35,9 @@ - (void)_releaseResources
[handle release];
handle = nil;
[controller release];
controller = nil;
[dataSource release];
dataSource = nil;
......@@ -84,12 +87,15 @@ - (void)setDataSource:(WebDataSource *)d
[d retain];
[dataSource release];
dataSource = d;
[controller release];
controller = [[dataSource controller] retain];
[resourceLoadDelegate release];
resourceLoadDelegate = [[[dataSource controller] resourceLoadDelegate] retain];
resourceLoadDelegate = [[controller resourceLoadDelegate] retain];
[downloadDelegate release];
downloadDelegate = [[[dataSource controller] downloadDelegate] retain];
downloadDelegate = [[controller downloadDelegate] retain];
}
- (WebDataSource *)dataSource
......@@ -122,7 +128,7 @@ -(WebResourceRequest *)handle:(WebResourceHandle *)h willSendRequest:(WebResourc
ASSERT(handle == h);
ASSERT(!reachedTerminalState);
[newRequest setUserAgent:[[dataSource controller] userAgentForURL:[newRequest URL]]];
[newRequest setUserAgent:[controller userAgentForURL:[newRequest URL]]];
if (identifier == nil) {
// The identifier is released after the last callback, rather than in dealloc
......@@ -139,11 +145,11 @@ -(WebResourceRequest *)handle:(WebResourceHandle *)h willSendRequest:(WebResourc
request = [newRequest copy];
if (currentURL) {
[[WebStandardPanels sharedStandardPanels] _didStopLoadingURL:currentURL inController:[dataSource controller]];
[[WebStandardPanels sharedStandardPanels] _didStopLoadingURL:currentURL inController:controller];
}
[currentURL release];
currentURL = [[request URL] retain];
[[WebStandardPanels sharedStandardPanels] _didStartLoadingURL:currentURL inController:[dataSource controller]];
[[WebStandardPanels sharedStandardPanels] _didStartLoadingURL:currentURL inController:controller];
return request;
}
......@@ -184,7 +190,7 @@ - (void)handleDidFinishLoading:(WebResourceHandle *)h
else
[resourceLoadDelegate resource:identifier didFinishLoadingFromDataSource:dataSource];
[[WebStandardPanels sharedStandardPanels] _didStopLoadingURL:currentURL inController:[dataSource controller]];
[[WebStandardPanels sharedStandardPanels] _didStopLoadingURL:currentURL inController:controller];
[self _releaseResources];
}
......@@ -199,7 +205,7 @@ - (void)handle:(WebResourceHandle *)h didFailLoadingWithError:(WebError *)result
else
[resourceLoadDelegate resource:identifier didFailLoadingWithError:result fromDataSource:dataSource];
[[WebStandardPanels sharedStandardPanels] _didStopLoadingURL:currentURL inController:[dataSource controller]];
[[WebStandardPanels sharedStandardPanels] _didStopLoadingURL:currentURL inController:controller];
[self _releaseResources];
}
......@@ -210,7 +216,7 @@ - (void)_cancelWithError:(WebError *)error
[handle cancel];
[[WebStandardPanels sharedStandardPanels] _didStopLoadingURL:currentURL inController:[dataSource controller]];
[[WebStandardPanels sharedStandardPanels] _didStopLoadingURL:currentURL inController:controller];
if (error) {
[resourceLoadDelegate resource:identifier didFailLoadingWithError:error fromDataSource:dataSource];
......
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