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

darin darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 06:08:02 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit c17374a5408b85c95d62d9fca830d72f30316ff3
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Apr 19 15:45:58 2002 +0000

    	* Plugins.subproj/IFPluginView.h: Re-add the attributes and values arrays,
    	since they need to live the life of the plugin.
    	* Plugins.subproj/IFPluginView.mm: (newCString): New function to make a C++
    	new-allocated C string from an NSString.
    	(-[IFPluginView initWithFrame:plugin:url:mime:arguments:mode:]): Move code
    	to allocate the arrays back here.
    	(-[IFPluginView dealloc]): Deallocate the arrays and their contents.
    	(-[IFPluginView start]): Simplify now that it does no work.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1051 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 2a9eab0..767beb5 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,14 @@
+2002-04-19  Darin Adler  <darin at apple.com>
+
+	* Plugins.subproj/IFPluginView.h: Re-add the attributes and values arrays,
+	since they need to live the life of the plugin.
+	* Plugins.subproj/IFPluginView.mm: (newCString): New function to make a C++
+	new-allocated C string from an NSString.
+	(-[IFPluginView initWithFrame:plugin:url:mime:arguments:mode:]): Move code
+	to allocate the arrays back here.
+	(-[IFPluginView dealloc]): Deallocate the arrays and their contents.
+	(-[IFPluginView start]): Simplify now that it does no work.
+
 2002-04-18  Chris Blumenberg  <cblu at apple.com>
 
 	Made stop and start to work better. Fixed a bug darin made.
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index 2a9eab0..767beb5 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,3 +1,14 @@
+2002-04-19  Darin Adler  <darin at apple.com>
+
+	* Plugins.subproj/IFPluginView.h: Re-add the attributes and values arrays,
+	since they need to live the life of the plugin.
+	* Plugins.subproj/IFPluginView.mm: (newCString): New function to make a C++
+	new-allocated C string from an NSString.
+	(-[IFPluginView initWithFrame:plugin:url:mime:arguments:mode:]): Move code
+	to allocate the arrays back here.
+	(-[IFPluginView dealloc]): Deallocate the arrays and their contents.
+	(-[IFPluginView start]): Simplify now that it does no work.
+
 2002-04-18  Chris Blumenberg  <cblu at apple.com>
 
 	Made stop and start to work better. Fixed a bug darin made.
