* If a script function returns an instance of org.mozilla.javascript.Wrapper

always unwrap it before processing/returning.
* If a script function returns null or undefined, return null even when
  invoke() was called in XML-RPC mode.
This commit is contained in:
hns 2003-12-09 16:34:05 +00:00
parent b85b9f206b
commit ae1aa70fdf

View file

@ -262,12 +262,14 @@ public class RhinoEngine implements ScriptingEngine {
Object retval = ((Function) f).call(context, global, eso, args);
if (xmlrpc) {
return core.processXmlRpcResponse (retval);
} else if ((retval == null) || (retval == Undefined.instance)) {
if (retval instanceof Wrapper) {
retval = ((Wrapper) retval).unwrap();
}
if ((retval == null) || (retval == Undefined.instance)) {
return null;
} else if (retval instanceof Wrapper) {
return ((Wrapper) retval).unwrap();
} else if (xmlrpc) {
return core.processXmlRpcResponse (retval);
} else {
return retval;
}