diff --git a/src/helma/scripting/rhino/GlobalObject.java b/src/helma/scripting/rhino/GlobalObject.java index baab721a..5d9d638d 100644 --- a/src/helma/scripting/rhino/GlobalObject.java +++ b/src/helma/scripting/rhino/GlobalObject.java @@ -108,7 +108,14 @@ public class GlobalObject extends ImporterTopLevel implements PropertyRecorder { public void put(String name, Scriptable start, Object value) { // register property for PropertyRecorder interface if (isRecording) { - changedProperties.add(name); + // if during compilation a property is set on the thread scope + // forward it to the shared scope (bug 504) + if (isThreadScope) { + core.global.put(name, core.global, value); + return; + } else { + changedProperties.add(name); + } } super.put(name, start, value); } diff --git a/src/helma/scripting/rhino/RhinoEngine.java b/src/helma/scripting/rhino/RhinoEngine.java index 4f2c5171..e9ba5eab 100644 --- a/src/helma/scripting/rhino/RhinoEngine.java +++ b/src/helma/scripting/rhino/RhinoEngine.java @@ -526,7 +526,16 @@ public class RhinoEngine implements ScriptingEngine { * @param resource a code resource */ public void injectCodeResource(String typename, Resource resource) { - core.injectCodeResource(typename, resource); + // we activate recording on thread scope to make it forward + // property puts to the shared scope (bug 504) + if (global != null) + global.startRecording(); + try { + core.injectCodeResource(typename, resource); + } finally { + if (global != null) + global.stopRecording(); + } } /**