[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

cblu cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 06:14:24 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 53dbee04ca7088cc176e9043e13a1629828ab744
Author: cblu <cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed May 22 07:39:27 2002 +0000

    WebBrowser:
    
    	- Added an array to the defaults for MIME types for downloaded files
    	  that we open after download.
    	- Made sure we check for IFContentPolicySave when checking if
    	  a data source is a download data source.
    	- Set policy to IFContentPolicySave for types not in the defaults.
    
    	* Defaults.plist:
    	* DownloadMonitor.m:
    	(-[DownloadMonitor monitorDownload:withProgress:error:dataSource:]):
    	* LocationChangeHandler.m:
    	(-[LocationChangeHandler requestContentPolicyForMIMEType:]):
    	* WebController.m:
    	(-[WebController receivedProgress:forResource:fromDataSource:]):
    	(-[WebController receivedError:forResource:partialProgress:fromDataSource:]):
    
    WebKit:
    
    
    	- Removed obsolete MIME/download related code.
    	- Minor clean-ups.
    	- Made WebKit support all text/* MIME types.
    	- Now send NPP_URLNotify when pages requested by plug-ins are loaded.
    	- Simplified NPP_Get/NPP_Post code.
    
    	* MIME.subproj/IFContentHandler.h:
    	* MIME.subproj/IFContentHandler.m:
    	* MIME.subproj/IFDownloadHandler.mm:
    	* MIME.subproj/IFMIMEDatabase.h: Removed.
    	* MIME.subproj/IFMIMEDatabase.m: Removed.
    	* MIME.subproj/IFMIMEHandler.h:
    	* MIME.subproj/IFMIMEHandler.m:
    	(+[IFMIMEHandler MIMEHandlerTypeForMIMEType:]):
    	(+[IFMIMEHandler canShowMIMEType:]):
    	* Plugins.subproj/IFPluginView.h:
    	* Plugins.subproj/IFPluginView.mm:
    	(-[IFPluginView initWithFrame:plugin:url:mime:arguments:mode:]):
    	(-[IFPluginView dealloc]):
    	(-[IFPluginView frameStateChanged:]):
    	(-[IFPluginView loadURL:inTarget:withNotifyData:andHandleAttributes:]):
    	(-[IFPluginView getURLNotify:target:notifyData:]):
    	(-[IFPluginView getURL:target:]):
    	(-[IFPluginView postURLNotify:target:len:buf:file:notifyData:]):
    	(-[IFPluginView postURL:target:len:buf:file:]):
    	(-[IFPluginView invalidateRect:]):
    	(-[IFPluginView invalidateRegion:]):
    	(-[IFPluginView forceRedraw]):
    	* WebKit.pbproj/project.pbxproj:
    	* WebView.subproj/IFMainURLHandleClient.h:
    	* WebView.subproj/IFMainURLHandleClient.mm:
    	(-[IFMainURLHandleClient dealloc]):
    	(-[IFMainURLHandleClient IFURLHandle:resourceDataDidBecomeAvailable:]):
    	(-[IFMainURLHandleClient processData:isComplete:]):
    	* WebView.subproj/IFWebFramePrivate.h:
    	* WebView.subproj/IFWebFramePrivate.mm:
    	(-[IFWebFrame _setState:]):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1193 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 31a539b..30a885d 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,43 @@
+2002-05-22  Chris Blumenberg  <cblu at apple.com>
+
+	- Removed obsolete MIME/download related code.
+	- Minor clean-ups.
+	- Made WebKit support all text/* MIME types.
+	- Now send NPP_URLNotify when pages requested by plug-ins are loaded.
+	- Simplified NPP_Get/NPP_Post code.
+	
+	* MIME.subproj/IFContentHandler.h:
+	* MIME.subproj/IFContentHandler.m:
+	* MIME.subproj/IFDownloadHandler.mm:
+	* MIME.subproj/IFMIMEDatabase.h: Removed.
+	* MIME.subproj/IFMIMEDatabase.m: Removed.
+	* MIME.subproj/IFMIMEHandler.h:
+	* MIME.subproj/IFMIMEHandler.m:
+	(+[IFMIMEHandler MIMEHandlerTypeForMIMEType:]):
+	(+[IFMIMEHandler canShowMIMEType:]):
+	* Plugins.subproj/IFPluginView.h:
+	* Plugins.subproj/IFPluginView.mm:
+	(-[IFPluginView initWithFrame:plugin:url:mime:arguments:mode:]):
+	(-[IFPluginView dealloc]):
+	(-[IFPluginView frameStateChanged:]):
+	(-[IFPluginView loadURL:inTarget:withNotifyData:andHandleAttributes:]):
+	(-[IFPluginView getURLNotify:target:notifyData:]):
+	(-[IFPluginView getURL:target:]):
+	(-[IFPluginView postURLNotify:target:len:buf:file:notifyData:]):
+	(-[IFPluginView postURL:target:len:buf:file:]):
+	(-[IFPluginView invalidateRect:]):
+	(-[IFPluginView invalidateRegion:]):
+	(-[IFPluginView forceRedraw]):
+	* WebKit.pbproj/project.pbxproj:
+	* WebView.subproj/IFMainURLHandleClient.h:
+	* WebView.subproj/IFMainURLHandleClient.mm:
+	(-[IFMainURLHandleClient dealloc]):
+	(-[IFMainURLHandleClient IFURLHandle:resourceDataDidBecomeAvailable:]):
+	(-[IFMainURLHandleClient processData:isComplete:]):
+	* WebView.subproj/IFWebFramePrivate.h:
+	* WebView.subproj/IFWebFramePrivate.mm:
+	(-[IFWebFrame _setState:]):
+
 2002-05-21  Richard J. Williamson  <rjw at apple.com>
 
     Fixed baseline regression.  Obvious of sites that have tables w/ backgrounds,
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index 31a539b..30a885d 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,3 +1,43 @@
+2002-05-22  Chris Blumenberg  <cblu at apple.com>
+
+	- Removed obsolete MIME/download related code.
+	- Minor clean-ups.
+	- Made WebKit support all text/* MIME types.
+	- Now send NPP_URLNotify when pages requested by plug-ins are loaded.
+	- Simplified NPP_Get/NPP_Post code.
+	
+	* MIME.subproj/IFContentHandler.h:
+	* MIME.subproj/IFContentHandler.m:
+	* MIME.subproj/IFDownloadHandler.mm:
+	* MIME.subproj/IFMIMEDatabase.h: Removed.
+	* MIME.subproj/IFMIMEDatabase.m: Removed.
+	* MIME.subproj/IFMIMEHandler.h:
+	* MIME.subproj/IFMIMEHandler.m:
+	(+[IFMIMEHandler MIMEHandlerTypeForMIMEType:]):
+	(+[IFMIMEHandler canShowMIMEType:]):
+	* Plugins.subproj/IFPluginView.h:
+	* Plugins.subproj/IFPluginView.mm:
+	(-[IFPluginView initWithFrame:plugin:url:mime:arguments:mode:]):
+	(-[IFPluginView dealloc]):
+	(-[IFPluginView frameStateChanged:]):
+	(-[IFPluginView loadURL:inTarget:withNotifyData:andHandleAttributes:]):
+	(-[IFPluginView getURLNotify:target:notifyData:]):
+	(-[IFPluginView getURL:target:]):
+	(-[IFPluginView postURLNotify:target:len:buf:file:notifyData:]):
+	(-[IFPluginView postURL:target:len:buf:file:]):
+	(-[IFPluginView invalidateRect:]):
+	(-[IFPluginView invalidateRegion:]):
+	(-[IFPluginView forceRedraw]):
+	* WebKit.pbproj/project.pbxproj:
+	* WebView.subproj/IFMainURLHandleClient.h:
+	* WebView.subproj/IFMainURLHandleClient.mm:
+	(-[IFMainURLHandleClient dealloc]):
+	(-[IFMainURLHandleClient IFURLHandle:resourceDataDidBecomeAvailable:]):
+	(-[IFMainURLHandleClient processData:isComplete:]):
+	* WebView.subproj/IFWebFramePrivate.h:
+	* WebView.subproj/IFWebFramePrivate.mm:
+	(-[IFWebFrame _setState:]):
+
 2002-05-21  Richard J. Williamson  <rjw at apple.com>
 
     Fixed baseline regression.  Obvious of sites that have tables w/ backgrounds,
diff --git a/WebKit/MIME.subproj/IFContentHandler.h b/WebKit/MIME.subproj/IFContentHandler.h
index 77c0a32..78b434d 100644
--- a/WebKit/MIME.subproj/IFContentHandler.h
+++ b/WebKit/MIME.subproj/IFContentHandler.h
@@ -10,7 +10,7 @@
     NSString *MIMEType, *URLString;
 }
 
-- initWithMIMEHandler:(IFMIMEHandler *)mimeHandler URL:(NSURL *)URL;
+- initWithURL:(NSURL *)URL MIMEType:(NSString *)theMIMEType MIMEHandlerType:(IFMIMEHandlerType)theMIMEHandlerType;
 - (NSString *) HTMLDocument;
 - (NSString *) textHTMLDocumentBottom;
 
diff --git a/WebKit/MIME.subproj/IFContentHandler.m b/WebKit/MIME.subproj/IFContentHandler.m
index 69bf2ae..ff90576 100644
--- a/WebKit/MIME.subproj/IFContentHandler.m
+++ b/WebKit/MIME.subproj/IFContentHandler.m
@@ -15,10 +15,10 @@ static BOOL textDocumentLoaded = NO;
 
 @implementation IFContentHandler
 
-- initWithMIMEHandler:(IFMIMEHandler *)mimeHandler URL:(NSURL *)URL
+- initWithURL:(NSURL *)URL MIMEType:(NSString *)theMIMEType MIMEHandlerType:(IFMIMEHandlerType)theMIMEHandlerType;
 {
-    handlerType = [mimeHandler handlerType];
-    MIMEType = [[mimeHandler MIMEType] retain];
+    handlerType = theMIMEHandlerType;
+    MIMEType = [theMIMEType retain];
     URLString = [[URL absoluteString] retain];
     
     return self;
diff --git a/WebKit/MIME.subproj/IFDownloadHandler.mm b/WebKit/MIME.subproj/IFDownloadHandler.mm
index dbd9bb4..51add67 100644
--- a/WebKit/MIME.subproj/IFDownloadHandler.mm
+++ b/WebKit/MIME.subproj/IFDownloadHandler.mm
@@ -40,7 +40,7 @@
     FNNotifyByPath((UInt8 *)[[path stringByDeletingLastPathComponent] UTF8String], kFNDirectoryModifiedMessage, kNilOptions);
     
     if([dataSource contentPolicy] == IFContentPolicyOpenExternally){
-        [IFDownloadHandler launchURL:[NSURL fileURLWithPath:path]];
+        [[self class] launchURL:[NSURL fileURLWithPath:path]];
     }
 }
 
diff --git a/WebKit/MIME.subproj/IFMIMEDatabase.h b/WebKit/MIME.subproj/IFMIMEDatabase.h
deleted file mode 100644
index 7dc3763..0000000
--- a/WebKit/MIME.subproj/IFMIMEDatabase.h
+++ /dev/null
@@ -1,62 +0,0 @@
-//
-//  IFMIMEDatabase.h
-//  WebKit
-//
-//  Created by Chris Blumenberg on Fri Mar 22 2002.
-//  Copyright (c) 2002 Apple Computer Inc.. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-
- at class IFMIMEHandler;
-
- at interface IFMIMEDatabase : NSObject {
-    NSMutableDictionary *mimeHandlers;
-}
-
-/*
-IFMIMEDatabase creates a dictionary of MIME type keys and IFMIMEHandlers objects. IFMIMEDatabase should only create entries in the dictionary for mime types that WebKit handles internally including plug-in types.
-
-At some point, IFMIMEDatabase might interact with the defaults to provide for customization.
-
-Types that WebKit can handle internally:
-
-Text types:
-text/html
-text/plain
-
-Image types (taken from [NSImage imageFileTypes]): 
-image/pict
-application/postscript (eps)
-image/tiff
-image/x-quicktime
-image/x-targa
-image/x-sgi
-image/x-rgb
-image/x-macpaint
-image/png
-image/gif
-image/jpg
-image/x-bmp
-image/tiff
-image/x-tiff
-
-Image mime types not found, but handleable:
-psd (photoshop)
-fpx
-cur
-ico (window's icon)
-fax
-
-*/
-
-+ (IFMIMEDatabase *)sharedMIMEDatabase;
-
-
-/* 
-MIMEHandlerForMIMEType does a simple dictionary lookup. If none is found IFMIMEHandler will return a IFMIMEHandler with an application handler type (look at IFMIMEHandler.h) which means that the file should be downloaded.
-*/
-
-- (IFMIMEHandler *)MIMEHandlerForMIMEType:(NSString *)mimeType;
-
- at end
diff --git a/WebKit/MIME.subproj/IFMIMEDatabase.m b/WebKit/MIME.subproj/IFMIMEDatabase.m
deleted file mode 100644
index d2705ed..0000000
--- a/WebKit/MIME.subproj/IFMIMEDatabase.m
+++ /dev/null
@@ -1,97 +0,0 @@
-//
-//  IFMIMEDatabase.m
-//  WebKit
-//
-//  Created by Chris Blumenberg on Fri Mar 22 2002.
-//  Copyright (c) 2002 Apple Computer Inc.. All rights reserved.
-//
-
-#import "IFMIMEDatabase.h"
-
-#import "IFMIMEHandler.h"
-#import <IFPluginDatabase.h>
-#import <IFPlugin.h>
-
-NSMutableDictionary *setMimeHandlers(void);
-
-
-static IFMIMEDatabase *sharedMIMEDatabase = nil;
-
- at implementation IFMIMEDatabase
-
-+ (IFMIMEDatabase *)sharedMIMEDatabase
-{
-    if(!sharedMIMEDatabase){
-        sharedMIMEDatabase = [IFMIMEDatabase alloc];
-        sharedMIMEDatabase->mimeHandlers = setMimeHandlers();
-    }
-    return sharedMIMEDatabase;
-}
-
-
-- (IFMIMEHandler *)MIMEHandlerForMIMEType:(NSString *)mimeType
-{
-    IFMIMEHandler *tempHandler;
-    IFPluginDatabase *pluginDatabase;
-    IFPlugin *plugin;
-    
-    if(!mimeType)
-        return [[[IFMIMEHandler alloc] initWithMIMEType:mimeType handlerType:IFMIMEHANDLERTYPE_NIL handlerName:nil] autorelease];
-    
-    tempHandler = [mimeHandlers objectForKey:mimeType];
-    if(tempHandler){
-        return tempHandler;
-    }else{
-        pluginDatabase = [IFPluginDatabase installedPlugins];
-        plugin = [pluginDatabase getPluginForMimeType:mimeType];
-        if(plugin){
-            return [[[IFMIMEHandler alloc] initWithMIMEType:mimeType handlerType:IFMIMEHANDLERTYPE_PLUGIN handlerName:[plugin name]] autorelease];
-        }
-        else{
-            return [[[IFMIMEHandler alloc] initWithMIMEType:mimeType handlerType:IFMIMEHANDLERTYPE_APPLICATION handlerName:nil] autorelease];
-        }
-    }
-}
-
- at end
-
-NSMutableDictionary *setMimeHandlers(void)
-{
-    NSArray *imageTypes;
-    NSMutableDictionary *handledTypes;
-    IFMIMEHandler *tempHandler;
-    NSString *tempMime = nil;
-    uint i;
-    
-    handledTypes = [NSMutableDictionary dictionaryWithCapacity:20];
-    imageTypes = [NSArray arrayWithObjects:
-        //@"image/pict",
-        //@"application/postscript",
-        //@"image/x-quicktime",
-        //@"image/x-targa",
-        //@"image/x-sgi",
-        //@"image/x-rgb",
-        //@"image/x-macpaint",
-        //@"image/x-bmp",
-        //@"image/tiff",
-        //@"image/x-tiff",
-        @"image/png",
-        @"image/gif",
-        @"image/jpg",
-        @"image/jpeg", nil];
-
-    for(i=0; i<[imageTypes count]; i++){
-        tempMime = [imageTypes objectAtIndex:i];
-        tempHandler = [[IFMIMEHandler alloc] initWithMIMEType:tempMime handlerType:IFMIMEHANDLERTYPE_IMAGE handlerName:@"WebKit"];
-        [handledTypes setObject:tempHandler forKey:tempMime];
-    }
-    tempHandler = [[IFMIMEHandler alloc] initWithMIMEType:@"text/plain" handlerType:IFMIMEHANDLERTYPE_TEXT handlerName:@"WebKit"];
-    [handledTypes setObject:tempHandler forKey:@"text/plain"];
-    
-    tempHandler = [[IFMIMEHandler alloc] initWithMIMEType:@"text/html" handlerType:IFMIMEHANDLERTYPE_HTML handlerName:@"WebKit"];
-    [handledTypes setObject:tempHandler forKey:@"text/html"];
-    
-    [handledTypes retain];
-    
-    return handledTypes;
-}
\ No newline at end of file
diff --git a/WebKit/MIME.subproj/IFMIMEHandler.h b/WebKit/MIME.subproj/IFMIMEHandler.h
index 158407b..b7a2f95 100644
--- a/WebKit/MIME.subproj/IFMIMEHandler.h
+++ b/WebKit/MIME.subproj/IFMIMEHandler.h
@@ -8,10 +8,7 @@
 
 #import <Foundation/Foundation.h>
 
-/*
-IFMIMEHandler is a simple data type object holding the MIME type, the type of handler and the handler's name (ie plugin's name or application's name).
-*/
-
+// FIXME: This code should be replaced by the MIME type DB 2927855
 
 typedef enum {
     IFMIMEHANDLERTYPE_NIL = 0,		
@@ -23,25 +20,9 @@ typedef enum {
 } IFMIMEHandlerType;
 
 
- at interface IFMIMEHandler : NSObject {
-    NSString *MIMEType, *handlerName;
-    IFMIMEHandlerType handlerType;
-}
-
-/*
-initWithMIMEType gets called by [IFMIMEDatabase sharedMIMEDatabase] for at least every mime type that WebKit handles. We, at some point, might want to store IFMIMEHandler's for types that other application handle. I hope not though.
-*/
-
-+ (void) saveFileWithPath:(NSString *)path andData:(NSData *)data;
-+ (void) saveAndOpenFileWithPath:(NSString *)path andData:(NSData *)data;
-+ (NSArray *)showableMIMETypes;
-
-- initWithMIMEType:(NSString *)MIME handlerType:(IFMIMEHandlerType)hType handlerName:(NSString *)handler;
-
-// Accessor methods
-- (NSString *)MIMEType;
-- (NSString *)handlerName;
-- (IFMIMEHandlerType)handlerType;
+ at interface IFMIMEHandler: NSObject
 
++ (IFMIMEHandlerType) MIMEHandlerTypeForMIMEType:(NSString *)MIMEType;
++ (BOOL) canShowMIMEType:(NSString *)MIMEType;
 
 @end
diff --git a/WebKit/MIME.subproj/IFMIMEHandler.m b/WebKit/MIME.subproj/IFMIMEHandler.m
index c7eff4e..4faeba9 100644
--- a/WebKit/MIME.subproj/IFMIMEHandler.m
+++ b/WebKit/MIME.subproj/IFMIMEHandler.m
@@ -10,103 +10,55 @@
 #import <WebKit/WebKitDebug.h>
 #import <IFPluginDatabase.h>
 
-static NSArray *MIMETypes = nil;
+
+// FIXME: This code should be replaced by the MIME type DB 2927855
 
 @implementation IFMIMEHandler
 
-+ (NSArray *)showableMIMETypes
++ (IFMIMEHandlerType) MIMEHandlerTypeForMIMEType:(NSString *)MIMEType
 {
-    if(!MIMETypes){
-        MIMETypes = [[NSArray arrayWithObjects:
-        @"text/plain",
-        @"text/html",
+    NSArray *pluginTypes;
     
-        //@"image/pict",
-        //@"application/postscript",
-        //@"image/x-quicktime",
-        //@"image/x-targa",
-        //@"image/x-sgi",
-        //@"image/x-rgb",
-        //@"image/x-macpaint",
-        //@"image/x-bmp",
-        //@"image/tiff",
-        //@"image/x-tiff",
-        @"image/png",
-        @"image/gif",
-        @"image/jpg",
-        @"image/jpeg", nil] arrayByAddingObjectsFromArray:[[IFPluginDatabase installedPlugins] allHandledMIMETypes]];
-        [MIMETypes retain];
+    if(!MIMEType){
+        return IFMIMEHANDLERTYPE_NIL;
+    }else if([MIMEType isEqualToString:@"text/html"]){
+        return IFMIMEHANDLERTYPE_HTML;
+    }else if([MIMEType hasPrefix:@"text/"] && ![MIMEType isEqualToString:@"text/rtf"]){
+        return IFMIMEHANDLERTYPE_TEXT;
+    }else if([MIMEType isEqualToString:@"image/jpg"] || [MIMEType isEqualToString:@"image/jpeg"] || 
+             [MIMEType isEqualToString:@"image/gif"] || [MIMEType isEqualToString:@"image/png"]){
+        return IFMIMEHANDLERTYPE_IMAGE;
+    }else{
+        pluginTypes = [[IFPluginDatabase installedPlugins] allHandledMIMETypes];
+        if([pluginTypes containsObject:MIMEType]){
+            return IFMIMEHANDLERTYPE_PLUGIN;
+        }else{
+            return IFMIMEHANDLERTYPE_APPLICATION;
+        }
     }
-    return MIMETypes;
-}
-
-- initWithMIMEType:(NSString *)MIME handlerType:(IFMIMEHandlerType)hType handlerName:(NSString *)handler
-{
-    MIMEType = [MIME retain];
-    handlerName = [handler retain];
-    handlerType = hType; 
-    
-    return self;
 }
 
-
-+ (void) saveFileWithPath:(NSString *)path andData:(NSData *)data
++ (BOOL) canShowMIMEType:(NSString *)MIMEType
 {
-    NSFileManager *fileManager;
+    NSArray *pluginTypes;
     
-    // FIXME: Should probably not replace existing file
-    // FIXME: Should report error if there is one
-    fileManager = [NSFileManager defaultManager];
-    [fileManager createFileAtPath:path contents:data attributes:nil];
-    WEBKITDEBUGLEVEL(WEBKIT_LOG_DOWNLOAD, "Download complete. Saved to: %s", [path cString]);
+    if(!MIMEType)
+        return YES;
     
-    // Send Finder notification
-    WEBKITDEBUGLEVEL(WEBKIT_LOG_DOWNLOAD, "Notifying Finder");
-    FNNotifyByPath([[path stringByDeletingLastPathComponent] cString], kFNDirectoryModifiedMessage, kNilOptions);
-}
-
-+ (void) saveAndOpenFileWithPath:(NSString *)path andData:(NSData *)data
-{
-    CFURLRef pathURL;
-    
-    [IFMIMEHandler saveFileWithPath:path andData:data];
-    pathURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, (CFStringRef)path, kCFURLPOSIXPathStyle, FALSE);
-    WEBKITDEBUGLEVEL(WEBKIT_LOG_DOWNLOAD,"Opening: %s", [path cString]);
-    LSOpenCFURLRef(pathURL, NULL);
-    CFRelease(pathURL);
-}
-
-// Accessor methods
-- (NSString *)MIMEType
-{
-    return MIMEType;
-}
-
-- (NSString *)handlerName
-{
-    return handlerName;
-}
-
-- (IFMIMEHandlerType)handlerType
-{
-    return handlerType;
-}
-
-- (NSString *) description
-{
-    NSString *handlerTypeString = nil;
-    if(handlerType == IFMIMEHANDLERTYPE_HTML)
-        handlerTypeString = @"IFMIMEHANDLERTYPE_HTML";
-    else if(handlerType == IFMIMEHANDLERTYPE_IMAGE)
-        handlerTypeString = @"IFMIMEHANDLERTYPE_IMAGE";
-    else if(handlerType == IFMIMEHANDLERTYPE_TEXT)
-        handlerTypeString = @"IFMIMEHANDLERTYPE_TEXT";
-    else if(handlerType == IFMIMEHANDLERTYPE_PLUGIN)
-        handlerTypeString = @"IFMIMEHANDLERTYPE_PLUGIN";
-    else if(handlerType == IFMIMEHANDLERTYPE_APPLICATION)
-        handlerTypeString = @"IFMIMEHANDLERTYPE_APPLICATION";
-    return [NSString stringWithFormat:@"MIME TYPE: %@, HANDLER TYPE: %@, HANDLER NAME: %@", 
-                MIMEType, handlerTypeString, handlerName];
+    if(([MIMEType hasPrefix:@"text/"] && ![MIMEType isEqualToString:@"text/rtf"]) ||
+       [MIMEType isEqualToString:@"image/jpg"]  ||
+       [MIMEType isEqualToString:@"image/jpeg"] ||
+       [MIMEType isEqualToString:@"image/gif"]  || 
+       [MIMEType isEqualToString:@"image/png"]){
+        return YES;
+    }else{
+        pluginTypes = [[IFPluginDatabase installedPlugins] allHandledMIMETypes];
+        if([pluginTypes containsObject:MIMEType]){
+            return YES;
+        }else{
+            return NO;
+        }
+    }
 }
 
 @end
diff --git a/WebKit/Plugins.subproj/IFPluginView.h b/WebKit/Plugins.subproj/IFPluginView.h
index d8f4bb6..4acaa47 100644
--- a/WebKit/Plugins.subproj/IFPluginView.h
+++ b/WebKit/Plugins.subproj/IFPluginView.h
@@ -16,7 +16,6 @@
 
 @interface IFPluginView : NSView
 {
-    IFPlugin *plugin;
     IFPluginNullEventSender *eventSender;
     unsigned argsCount;
     char **cAttributes, **cValues;
@@ -36,6 +35,7 @@
     NSURL *srcURL, *baseURL;
     NSTrackingRectTag trackingTag;
     NSMutableArray *streams;
+    NSMutableDictionary *notificationData;
     
     NPP_NewProcPtr NPP_New;
     NPP_DestroyProcPtr NPP_Destroy;
@@ -52,7 +52,7 @@
     NPP_SetValueProcPtr NPP_SetValue;
 }
 
-- (id)initWithFrame:(NSRect)r plugin:(IFPlugin *)plug url:(NSURL *)theURL mime:(NSString *)mimeType arguments:(NSDictionary *)arguments mode:(uint16)mode;
+- (id)initWithFrame:(NSRect)r plugin:(IFPlugin *)plugin url:(NSURL *)theURL mime:(NSString *)mimeType arguments:(NSDictionary *)arguments mode:(uint16)mode;
 -(void)stop;
 - (IFWebDataSource *)webDataSource;
 - (id <IFWebController>) webController;
diff --git a/WebKit/Plugins.subproj/IFPluginView.mm b/WebKit/Plugins.subproj/IFPluginView.mm
index 51171d3..a01ddd9 100644
--- a/WebKit/Plugins.subproj/IFPluginView.mm
+++ b/WebKit/Plugins.subproj/IFPluginView.mm
@@ -5,10 +5,13 @@
 
 #define USE_CARBON 1
 
+// FIXME: clean up these includes
+
 #import "IFPluginView.h"
 
 #import <WebKit/IFWebController.h>
 #import <WebKit/IFWebFrame.h>
+#import <WebKit/IFWebFramePrivate.h>
 
 #import <AppKit/NSWindow_Private.h>
 #import <Carbon/Carbon.h>
@@ -254,7 +257,7 @@ static char *newCString(NSString *string)
     return cString;
 }
 
-- (id)initWithFrame:(NSRect)r plugin:(IFPlugin *)plug url:(NSURL *)theURL mime:(NSString *)mimeType arguments:(NSDictionary *)arguments mode:(uint16)mode
+- (id)initWithFrame:(NSRect)r plugin:(IFPlugin *)plugin url:(NSURL *)theURL mime:(NSString *)mimeType arguments:(NSDictionary *)arguments mode:(uint16)mode
 {
     NSString *baseURLString;
 
@@ -267,7 +270,6 @@ static char *newCString(NSString *string)
 
     mime = [mimeType retain];
     srcURL = [theURL retain];
-    plugin = [plug retain];
     
     // load the plug-in if it is not already loaded
     [plugin load];
@@ -319,6 +321,7 @@ static char *newCString(NSString *string)
     }
     
     streams = [[NSMutableArray alloc] init];
+    notificationData = [NSMutableDictionary dictionaryWithCapacity:1];
     
     // Initialize globals
     canRestart = YES;
@@ -341,7 +344,7 @@ static char *newCString(NSString *string)
     [streams release];
     [mime release];
     [srcURL release];
-    [plugin release];
+    [notificationData release];
     delete [] cAttributes;
     delete [] cValues;
     [super dealloc];
@@ -547,79 +550,129 @@ static char *newCString(NSString *string)
     }
 }
 
