* Make sure global reference is always available, even if there is no per-thread scope

(e.g. when compiling scripts)
This commit is contained in:
hns 2006-03-30 10:19:25 +00:00
parent e6824fe0ee
commit edfdfd5a79
2 changed files with 5 additions and 4 deletions

View file

@ -39,10 +39,10 @@ public class DynamicGlobalObject extends GlobalObject {
if (obj != null && obj != NOT_FOUND) {
return obj;
}
}
// make thread scope accessible as "global"
if ("global".equals(s)) {
return scope;
// make thread scope accessible as "global"
if ("global".equals(s)) {
return scope;
}
}
return super.get(s, scriptable);
}

View file

@ -75,6 +75,7 @@ public class GlobalObject extends ImporterTopLevel implements PropertyRecorder {
defineFunctionProperties(globalFuncs, GlobalObject.class, 0);
put("app", this, Context.toObject(new ApplicationBean(app), this));
put("Xml", this, Context.toObject(new XmlObject(core), this));
put("global", this, this);
// Define dontEnum() on Object prototype
String[] objFuncs = { "dontEnum" };
ScriptableObject objproto = (ScriptableObject) getObjectPrototype(this);