On Tue, Jun 30, 2009 at 11:10, atzoum<atz...@gmail.com> wrote:
>
> It is well known that JQuery's official JSONP implementation doesn't
> support error handling in jsonp requests.
I just checked that this is true for Dojo as well.
> However, there is an alternative solution of jquery-jsonp at
> http://code.google.com/p/jquery-jsonp/ which supports error recovery.
> Jquery-jsonp plugin is using iframes to do the jsonp request and that
> causes problems with javascript Arrays passed from the jsonp-iframe to
> the parent.
>
> I believe that it would be better to use this plugin in the jquery
> cometd implementation in order to support client reconnection with
> callback-polling transport. However, as mentioned above, it requires
> some modifications in cometd-javascript common code in order to handle
> Array objects.
>
> Could I contribute somehow?
Can you expand a bit on why there is this Array problem ? And how the
common code would be changed to support that ?
I took a look at the jquery-jsonp plugin, and seems to me generic
enough to try a generalization that will work for dojo as well.
Thanks,
Simon
--
http://bordet.blogspot.com
---
Finally, no matter how good the architecture and design are,
to deliver bug-free software with optimal performance and reliability,
the implementation technique must be flawless. Victoria Livschitz
On Wed, Jul 1, 2009 at 13:17, atzoum<atz...@gmail.com> wrote:
>
> Got it all working fine!
>
> I' m posting the diff for the jquery-jsonp patch.
> As you' ll notice, I changed the _mixin() function of cometd.js
> because of a bug that caused null values to be copied as empty
> objects. As a result, the stringified json object instead of...
> "value": null
> ...was...
> "value": {}
>
> The above should be fixed in an upcoming cometd release
It's fixed in trunk, thanks.
As for the rest, there are things that we can do, others that we
cannot because we're not the owner of the source.
> @@ -617,7 +617,10 @@
> */
> function _convertToMessages(response)
> {
> - if (response === undefined) return [];
> +
> + response = org.cometd.JSON.fromJSON(org.cometd.JSON.toJSON
> (response));
> + if (response === undefined) return [];
> + /* atzoum patch */
> if (response instanceof Array) return response;
> if (response instanceof String || typeof response ==
> 'string') return org.cometd.JSON.fromJSON(response);
> if (response instanceof Object) return [response];
I am not sure about this fix. The idea is that *before* assuming
that's a string and converting it to object from json, I do the other
checks first.
About this one I am not fully sure: does it work without the patches below ?
I ask because I cannot change the jquery json plugin.
However, glad to made it working.
Does it work in IE8 as well ?
Thanks,
Simon
--
http://bordet.blogspot.com
---
Finally, no matter how good the architecture and design are,
to deliver bug-free software with optimal performance and reliability,
the implementation technique must be flawless. Victoria Livschitz
> Index: jquery.json-1.3.js