monami7000 / json-xml-rpc

0 stars 0 forks source link

Wrapper to this.__callMethod uses 'this' rather than bound instance variable #3

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Client 0.8.0.1, line 172:

   if (this.__isAsynchronous){

should be

   if (instance.__isAsynchronous){

or call.instance, following your pattern. (Note that instance and
methodName are local vars in the closure anyway, so the call object isn't
strictly needed.)

Original issue reported on code.google.com by avarag...@gmail.com on 6 Dec 2007 at 11:29

GoogleCodeExporter commented 9 years ago
I made the revision and checked-in the code... please QA for me, and I'll 
release it
once everything checks out.

Was this mistake causing any erroneous behavior?

Original comment by WestonRuter on 6 Dec 2007 at 3:30

GoogleCodeExporter commented 9 years ago
Yes. I was calling a method asynchronously passing params and callbacks as an 
object
with named parameters, like this:

   var cfg = {
     sanitize: false,
     methods: ['simple.hello']
   };

   var service = new rpc.ServiceProxy('/test-rpc.php', cfg);

   var cfgCall = {
     params: ['foo'],
     onSuccess: function(s) {
       alert(s);
     },
     onException: function(objError) {
       alert(objError);
     }
   };

   service.simple.hello(cfgCall);

In the original client code, this.__isAsynchronous was undefined in this 
scenario so
it fell through to the line calling rpc.toArray. That's passed an array with one
element, the object cfgCall (in my example above). As that's not what 
__callMethod is
expecting in this scenario, everything goes wrong from there...

Original comment by avarag...@gmail.com on 6 Dec 2007 at 4:01

GoogleCodeExporter commented 9 years ago
The diff looks good to me.

Original comment by avarag...@gmail.com on 6 Dec 2007 at 4:06

GoogleCodeExporter commented 9 years ago
Just noticed: rpc.version should be updated to 0.8.0.2.

Original comment by avarag...@gmail.com on 6 Dec 2007 at 4:14

GoogleCodeExporter commented 9 years ago
New version 0.8.0.2 has been released with this bug fix.
(I appreciate your help.)

Original comment by WestonRuter on 6 Dec 2007 at 4:27