/hg/icedtea6: Remove gcjwebplugin.cc (support removed in 1.5)

doko at icedtea.classpath.org doko at icedtea.classpath.org
Wed Oct 21 22:59:33 PDT 2009


changeset ad96ca42aab3 in /hg/icedtea6
details: http://icedtea.classpath.org/hg/icedtea6?cmd=changeset;node=ad96ca42aab3
author: doko at ubuntu.com
date: Thu Oct 22 08:00:17 2009 +0200

	Remove gcjwebplugin.cc (support removed in 1.5)

	2009-10-22 Matthias Klose <doko at ubuntu.com>

	 * gcjwebplugin.cc: Remove.


diffstat:

2 files changed, 4 insertions(+), 1661 deletions(-)
ChangeLog       |    4 
gcjwebplugin.cc | 1661 -------------------------------------------------------

diffs (truncated from 1676 to 500 lines):

diff -r 86a05a0cec75 -r ad96ca42aab3 ChangeLog
--- a/ChangeLog	Wed Oct 21 17:00:21 2009 +0100
+++ b/ChangeLog	Thu Oct 22 08:00:17 2009 +0200
@@ -1,3 +1,7 @@ 2009-10-21  Andrew John Hughes  <ahughes
+2009-10-22  Matthias Klose  <doko at ubuntu.com>
+
+	* gcjwebplugin.cc: Remove.
+
 2009-10-21  Andrew John Hughes  <ahughes at redhat.com>
 
 	Correctly use original build by default.
