r9668 - helma-ng/trunk/src/org/helma/util
[email protected] Thu, 23 Apr 2009 21:54:23 +0200 (CEST)
| Newsgroups | gmane.comp.java.helma.cvs |
|---|---|
| Message-ID | <20090423195423.6E0AB3D0D6@mia> |
Author: hannes
Date: 2009-04-23 21:54:23 +0200 (Thu, 23 Apr 2009)
New Revision: 9668
Modified:
helma-ng/trunk/src/org/helma/util/ScriptUtils.java
Log:
Set prototype and parent in ScriptUtils.javaToJS on ScriptableObjects if necessary
Details at http://dev.helma.org/trac/helma/changeset/9668
Modified: helma-ng/trunk/src/org/helma/util/ScriptUtils.java
===================================================================
--- helma-ng/trunk/src/org/helma/util/ScriptUtils.java 2009-04-23 19:54:21 UTC (rev 9667)
+++ helma-ng/trunk/src/org/helma/util/ScriptUtils.java 2009-04-23 19:54:23 UTC (rev 9668)
@@ -35,6 +35,11 @@
*/
public static Object javaToJS(Object obj, Scriptable scope) {
if (obj instanceof Scriptable) {
+ if (obj instanceof ScriptableObject
+ && ((Scriptable) obj).getParentScope() == null
+ && ((Scriptable) obj).getPrototype() == null) {
+ ScriptRuntime.setObjectProtoAndParent((ScriptableObject) obj, scope);
+ }
return obj;
} else if (obj instanceof List) {
return new ScriptableList(scope, (List) obj);