-
-#pragma mark PLUGIN-TO-BROWSER
-
-- (NSURL *)URLForString:(NSString *)URLString
+- (void) frameStateChanged:(NSNotification *)notification
 {
-    if([URLString _IF_looksLikeAbsoluteURL])
-        return [NSURL URLWithString:URLString];
-    else
-        return [NSURL URLWithString:URLString relativeToURL:baseURL];
+    IFWebFrame *frame;
+    IFWebFrameState frameState;
+    NSValue *notifyDataValue;
+    void *notifyData;
+    NSURL *url;
+    
+    frame = [notification object];
+    url = [[frame dataSource] inputURL];
+    notifyDataValue = [notificationData objectForKey:url];
+    
+    if(!notifyDataValue)
+        return;
+    
+    notifyData = [notifyDataValue pointerValue];
+    frameState = (IFWebFrameState)[[[notification userInfo] objectForKey:IFCurrentFrameState] intValue];
+    if(frameState == IFWEBFRAMESTATE_COMPLETE){
+        NPP_URLNotify(instance, [[url absoluteString] cString], NPRES_DONE, notifyData);
+    }
+    //FIXME: Need to send other NPReasons
 }
 
+#pragma mark PLUGIN-TO-BROWSER
 
--(NPError)getURLNotify:(const char *)url target:(const char *)target notifyData:(void *)notifyData
+- (NPError) loadURL:(NSString *)URLString inTarget:(NSString *)target withNotifyData:(void *)notifyData andHandleAttributes:(NSDictionary *)attributes
 {
-    NSURL *requestedURL;
     IFPluginStream *stream;
     IFWebDataSource *dataSource;
     IFWebFrame *frame;
+    NSURL *url;
     
-    WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPN_GetURLNotify: %s target: %s\n", url, target);
- 
-    requestedURL = [self URLForString:[NSString stringWithCString:url]];
+    if([URLString _IF_looksLikeAbsoluteURL])
+        url = [NSURL URLWithString:URLString];
+    else
+        url = [NSURL URLWithString:URLString relativeToURL:baseURL];
     
-    if(!requestedURL)
+    if(!url)
         return NPERR_INVALID_URL;
     
-    if(target == NULL){ 
-        // Send data to plug-in if target is null
-        stream = [[IFPluginStream alloc] initWithURL:requestedURL pluginPointer:instance notifyData:notifyData];
+    if(!target){
+        stream = [[IFPluginStream alloc] initWithURL:url pluginPointer:instance notifyData:notifyData attributes:attributes];
         if(stream){
             [streams addObject:stream];
             [stream release];
+        }else{
+            return NPERR_INVALID_URL;
         }
-    
     }else{
-        dataSource = [[[IFWebDataSource alloc] initWithURL:requestedURL] autorelease];
-        frame = [webFrame frameNamed:[NSString stringWithCString:target]];
-        if(frame){
-            [frame setProvisionalDataSource:dataSource];
-            [frame startLoading];
-        }else{
+        frame = [webFrame frameNamed:target];
+        if(!frame){
             //FIXME: Create new window here (2931449)
+            return NPERR_GENERIC_ERROR;
         }
-        // FIXME: Need to send NPP_URLNotify
+        if(notifyData){
+            if([target isEqualToString:@"_self"] || [target isEqualToString:@"_current"] || 
+               [target isEqualToString:@"_parent"] || [target isEqualToString:@"_top"]){
+                // return error since notification can't be sent to a plug-in that will no longer exist
+                return NPERR_INVALID_PARAM;
+            }
+            [notificationData setObject:[NSValue valueWithPointer:notifyData] forKey:url];
+            [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(frameStateChanged:) name:IFFrameStateChangedNotification object:frame];
+        }
+        dataSource = [[[IFWebDataSource alloc] initWithURL:url attributes:attributes] autorelease];
+        [frame setProvisionalDataSource:dataSource];
+        [frame startLoading];
     }
     return NPERR_NO_ERROR;
 }
 
+-(NPError)getURLNotify:(const char *)url target:(const char *)target notifyData:(void *)notifyData
+{
+    NSString *theTarget = nil;
+        
+    WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPN_GetURLNotify: %s target: %s\n", url, target);
+        
+    if(!url)
+        return NPERR_INVALID_URL;
+        
+    if(target)
+        theTarget = [NSString stringWithCString:url];
+    
+    return [self loadURL:[NSString stringWithCString:url] inTarget:theTarget withNotifyData:notifyData andHandleAttributes:nil];
+}
+
 -(NPError)getURL:(const char *)url target:(const char *)target
 {
+    NSString *theTarget = nil;
+    
     WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPN_GetURL: %s target: %s\n", url, target);
-    return [self getURLNotify:url target:target notifyData:NULL];
+    
+    if(!url)
+        return NPERR_INVALID_URL;
+        
+    if(target)
+        theTarget = [NSString stringWithCString:url];
+    
+    return [self loadURL:[NSString stringWithCString:url] inTarget:theTarget withNotifyData:nil andHandleAttributes:nil];
 }
 
 -(NPError)postURLNotify:(const char *)url target:(const char *)target len:(UInt32)len buf:(const char *)buf file:(NPBool)file notifyData:(void *)notifyData
 {
-    NSURL *requestedURL;
     NSDictionary *attributes=nil;
     NSData *postData;
-    IFWebDataSource *dataSource;
-    IFPluginStream *stream;
-    IFWebFrame *frame;
-            
-    WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "postURLNotify: %s\n", url);
- 
-    requestedURL = [self URLForString:[NSString stringWithCString:url]];
+    NSURL *tempURL;
+    NSString *path, *theTarget = nil;
     
-    if(!requestedURL)
+    WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPN_PostURLNotify: %s\n", url);
+ 
+    if(!url)
         return NPERR_INVALID_URL;
-    
+        
+    if(target)
+        theTarget = [NSString stringWithCString:url];
+ 
     if(file){
-        // FIXME: Need function to convert from carbon path to posix
-        postData = [NSData dataWithContentsOfFile:nil];
+        if([[NSString stringWithCString:buf] _IF_looksLikeAbsoluteURL]){
+            tempURL = [NSURL fileURLWithPath:[NSString stringWithCString:url]];
+            path = [tempURL path];
+        }else{
+            path = [NSString stringWithCString:buf];
+        }
+        postData = [NSData dataWithContentsOfFile:path];
     }else{
         postData = [NSData dataWithBytes:buf length:len];
     }
@@ -628,30 +681,22 @@ static char *newCString(NSString *string)
         postData,	IFHTTPURLHandleRequestData,
         @"POST", 	IFHTTPURLHandleRequestMethod, nil];
                 
-    if(target == NULL){ 
-        // Send data to plug-in if target is null
-        stream = [[IFPluginStream alloc] initWithURL:requestedURL pluginPointer:instance notifyData:notifyData attributes:attributes];
-        if(stream){
-            [streams addObject:stream];
-            [stream release];
-        }  
-    }else{
-        dataSource = [[[IFWebDataSource alloc] initWithURL:requestedURL attributes:attributes] autorelease];
-        frame = [webFrame frameNamed:[NSString stringWithCString:target]];
-        if(frame){
-            [frame setProvisionalDataSource:dataSource];
-            [frame startLoading];
-        }else{
-            //FIXME: Create new window here (2931449)
-        }
-        // FIXME: Need to send NPP_URLNotify
-    }
-    return NPERR_NO_ERROR;
+    return [self loadURL:[NSString stringWithCString:url] inTarget:theTarget 
+                withNotifyData:notifyData andHandleAttributes:attributes];
 }
 
 -(NPError)postURL:(const char *)url target:(const char *)target len:(UInt32)len buf:(const char *)buf file:(NPBool)file
 {
-    WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPN_PostURL\n");
+    NSString *theTarget = nil;
+        
+    WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPN_PostURL: %s\n", url);
+    
+    if(!url)
+        return NPERR_INVALID_URL;
+        
+    if(target)
+        theTarget = [NSString stringWithCString:url];
+        
     return [self postURLNotify:url target:target len:len buf:buf file:file notifyData:NULL];
 }
 
