public class HtmlUnitContextFactory extends org.htmlunit.corejs.javascript.ContextFactory
org.htmlunit.corejs.javascript.ContextFactory.GlobalSetter, org.htmlunit.corejs.javascript.ContextFactory.Listener
Constructor and Description |
---|
HtmlUnitContextFactory(WebClient webClient)
Creates a new instance of HtmlUnitContextFactory.
|
Modifier and Type | Method and Description |
---|---|
<T> T |
callSecured(org.htmlunit.corejs.javascript.ContextAction<T> action,
HtmlPage page)
Same as
ContextFactory ContextFactory.call(ContextAction) but with handling
of some exceptions. |
protected Object |
doTopCall(org.htmlunit.corejs.javascript.Callable callable,
org.htmlunit.corejs.javascript.Context cx,
org.htmlunit.corejs.javascript.Scriptable scope,
org.htmlunit.corejs.javascript.Scriptable thisObj,
Object[] args) |
org.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(org.htmlunit.corejs.javascript.Context cx,
int featureIndex) |
boolean |
isDeminifyFunctionCode()
Indicates code of calls like
new Function("...some code...") |
protected org.htmlunit.corejs.javascript.Context |
makeContext() |
protected void |
observeInstructionCount(org.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(org.htmlunit.corejs.javascript.debug.Debugger debugger)
Sets the JavaScript debugger to use to receive JavaScript execution debugging information.
|
void |
setDeminifyFunctionCode(boolean deminify)
Configures if the code of
new Function("...some code...") |
void |
setTimeout(long timeout)
Sets the number of milliseconds a script is allowed to execute before
being terminated.
|
addListener, call, checkNotSealed, createClassLoader, enter, enterContext, enterContext, exit, getApplicationClassLoader, getE4xImplementationFactory, getGlobal, getGlobalSetter, hasExplicitGlobal, initApplicationClassLoader, initGlobal, isSealed, onContextCreated, onContextReleased, removeListener, seal
public HtmlUnitContextFactory(WebClient webClient)
webClient
- the web client using this factorypublic void setTimeout(long timeout)
timeout
- the timeout valuepublic long getTimeout()
0
)public void setDebugger(org.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 org.htmlunit.corejs.javascript.debug.Debugger getDebugger()
null
.public void setDeminifyFunctionCode(boolean deminify)
new Function("...some code...")
should be deminified to be more readable
when using the debugger. This is a small performance cost.deminify
- the new valuepublic boolean isDeminifyFunctionCode()
new Function("...some code...")
should be deminified to be more
readable when using the debugger.protected String preProcess(HtmlPage htmlPage, String sourceCode, String sourceName, int lineNumber, HtmlElement htmlElement)
WebClient
. This method delegates to the pre processor handler specified in the
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 contextScriptPreProcessor
protected org.htmlunit.corejs.javascript.Context makeContext()
makeContext
in class org.htmlunit.corejs.javascript.ContextFactory
protected void observeInstructionCount(org.htmlunit.corejs.javascript.Context cx, int instructionCount)
observeInstructionCount
in class org.htmlunit.corejs.javascript.ContextFactory
cx
- the context calling usinstructionCount
- amount of script instruction executed since last call to observeInstructionCountprotected Object doTopCall(org.htmlunit.corejs.javascript.Callable callable, org.htmlunit.corejs.javascript.Context cx, org.htmlunit.corejs.javascript.Scriptable scope, org.htmlunit.corejs.javascript.Scriptable thisObj, Object[] args)
doTopCall
in class org.htmlunit.corejs.javascript.ContextFactory
public final <T> T callSecured(org.htmlunit.corejs.javascript.ContextAction<T> action, HtmlPage page)
ContextFactory
ContextFactory.call(ContextAction)
but with handling
of some exceptions.T
- return type of the actionaction
- the contextActionpage
- the pageprotected boolean hasFeature(org.htmlunit.corejs.javascript.Context cx, int featureIndex)
hasFeature
in class org.htmlunit.corejs.javascript.ContextFactory
Copyright © 2002–2024 Gargoyle Software Inc.. All rights reserved.