From 512cea20ac177c1c06b368720b0cfd30a23396e0 Mon Sep 17 00:00:00 2001 From: hns Date: Mon, 15 Sep 2003 14:41:08 +0000 Subject: [PATCH] Call hasFunction() on the prototype rather than on HopObjects themselves to avoid fetching references or child objects from database. --- src/helma/scripting/rhino/RhinoEngine.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/helma/scripting/rhino/RhinoEngine.java b/src/helma/scripting/rhino/RhinoEngine.java index 109cd1ec..fcf3c885 100644 --- a/src/helma/scripting/rhino/RhinoEngine.java +++ b/src/helma/scripting/rhino/RhinoEngine.java @@ -337,7 +337,13 @@ public class RhinoEngine implements ScriptingEngine { * is a java object) with that name. */ public boolean hasFunction(Object obj, String fname) { - // System.err.println ("HAS_FUNC: "+obj+"."+fname); + // Treat HopObjects separately - otherwise we risk to fetch database + // references/child objects just to check for function properties. + if (obj instanceof INode) { + String protoname = ((INode) obj).getPrototype(); + return core.hasFunction(protoname, fname.replace('.', '_')); + } + Scriptable op = obj == null ? global : Context.toObject(obj, global); Object func = ScriptableObject.getProperty(op, fname.replace('.', '_'));