@@ -687,20 +732,20 @@ static char *newCString(NSString *string)
 
 -(void)invalidateRect:(NPRect *)invalidRect
 {
-    [self sendUpdateEvent];
     WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPN_InvalidateRect\n");
+    [self sendUpdateEvent];
 }
 
 -(void)invalidateRegion:(NPRegion)invalidateRegion
 {
-    [self sendUpdateEvent];
     WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPN_InvalidateRegion\n");
+    [self sendUpdateEvent];
 }
 
 -(void)forceRedraw
 {
-    [self sendUpdateEvent];
     WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "forceRedraw\n");
+    [self sendUpdateEvent];
 }
 
 
@@ -738,8 +783,4 @@ static char *newCString(NSString *string)
     return NPP_URLNotify;
 }
 
-
-
 @end
-
-
diff --git a/WebKit/Plugins.subproj/WebPluginView.h b/WebKit/Plugins.subproj/WebPluginView.h
index d8f4bb6..4acaa47 100644
--- a/WebKit/Plugins.subproj/WebPluginView.h
+++ b/WebKit/Plugins.subproj/WebPluginView.h
@@ -16,7 +16,6 @@
 
 @interface IFPluginView : NSView
 {
-    IFPlugin *plugin;
     IFPluginNullEventSender *eventSender;
     unsigned argsCount;
     char **cAttributes, **cValues;
@@ -36,6 +35,7 @@
     NSURL *srcURL, *baseURL;
     NSTrackingRectTag trackingTag;
     NSMutableArray *streams;
+    NSMutableDictionary *notificationData;
     
     NPP_NewProcPtr NPP_New;
     NPP_DestroyProcPtr NPP_Destroy;
@@ -52,7 +52,7 @@
     NPP_SetValueProcPtr NPP_SetValue;
 }
 
