[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 05:55:38 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 0e9fc40474f8bcacc819e791c3c3a389f36ad46b
Author: cblu <cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Feb 13 19:14:06 2002 +0000

    Fixed a bug where the QT Plug-in would complain about not using QT 5. This was because sometimes I wasn't passing a mime type to the plug-in
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@618 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/kwq/WCPlugin.h b/WebCore/kwq/WCPlugin.h
index f1cf405..2e996b0 100644
--- a/WebCore/kwq/WCPlugin.h
+++ b/WebCore/kwq/WCPlugin.h
@@ -27,7 +27,6 @@
 #include "npapi.h"
 
 @interface WCPlugin : NSObject {
-
     NSMutableArray *mimeTypes;
     NSString *name, *executablePath, *filename, *pluginDescription;
     BOOL isLoaded;
@@ -35,6 +34,7 @@
     NPNetscapeFuncs browserFuncs;
     uint16 pluginSize;
     uint16 pluginVersion;
+    
     NPP_NewProcPtr NPP_New;
     NPP_DestroyProcPtr NPP_Destroy;
     NPP_SetWindowProcPtr NPP_SetWindow;
@@ -49,13 +49,13 @@
     NPP_GetValueProcPtr NPP_GetValue;
     NPP_SetValueProcPtr NPP_SetValue;
     NPP_ShutdownProcPtr NPP_Shutdown; 
-
 }
 
 - (BOOL)initializeWithPath:(NSString *)plugin;
 - (BOOL)getPluginInfoForResourceFile:(SInt16)resRef;
 - (void)load;
 - (void)unload;
+- (NSString *)mimeTypeForURL:(NSString *)URL;
 - (NSArray *)mimeTypes;
 - (NSString *)name;
 - (NSString *)filename;
@@ -64,7 +64,6 @@
 - (NSString *)description;
 - (NSString *)pluginDescription;
 
-
 - (NPP_NewProcPtr)NPP_New;
 - (NPP_DestroyProcPtr)NPP_Destroy;
 - (NPP_SetWindowProcPtr)NPP_SetWindow;
diff --git a/WebCore/kwq/WCPlugin.mm b/WebCore/kwq/WCPlugin.mm
index 40be25b..fef88dc 100644
--- a/WebCore/kwq/WCPlugin.mm
+++ b/WebCore/kwq/WCPlugin.mm
@@ -209,6 +209,22 @@
     // unload library here
 }
 
+- (NSString *)mimeTypeForURL:(NSString *)URL
+{
+    uint n;
+    NSRange hasExtension;
+    NSString *extension;
+    
+    extension = [URL pathExtension];
+    for(n=0; n<[mimeTypes count]; n++){
+        hasExtension = [[[mimeTypes objectAtIndex:n] objectAtIndex:1] rangeOfString:extension];
+        if(hasExtension.length){
+            return [[mimeTypes objectAtIndex:n] objectAtIndex:0];
+        }
+    }
+    return nil;
+}
+
 - (NPP_SetWindowProcPtr)NPP_SetWindow{
     return NPP_SetWindow;
 }
