incubator-callback-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Filip Maj <>
Subject [DISCUSS] using JSON.parse to parse messages from native
Date Sat, 02 Jun 2012 00:07:09 GMT
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;

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

Any issues with pulling this in, and while we're at it, adjusting the
other implementations that are doing the same thing?


View raw message