* Add RhinoCore.isInitialized() to check whether we are up and running yet.

* Initialize prototypes on static constructor access also when prototype property
  is accessed, using RhinoCore.isInitialized() to check against premature compilation.
This commit is contained in:
hns 2007-02-21 13:00:07 +00:00
parent cecd2af590
commit f4b281a639
2 changed files with 7 additions and 1 deletions

View file

@ -109,7 +109,7 @@ public class HopObjectCtor extends FunctionObject {
}
public Object get(String name, Scriptable start) {
if (!initialized && !"prototype".equals(name)) {
if (!initialized && core.isInitialized()) {
// trigger prototype compilation on static
// constructor property access
initialized = true;

View file

@ -78,6 +78,7 @@ public final class RhinoCore implements ScopeProvider {
// debugger/tracer flags
boolean hasDebugger = false;
boolean hasTracer = false;
private boolean isInitialized = false;
// dynamic portion of the type check sleep that grows
// as the app remains unchanged
@ -170,9 +171,14 @@ public final class RhinoCore implements ScopeProvider {
throw new RuntimeException(e.getMessage(), e);
} finally {
contextFactory.exit();
isInitialized = true;
}
}
boolean isInitialized() {
return isInitialized;
}
void initDebugger(Context context) {
try {
if (debugger == null) {