diff --git a/WebCore/kwq/WCPluginWidget.mm b/WebCore/kwq/WCPluginWidget.mm
index 125c165..ce88a90 100644
--- a/WebCore/kwq/WCPluginWidget.mm
+++ b/WebCore/kwq/WCPluginWidget.mm
@@ -37,7 +37,7 @@
 WCPluginWidget::WCPluginWidget(QWidget *parent, const QString &url, const QString &serviceType, const QStringList &args)
 {
     NSMutableDictionary *arguments;
-    NSString *arg;
+    NSString *arg, *mimeType;
     NSRange r1, r2, r3;
     WCPlugin *plugin;
     uint i;
@@ -51,9 +51,14 @@ WCPluginWidget::WCPluginWidget(QWidget *parent, const QString &url, const QStrin
         r3.length = [arg length] - r2.location - 2; // don't include quotes
         [arguments setObject:[arg substringWithRange:r3] forKey:[arg substringToIndex:r1.location]];
     }
-    plugin = [[WCPluginDatabase installedPlugins] getPluginForMimeType:QSTRING_TO_NSSTRING(serviceType)];
-    if(plugin == nil){
+    if(serviceType.isNull()){
         plugin = [[WCPluginDatabase installedPlugins] getPluginForURL:QSTRING_TO_NSSTRING(url)];
+        if(plugin != nil){
+            mimeType = [plugin mimeTypeForURL:QSTRING_TO_NSSTRING(url)];
+        }
+    }else{
+        plugin = [[WCPluginDatabase installedPlugins] getPluginForMimeType:QSTRING_TO_NSSTRING(serviceType)];
+        mimeType = QSTRING_TO_NSSTRING(serviceType);
     }
     if(plugin == nil){
         //FIXME: Error dialog should be shown here
@@ -61,7 +66,7 @@ WCPluginWidget::WCPluginWidget(QWidget *parent, const QString &url, const QStrin
         return;
     }
     [plugin load];
-    setView([[[IFPluginView alloc] initWithFrame:NSMakeRect(0,0,0,0) widget:this plugin:plugin url:QSTRING_TO_NSSTRING(url) mime:QSTRING_TO_NSSTRING(serviceType) arguments:arguments] autorelease]);
+    setView([[[IFPluginView alloc] initWithFrame:NSMakeRect(0,0,0,0) widget:this plugin:plugin url:QSTRING_TO_NSSTRING(url) mime:mimeType arguments:arguments] autorelease]);
 }
 
 WCPluginWidget::~WCPluginWidget()
diff --git a/WebCore/src/kwq/WCPlugin.h b/WebCore/src/kwq/WCPlugin.h
index f1cf405..2e996b0 100644
--- a/WebCore/src/kwq/WCPlugin.h
+++ b/WebCore/src/kwq/WCPlugin.h
@@ -27,7 +27,6 @@
 #include "npapi.h"
 
 @interface WCPlugin : NSObject {
-
     NSMutableArray *mimeTypes;
     NSString *name, *executablePath, *filename, *pluginDescription;
     BOOL isLoaded;
@@ -35,6 +34,7 @@
     NPNetscapeFuncs browserFuncs;
     uint16 pluginSize;
     uint16 pluginVersion;
+    
     NPP_NewProcPtr NPP_New;
     NPP_DestroyProcPtr NPP_Destroy;
     NPP_SetWindowProcPtr NPP_SetWindow;
@@ -49,13 +49,13 @@
     NPP_GetValueProcPtr NPP_GetValue;
     NPP_SetValueProcPtr NPP_SetValue;
     NPP_ShutdownProcPtr NPP_Shutdown; 
-
 }
 
 - (BOOL)initializeWithPath:(NSString *)plugin;
 - (BOOL)getPluginInfoForResourceFile:(SInt16)resRef;
 - (void)load;
 - (void)unload;
+- (NSString *)mimeTypeForURL:(NSString *)URL;
 - (NSArray *)mimeTypes;
 - (NSString *)name;
 - (NSString *)filename;
@@ -64,7 +64,6 @@
 - (NSString *)description;
 - (NSString *)pluginDescription;
 
-
 - (NPP_NewProcPtr)NPP_New;
 - (NPP_DestroyProcPtr)NPP_Destroy;
 - (NPP_SetWindowProcPtr)NPP_SetWindow;
diff --git a/WebCore/src/kwq/WCPlugin.mm b/WebCore/src/kwq/WCPlugin.mm
index 40be25b..fef88dc 100644
--- a/WebCore/src/kwq/WCPlugin.mm
+++ b/WebCore/src/kwq/WCPlugin.mm
@@ -209,6 +209,22 @@
     // unload library here
 }
 
+- (NSString *)mimeTypeForURL:(NSString *)URL
+{
+    uint n;
+    NSRange hasExtension;
+    NSString *extension;
+    
+    extension = [URL pathExtension];
+    for(n=0; n<[mimeTypes count]; n++){
+        hasExtension = [[[mimeTypes objectAtIndex:n] objectAtIndex:1] rangeOfString:extension];
+        if(hasExtension.length){
+            return [[mimeTypes objectAtIndex:n] objectAtIndex:0];
+        }
+    }
+    return nil;
+}
+
 - (NPP_SetWindowProcPtr)NPP_SetWindow{
     return NPP_SetWindow;
 }
diff --git a/WebCore/src/kwq/WCPluginWidget.mm b/WebCore/src/kwq/WCPluginWidget.mm
index 125c165..ce88a90 100644
--- a/WebCore/src/kwq/WCPluginWidget.mm
+++ b/WebCore/src/kwq/WCPluginWidget.mm
@@ -37,7 +37,7 @@
 WCPluginWidget::WCPluginWidget(QWidget *parent, const QString &url, const QString &serviceType, const QStringList &args)
 {
     NSMutableDictionary *arguments;
-    NSString *arg;
+    NSString *arg, *mimeType;
     NSRange r1, r2, r3;
     WCPlugin *plugin;
     uint i;
@@ -51,9 +51,14 @@ WCPluginWidget::WCPluginWidget(QWidget *parent, const QString &url, const QStrin
         r3.length = [arg length] - r2.location - 2; // don't include quotes
         [arguments setObject:[arg substringWithRange:r3] forKey:[arg substringToIndex:r1.location]];
     }
-    plugin = [[WCPluginDatabase installedPlugins] getPluginForMimeType:QSTRING_TO_NSSTRING(serviceType)];
-    if(plugin == nil){
+    if(serviceType.isNull()){
         plugin = [[WCPluginDatabase installedPlugins] getPluginForURL:QSTRING_TO_NSSTRING(url)];
+        if(plugin != nil){
+            mimeType = [plugin mimeTypeForURL:QSTRING_TO_NSSTRING(url)];
+        }
+    }else{
+        plugin = [[WCPluginDatabase installedPlugins] getPluginForMimeType:QSTRING_TO_NSSTRING(serviceType)];
+        mimeType = QSTRING_TO_NSSTRING(serviceType);
     }
     if(plugin == nil){
         //FIXME: Error dialog should be shown here
@@ -61,7 +66,7 @@ WCPluginWidget::WCPluginWidget(QWidget *parent, const QString &url, const QStrin
         return;
     }
     [plugin load];
-    setView([[[IFPluginView alloc] initWithFrame:NSMakeRect(0,0,0,0) widget:this plugin:plugin url:QSTRING_TO_NSSTRING(url) mime:QSTRING_TO_NSSTRING(serviceType) arguments:arguments] autorelease]);
+    setView([[[IFPluginView alloc] initWithFrame:NSMakeRect(0,0,0,0) widget:this plugin:plugin url:QSTRING_TO_NSSTRING(url) mime:mimeType arguments:arguments] autorelease]);
 }
 
 WCPluginWidget::~WCPluginWidget()
diff --git a/WebKit/Plugins.subproj/IFPluginView.h b/WebKit/Plugins.subproj/IFPluginView.h
index fbe3e66..9e72f3a 100644
--- a/WebKit/Plugins.subproj/IFPluginView.h
+++ b/WebKit/Plugins.subproj/IFPluginView.h
@@ -10,8 +10,6 @@
 #include <npapi.h>
 #include <WCURLHandle.h>
 
-
-
 typedef struct _StreamData{
     uint16 transferMode;
     int32 offset;
@@ -21,7 +19,6 @@ typedef struct _StreamData{
     NSMutableData *data;
 } StreamData;
 
-
 @interface IFPluginViewNullEventSender : NSObject{
     NPP instance;
     NPP_HandleEventProcPtr NPP_HandleEvent;
@@ -44,7 +41,7 @@ typedef struct _StreamData{
     char **cAttributes, **cValues;
     bool isFlipped, transferred, hidden, stopped;
             
-    NSString *url, *mime;
+    NSString *URL, *mime;
     NSTrackingRectTag trackingTag;
     NSMutableArray *filesToErase;
     
@@ -61,7 +58,6 @@ typedef struct _StreamData{
     NPP_URLNotifyProcPtr NPP_URLNotify;
     NPP_GetValueProcPtr NPP_GetValue;
     NPP_SetValueProcPtr NPP_SetValue;
-    NPP_ShutdownProcPtr NPP_Shutdown; 
 }
 
 - initWithFrame: (NSRect) r widget: (QWidget *)w plugin: (WCPlugin *)plug url: (NSString *)location mime:(NSString *)mime arguments:(NSDictionary *)arguments;
diff --git a/WebKit/Plugins.subproj/IFPluginView.mm b/WebKit/Plugins.subproj/IFPluginView.mm
index 8586b03..b7dd617 100644
--- a/WebKit/Plugins.subproj/IFPluginView.mm
+++ b/WebKit/Plugins.subproj/IFPluginView.mm
@@ -7,6 +7,7 @@
 #include <Carbon/Carbon.h> 
 #include "kwqdebug.h"
 
+
 @implementation IFPluginViewNullEventSender
 
 -(id)initializeWithNPP:(NPP)pluginInstance functionPointer:(NPP_HandleEventProcPtr)HandleEventFunction;
@@ -53,10 +54,10 @@
     instance->ndata = self;
 
     mime = mimeType;
-    url = location;
+    URL = location;
     plugin = plug;
     [mime retain];
-    [url retain];
+    [URL retain];
     [plugin retain];
     
     NPP_New = 		[plugin NPP_New]; // copy function pointers
@@ -69,6 +70,9 @@
     NPP_DestroyStream = [plugin NPP_DestroyStream];
     NPP_HandleEvent = 	[plugin NPP_HandleEvent];
     NPP_URLNotify = 	[plugin NPP_URLNotify];
+    NPP_GetValue = 	[plugin NPP_GetValue];
+    NPP_SetValue = 	[plugin NPP_SetValue];
+    NPP_Print = 	[plugin NPP_Print]; 
     
     attributes = [arguments allKeys];
     values = [arguments allValues];
@@ -113,7 +117,7 @@
     [self setWindow:rect];
     if(!transferred){
         [self sendActivateEvent];
-        [self newStream:url mimeType:mime notifyData:NULL];
+        [self newStream:URL mimeType:mime notifyData:NULL];
         transferred = TRUE;
     }
     [self sendUpdateEvent];
@@ -147,8 +151,8 @@
     
     npErr = NPP_SetWindow(instance, &window);
     KWQDebug("NPP_SetWindow: %d rect.size.height=%d rect.size.width=%d port=%d rect.origin.x=%f rect.origin.y=%f\n", npErr, (int)rect.size.height, (int)rect.size.width, (int)nPort.port, rect.origin.x, rect.origin.y);
-    KWQDebug("frame.size.height=%d frame.size.width=%d frame.origin.x=%f frame.origin.y=%f\n", (int)frame.size.height, (int)frame.size.width, frame.origin.x, frame.origin.y);
-    KWQDebug("frameInWindow.size.height=%d frameInWindow.size.width=%d frameInWindow.origin.x=%f frameInWindow.origin.y=%f\n", (int)frameInWindow.size.height, (int)frameInWindow.size.width, frameInWindow.origin.x, frameInWindow.origin.y);
+    //KWQDebug("frame.size.height=%d frame.size.width=%d frame.origin.x=%f frame.origin.y=%f\n", (int)frame.size.height, (int)frame.size.width, frame.origin.x, frame.origin.y);
+    //KWQDebug("frameInWindow.size.height=%d frameInWindow.size.width=%d frameInWindow.origin.x=%f frameInWindow.origin.y=%f\n", (int)frameInWindow.size.height, (int)frameInWindow.size.width, frameInWindow.origin.x, frameInWindow.origin.y);
 }
 
 - (void) newStream:(NSString *)streamURL mimeType:(NSString *)mimeType notifyData:(void *)notifyData
@@ -161,9 +165,9 @@
     
     stream = malloc(sizeof(NPStream));
     cURL   = malloc([streamURL length]+1);
-    cMime  = malloc([mime length]+1);
+    cMime  = malloc([mimeType length]+1);
     [streamURL getCString:cURL];
-    [mime getCString:cMime];
+    [mimeType getCString:cMime];
     stream->url = cURL;
     stream->end = 0;
     stream->lastmodified = 0;
@@ -239,6 +243,7 @@
         cFilename = malloc([filenameClassic length]+1);
         [filenameClassic getCString:cFilename];
         NPP_StreamAsFile(instance, streamData->stream, cFilename);
+        KWQDebug("NPP_StreamAsFile: %s\n", cFilename);
         [streamData->data release];
         [streamData->filename release];
     }
@@ -254,6 +259,7 @@
 
 - (void)WCURLHandleResourceDidBeginLoading:(id)sender userData:(void *)userData
 {
+    [self setNeedsDisplay:YES];
 }
 
 - (void)WCURLHandleResourceDidCancelLoading:(id)sender userData:(void *)userData
@@ -447,73 +453,76 @@
 {
     KWQDebug("NPN_GetURLNotify: %s\n", url);
     if(target == NULL){ // send data to plug-in if target is null
-        [self newStream:[NSString stringWithCString:url] mimeType:nil notifyData:(void *)notifyData];
+        [self newStream:[NSString stringWithCString:url] mimeType:[plugin mimeTypeForURL:[NSString stringWithCString:url]] notifyData:(void *)notifyData];
     }
-    
     return NPERR_NO_ERROR;
 }
 
 -(NPError)getURL:(const char *)url target:(const char *)target
 {
-    KWQDebug("getURL\n");
-    return NPERR_GENERIC_ERROR;
+    KWQDebug("NPN_GetURL\n");
+    if(target == NULL){ // send data to plug-in if target is null
+        [self newStream:[NSString stringWithCString:url] mimeType:[plugin mimeTypeForURL:[NSString stringWithCString:url]] notifyData:NULL];
+    }
+    
+    return NPERR_NO_ERROR;
 }
 
 -(NPError)postURLNotify:(const char *)url target:(const char *)target len:(UInt32)len buf:(const char *)buf file:(NPBool)file notifyData:(void *)notifyData
 {
-    KWQDebug("postURLNotify\n");
+    KWQDebug("NPN_PostURLNotify\n");
     return NPERR_GENERIC_ERROR;
 }
 
 -(NPError)postURL:(const char *)url target:(const char *)target len:(UInt32)len buf:(const char *)buf file:(NPBool)file
 {
-    KWQDebug("postURL\n");
+    KWQDebug("NPN_PostURL\n");
     return NPERR_GENERIC_ERROR;
 }
 
 -(NPError)newStream:(NPMIMEType)type target:(const char *)target stream:(NPStream**)stream
 {
-    KWQDebug("newStream\n");
+    KWQDebug("NPN_NewStream\n");
     return NPERR_GENERIC_ERROR;
 }
 
 -(NPError)write:(NPStream*)stream len:(SInt32)len buffer:(void *)buffer
 {
-    KWQDebug("write\n");
+    KWQDebug("NPN_Write\n");
     return NPERR_GENERIC_ERROR;
 }
 
 -(NPError)destroyStream:(NPStream*)stream reason:(NPReason)reason
 {
-    KWQDebug("destroyStream\n");
+    KWQDebug("NPN_DestroyStream\n");
     return NPERR_GENERIC_ERROR;
 }
 
 -(void)status:(const char *)message
 {
-    KWQDebug("status\n");
+    KWQDebug("NPN_Status\n");
 }
 
 -(NPError)getValue:(NPNVariable)variable value:(void *)value
 {
-    KWQDebug("getValue\n");
+    KWQDebug("NPN_GetValue\n");
     return NPERR_GENERIC_ERROR;
 }
 
 -(NPError)setValue:(NPPVariable)variable value:(void *)value
 {
-    KWQDebug("setValue\n");
+    KWQDebug("NPN_SetValue\n");
     return NPERR_GENERIC_ERROR;
 }
 
 -(void)invalidateRect:(NPRect *)invalidRect
 {
-    KWQDebug("invalidateRect\n");
+    KWQDebug("NPN_InvalidateRect\n");
 }
 
 -(void)invalidateRegion:(NPRegion)invalidateRegion
 {
-    KWQDebug("invalidateRegion\n");
+    KWQDebug("NPN_InvalidateRegion\n");
 }
 
 - (void)stop
@@ -541,10 +550,15 @@
     
     [self stop];
     fileManager = [NSFileManager defaultManager];
-    for(i=0; i<[filesToErase count]; i++){
-        [fileManager removeFileAtPath:[filesToErase objectAtIndex:i] handler:nil];
+    for(i=0; i<[filesToErase count]; i++){  // remove downloaded files
+        [fileManager removeFileAtPath:[filesToErase objectAtIndex:i] handler:nil]; 
     }
     [filesToErase release];
+    [mime release];
+    [URL release];
+    [plugin release];
+    free(cAttributes);
+    free(cValues);
     [super dealloc];
 }
 
@@ -561,5 +575,4 @@ NSString* startupVolumeName(void)
         }
     }
     return rootName;
-}
-
+}
\ No newline at end of file
diff --git a/WebKit/Plugins.subproj/WebPluginView.h b/WebKit/Plugins.subproj/WebPluginView.h
index fbe3e66..9e72f3a 100644
--- a/WebKit/Plugins.subproj/WebPluginView.h
+++ b/WebKit/Plugins.subproj/WebPluginView.h
@@ -10,8 +10,6 @@
 #include <npapi.h>
 #include <WCURLHandle.h>
 
