textbender.o.rhinohide
Class Rhinohide

java.lang.Object
  extended by Rhinohide
Direct Known Subclasses:
RhiDOMImplementation, RhiEvent, RhiEventTarget, RhiNamedNodeMap, RhiNodeList, RhiRange, RhiSelection, RhiTreeWalker

@ThreadSafe
public class Rhinohide
extends Object

An overlay/wrapper of a JavaScript object, based on an intermediate JSObject bridge.

BUG: lebensRAM

http://zelea.com/var/cache/textbender-javadoc/textbender/o/rhinohide/Rhinohide.html#lebensRAM

Was intermittent on system/host/tinman/windows.xht, both IE and Firefox. Different failure modes, including crash of browser. Probable concurrency bug in the underlying JSObject bridge.

Moved to Java 1.6, and added memory to that Windows box. Bug has not recurred.

See Also:
LiveConnect documentation, JSObject in the LiveConnect API, JSObject as implmented for the Java Plug-In

Field Summary
protected  RhiWindow window
           
 
Constructor Summary
protected Rhinohide(netscape.javascript.JSObject jsObject)
           
  Rhinohide(RhiWindow window, netscape.javascript.JSObject jsObject)
          Creates a Rhinohide.
 
Method Summary
 Object call(String methodName, Object... arguments)
          Calls a method on the underlying JavaScript object, via the bridge.
 Object callV(String methodName, Object... arguments)
          Same as checkV(call(methodName, arguments)).
static Object checkV(Object object)
           
 boolean equals(Object o)
          Returns true iff o is a Rhinohide, and has an 'equal' JSObject bridge.
 Object eval(String expression)
          Evaluates an expression in the context of the underlying JavaScript object, via the bridge.
 Object evalV(String expression)
          Same as checkV(eval(expression)).
 Object getMember(String name)
          Returns a property of the underlying JavaScript object, via the bridge.
 Object getMemberV(String name)
          Same as checkV(getMember(name)).
 int hashCode()
          Defers to the bridge, returning jsObject.hashCode().
 netscape.javascript.JSObject jsObject()
          Bridge to underlying JavaScript object.
 void setMember(String name, Object value)
          Sets a property of the underlying JavaScript object, via the bridge.
static netscape.javascript.JSObject toJSObject(Rhinohide rhinohide)
           
 String toString()
          Defers to the bridge, returning jsObject.toString().
 RhiWindow window()
          The global object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

window

protected RhiWindow window
Constructor Detail

Rhinohide

public Rhinohide(RhiWindow window,
                 netscape.javascript.JSObject jsObject)
Creates a Rhinohide.

Parameters:
window - global object
jsObject - bridge to underlying JavaScript object, per jsObject()

Rhinohide

protected Rhinohide(netscape.javascript.JSObject jsObject)
Method Detail

checkV

public static Object checkV(Object object)
Returns:
the same object
Throws:
StunnedRhinoException - if the object is null
See Also:
callV(String,Object...), evalV(String), getMemberV(String)

jsObject

public final netscape.javascript.JSObject jsObject()
Bridge to underlying JavaScript object. It is never null.

Ordinary clients ought not to call methods of the underlying JavaScript object directly. Instead, they ought to call the equivalent methods of this Rhinohide wrapper.


toJSObject

public static netscape.javascript.JSObject toJSObject(Rhinohide rhinohide)
Returns:
rhinohide.jsObject(); or null if rhinohide is null

window

public RhiWindow window()
The global object.


call

public Object call(String methodName,
                   Object... arguments)
Calls a method on the underlying JavaScript object, via the bridge. Equivalent to jsObject().call(). Equivalent to JavaScript:
     object.methodName( arguments );
     


callV

public Object callV(String methodName,
                    Object... arguments)
Same as checkV(call(methodName, arguments)).

Throws:
StunnedRhinoException - if the result is null

eval

public Object eval(String expression)
Evaluates an expression in the context of the underlying JavaScript object, via the bridge. Equivalent to jsObject().eval(). Similar to JavaScript:
     object.eval( expression );

BUG: stubborn-rhino

http://zelea.com/var/cache/textbender-javadoc/textbender/o/rhinohide/Rhinohide.html#stubborn-rhino

Repeatable on system/host/tinman/windows.xht#firefox. JSObject.eval() and call() fail, after a time. Failure may occur some time into applet initialization; or after interruption by an alert box. It consistently occurs on that host for all post-init access, e.g. via RMI worker threads, or the AWT event dispatch thread.

On failure, JSObject.eval() calls no longer have effect, and always return null. And JSObject.call(method) always returns null for custom methods; those defined in page content scripts, as well as those defined in previous calls to eval().


evalV

public Object evalV(String expression)
Same as checkV(eval(expression)).

Throws:
StunnedRhinoException - if the result is null

getMember

public Object getMember(String name)
Returns a property of the underlying JavaScript object, via the bridge. Equivalent to jsObject().getMember(). Similar to JavaScript:
     object.name;
     


getMemberV

public Object getMemberV(String name)
Same as checkV(getMember(name)).

Throws:
StunnedRhinoException - if the result is null

setMember

public void setMember(String name,
                      Object value)
Sets a property of the underlying JavaScript object, via the bridge. Equivalent to jsObject().setMember(). Equivalent to JavaScript:
     object.name = value;
     


equals

public boolean equals(Object o)
Returns true iff o is a Rhinohide, and has an 'equal' JSObject bridge.

Overrides:
equals in class Object

hashCode

public int hashCode()
Defers to the bridge, returning jsObject.hashCode().

Overrides:
hashCode in class Object

toString

public String toString()
Defers to the bridge, returning jsObject.toString().

Overrides:
toString in class Object