* 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:
parent
b85b9f206b
commit
ae1aa70fdf
1 changed files with 7 additions and 5 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue