summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Chimento <philip.chimento@gmail.com>2017-03-19 04:53:15 +0000
committerPhilip Chimento <philip.chimento@gmail.com>2017-05-05 23:26:30 -0700
commitbfaeab1886daf2458caf94b9a06d7ead3ac24d72 (patch)
tree4ffffd5015189f71a970dceb22cb0e1c85fc448b
parent9a7db679053d7050ae139b5dcb449d484052049e (diff)
downloadgjs-bfaeab1886daf2458caf94b9a06d7ead3ac24d72.tar.gz
js: new JS_Enumerate api
You now have to pass into JS_Enumerate() a rooted JS::IdVector for it to fill in, rather than it returning a JSIdArray.
-rw-r--r--gi/arg.cpp4
-rw-r--r--gi/boxed.cpp5
-rw-r--r--gi/object.cpp4
-rw-r--r--gjs/importer.cpp4
4 files changed, 8 insertions, 9 deletions
diff --git a/gi/arg.cpp b/gi/arg.cpp
index 81ebf4de..c651bd55 100644
--- a/gi/arg.cpp
+++ b/gi/arg.cpp
@@ -502,8 +502,8 @@ gjs_object_to_g_hash(JSContext *context,
transfer = GI_TRANSFER_NOTHING;
}
- JS::AutoIdArray ids(context, JS_Enumerate(context, props));
- if (!ids)
+ JS::Rooted<JS::IdVector> ids(context, context);
+ if (!JS_Enumerate(context, props, &ids))
return false;
result = create_hash_table_for_key_type(key_param_info);
diff --git a/gi/boxed.cpp b/gi/boxed.cpp
index e6500d3b..938c78b5 100644
--- a/gi/boxed.cpp
+++ b/gi/boxed.cpp
@@ -269,9 +269,8 @@ boxed_init_from_props(JSContext *context,
}
JS::RootedObject props(context, &props_value.toObject());
- JS::AutoIdArray ids(context, JS_Enumerate(context, props));
-
- if (!ids) {
+ JS::Rooted<JS::IdVector> ids(context, context);
+ if (!JS_Enumerate(context, props, &ids)) {
gjs_throw(context, "Failed to enumerate fields hash");
return false;
}
diff --git a/gi/object.cpp b/gi/object.cpp
index d98c1260..fd9ea6b9 100644
--- a/gi/object.cpp
+++ b/gi/object.cpp
@@ -851,9 +851,9 @@ object_instance_props_to_g_parameters(JSContext *context,
JS::RootedObject props(context, &args[0].toObject());
JS::RootedId prop_id(context);
- JS::AutoIdArray ids(context, JS_Enumerate(context, props));
JS::RootedValue value(context);
- if (!ids) {
+ JS::Rooted<JS::IdVector> ids(context, context);
+ if (!JS_Enumerate(context, props, &ids)) {
gjs_throw(context, "Failed to create property iterator for object props hash");
goto free_array_and_fail;
}
diff --git a/gjs/importer.cpp b/gjs/importer.cpp
index 5ee128ef..c930eba9 100644
--- a/gjs/importer.cpp
+++ b/gjs/importer.cpp
@@ -412,8 +412,8 @@ load_module_elements(JSContext *cx,
if (module_obj == NULL)
return;
- JS::AutoIdArray ids(cx, JS_Enumerate(cx, module_obj));
- if (!ids)
+ JS::Rooted<JS::IdVector> ids(cx, cx);
+ if (!JS_Enumerate(cx, module_obj, &ids))
return;
for (ix = 0, length = ids.length(); ix < length; ix++)