changeset 108:1a2f329bdd26

Send initialization information to Java side via a new function (also takes care of webkit/chromium breakage with a 0x0 sized plugin)
author Deepak Bhole <dbhole@redhat.com>
date Thu, 03 Mar 2011 17:56:00 -0500
parents fb436cda450e
children 04a9055a491d
files ChangeLog plugin/icedteanp/IcedTeaNPPlugin.cc
diffstat 2 files changed, 35 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Mar 03 17:09:54 2011 -0500
+++ b/ChangeLog	Thu Mar 03 17:56:00 2011 -0500
@@ -1,3 +1,12 @@
+2011-03-03  Deepak Bhole <dbhole@redhat.com>
+
+	* plugin/icedteanp/IcedTeaNPPlugin.cc
+	(plugin_send_initialization_message): New method. Sends initialization
+	information to the Java side.
+	(ITNP_SetWindow): Call the new plugin_send_initialization_message
+	function.
+	(get_scriptable_object): Same.
+
 2011-03-03  Deepak Bhole <dbhole@redhat.com>
 
 	* plugin/icedteanp/IcedTeaPluginRequestProcessor.cc
--- a/plugin/icedteanp/IcedTeaNPPlugin.cc	Thu Mar 03 17:09:54 2011 -0500
+++ b/plugin/icedteanp/IcedTeaNPPlugin.cc	Thu Mar 03 17:56:00 2011 -0500
@@ -220,6 +220,9 @@
 void consume_message(gchar* message);
 void start_jvm_if_needed();
 static void appletviewer_monitor(GPid pid, gint status, gpointer data);
+void plugin_send_initialization_message(char* instance, gulong handle,
+                                               int width, int height,
+                                               char* url);
 
 // Global instance counter.
 // Mutex to protect plugin_instance_counter.
@@ -768,18 +771,9 @@
       data->window_height = window->height;
 
       // Now we have everything. Send this data to the Java side
-
-      gchar* instance_msg =  g_strdup_printf ("instance %s handle %ld width %d height %d %s",
-											 data->instance_id,
-											 (gulong) data->window_handle,
-											 data->window_width,
-											 data->window_height,
-											 data->applet_tag);
-
-      plugin_send_message_to_appletviewer (instance_msg);
-
-      g_free(instance_msg);
-      instance_msg = NULL;
+      plugin_send_initialization_message(
+    		  data->instance_id, (gulong) data->window_handle,
+    		  data->window_width, data->window_height, data->applet_tag);
 
       g_mutex_unlock (data->appletviewer_mutex);
 
@@ -1828,6 +1822,25 @@
   PLUGIN_DEBUG ("plugin_send_message_to_appletviewer return\n");
 }
 
+/*
+ * Sends the initialization message (handle/size/url) to the plugin
+ */
+void
+plugin_send_initialization_message(char* instance, gulong handle,
+                                   int width, int height, char* url)
+{
+  PLUGIN_DEBUG ("plugin_send_initialization_message\n");
+
+  gchar *window_message = g_strdup_printf ("instance %s handle %ld width %d height %d %s",
+                                            instance, handle, width, height, url);
+  plugin_send_message_to_appletviewer (window_message);
+  g_free (window_message);
+  window_message = NULL;
+
+  PLUGIN_DEBUG ("plugin_send_initialization_message return\n");
+}
+
+
 // Stop the appletviewer process.  When this is called the
 // appletviewer can be in any of three states: running, crashed or
 // hung.  If the appletviewer is running then sending it "shutdown"
@@ -2436,11 +2449,7 @@
         // a 0 handle
         if (!data->window_handle)
         {
-            data->window_handle = 0;
-            gchar *window_message = g_strdup_printf ("instance %s handle %d",
-                                                    id_str, 0);
-            plugin_send_message_to_appletviewer (window_message);
-            g_free (window_message);
+            plugin_send_initialization_message(data->instance_id, 0, 0, 0, data->applet_tag);
         }
 
         java_result = java_request.getAppletObjectInstance(id_str);