/** * Disables all breakpoints. */ public void disableAllBreakPoints() { debugObject.executeVoidFunction(DISABLE_ALL_BREAK_POINTS, null); }
/** * Disables a breakpoint. * * @param breakpointID The breakpoint to disable */ public void disableScriptBreakPoint(final int breakpointID) { V8Array parameters = new V8Array(runtime); parameters.push(breakpointID); try { debugObject.executeVoidFunction(DISABLE_SCRIPT_BREAK_POINT, parameters); } finally { parameters.close(); } }
/** * Enables a breakpoint. * * @param breakpointID The breakpoint to enable. */ public void enableScriptBreakPoint(final int breakpointID) { V8Array parameters = new V8Array(runtime); parameters.push(breakpointID); try { debugObject.executeVoidFunction(ENABLE_SCRIPT_BREAK_POINT, parameters); } finally { parameters.close(); } }
/** * Removes a Breakpoint. * * @param breakpointID The ID of the breakpoint to remove. */ public void clearBreakPoint(final int breakpointID) { V8Array parameters = new V8Array(runtime); parameters.push(breakpointID); try { debugObject.executeVoidFunction(CLEAR_BREAK_POINT, 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(); } }
/** * 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(); } }
/** * Changes the current condition on the breakpoint as specified by the breakpoint ID * * @param breakpointID The ID of the breakpoint of which to change the condition on * @param condition The new condition to set */ public void changeBreakPointCondition(final int breakpointID, final String condition) { V8Array parameters = new V8Array(runtime); parameters.push(breakpointID); parameters.push(condition); try { debugObject.executeVoidFunction(CHANGE_BREAK_POINT_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 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 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 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(); } }
/** * Disables all breakpoints. */ public void disableAllBreakPoints() { debugObject.executeVoidFunction(DISABLE_ALL_BREAK_POINTS, null); }
/** * Disables a breakpoint. * * @param breakpointID The breakpoint to disable */ public void disableScriptBreakPoint(final int breakpointID) { V8Array parameters = new V8Array(runtime); parameters.push(breakpointID); try { debugObject.executeVoidFunction(DISABLE_SCRIPT_BREAK_POINT, parameters); } finally { parameters.close(); } }
/** * Removes a Breakpoint. * * @param breakpointID The ID of the breakpoint to remove. */ public void clearBreakPoint(final int breakpointID) { V8Array parameters = new V8Array(runtime); parameters.push(breakpointID); try { debugObject.executeVoidFunction(CLEAR_BREAK_POINT, parameters); } finally { parameters.close(); } }
/** * Enables a breakpoint. * * @param breakpointID The breakpoint to enable. */ public void enableScriptBreakPoint(final int breakpointID) { V8Array parameters = new V8Array(runtime); parameters.push(breakpointID); try { debugObject.executeVoidFunction(ENABLE_SCRIPT_BREAK_POINT, 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(); } }
@Test(expected = UnsupportedOperationException.class) public void testExecuteVoidFunctionUndefined() { V8Object undefined = v8.getObject("object"); undefined.executeVoidFunction("foo", null); }
@Test public void testInvokeCallbackFunctionUsesReciver() { V8Object bar = v8.executeObjectScript("var bar = {}; bar;"); JavaVoidCallback callback = mock(JavaVoidCallback.class); bar.registerJavaMethod(callback, "foo"); doAnswer(constructAnswer(bar, null, 77)).when(callback).invoke(any(V8Object.class), any(V8Array.class)); bar.executeVoidFunction("foo", null); bar.close(); }
@Test public void testVoidFunctionCallOnJSObject() { ICallback callback = mock(ICallback.class); V8Object v8Object = new V8Object(v8); v8Object.registerJavaMethod(callback, "voidMethodNoParameters", "foo", new Class<?>[0]); v8Object.executeVoidFunction("foo", null); verify(callback).voidMethodNoParameters(); v8Object.close(); }