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 JavaScriptScriptEngineOptions

Constructors

NameDescription
JavaScriptScriptEngineOptions()

JavaScriptScriptEngineOptions()

JavaScriptScriptEngineOptions.cs
public JavaScriptScriptEngineOptions()

No documentation is available.

Properties

NameDescription
ConfigureEngineGets 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.
MaxStatementsGets 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.
MemoryLimitGets the maximum number of bytes allocated by the thread during an entry into JavaScript. The default is 256 MB. Null disables the limit.
RecursionLimitGets 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.
RegexTimeoutGets 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).
TimeProviderGets the clock of Date.now() and new Date(), and the local time zone of the dates. The default is TimeProvider.System.
TimeoutGets the maximum duration of an entry into JavaScript. The default is 10 seconds. Null disables the limit.

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.

public Action<JsEngineOptions>? ConfigureEngine { get; init; }

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.

public int? MaxStatements { get; init; }

Property value

int?

Gets the maximum number of bytes allocated by the thread during an entry into JavaScript. The default is 256 MB. Null disables the limit.

public long? MemoryLimit { get; init; }

Property value

long?

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.

public int? RecursionLimit { get; init; }

Property value

int?

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).

public TimeSpan? RegexTimeout { get; init; }

Property value

TimeSpan?

Gets 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; }

Property value

TimeProvider?

Gets the maximum duration of an entry into JavaScript. The default is 10 seconds. Null disables the limit.

public TimeSpan? Timeout { get; init; }

Property value

TimeSpan?