-- (id)initWithFrame:(NSRect)r plugin:(IFPlugin *)plug url:(NSURL *)theURL mime:(NSString *)mimeType arguments:(NSDictionary *)arguments mode:(uint16)mode;
+- (id)initWithFrame:(NSRect)r plugin:(IFPlugin *)plugin url:(NSURL *)theURL mime:(NSString *)mimeType arguments:(NSDictionary *)arguments mode:(uint16)mode;
 -(void)stop;
 - (IFWebDataSource *)webDataSource;
 - (id <IFWebController>) webController;
diff --git a/WebKit/Plugins.subproj/WebPluginView.m b/WebKit/Plugins.subproj/WebPluginView.m
index 51171d3..a01ddd9 100644
--- a/WebKit/Plugins.subproj/WebPluginView.m
+++ b/WebKit/Plugins.subproj/WebPluginView.m
@@ -5,10 +5,13 @@
 
 #define USE_CARBON 1
 
+// FIXME: clean up these includes
+
 #import "IFPluginView.h"
 
 #import <WebKit/IFWebController.h>
 #import <WebKit/IFWebFrame.h>
+#import <WebKit/IFWebFramePrivate.h>
 
 #import <AppKit/NSWindow_Private.h>
 #import <Carbon/Carbon.h>
@@ -254,7 +257,7 @@ static char *newCString(NSString *string)
     return cString;
 }
 
