[gjs] xulrunner2: conditionally adapt to new Strict setters



commit 9697fe7640c378c759e676caeac3a42a05e0de75
Author: Marc-Antoine Perennou <Marc-Antoine Perennou com>
Date:   Sat Feb 12 20:13:49 2011 +0100

    xulrunner2: conditionally adapt to new Strict setters
    
    Upstream broke their API in commit:
    http://hg.mozilla.org/mozilla-central/rev/4b56bfdf61a7
    They added an extra arg to the setters, a JSBool to enable strict mode.
    Adapt setters to match the new API
    
    https://bugzilla.gnome.org/show_bug.cgi?id=642186

 configure.ac           |    1 +
 gi/boxed.c             |    5 ++++-
 gi/function.c          |    2 +-
 gi/keep-alive.c        |    2 +-
 gi/ns.c                |    2 +-
 gi/object.c            |    3 +++
 gi/param.c             |    2 +-
 gi/repo.c              |    2 +-
 gi/union.c             |    2 +-
 gjs/byteArray.c        |    9 +++++++++
 gjs/compat.h           |    4 ++++
 gjs/importer.c         |    2 +-
 gjs/jsapi-util.c       |    2 +-
 gjs/jsapi-util.h       |    2 +-
 modules/dbus-exports.c |    2 +-
 15 files changed, 31 insertions(+), 11 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 3da23d2..5ff896b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -152,6 +152,7 @@ fi
 AC_CHECK_LIB([mozjs], [JS_GetStringBytes], AC_DEFINE([HAVE_JS_GETSTRINGBYTES], [1], [Define if we still have JS_GetStringBytes]),, [$JS_LIBS])
 AC_CHECK_LIB([mozjs], [JS_GetFunctionName], AC_DEFINE([HAVE_JS_GETFUNCTIONNAME], [1], [Define if we still have JS_GetFunctionName]),, [$JS_LIBS])
 AC_CHECK_LIB([mozjs], [JS_GetStringChars], AC_DEFINE([HAVE_JS_GETSTRINGCHARS], [1], [Define if we still have JS_GetStringChars]),, [$JS_LIBS])
+AC_CHECK_LIB([mozjs], [JS_StrictPropertyStub], AC_DEFINE([HAVE_JS_STRICTPROPERTYSTUB], [1], [Define if we have JS_StrictPropertyStub]),, [$JS_LIBS])
 
 AC_MSG_CHECKING([for mozilla-js >= 2 ])
 if `$PKG_CONFIG --exists $JS_PACKAGE '>=' 2`; then
