-
Notifications
You must be signed in to change notification settings - Fork 851
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The $262 object does not use LiveConnect any more #1664
The $262 object does not use LiveConnect any more #1664
Conversation
|
||
// same as cx.evaluateString(scope, "var $262 = new __262__()", "<init>", 1, null); | ||
BaseFunction ctor = (BaseFunction) scope.get("__262__", scope); | ||
$262.install(scope, ctor.construct(cx, scope, new Object[0])); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The initialization looks a bit strange to me, maybe some experts can give me hints how do I write cleaner code here?
I also took __262__
as class name, which is somehow required
The initialization makes sense to me if it's using the reflection based attributes there. You could also just create a ScriptableObject and attach LambdaFunctions to it if you'd like to do it a different way -- the latter is a bit faster once it's set up. There's a method in ScriptableObject that does it quickly but it's protected -- but it could be public. |
proto.setPrototype(getObjectPrototype(scope)); | ||
proto.setParentScope(scope); | ||
|
||
proto.defineProperty("toSource", "Math", DONTENUM | READONLY | PERMANENT); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks strange to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copy-paste error
Great - the lambda thing is much better - at least from my point of view - thanks a lot |
0492c78
to
9caa579
Compare
Thanks -- looks good! |
I noticed, that the $262 object, which defines the host functions was wrapped into a NativeJavaObject.
In other words, the
@JsMethod
annotations were useless, instead, the methods were exposed by LiveConnect.In this PR, I've changed the $262 to a subclass of ScriptableObject, so that the annotations take place and we do not longer depend on LC when running the 262 tests.