org.eclipse.wst.jsdt.chromium

## Interface JavascriptVm

All Known Subinterfaces:
  BrowserTab, StandaloneVm, WipJavascriptVm

    public interface JavascriptVm

Abstraction of a remote JavaScript virtual machine. Clients can use it to conduct debugging process.

See Also:
  `Browser.TabConnector.attach(org.eclipse.wst.jsdt.chromium.TabDebugEventListener)`, `JavascriptVmFactory.createStandalone(java.net.SocketAddress, org.eclipse.wst.jsdt.chromium.ConnectionLogger)`, `WipBrowser.WipTabConnector.attach(TabDebugEventListener)`

### Nested Class Summary

Nested Classes
`static interface` `JavascriptVm.BreakpointCallback` A callback for breakpoint-related requests.
`static class` `JavascriptVm.ExceptionCatchMode` Defines when VM will break on exception throw (before stack unwind happened).
`static interface` `JavascriptVm.ListBreakpointsCallback`
`static interface` `JavascriptVm.ScriptsCallback` A callback for retrieving scripts.
`static interface` `JavascriptVm.SuspendCallback` A callback for suspend request.

### Method Summary

All Methods Instance Methods Abstract Methods
`boolean` `detach()` Detaches from the related tab debugger.
`RelayOk` `enableBreakpoints(java.lang.Boolean enabled, GenericCallback<java.lang.Boolean> callback, SyncCallback syncCallback)` Asynchronously enables or disables all breakpoints on remote.
`BreakpointTypeExtension` `getBreakpointTypeExtension()`
`FunctionScopeExtension` `getFunctionScopeExtension()`
`IgnoreCountBreakpointExtension` `getIgnoreCountBreakpointExtension()`
`RestartFrameExtension` `getRestartFrameExtension()`
`void` `getScripts(JavascriptVm.ScriptsCallback callback)` Returns user scripts loaded into the tab.
`Version` `getVersion()`
`boolean` `isAttached()`
`RelayOk` `listBreakpoints(JavascriptVm.ListBreakpointsCallback callback, SyncCallback syncCallback)` Asynchronously reads breakpoints from remote VM.
`RelayOk` `setBreakOnException(JavascriptVm.ExceptionCatchMode catchMode, GenericCallback<JavascriptVm.ExceptionCatchMode> callback, SyncCallback syncCallback)` Controls whether VM stops on exceptions. 3 catch modes are supported.
`RelayOk` `setBreakpoint(Breakpoint.Target target, int line, int column, boolean enabled, java.lang.String condition, JavascriptVm.BreakpointCallback callback, SyncCallback syncCallback)` Sets a breakpoint with the specified parameters.
`void` `suspend(JavascriptVm.SuspendCallback callback)` Tries to suspend VM.

### Method Detail

#### detach

    boolean detach()

Detaches from the related tab debugger.

Returns:
  whether the operation succeeded

#### isAttached

    boolean isAttached()

Returns:
  whether the tab is currently attached

#### getScripts

    void getScripts(JavascriptVm.ScriptsCallback callback)
             throws MethodIsBlockingException

Returns user scripts loaded into the tab. May block until scripts are actually loaded.

Some scripts could be already collected when the method is called. They can be missed in the result list.

Parameters:
  `callback` - that synchronously receives result, may be `null`
Throws:
  `MethodIsBlockingException` - because it may need to actually load scripts

#### setBreakpoint

    RelayOk setBreakpoint(Breakpoint.Target target,
                          int line,
                          int column,
                          boolean enabled,
                          java.lang.String condition,
                          JavascriptVm.BreakpointCallback callback,
                          SyncCallback syncCallback)

Sets a breakpoint with the specified parameters.

Parameters:
  `target` - of the breakpoint
  `line` - in the script or function (0-based). If none, use `Breakpoint.EMPTY_VALUE`
  `column` - of the target start within the line (0-based). If none, use `Breakpoint.EMPTY_VALUE`
  `enabled` - whether the breakpoint is enabled initially
  `condition` - nullable string with breakpoint condition
  `callback` - to invoke when the evaluation result is ready, may be `null`

#### suspend

    void suspend(JavascriptVm.SuspendCallback callback)

Tries to suspend VM. If successful, `DebugEventListener.suspended(DebugContext)` will be called.

Parameters:
  `callback` - to invoke once the operation result is available, may be `null`

#### listBreakpoints

    RelayOk listBreakpoints(JavascriptVm.ListBreakpointsCallback callback,
                            SyncCallback syncCallback)

Asynchronously reads breakpoints from remote VM. The now-effective collection of breakpoints is returned to callback. Already existing `Breakpoint` instances are preserved.

#### enableBreakpoints

    RelayOk enableBreakpoints(java.lang.Boolean enabled,
                              GenericCallback<java.lang.Boolean> callback,
                              SyncCallback syncCallback)

Asynchronously enables or disables all breakpoints on remote. 'Enabled' means that breakpoints behave as normal, 'disabled' means that VM doesn't stop on breakpoints. It doesn't update individual properties of `Breakpoint`s. Method call with a null value and not null callback simply returns current value.

Parameters:
  `enabled` - new value to set or null
  `callback` - receives current value if succeed or error message

#### setBreakOnException

    RelayOk setBreakOnException(JavascriptVm.ExceptionCatchMode catchMode,
                                GenericCallback<JavascriptVm.ExceptionCatchMode> callback,
                                SyncCallback syncCallback)

Controls whether VM stops on exceptions. 3 catch modes are supported.

Parameters:
  `catchMode` - new mode or null to keep the current mode
  `callback` - gets invoked when operation is finished and receives current mode as a value (may receive null if actual mode doesn't fit into `JavascriptVm.ExceptionCatchMode` type)

#### getVersion

    Version getVersion()

Returns:
  version of JavaScript VM or null if not available

#### getBreakpointTypeExtension

    BreakpointTypeExtension getBreakpointTypeExtension()

Returns:
  extension to standard breakpoint target types

#### getIgnoreCountBreakpointExtension

    IgnoreCountBreakpointExtension getIgnoreCountBreakpointExtension()

Returns:
  extension that supports ignore count property of breakpoint or null if unsupported by VM

#### getFunctionScopeExtension

    FunctionScopeExtension getFunctionScopeExtension()

Returns:
  extension that returns function hidden scopes or null if unsupported by VM

#### getRestartFrameExtension

    RestartFrameExtension getRestartFrameExtension()

Returns:
  extension that restarts frame or null if unsupported by VM