public class TimeLimitedContextFactory
extends org.mozilla.javascript.ContextFactory
| Modifier and Type | Class and Description |
|---|---|
static class |
TimeLimitedContextFactory.TimeExceededException |
| Constructor and Description |
|---|
TimeLimitedContextFactory(long maxTime,
TimeUnit timeUnit)
Create a new
TimeLimitedContextFactory. |
| Modifier and Type | Method and Description |
|---|---|
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.
|
addListener, call, checkNotSealed, createClassLoader, enter, enterContext, enterContext, exit, getApplicationClassLoader, getE4xImplementationFactory, getGlobal, getGlobalSetter, hasExplicitGlobal, hasFeature, initApplicationClassLoader, initGlobal, isSealed, onContextCreated, onContextReleased, removeListener, sealpublic 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.protected org.mozilla.javascript.Context makeContext()
makeContext in class org.mozilla.javascript.ContextFactoryprotected 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.ContextFactoryprotected void observeInstructionCount(org.mozilla.javascript.Context cx,
int instructionCount)
observeInstructionCount in class org.mozilla.javascript.ContextFactoryCopyright © 2007-2013. All Rights Reserved.