/** * Returns the ID of this breakpoint. * * @return The ID (breakpoint number) of this breakpoint. */ public int getBreakPointNumber() { return v8Object.executeIntegerFunction(NUMBER, null); }
/** * Returns the source line that this break event occurred on. * * @return The line number that this break event occurred on. */ public int getSourceLine() { return v8Object.executeIntegerFunction(SOURCE_LINE, null); }
/** * Returns the current stack frame count. * * @return The stack frame count. */ public int getFrameCount() { return v8Object.executeIntegerFunction(FRAME_COUNT, null); }
/** * Returns the number of accessible scopes from this stack frame. * * @return The number of accessible scopes */ public int getScopeCount() { return v8Object.executeIntegerFunction(SCOPE_COUNT, null); }
/** * Returns the source column that this break event occurred on. * * @return The column number that this break event occurred on. */ public int getSourceColumn() { return v8Object.executeIntegerFunction(SOURCE_COLUMN, null); }
/** * Returns the line number of this breakpoint. * * @return The line number of this breakpoint. */ public int getLine() { return v8Object.executeIntegerFunction(LINE, null); }
/** * Returns the length of the array pointed to by this Array Mirror * * @return The length of the array. */ public int length() { return v8Object.executeIntegerFunction(LENGTH, null); }
/** * Returns the number of arguments to this frame. * * @return The number of arguments passed to this frame. */ public int getArgumentCount() { return v8Object.executeIntegerFunction(ARGUMENT_COUNT, null); }
/** * Returns the number of local variables in this frame. * * @return The number of local variables accessible from this stack frame. */ public int getLocalCount() { return v8Object.executeIntegerFunction(LOCAL_COUNT, null); }
/** * Returns the type of this scope. * * @return The type of scope. */ public ScopeType getType() { return ScopeType.values()[v8Object.executeIntegerFunction(SCOPE_TYPE, null)]; }
/** * Registers a function breakpoint. When the JavaScript function * is invoked, the breakpoint will be 'hit'. * * @param function The function on which to register the breakpoint. * @return The berakpointID. */ public int setBreakpoint(final V8Function function) { V8Array parameters = new V8Array(runtime); parameters.push(function); try { return debugObject.executeIntegerFunction(SET_BREAK_POINT, parameters); } finally { parameters.close(); } }
/** * Registers a breakpoint given a scriptID and line number. The breakpoint * will be 'hit' when the script is executed and the given line is reached. * * @param scriptID The ID of the script on which to set the breakpoint. * @param lineNumber The line number on which to set the breakpoint. * @return The berakpointID. */ public int setScriptBreakpoint(final String scriptID, final int lineNumber) { V8Array parameters = new V8Array(runtime); parameters.push(scriptID); parameters.push(lineNumber); try { return debugObject.executeIntegerFunction(SET_SCRIPT_BREAK_POINT_BY_NAME, parameters); } finally { parameters.close(); } }
/** * Get all the BreakPoint IDs as an array. * * @return A list of BreakPoint IDs. */ public int[] getScriptBreakPointIDs() { V8Array breakPoints = debugObject.executeArrayFunction(SCRIPT_BREAK_POINTS, null); try { int[] result = new int[breakPoints.length()]; for (int i = 0; i < breakPoints.length(); i++) { V8Object breakPoint = breakPoints.getObject(i); try { result[i] = breakPoint.executeIntegerFunction(NUMBER, null); } finally { breakPoint.close(); } } return result; } finally { breakPoints.close(); } }
/** * Returns the source line that this break event occurred on. * * @return The line number that this break event occurred on. */ public int getSourceLine() { return v8Object.executeIntegerFunction(SOURCE_LINE, null); }
/** * Returns the length of the array pointed to by this Array Mirror * * @return The length of the array. */ public int length() { return v8Object.executeIntegerFunction(LENGTH, null); }
/** * Returns the current stack frame count. * * @return The stack frame count. */ public int getFrameCount() { return v8Object.executeIntegerFunction(FRAME_COUNT, null); }
/** * Returns the source column that this break event occurred on. * * @return The column number that this break event occurred on. */ public int getSourceColumn() { return v8Object.executeIntegerFunction(SOURCE_COLUMN, null); }
/** * Returns the ID of this breakpoint. * * @return The ID (breakpoint number) of this breakpoint. */ public int getBreakPointNumber() { return v8Object.executeIntegerFunction(NUMBER, null); }
@Test(expected = UnsupportedOperationException.class) public void testExecuteIntFunctionUndefined() { V8Object undefined = v8.getObject("object"); undefined.executeIntegerFunction("foo", null); }
@Test public void testIntFunctionCallOnJSObject() { ICallback callback = mock(ICallback.class); doReturn(99).when(callback).intMethodNoParameters(); V8Object v8Object = new V8Object(v8); v8Object.registerJavaMethod(callback, "intMethodNoParameters", "foo", new Class<?>[0]); int result = v8Object.executeIntegerFunction("foo", null); verify(callback).intMethodNoParameters(); assertEquals(99, result); v8Object.close(); }