* 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:
		
							parent
							
								
									cecd2af590
								
							
						
					
					
						commit
						f4b281a639
					
				
					 2 changed files with 7 additions and 1 deletions
				
			
		| 
						 | 
					@ -109,7 +109,7 @@ public class HopObjectCtor extends FunctionObject {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public Object get(String name, Scriptable start) {
 | 
					    public Object get(String name, Scriptable start) {
 | 
				
			||||||
        if (!initialized  && !"prototype".equals(name)) {
 | 
					        if (!initialized && core.isInitialized()) {
 | 
				
			||||||
            // trigger prototype compilation on static
 | 
					            // trigger prototype compilation on static
 | 
				
			||||||
            // constructor property access
 | 
					            // constructor property access
 | 
				
			||||||
            initialized = true;
 | 
					            initialized = true;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -78,6 +78,7 @@ public final class RhinoCore implements ScopeProvider {
 | 
				
			||||||
    // debugger/tracer flags
 | 
					    // debugger/tracer flags
 | 
				
			||||||
    boolean hasDebugger = false;
 | 
					    boolean hasDebugger = false;
 | 
				
			||||||
    boolean hasTracer = false;
 | 
					    boolean hasTracer = false;
 | 
				
			||||||
 | 
					    private boolean isInitialized = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // dynamic portion of the type check sleep that grows
 | 
					    // dynamic portion of the type check sleep that grows
 | 
				
			||||||
    // as the app remains unchanged
 | 
					    // as the app remains unchanged
 | 
				
			||||||
| 
						 | 
					@ -170,9 +171,14 @@ public final class RhinoCore implements ScopeProvider {
 | 
				
			||||||
            throw new RuntimeException(e.getMessage(), e);
 | 
					            throw new RuntimeException(e.getMessage(), e);
 | 
				
			||||||
        } finally {
 | 
					        } finally {
 | 
				
			||||||
            contextFactory.exit();
 | 
					            contextFactory.exit();
 | 
				
			||||||
 | 
					            isInitialized = true;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    boolean isInitialized() {
 | 
				
			||||||
 | 
					        return isInitialized;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    void initDebugger(Context context) {
 | 
					    void initDebugger(Context context) {
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
            if (debugger == null) {
 | 
					            if (debugger == null) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue