/** * Returns the name of this property. * * @return The name of this property. */ public String getName() { return v8Object.executeStringFunction("name", null); }
/** * Returns the name of this Function. * * @return The name of this function */ public String getName() { return v8Object.executeStringFunction(NAME, null); }
/** * Returns the text of the line that this event occurred on. * * @return The text of the line that this event occurred on. */ public String getSourceLineText() { return v8Object.executeStringFunction(SOURCE_LINE_TEXT, null); }
/** * Returns the condition set on this breakpoint or the String * 'undefined' if a condition was not set. * * @return The condition set on this breakpoint. */ public String getCondition() { try { return v8Object.executeStringFunction(CONDITION, null); } catch (V8ResultUndefined e) { return "undefined"; } }
@Override public String toString() { return v8Object.executeStringFunction("toText", null); } }
@Override public String toString() { return v8Object.executeStringFunction("toText", null); }
@Override public String toString() { return v8Object.executeStringFunction("toText", null); }
/** * Returns the name of the Script associated with * this FunctionMirror. * * @return The name of the script. */ public String getScriptName() { V8Object script = v8Object.executeObjectFunction(SCRIPT, null); try { return script.executeStringFunction(NAME, null); } finally { script.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(); } }
/** * 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(); } }
private void sendCompileEvent(final V8Object eventData) throws IOException { if (!isConnected()) { return; } //send event to debugger int type = eventData.getInteger("type_"); V8Object script = eventData.getObject("script_"); V8Object event = null; V8Array params = new V8Array(runtime); try { params.push(script); params.push(type); event = debugObject.executeObjectFunction(MAKE_COMPILE_EVENT, params); String json = event.executeStringFunction("toJSONProtocol", null); if (traceCommunication) { System.out.println("Sending event (CompileEvent):\n" + json.substring(0, Math.min(json.length(), 1000))); } if (json.length() > 0) { sendJson(json); } } finally { params.close(); script.close(); if (event != null) { event.close(); } } }
/** * Returns the name of this property. * * @return The name of this property. */ public String getName() { return v8Object.executeStringFunction("name", null); }
@Override public String toString() { return v8Object.executeStringFunction("toText", null); } }
/** * Returns the name of this Function. * * @return The name of this function */ public String getName() { return v8Object.executeStringFunction(NAME, null); }
/** * Returns the text of the line that this event occurred on. * * @return The text of the line that this event occurred on. */ public String getSourceLineText() { return v8Object.executeStringFunction(SOURCE_LINE_TEXT, null); }
@Override public String toString() { return v8Object.executeStringFunction("toText", null); }
/** * Returns the condition set on this breakpoint or the String * 'undefined' if a condition was not set. * * @return The condition set on this breakpoint. */ public String getCondition() { try { return v8Object.executeStringFunction(CONDITION, null); } catch (V8ResultUndefined e) { return "undefined"; } }
params.push(breakpointsHit); event = debugObject.executeObjectFunction(MAKE_BREAK_EVENT, params); String json = event.executeStringFunction("toJSONProtocol", null); if (traceCommunication) { System.out.println("Sending event (Break):\n" + json);
@Test(expected = UnsupportedOperationException.class) public void testExecuteStringFunctionUndefined() { V8Object undefined = v8.getObject("object"); undefined.executeStringFunction("foo", null); }
@Test public void testStringFunctionCallOnJSObject() { ICallback callback = mock(ICallback.class); doReturn("mystring").when(callback).stringMethodNoParameters(); V8Object v8Object = new V8Object(v8); v8Object.registerJavaMethod(callback, "stringMethodNoParameters", "foo", new Class<?>[0]); String result = v8Object.executeStringFunction("foo", null); verify(callback).stringMethodNoParameters(); assertEquals("mystring", result); v8Object.close(); }