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 638731 - Adapt to JS_GetStringChars removal in xulrunner 2
Adapt to JS_GetStringChars removal in xulrunner 2
Status: RESOLVED FIXED
Product: gjs
Classification: Bindings
Component: general
unspecified
Other Linux
: Normal blocker
: ---
Assigned To: gjs-maint
gjs-maint
Depends on:
Blocks:
 
 
Reported: 2011-01-05 10:00 UTC by Quentin "Sardem FF7" Glidic
Modified: 2011-01-05 23:33 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to fix GJS with configure.ac check (3.30 KB, patch)
2011-01-05 10:00 UTC, Quentin "Sardem FF7" Glidic
reviewed Details | Review
Patch to fix GJS with configure.ac other check (3.30 KB, patch)
2011-01-05 23:05 UTC, Quentin "Sardem FF7" Glidic
reviewed Details | Review
Patch to fix GJS with configure.ac other check (3.73 KB, patch)
2011-01-05 23:16 UTC, Quentin "Sardem FF7" Glidic
committed Details | Review

Description Quentin "Sardem FF7" Glidic 2011-01-05 10:00:52 UTC
Created attachment 177558 [details] [review]
Patch to fix GJS with configure.ac check

Another removal in the xulrunner 2 JSAPI.
JS_GetStringChars was considered as fallible.

http://hg.mozilla.org/mozilla-central/rev/cc6d97b432cc#l39.102
Comment 1 Colin Walters 2011-01-05 22:56:40 UTC
Review of attachment 177558 [details] [review]:

::: configure.ac
@@ +152,1 @@
 

I'd prefer to flip around the check; look for JS_GetStringCharsAndLength.
Comment 2 Colin Walters 2011-01-05 22:56:40 UTC
Review of attachment 177558 [details] [review]:

::: configure.ac
@@ +152,1 @@
 

I'd prefer to flip around the check; look for JS_GetStringCharsAndLength.
Comment 3 Quentin "Sardem FF7" Glidic 2011-01-05 23:05:30 UTC
Created attachment 177623 [details] [review]
Patch to fix GJS with configure.ac other check
Comment 4 Colin Walters 2011-01-05 23:09:03 UTC
Review of attachment 177623 [details] [review]:

::: gjs/byteArray.c
@@ +680,3 @@
 
+#ifdef HAVE_JS_GETSTRINGCHARSANDLENGTH
+        u16_chars = JS_GetStringCharsAndLength(context, JSVAL_TO_STRING(argv[0]), &u16_len);

Note that the point of the Mozilla change was that JS_GetStringCharsAndLength became a *failable* API.  So we need to do:

if (u16_chars == NULL)
  return JS_FALSE;

::: gjs/jsapi-util-string.c
@@ +52,3 @@
 
+#ifdef HAVE_JS_GETSTRINGCHARSANDLENGTH
+    s = JS_GetStringCharsAndLength(context, JSVAL_TO_STRING(string_val), &s_length);

Ditto here.
Comment 5 Quentin "Sardem FF7" Glidic 2011-01-05 23:16:59 UTC
Created attachment 177624 [details] [review]
Patch to fix GJS with configure.ac other check

It should be safe now, and I added some code to cleanly fail.