/** * Performs a JS == on the parameter and the receiver. * * @param that The Object to compare this object against. * @return Returns true iff this == that */ public boolean jsEquals(final Object that) { v8.checkThread(); checkReleased(); if (that == this) { return true; } if (that == null) { return false; } if (!(that instanceof V8Value)) { return false; } if (isUndefined() && ((V8Value) that).isUndefined()) { return true; } if (((V8Value) that).isUndefined()) { return false; } return v8.equals(v8.getV8RuntimePtr(), getHandle(), ((V8Value) that).getHandle()); }
/** * Performs a JS == on the parameter and the receiver. * * @param that The Object to compare this object against. * @return Returns true iff this == that */ public boolean jsEquals(final Object that) { v8.checkThread(); checkReleased(); if (that == this) { return true; } if (that == null) { return false; } if (!(that instanceof V8Value)) { return false; } if (isUndefined() && ((V8Value) that).isUndefined()) { return true; } if (((V8Value) that).isUndefined()) { return false; } return v8.equals(v8.getV8RuntimePtr(), getHandle(), ((V8Value) that).getHandle()); }
@Test public void testV8IsGlobalEquals() { setupWindowAlias(); v8.executeVoidScript("var global = Function('return this')();"); V8Object global = v8.executeObjectScript("global"); assertTrue(v8.equals(global)); assertTrue(global.equals(v8)); global.close(); }
/** * Performs a JS == on the parameter and the receiver. * * @param that The Object to compare this object against. * @return Returns true iff this == that */ public boolean jsEquals(final Object that) { v8.checkThread(); checkReleased(); if (that == this) { return true; } if (that == null) { return false; } if (!(that instanceof V8Value)) { return false; } if (isUndefined() && ((V8Value) that).isUndefined()) { return true; } if (((V8Value) that).isUndefined()) { return false; } return v8.equals(v8.getV8RuntimePtr(), getHandle(), ((V8Value) that).getHandle()); }
/** * Performs a JS == on the parameter and the receiver. * * @param that The Object to compare this object against. * @return Returns true iff this == that */ public boolean jsEquals(final Object that) { v8.checkThread(); checkReleased(); if (that == this) { return true; } if (that == null) { return false; } if (!(that instanceof V8Value)) { return false; } if (isUndefined() && ((V8Value) that).isUndefined()) { return true; } if (((V8Value) that).isUndefined()) { return false; } return v8.equals(v8.getV8RuntimePtr(), getHandle(), ((V8Value) that).getHandle()); }