JavaScriptScriptEngineOptions Class
Options of a JavaScriptScriptEngine. The defaults limit the resources a script can use, as the documents may be untrusted: each limit applies to each entry into JavaScript (a script, an event listener, a timer callback...).
public sealed class JavaScriptScriptEngineOptionsConstructors
| Name | Description |
|---|---|
| JavaScriptScriptEngineOptions() |
JavaScriptScriptEngineOptions()
JavaScriptScriptEngineOptions.cspublic JavaScriptScriptEngineOptions()No documentation is available.
Properties
| Name | Description |
|---|---|
| ConfigureEngine | Gets a callback that configures the options of the engine, after the options of the library. The host hooks (JsEngineOptions.Host) and the module loader (JsEngineOptions.ModuleLoader) are the ones of the library and must not be replaced. |
| MaxStatements | Gets the maximum number of statements of an entry into JavaScript. The default is null: no limit. The engine counts the iterations of the loops and the calls, which bound the work of a script as the statements do. |
| MemoryLimit | Gets the maximum number of bytes allocated by the thread during an entry into JavaScript. The default is 256 MB. Null disables the limit. |
| RecursionLimit | Gets the maximum depth of the JavaScript calls: a deeper call throws a RangeError. The default is 512. Null is the limit of the engine (JsEngineOptions.RecursionLimit, 10,000 calls): the frames of the engine are not on the .NET stack, so there is always a limit. |
| RegexTimeout | Gets the maximum duration of a regular expression match: a match that exceeds it stops the script. The default is 2 seconds. Null disables the limit (the matches are still bounded by JavaScriptScriptEngineOptions.Timeout). |
| TimeProvider | Gets the clock of Date.now() and new Date(), and the local time zone of the dates. The default is TimeProvider.System. |
| Timeout | Gets the maximum duration of an entry into JavaScript. The default is 10 seconds. Null disables the limit. |
ConfigureEngine
JavaScriptScriptEngineOptions.csGets a callback that configures the options of the engine, after the options of the library. The host hooks (JsEngineOptions.Host) and the module loader (JsEngineOptions.ModuleLoader) are the ones of the library and must not be replaced.
public Action<JsEngineOptions>? ConfigureEngine { get; init; }Property value
MaxStatements
JavaScriptScriptEngineOptions.csMemoryLimit
JavaScriptScriptEngineOptions.csRecursionLimit
JavaScriptScriptEngineOptions.csGets the maximum depth of the JavaScript calls: a deeper call throws a RangeError. The default is 512. Null is the limit of the engine (JsEngineOptions.RecursionLimit, 10,000 calls): the frames of the engine are not on the .NET stack, so there is always a limit.
public int? RecursionLimit { get; init; }Property value
RegexTimeout
JavaScriptScriptEngineOptions.csGets the maximum duration of a regular expression match: a match that exceeds it stops the script. The default is 2 seconds. Null disables the limit (the matches are still bounded by JavaScriptScriptEngineOptions.Timeout).
public TimeSpan? RegexTimeout { get; init; }Property value
TimeProvider
JavaScriptScriptEngineOptions.csGets the clock of Date.now() and new Date(), and the local time zone of the dates. The default is TimeProvider.System.
public TimeProvider? TimeProvider { get; init; }