[RFC] Always answer a message with a reference

Deepak Bhole dbhole at redhat.com
Thu Jan 26 13:14:14 PST 2012


* Thomas Meyer <thomas at m3y3r.de> [2012-01-10 02:16]:
> 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.
> 

Hi Thomas,

This patch is always returning JavaScriptGetWindow back to the Java
side. I am not sure if this currently causes issues or not, but even if
it doesn't, it may down the road if someone changes the Java side
without realizing that C++ is going to return "JavaScriptGetWindow" if
it discards the message.

I think it would therefore be better to return a new tag, something like
"PluginMessageDiscarded"

Cheers,
Deepak

> 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");
>              }
> 
> 





More information about the distro-pkg-dev mailing list