I can build SpiderMonkey as a library and use it as a Javascript engine in my C++ application.
In the documentation is been specified that SpiderMonkey is threadsafe, but what does it mean since Javascript/Ecmascript doesn't currently even have a threading model. What kind of calls or expressions are qualified as "safe" with this phrase about SpiderMonkey ? It's just about a piece of C++ code calling any JS functionality from any C++ thread to the Javascript virtual machine ?
Thread-safety of a library means that the library can be used in a multithreaded environment. SpiderMonkey library can be integrated into a multithreaded C++ application. That has nothing to do with JavaScript language model.
However certain rules and restrictions apply. Theses rules are confusing as they have been changing from one version of the library to another and the documentation wasn't and still isn't very clear about them. Documentation pages often display notes like: "Deprecated since..." or "DRAFT IN PROGRESS...", or "Not Found 404".
Starting in Gecko 12.0 or SpiderMonkey 24, the rules are:
You may consider building a debug version of SpiderMonkey to test your integration. Try using flags:
Those add assertions in the library code to help catching thread (garbage collector, and memory) related problems earlier.