-
-
 typedef struct _StreamData{
     uint16 transferMode;
     int32 offset;
@@ -21,7 +19,6 @@ typedef struct _StreamData{
     NSMutableData *data;
 } StreamData;
 
-
 @interface IFPluginViewNullEventSender : NSObject{
     NPP instance;
     NPP_HandleEventProcPtr NPP_HandleEvent;
@@ -44,7 +41,7 @@ typedef struct _StreamData{
     char **cAttributes, **cValues;
     bool isFlipped, transferred, hidden, stopped;
             
-    NSString *url, *mime;
+    NSString *URL, *mime;
     NSTrackingRectTag trackingTag;
     NSMutableArray *filesToErase;
     
@@ -61,7 +58,6 @@ typedef struct _StreamData{
     NPP_URLNotifyProcPtr NPP_URLNotify;
     NPP_GetValueProcPtr NPP_GetValue;
     NPP_SetValueProcPtr NPP_SetValue;
-    NPP_ShutdownProcPtr NPP_Shutdown; 
 }
 
 - initWithFrame: (NSRect) r widget: (QWidget *)w plugin: (WCPlugin *)plug url: (NSString *)location mime:(NSString *)mime arguments:(NSDictionary *)arguments;
diff --git a/WebKit/Plugins.subproj/WebPluginView.m b/WebKit/Plugins.subproj/WebPluginView.m
index 8586b03..b7dd617 100644
--- a/WebKit/Plugins.subproj/WebPluginView.m
+++ b/WebKit/Plugins.subproj/WebPluginView.m
@@ -7,6 +7,7 @@
 #include <Carbon/Carbon.h> 
 #include "kwqdebug.h"
 
+
 @implementation IFPluginViewNullEventSender
 
 -(id)initializeWithNPP:(NPP)pluginInstance functionPointer:(NPP_HandleEventProcPtr)HandleEventFunction;
@@ -53,10 +54,10 @@
     instance->ndata = self;
 
     mime = mimeType;
-    url = location;
+    URL = location;
     plugin = plug;
     [mime retain];
-    [url retain];
+    [URL retain];
     [plugin retain];
     
     NPP_New = 		[plugin NPP_New]; // copy function pointers
@@ -69,6 +70,9 @@
     NPP_DestroyStream = [plugin NPP_DestroyStream];
     NPP_HandleEvent = 	[plugin NPP_HandleEvent];
     NPP_URLNotify = 	[plugin NPP_URLNotify];
+    NPP_GetValue = 	[plugin NPP_GetValue];
+    NPP_SetValue = 	[plugin NPP_SetValue];
+    NPP_Print = 	[plugin NPP_Print]; 
     
     attributes = [arguments allKeys];
     values = [arguments allValues];
@@ -113,7 +117,7 @@
     [self setWindow:rect];
     if(!transferred){
         [self sendActivateEvent];
-        [self newStream:url mimeType:mime notifyData:NULL];
+        [self newStream:URL mimeType:mime notifyData:NULL];
         transferred = TRUE;
     }
     [self sendUpdateEvent];
@@ -147,8 +151,8 @@
     
     npErr = NPP_SetWindow(instance, &window);
     KWQDebug("NPP_SetWindow: %d rect.size.height=%d rect.size.width=%d port=%d rect.origin.x=%f rect.origin.y=%f\n", npErr, (int)rect.size.height, (int)rect.size.width, (int)nPort.port, rect.origin.x, rect.origin.y);
-    KWQDebug("frame.size.height=%d frame.size.width=%d frame.origin.x=%f frame.origin.y=%f\n", (int)frame.size.height, (int)frame.size.width, frame.origin.x, frame.origin.y);
-    KWQDebug("frameInWindow.size.height=%d frameInWindow.size.width=%d frameInWindow.origin.x=%f frameInWindow.origin.y=%f\n", (int)frameInWindow.size.height, (int)frameInWindow.size.width, frameInWindow.origin.x, frameInWindow.origin.y);
+    //KWQDebug("frame.size.height=%d frame.size.width=%d frame.origin.x=%f frame.origin.y=%f\n", (int)frame.size.height, (int)frame.size.width, frame.origin.x, frame.origin.y);
+    //KWQDebug("frameInWindow.size.height=%d frameInWindow.size.width=%d frameInWindow.origin.x=%f frameInWindow.origin.y=%f\n", (int)frameInWindow.size.height, (int)frameInWindow.size.width, frameInWindow.origin.x, frameInWindow.origin.y);
 }
 
 - (void) newStream:(NSString *)streamURL mimeType:(NSString *)mimeType notifyData:(void *)notifyData
@@ -161,9 +165,9 @@
     
     stream = malloc(sizeof(NPStream));
     cURL   = malloc([streamURL length]+1);
-    cMime  = malloc([mime length]+1);
+    cMime  = malloc([mimeType length]+1);
     [streamURL getCString:cURL];
-    [mime getCString:cMime];
+    [mimeType getCString:cMime];
     stream->url = cURL;
     stream->end = 0;
     stream->lastmodified = 0;
@@ -239,6 +243,7 @@
         cFilename = malloc([filenameClassic length]+1);
         [filenameClassic getCString:cFilename];
         NPP_StreamAsFile(instance, streamData->stream, cFilename);
+        KWQDebug("NPP_StreamAsFile: %s\n", cFilename);
         [streamData->data release];
         [streamData->filename release];
     }
@@ -254,6 +259,7 @@
 
 - (void)WCURLHandleResourceDidBeginLoading:(id)sender userData:(void *)userData
 {
+    [self setNeedsDisplay:YES];
 }
 
 - (void)WCURLHandleResourceDidCancelLoading:(id)sender userData:(void *)userData
@@ -447,73 +453,76 @@
 {
     KWQDebug("NPN_GetURLNotify: %s\n", url);
     if(target == NULL){ // send data to plug-in if target is null
-        [self newStream:[NSString stringWithCString:url] mimeType:nil notifyData:(void *)notifyData];
+        [self newStream:[NSString stringWithCString:url] mimeType:[plugin mimeTypeForURL:[NSString stringWithCString:url]] notifyData:(void *)notifyData];
     }
-    
     return NPERR_NO_ERROR;
 }
 
 -(NPError)getURL:(const char *)url target:(const char *)target
 {
-    KWQDebug("getURL\n");
-    return NPERR_GENERIC_ERROR;
+    KWQDebug("NPN_GetURL\n");
+    if(target == NULL){ // send data to plug-in if target is null
+        [self newStream:[NSString stringWithCString:url] mimeType:[plugin mimeTypeForURL:[NSString stringWithCString:url]] notifyData:NULL];
+    }
+    
+    return NPERR_NO_ERROR;
 }
 
 -(NPError)postURLNotify:(const char *)url target:(const char *)target len:(UInt32)len buf:(const char *)buf file:(NPBool)file notifyData:(void *)notifyData
 {
-    KWQDebug("postURLNotify\n");
+    KWQDebug("NPN_PostURLNotify\n");
     return NPERR_GENERIC_ERROR;
 }
 
 -(NPError)postURL:(const char *)url target:(const char *)target len:(UInt32)len buf:(const char *)buf file:(NPBool)file
 {
-    KWQDebug("postURL\n");
+    KWQDebug("NPN_PostURL\n");
     return NPERR_GENERIC_ERROR;
 }
 
 -(NPError)newStream:(NPMIMEType)type target:(const char *)target stream:(NPStream**)stream
 {
-    KWQDebug("newStream\n");
+    KWQDebug("NPN_NewStream\n");
     return NPERR_GENERIC_ERROR;
 }
 
 -(NPError)write:(NPStream*)stream len:(SInt32)len buffer:(void *)buffer
 {
-    KWQDebug("write\n");
+    KWQDebug("NPN_Write\n");
     return NPERR_GENERIC_ERROR;
 }
 
 -(NPError)destroyStream:(NPStream*)stream reason:(NPReason)reason
 {
-    KWQDebug("destroyStream\n");
+    KWQDebug("NPN_DestroyStream\n");
     return NPERR_GENERIC_ERROR;
 }
 
 -(void)status:(const char *)message
 {
-    KWQDebug("status\n");
+    KWQDebug("NPN_Status\n");
 }
 
 -(NPError)getValue:(NPNVariable)variable value:(void *)value
 {
-    KWQDebug("getValue\n");
+    KWQDebug("NPN_GetValue\n");
     return NPERR_GENERIC_ERROR;
 }
 
 -(NPError)setValue:(NPPVariable)variable value:(void *)value
 {
-    KWQDebug("setValue\n");
+    KWQDebug("NPN_SetValue\n");
     return NPERR_GENERIC_ERROR;
 }
 
 -(void)invalidateRect:(NPRect *)invalidRect
 {
-    KWQDebug("invalidateRect\n");
+    KWQDebug("NPN_InvalidateRect\n");
 }
 
 -(void)invalidateRegion:(NPRegion)invalidateRegion
 {
-    KWQDebug("invalidateRegion\n");
+    KWQDebug("NPN_InvalidateRegion\n");
 }
 
 - (void)stop
@@ -541,10 +550,15 @@
     
     [self stop];
     fileManager = [NSFileManager defaultManager];
-    for(i=0; i<[filesToErase count]; i++){
-        [fileManager removeFileAtPath:[filesToErase objectAtIndex:i] handler:nil];
+    for(i=0; i<[filesToErase count]; i++){  // remove downloaded files
+        [fileManager removeFileAtPath:[filesToErase objectAtIndex:i] handler:nil]; 
     }
     [filesToErase release];
+    [mime release];
+    [URL release];
+    [plugin release];
+    free(cAttributes);
+    free(cValues);
     [super dealloc];
 }
 
@@ -561,5 +575,4 @@ NSString* startupVolumeName(void)
         }
     }
     return rootName;
-}
-
+}
\ No newline at end of file

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list