[gjs] support build with mozilla-js that compiled with --disable-threadsafe --enable-debug



commit 718746722ecd7ebbe459d6acc95bbb60d9e1ef34
Author: Maxim Ermilov <zaspire rambler ru>
Date:   Wed Mar 17 20:27:12 2010 +0300

    support build with mozilla-js that compiled with --disable-threadsafe --enable-debug
    
    https://bugzilla.gnome.org/show_bug.cgi?id=613106

 configure.ac     |   22 ----------------------
 gi/boxed.c       |    8 ++++----
 gi/keep-alive.c  |    1 +
 gi/object.c      |    6 +++---
 gi/param.c       |    6 +++---
 gi/union.c       |    8 ++++----
 gjs/jsapi-util.c |   10 +++++-----
 7 files changed, 20 insertions(+), 41 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 5f858c8..de2e7a0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -171,28 +171,6 @@ if test "$js_extra_cflags_needed" = yes; then
 fi
 AC_SUBST([JS_EXTRA_CFLAGS])
 
-# Check that SpiderMonkey is compiled with --enable-threadsafe, since
-# GJS needs JS_GetClass etc. to take a JSContext* argument.
-#
-# NOTE: This does not imply that GJS itself is thread-safe! (It isn't.)
-AC_MSG_CHECKING([if JS_GetClass is compatible])
-save_CFLAGS="$CFLAGS"
-CFLAGS="$CFLAGS $JS_CFLAGS $JS_EXTRA_CFLAGS"
-AC_COMPILE_IFELSE(
-    [AC_LANG_PROGRAM([[#include <jsapi.h>]], [[
-JSContext *cx = NULL;
-JSObject *obj = NULL;
-(void)JS_GetClass(cx, obj);
-                     ]])],
-    [js_getclass=yes],
-    [js_getclass=no])
-CFLAGS="$save_CFLAGS"
-AC_MSG_RESULT([$js_getclass])
-
-if test "$js_getclass" = no; then
-    AC_MSG_ERROR([SpiderMonkey needs to be compiled with --enable-threadsafe])
-fi
-
 common_packages="gobject-2.0 >= gobject_required_version $JS_PACKAGE"
 gjs_packages="gmodule-2.0 gthread-2.0 $common_packages"
 gjs_gi_packages="gobject-introspection-1.0 >= 0.6.3 $common_packages"
diff --git a/gi/boxed.c b/gi/boxed.c
index b121fd5..d3bc4ec 100644
--- a/gi/boxed.c
+++ b/gi/boxed.c
@@ -448,8 +448,8 @@ boxed_constructor(JSContext *context,
      * class as us, but if we're constructing an instance, the prototype
      * has the same class.
      */
-    obj_class = JS_GetClass(context, obj);
-    proto_class = JS_GetClass(context, proto);
+    obj_class = JS_GET_CLASS(context, obj);
+    proto_class = JS_GET_CLASS(context, proto);
 
     is_proto = (obj_class != proto_class);
 
@@ -1014,7 +1014,7 @@ gjs_lookup_boxed_class(JSContext    *context,
 
     prototype = gjs_lookup_boxed_prototype(context, info);
 
-    return JS_GetClass(context, prototype);
+    return JS_GET_CLASS(context, prototype);
 }
 
 /* Check if the type of the boxed is "simple" - every field is a non-pointer
@@ -1196,7 +1196,7 @@ gjs_define_boxed_class(JSContext    *context,
     g_base_info_ref( (GIBaseInfo*) priv->info);
 
     gjs_debug(GJS_DEBUG_GBOXED, "Defined class %s prototype is %p class %p in object %p",
-              constructor_name, prototype, JS_GetClass(context, prototype), in_object);
+              constructor_name, prototype, JS_GET_CLASS(context, prototype), in_object);
 
     priv->can_allocate_directly = struct_is_simple (priv->info);
 
diff --git a/gi/keep-alive.c b/gi/keep-alive.c
index c2a7703..160a9ca 100644
--- a/gi/keep-alive.c
+++ b/gi/keep-alive.c
@@ -148,6 +148,7 @@ trace_foreach(void *key,
     JSTracer *tracer = data;
 
     if (child->child != NULL) {
+        JS_SET_TRACING_DETAILS(tracer, NULL, "keep-alive", 0);
         JS_CallTracer(tracer, child->child, JSTRACE_OBJECT);
     }
 }
diff --git a/gi/object.c b/gi/object.c
index 6ea2c49..4d73fac 100644
--- a/gi/object.c
+++ b/gi/object.c
@@ -648,8 +648,8 @@ object_instance_constructor(JSContext *context,
      * class as us, but if we're constructing an instance, the prototype
      * has the same class.
      */
-    obj_class = JS_GetClass(context, obj);
-    proto_class = JS_GetClass(context, proto);
+    obj_class = JS_GET_CLASS(context, obj);
+    proto_class = JS_GET_CLASS(context, proto);
 
     is_proto = (obj_class != proto_class);
 
@@ -1392,7 +1392,7 @@ gjs_define_object_class(JSContext     *context,
     priv->gtype = gtype;
 
     gjs_debug(GJS_DEBUG_GOBJECT, "Defined class %s prototype %p class %p in object %p",
-              constructor_name, prototype, JS_GetClass(context, prototype), in_object);
+              constructor_name, prototype, JS_GET_CLASS(context, prototype), in_object);
 
     /* Now get the constructor we defined in
      * gjs_init_class_dynamic
diff --git a/gi/param.c b/gi/param.c
index 4e0387c..fb826c6 100644
--- a/gi/param.c
+++ b/gi/param.c
@@ -175,8 +175,8 @@ param_constructor(JSContext *context,
      * class as us, but if we're constructing an instance, the prototype
      * has the same class.
      */
-    obj_class = JS_GetClass(context, obj);
-    proto_class = JS_GetClass(context, proto);
+    obj_class = JS_GET_CLASS(context, obj);
+    proto_class = JS_GET_CLASS(context, proto);
 
     is_proto = (obj_class != proto_class);
 
@@ -364,7 +364,7 @@ gjs_define_param_class(JSContext    *context,
         *prototype_p = prototype;
 
     gjs_debug(GJS_DEBUG_GPARAM, "Defined class %s prototype is %p class %p in object %p",
-              constructor_name, prototype, JS_GetClass(context, prototype), in_object);
+              constructor_name, prototype, JS_GET_CLASS(context, prototype), in_object);
 
     return JS_TRUE;
 }
