[gjs/wip/ptomato/mozjs31: 21/25] js: No need to use .address() in new API



commit fc2a9da2ebba6202bba3b2094c89cb1610e70541
Author: Philip Chimento <philip endlessm com>
Date:   Thu Nov 3 17:55:28 2016 -0700

    js: No need to use .address() in new API
    
    Since in mozjs31 all out parameters for GC things have been changed from
    pointers to MutableHandles, there is no need to get the underlying GC
    thing's address with JS::Handle::address(). Instead, we can simply use
    the unary & operator to get a MutableHandle from a Rooted.

 gi/arg.cpp                  |   20 ++++++++++----------
 gi/boxed.cpp                |    2 +-
 gi/function.cpp             |   10 +++++-----
 gi/fundamental.cpp          |    4 ++--
 gi/gerror.cpp               |    2 +-
 gi/gtype.cpp                |    4 ++--
 gi/object.cpp               |   16 ++++++++--------
 gi/param.cpp                |    2 +-
 gi/repo.cpp                 |    6 +++---
 gi/union.cpp                |    2 +-
 gjs/byteArray.cpp           |    6 +++---
 gjs/context.cpp             |    2 +-
 gjs/coverage.cpp            |   32 ++++++++++++++------------------
 gjs/importer.cpp            |   17 ++++++-----------
 gjs/jsapi-util-error.cpp    |    2 +-
 gjs/jsapi-util-string.cpp   |    2 +-
 gjs/jsapi-util.cpp          |   16 ++++++++--------
 gjs/jsapi-util.h            |    2 +-
 modules/cairo-context.cpp   |   18 +++++++++---------
 modules/cairo-region.cpp    |    8 ++++----
 modules/console.cpp         |    4 ++--
 test/gjs-test-call-args.cpp |    4 ++--
 test/gjs-tests.cpp          |    6 +++---
 23 files changed, 89 insertions(+), 98 deletions(-)
