GNOME Bugzilla – Bug 639691
gjs segfaults on newest libmozjs because of missing compartments
Last modified: 2011-01-17 16:12:17 UTC
<magcius> http://fpaste.org/jbHX/ <shaver> yep, compartment is NULL <shaver> before evaluating, you need to enter a compartment (a GC domain, basically) <shaver> gal: ^^ <gal> here <gal> looking <gal> there is JS_NewGlobalObjectAndCompartment <gal> that makes a compartment for you <gal> and you want to enter that <gal> JSAutoEnterCompartment <gal> we have to get the docs up to speed on this, I will chat with jorendorff monday libmozjs broke API with the new GC Compartments stuff... http://andreasgal.wordpress.com/2010/10/13/compartments/
Created attachment 178454 [details] backtrace
Created attachment 178459 [details] [review] Fix the segfault I hit the same problem today, and debugging it I found that NULL compartment too, then I got to this patch, all is working fine with it
Review of attachment 178459 [details] [review]: We need to actually detect the availability of the function and use it conditionally, otherwise we break on a pre-compartment snapshot.
Created attachment 178520 [details] [review] Fix the segfault I didn't add that check cause this function seems to be implemented since a while, but here it is
Created attachment 178522 [details] [review] Fix the segfault Typso ...
Created attachment 178523 [details] [review] Add support and don't crash on libmozjs 2.0. Use JS_NewCompartmentAndGlobalObject if it is available rather than JS_NewGlobalObject to be sure that we use the new GC compartment APIs and avoid a segfault with libmozjs 2.0. Based on a patch by Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
gah, we just made the same patch :)
Review of attachment 178522 [details] [review]: Looks good.