/** * Returns the name of the local variable at the given index. * * @param index The index of the local variable name to return. * @return The name of local variable at the given index. */ public String getLocalName(final int index) { V8Array parameters = new V8Array(v8Object.getRuntime()); parameters.push(index); try { return v8Object.executeStringFunction(LOCAL_NAME, parameters); } finally { parameters.close(); } }
/** * Returns the name of the argument at the given index. * * @param index The index of the argument name to return. * @return The name of argument at the given index. */ public String getArgumentName(final int index) { V8Array parameters = new V8Array(v8Object.getRuntime()); parameters.push(index); try { return v8Object.executeStringFunction(ARGUMENT_NAME, parameters); } finally { parameters.close(); } }
/** * Indicates to the debugger how to proceed. If not called, * the debugger will continue running until the next breakpoint * is hit. * * @param action The step action to use. */ public void prepareStep(final StepAction action) { V8Array parameters = new V8Array(v8Object.getRuntime()); parameters.push(action.index); try { v8Object.executeVoidFunction(PREPARE_STEP, parameters); } finally { parameters.close(); } }
/** * Sets a condition to be evaluated before determining if * the breakpoint event should be fired. * * @param condition A JavaScript condition to be evaluated. */ public void setCondition(final String condition) { V8Array parameters = new V8Array(v8Object.getRuntime()); parameters.push(condition); try { v8Object.executeVoidFunction(SET_CONDITION, parameters); } finally { parameters.close(); } }
/** * Sets the value of a variable in this scope. * * @param name The name of the variable * @param value The value */ public void setVariableValue(final String name, final double value) { V8Array parameters = new V8Array(v8Object.getRuntime()); parameters.push(name); parameters.push(value); try { v8Object.executeVoidFunction(SET_VARIABLE_VALUE, parameters); } finally { parameters.close(); } }
/** * Sets the value of a variable in this scope. * * @param name The name of the variable * @param value The value */ public void setVariableValue(final String name, final V8Value value) { V8Array parameters = new V8Array(v8Object.getRuntime()); parameters.push(name); parameters.push(value); try { v8Object.executeVoidFunction(SET_VARIABLE_VALUE, parameters); } finally { parameters.close(); } }
/** * Sets the value of a variable in this scope. * * @param name The name of the variable * @param value The value */ public void setVariableValue(final String name, final boolean value) { V8Array parameters = new V8Array(v8Object.getRuntime()); parameters.push(name); parameters.push(value); try { v8Object.executeVoidFunction(SET_VARIABLE_VALUE, parameters); } finally { parameters.close(); } }
/** * Sets the value of a variable in this scope. * * @param name The name of the variable * @param value The value */ public void setVariableValue(final String name, final int value) { V8Array parameters = new V8Array(v8Object.getRuntime()); parameters.push(name); parameters.push(value); try { v8Object.executeVoidFunction(SET_VARIABLE_VALUE, parameters); } finally { parameters.close(); } }
/** * Sets the value of a variable in this scope. * * @param name The name of the variable * @param value The value */ public void setVariableValue(final String name, final String value) { V8Array parameters = new V8Array(v8Object.getRuntime()); parameters.push(name); parameters.push(value); try { v8Object.executeVoidFunction(SET_VARIABLE_VALUE, parameters); } finally { parameters.close(); } }
/** * Returns the value of the local variable at the given index. * * @param index The index of the local to return. * @return The value of local at the given index. */ public ValueMirror getLocalValue(final int index) { V8Array parameters = new V8Array(v8Object.getRuntime()); parameters.push(index); V8Object result = null; try { result = v8Object.executeObjectFunction(LOCAL_VALUE, parameters); if (!isValue(result)) { throw new IllegalStateException("Local value is not a ValueMirror"); } return createMirror(result); } finally { parameters.close(); if (result != null) { result.close(); } } }
/** * Returns the value of the argument at the given index. * * @param index The index of the argument value to return. * @return The value of argument at the given index. */ public ValueMirror getArgumentValue(final int index) { V8Array parameters = new V8Array(v8Object.getRuntime()); parameters.push(index); V8Object result = null; try { result = v8Object.executeObjectFunction(ARGUMENT_VALUE, parameters); if (!isValue(result)) { throw new IllegalStateException("Argument value is not a ValueMirror"); } return new ValueMirror(result); } finally { parameters.close(); if (result != null) { result.close(); } } }
/** * Returns the Frame at a given index * * @param index The stack index * @return The stack frame at a given index */ public Frame getFrame(final int index) { V8Array parameters = new V8Array(v8Object.getRuntime()); parameters.push(index); V8Object frame = null; try { frame = v8Object.executeObjectFunction(FRAME, parameters); return new Frame(frame); } finally { parameters.close(); if (frame != null) { frame.close(); } } }
/** * Returns the scope at a given index. * * @param index The index * @return The scope */ public Scope getScope(final int index) { V8Array parameters = new V8Array(v8Object.getRuntime()); parameters.push(index); V8Object scope = null; try { scope = v8Object.executeObjectFunction(SCOPE, parameters); return new Scope(scope); } finally { parameters.close(); if (scope != null) { scope.close(); } } }
/** * Return the properties for this object as an array of PropertyMirror objects. * * @param kind Indicate whether named, indexed or both kinds of properties are requested * @param limit Limit the number of properties returned to the specified value * @return {Array} Property mirrors for this object */ public PropertiesArray getProperties(final PropertyKind kind, final int limit) { V8Array parameters = new V8Array(v8Object.getRuntime()); parameters.push(kind.index); parameters.push(limit); V8Array result = null; try { result = v8Object.executeArrayFunction(PROPERTIES, parameters); return new PropertiesArray(result); } finally { parameters.close(); if ((result != null) && !result.isReleased()) { result.close(); result = null; } } }
/** * Returns all the property names for the given object. * * @param kind Indicate whether named, indexed or both kinds of properties are requested. * @param limit Limit the number of properties returned to the specified value * @return All the property names for a given object */ public String[] getPropertyNames(final PropertyKind kind, final int limit) { V8Array parameters = new V8Array(v8Object.getRuntime()); parameters.push(kind.index); parameters.push(limit); V8Array propertyNames = null; try { propertyNames = v8Object.executeArrayFunction(PROPERTY_NAMES, parameters); String[] result = new String[propertyNames.length()]; for (int i = 0; i < result.length; i++) { result[i] = propertyNames.getString(i); } return result; } finally { parameters.close(); if (propertyNames != null) { propertyNames.close(); } } }
/** * Sets a condition to be evaluated before determining if * the breakpoint event should be fired. * * @param condition A JavaScript condition to be evaluated. */ public void setCondition(final String condition) { V8Array parameters = new V8Array(v8Object.getRuntime()); parameters.push(condition); try { v8Object.executeVoidFunction(SET_CONDITION, parameters); } finally { parameters.close(); } }
/** * Returns the name of the local variable at the given index. * * @param index The index of the local variable name to return. * @return The name of local variable at the given index. */ public String getLocalName(final int index) { V8Array parameters = new V8Array(v8Object.getRuntime()); parameters.push(index); try { return v8Object.executeStringFunction(LOCAL_NAME, parameters); } finally { parameters.close(); } }
/** * Indicates to the debugger how to proceed. If not called, * the debugger will continue running until the next breakpoint * is hit. * * @param action The step action to use. */ public void prepareStep(final StepAction action) { V8Array parameters = new V8Array(v8Object.getRuntime()); parameters.push(action.index); try { v8Object.executeVoidFunction(PREPARE_STEP, parameters); } finally { parameters.close(); } }
/** * Sets the value of a variable in this scope. * * @param name The name of the variable * @param value The value */ public void setVariableValue(final String name, final V8Value value) { V8Array parameters = new V8Array(v8Object.getRuntime()); parameters.push(name); parameters.push(value); try { v8Object.executeVoidFunction(SET_VARIABLE_VALUE, parameters); } finally { parameters.close(); } }
/** * Sets the value of a variable in this scope. * * @param name The name of the variable * @param value The value */ public void setVariableValue(final String name, final boolean value) { V8Array parameters = new V8Array(v8Object.getRuntime()); parameters.push(name); parameters.push(value); try { v8Object.executeVoidFunction(SET_VARIABLE_VALUE, parameters); } finally { parameters.close(); } }