[RFC] Always answer a message with a reference

Thomas Meyer thomas at m3y3r.de
Mon Jan 9 23:16:32 PST 2012


Am Montag, den 09.01.2012, 18:39 -0500 schrieb bugzilla at redhat.com:
> Hi Thomas,

Hi,

> As for the issue about having consume_message return null, that is a separate
> issue IMO whereby the Java side is not notified about the C++ side having
> discarded the message. The idea of consume message returning null is not a bad
> one, but will need some testing to cover the various requests Java makes to
> C++.

I tried this patch to achieve an always answer a message with a
reference, but I think it incomplete. comments are welcome.

diff -r 7d090bfa3819 plugin/icedteanp/IcedTeaNPPlugin.cc
--- a/plugin/icedteanp/IcedTeaNPPlugin.cc	Tue Dec 13 12:45:36 2011 +0100
+++ b/plugin/icedteanp/IcedTeaNPPlugin.cc	Tue Jan 10 08:03:52 2012 +0100
@@ -1202,6 +1202,15 @@
       if (instance_id > 0 && !instance)
         {
           PLUGIN_DEBUG("Instance %d is not active. Refusing to consume message \"%s\"\n", instance_id, message);
+          // if the message has a reference send back a NULL to make java side unwait
+          if(g_str_has_prefix(parts[2], "reference"))
+          {
+             // type + identifier + reference + ref_id + validFinishCallRequest + NULL
+             gchar* null_resp = g_strconcat ("context 0 reference ", parts[3], " JavaScriptGetWindow 0", NULL);
+             plugin_send_message_to_appletviewer(null_resp);
+             g_free(null_resp);
+             null_resp = NULL;
+          }
           return;
         }
       else if (instance)
diff -r 7d090bfa3819 plugin/icedteanp/java/sun/applet/PluginAppletViewer.java
--- a/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java	Tue Dec 13 12:45:36 2011 +0100
+++ b/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java	Tue Jan 10 08:03:52 2012 +0100
@@ -985,7 +985,7 @@
             PluginDebug.debug("wait request 1");
             synchronized (request) {
                 PluginDebug.debug("wait request 2");
-                while ((Long) request.getObject() == 0)
+                while (request.isDone() == false)
                     request.wait();
                 PluginDebug.debug("wait request 3");
             }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: This is a digitally signed message part
Url : http://mail.openjdk.java.net/pipermail/distro-pkg-dev/attachments/20120110/d07116d2/attachment.bin 


More information about the distro-pkg-dev mailing list