[gjs/wip/xulrunner-1.9.3: 4/5] xulrunner 1.9.3: Fix assumption that jsid == jsval
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/wip/xulrunner-1.9.3: 4/5] xulrunner 1.9.3: Fix assumption that jsid == jsval
- Date: Fri, 17 Sep 2010 22:55:54 +0000 (UTC)
commit 488038f6ce393b9eee264255bee041242beacf3c
Author: Colin Walters <walters verbum org>
Date: Thu Sep 16 19:40:11 2010 -0400
xulrunner 1.9.3: Fix assumption that jsid == jsval
The two have always been conceptually distinct types. Even in 1.9.3,
they are still the same in implementation, but to avoid a pile of
warnings, we should avoid confusing them. Unfortunately, even the
SpiderMonkey docs are wrong in a few places, so gjs' code confusing
them is understandable.
Anyways, fix up places that made this assumption.
gi/arg.c | 6 +++---
gi/boxed.c | 30 +++++++++++++++---------------
gi/function.c | 4 ++--
gi/ns.c | 4 ++--
gi/object.c | 28 ++++++++++++----------------
gi/param.c | 8 ++++----
gi/repo.c | 4 ++--
gi/union.c | 4 ++--
gjs/byteArray.c | 36 ++++++++++++++++++++++++------------
gjs/compat.h | 12 ++++++++++++
gjs/importer.c | 16 ++++++----------
gjs/jsapi-util-string.c | 11 +++++++++--
gjs/jsapi-util.c | 14 +++++---------
gjs/jsapi-util.h | 3 ++-
modules/dbus-exports.c | 10 +++++-----
modules/dbus-values.c | 6 +++---
modules/dbus.c | 7 ++++---
17 files changed, 112 insertions(+), 91 deletions(-)
---
diff --git a/gi/arg.c b/gi/arg.c
index 92ee871..19f3449 100644
--- a/gi/arg.c
+++ b/gi/arg.c
@@ -298,7 +298,7 @@ gjs_object_to_g_hash(JSContext *context,
if (iter == NULL)
return JS_FALSE;
- prop_id = JSVAL_VOID;
+ prop_id = JSID_VOID;
if (!JS_NextProperty(context, iter, &prop_id))
return JS_FALSE;
@@ -307,7 +307,7 @@ gjs_object_to_g_hash(JSContext *context,
* Rely on the type-aware g_argument_release functions. */
result = g_hash_table_new(g_str_hash, g_str_equal);
- while (prop_id != JSVAL_VOID) {
+ while (!JSID_IS_VOID(prop_id)) {
jsval key_js, val_js;
GArgument key_arg, val_arg;
@@ -340,7 +340,7 @@ gjs_object_to_g_hash(JSContext *context,
g_hash_table_insert(result, key_arg.v_pointer, val_arg.v_pointer);
- prop_id = JSVAL_VOID;
+ prop_id = JSID_VOID;
if (!JS_NextProperty(context, iter, &prop_id))
goto free_hash_and_fail;
}
diff --git a/gi/boxed.c b/gi/boxed.c
index 89eaab4..8615e00 100644
--- a/gi/boxed.c
+++ b/gi/boxed.c
@@ -83,7 +83,7 @@ GJS_DEFINE_DYNAMIC_PRIV_FROM_JS(Boxed, gjs_boxed_class)
static JSBool
boxed_new_resolve(JSContext *context,
JSObject *obj,
- jsval id,
+ jsid id,
uintN flags,
JSObject **objp)
{
@@ -92,7 +92,7 @@ boxed_new_resolve(JSContext *context,
*objp = NULL;
- if (!gjs_get_string_id(id, &name))
+ if (!gjs_get_string_id(context, id, &name))
return JS_TRUE; /* not resolved, but no error */
priv = priv_from_js(context, obj);
@@ -327,20 +327,16 @@ boxed_init_from_props(JSContext *context,
field_map = get_field_map(priv->info);
- prop_id = JSVAL_VOID;
+ prop_id = JSID_VOID;
if (!JS_NextProperty(context, iter, &prop_id))
goto out;
- while (prop_id != JSVAL_VOID) {
+ while (!JSID_IS_VOID(prop_id)) {
GIFieldInfo *field_info;
- jsval nameval;
const char *name;
jsval value;
- if (!JS_IdToValue(context, prop_id, &nameval))
- goto out;
-
- if (!gjs_get_string_id(nameval, &name))
+ if (!gjs_get_string_id(context, prop_id, &name))
goto out;
field_info = g_hash_table_lookup(field_map, name);
@@ -357,7 +353,7 @@ boxed_init_from_props(JSContext *context,
goto out;
}
- prop_id = JSVAL_VOID;
+ prop_id = JSID_VOID;
if (!JS_NextProperty(context, iter, &prop_id))
goto out;
}
@@ -591,17 +587,21 @@ boxed_finalize(JSContext *context,
static GIFieldInfo *
get_field_info (JSContext *context,
Boxed *priv,
- jsval id)
+ jsid id)
{
int field_index;
+ jsval id_val;
+
+ if (!JS_IdToValue(context, id, &id_val))
+ return JS_FALSE;
- if (!JSVAL_IS_INT (id)) {
+ if (!JSVAL_IS_INT (id_val)) {
gjs_throw(context, "Field index for %s is not an integer",
g_base_info_get_name ((GIBaseInfo *)priv->info));
return NULL;
}
- field_index = JSVAL_TO_INT(id);
+ field_index = JSVAL_TO_INT(id_val);
if (field_index < 0 || field_index >= g_struct_info_get_n_fields (priv->info)) {
gjs_throw(context, "Bad field index %d for %s", field_index,
g_base_info_get_name ((GIBaseInfo *)priv->info));
@@ -660,7 +660,7 @@ get_nested_interface_object (JSContext *context,
static JSBool
boxed_field_getter (JSContext *context,
JSObject *obj,
- jsval id,
+ jsid id,
jsval *value)
{
Boxed *priv;
@@ -839,7 +839,7 @@ out:
static JSBool
boxed_field_setter (JSContext *context,
JSObject *obj,
- jsval id,
+ jsid id,
jsval *value)
{
Boxed *priv;
diff --git a/gi/function.c b/gi/function.c
index fe1e3c8..12fc6e4 100644
--- a/gi/function.c
+++ b/gi/function.c
@@ -102,7 +102,7 @@ GJS_DEFINE_PRIV_FROM_JS(Function, gjs_function_class)
static JSBool
function_new_resolve(JSContext *context,
JSObject *obj,
- jsval id,
+ jsid id,
uintN flags,
JSObject **objp)
{
@@ -111,7 +111,7 @@ function_new_resolve(JSContext *context,
*objp = NULL;
- if (!gjs_get_string_id(id, &name))
+ if (!gjs_get_string_id(context, id, &name))
return JS_TRUE; /* not resolved, but no error */
priv = priv_from_js(context, obj);
diff --git a/gi/ns.c b/gi/ns.c
index 85652dd..d8aaad3 100644
--- a/gi/ns.c
+++ b/gi/ns.c
@@ -62,7 +62,7 @@ GJS_DEFINE_PRIV_FROM_JS(Ns, gjs_ns_class)
static JSBool
ns_new_resolve(JSContext *context,
JSObject *obj,
- jsval id,
+ jsid id,
uintN flags,
JSObject **objp)
{
@@ -74,7 +74,7 @@ ns_new_resolve(JSContext *context,
*objp = NULL;
- if (!gjs_get_string_id(id, &name))
+ if (!gjs_get_string_id(context, id, &name))
return JS_TRUE; /* not resolved, but no error */
/* let Object.prototype resolve these */
diff --git a/gi/object.c b/gi/object.c
index caacce5..77791e6 100644
--- a/gi/object.c
+++ b/gi/object.c
@@ -120,7 +120,7 @@ init_g_param_from_property(JSContext *context,
static JSBool
object_instance_get_prop(JSContext *context,
JSObject *obj,
- jsval id,
+ jsid id,
jsval *value_p)
{
ObjectInstance *priv;
@@ -129,7 +129,7 @@ object_instance_get_prop(JSContext *context,
GParamSpec *param;
GValue gvalue = { 0, };
- if (!gjs_get_string_id(id, &name))
+ if (!gjs_get_string_id(context, id, &name))
return JS_TRUE; /* not resolved, but no error */
priv = priv_from_js(context, obj);
@@ -177,14 +177,14 @@ object_instance_get_prop(JSContext *context,
static JSBool
object_instance_set_prop(JSContext *context,
JSObject *obj,
- jsval id,
+ jsid id,
jsval *value_p)
{
ObjectInstance *priv;
const char *name;
GParameter param = { NULL, { 0, }};
- if (!gjs_get_string_id(id, &name))
+ if (!gjs_get_string_id(context, id, &name))
return JS_TRUE; /* not resolved, but no error */
priv = priv_from_js(context, obj);
@@ -238,7 +238,7 @@ object_instance_set_prop(JSContext *context,
static JSBool
object_instance_new_resolve(JSContext *context,
JSObject *obj,
- jsval id,
+ jsid id,
uintN flags,
JSObject **objp)
{
@@ -247,7 +247,7 @@ object_instance_new_resolve(JSContext *context,
*objp = NULL;
- if (!gjs_get_string_id(id, &name))
+ if (!gjs_get_string_id(context, id, &name))
return JS_TRUE; /* not resolved, but no error */
priv = priv_from_js(context, obj);
@@ -458,27 +458,23 @@ object_instance_props_to_g_parameters(JSContext *context,
return JS_FALSE;
}
- prop_id = JSVAL_VOID;
+ prop_id = JSID_VOID;
if (!JS_NextProperty(context, iter, &prop_id))
return JS_FALSE;
- if (prop_id != JSVAL_VOID) {
+ if (!JSID_IS_VOID(prop_id)) {
gparams = g_array_new(/* nul term */ FALSE, /* clear */ TRUE,
sizeof(GParameter));
} else {
return JS_TRUE;
}
- while (prop_id != JSVAL_VOID) {
- jsval nameval;
+ while (!JSID_IS_VOID(prop_id)) {
const char *name;
jsval value;
GParameter gparam = { NULL, { 0, }};
- if (!JS_IdToValue(context, prop_id, &nameval))
- goto free_array_and_fail;
-
- if (!gjs_get_string_id(nameval, &name))
+ if (!gjs_get_string_id(context, prop_id, &name))
goto free_array_and_fail;
if (!gjs_object_require_property(context, props, "property list", name, &value))
@@ -500,7 +496,7 @@ object_instance_props_to_g_parameters(JSContext *context,
g_array_append_val(gparams, gparam);
- prop_id = JSVAL_VOID;
+ prop_id = JSID_VOID;
if (!JS_NextProperty(context, iter, &prop_id))
goto free_array_and_fail;
}
@@ -858,7 +854,7 @@ real_connect_func(JSContext *context,
const char *signal_name;
GQuark signal_detail;
- *retval = INT_TO_JSVAL(0);
+ *retval = JSID_VOID;
priv = priv_from_js(context, obj);
gjs_debug_gsignal("connect obj %p priv %p argc %d", obj, priv, argc);
diff --git a/gi/param.c b/gi/param.c
index fb826c6..fa7d7af 100644
--- a/gi/param.c
+++ b/gi/param.c
@@ -49,14 +49,14 @@ GJS_DEFINE_DYNAMIC_PRIV_FROM_JS(Param, gjs_param_class)
static JSBool
param_get_prop(JSContext *context,
JSObject *obj,
- jsval id,
+ jsid id,
jsval *value_p)
{
Param *priv;
const char *name;
const char *value_str;
- if (!gjs_get_string_id(id, &name))
+ if (!gjs_get_string_id(context, id, &name))
return JS_TRUE; /* not something we affect, but no error */
priv = priv_from_js(context, obj);
@@ -98,7 +98,7 @@ param_get_prop(JSContext *context,
static JSBool
param_new_resolve(JSContext *context,
JSObject *obj,
- jsval id,
+ jsid id,
uintN flags,
JSObject **objp)
{
@@ -107,7 +107,7 @@ param_new_resolve(JSContext *context,
*objp = NULL;
- if (!gjs_get_string_id(id, &name))
+ if (!gjs_get_string_id(context, id, &name))
return JS_TRUE; /* not resolved, but no error */
priv = priv_from_js(context, obj);
diff --git a/gi/repo.c b/gi/repo.c
index cff1b24..b5786b8 100644
--- a/gi/repo.c
+++ b/gi/repo.c
@@ -123,7 +123,7 @@ resolve_namespace_object(JSContext *context,
static JSBool
repo_new_resolve(JSContext *context,
JSObject *obj,
- jsval id,
+ jsid id,
uintN flags,
JSObject **objp)
{
@@ -133,7 +133,7 @@ repo_new_resolve(JSContext *context,
*objp = NULL;
- if (!gjs_get_string_id(id, &name))
+ if (!gjs_get_string_id(context, id, &name))
return JS_TRUE; /* not resolved, but no error */
/* let Object.prototype resolve these */
diff --git a/gi/union.c b/gi/union.c
index ff99568..7f5c92f 100644
--- a/gi/union.c
+++ b/gi/union.c
@@ -67,7 +67,7 @@ GJS_DEFINE_DYNAMIC_PRIV_FROM_JS(Union, gjs_union_class)
static JSBool
union_new_resolve(JSContext *context,
JSObject *obj,
- jsval id,
+ jsid id,
uintN flags,
JSObject **objp)
{
@@ -76,7 +76,7 @@ union_new_resolve(JSContext *context,
*objp = NULL;
- if (!gjs_get_string_id(id, &name))
+ if (!gjs_get_string_id(context, id, &name))
return JS_TRUE; /* not resolved, but no error */
priv = priv_from_js(context, obj);
diff --git a/gjs/byteArray.c b/gjs/byteArray.c
index d0157e9..358b6fe 100644
--- a/gjs/byteArray.c
+++ b/gjs/byteArray.c
@@ -39,15 +39,15 @@ GJS_DEFINE_PRIV_FROM_JS(ByteArrayInstance, gjs_byte_array_class)
static JSBool byte_array_get_prop (JSContext *context,
JSObject *obj,
- jsval id,
+ jsid id,
jsval *value_p);
static JSBool byte_array_set_prop (JSContext *context,
JSObject *obj,
- jsval id,
+ jsid id,
jsval *value_p);
static JSBool byte_array_new_resolve (JSContext *context,
JSObject *obj,
- jsval id,
+ jsid id,
uintN flags,
JSObject **objp);
static JSBool byte_array_constructor (JSContext *context,
@@ -186,10 +186,11 @@ byte_array_get_index(JSContext *context,
static JSBool
byte_array_get_prop(JSContext *context,
JSObject *obj,
- jsval id,
+ jsid id,
jsval *value_p)
{
ByteArrayInstance *priv;
+ jsval id_value;
priv = priv_from_js(context, obj);
@@ -198,10 +199,13 @@ byte_array_get_prop(JSContext *context,
if (priv->array == NULL)
return JS_TRUE; /* prototype, not an instance. */
+ if (!JS_IdToValue(context, id, &id_value))
+ return JS_FALSE;
+
/* First handle array indexing */
- if (JSVAL_IS_NUMBER(id)) {
+ if (JSVAL_IS_NUMBER(id_value)) {
gsize idx;
- if (!gjs_value_to_gsize(context, id, &idx))
+ if (!gjs_value_to_gsize(context, id_value, &idx))
return JS_FALSE;
return byte_array_get_index(context, obj, priv, idx, value_p);
}
@@ -216,7 +220,7 @@ byte_array_get_prop(JSContext *context,
static JSBool
byte_array_length_getter(JSContext *context,
JSObject *obj,
- jsval id,
+ jsid id,
jsval *value_p)
{
ByteArrayInstance *priv;
@@ -235,7 +239,7 @@ byte_array_length_getter(JSContext *context,
static JSBool
byte_array_length_setter(JSContext *context,
JSObject *obj,
- jsval id,
+ jsid id,
jsval *value_p)
{
ByteArrayInstance *priv;
@@ -294,10 +298,11 @@ byte_array_set_index(JSContext *context,
static JSBool
byte_array_set_prop(JSContext *context,
JSObject *obj,
- jsval id,
+ jsid id,
jsval *value_p)
{
ByteArrayInstance *priv;
+ jsval id_value;
priv = priv_from_js(context, obj);
@@ -306,6 +311,9 @@ byte_array_set_prop(JSContext *context,
if (priv->array == NULL)
return JS_TRUE; /* prototype, not an instance. */
+ if (!JS_IdToValue(context, id, &id_value))
+ return JS_FALSE;
+
/* First handle array indexing */
if (JSVAL_IS_NUMBER(id)) {
gsize idx;
@@ -344,11 +352,12 @@ byte_array_set_prop(JSContext *context,
static JSBool
byte_array_new_resolve(JSContext *context,
JSObject *obj,
- jsval id,
+ jsid id,
uintN flags,
JSObject **objp)
{
ByteArrayInstance *priv;
+ jsval id_val;
priv = priv_from_js(context, *objp);
@@ -357,9 +366,12 @@ byte_array_new_resolve(JSContext *context,
if (priv->array == NULL)
return JS_TRUE; /* prototype, not an instance. */
- if (JSVAL_IS_NUMBER(id)) {
+ if (!JS_IdToValue(context, id, &id_val))
+ return JS_FALSE;
+
+ if (JSVAL_IS_NUMBER(id_val)) {
gsize idx;
- if (!gjs_value_to_gsize(context, id, &idx))
+ if (!gjs_value_to_gsize(context, id_val, &idx))
return JS_FALSE;
if (idx >= priv->array->len) {
*objp = NULL;
diff --git a/gjs/compat.h b/gjs/compat.h
index 793ab5c..976d9c4 100644
--- a/gjs/compat.h
+++ b/gjs/compat.h
@@ -37,6 +37,10 @@ G_BEGIN_DECLS
/* See https://bugzilla.gnome.org/show_bug.cgi?id=622896 */
#ifndef HAVE_JS_ADDVALUEROOT
+
+/* The old JS_AddRoot accepted anything via void *, new
+ * api is stricter.
+ */
#define JS_AddValueRoot JS_AddRoot
#define JS_AddObjectRoot JS_AddRoot
#define JS_AddStringRoot JS_AddRoot
@@ -45,6 +49,14 @@ G_BEGIN_DECLS
#define JS_RemoveObjectRoot JS_RemoveRoot
#define JS_RemoveStringRoot JS_RemoveRoot
#define JS_RemoveGCThingRoot JS_RemoveRoot
+
+/* This one is complex; jsid appears to be explicitly
+ * different from JSVAL now. If we're on an old xulrunner,
+ * define JSID_IS_VOID in a simple way.
+ */
+#define JSID_VOID JSVAL_VOID
+#define JSID_IS_VOID(id) (id == JSVAL_VOID)
+
#endif
G_END_DECLS
diff --git a/gjs/importer.c b/gjs/importer.c
index f2d1bd1..546f194 100644
--- a/gjs/importer.c
+++ b/gjs/importer.c
@@ -360,15 +360,10 @@ load_module_elements(JSContext *context,
return;
}
- while (idp != JSVAL_VOID) {
- jsval nameval;
+ while (!JSID_IS_VOID(idp)) {
const char *name;
- if (!JS_IdToValue(context, idp, &nameval)) {
- continue;
- }
-
- if (!gjs_get_string_id(nameval, &name)) {
+ if (!gjs_get_string_id(context, idp, &name)) {
continue;
}
@@ -739,7 +734,7 @@ importer_new_enumerate(JSContext *context,
*state_p = JSVAL_NULL;
if (id_p)
- *id_p = JSVAL_ZERO;
+ *id_p = JSID_VOID;
priv = priv_from_js(context, object);
if (!priv)
@@ -907,7 +902,7 @@ importer_new_enumerate(JSContext *context,
static JSBool
importer_new_resolve(JSContext *context,
JSObject *obj,
- jsval id,
+ jsid id,
uintN flags,
JSObject **objp)
{
@@ -917,7 +912,8 @@ importer_new_resolve(JSContext *context,
*objp = NULL;
- name = gjs_string_get_ascii(id);
+ if (!gjs_get_string_id(context, id, &name))
+ return JS_FALSE;
/* let Object.prototype resolve these */
if (strcmp(name, "valueOf") == 0 ||
diff --git a/gjs/jsapi-util-string.c b/gjs/jsapi-util-string.c
index a6453d4..a687c5c 100644
--- a/gjs/jsapi-util-string.c
+++ b/gjs/jsapi-util-string.c
@@ -420,7 +420,8 @@ gjs_string_get_uint16_data(JSContext *context,
/**
* gjs_get_string_id:
- * @id_val: a jsval that is an object hash key (could be an int or string)
+ * @context: a #JSContext
+ * @id: a jsid that is an object hash key (could be an int or string)
* @name_p place to store ASCII string version of key
*
* If the id is not a string ID, return false and set *name_p to %NULL.
@@ -429,9 +430,15 @@ gjs_string_get_uint16_data(JSContext *context,
* Returns: true if *name_p is non-%NULL
**/
JSBool
-gjs_get_string_id (jsval id_val,
+gjs_get_string_id (JSContext *context,
+ jsid id,
const char **name_p)
{
+ jsval id_val;
+
+ if (!JS_IdToValue(context, id, &id_val))
+ return JS_FALSE;
+
if (JSVAL_IS_STRING(id_val)) {
*name_p = JS_GetStringBytes(JSVAL_TO_STRING(id_val));
return JS_TRUE;
diff --git a/gjs/jsapi-util.c b/gjs/jsapi-util.c
index 88361de..b8ffb64 100644
--- a/gjs/jsapi-util.c
+++ b/gjs/jsapi-util.c
@@ -695,19 +695,15 @@ gjs_log_object_props(JSContext *context,
goto done;
}
- prop_id = JSVAL_VOID;
+ prop_id = JSID_VOID;
if (!JS_NextProperty(context, props_iter, &prop_id))
goto done;
- while (prop_id != JSVAL_VOID) {
- jsval nameval;
- const char *name;
+ while (!JSID_IS_VOID(prop_id)) {
jsval propval;
+ const char *name;
- if (!JS_IdToValue(context, prop_id, &nameval))
- goto next;
-
- if (!gjs_get_string_id(nameval, &name))
+ if (!gjs_get_string_id(context, prop_id, &name))
goto next;
if (!gjs_object_get_property(context, obj, name, &propval))
@@ -719,7 +715,7 @@ gjs_log_object_props(JSContext *context,
gjs_value_debug_string(context, propval));
next:
- prop_id = JSVAL_VOID;
+ prop_id = JSID_VOID;
if (!JS_NextProperty(context, props_iter, &prop_id))
break;
}
diff --git a/gjs/jsapi-util.h b/gjs/jsapi-util.h
index 9921805..39b782a 100644
--- a/gjs/jsapi-util.h
+++ b/gjs/jsapi-util.h
@@ -331,7 +331,8 @@ JSBool gjs_string_get_uint16_data (JSContext *context,
jsval value,
guint16 **data_p,
gsize *len_p);
-JSBool gjs_get_string_id (jsval id_val,
+JSBool gjs_get_string_id (JSContext *context,
+ jsid id,
const char **name_p);
const char* gjs_get_type_name (jsval value);
diff --git a/modules/dbus-exports.c b/modules/dbus-exports.c
index 319f609..698e9a5 100644
--- a/modules/dbus-exports.c
+++ b/modules/dbus-exports.c
@@ -1407,14 +1407,14 @@ handle_introspect(JSContext *context,
JS_AddStringRoot(context, &key_str);
props_iter = JS_NewPropertyIterator(context, dir_obj);
- prop_id = JSVAL_VOID;
+ prop_id = JSID_VOID;
if (!JS_NextProperty(context, props_iter, &prop_id)) {
gjs_debug(GJS_DEBUG_DBUS,
"Failed to get next property iterating dbus directory");
goto out;
}
- while (prop_id != JSVAL_VOID) {
+ while (!JSID_IS_VOID(prop_id)) {
char *key;
jsval keyval;
jsval valueval = JSVAL_VOID;
@@ -1454,7 +1454,7 @@ handle_introspect(JSContext *context,
key);
}
- prop_id = JSVAL_VOID;
+ prop_id = JSID_VOID;
if (!JS_NextProperty(context, props_iter, &prop_id)) {
gjs_debug(GJS_DEBUG_DBUS,
"Failed to get next property iterating dbus object");
@@ -1659,7 +1659,7 @@ on_message(DBusConnection *connection,
static JSBool
exports_new_resolve(JSContext *context,
JSObject *obj,
- jsval id,
+ jsid id,
uintN flags,
JSObject **objp)
{
@@ -1668,7 +1668,7 @@ exports_new_resolve(JSContext *context,
*objp = NULL;
- if (!gjs_get_string_id(id, &name))
+ if (!gjs_get_string_id(context, id, &name))
return JS_TRUE; /* not resolved, but no error */
priv = priv_from_js(context, obj);
diff --git a/modules/dbus-values.c b/modules/dbus-values.c
index 97757bc..b145962 100644
--- a/modules/dbus-values.c
+++ b/modules/dbus-values.c
@@ -773,11 +773,11 @@ append_dict(JSContext *context,
return JS_FALSE;
}
- prop_id = JSVAL_VOID;
+ prop_id = JSID_VOID;
if (!JS_NextProperty(context, props_iter, &prop_id))
return JS_FALSE;
- while (prop_id != JSVAL_VOID) {
+ while (!JSID_IS_VOID(prop_id)) {
jsval nameval;
char *name;
jsval propval;
@@ -861,7 +861,7 @@ append_dict(JSContext *context,
dbus_message_iter_close_container(&dict_iter, &entry_iter);
next:
- prop_id = JSVAL_VOID;
+ prop_id = JSID_VOID;
if (!JS_NextProperty(context, props_iter, &prop_id))
return JS_FALSE;
}
diff --git a/modules/dbus.c b/modules/dbus.c
index d5eacb5..d5cb53b 100644
--- a/modules/dbus.c
+++ b/modules/dbus.c
@@ -1409,7 +1409,7 @@ gjs_js_dbus_watch_name(JSContext *context,
static JSBool
unique_name_getter(JSContext *context,
JSObject *obj,
- jsval id,
+ jsid id,
jsval *value_p)
{
const char *name;
@@ -1419,7 +1419,8 @@ unique_name_getter(JSContext *context,
if (!get_bus_type_from_object(context, obj, &bus_type))
return JS_FALSE;
- name = gjs_string_get_ascii(id);
+ if (!gjs_get_string_id(context, id, &name))
+ return JS_FALSE;
gjs_debug_jsprop(GJS_DEBUG_DBUS, "Get prop '%s' on dbus object", name);
@@ -1519,7 +1520,7 @@ gjs_js_dbus_start_service(JSContext *context,
static JSBool
gjs_js_dbus_get_machine_id(JSContext *context,
JSObject *obj,
- jsval key,
+ jsid key,
jsval *value)
{
char *machine_id;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]