[gjs/wip/ptomato/mozjs52: 15/45] js: new JS_Enumerate API



commit 5ab469ecdeedf67972cf03093d06ef5c10688514
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.

 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 3fe037d..ecef36d 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 b433956..0071d23 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 ff592c1..7d2c433 100644
--- a/gjs/importer.cpp
+++ b/gjs/importer.cpp
@@ -409,8 +409,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]