-- (id)initWithFrame:(NSRect)r plugin:(IFPlugin *)plug url:(NSURL *)theURL mime:(NSString *)mimeType arguments:(NSDictionary *)arguments mode:(uint16)mode
+- (id)initWithFrame:(NSRect)r plugin:(IFPlugin *)plugin url:(NSURL *)theURL mime:(NSString *)mimeType arguments:(NSDictionary *)arguments mode:(uint16)mode
 {
     NSString *baseURLString;
 
@@ -267,7 +270,6 @@ static char *newCString(NSString *string)
 
     mime = [mimeType retain];
     srcURL = [theURL retain];
-    plugin = [plug retain];
     
     // load the plug-in if it is not already loaded
     [plugin load];
@@ -319,6 +321,7 @@ static char *newCString(NSString *string)
     }
     
     streams = [[NSMutableArray alloc] init];
+    notificationData = [NSMutableDictionary dictionaryWithCapacity:1];
     
     // Initialize globals
     canRestart = YES;
@@ -341,7 +344,7 @@ static char *newCString(NSString *string)
     [streams release];
     [mime release];
     [srcURL release];
-    [plugin release];
+    [notificationData release];
     delete [] cAttributes;
     delete [] cValues;
     [super dealloc];
@@ -547,79 +550,129 @@ static char *newCString(NSString *string)
     }
 }
 
-
-#pragma mark PLUGIN-TO-BROWSER
-
-- (NSURL *)URLForString:(NSString *)URLString
+- (void) frameStateChanged:(NSNotification *)notification
 {
-    if([URLString _IF_looksLikeAbsoluteURL])
-        return [NSURL URLWithString:URLString];
-    else
-        return [NSURL URLWithString:URLString relativeToURL:baseURL];
+    IFWebFrame *frame;
+    IFWebFrameState frameState;
+    NSValue *notifyDataValue;
+    void *notifyData;
+    NSURL *url;
+    
+    frame = [notification object];
+    url = [[frame dataSource] inputURL];
+    notifyDataValue = [notificationData objectForKey:url];
+    
+    if(!notifyDataValue)
+        return;
+    
+    notifyData = [notifyDataValue pointerValue];
+    frameState = (IFWebFrameState)[[[notification userInfo] objectForKey:IFCurrentFrameState] intValue];
+    if(frameState == IFWEBFRAMESTATE_COMPLETE){
+        NPP_URLNotify(instance, [[url absoluteString] cString], NPRES_DONE, notifyData);
+    }
+    //FIXME: Need to send other NPReasons
 }
 
+#pragma mark PLUGIN-TO-BROWSER
 
--(NPError)getURLNotify:(const char *)url target:(const char *)target notifyData:(void *)notifyData
+- (NPError) loadURL:(NSString *)URLString inTarget:(NSString *)target withNotifyData:(void *)notifyData andHandleAttributes:(NSDictionary *)attributes
 {
-    NSURL *requestedURL;
     IFPluginStream *stream;
     IFWebDataSource *dataSource;
     IFWebFrame *frame;
+    NSURL *url;
     
-    WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPN_GetURLNotify: %s target: %s\n", url, target);
- 
-    requestedURL = [self URLForString:[NSString stringWithCString:url]];
+    if([URLString _IF_looksLikeAbsoluteURL])
+        url = [NSURL URLWithString:URLString];
+    else
+        url = [NSURL URLWithString:URLString relativeToURL:baseURL];
     
-    if(!requestedURL)
+    if(!url)
         return NPERR_INVALID_URL;
     
-    if(target == NULL){ 
-        // Send data to plug-in if target is null
-        stream = [[IFPluginStream alloc] initWithURL:requestedURL pluginPointer:instance notifyData:notifyData];
+    if(!target){
+        stream = [[IFPluginStream alloc] initWithURL:url pluginPointer:instance notifyData:notifyData attributes:attributes];
         if(stream){
             [streams addObject:stream];
             [stream release];
+        }else{
+            return NPERR_INVALID_URL;
         }
-    
     }else{
-        dataSource = [[[IFWebDataSource alloc] initWithURL:requestedURL] autorelease];
-        frame = [webFrame frameNamed:[NSString stringWithCString:target]];
-        if(frame){
-            [frame setProvisionalDataSource:dataSource];
-            [frame startLoading];
-        }else{
+        frame = [webFrame frameNamed:target];
+        if(!frame){
             //FIXME: Create new window here (2931449)
+            return NPERR_GENERIC_ERROR;
         }
-        // FIXME: Need to send NPP_URLNotify
+        if(notifyData){
+            if([target isEqualToString:@"_self"] || [target isEqualToString:@"_current"] || 
+               [target isEqualToString:@"_parent"] || [target isEqualToString:@"_top"]){
+                // return error since notification can't be sent to a plug-in that will no longer exist
+                return NPERR_INVALID_PARAM;
+            }
+            [notificationData setObject:[NSValue valueWithPointer:notifyData] forKey:url];
+            [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(frameStateChanged:) name:IFFrameStateChangedNotification object:frame];
+        }
+        dataSource = [[[IFWebDataSource alloc] initWithURL:url attributes:attributes] autorelease];
+        [frame setProvisionalDataSource:dataSource];
+        [frame startLoading];
     }
     return NPERR_NO_ERROR;
 }
 
+-(NPError)getURLNotify:(const char *)url target:(const char *)target notifyData:(void *)notifyData
+{
+    NSString *theTarget = nil;
+        
+    WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPN_GetURLNotify: %s target: %s\n", url, target);
+        
+    if(!url)
+        return NPERR_INVALID_URL;
+        
+    if(target)
+        theTarget = [NSString stringWithCString:url];
+    
+    return [self loadURL:[NSString stringWithCString:url] inTarget:theTarget withNotifyData:notifyData andHandleAttributes:nil];
+}
+
 -(NPError)getURL:(const char *)url target:(const char *)target
 {
+    NSString *theTarget = nil;
+    
     WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPN_GetURL: %s target: %s\n", url, target);
-    return [self getURLNotify:url target:target notifyData:NULL];
+    
+    if(!url)
+        return NPERR_INVALID_URL;
+        
+    if(target)
+        theTarget = [NSString stringWithCString:url];
+    
+    return [self loadURL:[NSString stringWithCString:url] inTarget:theTarget withNotifyData:nil andHandleAttributes:nil];
 }
 
 -(NPError)postURLNotify:(const char *)url target:(const char *)target len:(UInt32)len buf:(const char *)buf file:(NPBool)file notifyData:(void *)notifyData
 {
-    NSURL *requestedURL;
     NSDictionary *attributes=nil;
     NSData *postData;
-    IFWebDataSource *dataSource;
-    IFPluginStream *stream;
-    IFWebFrame *frame;
-            
-    WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "postURLNotify: %s\n", url);
- 
-    requestedURL = [self URLForString:[NSString stringWithCString:url]];
+    NSURL *tempURL;
+    NSString *path, *theTarget = nil;
     
-    if(!requestedURL)
+    WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPN_PostURLNotify: %s\n", url);
+ 
+    if(!url)
         return NPERR_INVALID_URL;
-    
+        
+    if(target)
+        theTarget = [NSString stringWithCString:url];
+ 
     if(file){
-        // FIXME: Need function to convert from carbon path to posix
-        postData = [NSData dataWithContentsOfFile:nil];
+        if([[NSString stringWithCString:buf] _IF_looksLikeAbsoluteURL]){
+            tempURL = [NSURL fileURLWithPath:[NSString stringWithCString:url]];
+            path = [tempURL path];
+        }else{
+            path = [NSString stringWithCString:buf];
+        }
+        postData = [NSData dataWithContentsOfFile:path];
     }else{
         postData = [NSData dataWithBytes:buf length:len];
     }
@@ -628,30 +681,22 @@ static char *newCString(NSString *string)
         postData,	IFHTTPURLHandleRequestData,
         @"POST", 	IFHTTPURLHandleRequestMethod, nil];
                 
-    if(target == NULL){ 
-        // Send data to plug-in if target is null
-        stream = [[IFPluginStream alloc] initWithURL:requestedURL pluginPointer:instance notifyData:notifyData attributes:attributes];
-        if(stream){
-            [streams addObject:stream];
-            [stream release];
-        }  
-    }else{
-        dataSource = [[[IFWebDataSource alloc] initWithURL:requestedURL attributes:attributes] autorelease];
-        frame = [webFrame frameNamed:[NSString stringWithCString:target]];
-        if(frame){
-            [frame setProvisionalDataSource:dataSource];
-            [frame startLoading];
-        }else{
-            //FIXME: Create new window here (2931449)
-        }
-        // FIXME: Need to send NPP_URLNotify
-    }
-    return NPERR_NO_ERROR;
+    return [self loadURL:[NSString stringWithCString:url] inTarget:theTarget 
+                withNotifyData:notifyData andHandleAttributes:attributes];
 }
 
 -(NPError)postURL:(const char *)url target:(const char *)target len:(UInt32)len buf:(const char *)buf file:(NPBool)file
 {
-    WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPN_PostURL\n");
+    NSString *theTarget = nil;
+        
+    WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPN_PostURL: %s\n", url);
+    
+    if(!url)
+        return NPERR_INVALID_URL;
+        
+    if(target)
+        theTarget = [NSString stringWithCString:url];
+        
     return [self postURLNotify:url target:target len:len buf:buf file:file notifyData:NULL];
 }
 
