[gjs/wip/ptomato/mozjs52: 4/36] js: new JS_Enumerate API



commit fd6f36cd0d7fb2e99a8eb2ca3cbb7bcab28866da
Author: Philip Chimento <philip chimento gmail com>
Date:   Sun Mar 19 04:53:15 2017 +0000

    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.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=784196

 gi/arg.cpp       |    4 ++--
 gi/boxed.cpp     |    5 ++---
 gi/object.cpp    |    4 ++--
 gjs/importer.cpp |    4 ++--
 4 files changed, 8 insertions(+), 9 deletions(-)
---
diff --git a/gi/arg.cpp b/gi/arg.cpp
index 0457673..c7e92ee 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 f7608a9..128d394 100644
--- a/gi/boxed.cpp
+++ b/gi/boxed.cpp
@@ -265,9 +265,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 4664161..850d060 100644
--- a/gi/object.cpp
+++ b/gi/object.cpp
@@ -836,9 +836,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 56c1911..f76bdd8 100644
--- a/gjs/importer.cpp
+++ b/gjs/importer.cpp
@@ -396,8 +396,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++)


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