Commit 18c3b035 authored by darin's avatar darin
Browse files

- fixed crashing part of 3063517 -- crash loading .png in separate window

        * Plugins.subproj/WebPluginView.m:
        (-[WebNetscapePluginView start]): Don't try to start if the NPP_New is 0.
	This indicates the the plugin hasn't been loaded.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2205 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 89eb76b5
2002-09-30 Darin Adler <darin@apple.com>
- fixed crashing part of 3063517 -- crash loading .png in separate window
* Plugins.subproj/WebPluginView.m:
(-[WebNetscapePluginView start]): Don't try to start if the NPP_New is 0.
This indicates the the plugin hasn't been loaded.
2002-09-30 Darin Adler <darin@apple.com>
 
* WebView.subproj/WebDataSourcePrivate.m: (-[WebDataSource _setLoading:]):
......
2002-09-30 Darin Adler <darin@apple.com>
- fixed crashing part of 3063517 -- crash loading .png in separate window
* Plugins.subproj/WebPluginView.m:
(-[WebNetscapePluginView start]): Don't try to start if the NPP_New is 0.
This indicates the the plugin hasn't been loaded.
2002-09-30 Darin Adler <darin@apple.com>
 
* WebView.subproj/WebDataSourcePrivate.m: (-[WebDataSource _setLoading:]):
......
......@@ -379,12 +379,14 @@ - (id)initWithFrame:(NSRect)r plugin:(WebNetscapePlugin *)plugin URL:(NSURL *)th
instance = &instanceStruct;
instance->ndata = self;
canRestart = YES;
mime = [mimeType retain];
srcURL = [theURL retain];
baseURL = [theBaseURL retain];
// load the plug-in if it is not already loaded
if(![plugin load])
if (![plugin load])
return nil;
// copy function pointers
......@@ -402,7 +404,7 @@ - (id)initWithFrame:(NSRect)r plugin:(WebNetscapePlugin *)plugin URL:(NSURL *)th
NPP_SetValue = [plugin NPP_SetValue];
NPP_Print = [plugin NPP_Print];
LOG(Plugins, "%s", [[arguments description] cString]);
LOG(Plugins, "%@", arguments);
// Convert arguments dictionary to 2 string arrays.
// These arrays are passed to NPP_New, but the strings need to be
......@@ -431,9 +433,6 @@ - (id)initWithFrame:(NSRect)r plugin:(WebNetscapePlugin *)plugin URL:(NSURL *)th
streams = [[NSMutableArray alloc] init];
notificationData = [[NSMutableDictionary alloc] init];
// Initialize globals
canRestart = YES;
return self;
}
......@@ -491,7 +490,7 @@ - (void)setUpWindowAndPort
window.type = NPWindowTypeWindow;
}
- (void) setWindow
- (void)setWindow
{
[self setUpWindowAndPort];
......@@ -534,11 +533,7 @@ - (void)resetTrackingRect
-(void)start
{
NSNotificationCenter *notificationCenter;
NSWindow *theWindow;
WebNetscapePluginStream *stream;
if(isStarted || !canRestart)
if (isStarted || !canRestart || NPP_New == 0)
return;
isStarted = YES;
......@@ -554,8 +549,8 @@ -(void)start
[self setWindow];
theWindow = [self window];
notificationCenter = [NSNotificationCenter defaultCenter];
NSWindow *theWindow = [self window];
NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
NSView *view;
for (view = self; view; view = [view superview]) {
[notificationCenter addObserver:self selector:@selector(viewHasMoved:)
......@@ -581,7 +576,7 @@ -(void)start
webDataSource = [[webFrame dataSource] retain];
if(srcURL){
stream = [[WebNetscapePluginStream alloc] initWithURL:srcURL pluginPointer:instance];
WebNetscapePluginStream *stream = [[WebNetscapePluginStream alloc] initWithURL:srcURL pluginPointer:instance];
if(stream){
[stream startLoad];
[streams addObject:stream];
......@@ -632,7 +627,7 @@ - (WebDataSource *)webDataSource
return webDataSource;
}
- (WebController *) webController
- (WebController *)webController
{
return webController;
}
......@@ -656,15 +651,13 @@ - (WebController *) webController
- (void)setDataSource:(WebDataSource *)dataSource
{
WebNetscapePlugin *plugin;
[webDataSource release];
webDataSource = [dataSource retain];
mime = [[dataSource contentType] retain];
plugin = [[WebNetscapePluginDatabase installedPlugins] pluginForMIMEType:mime];
WebNetscapePlugin *plugin = [[WebNetscapePluginDatabase installedPlugins] pluginForMIMEType:mime];
if(![plugin load])
if (![plugin load])
return;
// copy function pointers
......@@ -752,37 +745,37 @@ -(void)viewHasMoved:(NSNotification *)notification
[self resetTrackingRect];
}
-(void) windowWillClose:(NSNotification *)notification
-(void)windowWillClose:(NSNotification *)notification
{
[self stop];
}
-(void) windowBecameKey:(NSNotification *)notification
-(void)windowBecameKey:(NSNotification *)notification
{
[self sendActivateEvent:YES];
[self performSelector:@selector(sendUpdateEvent) withObject:nil afterDelay:.001];
}
-(void) windowResignedKey:(NSNotification *)notification
-(void)windowResignedKey:(NSNotification *)notification
{
[self sendActivateEvent:NO];
[self performSelector:@selector(sendUpdateEvent) withObject:nil afterDelay:.001];
}
- (void) defaultsHaveChanged:(NSNotification *)notification
- (void)defaultsHaveChanged:(NSNotification *)notification
{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
if([defaults boolForKey:@"WebKitPluginsEnabled"]){
if ([defaults boolForKey:@"WebKitPluginsEnabled"]) {
canRestart = YES;
[self start];
}else{
} else {
canRestart = NO;
[self stop];
[self setNeedsDisplay:YES];
}
}
- (void) frameStateChanged:(NSNotification *)notification
- (void)frameStateChanged:(NSNotification *)notification
{
WebFrame *frame;
WebFrameState frameState;
......@@ -868,7 +861,7 @@ - (NSURL *)pluginURLFromCString:(const char *)URLCString
return URL;
}
- (NPError) loadRequest:(WebResourceRequest *)request inTarget:(NSString *)target withNotifyData:(void *)notifyData
- (NPError)loadRequest:(WebResourceRequest *)request inTarget:(NSString *)target withNotifyData:(void *)notifyData
{
WebNetscapePluginStream *stream;
WebDataSource *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