|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.mozilla.javascript.ContextFactory
com.googlecode.jslint4java.TimeLimitedContextFactory
public class TimeLimitedContextFactory
A ContextFactory that allows specification of a timeout. This is mostly copied from the example in the ContextFactory javadocs.
Nested Class Summary | |
---|---|
static class |
TimeLimitedContextFactory.TimeExceededException
|
Nested classes/interfaces inherited from class org.mozilla.javascript.ContextFactory |
---|
org.mozilla.javascript.ContextFactory.GlobalSetter, org.mozilla.javascript.ContextFactory.Listener |
Constructor Summary | |
---|---|
TimeLimitedContextFactory(long maxTime,
TimeUnit timeUnit)
Create a new TimeLimitedContextFactory . |
Method Summary | |
---|---|
protected Object |
doTopCall(org.mozilla.javascript.Callable callable,
org.mozilla.javascript.Context cx,
org.mozilla.javascript.Scriptable scope,
org.mozilla.javascript.Scriptable thisObj,
Object[] args)
Record start time in context. |
protected org.mozilla.javascript.Context |
makeContext()
Create a TimeLimitedContext that runs the observer every 10k ops. |
protected void |
observeInstructionCount(org.mozilla.javascript.Context cx,
int instructionCount)
Enforce time restrictions. |
Methods inherited from class org.mozilla.javascript.ContextFactory |
---|
addListener, call, checkNotSealed, createClassLoader, enter, enterContext, enterContext, exit, getApplicationClassLoader, getE4xImplementationFactory, getGlobal, getGlobalSetter, hasExplicitGlobal, hasFeature, initApplicationClassLoader, initGlobal, isSealed, onContextCreated, onContextReleased, removeListener, seal |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TimeLimitedContextFactory(long maxTime, TimeUnit timeUnit)
TimeLimitedContextFactory
.
maxTime
- the maximum amount of time that a JavaScript execution is
allowed to take.timeUnit
- the unit of maxTime.Method Detail |
---|
protected org.mozilla.javascript.Context makeContext()
makeContext
in class org.mozilla.javascript.ContextFactory
protected Object doTopCall(org.mozilla.javascript.Callable callable, org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable scope, org.mozilla.javascript.Scriptable thisObj, Object[] args)
doTopCall
in class org.mozilla.javascript.ContextFactory
protected void observeInstructionCount(org.mozilla.javascript.Context cx, int instructionCount)
observeInstructionCount
in class org.mozilla.javascript.ContextFactory
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |