From da007f95061ea45b8f5974da745a89276c793b5e Mon Sep 17 00:00:00 2001 From: hns Date: Mon, 20 Dec 2004 13:14:39 +0000 Subject: [PATCH] Set parent scope rather than prototype for temporary global prototype. This should solve the problems described in bug 390 where global functions were called on the temporary prototype in some cases. --- src/helma/scripting/rhino/RhinoCore.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/helma/scripting/rhino/RhinoCore.java b/src/helma/scripting/rhino/RhinoCore.java index 24e2b7c7..7f5b1659 100644 --- a/src/helma/scripting/rhino/RhinoCore.java +++ b/src/helma/scripting/rhino/RhinoCore.java @@ -886,8 +886,11 @@ public final class RhinoCore { public void prepareCompilation() { if ("global".equals(frameworkProto.getLowerCaseName())) { tmpObjProto = new GlobalObject(RhinoCore.this, app); - tmpObjProto.setPrototype(global); - tmpObjProto.setParentScope(null); + // setting the prototype to global does not seem to be the right + // thing to do. that and not using a GlobalObject instance + // as temporary object proto resulted in bug 390. + tmpObjProto.setPrototype(null); + tmpObjProto.setParentScope(global); } else { tmpObjProto = new HopObject(frameworkProto.getName()); tmpObjProto.setPrototype(objProto);