changeset 277:cdd0bbf399e8

RH586194: Unable to connect to connect with Juniper VPN client Patch from Thomas Meyer <thomas@m3y3r.de> * plugin/icedteanp/IcedTeaPluginRequestProcessor.cc(sendMember): Use createJavaObjectFromVariant to create the resulting object on Java side, rather than always creating a JSObject.
author Deepak Bhole <dbhole@redhat.com>
date Wed, 21 Dec 2011 17:29:45 -0500
parents 88e6e058cdf3
children 9f7d46c3314d
files AUTHORS ChangeLog NEWS plugin/icedteanp/IcedTeaPluginRequestProcessor.cc
diffstat 4 files changed, 15 insertions(+), 46 deletions(-) [+]
line wrap: on
line diff
--- a/AUTHORS	Wed Dec 21 12:33:06 2011 +0100
+++ b/AUTHORS	Wed Dec 21 17:29:45 2011 -0500
@@ -13,6 +13,7 @@
 DJ Lucas <dj@lucasit.com>
 Omair Majid <omajid@redhat.com>
 Jon A. Maxwell <jmaxwell@users.sourceforge.net>
+Thomas Meyer <thomas@m3y3r.de>
 Andrew Su <asu@redhat.com>
 Joshua Sumali <jsumali@redhat.com>
 Mark Wielaard <mark@klomp.org>
--- a/ChangeLog	Wed Dec 21 12:33:06 2011 +0100
+++ b/ChangeLog	Wed Dec 21 17:29:45 2011 -0500
@@ -1,3 +1,10 @@
+2011-12-21  Thomas Meyer <thomas@m3y3r.de>
+
+	RH586194: Unable to connect to connect with Juniper VPN client
+	* plugin/icedteanp/IcedTeaPluginRequestProcessor.cc(sendMember): Use
+	createJavaObjectFromVariant to create the resulting object on Java side,
+	rather than always creating a JSObject.
+
 2011-12-21  Jiri Vanek  <jvanek@redhat.com>
 
 	*Makefile.am:
--- a/NEWS	Wed Dec 21 12:33:06 2011 +0100
+++ b/NEWS	Wed Dec 21 17:29:45 2011 -0500
@@ -9,6 +9,8 @@
 CVE-XXXX-YYYY: http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=XXXX-YYYY
 
 New in release 1.1.5 (2011-XX-XX):
+* Plugin
+  - RH586194: Unable to connect to connect with Juniper VPN client
 
 New in release 1.1.4 (2011-11-08):
 * Security updates:
--- a/plugin/icedteanp/IcedTeaPluginRequestProcessor.cc	Wed Dec 21 12:33:06 2011 +0100
+++ b/plugin/icedteanp/IcedTeaPluginRequestProcessor.cc	Wed Dec 21 17:29:45 2011 -0500
@@ -490,12 +490,12 @@
     JavaRequestProcessor java_request = JavaRequestProcessor();
     JavaResultData* java_result;
     NPVariant* parent_ptr;
+    NPVariant* member_ptr;
 
     //int reference;
     std::string member_id = std::string();
-    std::string jsObjectClassID = std::string();
-    std::string jsObjectConstructorID = std::string();
     std::string response = std::string();
+    std::string result_id = std::string();
 
     NPIdentifier member_identifier;
 
@@ -551,50 +551,9 @@
 
     PLUGIN_DEBUG("Member PTR after internal request: %s\n", thread_data.result.c_str());
 
-    java_result = java_request.findClass(0, "netscape.javascript.JSObject");
-
-    // the result we want is in result_string (assuming there was no error)
-    if (java_result->error_occurred)
-    {
-        printf("Unable to process getMember request. Error occurred: %s\n", java_result->error_msg->c_str());
-        //goto cleanup;
-    }
-
-    jsObjectClassID.append(*(java_result->return_string));
-
-    args = std::vector<std::string>();
-    std::string longArg = "J";
-    args.push_back(longArg);
-
-    java_result = java_request.getMethodID(jsObjectClassID,
-                                           browser_functions.getstringidentifier("<init>"),
-                                           args);
+    member_ptr = (NPVariant*) IcedTeaPluginUtilities::stringToJSID(thread_data.result);
 
-    // the result we want is in result_string (assuming there was no error)
-    if (java_result->error_occurred)
-    {
-        printf("Unable to process getMember request. Error occurred: %s\n", java_result->error_msg->c_str());
-        //goto cleanup;
-    }
-
-    jsObjectConstructorID.append(*(java_result->return_string));
-
-    // We have the method id. Now create a new object.
-
-    args.clear();
-    args.push_back(thread_data.result);
-    java_result = java_request.newObjectWithConstructor("",
-                                         jsObjectClassID,
-                                         jsObjectConstructorID,
-                                         args);
-
-    // the result we want is in result_string (assuming there was no error)
-    if (java_result->error_occurred)
-    {
-        printf("Unable to process getMember request. Error occurred: %s\n", java_result->error_msg->c_str());
-        //goto cleanup;
-    }
-
+    createJavaObjectFromVariant(instance, *member_ptr, &result_id);
 
     IcedTeaPluginUtilities::constructMessagePrefix(0, reference, &response);
     if (*(message_parts->at(2)) == "GetSlot")
@@ -603,7 +562,7 @@
     } else {
         response.append(" JavaScriptGetSlot ");
     }
-    response.append(java_result->return_string->c_str());
+    response.append(result_id.c_str());
     plugin_to_java_bus->post(response.c_str());
 }