JS-Engine FAQ


Spidermonkey

How long are private pointers?

2-byte aligned. Check the JSVAL macros at the top of js/src/jsapi.h

Can an embedded SpiderMonkey JS Engine use DOMParser extension of Mozilla?

DOMParser is not part of JS but part of Mozilla browser which makes it available to script in the browser using XPConnect. An alternative would be to use built-in E4X.

Newly created threads in JS from MOZILLA_1_8_BRANCH causes to hang in Windows

Patch from bugĀ 351602 should fix the problem. After applying that patch, recompile JS and define JS_USE_ONLY_NSPR_LOCKS in the build.

Spidermonkey library loading mechanism?

To write wrappers in pure JavaScript to interface with any C library on the system there are mechanisms such as xpcshell, wxjs, jsdb, JSNI

Coding Spidermonkey in C

check out this tutorial

How to compile Tamarin on Linux/x86

There is a patch that allows you to compile it.

Rhino

What is the performance between Rhino JS and native Java

Rhino JS is significantly slower in run-time than native Java. Even when Rhino is pre-compiled with high optimization, it still is no match for a compiled Java program.

How to determine Rhino version programatically?

You can call getImplementationVersion() on a Context instance and it gives you a string, e.g. <tt>Rhino 1.6 release 2 2005 09 19</tt>.

How to compile JavaScript into Java

Invoking compiler: java org.mozilla.javascript.tools.jsc.Main [options] file1.js [file2.js...]
This results in a class file.
Compiler options can be vied here.

Non-js-engine questions

Can I call functions in Mozilla extensions from web page?

No, accessing anything in the web page's script may lead to security problems. See XPCNativeWrapper.

Document Tags and Contributors

 Contributors to this page: fscholz, Dtolj, Dria, Nickolay
 Last updated by: fscholz,