Make cast() in JavaScriptObject behave a little more realistically. This will allow it to be used in situations where the cast would be valid in Java, but not in general situations as would be allowed in Javascript.