|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.htmlunit.corejs.javascript.ContextFactory
com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory
public class HtmlUnitContextFactory
ContextFactory that supports termination of scripts if they exceed a timeout. Based on example from ContextFactory.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class net.sourceforge.htmlunit.corejs.javascript.ContextFactory |
---|
net.sourceforge.htmlunit.corejs.javascript.ContextFactory.GlobalSetter, net.sourceforge.htmlunit.corejs.javascript.ContextFactory.Listener |
Constructor Summary | |
---|---|
HtmlUnitContextFactory(WebClient webClient)
Creates a new instance of HtmlUnitContextFactory. |
Method Summary | |
---|---|
protected void |
configureErrorReporter(net.sourceforge.htmlunit.corejs.javascript.Context context)
Configures the ErrorReporter on the context. |
protected Object |
doTopCall(net.sourceforge.htmlunit.corejs.javascript.Callable callable,
net.sourceforge.htmlunit.corejs.javascript.Context cx,
net.sourceforge.htmlunit.corejs.javascript.Scriptable scope,
net.sourceforge.htmlunit.corejs.javascript.Scriptable thisObj,
Object[] args)
|
net.sourceforge.htmlunit.corejs.javascript.debug.Debugger |
getDebugger()
Returns the JavaScript debugger to use to receive JavaScript execution debugging information. |
long |
getTimeout()
Returns the number of milliseconds a script is allowed to execute before being terminated. |
protected boolean |
hasFeature(net.sourceforge.htmlunit.corejs.javascript.Context cx,
int featureIndex)
|
protected net.sourceforge.htmlunit.corejs.javascript.Context |
makeContext()
|
protected void |
observeInstructionCount(net.sourceforge.htmlunit.corejs.javascript.Context cx,
int instructionCount)
Run-time calls this when instruction counting is enabled and the counter reaches limit set by setInstructionObserverThreshold(). |
protected String |
preProcess(HtmlPage htmlPage,
String sourceCode,
String sourceName,
int lineNumber,
HtmlElement htmlElement)
Pre process the specified source code in the context of the given page using the processor specified in the webclient. |
void |
setDebugger(net.sourceforge.htmlunit.corejs.javascript.debug.Debugger debugger)
Sets the JavaScript debugger to use to receive JavaScript execution debugging information. |
void |
setTimeout(long timeout)
Sets the number of milliseconds a script is allowed to execute before being terminated. |
Methods inherited from class net.sourceforge.htmlunit.corejs.javascript.ContextFactory |
---|
addListener, call, checkNotSealed, createClassLoader, enter, enterContext, enterContext, exit, getApplicationClassLoader, getE4xImplementationFactory, getGlobal, getGlobalSetter, hasExplicitGlobal, 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 HtmlUnitContextFactory(WebClient webClient)
webClient
- the web client using this factoryMethod Detail |
---|
public void setTimeout(long timeout)
timeout
- the timeout valuepublic long getTimeout()
public void setDebugger(net.sourceforge.htmlunit.corejs.javascript.debug.Debugger debugger)
DebuggerImpl
, DebugFrameImpl
) may be
used, or a custom debugger may be used instead. By default, no debugger is used.
debugger
- the JavaScript debugger to use (may be null)public net.sourceforge.htmlunit.corejs.javascript.debug.Debugger getDebugger()
protected String preProcess(HtmlPage htmlPage, String sourceCode, String sourceName, int lineNumber, HtmlElement htmlElement)
WebClient
. If no pre processor handler is defined, the original source code is returned
unchanged.
htmlPage
- the pagesourceCode
- the code to processsourceName
- a name for the chunk of code (used in error messages)lineNumber
- the line number of the source codehtmlElement
- the HTML element that will act as the context
ScriptPreProcessor
protected net.sourceforge.htmlunit.corejs.javascript.Context makeContext()
makeContext
in class net.sourceforge.htmlunit.corejs.javascript.ContextFactory
protected void configureErrorReporter(net.sourceforge.htmlunit.corejs.javascript.Context context)
ErrorReporter
on the context.
context
- the context to configureContext#setErrorReporter(ErrorReporter)}
protected void observeInstructionCount(net.sourceforge.htmlunit.corejs.javascript.Context cx, int instructionCount)
observeInstructionCount
in class net.sourceforge.htmlunit.corejs.javascript.ContextFactory
cx
- the context calling usinstructionCount
- amount of script instruction executed since last call to observeInstructionCountprotected Object doTopCall(net.sourceforge.htmlunit.corejs.javascript.Callable callable, net.sourceforge.htmlunit.corejs.javascript.Context cx, net.sourceforge.htmlunit.corejs.javascript.Scriptable scope, net.sourceforge.htmlunit.corejs.javascript.Scriptable thisObj, Object[] args)
doTopCall
in class net.sourceforge.htmlunit.corejs.javascript.ContextFactory
protected boolean hasFeature(net.sourceforge.htmlunit.corejs.javascript.Context cx, int featureIndex)
hasFeature
in class net.sourceforge.htmlunit.corejs.javascript.ContextFactory
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |