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

Reply via email to