DebuggerCompartment

For debugging purpose, Nidium use the Debugger of SpiderMonkey.

As the Debugger is not residing in the same compartment you need to use a DebuggerCompartment to initialize and execute code inside the Debugger.

new DebuggerCompartment()

Create a new instance of a Debugger inside a new compartment.

run(context, callback[, arg=0]) (static)

Run a function inside the Debugger compartment.

Important note : You cannot share variables between compartments as you usually do in JS. Each compartment is like a sandbox. If you want to have access to variables from the main compartment, you can pass them as an arguments to the run() method. Nidium will wrap your variables to make them accessible inside the Debugger compartment. The compartment of the debugger only expose the console API. None of Nidium APIs will be available.

Arguments:
context (DebuggerCompartment)

Debugger compartment context

callback (Function)

function to be executed in the Debugger compartment

debugger (DebuggerCompartment)

Debugger instance

params (Any[])

arguments

arg (Any)

Optional variable to wrap into the Debugger compartment. The wrapped variable is passed as an argument of the callback

Returns: Any

The value returned from the callback function


Caught a mistake or want to contribute to the documentation? Edit this page on GitHub!