Q:

How to use callback in sandbox in firefox add-on on android? 

I want to execute sided javascript code in my firefox add-on program on android.  How to call method of main page's script from sided js code? 
Main code:
function execJavaScript(aWindow, itemId, password) {
    var xmlHttpPost = new aWindow. XMLHttpRequest();

    if (xmlHttpPost.overrideMimeType)
        xmlHttpPost.overrideMimeType('text/html');
    xmlHttpPost.open( 'POST', 'http://localhost:'+port+'/home.html?msgfill='+itemId+'msgpasswd='+password, false);

    xmlHttpPost.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    xmlHttpPost.send('msg=hello');

    // execute received javascript
    var javascript = xmlHttpPost.responseText;

    try {
        // try to execute received javascript
        evalInSandbox(aWindow, javascript);
    } catch(e) {
        showToast(aWindow, e.message);
    }
}

function callBackFromLoadedJS(String result) {
    Console.log("Callback result = " + result);
}

I want to send result from sided javascript. 

A:

var javascript = readFileContent();
var sandbox = new Components.utils. Sandbox(window);
sandbox.window = window;

Components.utils.evalInSandbox(javascript, sandbox);

sandbox.theMethodYouNeedToCall();

