JsDebugFrame Class

A JavaScript frame of the stack of a statement given to a JsDebugger: a function call, or the top-level code of a script, a module or eval code (JsDebugEvent.GetCallStack). It can be used until the callback that received the event returns.

public sealed class JsDebugFrame

Properties

NameDescription
FunctionGets the function of the frame, or null for the top-level code of a script, a module or eval code.
FunctionNameGets the name of the function of the frame, or null for the top-level code and the anonymous functions.
LocationGets the position of the statement of the frame (the paused statement), or of the call that the frame is running.
RealmGets the realm of the code of the frame.

Gets the function of the frame, or null for the top-level code of a script, a module or eval code.

public JsFunction? Function { get; }

Property value

JsFunction?

FunctionName

JsDebugFrame.cs

Gets the name of the function of the frame, or null for the top-level code and the anonymous functions.

public string? FunctionName { get; }

Property value

string?

Gets the position of the statement of the frame (the paused statement), or of the call that the frame is running.

public JsSourceLocation Location { get; }

Property value

JsSourceLocation

Gets the realm of the code of the frame.

public JsRealm Realm { get; }

Property value

JsRealm

Methods

NameDescription
Evaluate(string)Evaluates code at the position of the frame, like a direct eval written there: it reads and changes the variables of the frame, and uses its this, new.target and super. The code raises no event of the debugger, and the host is not asked whether it can be compiled (JsEngineOptions.AllowStringCompilation, JsHost.EnsureCanCompileStrings).
GetScopes()Gets the scopes of the frame at its position, the innermost first: the blocks, the function (JsDebugScopeKind.Local), the enclosing functions (JsDebugScopeKind.Closure), then the global scope. The scopes that have no variable are omitted, except the global object.

Evaluate(string)

JsDebugFrame.cs

Evaluates code at the position of the frame, like a direct eval written there: it reads and changes the variables of the frame, and uses its this, new.target and super. The code raises no event of the debugger, and the host is not asked whether it can be compiled (JsEngineOptions.AllowStringCompilation, JsHost.EnsureCanCompileStrings).

public JsValue Evaluate(string code)

Parameters

code string
The code, e.g. an expression.

Returns

JsValue The completion value of the code.

Exceptions

InvalidOperationException
The callback that received the event returned.
JsException
The code throws, or it has a syntax error.

GetScopes()

JsDebugFrame.cs

Gets the scopes of the frame at its position, the innermost first: the blocks, the function (JsDebugScopeKind.Local), the enclosing functions (JsDebugScopeKind.Closure), then the global scope. The scopes that have no variable are omitted, except the global object.

public IReadOnlyList<JsDebugScope> GetScopes()

Returns

IReadOnlyList<JsDebugScope>

Exceptions

InvalidOperationException
The callback that received the event returned.