diff --git a/gi/boxed.c b/gi/boxed.c
index 9bdd513..405baaa 100644
--- a/gi/boxed.c
+++ b/gi/boxed.c
@@ -851,6 +851,9 @@ static JSBool
 boxed_field_setter (JSContext *context,
                     JSObject  *obj,
                     jsid       id,
+#ifdef HAVE_JS_STRICTPROPERTYSTUB
+                    JSBool     strict,
+#endif
                     jsval     *value)
 {
     Boxed *priv;
@@ -959,7 +962,7 @@ static struct JSClass gjs_boxed_class = {
     JS_PropertyStub,
     JS_PropertyStub,
     JS_PropertyStub,
-    JS_PropertyStub,
+    JS_StrictPropertyStub,
     JS_EnumerateStub,
     (JSResolveOp) boxed_new_resolve, /* needs cast since it's the new resolve signature */
     JS_ConvertStub,
diff --git a/gi/function.c b/gi/function.c
index 56fc5f5..f03b5ff 100644
--- a/gi/function.c
+++ b/gi/function.c
@@ -974,7 +974,7 @@ static struct JSClass gjs_function_class = {
     JS_PropertyStub,
     JS_PropertyStub,
     JS_PropertyStub,
-    JS_PropertyStub,
+    JS_StrictPropertyStub,
     JS_EnumerateStub,
     (JSResolveOp) function_new_resolve, /* needs cast since it's the new resolve signature */
     JS_ConvertStub,
diff --git a/gi/keep-alive.c b/gi/keep-alive.c
index 87fb2f0..028f900 100644
--- a/gi/keep-alive.c
+++ b/gi/keep-alive.c
@@ -187,7 +187,7 @@ static struct JSClass gjs_keep_alive_class = {
     JS_PropertyStub,
     JS_PropertyStub,
     JS_PropertyStub,
-    JS_PropertyStub,
+    JS_StrictPropertyStub,
     JS_EnumerateStub,
     JS_ResolveStub,
     JS_ConvertStub,
diff --git a/gi/ns.c b/gi/ns.c
index b6591ff..665af8a 100644
--- a/gi/ns.c
+++ b/gi/ns.c
@@ -213,7 +213,7 @@ static struct JSClass gjs_ns_class = {
     JS_PropertyStub,
     JS_PropertyStub,
     JS_PropertyStub,
-    JS_PropertyStub,
+    JS_StrictPropertyStub,
     JS_EnumerateStub,
     (JSResolveOp) ns_new_resolve, /* needs cast since it's the new resolve signature */
     JS_ConvertStub,
diff --git a/gi/object.c b/gi/object.c
index 4e04dce..25b561a 100644
--- a/gi/object.c
+++ b/gi/object.c
@@ -184,6 +184,9 @@ static JSBool
 object_instance_set_prop(JSContext *context,
                          JSObject  *obj,
                          jsid       id,
+#ifdef HAVE_JS_STRICTPROPERTYSTUB
+                         JSBool     strict,
+#endif
                          jsval     *value_p)
 {
     ObjectInstance *priv;
diff --git a/gi/param.c b/gi/param.c
index 1b03ad2..77b83af 100644
--- a/gi/param.c
+++ b/gi/param.c
@@ -259,7 +259,7 @@ static struct JSClass gjs_param_class = {
     JS_PropertyStub,
     JS_PropertyStub,
     param_get_prop,
-    JS_PropertyStub,
+    JS_StrictPropertyStub,
     JS_EnumerateStub,
     (JSResolveOp) param_new_resolve, /* needs cast since it's the new resolve signature */
     JS_ConvertStub,
diff --git a/gi/repo.c b/gi/repo.c
index 3381da1..097ca67 100644
--- a/gi/repo.c
+++ b/gi/repo.c
@@ -222,7 +222,7 @@ static struct JSClass gjs_repo_class = {
     JS_PropertyStub,
     JS_PropertyStub,
     JS_PropertyStub,
-    JS_PropertyStub,
+    JS_StrictPropertyStub,
     JS_EnumerateStub,
     (JSResolveOp) repo_new_resolve, /* needs cast since it's the new resolve signature */
     JS_ConvertStub,
diff --git a/gi/union.c b/gi/union.c
index b2978af..8d1ee6e 100644
--- a/gi/union.c
+++ b/gi/union.c
@@ -355,7 +355,7 @@ static struct JSClass gjs_union_class = {
     JS_PropertyStub,
     JS_PropertyStub,
     JS_PropertyStub,
-    JS_PropertyStub,
+    JS_StrictPropertyStub,
     JS_EnumerateStub,
     (JSResolveOp) union_new_resolve, /* needs cast since it's the new resolve signature */
     JS_ConvertStub,
diff --git a/gjs/byteArray.c b/gjs/byteArray.c
index a1d1ffe..02c627f 100644
--- a/gjs/byteArray.c
+++ b/gjs/byteArray.c
@@ -45,6 +45,9 @@ static JSBool byte_array_get_prop      (JSContext    *context,
 static JSBool byte_array_set_prop      (JSContext    *context,
                                         JSObject     *obj,
                                         jsid          id,
+#ifdef HAVE_JS_STRICTPROPERTYSTUB
+                                        JSBool        strict,
+#endif
                                         jsval        *value_p);
 static JSBool byte_array_new_resolve   (JSContext    *context,
                                         JSObject     *obj,
@@ -237,6 +240,9 @@ static JSBool
 byte_array_length_setter(JSContext *context,
                          JSObject  *obj,
                          jsid       id,
+#ifdef HAVE_JS_STRICTPROPERTYSTUB
+                         JSBool     strict,
+#endif
                          jsval     *value_p)
 {
     ByteArrayInstance *priv;
@@ -296,6 +302,9 @@ static JSBool
 byte_array_set_prop(JSContext *context,
                     JSObject  *obj,
                     jsid       id,
+#ifdef HAVE_JS_STRICTPROPERTYSTUB
+                    JSBool     strict,
+#endif
                     jsval     *value_p)
 {
     ByteArrayInstance *priv;
diff --git a/gjs/compat.h b/gjs/compat.h
index d418a22..09c2b98 100644
--- a/gjs/compat.h
+++ b/gjs/compat.h
@@ -135,6 +135,10 @@ gjs_##name##_constructor(JSContext *context,            \
 
 #endif
 
+#ifndef HAVE_JS_STRICTPROPERTYSTUB
+#define JS_StrictPropertyStub JS_PropertyStub
+#endif
+
 G_END_DECLS
 
 #endif  /* __GJS_COMPAT_H__ */
diff --git a/gjs/importer.c b/gjs/importer.c
index d875a38..fc5e16c 100644
--- a/gjs/importer.c
+++ b/gjs/importer.c
@@ -1021,7 +1021,7 @@ static struct JSClass gjs_importer_class = {
     JS_PropertyStub,
     JS_PropertyStub,
     JS_PropertyStub,
-    JS_PropertyStub,
+    JS_StrictPropertyStub,
     (JSEnumerateOp) importer_new_enumerate, /* needs cast since it's the new enumerate signature */
     (JSResolveOp) importer_new_resolve, /* needs cast since it's the new resolve signature */
     JS_ConvertStub,
diff --git a/gjs/jsapi-util.c b/gjs/jsapi-util.c
index 27260ca..cc89ab5 100644
--- a/gjs/jsapi-util.c
+++ b/gjs/jsapi-util.c
@@ -240,7 +240,7 @@ gjs_runtime_get_current_context(JSRuntime *runtime)
 
 static JSClass global_class = {
     "GjsGlobal", JSCLASS_GLOBAL_FLAGS,
-    JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub,
+    JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
     JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, JS_FinalizeStub,
     JSCLASS_NO_OPTIONAL_MEMBERS
 };
diff --git a/gjs/jsapi-util.h b/gjs/jsapi-util.h
index 5266ff0..4d61916 100644
--- a/gjs/jsapi-util.h
+++ b/gjs/jsapi-util.h
@@ -148,7 +148,7 @@ static struct JSClass gjs_##cname##_class = { \
     JS_PropertyStub, \
     JS_PropertyStub, \
     JS_PropertyStub, \
-    JS_PropertyStub,\
+    JS_StrictPropertyStub, \
     JS_EnumerateStub,\
     (JSResolveOp) gjs_##cname##_new_resolve, \
     JS_ConvertStub, \
diff --git a/modules/dbus-exports.c b/modules/dbus-exports.c
index e234bf8..d5c7198 100644
--- a/modules/dbus-exports.c
+++ b/modules/dbus-exports.c
@@ -1803,7 +1803,7 @@ static struct JSClass gjs_js_exports_class = {
     JS_PropertyStub,
     JS_PropertyStub,
     JS_PropertyStub,
-    JS_PropertyStub,
+    JS_StrictPropertyStub,
     JS_EnumerateStub,
     (JSResolveOp) exports_new_resolve, /* needs cast since it's the new resolve signature */
     JS_ConvertStub,



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