diff --git a/gi/union.c b/gi/union.c
index 5a9dfb2..ff99568 100644
--- a/gi/union.c
+++ b/gi/union.c
@@ -235,8 +235,8 @@ union_constructor(JSContext *context,
      * class as us, but if we're constructing an instance, the prototype
      * has the same class.
      */
-    obj_class = JS_GetClass(context, obj);
-    proto_class = JS_GetClass(context, proto);
+    obj_class = JS_GET_CLASS(context, obj);
+    proto_class = JS_GET_CLASS(context, proto);
 
     is_proto = (obj_class != proto_class);
 
@@ -417,7 +417,7 @@ gjs_lookup_union_class(JSContext    *context,
 
     prototype = gjs_lookup_union_prototype(context, info);
 
-    return JS_GetClass(context, prototype);
+    return JS_GET_CLASS(context, prototype);
 }
 
 JSBool
@@ -511,7 +511,7 @@ gjs_define_union_class(JSContext    *context,
     g_base_info_ref( (GIBaseInfo*) priv->info);
 
     gjs_debug(GJS_DEBUG_GBOXED, "Defined class %s prototype is %p class %p in object %p",
-              constructor_name, prototype, JS_GetClass(context, prototype), in_object);
+              constructor_name, prototype, JS_GET_CLASS(context, prototype), in_object);
 
     if (constructor_p) {
         *constructor_p = NULL;
diff --git a/gjs/jsapi-util.c b/gjs/jsapi-util.c
index 0240a7f..b40a4b3 100644
--- a/gjs/jsapi-util.c
+++ b/gjs/jsapi-util.c
@@ -436,7 +436,7 @@ gjs_get_instance_private_dynamic(JSContext      *context,
         return NULL;
     }
 
-    obj_class = JS_GetClass(context, obj);
+    obj_class = JS_GET_CLASS(context, obj);
     g_assert(obj_class != NULL);
 
     rd = get_data_from_context(context);
@@ -472,7 +472,7 @@ gjs_get_instance_private_dynamic_with_typecheck(JSContext      *context,
         return NULL;
     }
 
-    obj_class = JS_GetClass(context, obj);
+    obj_class = JS_GET_CLASS(context, obj);
     g_assert(obj_class != NULL);
 
     rd = get_data_from_context(context);
@@ -508,7 +508,7 @@ gjs_construct_object_dynamic(JSContext      *context,
      */
     load_context = gjs_runtime_get_load_context(JS_GetRuntime(context));
 
-    proto_class = JS_GetClass(load_context, proto);
+    proto_class = JS_GET_CLASS(load_context, proto);
 
     rd = get_data_from_context(load_context);
 
@@ -598,7 +598,7 @@ gjs_value_debug_string(JSContext      *context,
              */
             JSClass *klass;
 
-            klass = JS_GetClass(context, JSVAL_TO_OBJECT(value));
+            klass = JS_GET_CLASS(context, JSVAL_TO_OBJECT(value));
             if (klass != NULL) {
                 str = JS_NewStringCopyZ(context, klass->name);
                 JS_ClearPendingException(context);
@@ -1025,7 +1025,7 @@ gjs_date_from_time_t (JSContext *context, time_t time)
     if (!JS_GetProperty(context, date_constructor, "prototype", &date_prototype))
         gjs_fatal("Failed to get prototype from Date constructor");
 
-    date_class = JS_GetClass(context, JSVAL_TO_OBJECT (date_prototype));
+    date_class = JS_GET_CLASS(context, JSVAL_TO_OBJECT (date_prototype));
 
     if (!JS_NewNumberValue(context, ((double) time) * 1000, &(args[0])))
         gjs_fatal("Failed to convert time_t to number");



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]