These release notes are an incomplete draft and were initially seeded from the SpiderMonkey 17 release notes, so they're not necessarily complete or fully accurate.
— Dec 16, 2013
SpiderMonkey 24 is supported on all the platforms where Firefox 24 runs. Compiling it requires a C++ compiler, and the JSAPI can only be used from C++ code. (This change was motivated by garbage collector improvements, which lean quite heavily on C++'s support for RAII through constructors and destructors.) If you are compiling with Microsoft's Visual Studio, note that the minimum supported version is MSVC10/2010: MSVC8/9 support has been dropped.
Migrating to SpiderMonkey 24
SpiderMonkey now provides a fully C++ interface, so embedders relying on embeddability in C projects will have to convert to C++, or implement their own adapter code.
The following features in earlier versions of SpiderMonkey have been dropped.
- JaegerMonkey has been removed and replaced by IonMonkey
SpiderMonkey 24 is not binary-compatible with previous releases, nor is it source-code compatible. Many JSAPI types, functions, and callback signatures have changed, though most of them still have the same names and do the same things. Applications will need significant changes, but most of those changes will be detected by the C/C++ compiler, so they are easy to detect and updating the code is a fairly straightforward job. Here is a list of the most significant changes.
- Many of the garbage collector changes require type signature changes to JSAPI methods: specifically introducing JS::Rooted, JS::Handle, and JS::MutableHandle types. These types, with the appropriate parametrizations, can roughly be substituted for plain types of GC things (values, string/object pointers, etc.).
These and other changes are explained in detail below.
The fixed-size integer types introduced in SpiderMonkey 17 are defined in one of the following ways (XXX update for MSVC<10 deprecation):
- If the environment variable
MOZ_CUSTOM_STDINT_His set, that file will be included to provide definitions for these types. The file must conform to the standard C99
<stdint.h>header interface in all respects, providing all that header's types and macro definitions. (The msstdint project includes an implementation of this header for Microsoft Visual Studio which demonstrates what the C99 interface looks like.)
- Otherwise, if the compiler doesn't provide a usable
<stdint.h>header, a custom implementation shipped with the SpiderMonkey source is used. Currently only versions of Visual Studio prior to 2010 (also known as version 10) are known to be deficient in this manner, so the custom implementation (which is compatible with the one shipped in Visual Studio 2010 and later) is only invoked for those compilers.
The environment variable is provided as a solution for embedders whose code requires particular definitions of those types, and those particular definitions are incompatible with the standard definitions or the custom implementation needed for older versions of Visual Studio. In the long run we anticipate removing the environment variable-based overriding when we drop support for versions of Visual Studio prior to 2010. In the meantime
MOZ_CUSTOM_STDINT_H is intended to function as a bridge to always using the standard header.
For more information on the fixed-size integer types changes, see this blog post.
New C APIs
JS_GetArrayPrototypeprovides access to the original value of
New C++ helpers
While JSAPI remains a C API, the engine is now implemented in C++. Some C++ helpers have been introduced into the API, to help embedders writing C++ projects. Please note that SpiderMonkey reserves the
JS:: namespace for itself (and the
js:: namespace for internal use).
...list new C++ helpers here...
...list obsolete methods/structs/APIs here...
- JS_GET_CLASS (use
- ...list other deleted APIs...
Break out and discuss all API changes here...
JSOPTION_STRICT has been renamed to
JS_SetVersion has been removed, JS Version is now set on the compartment instead of context.
JS_GetPrototype, takes context as first argument
JS_EncodeStringToBuffer takes add context as first argument,
JS_NewRuntime adds a JS_[USE|NO]_HELPER_THREADS flag
Delete property in JSClass definitions now use JS_DeletePropertyStub
Garbage Collection functions now take runtime argument
Most garbage collection functions now take a runtime argument instead of a context. The one exception to this is
JS_MaybeGC which still takes a context as argument.
Detail added/removed methods here...
Detail any known issues here...
...insert details on future plans...
SpiderMonkey embedders should be aware that
- Mozilla has no plans to keep the JSAPI, nor the JSDBGAPI stable for embedders. We have chosen to concentrate on performance and correctness as primary concerns instead.
- The team is considering the removal of TinyIDs
- JS_THREADSAFE is going away, with future versions supporting only thread-safe builds
- A new debugging API is on the way to replace JSD.
Release Notes Errata
This is a list of changes which need to be made to the release notes ASAP. Feel free to fix any problems you spot -- this is a Wiki!
- Don't add anything here -- this is for after the release notes are completed. :-)