@@ -687,20 +732,20 @@ static char *newCString(NSString *string)
 
 -(void)invalidateRect:(NPRect *)invalidRect
 {
-    [self sendUpdateEvent];
     WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPN_InvalidateRect\n");
+    [self sendUpdateEvent];
 }
 
 -(void)invalidateRegion:(NPRegion)invalidateRegion
 {
-    [self sendUpdateEvent];
     WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPN_InvalidateRegion\n");
+    [self sendUpdateEvent];
 }
 
 -(void)forceRedraw
 {
-    [self sendUpdateEvent];
     WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "forceRedraw\n");
+    [self sendUpdateEvent];
 }
 
 
@@ -738,8 +783,4 @@ static char *newCString(NSString *string)
     return NPP_URLNotify;
 }
 
-
-
 @end
-
-
diff --git a/WebKit/WebKit.pbproj/project.pbxproj b/WebKit/WebKit.pbproj/project.pbxproj
index 5973e8d..bf4f0af 100644
--- a/WebKit/WebKit.pbproj/project.pbxproj
+++ b/WebKit/WebKit.pbproj/project.pbxproj
@@ -210,7 +210,6 @@
 				F5B92B840223191D01C1A525,
 				F5D538EA02441F2601A80181,
 				F5F084BB024BDC8E01CA1520,
-				F5F084BF024BDCA701CA1520,
 				F58BAB3B025036CA01C1A526,
 				9CAE9D080252A4130ECA16EA,
 				F59EAE400253C7EE018635CA,
@@ -275,7 +274,6 @@
 				F5D538ED02441FDD01A80181,
 				F5AEBB3E024A527601C1A526,
 				F5F084BC024BDC8E01CA1520,
-				F5F084C0024BDCA701CA1520,
 				F58BAB390250363E01C1A526,
 				F59EAE420253C8DE018635CA,
 				F5883BE3025E5E9D01000102,
@@ -1723,8 +1721,6 @@
 			children = (
 				F5F084B9024BDC8E01CA1520,
 				F5F084BA024BDC8E01CA1520,
-				F5F084BD024BDCA701CA1520,
-				F5F084BE024BDCA701CA1520,
 				F5A357510265E57A01000102,
 				F5A357520265E57A01000102,
 				F544394D02674FD501FF6181,
@@ -1762,30 +1758,6 @@
 			settings = {
 			};
 		};
