Friday, 29 June 2012

Re: JavaScript

On Fri, 29 Jun 2012 17:28:39 +0100, Vincent Sanders wrote:

> A simple javascript abstraction has been added allowing for
> alternative javascript interpreters to be added in future. And an
> initial implementation added for the spidermonkey interpreter/jit
> (jsapi) this integration allows for javascript code to be correctly
> gathered and executed from script tags.

That's good to hear. Spidermonkey is perhaps a bit "heavy", partly
due to being C++ (so the std C++ lib has to be loaded too), and
current versions are awkward to port due to the dependency on NSPR
(although there is a Bugzilla open to remove this dependency which I'm
keeping my eye on). Unfortunately it's probably our best option - I
don't know of any decent lighter Javascript engines.

> What is now required is to add bindings to the javascript runtime for
> all the DOM operations including the so called DOM0 objects like the
> global window object and all the associated sub objects like
> navigator, console etc.

Would that need to be done again if somebody decides to add support
for a different Javascript library?

> Although there is no explicit dependency on
> specific versions of spidermonkey I am primarily basing my efforts on
> the 1.8.5 releases as this are the most common version found in
> distributions.

v1.50-2 (which is positively prehistoric, but the only working ported
version I have) unfortunately does not work, I fudged it with some
macros from newer Spidermonkey includes, and it is calling alert
(warn_user()) but with no text. Not sure if it is easy to get it
working, for such an old version it's probably not worth it. I have
a quick port of Spidermonkey 1.85 but having issues with it crashing;
I guess I have quite a while to fix this though.

I'd be interested to hear which versions of Spidermonkey are ported to
other operating systems we target (and any porting tips!)

Chris

No comments:

Post a Comment