diff --git a/WebKit/Plugins.subproj/IFPluginView.h b/WebKit/Plugins.subproj/IFPluginView.h
index 6288f03..5b30735 100644
--- a/WebKit/Plugins.subproj/IFPluginView.h
+++ b/WebKit/Plugins.subproj/IFPluginView.h
@@ -15,7 +15,8 @@
 {
     WCPlugin *plugin;
     IFPluginNullEventSender *eventSender;
-    NSDictionary *arguments;
+    unsigned argsCount;
+    char **cAttributes, **cValues;
     
     id <IFWebController> webController;
     IFWebDataSource *webDataSource;
@@ -25,7 +26,7 @@
     NP_Port nPort;
     NPP_t instanceStruct;
 
-    BOOL isFlipped, transferred, isHidden, isStarted;
+    BOOL isFlipped, transferred, isHidden, isStarted, fullMode;
             
     NSString *URL, *mime;
     NSURL *baseURL;
diff --git a/WebKit/Plugins.subproj/IFPluginView.mm b/WebKit/Plugins.subproj/IFPluginView.mm
index 2e63749..5477a2a 100644
--- a/WebKit/Plugins.subproj/IFPluginView.mm
+++ b/WebKit/Plugins.subproj/IFPluginView.mm
@@ -36,7 +36,16 @@ extern "C" {
 
 #pragma mark IFPLUGINVIEW
 
-- initWithFrame:(NSRect)r plugin:(WCPlugin *)plug url:(NSString *)location mime:(NSString *)mimeType arguments:(NSDictionary *)args mode:(uint16)mode
+// Could do this as a category on NSString if we wanted.
+static char *
+newCString(NSString *string)
+{
+    char *cString = new char[[string cStringLength] + 1];
+    [string getCString:cString];
+    return cString;
+}
+
+- initWithFrame:(NSRect)r plugin:(WCPlugin *)plug url:(NSString *)location mime:(NSString *)mimeType arguments:(NSDictionary *)arguments mode:(uint16)mode
 {
     NSString *baseURLString;
     
@@ -50,7 +59,6 @@ extern "C" {
     mime = [mimeType retain];
     URL = [location retain];
     plugin = [plug retain];
-    arguments = [args copy];
     
     // load the plug-in if it is not already loaded
     [plugin load];
@@ -70,13 +78,38 @@ extern "C" {
     NPP_SetValue = 	[plugin NPP_SetValue];
     NPP_Print = 	[plugin NPP_Print]; 
 
-
     // get base URL which was added in the args in the part
     baseURLString = [arguments objectForKey:@"WebKitBaseURL"];
     if (baseURLString)
         baseURL = [[NSURL URLWithString:baseURLString] retain];
             
     isHidden = [arguments objectForKey:@"hidden"] != nil;
+    fullMode = [arguments objectForKey:@"wkfullmode"] != nil;
+    
+    argsCount = 0;
+    if (fullMode) {
+        cAttributes = 0;
+        cValues = 0;
+    } else {
+        // Convert arguments dictionary to 2 string arrays.
+        // These arrays are passed to NPP_New, but the strings need to be
+        // modifiable and live the entire life of the plugin.
+        
+        argsCount = [arguments count];
+        
+        cAttributes = new char * [argsCount];
+        cValues = new char * [argsCount];
+        
+        NSEnumerator *e = [arguments keyEnumerator];
+        NSString *key;
+        while ((key = [e nextObject])) {
+            if (![key isEqualToString:@"wkfullmode"]) {
+                cAttributes[argsCount] = newCString(key);
+                cValues[argsCount] = newCString([arguments objectForKey:key]);
+                argsCount++;
+            }
+        }
+    }
     
     // Initialize globals
     transferred = NO;
@@ -96,16 +129,22 @@ extern "C" {
     
     // remove downloaded files
     fileManager = [NSFileManager defaultManager];
-    for(i=0; i<[filesToErase count]; i++){  
+    for (i=0; i<[filesToErase count]; i++){  
         [fileManager removeFileAtPath:[filesToErase objectAtIndex:i] handler:nil]; 
     }
     
+    for (i = 0; i < argsCount; i++) {
+        delete [] cAttributes[i];
+        delete [] cValues[i];
+    }
+    
     [filesToErase release];
     [activeURLHandles release];
     [mime release];
     [URL release];
     [plugin release];
-    [arguments release];
+    delete [] cAttributes;
+    delete [] cValues;
     [super dealloc];
 }
 
@@ -196,30 +235,7 @@ extern "C" {
     
     isStarted = YES;
     
-    if (![arguments objectForKey:@"wkfullmode"]) {
-        // convert arguments dictionary to 2 string arrays
-        
-        int argsCount = [arguments count];
-        
-        char **cAttributes = new char * [argsCount];
-        char **cValues = new char * [argsCount];
-        
-        NSEnumerator *e = [arguments keyEnumerator];
-        NSString *key;
-        int i = 0;
-        while ((key = [e nextObject])) {
-            cAttributes[i] = (char *)[key cString];
-            cValues[i] = (char *)[[arguments objectForKey:key] cString];
-            i++;
-        }
-        
-        npErr = NPP_New((char *)[mime cString], instance, NP_EMBED, argsCount, cAttributes, cValues, &saved);
-        
-        delete [] cAttributes;
-        delete [] cValues;
-    } else {
-        npErr = NPP_New((char *)[mime cString], instance, NP_FULL, 0, NULL, NULL, &saved);
-    }
+    npErr = NPP_New((char *)[mime cString], instance, fullMode ? NP_FULL : NP_EMBED, argsCount, cAttributes, cValues, &saved);
 
     WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_New: %d\n", npErr);
     
diff --git a/WebKit/Plugins.subproj/WebPluginView.h b/WebKit/Plugins.subproj/WebPluginView.h
index 6288f03..5b30735 100644
--- a/WebKit/Plugins.subproj/WebPluginView.h
+++ b/WebKit/Plugins.subproj/WebPluginView.h
@@ -15,7 +15,8 @@
 {
     WCPlugin *plugin;
     IFPluginNullEventSender *eventSender;
-    NSDictionary *arguments;
+    unsigned argsCount;
+    char **cAttributes, **cValues;
     
     id <IFWebController> webController;
     IFWebDataSource *webDataSource;
@@ -25,7 +26,7 @@
     NP_Port nPort;
     NPP_t instanceStruct;
 
-    BOOL isFlipped, transferred, isHidden, isStarted;
+    BOOL isFlipped, transferred, isHidden, isStarted, fullMode;
             
     NSString *URL, *mime;
     NSURL *baseURL;
diff --git a/WebKit/Plugins.subproj/WebPluginView.m b/WebKit/Plugins.subproj/WebPluginView.m
index 2e63749..5477a2a 100644
--- a/WebKit/Plugins.subproj/WebPluginView.m
+++ b/WebKit/Plugins.subproj/WebPluginView.m
@@ -36,7 +36,16 @@ extern "C" {
 
 #pragma mark IFPLUGINVIEW
 
-- initWithFrame:(NSRect)r plugin:(WCPlugin *)plug url:(NSString *)location mime:(NSString *)mimeType arguments:(NSDictionary *)args mode:(uint16)mode
+// Could do this as a category on NSString if we wanted.
+static char *
+newCString(NSString *string)
+{
+    char *cString = new char[[string cStringLength] + 1];
+    [string getCString:cString];
+    return cString;
+}
+
+- initWithFrame:(NSRect)r plugin:(WCPlugin *)plug url:(NSString *)location mime:(NSString *)mimeType arguments:(NSDictionary *)arguments mode:(uint16)mode
 {
     NSString *baseURLString;
     
@@ -50,7 +59,6 @@ extern "C" {
     mime = [mimeType retain];
     URL = [location retain];
     plugin = [plug retain];
-    arguments = [args copy];
     
     // load the plug-in if it is not already loaded
     [plugin load];
@@ -70,13 +78,38 @@ extern "C" {
     NPP_SetValue = 	[plugin NPP_SetValue];
     NPP_Print = 	[plugin NPP_Print]; 
 
-
     // get base URL which was added in the args in the part
     baseURLString = [arguments objectForKey:@"WebKitBaseURL"];
     if (baseURLString)
         baseURL = [[NSURL URLWithString:baseURLString] retain];
             
     isHidden = [arguments objectForKey:@"hidden"] != nil;
+    fullMode = [arguments objectForKey:@"wkfullmode"] != nil;
+    
+    argsCount = 0;
+    if (fullMode) {
+        cAttributes = 0;
+        cValues = 0;
+    } else {
+        // Convert arguments dictionary to 2 string arrays.
+        // These arrays are passed to NPP_New, but the strings need to be
+        // modifiable and live the entire life of the plugin.
+        
+        argsCount = [arguments count];
+        
+        cAttributes = new char * [argsCount];
+        cValues = new char * [argsCount];
+        
+        NSEnumerator *e = [arguments keyEnumerator];
+        NSString *key;
+        while ((key = [e nextObject])) {
+            if (![key isEqualToString:@"wkfullmode"]) {
+                cAttributes[argsCount] = newCString(key);
+                cValues[argsCount] = newCString([arguments objectForKey:key]);
+                argsCount++;
+            }
+        }
+    }
     
     // Initialize globals
     transferred = NO;
@@ -96,16 +129,22 @@ extern "C" {
     
     // remove downloaded files
     fileManager = [NSFileManager defaultManager];
-    for(i=0; i<[filesToErase count]; i++){  
+    for (i=0; i<[filesToErase count]; i++){  
         [fileManager removeFileAtPath:[filesToErase objectAtIndex:i] handler:nil]; 
     }
     
+    for (i = 0; i < argsCount; i++) {
+        delete [] cAttributes[i];
+        delete [] cValues[i];
+    }
+    
     [filesToErase release];
     [activeURLHandles release];
     [mime release];
     [URL release];
     [plugin release];
-    [arguments release];
+    delete [] cAttributes;
+    delete [] cValues;
     [super dealloc];
 }
 
@@ -196,30 +235,7 @@ extern "C" {
     
     isStarted = YES;
     
-    if (![arguments objectForKey:@"wkfullmode"]) {
-        // convert arguments dictionary to 2 string arrays
-        
-        int argsCount = [arguments count];
-        
-        char **cAttributes = new char * [argsCount];
-        char **cValues = new char * [argsCount];
-        
-        NSEnumerator *e = [arguments keyEnumerator];
-        NSString *key;
-        int i = 0;
-        while ((key = [e nextObject])) {
-            cAttributes[i] = (char *)[key cString];
-            cValues[i] = (char *)[[arguments objectForKey:key] cString];
-            i++;
-        }
-        
-        npErr = NPP_New((char *)[mime cString], instance, NP_EMBED, argsCount, cAttributes, cValues, &saved);
-        
-        delete [] cAttributes;
-        delete [] cValues;
-    } else {
-        npErr = NPP_New((char *)[mime cString], instance, NP_FULL, 0, NULL, NULL, &saved);
-    }
+    npErr = NPP_New((char *)[mime cString], instance, fullMode ? NP_FULL : NP_EMBED, argsCount, cAttributes, cValues, &saved);
 
     WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_New: %d\n", npErr);
     

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list