-		F5F084BD024BDCA701CA1520 = {
-			isa = PBXFileReference;
-			name = IFMIMEDatabase.h;
-			path = MIME.subproj/IFMIMEDatabase.h;
-			refType = 4;
-		};
-		F5F084BE024BDCA701CA1520 = {
-			isa = PBXFileReference;
-			name = IFMIMEDatabase.m;
-			path = MIME.subproj/IFMIMEDatabase.m;
-			refType = 4;
-		};
-		F5F084BF024BDCA701CA1520 = {
-			fileRef = F5F084BD024BDCA701CA1520;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		F5F084C0024BDCA701CA1520 = {
-			fileRef = F5F084BE024BDCA701CA1520;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
 		F5F7171E0288493C018635CA = {
 			isa = PBXFileReference;
 			name = IFPlugin.h;
diff --git a/WebKit/WebView.subproj/IFMainURLHandleClient.h b/WebKit/WebView.subproj/IFMainURLHandleClient.h
index ce00ea8..e4291fb 100644
--- a/WebKit/WebView.subproj/IFMainURLHandleClient.h
+++ b/WebKit/WebView.subproj/IFMainURLHandleClient.h
@@ -21,12 +21,11 @@ class KHTMLPart;
     id dataSource;
     KHTMLPart *part;
     BOOL sentFakeDocForNonHTMLContentType, processedBufferedData, downloadStarted, loadFinished, examinedInitialData;
-    IFMIMEHandler *mimeHandler;
     IFMIMEHandlerType handlerType;
     IFDownloadHandler *downloadHandler;
     IFContentPolicy contentPolicy;
     NSData *resourceData;
-    NSString *encoding;
+    NSString *encoding, *MIMEType;
     NSURL *url;
 }
 - initWithDataSource: (IFWebDataSource *)ds part: (KHTMLPart *)p;
diff --git a/WebKit/WebView.subproj/IFMainURLHandleClient.mm b/WebKit/WebView.subproj/IFMainURLHandleClient.mm
index 865d9c0..abd38fa 100644
--- a/WebKit/WebView.subproj/IFMainURLHandleClient.mm
+++ b/WebKit/WebView.subproj/IFMainURLHandleClient.mm
@@ -10,7 +10,6 @@
 
 #import <WebKit/IFLoadProgress.h>
 #import <WebKit/IFBaseWebControllerPrivate.h>
-#import <WebKit/IFMIMEDatabase.h>
 #import <WebKit/WebKitDebug.h>
 #import <WebKit/IFContentHandler.h>
 #import <WebKit/IFDownloadHandler.h>
@@ -50,10 +49,10 @@
 {
     part->deref();
     [dataSource release];
-    [mimeHandler release];
     [resourceData release];
     [encoding release];
     [url release];
+    [MIMEType release];
     [super dealloc];
 }
 
@@ -67,7 +66,6 @@
         [self processData:resourceData isComplete:YES];
 }
 
-
 - (void)IFURLHandleResourceDidBeginLoading:(IFURLHandle *)sender
 {
     WEBKITDEBUGLEVEL (WEBKIT_LOG_LOADING, "url = %s\n", [[[sender url] absoluteString] cString]);
@@ -119,19 +117,24 @@
     
     // Check the mime type and ask the client for the content policy.
     if(!examinedInitialData){
-        WEBKITDEBUGLEVEL(WEBKIT_LOG_DOWNLOAD, "main content type: %s", [[sender contentType] cString]);
-        [[dataSource _locationChangeHandler] requestContentPolicyForMIMEType:[sender contentType]];
+        MIMEType = [[sender contentType] retain];
+        WEBKITDEBUGLEVEL(WEBKIT_LOG_DOWNLOAD, "main content type: %s", [MIMEType cString]);
+        [[dataSource _locationChangeHandler] requestContentPolicyForMIMEType:MIMEType];
         
         // FIXME: Remove/replace IFMIMEHandler stuff
-        mimeHandler = [[[IFMIMEDatabase sharedMIMEDatabase] MIMEHandlerForMIMEType:[sender contentType]] retain];
-        handlerType = [mimeHandler handlerType];
+        handlerType = [IFMIMEHandler MIMEHandlerTypeForMIMEType:MIMEType];
         
         encoding = [[sender characterSet] retain];
         url = [[sender url] retain];
         examinedInitialData = YES;
     }
     
-    if(contentPolicy != IFContentPolicyNone && contentPolicy != IFContentPolicyIgnore){
+    if(contentPolicy == IFContentPolicyIgnore){
+        [sender cancelLoadInBackground];
+        return;
+    }
+    
+    if(contentPolicy != IFContentPolicyNone){
         if(!processedBufferedData){
             // process all data that has been received now that we have a content policy
             [self processData:[sender resourceData] isComplete:NO];
@@ -141,10 +144,6 @@
         }
     }
     
-    if(contentPolicy == IFContentPolicyIgnore){
-        [sender cancelLoadInBackground];
-    }
-    
     WEBKITDEBUGLEVEL(WEBKIT_LOG_DOWNLOAD, "%d of %d", contentLengthReceived, contentLength);
     
     // Don't send the last progress message, it will be sent via
@@ -207,7 +206,7 @@
                 
             // For a non-html document, create html doc that embeds it.
             if (!sentFakeDocForNonHTMLContentType) {
-                contentHandler = [[IFContentHandler alloc] initWithMIMEHandler:mimeHandler URL:url];
+                contentHandler = [[IFContentHandler alloc] initWithURL:url MIMEType:MIMEType MIMEHandlerType:handlerType];
                 fakeHTMLDocument = [contentHandler HTMLDocument];
                 fakeHTMLDocumentBytes = [fakeHTMLDocument cString];
                 part->slotData(encoding, (const char *)fakeHTMLDocumentBytes, strlen(fakeHTMLDocumentBytes));
@@ -223,18 +222,18 @@
     }
     
     else if(contentPolicy == IFContentPolicySave || contentPolicy == IFContentPolicyOpenExternally){
-            if(!downloadStarted){
+        if(!downloadStarted){
+        
+            // If this is a download, detach the provisionalDataSource from the frame
+            // and have downloadHandler retain it.
+            downloadHandler = [[IFDownloadHandler alloc] initWithDataSource:dataSource];
+            frame = [dataSource webFrame];
+            [frame->_private setProvisionalDataSource:nil];
             
-                // If this is a download, detach the provisionalDataSource from the frame
-                // and have downloadHandler retain it.
-                downloadHandler = [[IFDownloadHandler alloc] initWithDataSource:dataSource];
-                frame = [dataSource webFrame];
-                [frame->_private setProvisionalDataSource:nil];
-                
-                // go right to locationChangeDone as the data source never gets committed.
-                [[dataSource _locationChangeHandler] locationChangeDone:nil];
-                downloadStarted = YES;
-            }
+            // go right to locationChangeDone as the data source never gets committed.
+            [[dataSource _locationChangeHandler] locationChangeDone:nil];
+            downloadStarted = YES;
+        }
     }
     
     if(complete)
@@ -249,7 +248,7 @@
     
     if(contentPolicy == IFContentPolicyShow){
         if(handlerType == IFMIMEHANDLERTYPE_TEXT) {
-            contentHandler = [[IFContentHandler alloc] initWithMIMEHandler:mimeHandler URL:url];
+            contentHandler = [[IFContentHandler alloc] initWithURL:url MIMEType:MIMEType MIMEHandlerType:IFMIMEHANDLERTYPE_TEXT];
             fakeHTMLDocument = [contentHandler textHTMLDocumentBottom];
             fakeHTMLDocumentBytes = [fakeHTMLDocument cString];
             part->slotData(encoding, (const char *)fakeHTMLDocumentBytes, strlen(fakeHTMLDocumentBytes));
diff --git a/WebKit/WebView.subproj/IFWebFramePrivate.h b/WebKit/WebView.subproj/IFWebFramePrivate.h
index b61bf5e..6fd78fe 100644
--- a/WebKit/WebView.subproj/IFWebFramePrivate.h
+++ b/WebKit/WebView.subproj/IFWebFramePrivate.h
@@ -30,6 +30,11 @@ typedef enum {
     IFWEBFRAMESTATE_COMPLETE = 5
 } IFWebFrameState;
 
+#define IFFrameStateChangedNotification @"IFFrameStateChangedNotification"
+
+#define IFPreviousFrameState @"IFPreviousFrameState"
+#define IFCurrentFrameState  @"IFCurrentFrameState"
+
 @interface IFWebFramePrivate : NSObject
 {
     NSString *name;
diff --git a/WebKit/WebView.subproj/IFWebFramePrivate.mm b/WebKit/WebView.subproj/IFWebFramePrivate.mm
index 560a0f0..0f22af1 100644
--- a/WebKit/WebView.subproj/IFWebFramePrivate.mm
+++ b/WebKit/WebView.subproj/IFWebFramePrivate.mm
@@ -267,7 +267,13 @@ static const char * const stateNames[6] = {
     if (newState == IFWEBFRAMESTATE_COMPLETE && self == [[self controller] mainFrame]){
         WEBKITDEBUGLEVEL (WEBKIT_LOG_DOCUMENTLOAD, "completed %s (%f seconds)", [[[[self dataSource] inputURL] absoluteString] cString], CFAbsoluteTimeGetCurrent() - [[self dataSource] _loadingStartedTime]);
     }
-
+    
+    NSDictionary *userInfo = [NSDictionary dictionaryWithObjectsAndKeys:
+                    [NSNumber numberWithInt:_private->state], IFPreviousFrameState,
+                    [NSNumber numberWithInt:newState], IFCurrentFrameState, nil];
+                    
+    [[NSNotificationCenter defaultCenter] postNotificationName:IFFrameStateChangedNotification object:self userInfo:userInfo];
+    
     _private->state = newState;
 }
 
diff --git a/WebKit/WebView.subproj/WebFramePrivate.h b/WebKit/WebView.subproj/WebFramePrivate.h
index b61bf5e..6fd78fe 100644
--- a/WebKit/WebView.subproj/WebFramePrivate.h
+++ b/WebKit/WebView.subproj/WebFramePrivate.h
@@ -30,6 +30,11 @@ typedef enum {
     IFWEBFRAMESTATE_COMPLETE = 5
 } IFWebFrameState;
 
+#define IFFrameStateChangedNotification @"IFFrameStateChangedNotification"
+
+#define IFPreviousFrameState @"IFPreviousFrameState"
+#define IFCurrentFrameState  @"IFCurrentFrameState"
+
 @interface IFWebFramePrivate : NSObject
 {
     NSString *name;
diff --git a/WebKit/WebView.subproj/WebFramePrivate.m b/WebKit/WebView.subproj/WebFramePrivate.m
index 560a0f0..0f22af1 100644
--- a/WebKit/WebView.subproj/WebFramePrivate.m
+++ b/WebKit/WebView.subproj/WebFramePrivate.m
@@ -267,7 +267,13 @@ static const char * const stateNames[6] = {
     if (newState == IFWEBFRAMESTATE_COMPLETE && self == [[self controller] mainFrame]){
         WEBKITDEBUGLEVEL (WEBKIT_LOG_DOCUMENTLOAD, "completed %s (%f seconds)", [[[[self dataSource] inputURL] absoluteString] cString], CFAbsoluteTimeGetCurrent() - [[self dataSource] _loadingStartedTime]);
     }
-
+    
+    NSDictionary *userInfo = [NSDictionary dictionaryWithObjectsAndKeys:
+                    [NSNumber numberWithInt:_private->state], IFPreviousFrameState,
+                    [NSNumber numberWithInt:newState], IFCurrentFrameState, nil];
+                    
+    [[NSNotificationCenter defaultCenter] postNotificationName:IFFrameStateChangedNotification object:self userInfo:userInfo];
+    
     _private->state = newState;
 }
 
diff --git a/WebKit/WebView.subproj/WebMainResourceClient.h b/WebKit/WebView.subproj/WebMainResourceClient.h
index ce00ea8..e4291fb 100644
--- a/WebKit/WebView.subproj/WebMainResourceClient.h
+++ b/WebKit/WebView.subproj/WebMainResourceClient.h
@@ -21,12 +21,11 @@ class KHTMLPart;
     id dataSource;
     KHTMLPart *part;
     BOOL sentFakeDocForNonHTMLContentType, processedBufferedData, downloadStarted, loadFinished, examinedInitialData;
-    IFMIMEHandler *mimeHandler;
     IFMIMEHandlerType handlerType;
     IFDownloadHandler *downloadHandler;
     IFContentPolicy contentPolicy;
     NSData *resourceData;
-    NSString *encoding;
+    NSString *encoding, *MIMEType;
     NSURL *url;
 }
 - initWithDataSource: (IFWebDataSource *)ds part: (KHTMLPart *)p;
diff --git a/WebKit/WebView.subproj/WebMainResourceClient.m b/WebKit/WebView.subproj/WebMainResourceClient.m
index 865d9c0..abd38fa 100644
--- a/WebKit/WebView.subproj/WebMainResourceClient.m
+++ b/WebKit/WebView.subproj/WebMainResourceClient.m
@@ -10,7 +10,6 @@
 
 #import <WebKit/IFLoadProgress.h>
 #import <WebKit/IFBaseWebControllerPrivate.h>
-#import <WebKit/IFMIMEDatabase.h>
 #import <WebKit/WebKitDebug.h>
 #import <WebKit/IFContentHandler.h>
 #import <WebKit/IFDownloadHandler.h>
@@ -50,10 +49,10 @@
 {
     part->deref();
     [dataSource release];
-    [mimeHandler release];
     [resourceData release];
     [encoding release];
     [url release];
+    [MIMEType release];
     [super dealloc];
 }
 
@@ -67,7 +66,6 @@
         [self processData:resourceData isComplete:YES];
 }
 
-
 - (void)IFURLHandleResourceDidBeginLoading:(IFURLHandle *)sender
 {
     WEBKITDEBUGLEVEL (WEBKIT_LOG_LOADING, "url = %s\n", [[[sender url] absoluteString] cString]);
@@ -119,19 +117,24 @@
     
     // Check the mime type and ask the client for the content policy.
     if(!examinedInitialData){
-        WEBKITDEBUGLEVEL(WEBKIT_LOG_DOWNLOAD, "main content type: %s", [[sender contentType] cString]);
-        [[dataSource _locationChangeHandler] requestContentPolicyForMIMEType:[sender contentType]];
+        MIMEType = [[sender contentType] retain];
+        WEBKITDEBUGLEVEL(WEBKIT_LOG_DOWNLOAD, "main content type: %s", [MIMEType cString]);
+        [[dataSource _locationChangeHandler] requestContentPolicyForMIMEType:MIMEType];
         
         // FIXME: Remove/replace IFMIMEHandler stuff
-        mimeHandler = [[[IFMIMEDatabase sharedMIMEDatabase] MIMEHandlerForMIMEType:[sender contentType]] retain];
-        handlerType = [mimeHandler handlerType];
+        handlerType = [IFMIMEHandler MIMEHandlerTypeForMIMEType:MIMEType];
         
         encoding = [[sender characterSet] retain];
         url = [[sender url] retain];
         examinedInitialData = YES;
     }
     
-    if(contentPolicy != IFContentPolicyNone && contentPolicy != IFContentPolicyIgnore){
+    if(contentPolicy == IFContentPolicyIgnore){
+        [sender cancelLoadInBackground];
+        return;
+    }
+    
+    if(contentPolicy != IFContentPolicyNone){
         if(!processedBufferedData){
             // process all data that has been received now that we have a content policy
             [self processData:[sender resourceData] isComplete:NO];
@@ -141,10 +144,6 @@
         }
     }
     
-    if(contentPolicy == IFContentPolicyIgnore){
-        [sender cancelLoadInBackground];
-    }
-    
     WEBKITDEBUGLEVEL(WEBKIT_LOG_DOWNLOAD, "%d of %d", contentLengthReceived, contentLength);
     
     // Don't send the last progress message, it will be sent via
@@ -207,7 +206,7 @@
                 
             // For a non-html document, create html doc that embeds it.
             if (!sentFakeDocForNonHTMLContentType) {
-                contentHandler = [[IFContentHandler alloc] initWithMIMEHandler:mimeHandler URL:url];
+                contentHandler = [[IFContentHandler alloc] initWithURL:url MIMEType:MIMEType MIMEHandlerType:handlerType];
                 fakeHTMLDocument = [contentHandler HTMLDocument];
                 fakeHTMLDocumentBytes = [fakeHTMLDocument cString];
                 part->slotData(encoding, (const char *)fakeHTMLDocumentBytes, strlen(fakeHTMLDocumentBytes));
@@ -223,18 +222,18 @@
     }
     
     else if(contentPolicy == IFContentPolicySave || contentPolicy == IFContentPolicyOpenExternally){
-            if(!downloadStarted){
+        if(!downloadStarted){
+        
+            // If this is a download, detach the provisionalDataSource from the frame
+            // and have downloadHandler retain it.
+            downloadHandler = [[IFDownloadHandler alloc] initWithDataSource:dataSource];
+            frame = [dataSource webFrame];
+            [frame->_private setProvisionalDataSource:nil];
             
-                // If this is a download, detach the provisionalDataSource from the frame
-                // and have downloadHandler retain it.
-                downloadHandler = [[IFDownloadHandler alloc] initWithDataSource:dataSource];
-                frame = [dataSource webFrame];
-                [frame->_private setProvisionalDataSource:nil];
-                
-                // go right to locationChangeDone as the data source never gets committed.
-                [[dataSource _locationChangeHandler] locationChangeDone:nil];
-                downloadStarted = YES;
-            }
+            // go right to locationChangeDone as the data source never gets committed.
+            [[dataSource _locationChangeHandler] locationChangeDone:nil];
+            downloadStarted = YES;
+        }
     }
     
     if(complete)
@@ -249,7 +248,7 @@
     
     if(contentPolicy == IFContentPolicyShow){
         if(handlerType == IFMIMEHANDLERTYPE_TEXT) {
-            contentHandler = [[IFContentHandler alloc] initWithMIMEHandler:mimeHandler URL:url];
+            contentHandler = [[IFContentHandler alloc] initWithURL:url MIMEType:MIMEType MIMEHandlerType:IFMIMEHANDLERTYPE_TEXT];
             fakeHTMLDocument = [contentHandler textHTMLDocumentBottom];
             fakeHTMLDocumentBytes = [fakeHTMLDocument cString];
             part->slotData(encoding, (const char *)fakeHTMLDocumentBytes, strlen(fakeHTMLDocumentBytes));
diff --git a/WebKit/WebView.subproj/WebMainResourceLoader.h b/WebKit/WebView.subproj/WebMainResourceLoader.h
index ce00ea8..e4291fb 100644
--- a/WebKit/WebView.subproj/WebMainResourceLoader.h
+++ b/WebKit/WebView.subproj/WebMainResourceLoader.h
@@ -21,12 +21,11 @@ class KHTMLPart;
     id dataSource;
     KHTMLPart *part;
     BOOL sentFakeDocForNonHTMLContentType, processedBufferedData, downloadStarted, loadFinished, examinedInitialData;
-    IFMIMEHandler *mimeHandler;
     IFMIMEHandlerType handlerType;
     IFDownloadHandler *downloadHandler;
     IFContentPolicy contentPolicy;
     NSData *resourceData;
-    NSString *encoding;
+    NSString *encoding, *MIMEType;
     NSURL *url;
 }
 - initWithDataSource: (IFWebDataSource *)ds part: (KHTMLPart *)p;
diff --git a/WebKit/WebView.subproj/WebMainResourceLoader.m b/WebKit/WebView.subproj/WebMainResourceLoader.m
index 865d9c0..abd38fa 100644
--- a/WebKit/WebView.subproj/WebMainResourceLoader.m
+++ b/WebKit/WebView.subproj/WebMainResourceLoader.m
@@ -10,7 +10,6 @@
 
 #import <WebKit/IFLoadProgress.h>
 #import <WebKit/IFBaseWebControllerPrivate.h>
-#import <WebKit/IFMIMEDatabase.h>
 #import <WebKit/WebKitDebug.h>
 #import <WebKit/IFContentHandler.h>
 #import <WebKit/IFDownloadHandler.h>
@@ -50,10 +49,10 @@
 {
     part->deref();
     [dataSource release];
-    [mimeHandler release];
     [resourceData release];
     [encoding release];
     [url release];
+    [MIMEType release];
     [super dealloc];
 }
 
@@ -67,7 +66,6 @@
         [self processData:resourceData isComplete:YES];
 }
 
-
 - (void)IFURLHandleResourceDidBeginLoading:(IFURLHandle *)sender
 {
     WEBKITDEBUGLEVEL (WEBKIT_LOG_LOADING, "url = %s\n", [[[sender url] absoluteString] cString]);
@@ -119,19 +117,24 @@
     
     // Check the mime type and ask the client for the content policy.
     if(!examinedInitialData){
-        WEBKITDEBUGLEVEL(WEBKIT_LOG_DOWNLOAD, "main content type: %s", [[sender contentType] cString]);
-        [[dataSource _locationChangeHandler] requestContentPolicyForMIMEType:[sender contentType]];
+        MIMEType = [[sender contentType] retain];
+        WEBKITDEBUGLEVEL(WEBKIT_LOG_DOWNLOAD, "main content type: %s", [MIMEType cString]);
+        [[dataSource _locationChangeHandler] requestContentPolicyForMIMEType:MIMEType];
         
         // FIXME: Remove/replace IFMIMEHandler stuff
-        mimeHandler = [[[IFMIMEDatabase sharedMIMEDatabase] MIMEHandlerForMIMEType:[sender contentType]] retain];
-        handlerType = [mimeHandler handlerType];
+        handlerType = [IFMIMEHandler MIMEHandlerTypeForMIMEType:MIMEType];
         
         encoding = [[sender characterSet] retain];
         url = [[sender url] retain];
         examinedInitialData = YES;
     }
     
-    if(contentPolicy != IFContentPolicyNone && contentPolicy != IFContentPolicyIgnore){
+    if(contentPolicy == IFContentPolicyIgnore){
+        [sender cancelLoadInBackground];
+        return;
+    }
+    
+    if(contentPolicy != IFContentPolicyNone){
         if(!processedBufferedData){
             // process all data that has been received now that we have a content policy
             [self processData:[sender resourceData] isComplete:NO];
@@ -141,10 +144,6 @@
         }
     }
     
-    if(contentPolicy == IFContentPolicyIgnore){
-        [sender cancelLoadInBackground];
-    }
-    
     WEBKITDEBUGLEVEL(WEBKIT_LOG_DOWNLOAD, "%d of %d", contentLengthReceived, contentLength);
     
     // Don't send the last progress message, it will be sent via
@@ -207,7 +206,7 @@
                 
             // For a non-html document, create html doc that embeds it.
             if (!sentFakeDocForNonHTMLContentType) {
-                contentHandler = [[IFContentHandler alloc] initWithMIMEHandler:mimeHandler URL:url];
+                contentHandler = [[IFContentHandler alloc] initWithURL:url MIMEType:MIMEType MIMEHandlerType:handlerType];
                 fakeHTMLDocument = [contentHandler HTMLDocument];
                 fakeHTMLDocumentBytes = [fakeHTMLDocument cString];
                 part->slotData(encoding, (const char *)fakeHTMLDocumentBytes, strlen(fakeHTMLDocumentBytes));
@@ -223,18 +222,18 @@
     }
     
     else if(contentPolicy == IFContentPolicySave || contentPolicy == IFContentPolicyOpenExternally){
-            if(!downloadStarted){
+        if(!downloadStarted){
+        
+            // If this is a download, detach the provisionalDataSource from the frame
+            // and have downloadHandler retain it.
+            downloadHandler = [[IFDownloadHandler alloc] initWithDataSource:dataSource];
+            frame = [dataSource webFrame];
+            [frame->_private setProvisionalDataSource:nil];
             
-                // If this is a download, detach the provisionalDataSource from the frame
-                // and have downloadHandler retain it.
-                downloadHandler = [[IFDownloadHandler alloc] initWithDataSource:dataSource];
-                frame = [dataSource webFrame];
-                [frame->_private setProvisionalDataSource:nil];
-                
-                // go right to locationChangeDone as the data source never gets committed.
-                [[dataSource _locationChangeHandler] locationChangeDone:nil];
-                downloadStarted = YES;
-            }
+            // go right to locationChangeDone as the data source never gets committed.
+            [[dataSource _locationChangeHandler] locationChangeDone:nil];
+            downloadStarted = YES;
+        }
     }
     
     if(complete)
@@ -249,7 +248,7 @@
     
     if(contentPolicy == IFContentPolicyShow){
         if(handlerType == IFMIMEHANDLERTYPE_TEXT) {
-            contentHandler = [[IFContentHandler alloc] initWithMIMEHandler:mimeHandler URL:url];
+            contentHandler = [[IFContentHandler alloc] initWithURL:url MIMEType:MIMEType MIMEHandlerType:IFMIMEHANDLERTYPE_TEXT];
             fakeHTMLDocument = [contentHandler textHTMLDocumentBottom];
             fakeHTMLDocumentBytes = [fakeHTMLDocument cString];
             part->slotData(encoding, (const char *)fakeHTMLDocumentBytes, strlen(fakeHTMLDocumentBytes));

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list