---
diff --git a/gi/arg.cpp b/gi/arg.cpp
index c158982..b24adb3 100644
--- a/gi/arg.cpp
+++ b/gi/arg.cpp
@@ -287,7 +287,7 @@ gjs_array_to_g_list(JSContext   *context,
         GArgument elem_arg = { 0 };
 
         elem = JS::UndefinedValue();
-        if (!JS_GetElement(context, array, i, elem.address())) {
+        if (!JS_GetElement(context, array, i, &elem)) {
             gjs_throw(context,
                       "Missing array element %u",
                       i);
@@ -512,14 +512,14 @@ gjs_object_to_g_hash(JSContext   *context,
         gpointer key_ptr, val_ptr;
         GIArgument val_arg = { 0 };
 
-        if (!JS_IdToValue(context, cur_id, key_js.address()))
+        if (!JS_IdToValue(context, cur_id, &key_js))
             goto free_hash_and_fail;
 
         /* Type check key type. */
         if (!value_to_ghashtable_key(context, key_js, key_param_info, &key_ptr))
             goto free_hash_and_fail;
 
-        if (!JS_GetPropertyById(context, props, cur_id, val_js.address()))
+        if (!JS_GetPropertyById(context, props, cur_id, &val_js))
             goto free_hash_and_fail;
 
         /* Type check and convert value to a c type */
@@ -602,7 +602,7 @@ gjs_array_to_strv(JSContext   *context,
 
     for (i = 0; i < length; ++i) {
         elem = JS::UndefinedValue();
-        if (!JS_GetElement(context, array, i, elem.address())) {
+        if (!JS_GetElement(context, array, i, &elem)) {
             g_free(result);
             gjs_throw(context,
                       "Missing array element %u",
@@ -684,7 +684,7 @@ gjs_array_to_gboolean_array(JSContext      *cx,
     gboolean *result = g_new0(gboolean, length);
 
     for (i = 0; i < length; i++) {
-        if (!JS_GetElement(cx, array, i, elem.address())) {
+        if (!JS_GetElement(cx, array, i, &elem)) {
             g_free(result);
             gjs_throw(cx, "Missing array element %u", i);
             return false;
@@ -719,7 +719,7 @@ gjs_array_to_intarray(JSContext   *context,
         bool success;
 
         elem = JS::UndefinedValue();
-        if (!JS_GetElement(context, array, i, elem.address())) {
+        if (!JS_GetElement(context, array, i, &elem)) {
             g_free(result);
             gjs_throw(context,
                       "Missing array element %u",
@@ -776,7 +776,7 @@ gjs_gtypearray_to_array(JSContext   *context,
         GType gtype;
 
         elem = JS::UndefinedValue();
-        if (!JS_GetElement(context, array, i, elem.address())) {
+        if (!JS_GetElement(context, array, i, &elem)) {
             g_free(result);
             gjs_throw(context, "Missing array element %u", i);
             return false;
@@ -823,7 +823,7 @@ gjs_array_to_floatarray(JSContext   *context,
         bool success;
 
         elem = JS::UndefinedValue();
-        if (!JS_GetElement(context, array, i, elem.address())) {
+        if (!JS_GetElement(context, array, i, &elem)) {
             g_free(result);
             gjs_throw(context,
                       "Missing array element %u",
@@ -879,7 +879,7 @@ gjs_array_to_ptrarray(JSContext   *context,
         bool success;
 
         elem = JS::UndefinedValue();
-        if (!JS_GetElement(context, array_obj, i, elem.address())) {
+        if (!JS_GetElement(context, array_obj, i, &elem)) {
             g_free(array);
             gjs_throw(context,
                       "Missing array element %u",
@@ -925,7 +925,7 @@ gjs_array_to_flat_gvalue_array(JSContext   *context,
     for (i = 0; i < length; i ++) {
         elem = JS::UndefinedValue();
 
-        if (!JS_GetElement(context, array, i, elem.address())) {
+        if (!JS_GetElement(context, array, i, &elem)) {
             g_free(values);
             gjs_throw(context,
                       "Missing array element %u",
diff --git a/gi/boxed.cpp b/gi/boxed.cpp
index 8b65204..6760808 100644
--- a/gi/boxed.cpp
+++ b/gi/boxed.cpp
@@ -440,7 +440,7 @@ GJS_NATIVE_CONSTRUCTOR_DECLARE(boxed)
                         "boxed constructor, obj %p priv %p",
                         object.get(), priv);
 
-    JS_GetPrototype(context, object, proto.address());
+    JS_GetPrototype(context, object, &proto);
     gjs_debug_lifecycle(GJS_DEBUG_GBOXED, "boxed instance __proto__ is %p",
                         proto.get());
     /* If we're the prototype, then post-construct we'll fill in priv->info.
diff --git a/gi/function.cpp b/gi/function.cpp
index 4cf9d66..58ec7a6 100644
--- a/gi/function.cpp
+++ b/gi/function.cpp
@@ -294,7 +294,7 @@ gjs_callback_closure(ffi_cif *cif,
                               rooted_function,
                               n_jsargs,
                               jsargs.begin(),
-                              rval.address())) {
+                              &rval)) {
         goto out;
     }
 
@@ -354,7 +354,7 @@ gjs_callback_closure(ffi_cif *cif,
         if (!ret_type_is_void) {
             GIArgument argument;
 
-            if (!JS_GetElement(context, out_array, elem_idx, elem.address()))
+            if (!JS_GetElement(context, out_array, elem_idx, &elem))
                 goto out;
 
             if (!gjs_value_to_g_argument(context,
@@ -382,7 +382,7 @@ gjs_callback_closure(ffi_cif *cif,
                 continue;
 
             g_arg_info_load_type(&arg_info, &type_info);
-            if (!JS_GetElement(context, out_array, elem_idx, elem.address()))
+            if (!JS_GetElement(context, out_array, elem_idx, &elem))
                 goto out;
 
             if (!gjs_value_to_g_argument(context,
@@ -1661,10 +1661,10 @@ function_new(JSContext      *context,
         JS::RootedObject parent_proto(context);
         JS::RootedValue v_native_function(context);
 
-        JS_GetProperty(context, global, "Function", v_native_function.address());
+        JS_GetProperty(context, global, "Function", &v_native_function);
         JS::RootedObject native_function(context, &v_native_function.toObject());
         /* We take advantage from that fact that Function.__proto__ is Function.prototype */
-        JS_GetPrototype(context, native_function, parent_proto.address());
+        JS_GetPrototype(context, native_function, &parent_proto);
 
         prototype = JS_InitClass(context, global,
                                  /* parent prototype JSObject* for
diff --git a/gi/fundamental.cpp b/gi/fundamental.cpp
index d18e4a9..6963c1b 100644
--- a/gi/fundamental.cpp
+++ b/gi/fundamental.cpp
@@ -134,7 +134,7 @@ proto_priv_from_js(JSContext       *context,
                    JS::HandleObject obj)
 {
     JS::RootedObject proto(context);
-    JS_GetPrototype(context, obj, proto.address());
+    JS_GetPrototype(context, obj, &proto);
     return (Fundamental*) priv_from_js(context, proto);
 }
 
@@ -594,7 +594,7 @@ gjs_lookup_fundamental_prototype(JSContext    *context,
         return NULL;
 
     JS::RootedValue value(context);
-    if (!JS_GetProperty(context, in_object, constructor_name, value.address()))
+    if (!JS_GetProperty(context, in_object, constructor_name, &value))
         return NULL;
 
     JS::RootedObject constructor(context);
diff --git a/gi/gerror.cpp b/gi/gerror.cpp
index 2209602..6a43d88 100644
--- a/gi/gerror.cpp
+++ b/gi/gerror.cpp
@@ -76,7 +76,7 @@ GJS_NATIVE_CONSTRUCTOR_DECLARE(error)
                         object.get(), priv);
 
     JS::RootedObject proto(context);
-    JS_GetPrototype(context, object, proto.address());
+    JS_GetPrototype(context, object, &proto);
     gjs_debug_lifecycle(GJS_DEBUG_GERROR, "GError instance __proto__ is %p",
                         proto.get());
 
diff --git a/gi/gtype.cpp b/gi/gtype.cpp
index 9c9c24b..9e6e873 100644
--- a/gi/gtype.cpp
+++ b/gi/gtype.cpp
@@ -158,12 +158,12 @@ _gjs_gtype_get_actual_gtype(JSContext       *context,
 
     /* OK, we don't have a GType wrapper object -- grab the "$gtype"
      * property on that and hope it's a GType wrapper object */
-    if (!JS_GetProperty(context, object, "$gtype", gtype_val.address()) ||
+    if (!JS_GetProperty(context, object, "$gtype", &gtype_val) ||
         !gtype_val.isObject()) {
 
         /* OK, so we're not a class. But maybe we're an instance. Check
            for "constructor" and recurse on that. */
-        if (!JS_GetProperty(context, object, "constructor", gtype_val.address()))
+        if (!JS_GetProperty(context, object, "constructor", &gtype_val))
             return G_TYPE_INVALID;
     }
 
diff --git a/gi/object.cpp b/gi/object.cpp
index 8c7d211..d527918 100644
--- a/gi/object.cpp
+++ b/gi/object.cpp
@@ -246,7 +246,7 @@ proto_priv_from_js(JSContext       *context,
                    JS::HandleObject obj)
 {
     JS::RootedObject proto(context);
-    JS_GetPrototype(context, obj, proto.address());
+    JS_GetPrototype(context, obj, &proto);
     return priv_from_js(context, proto);
 }
 
@@ -1465,7 +1465,7 @@ gjs_lookup_object_constructor_from_info(JSContext    *context,
         return NULL;
 
     JS::RootedValue value(context);
-    if (!JS_GetProperty(context, in_object, constructor_name, value.address()))
+    if (!JS_GetProperty(context, in_object, constructor_name, &value))
         return NULL;
 
     JS::RootedObject constructor(context);
@@ -2357,7 +2357,7 @@ gjs_object_get_gproperty (GObject    *object,
     JS::RootedValue jsvalue(context);
 
     underscore_name = hyphen_to_underscore((gchar *)pspec->name);
-    if (!JS_GetProperty(context, js_obj, underscore_name, jsvalue.address()) ||
+    if (!JS_GetProperty(context, js_obj, underscore_name, &jsvalue) ||
         !gjs_value_to_g_value(context, jsvalue, value))
         gjs_log_exception(context);
     g_free (underscore_name);
@@ -2376,7 +2376,7 @@ jsobj_set_gproperty(JSContext       *context,
         return;
 
     underscore_name = hyphen_to_underscore((gchar *)pspec->name);
-    if (!JS_SetProperty(context, object, underscore_name, jsvalue.address()))
+    if (!JS_SetProperty(context, object, underscore_name, jsvalue))
         gjs_log_exception(context);
     g_free (underscore_name);
 }
@@ -2612,7 +2612,7 @@ gjs_object_custom_init(GTypeInstance *instance,
 
     JS::RootedValue r(context);
     if (!JS_CallFunctionValue(context, object, v,
-                              0, NULL, r.address()))
+                              0, NULL, &r))
         gjs_log_exception(context);
 }
 
@@ -2671,7 +2671,7 @@ get_interface_gtypes(JSContext       *cx,
         JS::RootedValue iface_val(cx);
         GType iface_type;
 
-        if (!JS_GetElement(cx, interfaces, i, &iface_val.get()))
+        if (!JS_GetElement(cx, interfaces, i, &iface_val))
             return false;
 
         if (!iface_val.isObject()) {
@@ -2706,7 +2706,7 @@ save_properties_for_class_init(JSContext       *cx,
     for (i = 0; i < n_properties; i++) {
         JS::RootedValue prop_val(cx);
 
-        if (!JS_GetElement(cx, properties, i, &prop_val.get())) {
+        if (!JS_GetElement(cx, properties, i, &prop_val)) {
             g_clear_pointer(&properties_native, g_ptr_array_unref);
             return false;
         }
@@ -2968,7 +2968,7 @@ gjs_signal_new(JSContext *cx,
     params = g_newa(GType, n_parameters);
     JS::RootedValue gtype_val(cx);
     for (i = 0; i < n_parameters; i++) {
-        if (!JS_GetElement(cx, params_obj, i, gtype_val.address()) ||
+        if (!JS_GetElement(cx, params_obj, i, &gtype_val) ||
             !gtype_val.isObject()) {
             gjs_throw(cx, "Invalid signal parameter number %d", i);
             return false;
diff --git a/gi/param.cpp b/gi/param.cpp
index 1e1d0fa..f1836e5 100644
--- a/gi/param.cpp
+++ b/gi/param.cpp
@@ -190,7 +190,7 @@ gjs_lookup_param_prototype(JSContext    *context)
         return NULL;
 
     JS::RootedValue value(context);
-    if (!JS_GetProperty(context, in_object, "ParamSpec", value.address()))
+    if (!JS_GetProperty(context, in_object, "ParamSpec", &value))
         return NULL;
 
     if (G_UNLIKELY (!value.isObject()))
diff --git a/gi/repo.cpp b/gi/repo.cpp
index 9eaa4f4..7d6f363 100644
--- a/gi/repo.cpp
+++ b/gi/repo.cpp
@@ -134,7 +134,7 @@ resolve_namespace_object(JSContext       *context,
                                override, /* callee */
                                0, /* argc */
                                NULL, /* argv */
-                               result.address()))
+                               &result))
         return false;
 
     gjs_debug(GJS_DEBUG_GNAMESPACE,
@@ -320,7 +320,7 @@ repo_new(JSContext *context)
      */
     {
         JS::RootedValue value(context);
-        JS_GetProperty(context, repo, "GLib", value.address());
+        JS_GetProperty(context, repo, "GLib", &value);
     }
 
     return repo;
@@ -754,7 +754,7 @@ gjs_lookup_generic_constructor(JSContext  *context,
         return NULL;
 
     JS::RootedValue value(context);
-    if (!JS_GetProperty(context, in_object, constructor_name, value.address()))
+    if (!JS_GetProperty(context, in_object, constructor_name, &value))
         return NULL;
 
     if (G_UNLIKELY (!value.isObject()))
diff --git a/gi/union.cpp b/gi/union.cpp
index c319b19..fc0ef3e 100644
--- a/gi/union.cpp
+++ b/gi/union.cpp
@@ -208,7 +208,7 @@ GJS_NATIVE_CONSTRUCTOR_DECLARE(union)
                         "union constructor, obj %p priv %p",
                         object.get(), priv);
 
-    JS_GetPrototype(context, object, proto.address());
+    JS_GetPrototype(context, object, &proto);
     gjs_debug_lifecycle(GJS_DEBUG_GBOXED, "union instance __proto__ is %p",
                         proto.get());
 
diff --git a/gjs/byteArray.cpp b/gjs/byteArray.cpp
index b8e19dd..8248c62 100644
--- a/gjs/byteArray.cpp
+++ b/gjs/byteArray.cpp
@@ -201,7 +201,7 @@ byte_array_get_prop(JSContext *context,
         return true; /* prototype, not an instance. */
 
     JS::RootedValue id_value(context);
-    if (!JS_IdToValue(context, id, id_value.address()))
+    if (!JS_IdToValue(context, id, &id_value))
         return false;
 
     /* First handle array indexing */
@@ -310,7 +310,7 @@ byte_array_set_prop(JSContext *context,
         return true; /* prototype, not an instance. */
 
     JS::RootedValue id_value(context);
-    if (!JS_IdToValue(context, id, id_value.address()))
+    if (!JS_IdToValue(context, id, &id_value))
         return false;
 
     /* First handle array indexing */
@@ -684,7 +684,7 @@ from_array_func(JSContext *context,
         guint8 b;
 
         elem = JS::UndefinedValue();
-        if (!JS_GetElement(context, array_obj, i, elem.address())) {
+        if (!JS_GetElement(context, array_obj, i, &elem)) {
             /* this means there was an exception, while elem.isUndefined()
              * means no element found
              */
diff --git a/gjs/context.cpp b/gjs/context.cpp
index 7c730b7..c255926 100644
--- a/gjs/context.cpp
+++ b/gjs/context.cpp
@@ -767,7 +767,7 @@ gjs_object_get_property_const(JSContext             *cx,
                               JS::MutableHandleValue value_p)
 {
     JS::RootedId pname(cx, gjs_context_get_const_string(cx, property_name));
-    return JS_GetPropertyById(cx, obj, pname, value_p.address());
+    return JS_GetPropertyById(cx, obj, pname, value_p);
 }
 
 /**
diff --git a/gjs/coverage.cpp b/gjs/coverage.cpp
index ec2ad31..0b98b5a 100644
--- a/gjs/coverage.cpp
+++ b/gjs/coverage.cpp
@@ -425,7 +425,7 @@ get_array_from_js_value(JSContext             *context,
         u_int32_t i = 0;
         JS::RootedValue element(context);
         for (; i < js_array_len; ++i) {
-            if (!JS_GetElement(context, js_array, i, element.address())) {
+            if (!JS_GetElement(context, js_array, i, &element)) {
                 g_array_unref(c_side_array);
                 gjs_throw(context, "Failed to get function names array element %d", i);
                 return false;
@@ -477,7 +477,7 @@ get_executed_lines_for(JSContext        *context,
      * mutated in JS_CallFunction */
     if (!JS_CallFunctionName(context, coverage_statistics, "getExecutedLinesFor",
                              1, (JS::Value *) filename_value.address(),
-                             rval.address())) {
+                             &rval)) {
         gjs_log_exception(context);
         return NULL;
     }
@@ -590,7 +590,7 @@ get_functions_for(JSContext        *context,
      * mutated in JS_CallFunction */
     if (!JS_CallFunctionName(context, coverage_statistics, "getFunctionsFor",
                              1, (JS::Value *) filename_value.address(),
-                             rval.address())) {
+                             &rval)) {
         gjs_log_exception(context);
         return NULL;
     }
@@ -680,7 +680,7 @@ convert_and_insert_branch_info(GArray         *array,
         JS::RootedValue branch_exits_value(context);
         GArray *branch_exits_array = NULL;
 
-        if (!JS_GetProperty(context, object, "exits", branch_exits_value.address()) ||
+        if (!JS_GetProperty(context, object, "exits", &branch_exits_value) ||
             !branch_exits_value.isObject()) {
             gjs_throw(context, "Failed to get exits property from element");
             return false;
@@ -720,7 +720,7 @@ get_branches_for(JSContext        *context,
      * mutated in JS_CallFunction */
     if (!JS_CallFunctionName(context, coverage_statistics, "getBranchesFor",
                              1, (JS::Value *) filename_value.address(),
-                             rval.address())) {
+                             &rval)) {
         gjs_log_exception(context);
         return NULL;
     }
@@ -855,7 +855,7 @@ get_covered_files(GjsCoverage *coverage)
     uint32_t n_files;
 
     if (!JS_CallFunctionName(context, rooted_priv, "getCoveredFiles",
-                             0, NULL, rval.address())) {
+                             0, NULL, &rval)) {
         gjs_log_exception(context);
         return NULL;
     }
@@ -871,7 +871,7 @@ get_covered_files(GjsCoverage *coverage)
     JS::RootedValue element(context);
     for (uint32_t i = 0; i < n_files; i++) {
         char *file;
-        if (!JS_GetElement(context, files_obj, i, element.address()))
+        if (!JS_GetElement(context, files_obj, i, &element))
             goto error;
 
         if (!gjs_string_to_utf8(context, element, &file))
@@ -1015,7 +1015,7 @@ gjs_serialize_statistics(GjsCoverage *coverage)
     if (!JS_CallFunctionName(js_context, rooted_priv, "stringify",
                              0,
                              NULL,
-                             string_value_return.address())) {
+                             &string_value_return)) {
         gjs_log_exception(js_context);
         return NULL;
     }
@@ -1171,7 +1171,7 @@ coverage_statistics_has_stale_cache(GjsCoverage *coverage)
     if (!JS_CallFunctionName(js_context, rooted_priv, "staleCache",
                              0,
                              NULL,
-                             stale_cache_value.address())) {
+                             &stale_cache_value)) {
         gjs_log_exception(js_context);
         g_error("Failed to call into javascript to get stale cache value. This is a bug");
     }
@@ -1522,10 +1522,8 @@ gjs_inject_value_into_coverage_compartment(GjsCoverage     *coverage,
     JS::RootedObject coverage_global_scope(JS_GetRuntime(js_context),
                                            JS_GetGlobalForObject(js_context, priv->coverage_statistics));
 
-    /* Removing const with cast is OK because the property value is not
-     * mutated in JS_SetProperty */
     if (!JS_SetProperty(js_context, coverage_global_scope, property,
-                        (JS::Value *) value.address())) {
+                        value)) {
         g_warning("Failed to set property %s to requested value", property);
         return false;
     }
@@ -1549,7 +1547,7 @@ gjs_wrap_root_importer_in_compartment(JSContext *context,
 
     JS::RootedObject wrapped_importer(JS_GetRuntime(context),
                                       importer.toObjectOrNull());
-    if (!JS_WrapObject(context, wrapped_importer.address())) {
+    if (!JS_WrapObject(context, &wrapped_importer)) {
         return NULL;
     }
 
@@ -1575,16 +1573,14 @@ bootstrap_coverage(GjsCoverage *coverage)
     {
         JSAutoCompartment compartment(context, debugger_compartment);
         JS::RootedObject debuggeeWrapper(context, debuggee);
-        if (!JS_WrapObject(context, debuggeeWrapper.address())) {
+        if (!JS_WrapObject(context, &debuggeeWrapper)) {
             gjs_throw(context, "Failed to wrap debugeee");
             return false;
         }
 
         JS::RootedValue debuggeeWrapperValue(context, JS::ObjectValue(*debuggeeWrapper));
-        /* Removing const with cast is OK because the property value is not
-         * mutated in JS_SetProperty */
         if (!JS_SetProperty(context, debugger_compartment, "debuggee",
-                            (JS::Value *) debuggeeWrapperValue.address())) {
+                            debuggeeWrapperValue)) {
             gjs_throw(context, "Failed to set debuggee property");
             return false;
         }
@@ -1748,7 +1744,7 @@ gjs_clear_js_side_statistics_from_coverage_object(GjsCoverage *coverage)
         if (!JS_CallFunctionName(js_context, rooted_priv, "deactivate",
                                  0,
                                  NULL,
-                                 rval.address())) {
+                                 &rval)) {
             gjs_log_exception(js_context);
             g_error("Failed to deactivate debugger - this is a fatal error");
         }
diff --git a/gjs/importer.cpp b/gjs/importer.cpp
index 09e2b52..7b9241d 100644
--- a/gjs/importer.cpp
+++ b/gjs/importer.cpp
@@ -305,10 +305,8 @@ load_module_init(JSContext       *context,
         gjs_context_get_const_string(context, GJS_STRING_MODULE_INIT));
     if (JS_HasPropertyById(context, in_object, module_init_name, &found) && found) {
         JS::RootedValue module_obj_val(context);
-        if (JS_GetPropertyById(context,
-                               in_object,
-                               module_init_name,
-                               module_obj_val.address())) {
+        if (JS_GetPropertyById(context, in_object,
+                               module_init_name, &module_obj_val)) {
             return &module_obj_val.toObject();
         }
     }
@@ -458,7 +456,7 @@ do_import(JSContext       *context,
 
     for (i = 0; i < search_path_len; ++i) {
         elem.setUndefined();
-        if (!JS_GetElement(context, search_path, i, elem.address())) {
+        if (!JS_GetElement(context, search_path, i, &elem)) {
             /* this means there was an exception, while elem.isUndefined()
              * means no element found
              */
@@ -492,10 +490,7 @@ do_import(JSContext       *context,
         module_obj.set(load_module_init(context, obj, full_path));
         if (module_obj != NULL) {
             JS::RootedValue obj_val(context);
-            if (JS_GetProperty(context,
-                               module_obj,
-                               name,
-                               obj_val.address())) {
+            if (JS_GetProperty(context, module_obj, name, &obj_val)) {
                 if (!obj_val.isUndefined() &&
                     JS_DefineProperty(context, obj,
                                       name, obj_val,
@@ -697,7 +692,7 @@ importer_new_enumerate(JSContext  *context,
             GDir *dir = NULL;
 
             elem = JS::UndefinedValue();
-            if (!JS_GetElement(context, search_path, i, elem.address())) {
+            if (!JS_GetElement(context, search_path, i, &elem)) {
                 /* this means there was an exception, while elem.isUndefined()
                  * means no element found
                  */
@@ -785,7 +780,7 @@ importer_new_enumerate(JSContext  *context,
                                          &element_val))
                 return false;
 
-            if (!JS_ValueToId(context, element_val, idp.address()))
+            if (!JS_ValueToId(context, element_val, idp))
                 return false;
 
             break;
diff --git a/gjs/jsapi-util-error.cpp b/gjs/jsapi-util-error.cpp
index 005f81c..7f194e6 100644
--- a/gjs/jsapi-util-error.cpp
+++ b/gjs/jsapi-util-error.cpp
@@ -84,7 +84,7 @@ gjs_throw_valist(JSContext       *context,
         goto out;
     }
 
-    if (!JS_GetProperty(context, global, error_class, v_constructor.address()) ||
+    if (!JS_GetProperty(context, global, error_class, &v_constructor) ||
         !v_constructor.isObject()) {
         JS_ReportError(context, "??? Missing Error constructor in global object?");
         goto out;
diff --git a/gjs/jsapi-util-string.cpp b/gjs/jsapi-util-string.cpp
index 1707256..6143b47 100644
--- a/gjs/jsapi-util-string.cpp
+++ b/gjs/jsapi-util-string.cpp
@@ -313,7 +313,7 @@ gjs_get_string_id (JSContext       *context,
 {
     JS::RootedValue id_val(context);
 
-    if (!JS_IdToValue(context, id, id_val.address()))
+    if (!JS_IdToValue(context, id, &id_val))
         return false;
 
     if (id_val.isString()) {
diff --git a/gjs/jsapi-util.cpp b/gjs/jsapi-util.cpp
index 1095f86..9670ad8 100644
--- a/gjs/jsapi-util.cpp
+++ b/gjs/jsapi-util.cpp
@@ -169,7 +169,7 @@ gjs_object_require_property(JSContext             *context,
 {
     value.setUndefined();
 
-    if (G_UNLIKELY(!JS_GetPropertyById(context, obj, property_name, value.address())))
+    if (G_UNLIKELY(!JS_GetPropertyById(context, obj, property_name, value)))
         return false;
 
     if (G_LIKELY(!value.isUndefined()))
@@ -188,7 +188,7 @@ gjs_object_require_property_value(JSContext       *cx,
                                   bool            *value)
 {
     JS::RootedValue prop_value(cx);
-    if (JS_GetPropertyById(cx, obj, property_name, prop_value.address()) &&
+    if (JS_GetPropertyById(cx, obj, property_name, &prop_value) &&
         prop_value.isBoolean()) {
         *value = prop_value.toBoolean();
         return true;
@@ -207,7 +207,7 @@ gjs_object_require_property_value(JSContext       *cx,
                                   int32_t         *value)
 {
     JS::RootedValue prop_value(cx);
-    if (JS_GetPropertyById(cx, obj, property_name, prop_value.address()) &&
+    if (JS_GetPropertyById(cx, obj, property_name, &prop_value) &&
         prop_value.isInt32()) {
         *value = prop_value.toInt32();
         return true;
@@ -227,7 +227,7 @@ gjs_object_require_property_value(JSContext       *cx,
                                   char           **value)
 {
     JS::RootedValue prop_value(cx);
-    if (JS_GetPropertyById(cx, obj, property_name, prop_value.address()) &&
+    if (JS_GetPropertyById(cx, obj, property_name, &prop_value) &&
         gjs_string_to_utf8(cx, prop_value, value)) {
         return true;
     }
@@ -245,7 +245,7 @@ gjs_object_require_property_value(JSContext              *cx,
                                   JS::MutableHandleObject value)
 {
     JS::RootedValue prop_value(cx);
-    if (JS_GetPropertyById(cx, obj, property_name, prop_value.address()) &&
+    if (JS_GetPropertyById(cx, obj, property_name, &prop_value) &&
         prop_value.isObject()) {
         value.set(&prop_value.toObject());
         return true;
@@ -264,7 +264,7 @@ gjs_object_require_converted_property_value(JSContext       *cx,
                                             uint32_t        *value)
 {
     JS::RootedValue prop_value(cx);
-    if (JS_GetPropertyById(cx, obj, property_name, prop_value.address()) &&
+    if (JS_GetPropertyById(cx, obj, property_name, &prop_value) &&
         JS::ToUint32(cx, prop_value, value)) {
         return true;
     }
@@ -619,7 +619,7 @@ gjs_log_exception(JSContext  *context)
     JS_BeginRequest(context);
 
     JS::RootedValue exc(context);
-    if (!JS_GetPendingException(context, exc.address()))
+    if (!JS_GetPendingException(context, &exc))
         goto out;
 
     JS_ClearPendingException(context);
@@ -867,7 +867,7 @@ gjs_eval_with_scope(JSContext             *context,
            .setFileAndLine(filename, start_line_number)
            .setSourcePolicy(JS::CompileOptions::LAZY_SOURCE);
 
-    if (!JS::Evaluate(context, eval_obj, options, script, script_len, retval.address()))
+    if (!JS::Evaluate(context, eval_obj, options, script, script_len, retval))
         return false;
 
     gjs_schedule_gc_if_needed(context);
diff --git a/gjs/jsapi-util.h b/gjs/jsapi-util.h
index 8f8ce17..0285bd2 100644
--- a/gjs/jsapi-util.h
+++ b/gjs/jsapi-util.h
@@ -208,7 +208,7 @@ gjs_##cname##_create_proto(JSContext *context,                                 \
     JS::RootedObject global(context, gjs_get_import_global(context));          \
     JS::RootedId class_name(context,                                           \
         gjs_intern_string_to_id(context, gjs_##cname##_class.name));           \
-    if (!JS_GetPropertyById(context, global, class_name, rval.address()))      \
+    if (!JS_GetPropertyById(context, global, class_name, &rval))               \
         return JS::NullValue(); \
     if (rval.isUndefined()) { \
         JS::RootedObject prototype(context,                                    \
diff --git a/modules/cairo-context.cpp b/modules/cairo-context.cpp
index 24ec1b6..9f8d506 100644
--- a/modules/cairo-context.cpp
+++ b/modules/cairo-context.cpp
@@ -86,9 +86,9 @@ _GJS_CAIRO_CONTEXT_DEFINE_FUNC_BEGIN(method)                               \
       if (!array)                                                          \
         return false;                                                      \
       JS::RootedValue r(context, JS::NumberValue(arg1));                   \
-      if (!JS_SetElement(context, array, 0, r.address())) return false;    \
+      if (!JS_SetElement(context, array, 0, r)) return false;              \
       r.setNumber(arg2);                                                   \
-      if (!JS_SetElement(context, array, 1, r.address())) return false;    \
+      if (!JS_SetElement(context, array, 1, r)) return false;              \
       argv.rval().setObject(*array);                                       \
     }                                                                      \
 _GJS_CAIRO_CONTEXT_DEFINE_FUNC_END
@@ -104,9 +104,9 @@ _GJS_CAIRO_CONTEXT_DEFINE_FUNC_BEGIN(method)                               \
       if (!array)                                                          \
         return false;                                                      \
       JS::RootedValue r(context, JS::NumberValue(arg1));                   \
-      if (!JS_SetElement(context, array, 0, r.address())) return false;    \
+      if (!JS_SetElement(context, array, 0, r)) return false;              \
       r.setNumber(arg2);                                                   \
-      if (!JS_SetElement(context, array, 1, r.address())) return false;    \
+      if (!JS_SetElement(context, array, 1, r)) return false;              \
       argv.rval().setObject(*array);                                       \
     }                                                                      \
 _GJS_CAIRO_CONTEXT_DEFINE_FUNC_END
@@ -122,13 +122,13 @@ _GJS_CAIRO_CONTEXT_DEFINE_FUNC_BEGIN(method)                               \
       if (!array)                                                          \
         return false;                                                      \
       JS::RootedValue r(context, JS::NumberValue(arg1));                   \
-      if (!JS_SetElement(context, array, 0, r.address())) return false;    \
+      if (!JS_SetElement(context, array, 0, r)) return false;              \
       r.setNumber(arg2);                                                   \
-      if (!JS_SetElement(context, array, 1, r.address())) return false;    \
+      if (!JS_SetElement(context, array, 1, r)) return false;              \
       r.setNumber(arg3);                                                   \
-      if (!JS_SetElement(context, array, 2, r.address())) return false;    \
+      if (!JS_SetElement(context, array, 2, r)) return false;              \
       r.setNumber(arg4);                                                   \
-      if (!JS_SetElement(context, array, 3, r.address())) return false;    \
+      if (!JS_SetElement(context, array, 3, r)) return false;              \
       argv.rval().setObject(*array);                                       \
     }                                                                      \
 _GJS_CAIRO_CONTEXT_DEFINE_FUNC_END
@@ -558,7 +558,7 @@ setDash_func(JSContext *context,
         double b;
 
         elem.setUndefined();
-        if (!JS_GetElement(context, dashes, i, elem.address())) {
+        if (!JS_GetElement(context, dashes, i, &elem)) {
             return false;
         }
         if (elem.isUndefined())
diff --git a/modules/cairo-region.cpp b/modules/cairo-region.cpp
index f53ca60..8e3571a 100644
--- a/modules/cairo-region.cpp
+++ b/modules/cairo-region.cpp
@@ -152,16 +152,16 @@ make_rectangle(JSContext *context,
     JS::RootedValue val(context);
 
     val = JS::Int32Value(rect->x);
-    JS_SetProperty(context, rect_obj, "x", val.address());
+    JS_SetProperty(context, rect_obj, "x", val);
 
     val = JS::Int32Value(rect->y);
-    JS_SetProperty(context, rect_obj, "y", val.address());
+    JS_SetProperty(context, rect_obj, "y", val);
 
     val = JS::Int32Value(rect->width);
-    JS_SetProperty(context, rect_obj, "width", val.address());
+    JS_SetProperty(context, rect_obj, "width", val);
 
     val = JS::Int32Value(rect->height);
-    JS_SetProperty(context, rect_obj, "height", val.address());
+    JS_SetProperty(context, rect_obj, "height", val);
 
     return rect_obj;
 }
diff --git a/modules/console.cpp b/modules/console.cpp
index 33619c0..fb70fb6 100644
--- a/modules/console.cpp
+++ b/modules/console.cpp
@@ -195,11 +195,11 @@ gjs_console_interact(JSContext *context,
         JS::CompileOptions options(context);
         options.setUTF8(true)
                .setFileAndLine("typein", startline);
-        JS::Evaluate(context, object, options, buffer->str, buffer->len, result.address());
+        JS::Evaluate(context, object, options, buffer->str, buffer->len, &result);
 
         gjs_schedule_gc_if_needed(context);
 
-        if (JS_GetPendingException(context, result.address())) {
+        if (JS_GetPendingException(context, &result)) {
             str = JS::ToString(context, result);
             JS_ClearPendingException(context);
         } else if (result.isUndefined()) {
diff --git a/test/gjs-test-call-args.cpp b/test/gjs-test-call-args.cpp
index 2a6636b..90414a3 100644
--- a/test/gjs-test-call-args.cpp
+++ b/test/gjs-test-call-args.cpp
@@ -265,7 +265,7 @@ run_code(GjsUnitTestFixture *fx,
     JS::RootedObject global(fx->cx, gjs_get_import_global(fx->cx));
     JS::RootedValue ignored(fx->cx);
     bool ok = JS::Evaluate(fx->cx, global, options, script, strlen(script),
-                           ignored.address());
+                           &ignored);
     JS_ReportPendingException(fx->cx);
 
     g_assert_null(fx->message);
@@ -284,7 +284,7 @@ run_code_expect_exception(GjsUnitTestFixture *fx,
     JS::RootedObject global(fx->cx, gjs_get_import_global(fx->cx));
     JS::RootedValue ignored(fx->cx);
     bool ok = JS::Evaluate(fx->cx, global, options, script, strlen(script),
-                           ignored.address());
+                           &ignored);
     g_assert_false(ok);
     g_assert_true(JS_IsExceptionPending(fx->cx));
     JS_ReportPendingException(fx->cx);
diff --git a/test/gjs-tests.cpp b/test/gjs-tests.cpp
index 17251b3..161d0a5 100644
--- a/test/gjs-tests.cpp
+++ b/test/gjs-tests.cpp
@@ -87,11 +87,11 @@ gjstest_test_func_gjs_jsapi_util_error_throw(GjsUnitTestFixture *fx,
 
     g_assert(JS_IsExceptionPending(fx->cx));
 
-    JS_GetPendingException(fx->cx, exc.address());
+    JS_GetPendingException(fx->cx, &exc);
     g_assert(!exc.isUndefined());
 
     JS::RootedObject exc_obj(fx->cx, &exc.toObject());
-    JS_GetProperty(fx->cx, exc_obj, "message", value.address());
+    JS_GetProperty(fx->cx, exc_obj, "message", &value);
 
     g_assert(value.isString());
 
@@ -117,7 +117,7 @@ gjstest_test_func_gjs_jsapi_util_error_throw(GjsUnitTestFixture *fx,
     g_assert(JS_IsExceptionPending(fx->cx));
 
     exc = JS::UndefinedValue();
-    JS_GetPendingException(fx->cx, exc.address());
+    JS_GetPendingException(fx->cx, &exc);
     g_assert(!exc.isUndefined());
     g_assert(&exc.toObject() == &previous.toObject());
 }



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