incubator-callback-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Git at Apache <...@git.apache.org>
Subject incubator-cordova-android pull request: Fix to help JS compressors not vari...
Date Wed, 30 May 2012 00:15:18 GMT
GitHub user will-quast opened a pull request:

    https://github.com/apache/incubator-cordova-android/pull/26

    Fix to help JS compressors not variable rename vars used in cordova.exec's eval.

    A change to lib/android/exec.js has broken Google Closure Compiler's compressed version.
    
        // If a result was returned
        if (r.length > 0) {
            var v;
            eval("v="+r+";");
    
            // If status is OK, then return value back to caller
            if (v.status === cordova.callbackStatus.OK) {
        
    is compressed to 
    
        if(h.length>0){eval("v="+h+";");if((void 0).status===g.callbackStatus.OK){
    
    which does not work.
    
    I would suggest using JSON.parse instead, but this requires a small change to PluginResult.java
to return valid JSON.
    
    I have made a pull request in both incubator-cordova-js and incubator-cordova-android.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/will-quast/incubator-cordova-android master

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-cordova-android/pull/26.patch

----
commit ed94d0dd30831810eeb8c28523d08934c521ae00
Author: William Quast <will@bohemian.cc>
Date:   2012-05-29T16:59:31-07:00

    Make PluginResult return valid JSON so the JS side can use JSON.parse

----


Mime
View raw message