* Forward put()s from the thread scope to the shared scope during

repository injection. Fixes bug 504.
This commit is contained in:
hns 2007-03-27 19:51:43 +00:00
parent c04d2db80f
commit 11022c42b6
2 changed files with 18 additions and 2 deletions

View file

@ -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);
}

View file

@ -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();
}
}
/**