incubator-callback-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jesse <purplecabb...@gmail.com>
Subject Re: [DISCUSS] using JSON.parse to parse messages from native
Date Sat, 02 Jun 2012 00:19:50 GMT
If JSON.parse is available then definitely use it!
I don't mind the use of eval, but only when it is required, most times I
see it used in laziness...

Definitely pull!

On Fri, Jun 1, 2012 at 5:09 PM, Anis KADRI <anis.kadri@gmail.com> wrote:

> Not using eval
>
> On Fri, Jun 1, 2012 at 5:07 PM, Filip Maj <fil@adobe.com> wrote:
>
> > Some of our implementations (Android, BlackBerry) use eval() to parse
> > messages coming from native. I have no problem with eval on its own,
> > however, when running cordova.js through certain minifiers it can mess
> > stuff up if we use eval sloppily [1]. Example from [1], this from
> > Android's JS' exec module:
> >
> > // If a result was returned
> > if (r.length > 0) {
> >    var v;
> >    eval("v="+r+";");
> >
> >
> > Gets minified to this (using Google Closure compiler):
> >
> > if(h.length>0){eval("v="+h+";");if((void
> 0).status===g.callbackStatus.OK){
> >
> >
> > (void 0! Sweet!)
> >
> > GitHub user will-quast sent a pull request to the JS [1] and to Android
> > (native tweaks regarding returning proper quoted JSON) [2] to fix this
> > issue.
> >
> > Any issues with pulling this in, and while we're at it, adjusting the
> > other implementations that are doing the same thing?
> >
> > [1] https://github.com/apache/incubator-cordova-js/pull/15
> > [2] https://github.com/apache/incubator-cordova-android/pull/26
> >
> >
>



-- 
@purplecabbage
risingj.com

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message