After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 639691 - gjs segfaults on newest libmozjs because of missing compartments
gjs segfaults on newest libmozjs because of missing compartments
Status: RESOLVED FIXED
Product: gjs
Classification: Bindings
Component: general
unspecified
Other Linux
: Normal major
: ---
Assigned To: gjs-maint
gjs-maint
Depends on:
Blocks:
 
 
Reported: 2011-01-16 19:05 UTC by Jasper St. Pierre (not reading bugmail)
Modified: 2011-01-17 16:12 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
backtrace (2.43 KB, text/plain)
2011-01-16 19:06 UTC, Jasper St. Pierre (not reading bugmail)
  Details
Fix the segfault (1.06 KB, patch)
2011-01-16 20:08 UTC, Marc-Antoine Perennou
reviewed Details | Review
Fix the segfault (2.10 KB, patch)
2011-01-17 15:29 UTC, Marc-Antoine Perennou
none Details | Review
Fix the segfault (2.05 KB, patch)
2011-01-17 15:32 UTC, Marc-Antoine Perennou
accepted-commit_now Details | Review
Add support and don't crash on libmozjs 2.0. (1.90 KB, patch)
2011-01-17 15:43 UTC, Jasper St. Pierre (not reading bugmail)
none Details | Review

Description Jasper St. Pierre (not reading bugmail) 2011-01-16 19:05:30 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/
Comment 1 Jasper St. Pierre (not reading bugmail) 2011-01-16 19:06:00 UTC
Created attachment 178454 [details]
backtrace
Comment 2 Marc-Antoine Perennou 2011-01-16 20:08:14 UTC
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
Comment 3 Colin Walters 2011-01-17 15:21:23 UTC
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.
Comment 4 Marc-Antoine Perennou 2011-01-17 15:29:48 UTC
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
Comment 5 Marc-Antoine Perennou 2011-01-17 15:32:17 UTC
Created attachment 178522 [details] [review]
Fix the segfault

Typso ...
Comment 6 Jasper St. Pierre (not reading bugmail) 2011-01-17 15:43:16 UTC
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>
Comment 7 Jasper St. Pierre (not reading bugmail) 2011-01-17 15:45:25 UTC
gah, we just made the same patch :)
Comment 8 Colin Walters 2011-01-17 16:10:54 UTC
Review of attachment 178522 [details] [review]:

Looks good.