I moved the code to create the whitelist file from NP_Initialize to
GCJ_New. The file should be opened for each applet instance created.
This prevents any reading/writing/loading errors that were encountered.

2006-06-13  Lillian Angel  <[EMAIL PROTECTED]>

        * native/plugin/gcjwebplugin.cc
        (NP_Initialize): Removed code to create whitelist file.
        (GCJ_New): Added code to create whitelist file.
        (plugin_user_trusts_documentbase): Fixed error message.

Index: native/plugin/gcjwebplugin.cc
===================================================================
RCS file: /cvsroot/classpath/classpath/native/plugin/gcjwebplugin.cc,v
retrieving revision 1.11
diff -u -r1.11 gcjwebplugin.cc
--- native/plugin/gcjwebplugin.cc	9 Jun 2006 14:53:34 -0000	1.11
+++ native/plugin/gcjwebplugin.cc	13 Jun 2006 21:37:04 -0000
@@ -323,14 +323,34 @@
                     " Browser not Mozilla-based?");
       goto cleanup_appletviewer_mutex;
     }
+    
+  // Open the user's documentbase whitelist.
+  whitelist_file = g_io_channel_new_file (whitelist_filename,
+                                          "a+", &channel_error);
+  if (!whitelist_file)
+    {
+      if (channel_error)
+        {
+          PLUGIN_ERROR_THREE ("Failed to open whitelist file",
+                              whitelist_filename,
+                              channel_error->message);
+          g_error_free (channel_error);
+          channel_error = NULL;
+        }
+      else
+        PLUGIN_ERROR_TWO ("Failed to open whitelist file",
+                          whitelist_filename);
 
+      return NPERR_GENERIC_ERROR;
+    }
+    
   if (!plugin_user_trusts_documentbase (documentbase))
     {
       PLUGIN_ERROR ("User does not trust applet.");
       np_error = NPERR_GENERIC_ERROR;
       goto cleanup_appletviewer_mutex;
     }
-
+    
   // Create appletviewer-to-plugin pipe which we refer to as the input
   // pipe.
 
@@ -959,7 +979,7 @@
               channel_error = NULL;
             }
           else
-            PLUGIN_ERROR ("Failed to open whitelist file.");
+            PLUGIN_ERROR ("Failed to read line from whitelist file.");
           g_free (whitelist_entry);
           whitelist_entry = NULL;
           break;
@@ -1632,26 +1652,6 @@
         }
     }
 
-  // Open the user's documentbase whitelist.
-  whitelist_file = g_io_channel_new_file (whitelist_filename,
-                                          "a+", &channel_error);
-  if (!whitelist_file)
-    {
-      if (channel_error)
-        {
-          PLUGIN_ERROR_THREE ("Failed to open whitelist file",
-                              whitelist_filename,
-                              channel_error->message);
-          g_error_free (channel_error);
-          channel_error = NULL;
-        }
-      else
-        PLUGIN_ERROR_TWO ("Failed to open whitelist file",
-                          whitelist_filename);
-
-      return NPERR_GENERIC_ERROR;
-    }
-
   // Store in a local table the browser functions that we may use.
   browserFunctions.version = browserTable->version;
   browserFunctions.size = browserTable->size;

Reply via email to