Problem
With the 1.8.0.1 changes and KrollFunction being introduced, return values were overlooked.
Why it was Overlooked
Nothing in core or our private modules utilizes this portion of the API. But our demo module in the public repository makes use of it, and there may be third party developers that are using it.
How to Test
Create a new module:
{quote}
titanium create --type=module --name=testcb --id=ti.testcb --platform=android
{quote}
Update the TestcbModule.java:
package ti.testcb;
import java.util.HashMap;
import org.appcelerator.kroll.KrollModule;
import org.appcelerator.kroll.KrollFunction;
import org.appcelerator.kroll.annotations.Kroll;
@Kroll.module(name="Testcb", id="ti.testcb")
public class TestcbModule extends KrollModule
{
public TestcbModule()
{
super();
}
@Kroll.method
public String initiateCrank(KrollFunction crank) {
return crank.call(getKrollObject(), new HashMap()).toString();
}
}
Update the example/app.js:
var win = Ti.UI.createWindow({
backgroundColor: '#fff'
});
win.add(Ti.UI.createLabel({
text: require('ti.testcb').initiateCrank(function() {
return 'PASS: Is your refrigerator running? Tee hee.';
}) || 'FAIL: Critical failure of joke Kroll traversal!'
}));
win.open();
Pull Request
Master:
https://github.com/appcelerator/titanium_mobile/pull/1072
1_8_X:
https://github.com/appcelerator/titanium_mobile/pull/1073
Closing bug. Verified fix on: SDK build: 1.9.0.v20120112104633 Runtime: V8, Rhino Titanium Studio, build: 1.0.8.201201111843 Device: Droid 3 (2.3.4)