diff -r 86a05a0cec75 -r ad96ca42aab3 gcjwebplugin.cc
--- a/gcjwebplugin.cc	Wed Oct 21 17:00:21 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1661 +0,0 @@
-/* gcjwebplugin.cc -- web browser plugin to execute Java applets
-   Copyright (C) 2003, 2004, 2006, 2007  Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING.  If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library.  Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module.  An independent module is a module which is not derived from
-or based on this library.  If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so.  If you do not wish to do so, delete this
-exception statement from your version. */
-
-// System includes.
-#include <dlfcn.h>
-#include <errno.h>
-#include <libgen.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-// Netscape plugin API includes.
-#include <npapi.h>
-#include <npupp.h>
-
-// GLib includes.
-#include <glib.h>
-#include <glib/gstdio.h>
-
-// GTK includes.
-#include <gtk/gtk.h>
-
-// Documentbase retrieval includes.
-#include <nsIPluginInstance.h>
-#include <nsIPluginInstancePeer.h>
-#include <nsIPluginTagInfo2.h>
-
-// Debugging macros.
-#define PLUGIN_DEBUG(message)                                           \
-  g_print ("GCJ PLUGIN: thread %p: %s\n", g_thread_self (), message)
-
-#define PLUGIN_DEBUG_TWO(first, second)                                 \
-  g_print ("GCJ PLUGIN: thread %p: %s %s\n", g_thread_self (),          \
-           first, second)
-
-// Error reporting macros.
-#define PLUGIN_ERROR(message)                                       \
-  g_printerr ("%s:%d: thread %p: Error: %s\n", __FILE__, __LINE__,  \
-              g_thread_self (), message)
-
-#define PLUGIN_ERROR_TWO(first, second)                                 \
-  g_printerr ("%s:%d: thread %p: Error: %s: %s\n", __FILE__, __LINE__,  \
-              g_thread_self (), first, second)
-
-#define PLUGIN_ERROR_THREE(first, second, third)                        \
-  g_printerr ("%s:%d: thread %p: Error: %s: %s: %s\n", __FILE__,        \
-              __LINE__, g_thread_self (), first, second, third)
-
-// Plugin information passed to about:plugins.
-#define PLUGIN_NAME "GCJ Web Browser Plugin (using IcedTea)"
-#define PLUGIN_DESC "The " PLUGIN_NAME PLUGIN_VERSION " executes Java applets."
-#define PLUGIN_MIME_DESC                                               \
-  "application/x-java-vm:class,jar:IcedTea;"                           \
-  "application/x-java-applet:class,jar:IcedTea;"                       \
-  "application/x-java-applet;version=1.1:class,jar:IcedTea;"           \
-  "application/x-java-applet;version=1.1.1:class,jar:IcedTea;"         \
-  "application/x-java-applet;version=1.1.2:class,jar:IcedTea;"         \
-  "application/x-java-applet;version=1.1.3:class,jar:IcedTea;"         \
-  "application/x-java-applet;version=1.2:class,jar:IcedTea;"           \
-  "application/x-java-applet;version=1.2.1:class,jar:IcedTea;"         \
-  "application/x-java-applet;version=1.2.2:class,jar:IcedTea;"         \
-  "application/x-java-applet;version=1.3:class,jar:IcedTea;"           \
-  "application/x-java-applet;version=1.3.1:class,jar:IcedTea;"         \
-  "application/x-java-applet;version=1.4:class,jar:IcedTea;"           \
-  "application/x-java-applet;version=1.4.1:class,jar:IcedTea;"         \
-  "application/x-java-applet;version=1.4.2:class,jar:IcedTea;"         \
-  "application/x-java-applet;version=1.5:class,jar:IcedTea;"           \
-  "application/x-java-applet;version=1.6:class,jar:IcedTea;"           \
-  "application/x-java-applet;jpi-version=1.6.0_00:class,jar:IcedTea;"  \
-  "application/x-java-bean:class,jar:IcedTea;"                         \
-  "application/x-java-bean;version=1.1:class,jar:IcedTea;"             \
-  "application/x-java-bean;version=1.1.1:class,jar:IcedTea;"           \
-  "application/x-java-bean;version=1.1.2:class,jar:IcedTea;"           \
-  "application/x-java-bean;version=1.1.3:class,jar:IcedTea;"           \
-  "application/x-java-bean;version=1.2:class,jar:IcedTea;"             \
-  "application/x-java-bean;version=1.2.1:class,jar:IcedTea;"           \
-  "application/x-java-bean;version=1.2.2:class,jar:IcedTea;"           \
-  "application/x-java-bean;version=1.3:class,jar:IcedTea;"             \
-  "application/x-java-bean;version=1.3.1:class,jar:IcedTea;"           \
-  "application/x-java-bean;version=1.4:class,jar:IcedTea;"             \
-  "application/x-java-bean;version=1.4.1:class,jar:IcedTea;"           \
-  "application/x-java-bean;version=1.4.2:class,jar:IcedTea;"           \
-  "application/x-java-bean;version=1.5:class,jar:IcedTea;"             \
-  "application/x-java-bean;version=1.6:class,jar:IcedTea;"             \
-  "application/x-java-bean;jpi-version=1.6.0_00:class,jar:IcedTea;"
-#define PLUGIN_URL NS_INLINE_PLUGIN_CONTRACTID_PREFIX NS_JVM_MIME_TYPE
-#define PLUGIN_MIME_TYPE "application/x-java-vm"
-#define PLUGIN_FILE_EXTS "class,jar,zip"
-#define PLUGIN_MIME_COUNT 1
-
-#define FAILURE_MESSAGE "gcjwebplugin error: Failed to run %s." \
-  "  For more detail rerun \"firefox -g\" in a terminal window."
-
-// Documentbase retrieval required definition.
-static NS_DEFINE_IID (kIPluginTagInfo2IID, NS_IPLUGINTAGINFO2_IID);
-
-// Browser function table.
-static NPNetscapeFuncs browserFunctions;
-
-// Data directory for plugin.
-static gchar* data_directory = NULL;
-
-// Fully-qualified appletviewer executable.
-static gchar* appletviewer_executable = NULL;
-
-// Keeps track of initialization. NP_Initialize should only be
-// called once.
-gboolean initialized = false;
-
-// GCJPluginData stores all the data associated with a single plugin
-// instance.  A separate plugin instance is created for each <APPLET>
-// tag.  For now, each plugin instance spawns its own applet viewer
-// process but this may need to change if we find pages containing
-// multiple applets that expect to be running in the same VM.
-struct GCJPluginData
-{
-  // A unique identifier for this plugin window.
-  gchar* instance_string;
-  // Applet viewer input pipe name.
-  gchar* in_pipe_name;
-  // Applet viewer input channel.
-  GIOChannel* in_from_appletviewer;
-  // Applet viewer input watch source.
-  gint in_watch_source;
-  // Applet viewer output pipe name.
-  gchar* out_pipe_name;
-  // Applet viewer output channel.
-  GIOChannel* out_to_appletviewer;
-  // Applet viewer output watch source.
-  gint out_watch_source;
-  // Mutex to protect appletviewer_alive.
-  GMutex* appletviewer_mutex;
-  // Back-pointer to the plugin instance to which this data belongs.
-  // This should not be freed but instead simply set to NULL.
-  NPP owner;
-  // FALSE if the applet viewer process has died.  All code
-  // communicating with the applet viewer should check this flag
-  // before attempting to read from/write to the applet viewer pipes.
-  gboolean appletviewer_alive;
-  // The address of the plugin window.  This should not be freed but
-  // instead simply set to NULL.
-  gpointer window_handle;
-  // The last plugin window width sent to us by the browser.
-  guint32 window_width;
-  // The last plugin window height sent to us by the browser.
-  guint32 window_height;
-};
-
-// Documentbase retrieval type-punning union.
-typedef union
-{
-  void** void_field;
-  nsIPluginTagInfo2** info_field;
-} info_union;
-
-// Static instance helper functions.
-// Have the browser allocate a new GCJPluginData structure.
-static void plugin_data_new (GCJPluginData** data);
-// Retrieve the current document's documentbase.
-static gchar* plugin_get_documentbase (NPP instance);
-// Notify the user that the appletviewer is not installed correctly.
-static void plugin_display_failure_dialog ();
-// Callback used to monitor input pipe status.
-static gboolean plugin_in_pipe_callback (GIOChannel* source,
-                                         GIOCondition condition,
-                                         gpointer plugin_data);
-// Callback used to monitor output pipe status.
-static gboolean plugin_out_pipe_callback (GIOChannel* source,
-                                          GIOCondition condition,
-                                          gpointer plugin_data);
-static NPError plugin_start_appletviewer (GCJPluginData* data);
-static gchar* plugin_create_applet_tag (int16 argc, char* argn[],
-                                        char* argv[]);
-static void plugin_send_message_to_appletviewer (GCJPluginData* data,
-                                                 gchar const* message);
-static void plugin_stop_appletviewer (GCJPluginData* data);
-// Uninitialize GCJPluginData structure and delete pipes.
-static void plugin_data_destroy (GCJPluginData** data);
-
-// Global instance counter.
-// Mutex to protect plugin_instance_counter.
-static GMutex* plugin_instance_mutex = NULL;
-// A counter used to create uniquely named pipes.
-static gulong plugin_instance_counter = 0;
-// A global variable for reporting GLib errors.  This must be free'd
-// and set to NULL after each use.
-static GError* channel_error = NULL;
-
-// Functions prefixed by GCJ_ are instance functions.  They are called
-// by the browser and operate on instances of GCJPluginData.
-// Functions prefixed by plugin_ are static helper functions.
-// Functions prefixed by NP_ are factory functions.  They are called
-// by the browser and provide functionality needed to create plugin
-// instances.
-
-// INSTANCE FUNCTIONS
-
-// Creates a new gcjwebplugin instance.  This function creates a
-// GCJPluginData* and stores it in instance->pdata.  The following
-// GCJPluginData fiels are initialized: instance_string, in_pipe_name,
-// in_from_appletviewer, in_watch_source, out_pipe_name,
-// out_to_appletviewer, out_watch_source, appletviewer_mutex, owner,
-// appletviewer_alive.  In addition two pipe files are created.  All
-// of those fields must be properly destroyed, and the pipes deleted,
-// by GCJ_Destroy.  If an error occurs during initialization then this
-// function will free anything that's been allocated so far, set
-// instance->pdata to NULL and return an error code.
-NPError
-GCJ_New (NPMIMEType pluginType, NPP instance, uint16 mode,
-         int16 argc, char* argn[], char* argv[],
-         NPSavedData* saved)
-{
-  PLUGIN_DEBUG ("GCJ_New");
-
-  NPError np_error = NPERR_NO_ERROR;
-  GCJPluginData* data = NULL;
-
-  gchar* documentbase = NULL;
-  gchar* read_message = NULL;
-  gchar* applet_tag = NULL;
-  gchar* tag_message = NULL;
-
-  if (!instance)
-    {
-      PLUGIN_ERROR ("Browser-provided instance pointer is NULL.");
-      np_error = NPERR_INVALID_INSTANCE_ERROR;
-      goto cleanup_done;
-    }
-
-  // data
-  plugin_data_new (&data);
-  if (data == NULL)
-    {
-      PLUGIN_ERROR ("Failed to allocate plugin data.");
-      np_error = NPERR_OUT_OF_MEMORY_ERROR;
-      goto cleanup_done;
-    }
-
-  // Initialize data->instance_string.
-  //
-  // instance_string should be unique for this process so we use a
-  // combination of getpid and plugin_instance_counter.
-  //
-  // Critical region.  Reference and increment plugin_instance_counter
-  // global.
-  g_mutex_lock (plugin_instance_mutex);
-
-  // data->instance_string
-  data->instance_string = g_strdup_printf ("instance-%d-%ld",
-                                           getpid (),
-                                           plugin_instance_counter++);
-
-  g_mutex_unlock (plugin_instance_mutex);
-
-  // data->appletviewer_mutex
-  data->appletviewer_mutex = g_mutex_new ();
-
-  // Documentbase retrieval.
-  documentbase = plugin_get_documentbase (instance);
-  if (!documentbase)
-    {
-      PLUGIN_ERROR ("Documentbase retrieval failed."
-                    " Browser not Mozilla-based?");
-      goto cleanup_appletviewer_mutex;
-    }
-
-  // Create appletviewer-to-plugin pipe which we refer to as the input
-  // pipe.
-
-  // data->in_pipe_name
-  data->in_pipe_name = g_strdup_printf ("%s/gcj-%s-appletviewer-to-plugin", 
-                                         data_directory, data->instance_string);
-  if (!data->in_pipe_name)
-    {
-      PLUGIN_ERROR ("Failed to create input pipe name.");
-      np_error = NPERR_OUT_OF_MEMORY_ERROR;
-      // If data->in_pipe_name is NULL then the g_free at
-      // cleanup_in_pipe_name will simply return.
-      goto cleanup_in_pipe_name;
-    }
-
-  PLUGIN_DEBUG_TWO ("GCJ_New: creating input fifo:", data->in_pipe_name);
-  if (mkfifo (data->in_pipe_name, 0700) == -1 && errno != EEXIST)
-    {
-      PLUGIN_ERROR_TWO ("Failed to create input pipe", strerror (errno));
-      np_error = NPERR_GENERIC_ERROR;
-      goto cleanup_in_pipe_name;
-    }
-  PLUGIN_DEBUG_TWO ("GCJ_New: created input fifo:", data->in_pipe_name);
-
-  // Create plugin-to-appletviewer pipe which we refer to as the
-  // output pipe.
-
-  // data->out_pipe_name
-  data->out_pipe_name = g_strdup_printf ("%s/gcj-%s-plugin-to-appletviewer", 
-                                         data_directory, data->instance_string);
-
-  if (!data->out_pipe_name)
-    {
-      PLUGIN_ERROR ("Failed to create output pipe name.");
-      np_error = NPERR_OUT_OF_MEMORY_ERROR;
-      goto cleanup_out_pipe_name;
-    }
-
-  PLUGIN_DEBUG_TWO ("GCJ_New: creating output fifo:", data->out_pipe_name);
-  if (mkfifo (data->out_pipe_name, 0700) == -1 && errno != EEXIST)
-    {
-      PLUGIN_ERROR_TWO ("Failed to create output pipe", strerror (errno));
-      np_error = NPERR_GENERIC_ERROR;
-      goto cleanup_out_pipe_name;
-    }
-  PLUGIN_DEBUG_TWO ("GCJ_New: created output fifo:", data->out_pipe_name);
-
-  // Start a separate appletviewer process for each applet, even if
-  // there are multiple applets in the same page.  We may need to
-  // change this behaviour if we find pages with multiple applets that
-  // rely on being run in the same VM.
-
-  // Critical region.  Hold appletviewer_mutex while we start the
-  // appletviewer, create the IO channels and install the channel
-  // watch callbacks.
-  g_mutex_lock (data->appletviewer_mutex);
-  
-  np_error = plugin_start_appletviewer (data);
-
-  // Create plugin-to-appletviewer channel.  The default encoding for
-  // the file is UTF-8.
-  // data->out_to_appletviewer
-  data->out_to_appletviewer = g_io_channel_new_file (data->out_pipe_name,
-                                                     "w", &channel_error);
-  if (!data->out_to_appletviewer)
-    {
-      if (channel_error)
-        {
-          PLUGIN_ERROR_TWO ("Failed to create output channel",
-                            channel_error->message);
-          g_error_free (channel_error);
-          channel_error = NULL;
-        }
-      else
-        PLUGIN_ERROR ("Failed to create output channel");
-        
-      np_error = NPERR_GENERIC_ERROR;
-      goto cleanup_out_to_appletviewer;
-    }
-
-  // Watch for hangup and error signals on the output pipe.
-  data->out_watch_source =
-    g_io_add_watch (data->out_to_appletviewer,
-                    (GIOCondition) (G_IO_ERR | G_IO_HUP),
-                    plugin_out_pipe_callback, (gpointer) data);
-
-  // Create appletviewer-to-plugin channel.  The default encoding for
-  // the file is UTF-8.
-  // data->in_from_appletviewer
-  data->in_from_appletviewer = g_io_channel_new_file (data->in_pipe_name,
-                                                      "r", &channel_error);
-  if (!data->in_from_appletviewer)
-    {
-      if (channel_error)
-        {
-          PLUGIN_ERROR_TWO ("Failed to create input channel",
-                            channel_error->message);
-          g_error_free (channel_error);
-          channel_error = NULL;
-        }
-      else
-        PLUGIN_ERROR ("Failed to create input channel");
-        
-      np_error = NPERR_GENERIC_ERROR;
-      goto cleanup_in_from_appletviewer;
-    }
-
-  // Watch for hangup and error signals on the input pipe.
-  data->in_watch_source =
-    g_io_add_watch (data->in_from_appletviewer,
-                    (GIOCondition) (G_IO_IN | G_IO_ERR | G_IO_HUP),
-                    plugin_in_pipe_callback, (gpointer) data);
-
-  // Wait until we receive confirmation that the appletviewer has
-  // started.
-  if (g_io_channel_read_line (data->in_from_appletviewer,
-                              &read_message, NULL, NULL,
-                              &channel_error)
-      != G_IO_STATUS_NORMAL)
-    {
-      if (channel_error)
-        {
-          PLUGIN_ERROR_TWO ("Receiving confirmation from appletviewer failed",
-                            channel_error->message);
-          g_error_free (channel_error);
-          channel_error = NULL;
-        }
-      else
-        PLUGIN_ERROR ("Receiving confirmation from appletviewer failed");
-          
-      np_error = NPERR_GENERIC_ERROR;
-      goto cleanup_in_watch_source;
-    }
-
-  PLUGIN_DEBUG ("GCJ_New: got confirmation that appletviewer is running.");
-  data->appletviewer_alive = TRUE;
-
-  // Send applet tag message to appletviewer.
-  applet_tag = plugin_create_applet_tag (argc, argn, argv);
-  tag_message = g_strconcat ("tag ", documentbase, " ", applet_tag, NULL);
-
-  plugin_send_message_to_appletviewer (data, data->instance_string);
-  plugin_send_message_to_appletviewer (data, tag_message);
-
-  g_mutex_unlock (data->appletviewer_mutex);
-
-  // If initialization succeeded entirely then we store the plugin
-  // data in the instance structure and return.  Otherwise we free the
-  // data we've allocated so far and set instance->pdata to NULL.
-
-  // Set back-pointer to owner instance.
-  data->owner = instance;
-  instance->pdata = data;
-  goto cleanup_done;
-
-  // An error occurred while initializing the plugin data or spawning
-  // the appletviewer so we free the data we've already allocated.
-
- cleanup_in_watch_source:
-  // Removing a source is harmless if it fails since it just means the
-  // source has already been removed.
-  g_source_remove (data->in_watch_source);
-  data->in_watch_source = 0;
-
- cleanup_in_from_appletviewer:
-  if (data->in_from_appletviewer)
-    g_io_channel_unref (data->in_from_appletviewer);
-  data->in_from_appletviewer = NULL;
-
-  // cleanup_out_watch_source:
-  g_source_remove (data->out_watch_source);
-  data->out_watch_source = 0;
-
- cleanup_out_to_appletviewer:
-  if (data->out_to_appletviewer)
-    g_io_channel_unref (data->out_to_appletviewer);
-  data->out_to_appletviewer = NULL;
-
-  // cleanup_out_pipe:
-  // Delete output pipe.
-  PLUGIN_DEBUG_TWO ("GCJ_New: deleting input fifo:", data->in_pipe_name);
-  unlink (data->out_pipe_name);
-  PLUGIN_DEBUG_TWO ("GCJ_New: deleted input fifo:", data->in_pipe_name);



More information about the distro-pkg-dev mailing list