[gjs: 2/7] js: Replace all jsval by JS::Value



commit dcfc291ad1734f7a407e4d05eee7f6a22297b217
Author: Philip Chimento <philip chimento gmail com>
Date:   Tue Sep 6 22:57:10 2016 -0700

    js: Replace all jsval by JS::Value
    
    JS::Value is the new-style API. Nowadays jsval is simply a typedef for
    JS::Value for convenience, but since we will be updating everything to
    the JS::RootedValue, JS::HandleValue style API in mozjs31, we may as well
    go through and weed out all usage of jsval in favor of JS::Value for
    clarity.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=742249

 gi/arg.cpp                        |   96 ++++++++++++++++++------------------
 gi/arg.h                          |   14 +++---
 gi/boxed.cpp                      |   36 +++++++-------
 gi/closure.cpp                    |    8 ++--
 gi/closure.h                      |    4 +-
 gi/enumeration.cpp                |    6 +-
 gi/foreign.cpp                    |    4 +-
 gi/foreign.h                      |    8 ++--
 gi/function.cpp                   |   46 +++++++++---------
 gi/function.h                     |   10 ++--
 gi/fundamental.cpp                |   12 ++--
 gi/gerror.cpp                     |   20 +++++---
 gi/gtype.cpp                      |   10 ++--
 gi/gtype.h                        |    8 ++--
 gi/interface.cpp                  |    4 +-
 gi/interface.h                    |    2 +-
 gi/keep-alive.cpp                 |    4 +-
 gi/ns.cpp                         |    4 +-
 gi/object.cpp                     |   58 +++++++++++-----------
 gi/object.h                       |    2 +-
 gi/param.cpp                      |    4 +-
 gi/proxyutils.cpp                 |    2 +-
 gi/proxyutils.h                   |    2 +-
 gi/repo.cpp                       |   28 +++++-----
 gi/union.cpp                      |   14 +++---
 gi/value.cpp                      |   34 +++++++-------
 gi/value.h                        |    6 +-
 gjs/byteArray.cpp                 |   24 +++++-----
 gjs/compat.h                      |    7 ++-
 gjs/context.cpp                   |   12 ++--
 gjs/coverage.cpp                  |   70 +++++++++++++-------------
 gjs/importer.cpp                  |   17 +++----
 gjs/jsapi-dynamic-class.cpp       |   10 ++--
 gjs/jsapi-util-array.cpp          |   69 ++++++++++++++-------------
 gjs/jsapi-util-error.cpp          |    2 +-
 gjs/jsapi-util-string.cpp         |   24 +++++-----
 gjs/jsapi-util.cpp                |   90 ++++++++++++++++++-----------------
 gjs/jsapi-util.h                  |   90 +++++++++++++++++-----------------
 gjs/stack.cpp                     |   10 ++--
 modules/cairo-context.cpp         |   46 +++++++++---------
 modules/cairo-gradient.cpp        |    4 +-
 modules/cairo-image-surface.cpp   |   10 ++--
 modules/cairo-pattern.cpp         |    2 +-
 modules/cairo-private.h           |   28 +++++-----
 modules/cairo-region.cpp          |   20 ++++----
 modules/cairo-solid-pattern.cpp   |    4 +-
 modules/cairo-surface-pattern.cpp |    8 ++--
 modules/cairo-surface.cpp         |    8 ++--
 modules/cairo.cpp                 |    2 +-
 modules/console.cpp               |    4 +-
 modules/console.h                 |    2 +-
 modules/system.cpp                |   20 ++++----
 test/gjs-tests.cpp                |    6 +-
 53 files changed, 523 insertions(+), 512 deletions(-)
---
diff --git a/gi/arg.cpp b/gi/arg.cpp
index 93d6454..34d86be 100644
--- a/gi/arg.cpp
+++ b/gi/arg.cpp
@@ -275,7 +275,7 @@ type_needs_out_release(GITypeInfo *type_info,
 
 static JSBool
 gjs_array_to_g_list(JSContext   *context,
-                    jsval        array_value,
+                    JS::Value    array_value,
                     unsigned int length,
                     GITypeInfo  *param_info,
                     GITransfer   transfer,
@@ -286,7 +286,7 @@ gjs_array_to_g_list(JSContext   *context,
     guint32 i;
     GList *list;
     GSList *slist;
-    jsval elem;
+    JS::Value elem;
 
     list = NULL;
     slist = NULL;
@@ -352,7 +352,7 @@ gjs_array_to_g_list(JSContext   *context,
 
 static JSBool
 gjs_object_to_g_hash(JSContext   *context,
-                     jsval        hash_value,
+                     JS::Value    hash_value,
                      GITypeInfo  *key_param_info,
                      GITypeInfo  *val_param_info,
                      GITransfer   transfer,
@@ -395,7 +395,7 @@ gjs_object_to_g_hash(JSContext   *context,
    result = g_hash_table_new(g_str_hash, g_str_equal);
 
    while (!JSID_IS_VOID(prop_id)) {
-        jsval key_js, val_js;
+        JS::Value key_js, val_js;
         GArgument key_arg = { 0 }, val_arg = { 0 };
 
         if (!JS_IdToValue(context, prop_id, &key_js))
@@ -437,11 +437,11 @@ gjs_object_to_g_hash(JSContext   *context,
 
 JSBool
 gjs_array_from_strv(JSContext   *context,
-                    jsval       *value_p,
+                    JS::Value   *value_p,
                     const char **strv)
 {
     JSObject *obj;
-    jsval elem;
+    JS::Value elem;
     guint i;
     JSBool result = JS_FALSE;
 
@@ -474,7 +474,7 @@ out:
 
 JSBool
 gjs_array_to_strv(JSContext   *context,
-                  jsval        array_value,
+                  JS::Value    array_value,
                   unsigned int length,
                   void       **arr_p)
 {
@@ -484,7 +484,7 @@ gjs_array_to_strv(JSContext   *context,
     result = g_new0(char *, length+1);
 
     for (i = 0; i < length; ++i) {
-        jsval elem;
+        JS::Value elem;
 
         elem = JSVAL_VOID;
         if (!JS_GetElement(context, JSVAL_TO_OBJECT(array_value),
@@ -515,7 +515,7 @@ gjs_array_to_strv(JSContext   *context,
 
 static JSBool
 gjs_string_to_intarray(JSContext   *context,
-                       jsval        string_val,
+                       JS::Value    string_val,
                        GITypeInfo  *param_info,
                        void       **arr_p,
                        gsize       *length)
@@ -553,7 +553,7 @@ gjs_string_to_intarray(JSContext   *context,
 
 static JSBool
 gjs_array_to_intarray(JSContext   *context,
-                      jsval        array_value,
+                      JS::Value    array_value,
                       unsigned int length,
                       void       **arr_p,
                       unsigned intsize,
@@ -568,7 +568,7 @@ gjs_array_to_intarray(JSContext   *context,
     result = g_malloc0((length+1) * intsize);
 
     for (i = 0; i < length; ++i) {
-        jsval elem;
+        JS::Value elem;
         JSBool success;
 
         elem = JSVAL_VOID;
@@ -612,7 +612,7 @@ gjs_array_to_intarray(JSContext   *context,
 
 static JSBool
 gjs_gtypearray_to_array(JSContext   *context,
-                        jsval        array_value,
+                        JS::Value    array_value,
                         unsigned int length,
                         void       **arr_p)
 {
@@ -623,7 +623,7 @@ gjs_gtypearray_to_array(JSContext   *context,
     result = (GType *) g_malloc0((length+1) * sizeof(GType));
 
     for (i = 0; i < length; ++i) {
-        jsval elem;
+        JS::Value elem;
         GType gtype;
 
         elem = JSVAL_VOID;
@@ -656,7 +656,7 @@ gjs_gtypearray_to_array(JSContext   *context,
 
 static JSBool
 gjs_array_to_floatarray(JSContext   *context,
-                        jsval        array_value,
+                        JS::Value    array_value,
                         unsigned int length,
                         void       **arr_p,
                         gboolean     is_double)
@@ -668,7 +668,7 @@ gjs_array_to_floatarray(JSContext   *context,
     result = g_malloc0((length+1) * (is_double ? sizeof(double) : sizeof(float)));
 
     for (i = 0; i < length; ++i) {
-        jsval elem;
+        JS::Value elem;
         double val;
         JSBool success;
 
@@ -709,7 +709,7 @@ gjs_array_to_floatarray(JSContext   *context,
 
 static JSBool
 gjs_array_to_ptrarray(JSContext   *context,
-                      jsval        array_value,
+                      JS::Value    array_value,
                       unsigned int length,
                       GITransfer   transfer,
                       GITypeInfo  *param_info,
@@ -722,7 +722,7 @@ gjs_array_to_ptrarray(JSContext   *context,
     array[length] = NULL;
 
     for (i = 0; i < length; i++) {
-        jsval elem;
+        JS::Value elem;
         GIArgument arg;
         arg.v_pointer = NULL;
 
@@ -763,7 +763,7 @@ gjs_array_to_ptrarray(JSContext   *context,
 
 static JSBool
 gjs_array_to_flat_gvalue_array(JSContext   *context,
-                               jsval        array_value,
+                               JS::Value    array_value,
                                unsigned int length,
                                void       **arr_p)
 {
@@ -772,7 +772,7 @@ gjs_array_to_flat_gvalue_array(JSContext   *context,
     JSBool result = JS_TRUE;
 
     for (i = 0; i < length; i ++) {
-        jsval elem;
+        JS::Value elem;
         elem = JSVAL_VOID;
 
         if (!JS_GetElement(context, JSVAL_TO_OBJECT(array_value),
@@ -800,11 +800,11 @@ static JSBool
 gjs_array_from_flat_gvalue_array(JSContext   *context,
                                  gpointer     array,
                                  unsigned int length,
-                                 jsval       *value)
+                                 JS::Value   *value)
 {
     GValue *values = (GValue *)array;
     unsigned int i;
-    jsval *elems = g_newa(jsval, length);
+    JS::Value *elems = g_newa(JS::Value, length);
     JSBool result = JS_TRUE;
 
     for (i = 0; i < length; i ++) {
@@ -875,7 +875,7 @@ is_gvalue_flat_array(GITypeInfo *param_info,
 
 static JSBool
 gjs_array_to_array(JSContext   *context,
-                   jsval        array_value,
+                   JS::Value    array_value,
                    gsize        length,
                    GITransfer   transfer,
                    GITypeInfo  *param_info,
@@ -1061,7 +1061,7 @@ type_tag_to_human_string(GITypeInfo *type_info)
 
 static void
 throw_invalid_argument(JSContext      *context,
-                       jsval           value,
+                       JS::Value       value,
                        GITypeInfo     *arginfo,
                        const char     *arg_name,
                        GjsArgumentType arg_type)
@@ -1077,7 +1077,7 @@ throw_invalid_argument(JSContext      *context,
 
 static JSBool
 gjs_array_to_explicit_array_internal(JSContext       *context,
-                                     jsval            value,
+                                     JS::Value        value,
                                      GITypeInfo      *type_info,
                                      const char      *arg_name,
                                      GjsArgumentType  arg_type,
@@ -1111,7 +1111,7 @@ gjs_array_to_explicit_array_internal(JSContext       *context,
             goto out;
     } else if (JS_HasPropertyById(context, JSVAL_TO_OBJECT(value), length_name, &found_length) &&
                found_length) {
-        jsval length_value;
+        JS::Value length_value;
         guint32 length;
 
         if (!gjs_object_require_property(context,
@@ -1145,7 +1145,7 @@ gjs_array_to_explicit_array_internal(JSContext       *context,
 
 JSBool
 gjs_value_to_g_argument(JSContext      *context,
-                        jsval           value,
+                        JS::Value       value,
                         GITypeInfo     *type_info,
                         const char     *arg_name,
                         GjsArgumentType arg_type,
@@ -1162,7 +1162,7 @@ gjs_value_to_g_argument(JSContext      *context,
     type_tag = g_type_info_get_tag( (GITypeInfo*) type_info);
 
     gjs_debug_marshal(GJS_DEBUG_GFUNCTION,
-                      "Converting jsval to GArgument %s",
+                      "Converting JS::Value to GArgument %s",
                       g_type_tag_to_string(type_tag));
 
     nullable_type = FALSE;
@@ -1656,7 +1656,7 @@ gjs_value_to_g_argument(JSContext      *context,
             JSVAL_IS_OBJECT(value) &&
             JS_HasPropertyById(context, JSVAL_TO_OBJECT(value), length_name, &found_length) &&
             found_length) {
-            jsval length_value;
+            JS::Value length_value;
             guint32 length;
 
             if (!gjs_object_require_property(context,
@@ -1967,7 +1967,7 @@ gjs_g_argument_init_default(JSContext      *context,
 
 JSBool
 gjs_value_to_arg(JSContext  *context,
-                 jsval       value,
+                 JS::Value   value,
                  GIArgInfo  *arg_info,
                  GArgument  *arg)
 {
@@ -1987,7 +1987,7 @@ gjs_value_to_arg(JSContext  *context,
 
 JSBool
 gjs_value_to_explicit_array (JSContext  *context,
-                             jsval       value,
+                             JS::Value   value,
                              GIArgInfo  *arg_info,
                              GArgument  *arg,
                              gsize      *length_p)
@@ -2009,7 +2009,7 @@ gjs_value_to_explicit_array (JSContext  *context,
 
 static JSBool
 gjs_array_from_g_list (JSContext  *context,
-                       jsval      *value_p,
+                       JS::Value  *value_p,
                        GITypeTag   list_tag,
                        GITypeInfo *param_info,
                        GList      *list,
@@ -2017,7 +2017,7 @@ gjs_array_from_g_list (JSContext  *context,
 {
     JSObject *obj;
     unsigned int i;
-    jsval elem;
+    JS::Value elem;
     GArgument arg;
     JSBool result;
 
@@ -2077,13 +2077,13 @@ gjs_array_from_g_list (JSContext  *context,
 
 static JSBool
 gjs_array_from_carray_internal (JSContext  *context,
-                                jsval      *value_p,
+                                JS::Value  *value_p,
                                 GITypeInfo *param_info,
                                 guint       length,
                                 gpointer    array)
 {
     JSObject *obj;
-    jsval elem;
+    JS::Value elem;
     GArgument arg;
     JSBool result;
     GITypeTag element_type;
@@ -2219,7 +2219,7 @@ finally:
 
 static JSBool
 gjs_array_from_fixed_size_array (JSContext  *context,
-                                 jsval      *value_p,
+                                 JS::Value  *value_p,
                                  GITypeInfo *type_info,
                                  gpointer    array)
 {
@@ -2242,7 +2242,7 @@ gjs_array_from_fixed_size_array (JSContext  *context,
 
 JSBool
 gjs_value_from_explicit_array(JSContext  *context,
-                              jsval      *value_p,
+                              JS::Value  *value_p,
                               GITypeInfo *type_info,
                               GArgument  *arg,
                               int         length)
@@ -2261,7 +2261,7 @@ gjs_value_from_explicit_array(JSContext  *context,
 
 static JSBool
 gjs_array_from_boxed_array (JSContext   *context,
-                            jsval       *value_p,
+                            JS::Value   *value_p,
                             GIArrayType  array_type,
                             GITypeInfo  *param_info,
                             GArgument   *arg)
@@ -2298,12 +2298,12 @@ gjs_array_from_boxed_array (JSContext   *context,
 
 static JSBool
 gjs_array_from_zero_terminated_c_array (JSContext  *context,
-                                        jsval      *value_p,
+                                        JS::Value  *value_p,
                                         GITypeInfo *param_info,
                                         gpointer    c_array)
 {
     JSObject *obj;
-    jsval elem;
+    JS::Value elem;
     GArgument arg;
     JSBool result;
     GITypeTag element_type;
@@ -2407,7 +2407,7 @@ finally:
 
 static JSBool
 gjs_object_from_g_hash (JSContext  *context,
-                        jsval      *value_p,
+                        JS::Value  *value_p,
                         GITypeInfo *key_param_info,
                         GITypeInfo *val_param_info,
                         GHashTable *hash)
@@ -2416,7 +2416,7 @@ gjs_object_from_g_hash (JSContext  *context,
     JSObject *obj;
     JSString *keystr;
     char     *keyutf8 = NULL;
-    jsval     keyjs,  valjs;
+    JS::Value keyjs, valjs;
     GArgument keyarg, valarg;
     JSBool result;
 
@@ -2486,7 +2486,7 @@ gjs_object_from_g_hash (JSContext  *context,
 
 JSBool
 gjs_value_from_g_argument (JSContext  *context,
-                           jsval      *value_p,
+                           JS::Value  *value_p,
                            GITypeInfo *type_info,
                            GArgument  *arg,
                            gboolean    copy_structs)
@@ -2496,7 +2496,7 @@ gjs_value_from_g_argument (JSContext  *context,
     type_tag = g_type_info_get_tag( (GITypeInfo*) type_info);
 
     gjs_debug_marshal(GJS_DEBUG_GFUNCTION,
-                      "Converting GArgument %s to jsval",
+                      "Converting GArgument %s to JS::Value",
                       g_type_tag_to_string(type_tag));
 
     *value_p = JSVAL_NULL;
@@ -2602,7 +2602,7 @@ gjs_value_from_g_argument (JSContext  *context,
 
     case GI_TYPE_TAG_INTERFACE:
         {
-            jsval value;
+            JS::Value value;
             GIBaseInfo* interface_info;
             GIInfoType interface_type;
             GType gtype;
@@ -2626,7 +2626,7 @@ gjs_value_from_g_argument (JSContext  *context,
                 gint64 value_int64 = _gjs_enum_from_int ((GIEnumInfo *)interface_info, arg->v_int);
 
                 if (_gjs_enum_value_is_valid(context, (GIEnumInfo *)interface_info, value_int64)) {
-                    jsval tmp;
+                    JS::Value tmp;
                     if (JS_NewNumberValue(context, value_int64, &tmp))
                         value = tmp;
                 }
@@ -2637,7 +2637,7 @@ gjs_value_from_g_argument (JSContext  *context,
 
                 gtype = g_registered_type_info_get_g_type((GIRegisteredTypeInfo*)interface_info);
                 if (_gjs_flags_value_is_valid(context, gtype, value_int64)) {
-                    jsval tmp;
+                    JS::Value tmp;
                     if (JS_NewNumberValue(context, value_int64, &tmp))
                         value = tmp;
                 }
@@ -2753,14 +2753,14 @@ gjs_value_from_g_argument (JSContext  *context,
                 if (obj)
                     value = OBJECT_TO_JSVAL(obj);
             } else if (gtype == G_TYPE_NONE) {
-                gjs_throw(context, "Unexpected unregistered type packing GArgument into jsval");
+                gjs_throw(context, "Unexpected unregistered type packing GArgument into JS::Value");
             } else if (G_TYPE_IS_INSTANTIATABLE(gtype) || G_TYPE_IS_INTERFACE(gtype)) {
                 JSObject *obj;
                 obj = gjs_object_from_g_fundamental(context, (GIObjectInfo *)interface_info, arg->v_pointer);
                 if (obj)
                     value = OBJECT_TO_JSVAL(obj);
             } else {
-                gjs_throw(context, "Unhandled GType %s packing GArgument into jsval",
+                gjs_throw(context, "Unhandled GType %s packing GArgument into JS::Value",
                           g_type_name(gtype));
             }
 
diff --git a/gi/arg.h b/gi/arg.h
index 66621ad..f22f4cc 100644
--- a/gi/arg.h
+++ b/gi/arg.h
@@ -43,12 +43,12 @@ typedef enum {
 } GjsArgumentType;
 
 JSBool gjs_value_to_arg   (JSContext  *context,
-                           jsval       value,
+                           JS::Value   value,
                            GIArgInfo  *arg_info,
                            GArgument  *arg);
 
 JSBool gjs_value_to_explicit_array (JSContext  *context,
-                                    jsval       value,
+                                    JS::Value   value,
                                     GIArgInfo  *arg_info,
                                     GArgument  *arg,
                                     gsize      *length_p);
@@ -58,7 +58,7 @@ void gjs_g_argument_init_default (JSContext      *context,
                                   GArgument      *arg);
 
 JSBool gjs_value_to_g_argument (JSContext      *context,
-                                jsval           value,
+                                JS::Value       value,
                                 GITypeInfo     *type_info,
                                 const char     *arg_name,
                                 GjsArgumentType argument_type,
@@ -67,12 +67,12 @@ JSBool gjs_value_to_g_argument (JSContext      *context,
                                 GArgument      *arg);
 
 JSBool gjs_value_from_g_argument (JSContext  *context,
-                                  jsval      *value_p,
+                                  JS::Value  *value_p,
                                   GITypeInfo *type_info,
                                   GArgument  *arg,
                                   gboolean    copy_structs);
 JSBool gjs_value_from_explicit_array (JSContext  *context,
-                                      jsval      *value_p,
+                                      JS::Value  *value_p,
                                       GITypeInfo *type_info,
                                       GArgument  *arg,
                                       int         length);
@@ -108,11 +108,11 @@ gint64 _gjs_enum_from_int (GIEnumInfo *enum_info,
                            int         int_value);
 
 JSBool gjs_array_from_strv (JSContext   *context,
-                            jsval       *value_p,
+                            JS::Value   *value_p,
                             const char **strv);
 
 JSBool gjs_array_to_strv (JSContext   *context,
-                          jsval        array_value,
+                          JS::Value    array_value,
                           unsigned int length,
                           void       **arr_p);
 
diff --git a/gi/boxed.cpp b/gi/boxed.cpp
index 6d1ccd1..dc144af 100644
--- a/gi/boxed.cpp
+++ b/gi/boxed.cpp
@@ -63,7 +63,7 @@ static gboolean struct_is_simple(GIStructInfo *info);
 static JSBool boxed_set_field_from_value(JSContext   *context,
                                          Boxed       *priv,
                                          GIFieldInfo *field_info,
-                                         jsval        value);
+                                         JS::Value    value);
 
 extern struct JSClass gjs_boxed_class;
 
@@ -190,13 +190,13 @@ boxed_new_resolve(JSContext *context,
     return ret;
 }
 
-/* Check to see if jsval passed in is another Boxed object of the same,
+/* Check to see if JS::Value passed in is another Boxed object of the same,
  * and if so, retrieves the Boxed private structure for it.
  */
 static JSBool
 boxed_get_copy_source(JSContext *context,
                       Boxed     *priv,
-                      jsval      value,
+                      JS::Value  value,
                       Boxed    **source_priv_out)
 {
     Boxed *source_priv;
@@ -259,7 +259,7 @@ static JSBool
 boxed_init_from_props(JSContext   *context,
                       JSObject    *obj,
                       Boxed       *priv,
-                      jsval        props_value)
+                      JS::Value    props_value)
 {
     JSObject *props;
     JSObject *iter;
@@ -291,7 +291,7 @@ boxed_init_from_props(JSContext   *context,
     while (!JSID_IS_VOID(prop_id)) {
         GIFieldInfo *field_info;
         char *name;
-        jsval value;
+        JS::Value value;
 
         if (!gjs_get_string_id(context, prop_id, &name))
             goto out;
@@ -330,10 +330,10 @@ boxed_invoke_constructor(JSContext   *context,
                          JSObject    *obj,
                          jsid         constructor_name,
                          unsigned     argc,
-                         jsval       *argv,
-                         jsval       *rval)
+                         JS::Value   *argv,
+                         JS::Value   *rval)
 {
-    jsval js_constructor, js_constructor_func;
+    JS::Value js_constructor, js_constructor_func;
     jsid constructor_const;
 
     constructor_const = gjs_context_get_const_string(context, GJS_STRING_CONSTRUCTOR);
@@ -352,8 +352,8 @@ boxed_new(JSContext   *context,
           JSObject    *obj, /* "this" for constructor */
           Boxed       *priv,
           unsigned     argc,
-          jsval       *argv,
-          jsval       *rval)
+          JS::Value   *argv,
+          JS::Value   *rval)
 {
     if (priv->gtype == G_TYPE_VARIANT) {
         jsid constructor_name;
@@ -431,7 +431,7 @@ GJS_NATIVE_CONSTRUCTOR_DECLARE(boxed)
     Boxed *proto_priv;
     JSObject *proto;
     Boxed *source_priv;
-    jsval actual_rval;
+    JS::Value actual_rval;
     JSBool retval;
 
     GJS_NATIVE_CONSTRUCTOR_PRELUDE(boxed);
@@ -551,7 +551,7 @@ get_field_info (JSContext *context,
 {
     GIFieldInfo *field_info;
     char *name;
-    jsval value;
+    JS::Value value;
 
     if (!priv->field_map)
         priv->field_map = get_field_map(priv->info);
@@ -582,7 +582,7 @@ get_nested_interface_object (JSContext   *context,
                              GIFieldInfo *field_info,
                              GITypeInfo  *type_info,
                              GIBaseInfo  *interface_info,
-                             jsval       *value)
+                             JS::Value   *value)
 {
     JSObject *obj;
     JSObject *proto;
@@ -708,7 +708,7 @@ set_nested_interface_object (JSContext   *context,
                              GIFieldInfo *field_info,
                              GITypeInfo  *type_info,
                              GIBaseInfo  *interface_info,
-                             jsval        value)
+                             JS::Value    value)
 {
     JSObject *proto;
     int offset;
@@ -751,7 +751,7 @@ static JSBool
 boxed_set_field_from_value(JSContext   *context,
                            Boxed       *priv,
                            GIFieldInfo *field_info,
-                           jsval        value)
+                           JS::Value    value)
 {
     GITypeInfo *type_info;
     GArgument arg;
@@ -893,14 +893,14 @@ define_boxed_class_fields (JSContext *context,
 static JSBool
 to_string_func(JSContext *context,
                unsigned   argc,
-               jsval     *vp)
+               JS::Value *vp)
 {
     JS::CallReceiver rec = JS::CallReceiverFromVp(vp);
     JSObject *obj = JSVAL_TO_OBJECT(rec.thisv());
 
     Boxed *priv;
     JSBool ret = JS_FALSE;
-    jsval retval;
+    JS::Value retval;
 
     if (!priv_from_js_with_typecheck(context, obj, &priv))
         goto out;
@@ -1140,7 +1140,7 @@ gjs_define_boxed_class(JSContext    *context,
     const char *constructor_name;
     JSObject *prototype;
     JSObject *constructor;
-    jsval value;
+    JS::Value value;
     Boxed *priv;
 
     /* See the comment in gjs_define_object_class() for an
diff --git a/gi/closure.cpp b/gi/closure.cpp
index 61ed619..95c744d 100644
--- a/gi/closure.cpp
+++ b/gi/closure.cpp
@@ -246,10 +246,10 @@ closure_set_invalid(gpointer  data,
 }
 
 void
-gjs_closure_invoke(GClosure *closure,
-                   int       argc,
-                   jsval    *argv,
-                   jsval    *retval)
+gjs_closure_invoke(GClosure  *closure,
+                   int        argc,
+                   JS::Value *argv,
+                   JS::Value *retval)
 {
     Closure *c;
     JSContext *context;
diff --git a/gi/closure.h b/gi/closure.h
index 506178a..de5f235 100644
--- a/gi/closure.h
+++ b/gi/closure.h
@@ -36,8 +36,8 @@ GClosure*  gjs_closure_new           (JSContext    *context,
                                       gboolean      root_function);
 void       gjs_closure_invoke        (GClosure     *closure,
                                       int           argc,
-                                      jsval        *argv,
-                                      jsval        *retval);
+                                      JS::Value    *argv,
+                                      JS::Value    *retval);
 JSContext* gjs_closure_get_context   (GClosure     *closure);
 gboolean   gjs_closure_is_valid      (GClosure     *closure);
 JSObject*  gjs_closure_get_callable  (GClosure     *closure);
diff --git a/gi/enumeration.cpp b/gi/enumeration.cpp
index 598a11a..5ae196c 100644
--- a/gi/enumeration.cpp
+++ b/gi/enumeration.cpp
@@ -43,7 +43,7 @@ gjs_lookup_enumeration(JSContext    *context,
 {
     JSObject *in_object;
     const char *enum_name;
-    jsval value;
+    JS::Value value;
 
     in_object = gjs_lookup_namespace_object(context, (GIBaseInfo*) info);
 
@@ -70,7 +70,7 @@ gjs_define_enum_value(JSContext    *context,
     char *fixed_name;
     gsize i;
     gint64 value_val;
-    jsval value_js;
+    JS::Value value_js;
 
     value_name = g_base_info_get_name( (GIBaseInfo*) info);
     value_val = g_value_info_get_value(info);
@@ -113,7 +113,7 @@ gjs_define_enum_values(JSContext    *context,
 {
     GType gtype;
     int i, n_values;
-    jsval value;
+    JS::Value value;
 
     /* Fill in enum values first, so we don't define the enum itself until we're
      * sure we can finish successfully.
diff --git a/gi/foreign.cpp b/gi/foreign.cpp
index 7e2710a..b07b95b 100644
--- a/gi/foreign.cpp
+++ b/gi/foreign.cpp
@@ -139,7 +139,7 @@ gjs_struct_foreign_lookup(JSContext  *context,
 
 JSBool
 gjs_struct_foreign_convert_to_g_argument(JSContext      *context,
-                                         jsval           value,
+                                         JS::Value       value,
                                          GIBaseInfo     *interface_info,
                                          const char     *arg_name,
                                          GjsArgumentType argument_type,
@@ -162,7 +162,7 @@ gjs_struct_foreign_convert_to_g_argument(JSContext      *context,
 
 JSBool
 gjs_struct_foreign_convert_from_g_argument(JSContext  *context,
-                                           jsval      *value_p,
+                                           JS::Value  *value_p,
                                            GIBaseInfo *interface_info,
                                            GArgument  *arg)
 {
diff --git a/gi/foreign.h b/gi/foreign.h
index a4d3cf3..6cdde45 100644
--- a/gi/foreign.h
+++ b/gi/foreign.h
@@ -29,7 +29,7 @@
 #include "arg.h"
 
 typedef JSBool (*GjsArgOverrideToGArgumentFunc) (JSContext      *context,
-                                                 jsval           value,
+                                                 JS::Value       value,
                                                  const char     *arg_name,
                                                  GjsArgumentType argument_type,
                                                  GITransfer      transfer,
@@ -37,7 +37,7 @@ typedef JSBool (*GjsArgOverrideToGArgumentFunc) (JSContext      *context,
                                                  GArgument      *arg);
 
 typedef JSBool (*GjsArgOverrideFromGArgumentFunc) (JSContext  *context,
-                                                   jsval      *value_p,
+                                                   JS::Value  *value_p,
                                                    GArgument  *arg);
 typedef JSBool (*GjsArgOverrideReleaseGArgumentFunc) (JSContext  *context,
                                                       GITransfer  transfer,
@@ -54,7 +54,7 @@ JSBool  gjs_struct_foreign_register                (const char         *gi_names
                                                     GjsForeignInfo *info);
 
 JSBool  gjs_struct_foreign_convert_to_g_argument   (JSContext          *context,
-                                                    jsval               value,
+                                                    JS::Value           value,
                                                     GIBaseInfo         *interface_info,
                                                     const char         *arg_name,
                                                     GjsArgumentType     argument_type,
@@ -62,7 +62,7 @@ JSBool  gjs_struct_foreign_convert_to_g_argument   (JSContext          *context,
                                                     gboolean            may_be_null,
                                                     GArgument          *arg);
 JSBool  gjs_struct_foreign_convert_from_g_argument (JSContext          *context,
-                                                    jsval              *value_p,
+                                                    JS::Value          *value_p,
                                                     GIBaseInfo         *interface_info,
                                                     GArgument          *arg);
 JSBool  gjs_struct_foreign_release_g_argument      (JSContext          *context,
diff --git a/gi/function.cpp b/gi/function.cpp
index 35456f7..3ce4b64 100644
--- a/gi/function.cpp
+++ b/gi/function.cpp
@@ -175,7 +175,7 @@ gjs_callback_closure(ffi_cif *cif,
     JSObject *func_obj;
     GjsCallbackTrampoline *trampoline;
     int i, n_args, n_jsargs, n_outargs;
-    jsval *jsargs, rval;
+    JS::Value *jsargs, rval;
     JSObject *this_object;
     GITypeInfo ret_type;
     gboolean success = FALSE;
@@ -211,7 +211,7 @@ gjs_callback_closure(ffi_cif *cif,
     g_assert(n_args >= 0);
 
     n_outargs = 0;
-    jsargs = (jsval*)g_newa(jsval, n_args);
+    jsargs = (JS::Value *)g_newa(JS::Value, n_args);
     for (i = 0, n_jsargs = 0; i < n_args; i++) {
         GIArgInfo arg_info;
         GITypeInfo type_info;
@@ -241,7 +241,7 @@ gjs_callback_closure(ffi_cif *cif,
                 gint array_length_pos = g_type_info_get_array_length(&type_info);
                 GIArgInfo array_length_arg;
                 GITypeInfo arg_type_info;
-                jsval length;
+                JS::Value length;
 
                 g_callable_info_load_arg(trampoline->info, array_length_pos, &array_length_arg);
                 g_arg_info_load_type(&array_length_arg, &arg_type_info);
@@ -332,7 +332,7 @@ gjs_callback_closure(ffi_cif *cif,
             break;
         }
     } else {
-        jsval elem;
+        JS::Value elem;
         gsize elem_idx = 0;
         /* more than one of a return value or an out argument.
          * Should be an array of output values. */
@@ -420,7 +420,7 @@ gjs_destroy_notify_callback(gpointer data)
 
 GjsCallbackTrampoline*
 gjs_callback_trampoline_new(JSContext      *context,
-                            jsval           function,
+                            JS::Value       function,
                             GICallableInfo *callable_info,
                             GIScopeType     scope,
                             gboolean        is_vfunc)
@@ -672,8 +672,8 @@ gjs_invoke_c_function(JSContext      *context,
                       Function       *function,
                       JSObject       *obj, /* "this" object */
                       unsigned        js_argc,
-                      jsval          *js_argv,
-                      jsval          *js_rval,
+                      JS::Value      *js_argv,
+                      JS::Value      *js_rval,
                       GArgument      *r_value)
 {
     /* These first four are arrays which hold argument pointers.
@@ -707,7 +707,7 @@ gjs_invoke_c_function(JSContext      *context,
     gboolean is_method;
     GITypeInfo return_info;
     GITypeTag return_tag;
-    jsval *return_values = NULL;
+    JS::Value *return_values = NULL;
     guint8 next_rval = 0; /* index into return_values */
     GSList *iter;
 
@@ -849,7 +849,7 @@ gjs_invoke_c_function(JSContext      *context,
                 GIScopeType scope = g_arg_info_get_scope(&arg_info);
                 GjsCallbackTrampoline *trampoline;
                 ffi_closure *closure;
-                jsval value = js_argv[js_arg_pos];
+                JS::Value value = js_argv[js_arg_pos];
 
                 if (JSVAL_IS_NULL(value) && g_arg_info_may_be_null(&arg_info)) {
                     closure = NULL;
@@ -1012,7 +1012,7 @@ gjs_invoke_c_function(JSContext      *context,
 
     /* Only process return values if the function didn't throw */
     if (function->js_out_argc > 0 && !did_throw_gerror) {
-        return_values = g_newa(jsval, function->js_out_argc);
+        return_values = g_newa(JS::Value, function->js_out_argc);
         gjs_set_values(context, return_values, function->js_out_argc, JSVAL_VOID);
         gjs_root_value_locations(context, return_values, function->js_out_argc);
 
@@ -1029,7 +1029,7 @@ gjs_invoke_c_function(JSContext      *context,
             if (array_length_pos >= 0) {
                 GIArgInfo array_length_arg;
                 GITypeInfo arg_type_info;
-                jsval length;
+                JS::Value length;
 
                 g_callable_info_load_arg(function->info, array_length_pos, &array_length_arg);
                 g_arg_info_load_type(&array_length_arg, &arg_type_info);
@@ -1058,7 +1058,7 @@ gjs_invoke_c_function(JSContext      *context,
                     arg_failed = !gjs_value_from_g_argument(context, &return_values[next_rval],
                                                             &return_info, &return_gargument,
                                                             TRUE);
-                /* Free GArgument, the jsval should have ref'd or copied it */
+                /* Free GArgument, the JS::Value should have ref'd or copied it */
                 if (!arg_failed &&
                     !r_value &&
                     !gjs_g_argument_release(context,
@@ -1161,7 +1161,7 @@ release:
             GArgument *arg;
             gboolean arg_failed = FALSE;
             gint array_length_pos;
-            jsval array_length;
+            JS::Value array_length;
             GITransfer transfer;
 
             g_assert(next_rval < function->js_out_argc);
@@ -1201,7 +1201,7 @@ release:
             if (arg_failed)
                 postinvoke_release_failed = TRUE;
 
-            /* Free GArgument, the jsval should have ref'd or copied it */
+            /* Free GArgument, the JS::Value should have ref'd or copied it */
             transfer = g_arg_info_get_ownership_transfer(&arg_info);
             if (!arg_failed) {
                 if (array_length_pos >= 0) {
@@ -1300,7 +1300,7 @@ release:
 static JSBool
 function_call(JSContext *context,
               unsigned   js_argc,
-              jsval     *vp)
+              JS::Value *vp)
 {
     JS::CallArgs js_argv = JS::CallArgsFromVp (js_argc, vp);
     JSObject *object = JSVAL_TO_OBJECT(js_argv.thisv());
@@ -1308,7 +1308,7 @@ function_call(JSContext *context,
 
     JSBool success;
     Function *priv;
-    jsval retval;
+    JS::Value retval;
 
     priv = priv_from_js(context, callee);
     gjs_debug_marshal(GJS_DEBUG_GFUNCTION,
@@ -1368,7 +1368,7 @@ get_num_arguments (JSContext *context,
                    JS::MutableHandleValue vp)
 {
     int n_args, n_jsargs, i;
-    jsval retval;
+    JS::Value retval;
     Function *priv;
 
     JS::CallReceiver rec = JS::CallReceiverFromVp(vp.address());
@@ -1400,13 +1400,13 @@ get_num_arguments (JSContext *context,
 static JSBool
 function_to_string (JSContext *context,
                     guint      argc,
-                    jsval     *vp)
+                    JS::Value *vp)
 {
     Function *priv;
     gchar *string;
     gboolean free;
     JSObject *self;
-    jsval retval;
+    JS::Value retval;
     JSBool ret = JS_FALSE;
     int i, n_args, n_jsargs;
     GString *arg_names_str;
@@ -1678,7 +1678,7 @@ function_new(JSContext      *context,
     if (!found) {
         JSObject *prototype;
         JSObject *parent_proto;
-        jsval native_function;
+        JS::Value native_function;
 
         JS_GetProperty(context, global, "Function", &native_function);
         /* We take advantage from that fact that Function.__proto__ is Function.prototype */
@@ -1789,8 +1789,8 @@ gjs_invoke_c_function_uncached (JSContext      *context,
                                 GIFunctionInfo *info,
                                 JSObject       *obj,
                                 unsigned        argc,
-                                jsval          *argv,
-                                jsval          *rval)
+                                JS::Value      *argv,
+                                JS::Value      *rval)
 {
   Function function;
   JSBool result;
@@ -1809,7 +1809,7 @@ gjs_invoke_constructor_from_c (JSContext      *context,
                                JSObject       *constructor,
                                JSObject       *obj,
                                unsigned        argc,
-                               jsval          *argv,
+                               JS::Value      *argv,
                                GArgument      *rvalue)
 {
     Function *priv;
diff --git a/gi/function.h b/gi/function.h
index 24c23f2..0eaf26b 100644
--- a/gi/function.h
+++ b/gi/function.h
@@ -44,7 +44,7 @@ typedef struct {
     gint ref_count;
     JSContext *context;
     GICallableInfo *info;
-    jsval js_function;
+    JS::Value js_function;
     ffi_cif cif;
     ffi_closure *closure;
     GIScopeType scope;
@@ -53,7 +53,7 @@ typedef struct {
 } GjsCallbackTrampoline;
 
 GjsCallbackTrampoline* gjs_callback_trampoline_new(JSContext      *context,
-                                                   jsval           function,
+                                                   JS::Value       function,
                                                    GICallableInfo *callable_info,
                                                    GIScopeType     scope,
                                                    gboolean        is_vfunc);
@@ -70,14 +70,14 @@ JSBool    gjs_invoke_c_function_uncached (JSContext      *context,
                                           GIFunctionInfo *info,
                                           JSObject       *obj,
                                           unsigned        argc,
-                                          jsval          *argv,
-                                          jsval          *rval);
+                                          JS::Value      *argv,
+                                          JS::Value      *rval);
 
 JSBool    gjs_invoke_constructor_from_c (JSContext      *context,
                                          JSObject       *constructor,
                                          JSObject       *obj,
                                          unsigned        argc,
-                                         jsval          *argv,
+                                         JS::Value      *argv,
                                          GArgument      *rvalue);
 
 void     gjs_init_cinvoke_profiling (void);
diff --git a/gi/fundamental.cpp b/gi/fundamental.cpp
index 87b2293..4fcb590 100644
--- a/gi/fundamental.cpp
+++ b/gi/fundamental.cpp
@@ -384,10 +384,10 @@ fundamental_invoke_constructor(FundamentalInstance *priv,
                                JSContext           *context,
                                JSObject            *obj,
                                unsigned             argc,
-                               jsval               *argv,
+                               JS::Value           *argv,
                                GArgument           *rvalue)
 {
-    jsval js_constructor, js_constructor_func;
+    JS::Value js_constructor, js_constructor_func;
     jsid constructor_const;
     JSBool ret = JS_FALSE;
 
@@ -498,14 +498,14 @@ fundamental_finalize(JSFreeOp  *fop,
 static JSBool
 to_string_func(JSContext *context,
                unsigned   argc,
-               jsval     *vp)
+               JS::Value *vp)
 {
     JS::CallReceiver rec = JS::CallReceiverFromVp(vp);
     JSObject *obj = JSVAL_TO_OBJECT(rec.thisv());
 
     FundamentalInstance *priv;
     JSBool ret = JS_FALSE;
-    jsval retval;
+    JS::Value retval;
 
     if (!priv_from_js_with_typecheck(context, obj, &priv))
         goto out;
@@ -584,7 +584,7 @@ gjs_lookup_fundamental_prototype(JSContext    *context,
     JSObject *in_object;
     JSObject *constructor;
     const char *constructor_name;
-    jsval value;
+    JS::Value value;
 
     if (info) {
         in_object = gjs_lookup_namespace_object(context, (GIBaseInfo*) info);
@@ -649,7 +649,7 @@ gjs_define_fundamental_class(JSContext     *context,
 {
     const char *constructor_name;
     JSObject *prototype;
-    jsval value;
+    JS::Value value;
     jsid js_constructor_name = JSID_VOID;
     JSObject *parent_proto;
     Fundamental *priv;
diff --git a/gi/gerror.cpp b/gi/gerror.cpp
index 39786d7..0080b07 100644
--- a/gi/gerror.cpp
+++ b/gi/gerror.cpp
@@ -62,7 +62,7 @@ GJS_NATIVE_CONSTRUCTOR_DECLARE(error)
     Error *proto_priv;
     JSObject *proto;
     jsid message_name, code_name;
-    jsval v_message, v_code;
+    JS::Value v_message, v_code;
     gchar *message;
 
     /* Check early to avoid allocating memory for nothing */
@@ -206,12 +206,14 @@ error_get_code(JSContext *context, JS::HandleObject obj,
 }
 
 static JSBool
-error_to_string(JSContext *context, unsigned argc, jsval *vp)
+error_to_string(JSContext *context,
+                unsigned   argc,
+                JS::Value *vp)
 {
-    jsval v_self;
+    JS::Value v_self;
     JSObject *self;
     Error *priv;
-    jsval v_out;
+    JS::Value v_out;
     gchar *descr;
     JSBool retval;
 
@@ -261,11 +263,13 @@ error_to_string(JSContext *context, unsigned argc, jsval *vp)
 }
 
 static JSBool
-error_constructor_value_of(JSContext *context, unsigned argc, jsval *vp)
+error_constructor_value_of(JSContext *context,
+                           unsigned   argc,
+                           JS::Value *vp)
 {
-    jsval v_self, v_prototype;
+    JS::Value v_self, v_prototype;
     Error *priv;
-    jsval v_out;
+    JS::Value v_out;
     jsid prototype_name;
 
     JS::CallReceiver rec = JS::CallReceiverFromVp(vp);
@@ -447,7 +451,7 @@ define_error_properties(JSContext *context,
                         JSObject  *obj)
 {
     jsid stack_name, filename_name, linenumber_name;
-    jsval stack, fileName, lineNumber;
+    JS::Value stack, fileName, lineNumber;
 
     if (!gjs_context_get_frame_info (context,
                                      &stack,
diff --git a/gi/gtype.cpp b/gi/gtype.cpp
index a797194..958c7ce 100644
--- a/gi/gtype.cpp
+++ b/gi/gtype.cpp
@@ -64,7 +64,7 @@ gjs_gtype_finalize(JSFreeOp *fop,
 static JSBool
 to_string_func(JSContext *context,
                unsigned   argc,
-               jsval     *vp)
+               JS::Value *vp)
 {
     JS::CallReceiver rec = JS::CallReceiverFromVp(vp);
     JSObject *obj = JSVAL_TO_OBJECT(rec.thisv());
@@ -72,8 +72,8 @@ to_string_func(JSContext *context,
     GType gtype;
     gchar *strval;
     JSBool ret;
-    jsval retval;
-    
+    JS::Value retval;
+
     gtype = GPOINTER_TO_SIZE(priv_from_js(context, obj));
 
     if (gtype == 0)
@@ -96,7 +96,7 @@ get_name_func (JSContext *context,
 {
     GType gtype;
     JSBool ret;
-    jsval retval;
+    JS::Value retval;
     JS::CallReceiver rec = JS::CallReceiverFromVp(vp.address());
 
     gtype = GPOINTER_TO_SIZE(priv_from_js(context, obj));
@@ -162,7 +162,7 @@ _gjs_gtype_get_actual_gtype (JSContext *context,
                              int        recurse)
 {
     GType gtype = G_TYPE_INVALID;
-    jsval gtype_val = JSVAL_VOID;
+    JS::Value gtype_val = JSVAL_VOID;
 
     JS_BeginRequest(context);
     if (JS_InstanceOf(context, object, &gjs_gtype_class, NULL)) {
diff --git a/gi/gtype.h b/gi/gtype.h
index bde87ff..d5fc058 100644
--- a/gi/gtype.h
+++ b/gi/gtype.h
@@ -31,10 +31,10 @@
 
 G_BEGIN_DECLS
 
-jsval      gjs_gtype_create_proto         (JSContext       *context,
-                                           JSObject        *module,
-                                           const char      *proto_name,
-                                           JSObject        *parent);
+JS::Value   gjs_gtype_create_proto         (JSContext       *context,
+                                            JSObject        *module,
+                                            const char      *proto_name,
+                                            JSObject        *parent);
 
 JSObject * gjs_gtype_create_gtype_wrapper (JSContext *context,
                                            GType      gtype);
diff --git a/gi/interface.cpp b/gi/interface.cpp
index 44cc6e5..e9c5e30 100644
--- a/gi/interface.cpp
+++ b/gi/interface.cpp
@@ -194,7 +194,7 @@ gjs_define_interface_class(JSContext       *context,
     const char *ns;
     JSObject *constructor;
     JSObject *prototype;
-    jsval value;
+    JS::Value value;
 
     ns = gjs_get_names_from_gtype_and_gi_info(gtype, (GIBaseInfo *) info,
                                               &constructor_name);
@@ -243,7 +243,7 @@ gjs_define_interface_class(JSContext       *context,
 JSBool
 gjs_lookup_interface_constructor(JSContext *context,
                                  GType      gtype,
-                                 jsval     *value_p)
+                                 JS::Value *value_p)
 {
     JSObject *constructor;
     GIBaseInfo *interface_info;
diff --git a/gi/interface.h b/gi/interface.h
index 70e71a7..1390a65 100644
--- a/gi/interface.h
+++ b/gi/interface.h
@@ -39,7 +39,7 @@ JSBool gjs_define_interface_class (JSContext       *context,
 
 JSBool gjs_lookup_interface_constructor (JSContext     *context,
                                          GType          gtype,
-                                         jsval         *value_p);
+                                         JS::Value     *value_p);
 
 G_END_DECLS
 
diff --git a/gi/keep-alive.cpp b/gi/keep-alive.cpp
index 6c286df..6749ce8 100644
--- a/gi/keep-alive.cpp
+++ b/gi/keep-alive.cpp
@@ -120,7 +120,7 @@ trace_foreach(void *key,
     JSTracer *tracer = (JSTracer *) data;
 
     if (child->child != NULL) {
-        jsval val;
+        JS::Value val;
         JS_SET_TRACING_DETAILS(tracer, NULL, "keep-alive", 0);
         val = OBJECT_TO_JSVAL(child->child);
         g_assert (JSVAL_TO_TRACEABLE (val));
@@ -334,7 +334,7 @@ gjs_keep_alive_create(JSContext *context)
 JSObject*
 gjs_keep_alive_get_global_if_exists (JSContext *context)
 {
-    jsval keep_alive;
+    JS::Value keep_alive;
 
     keep_alive = gjs_get_global_slot(context, GJS_GLOBAL_SLOT_KEEP_ALIVE);
 
diff --git a/gi/ns.cpp b/gi/ns.cpp
index 5bda185..1c2c499 100644
--- a/gi/ns.cpp
+++ b/gi/ns.cpp
@@ -130,10 +130,10 @@ static JSBool
 get_name (JSContext *context,
           JS::HandleObject obj,
           JS::HandleId id,
-          jsval *vp)
+          JS::Value       *vp)
 {
     Ns *priv;
-    jsval retval;
+    JS::Value retval;
     JSBool ret = JS_FALSE;
 
     priv = priv_from_js(context, obj);
diff --git a/gi/object.cpp b/gi/object.cpp
index fad6e77..d4a6065 100644
--- a/gi/object.cpp
+++ b/gi/object.cpp
@@ -185,7 +185,7 @@ throw_priv_is_null_error(JSContext *context)
 static ValueFromPropertyResult
 init_g_param_from_property(JSContext  *context,
                            const char *js_prop_name,
-                           jsval       js_value,
+                           JS::Value   js_value,
                            GType       gtype,
                            GParameter *parameter,
                            gboolean    constructing)
@@ -668,7 +668,7 @@ static JSBool
 object_instance_props_to_g_parameters(JSContext   *context,
                                       JSObject    *obj,
                                       unsigned     argc,
-                                      jsval       *argv,
+                                      JS::Value   *argv,
                                       GType        gtype,
                                       GParameter **gparams_p,
                                       int         *n_gparams_p)
@@ -708,7 +708,7 @@ object_instance_props_to_g_parameters(JSContext   *context,
 
     while (!JSID_IS_VOID(prop_id)) {
         char *name = NULL;
-        jsval value;
+        JS::Value value;
         GParameter gparam = { NULL, { 0, }};
 
         if (!gjs_object_require_property(context, props, "property list", prop_id, &value)) {
@@ -1243,7 +1243,7 @@ static JSBool
 object_instance_init (JSContext *context,
                       JSObject **object,
                       unsigned   argc,
-                      jsval     *argv)
+                      JS::Value *argv)
 {
     ObjectInstance *priv;
     GType gtype;
@@ -1335,8 +1335,8 @@ GJS_NATIVE_CONSTRUCTOR_DECLARE(object_instance)
 {
     GJS_NATIVE_CONSTRUCTOR_VARIABLES(object_instance)
     JSBool ret;
-    jsval initer;
-    jsval rval;
+    JS::Value initer;
+    JS::Value rval;
     jsid object_init_name;
 
     GJS_NATIVE_CONSTRUCTOR_PRELUDE(object_instance);
@@ -1475,7 +1475,7 @@ gjs_lookup_object_constructor_from_info(JSContext    *context,
     JSObject *in_object;
     JSObject *constructor;
     const char *constructor_name;
-    jsval value;
+    JS::Value value;
 
     if (info) {
         in_object = gjs_lookup_namespace_object(context, (GIBaseInfo*) info);
@@ -1514,7 +1514,7 @@ gjs_lookup_object_prototype_from_info(JSContext    *context,
                                       GType         gtype)
 {
     JSObject *constructor;
-    jsval value;
+    JS::Value value;
 
     constructor = gjs_lookup_object_constructor_from_info(context, info, gtype);
 
@@ -1560,7 +1560,7 @@ signal_connection_invalidated (gpointer  user_data,
 static JSBool
 real_connect_func(JSContext *context,
                   unsigned   argc,
-                  jsval     *vp,
+                  JS::Value *vp,
                   gboolean  after)
 {
     JS::CallArgs argv = JS::CallArgsFromVp (argc, vp);
@@ -1572,7 +1572,7 @@ real_connect_func(JSContext *context,
     guint signal_id;
     char *signal_name;
     GQuark signal_detail;
-    jsval retval;
+    JS::Value retval;
     ConnectData *connect_data;
     JSBool ret = JS_FALSE;
 
@@ -1655,7 +1655,7 @@ real_connect_func(JSContext *context,
 static JSBool
 connect_after_func(JSContext *context,
                    unsigned   argc,
-                   jsval     *vp)
+                   JS::Value *vp)
 {
     return real_connect_func(context, argc, vp, TRUE);
 }
@@ -1663,7 +1663,7 @@ connect_after_func(JSContext *context,
 static JSBool
 connect_func(JSContext *context,
              unsigned   argc,
-             jsval     *vp)
+             JS::Value *vp)
 {
     return real_connect_func(context, argc, vp, FALSE);
 }
@@ -1671,7 +1671,7 @@ connect_func(JSContext *context,
 static JSBool
 emit_func(JSContext *context,
           unsigned   argc,
-          jsval     *vp)
+          JS::Value *vp)
 {
     JS::CallArgs argv = JS::CallArgsFromVp (argc, vp);
     JSObject *obj = JSVAL_TO_OBJECT(argv.thisv());
@@ -1685,7 +1685,7 @@ emit_func(JSContext *context,
     GValue rvalue = G_VALUE_INIT;
     unsigned int i;
     gboolean failed;
-    jsval retval;
+    JS::Value retval;
     JSBool ret = JS_FALSE;
 
     if (!do_base_typecheck(context, obj, JS_TRUE))
@@ -1795,14 +1795,14 @@ emit_func(JSContext *context,
 static JSBool
 to_string_func(JSContext *context,
                unsigned   argc,
-               jsval     *vp)
+               JS::Value *vp)
 {
     JS::CallReceiver rec = JS::CallReceiverFromVp(vp);
     JSObject *obj = JSVAL_TO_OBJECT(rec.thisv());
 
     ObjectInstance *priv;
     JSBool ret = JS_FALSE;
-    jsval retval;
+    JS::Value retval;
 
     if (!do_base_typecheck(context, obj, JS_TRUE))
         goto out;
@@ -1847,7 +1847,7 @@ struct JSClass gjs_object_instance_class = {
 static JSBool
 init_func (JSContext *context,
            unsigned   argc,
-           jsval     *vp)
+           JS::Value *vp)
 {
     JS::CallArgs argv = JS::CallArgsFromVp (argc, vp);
     JSObject *obj = JSVAL_TO_OBJECT(argv.thisv());
@@ -1947,7 +1947,7 @@ gjs_define_object_class(JSContext      *context,
     JSObject *parent_proto;
     JSObject *global;
 
-    jsval value;
+    JS::Value value;
     ObjectInstance *priv;
     const char *ns;
     GType parent_type;
@@ -2272,7 +2272,7 @@ find_vfunc_info (JSContext *context,
 static JSBool
 gjs_hook_up_vfunc(JSContext *cx,
                   unsigned   argc,
-                  jsval     *vp)
+                  JS::Value *vp)
 {
     JS::CallArgs argv = JS::CallArgsFromVp (argc, vp);
     gchar *name;
@@ -2401,7 +2401,7 @@ gjs_object_get_gproperty (GObject    *object,
     GjsContext *gjs_context;
     JSContext *context;
     JSObject *js_obj;
-    jsval jsvalue;
+    JS::Value jsvalue;
     gchar *underscore_name;
 
     gjs_context = gjs_context_get_current();
@@ -2423,7 +2423,7 @@ jsobj_set_gproperty (JSContext    *context,
                      const GValue *value,
                      GParamSpec   *pspec)
 {
-    jsval jsvalue;
+    JS::Value jsvalue;
     gchar *underscore_name;
 
     if (!gjs_value_from_g_value(context, &jsvalue, value))
@@ -2473,7 +2473,7 @@ gjs_object_constructor (GType                  type,
 
         if (n_construct_properties) {
             JSObject *args;
-            jsval argv;
+            JS::Value argv;
             guint i;
 
             args = JS_NewObject(context, NULL, NULL, NULL);
@@ -2525,7 +2525,7 @@ gjs_object_set_gproperty (GObject      *object,
 static JSBool
 gjs_override_property(JSContext *cx,
                       unsigned   argc,
-                      jsval     *vp)
+                      JS::Value *vp)
 {
     JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
     gchar *name = NULL;
@@ -2633,7 +2633,7 @@ gjs_object_custom_init(GTypeInstance *instance,
     JSContext *context;
     JSObject *object;
     ObjectInstance *priv;
-    jsval v, r;
+    JS::Value v, r;
 
     if (!object_init_list)
       return;
@@ -2786,7 +2786,7 @@ save_properties_for_class_init(JSContext *cx,
 static JSBool
 gjs_register_interface(JSContext *cx,
                        unsigned   argc,
-                       jsval     *vp)
+                       JS::Value *vp)
 {
     JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
     char *name = NULL;
@@ -2865,7 +2865,7 @@ gjs_register_interface(JSContext *cx,
 static JSBool
 gjs_register_type(JSContext *cx,
                   unsigned   argc,
-                  jsval     *vp)
+                  JS::Value *vp)
 {
     JS::CallArgs argv = JS::CallArgsFromVp (argc, vp);
     gchar *name;
@@ -2974,7 +2974,7 @@ out:
 static JSBool
 gjs_signal_new(JSContext *cx,
                unsigned   argc,
-               jsval     *vp)
+               JS::Value *vp)
 {
     JS::CallArgs argv = JS::CallArgsFromVp (argc, vp);
     JSObject *obj;
@@ -3027,7 +3027,7 @@ gjs_signal_new(JSContext *cx,
     }
     params = g_newa(GType, n_parameters);
     for (i = 0; i < n_parameters; i++) {
-        jsval gtype_val;
+        JS::Value gtype_val;
         if (!JS_GetElement(cx, JSVAL_TO_OBJECT(argv[5]), i, &gtype_val) ||
             !JSVAL_IS_OBJECT(gtype_val)) {
             gjs_throw(cx, "Invalid signal parameter number %d", i);
@@ -3090,7 +3090,7 @@ gjs_define_private_gi_stuff(JSContext *context,
 JSBool
 gjs_lookup_object_constructor(JSContext *context,
                               GType      gtype,
-                              jsval     *value_p)
+                              JS::Value *value_p)
 {
     JSObject *constructor;
     GIObjectInfo *object_info;
diff --git a/gi/object.h b/gi/object.h
index c54b2a3..376f8fd 100644
--- a/gi/object.h
+++ b/gi/object.h
@@ -37,7 +37,7 @@ void      gjs_define_object_class       (JSContext     *context,
                                          JSObject     **constructor_p);
 JSBool    gjs_lookup_object_constructor (JSContext     *context,
                                          GType          gtype,
-                                         jsval         *value_p);
+                                         JS::Value     *value_p);
 JSObject* gjs_object_from_g_object      (JSContext     *context,
                                          GObject       *gobj);
 GObject*  gjs_g_object_from_object      (JSContext     *context,
diff --git a/gi/param.cpp b/gi/param.cpp
index 27918b2..77ac8ce 100644
--- a/gi/param.cpp
+++ b/gi/param.cpp
@@ -187,7 +187,7 @@ gjs_lookup_param_prototype(JSContext    *context)
     JSObject *in_object;
     JSObject *constructor;
     jsid gobject_name;
-    jsval value;
+    JS::Value value;
 
     gobject_name = gjs_intern_string_to_id(context, "GObject");
     in_object = gjs_lookup_namespace_object_by_name(context, gobject_name);
@@ -220,7 +220,7 @@ gjs_define_param_class(JSContext    *context,
 {
     const char *constructor_name;
     JSObject *prototype;
-    jsval value;
+    JS::Value value;
     JSObject *constructor;
     GIObjectInfo *info;
 
diff --git a/gi/proxyutils.cpp b/gi/proxyutils.cpp
index b15c4e5..f40b5a5 100644
--- a/gi/proxyutils.cpp
+++ b/gi/proxyutils.cpp
@@ -38,7 +38,7 @@ _gjs_proxy_to_string_func(JSContext  *context,
                           GIBaseInfo *info,
                           GType       gtype,
                           gpointer    native_address,
-                          jsval      *rval)
+                          JS::Value  *rval)
 {
     GString *buf;
     JSBool ret = JS_FALSE;
diff --git a/gi/proxyutils.h b/gi/proxyutils.h
index 8ca7643..20324c7 100644
--- a/gi/proxyutils.h
+++ b/gi/proxyutils.h
@@ -35,7 +35,7 @@ JSBool _gjs_proxy_to_string_func(JSContext  *context,
                                  GIBaseInfo *info,
                                  GType       gtype,
                                  gpointer    native_address,
-                                 jsval      *ret);
+                                 JS::Value  *ret);
 
 G_END_DECLS
 
diff --git a/gi/repo.cpp b/gi/repo.cpp
index 7b5b59f..a13a4b3 100644
--- a/gi/repo.cpp
+++ b/gi/repo.cpp
@@ -63,9 +63,9 @@ get_version_for_ns (JSContext *context,
                     char     **version)
 {
     jsid versions_name;
-    jsval versions_val;
+    JS::Value versions_val;
     JSObject *versions;
-    jsval version_val;
+    JS::Value version_val;
 
     versions_name = gjs_context_get_const_string(context, GJS_STRING_GI_VERSIONS);
     if (!gjs_object_require_property(context, repo_obj, "GI repository object", versions_name, 
&versions_val) ||
@@ -95,7 +95,7 @@ resolve_namespace_object(JSContext  *context,
     GError *error;
     char *version;
     JSObject *override;
-    jsval result;
+    JS::Value result;
     JSObject *gi_namespace = NULL;
     JSBool ret = JS_FALSE;
 
@@ -333,7 +333,7 @@ repo_new(JSContext *context)
      * gobject-introspection does not yet search a path properly.
      */
     {
-        jsval value;
+        JS::Value value;
         JS_GetProperty(context, repo, "GLib", &value);
     }
 
@@ -358,7 +358,7 @@ gjs_define_constant(JSContext      *context,
                     JSObject       *in_object,
                     GIConstantInfo *info)
 {
-    jsval value;
+    JS::Value value;
     GArgument garg = { 0, };
     GITypeInfo *type_info;
     const char *name;
@@ -580,10 +580,10 @@ static JSObject*
 lookup_override_function(JSContext  *context,
                          jsid        ns_name)
 {
-    jsval importer;
-    jsval overridespkg;
-    jsval module;
-    jsval function;
+    JS::Value importer;
+    JS::Value overridespkg;
+    JS::Value module;
+    JS::Value function;
     jsid overrides_name, object_init_name;
 
     JS_BeginRequest(context);
@@ -623,9 +623,9 @@ gjs_lookup_namespace_object_by_name(JSContext      *context,
                                     jsid            ns_name)
 {
     JSObject *repo_obj;
-    jsval importer;
-    jsval girepository;
-    jsval ns_obj;
+    JS::Value importer;
+    JS::Value girepository;
+    JS::Value ns_obj;
     jsid gi_name;
 
     JS_BeginRequest(context);
@@ -771,7 +771,7 @@ gjs_lookup_generic_constructor(JSContext  *context,
     JSObject *in_object;
     JSObject *constructor;
     const char *constructor_name;
-    jsval value;
+    JS::Value value;
 
     in_object = gjs_lookup_namespace_object(context, (GIBaseInfo*) info);
     constructor_name = g_base_info_get_name((GIBaseInfo*) info);
@@ -796,7 +796,7 @@ gjs_lookup_generic_prototype(JSContext  *context,
                              GIBaseInfo *info)
 {
     JSObject *constructor;
-    jsval value;
+    JS::Value value;
 
     constructor = gjs_lookup_generic_constructor(context, info);
     if (G_UNLIKELY (constructor == NULL))
diff --git a/gi/union.cpp b/gi/union.cpp
index 870534c..154927e 100644
--- a/gi/union.cpp
+++ b/gi/union.cpp
@@ -160,7 +160,7 @@ union_new(JSContext   *context,
         if ((flags & GI_FUNCTION_IS_CONSTRUCTOR) != 0 &&
             g_callable_info_get_n_args((GICallableInfo*) func_info) == 0) {
 
-            jsval rval;
+            JS::Value rval;
 
             rval = JSVAL_NULL;
             gjs_invoke_c_function_uncached(context, func_info, obj,
@@ -227,8 +227,8 @@ GJS_NATIVE_CONSTRUCTOR_DECLARE(union)
     priv->gtype = proto_priv->gtype;
 
     /* union_new happens to be implemented by calling
-     * gjs_invoke_c_function(), which returns a jsval.
-     * The returned "gboxed" here is owned by that jsval,
+     * gjs_invoke_c_function(), which returns a JS::Value.
+     * The returned "gboxed" here is owned by that JS::Value,
      * not by us.
      */
     gboxed = union_new(context, object, priv->info);
@@ -237,7 +237,7 @@ GJS_NATIVE_CONSTRUCTOR_DECLARE(union)
         return JS_FALSE;
     }
 
-    /* Because "gboxed" is owned by a jsval and will
+    /* Because "gboxed" is owned by a JS::Value and will
      * be garbage collected, we make a copy here to be
      * owned by us.
      */
@@ -282,14 +282,14 @@ union_finalize(JSFreeOp *fop,
 static JSBool
 to_string_func(JSContext *context,
                unsigned   argc,
-               jsval     *vp)
+               JS::Value *vp)
 {
     JS::CallReceiver rec = JS::CallReceiverFromVp(vp);
     JSObject *obj = JSVAL_TO_OBJECT(rec.thisv());
 
     Union *priv;
     JSBool ret = JS_FALSE;
-    jsval retval;
+    JS::Value retval;
 
     if (!priv_from_js_with_typecheck(context, obj, &priv))
         goto out;
@@ -341,7 +341,7 @@ gjs_define_union_class(JSContext    *context,
 {
     const char *constructor_name;
     JSObject *prototype;
-    jsval value;
+    JS::Value value;
     Union *priv;
     GType gtype;
     JSObject *constructor;
diff --git a/gi/value.cpp b/gi/value.cpp
index 73f3669..2375682 100644
--- a/gi/value.cpp
+++ b/gi/value.cpp
@@ -42,7 +42,7 @@
 #include <girepository.h>
 
 static JSBool gjs_value_from_g_value_internal(JSContext    *context,
-                                              jsval        *value_p,
+                                              JS::Value    *value_p,
                                               const GValue *gvalue,
                                               gboolean      no_copy,
                                               GSignalQuery *signal_query,
@@ -85,7 +85,7 @@ get_signal_info_if_available(GSignalQuery *signal_query)
  */
 static JSBool
 gjs_value_from_array_and_length_values(JSContext    *context,
-                                       jsval        *value_p,
+                                       JS::Value    *value_p,
                                        GITypeInfo   *array_type_info,
                                        const GValue *array_value,
                                        const GValue *array_length_value,
@@ -93,7 +93,7 @@ gjs_value_from_array_and_length_values(JSContext    *context,
                                        GSignalQuery *signal_query,
                                        int           array_length_arg_n)
 {
-    jsval array_length;
+    JS::Value array_length;
     GArgument array_arg;
 
     g_assert(G_VALUE_HOLDS_POINTER(array_value));
@@ -122,8 +122,8 @@ closure_marshal(GClosure        *closure,
     JSRuntime *runtime;
     JSObject *obj;
     int argc;
-    jsval *argv;
-    jsval rval;
+    JS::Value *argv;
+    JS::Value rval;
     int i;
     GSignalQuery signal_query = { 0, };
     GISignalInfo *signal_info;
@@ -174,7 +174,7 @@ closure_marshal(GClosure        *closure,
     argc = n_param_values;
     rval = JSVAL_VOID;
     if (argc > 0) {
-        argv = g_newa(jsval, n_param_values);
+        argv = g_newa(JS::Value, n_param_values);
 
         gjs_set_values(context, argv, argc, JSVAL_VOID);
         gjs_root_value_locations(context, argv, argc);
@@ -338,7 +338,7 @@ gjs_closure_new_marshaled (JSContext    *context,
 
 static GType
 gjs_value_guess_g_type(JSContext *context,
-                       jsval      value)
+                       JS::Value  value)
 {
     if (JSVAL_IS_NULL(value))
         return G_TYPE_POINTER;
@@ -363,7 +363,7 @@ gjs_value_guess_g_type(JSContext *context,
 
 static JSBool
 gjs_value_to_g_value_internal(JSContext    *context,
-                              jsval         value,
+                              JS::Value     value,
                               GValue       *gvalue,
                               gboolean      no_copy)
 {
@@ -387,7 +387,7 @@ gjs_value_to_g_value_internal(JSContext    *context,
     }
 
     gjs_debug_marshal(GJS_DEBUG_GCLOSURE,
-                      "Converting jsval to gtype %s",
+                      "Converting JS::Value to gtype %s",
                       g_type_name(gtype));
 
 
@@ -518,7 +518,7 @@ gjs_value_to_g_value_internal(JSContext    *context,
             /* do nothing */
         } else if (JS_HasPropertyById(context, JSVAL_TO_OBJECT(value), length_name, &found_length) &&
                    found_length) {
-            jsval length_value;
+            JS::Value length_value;
             guint32 length;
 
             if (!gjs_object_require_property(context,
@@ -745,7 +745,7 @@ gjs_value_to_g_value_internal(JSContext    *context,
             return JS_FALSE;
         }
     } else {
-        gjs_debug(GJS_DEBUG_GCLOSURE, "jsval is number %d gtype fundamental %d transformable to int %d from 
int %d",
+        gjs_debug(GJS_DEBUG_GCLOSURE, "JS::Value is number %d gtype fundamental %d transformable to int %d 
from int %d",
                   JSVAL_IS_NUMBER(value),
                   G_TYPE_IS_FUNDAMENTAL(gtype),
                   g_value_type_transformable(gtype, G_TYPE_INT),
@@ -762,7 +762,7 @@ gjs_value_to_g_value_internal(JSContext    *context,
 
 JSBool
 gjs_value_to_g_value(JSContext    *context,
-                     jsval         value,
+                     JS::Value     value,
                      GValue       *gvalue)
 {
     return gjs_value_to_g_value_internal(context, value, gvalue, FALSE);
@@ -770,7 +770,7 @@ gjs_value_to_g_value(JSContext    *context,
 
 JSBool
 gjs_value_to_g_value_no_copy(JSContext    *context,
-                             jsval         value,
+                             JS::Value     value,
                              GValue       *gvalue)
 {
     return gjs_value_to_g_value_internal(context, value, gvalue, TRUE);
@@ -778,7 +778,7 @@ gjs_value_to_g_value_no_copy(JSContext    *context,
 
 static JSBool
 convert_int_to_enum (JSContext *context,
-                     jsval     *value_p,
+                     JS::Value *value_p,
                      GType      gtype,
                      int        v)
 {
@@ -804,7 +804,7 @@ convert_int_to_enum (JSContext *context,
 
 static JSBool
 gjs_value_from_g_value_internal(JSContext    *context,
-                                jsval        *value_p,
+                                JS::Value    *value_p,
                                 const GValue *gvalue,
                                 gboolean      no_copy,
                                 GSignalQuery *signal_query,
@@ -815,7 +815,7 @@ gjs_value_from_g_value_internal(JSContext    *context,
     gtype = G_VALUE_TYPE(gvalue);
 
     gjs_debug_marshal(GJS_DEBUG_GCLOSURE,
-                      "Converting gtype %s to jsval",
+                      "Converting gtype %s to JS::Value",
                       g_type_name(gtype));
 
     if (gtype == G_TYPE_STRING) {
@@ -1036,7 +1036,7 @@ gjs_value_from_g_value_internal(JSContext    *context,
 
 JSBool
 gjs_value_from_g_value(JSContext    *context,
-                       jsval        *value_p,
+                       JS::Value    *value_p,
                        const GValue *gvalue)
 {
     return gjs_value_from_g_value_internal(context, value_p, gvalue, FALSE, NULL, 0);
diff --git a/gi/value.h b/gi/value.h
index 00bbb3e..7490573 100644
--- a/gi/value.h
+++ b/gi/value.h
@@ -30,13 +30,13 @@
 G_BEGIN_DECLS
 
 JSBool     gjs_value_to_g_value         (JSContext    *context,
-                                         jsval         value,
+                                         JS::Value     value,
                                          GValue       *gvalue);
 JSBool     gjs_value_to_g_value_no_copy (JSContext    *context,
-                                         jsval         value,
+                                         JS::Value     value,
                                          GValue       *gvalue);
 JSBool     gjs_value_from_g_value       (JSContext    *context,
-                                         jsval        *value_p,
+                                         JS::Value    *value_p,
                                          const GValue *gvalue);
 GClosure*  gjs_closure_new_marshaled    (JSContext    *context,
                                          JSObject     *callable,
diff --git a/gjs/byteArray.cpp b/gjs/byteArray.cpp
index 48a143b..09795a4 100644
--- a/gjs/byteArray.cpp
+++ b/gjs/byteArray.cpp
@@ -115,7 +115,7 @@ byte_array_ensure_gbytes (ByteArrayInstance  *priv)
 
 static JSBool
 gjs_value_to_gsize(JSContext         *context,
-                   jsval              value,
+                   JS::Value          value,
                    gsize             *v_p)
 {
     guint32 val32;
@@ -149,7 +149,7 @@ gjs_value_to_gsize(JSContext         *context,
 
 static JSBool
 gjs_value_to_byte(JSContext         *context,
-                  jsval              value,
+                  JS::Value          value,
                   guint8            *v_p)
 {
     gsize v;
@@ -203,7 +203,7 @@ byte_array_get_prop(JSContext *context,
                     JS::MutableHandleValue value_p)
 {
     ByteArrayInstance *priv;
-    jsval id_value;
+    JS::Value id_value;
 
     priv = priv_from_js(context, obj);
 
@@ -315,7 +315,7 @@ byte_array_set_prop(JSContext *context,
                     JS::MutableHandleValue value_p)
 {
     ByteArrayInstance *priv;
-    jsval id_value;
+    JS::Value id_value;
 
     priv = priv_from_js(context, obj);
 
@@ -414,7 +414,7 @@ byte_array_finalize(JSFreeOp *fop,
 static JSBool
 to_string_func(JSContext *context,
                unsigned   argc,
-               jsval     *vp)
+               JS::Value *vp)
 {
     JS::CallArgs argv = JS::CallArgsFromVp (argc, vp);
     JSObject *object = JSVAL_TO_OBJECT(argv.thisv());
@@ -460,7 +460,7 @@ to_string_func(JSContext *context,
         /* optimization, avoids iconv overhead and runs
          * libmozjs hardwired utf8-to-utf16
          */
-        jsval retval;
+        JS::Value retval;
         JSBool ok;
 
         ok = gjs_string_from_utf8(context,
@@ -513,7 +513,7 @@ to_string_func(JSContext *context,
 static JSBool
 to_gbytes_func(JSContext *context,
                unsigned   argc,
-               jsval     *vp)
+               JS::Value *vp)
 {
     JS::CallReceiver rec = JS::CallReceiverFromVp(vp);
     JSObject *object = JSVAL_TO_OBJECT(rec.thisv());
@@ -540,7 +540,7 @@ to_gbytes_func(JSContext *context,
 static JSObject *
 byte_array_get_prototype(JSContext *context)
 {
-    jsval retval;
+    JS::Value retval;
     JSObject *prototype;
 
     retval = gjs_get_global_slot (context, GJS_GLOBAL_SLOT_BYTE_ARRAY_PROTOTYPE);
@@ -576,7 +576,7 @@ byte_array_new(JSContext *context)
 static JSBool
 from_string_func(JSContext *context,
                  unsigned   argc,
-                 jsval     *vp)
+                 JS::Value *vp)
 {
     JS::CallArgs argv = JS::CallArgsFromVp (argc, vp);
     ByteArrayInstance *priv;
@@ -681,7 +681,7 @@ from_string_func(JSContext *context,
 static JSBool
 from_array_func(JSContext *context,
                 unsigned   argc,
-                jsval     *vp)
+                JS::Value *vp)
 {
     JS::CallArgs argv = JS::CallArgsFromVp (argc, vp);
     ByteArrayInstance *priv;
@@ -718,7 +718,7 @@ from_array_func(JSContext *context,
     g_byte_array_set_size(priv->array, len);
 
     for (i = 0; i < len; ++i) {
-        jsval elem;
+        JS::Value elem;
         guint8 b;
 
         elem = JSVAL_VOID;
@@ -748,7 +748,7 @@ from_array_func(JSContext *context,
 static JSBool
 from_gbytes_func(JSContext *context,
                  unsigned   argc,
-                 jsval     *vp)
+                 JS::Value *vp)
 {
     JS::CallArgs argv = JS::CallArgsFromVp (argc, vp);
     JSObject *bytes_obj;
diff --git a/gjs/compat.h b/gjs/compat.h
index 76f5b5a..b0de41b 100644
--- a/gjs/compat.h
+++ b/gjs/compat.h
@@ -59,7 +59,10 @@ G_BEGIN_DECLS
 
 #define JS_GetGlobalObject(cx) gjs_get_global_object(cx)
 
-static JSBool G_GNUC_UNUSED JS_NewNumberValue(JSContext *cx, double d, jsval *rval)
+static JSBool G_GNUC_UNUSED
+JS_NewNumberValue(JSContext *cx,
+                  double     d,
+                  JS::Value *rval)
     {
         *rval = JS_NumberValue(d);
         if (JSVAL_IS_NUMBER(*rval))
@@ -75,7 +78,7 @@ static JSBool G_GNUC_UNUSED JS_NewNumberValue(JSContext *cx, double d, jsval *rv
 static JSBool                                           \
 gjs_##name##_constructor(JSContext  *context,           \
                          unsigned    argc,              \
-                         jsval      *vp)
+                         JS::Value  *vp)
 
 /**
  * GJS_NATIVE_CONSTRUCTOR_VARIABLES:
diff --git a/gjs/context.cpp b/gjs/context.cpp
index 19120c4..e468059 100644
--- a/gjs/context.cpp
+++ b/gjs/context.cpp
@@ -105,7 +105,7 @@ static GList *all_contexts = NULL;
 static JSBool
 gjs_log(JSContext *context,
         unsigned   argc,
-        jsval     *vp)
+        JS::Value *vp)
 {
     JS::CallArgs argv = JS::CallArgsFromVp (argc, vp);
     char *s;
@@ -149,7 +149,7 @@ gjs_log(JSContext *context,
 static JSBool
 gjs_log_error(JSContext *context,
               unsigned   argc,
-              jsval     *vp)
+              JS::Value *vp)
 {
     JS::CallArgs argv = JS::CallArgsFromVp (argc, vp);
     JSExceptionState *exc_state;
@@ -237,7 +237,7 @@ gjs_print_parse_args(JSContext *context,
 static JSBool
 gjs_print(JSContext *context,
           unsigned   argc,
-          jsval     *vp)
+          JS::Value *vp)
 {
     JS::CallArgs argv = JS::CallArgsFromVp (argc, vp);
     char *buffer;
@@ -256,7 +256,7 @@ gjs_print(JSContext *context,
 static JSBool
 gjs_printerr(JSContext *context,
              unsigned   argc,
-             jsval     *vp)
+             JS::Value *vp)
 {
     JS::CallArgs argv = JS::CallArgsFromVp (argc, vp);
     char *buffer;
@@ -635,7 +635,7 @@ gjs_context_eval(GjsContext   *js_context,
                  GError      **error)
 {
     gboolean ret = FALSE;
-    jsval retval;
+    JS::Value retval;
 
     JSAutoCompartment ac(js_context->context, js_context->global);
     JSAutoRequest ar(js_context->context);
@@ -756,7 +756,7 @@ gboolean
 gjs_object_get_property_const(JSContext      *context,
                               JSObject       *obj,
                               GjsConstString  property_name,
-                              jsval          *value_p)
+                              JS::Value      *value_p)
 {
     jsid pname;
     pname = gjs_context_get_const_string(context, property_name);
diff --git a/gjs/coverage.cpp b/gjs/coverage.cpp
index cbdb564..a89b1c6 100644
--- a/gjs/coverage.cpp
+++ b/gjs/coverage.cpp
@@ -391,11 +391,11 @@ get_absolute_path(const char *path)
 
 typedef gboolean (*ConvertAndInsertJSVal) (GArray    *array,
                                            JSContext *context,
-                                           jsval     *element);
+                                           JS::Value *element);
 
 static gboolean
 get_array_from_js_value(JSContext             *context,
-                        jsval                 *value,
+                        JS::Value             *value,
                         size_t                 array_element_size,
                         GDestroyNotify         element_clear_func,
                         ConvertAndInsertJSVal  inserter,
@@ -423,7 +423,7 @@ get_array_from_js_value(JSContext             *context,
     if (JS_GetArrayLength(context, js_array, &js_array_len)) {
         u_int32_t i = 0;
         for (; i < js_array_len; ++i) {
-            jsval element;
+            JS::Value element;
             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);
@@ -446,7 +446,7 @@ get_array_from_js_value(JSContext             *context,
 static gboolean
 convert_and_insert_unsigned_int(GArray    *array,
                                 JSContext *context,
-                                jsval     *element)
+                                JS::Value *element)
 {
     if (!JSVAL_IS_INT(*element) &&
         !JSVAL_IS_VOID(*element) &&
@@ -469,10 +469,10 @@ convert_and_insert_unsigned_int(GArray    *array,
 static GArray *
 get_executed_lines_for(JSContext        *context,
                        JS::HandleObject  coverage_statistics,
-                       jsval            *filename_value)
+                       JS::Value        *filename_value)
 {
     GArray *array = NULL;
-    jsval rval;
+    JS::Value rval;
 
     if (!JS_CallFunctionName(context, coverage_statistics, "getExecutedLinesFor", 1, filename_value, &rval)) 
{
         gjs_log_exception(context);
@@ -508,7 +508,7 @@ clear_coverage_function(gpointer info_location)
 static gboolean
 convert_and_insert_function_decl(GArray    *array,
                                  JSContext *context,
-                                 jsval     *element)
+                                 JS::Value *element)
 {
     JSObject *object = JSVAL_TO_OBJECT(*element);
 
@@ -517,7 +517,7 @@ convert_and_insert_function_decl(GArray    *array,
         return FALSE;
     }
 
-    jsval    function_name_property_value;
+    JS::Value function_name_property_value;
 
     if (!JS_GetProperty(context, object, "name", &function_name_property_value)) {
         gjs_throw(context, "Failed to get name property for function object");
@@ -540,14 +540,14 @@ convert_and_insert_function_decl(GArray    *array,
         return FALSE;
     }
 
-    jsval hit_count_property_value;
+    JS::Value hit_count_property_value;
     if (!JS_GetProperty(context, object, "hitCount", &hit_count_property_value) ||
         !JSVAL_IS_INT(hit_count_property_value)) {
         gjs_throw(context, "Failed to get hitCount property for function object");
         return FALSE;
     }
 
-    jsval line_number_property_value;
+    JS::Value line_number_property_value;
     if (!JS_GetProperty(context, object, "line", &line_number_property_value) ||
         !JSVAL_IS_INT(line_number_property_value)) {
         gjs_throw(context, "Failed to get line property for function object");
@@ -571,10 +571,10 @@ convert_and_insert_function_decl(GArray    *array,
 static GArray *
 get_functions_for(JSContext        *context,
                   JS::HandleObject  coverage_statistics,
-                  jsval            *filename_value)
+                  JS::Value        *filename_value)
 {
     GArray *array = NULL;
-    jsval rval;
+    JS::Value rval;
 
     if (!JS_CallFunctionName(context, coverage_statistics, "getFunctionsFor", 1, filename_value, &rval)) {
         gjs_log_exception(context);
@@ -610,7 +610,7 @@ clear_coverage_branch(gpointer branch_location)
 static gboolean
 convert_and_insert_branch_exit(GArray    *array,
                                JSContext *context,
-                               jsval     *element)
+                               JS::Value *element)
 {
     if (!JSVAL_IS_OBJECT(*element)) {
         gjs_throw(context, "Branch exit array element is not an object");
@@ -624,7 +624,7 @@ convert_and_insert_branch_exit(GArray    *array,
         return FALSE;
     }
 
-    jsval   line_value;
+    JS::Value line_value;
     int32_t line;
 
     if (!JS_GetProperty(context, object, "line", &line_value) ||
@@ -635,7 +635,7 @@ convert_and_insert_branch_exit(GArray    *array,
 
     line = JSVAL_TO_INT(line_value);
 
-    jsval   hit_count_value;
+    JS::Value hit_count_value;
     int32_t hit_count;
 
     if (!JS_GetProperty(context, object, "hitCount", &hit_count_value) ||
@@ -659,7 +659,7 @@ convert_and_insert_branch_exit(GArray    *array,
 static gboolean
 convert_and_insert_branch_info(GArray    *array,
                                JSContext *context,
-                               jsval     *element)
+                               JS::Value *element)
 {
     if (!JSVAL_IS_OBJECT(*element) &&
         !JSVAL_IS_VOID(*element)) {
@@ -675,7 +675,7 @@ convert_and_insert_branch_info(GArray    *array,
             return FALSE;
         }
 
-        jsval   branch_point_value;
+        JS::Value branch_point_value;
         int32_t branch_point;
 
         if (!JS_GetProperty(context, object, "point", &branch_point_value) ||
@@ -686,7 +686,7 @@ convert_and_insert_branch_info(GArray    *array,
 
         branch_point = JSVAL_TO_INT(branch_point_value);
 
-        jsval  was_hit_value;
+        JS::Value was_hit_value;
         JSBool was_hit;
 
         if (!JS_GetProperty(context, object, "hit", &was_hit_value) ||
@@ -697,7 +697,7 @@ convert_and_insert_branch_info(GArray    *array,
 
         was_hit = JSVAL_TO_BOOLEAN(was_hit_value);
 
-        jsval  branch_exits_value;
+        JS::Value branch_exits_value;
         GArray *branch_exits_array = NULL;
 
         if (!JS_GetProperty(context, object, "exits", &branch_exits_value) ||
@@ -731,10 +731,10 @@ convert_and_insert_branch_info(GArray    *array,
 static GArray *
 get_branches_for(JSContext        *context,
                  JS::HandleObject  coverage_statistics,
-                 jsval            *filename_value)
+                 JS::Value        *filename_value)
 {
     GArray *array = NULL;
-    jsval rval;
+    JS::Value rval;
 
     if (!JS_CallFunctionName(context, coverage_statistics, "getBranchesFor", 1, filename_value, &rval)) {
         gjs_log_exception(context);
@@ -766,7 +766,7 @@ fetch_coverage_file_statistics_from_js(JSContext                 *context,
     JSAutoRequest ar(context);
 
     JSString *filename_jsstr = JS_NewStringCopyZ(context, filename);
-    jsval    filename_jsval = STRING_TO_JSVAL(filename_jsstr);
+    JS::Value filename_jsval = STRING_TO_JSVAL(filename_jsstr);
 
     GArray *lines = get_executed_lines_for(context, coverage_statistics, &filename_jsval);
     GArray *functions = get_functions_for(context, coverage_statistics, &filename_jsval);
@@ -862,7 +862,7 @@ get_covered_files(GjsCoverage *coverage)
     JSContext *context = (JSContext *) gjs_context_get_native_context(priv->context);
     JSAutoRequest ar(context);
     JSAutoCompartment ac(context, priv->coverage_statistics);
-    jsval rval;
+    JS::Value rval;
     JSObject *files_obj;
 
     char **files = NULL;
@@ -882,7 +882,7 @@ get_covered_files(GjsCoverage *coverage)
 
     files = g_new0(char *, n_files + 1);
     for (uint32_t i = 0; i < n_files; i++) {
-        jsval element;
+        JS::Value element;
         char *file;
         if (!JS_GetElement(context, files_obj, i, &element))
             goto error;
@@ -1064,7 +1064,7 @@ gjs_get_generic_object_constructor(JSContext        *context,
     JSAutoRequest ar(context);
     JSAutoCompartment ac(context, global_object);
 
-    jsval object_constructor_value;
+    JS::Value object_constructor_value;
     if (!JS_GetProperty(context, global_object, "Object", &object_constructor_value) ||
         !JSVAL_IS_OBJECT(object_constructor_value))
         g_assert_not_reached();
@@ -1203,7 +1203,7 @@ coverage_statistics_has_stale_cache(GjsCoverage *coverage)
     JSAutoRequest ar(js_context);
     JSAutoCompartment ac(js_context, priv->coverage_statistics);
 
-    jsval stale_cache_value;
+    JS::Value stale_cache_value;
     if (!JS_CallFunctionName(js_context,
                              priv->coverage_statistics,
                              "staleCache",
@@ -1324,7 +1324,7 @@ gjs_context_eval_file_in_compartment(GjsContext *context,
 
     g_object_unref(file);
 
-    jsval return_value;
+    JS::Value return_value;
 
     JSContext *js_context = (JSContext *) gjs_context_get_native_context(context);
 
@@ -1349,7 +1349,7 @@ gjs_context_eval_file_in_compartment(GjsContext *context,
 static JSBool
 coverage_log(JSContext *context,
              unsigned   argc,
-             jsval     *vp)
+             JS::Value *vp)
 {
     JS::CallArgs argv = JS::CallArgsFromVp (argc, vp);
     char *s;
@@ -1424,7 +1424,7 @@ get_file_from_filename_as_js_string(JSContext    *context,
 static JSBool
 coverage_get_file_modification_time(JSContext *context,
                                     unsigned  argc,
-                                    jsval     *vp)
+                                    JS::Value *vp)
 {
     JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
     JSRuntime    *runtime = JS_GetRuntime(context);
@@ -1457,7 +1457,7 @@ out:
 static JSBool
 coverage_get_file_checksum(JSContext *context,
                            unsigned  argc,
-                           jsval     *vp)
+                           JS::Value *vp)
 {
     JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
     JSRuntime    *runtime = JS_GetRuntime(context);
@@ -1487,7 +1487,7 @@ coverage_get_file_checksum(JSContext *context,
 static JSBool
 coverage_get_file_contents(JSContext *context,
                            unsigned   argc,
-                           jsval     *vp)
+                           JS::Value *vp)
 {
     JSBool ret = JS_FALSE;
     JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
@@ -1553,7 +1553,7 @@ gjs_run_script_in_coverage_compartment(GjsCoverage *coverage,
     GjsCoveragePrivate *priv = (GjsCoveragePrivate *) gjs_coverage_get_instance_private(coverage);
     JSContext          *js_context = (JSContext *) gjs_context_get_native_context(priv->context);
     JSAutoCompartment ac(js_context, priv->coverage_statistics);
-    jsval rval;
+    JS::Value rval;
     if (!gjs_eval_with_scope(js_context,
                              priv->coverage_statistics,
                              script,
@@ -1582,7 +1582,7 @@ gjs_inject_value_into_coverage_compartment(GjsCoverage     *coverage,
     JS::RootedObject coverage_global_scope(JS_GetRuntime(js_context),
                                            JS_GetGlobalForObject(js_context, priv->coverage_statistics));
 
-    jsval value = handle_value;
+    JS::Value value = handle_value;
     if (!JS_SetProperty(js_context, coverage_global_scope, property, &value)) {
         g_warning("Failed to set property %s to requested value", property);
         return FALSE;
@@ -1685,7 +1685,7 @@ bootstrap_coverage(GjsCoverage *coverage)
                                                   &error))
             g_error("Failed to eval coverage script: %s\n", error->message);
 
-        jsval coverage_statistics_prototype_value;
+        JS::Value coverage_statistics_prototype_value;
         if (!JS_GetProperty(context, debugger_compartment, "CoverageStatistics", 
&coverage_statistics_prototype_value) ||
             !JSVAL_IS_OBJECT(coverage_statistics_prototype_value)) {
             gjs_throw(context, "Failed to get CoverageStatistics prototype");
@@ -1715,7 +1715,7 @@ bootstrap_coverage(GjsCoverage *coverage)
         /* Now create the array to pass the desired prefixes over */
         JSObject *prefixes = gjs_build_string_array(context, -1, priv->prefixes);
 
-        jsval coverage_statistics_constructor_arguments[] = {
+        JS::Value coverage_statistics_constructor_arguments[] = {
             OBJECT_TO_JSVAL(prefixes),
             cache_value.get()
         };
diff --git a/gjs/importer.cpp b/gjs/importer.cpp
index d5c4c90..2f5b476 100644
--- a/gjs/importer.cpp
+++ b/gjs/importer.cpp
@@ -265,7 +265,6 @@ import_file(JSContext  *context,
     char *script = NULL;
     char *full_path = NULL;
     gsize script_len = 0;
-    jsval script_retval;
     GError *error = NULL;
 
     JS::CompileOptions options(context);
@@ -310,7 +309,7 @@ load_module_init(JSContext  *context,
     /* First we check if js module has already been loaded  */
     module_init_name = gjs_context_get_const_string(context, GJS_STRING_MODULE_INIT);
     if (JS_HasPropertyById(context, in_object, module_init_name, &found) && found) {
-        jsval module_obj_val;
+        JS::Value module_obj_val;
 
         if (JS_GetPropertyById(context,
                                in_object,
@@ -420,7 +419,7 @@ do_import(JSContext  *context,
     char *filename;
     char *full_path;
     char *dirname = NULL;
-    jsval search_path_val;
+    JS::Value search_path_val;
     JSObject *search_path;
     JSObject *module_obj = NULL;
     guint32 search_path_len;
@@ -470,7 +469,7 @@ do_import(JSContext  *context,
     }
 
     for (i = 0; i < search_path_len; ++i) {
-        jsval elem;
+        JS::Value elem;
 
         elem = JSVAL_VOID;
         if (!JS_GetElement(context, search_path, i, &elem)) {
@@ -506,7 +505,7 @@ do_import(JSContext  *context,
 
         module_obj = load_module_init(context, obj, full_path);
         if (module_obj != NULL) {
-            jsval obj_val;
+            JS::Value obj_val;
 
             if (JS_GetProperty(context,
                                module_obj,
@@ -674,7 +673,7 @@ importer_new_enumerate(JSContext  *context,
     case JSENUMERATE_INIT: {
         Importer *priv;
         JSObject *search_path;
-        jsval search_path_val;
+        JS::Value search_path_val;
         guint32 search_path_len;
         guint32 i;
         jsid search_path_name;
@@ -716,7 +715,7 @@ importer_new_enumerate(JSContext  *context,
             char *dirname = NULL;
             char *init_path;
             const char *filename;
-            jsval elem;
+            JS::Value elem;
             GDir *dir = NULL;
 
             elem = JSVAL_VOID;
@@ -794,7 +793,7 @@ importer_new_enumerate(JSContext  *context,
     }
 
     case JSENUMERATE_NEXT: {
-        jsval element_val;
+        JS::Value element_val;
 
         if (JSVAL_IS_NULL(statep)) /* Iterating prototype */
             return JS_TRUE;
@@ -1122,7 +1121,7 @@ gjs_create_root_importer(JSContext   *context,
                          const char **initial_search_path,
                          gboolean     add_standard_search_path)
 {
-    jsval importer;
+    JS::Value importer;
 
     JS_BeginRequest(context);
 
diff --git a/gjs/jsapi-dynamic-class.cpp b/gjs/jsapi-dynamic-class.cpp
index d7cfe2e..a60ab38 100644
--- a/gjs/jsapi-dynamic-class.cpp
+++ b/gjs/jsapi-dynamic-class.cpp
@@ -45,11 +45,11 @@
 JSObject *
 gjs_new_object_for_constructor(JSContext *context,
                                JSClass   *clasp,
-                               jsval     *vp)
+                               JS::Value *vp)
 {
-    jsval     callee;
+    JS::Value callee;
     JSObject *parent;
-    jsval     prototype;
+    JS::Value prototype;
 
     callee = JS_CALLEE(context, vp);
     parent = JS_GetParent(JSVAL_TO_OBJECT (callee));
@@ -200,11 +200,11 @@ JSObject*
 gjs_construct_object_dynamic(JSContext      *context,
                              JSObject       *proto,
                              unsigned        argc,
-                             jsval          *argv)
+                             JS::Value      *argv)
 {
     JSObject *constructor;
     JSObject *result = NULL;
-    jsval value;
+    JS::Value value;
     jsid constructor_name;
 
     JS_BeginRequest(context);
diff --git a/gjs/jsapi-util-array.cpp b/gjs/jsapi-util-array.cpp
index 5aa357e..d01a8f2 100644
--- a/gjs/jsapi-util-array.cpp
+++ b/gjs/jsapi-util-array.cpp
@@ -26,7 +26,7 @@
 #include "jsapi-util.h"
 #include "compat.h"
 
-/* Maximum number of elements allowed in a GArray of rooted jsvals.
+/* Maximum number of elements allowed in a GArray of rooted JS::Values.
  * We pre-alloc that amount and then never allow the array to grow,
  * or we'd have invalid memory rooted if the internals of GArray decide
  * to move the contents to a new memory area
@@ -36,7 +36,7 @@
 /**
  * gjs_rooted_array_new:
  *
- * Creates an opaque data type that holds jsvals and keeps
+ * Creates an opaque data type that holds JS::Values and keeps
  * their location (NOT their value) GC-rooted.
  *
  * Returns: an opaque object prepared to hold GC root locations.
@@ -47,10 +47,10 @@ gjs_rooted_array_new()
     GArray *array;
 
     /* we prealloc ARRAY_MAX_LEN to avoid realloc */
-    array = g_array_sized_new(FALSE,         /* zero-terminated */
-                              FALSE,         /* clear */
-                              sizeof(jsval), /* element size */
-                              ARRAY_MAX_LEN); /* reserved size */
+    array = g_array_sized_new(FALSE,             /* zero-terminated */
+                              FALSE,             /* clear */
+                              sizeof(JS::Value), /* element size */
+                              ARRAY_MAX_LEN);    /* reserved size */
 
     return (GjsRootedArray*) array;
 }
@@ -58,7 +58,7 @@ gjs_rooted_array_new()
 /* typesafe wrapper */
 static void
 add_root_jsval(JSContext *context,
-               jsval     *value_p)
+               JS::Value *value_p)
 {
     JS_BeginRequest(context);
     JS_AddValueRoot(context, value_p);
@@ -68,7 +68,7 @@ add_root_jsval(JSContext *context,
 /* typesafe wrapper */
 static void
 remove_root_jsval(JSContext *context,
-                  jsval     *value_p)
+                  JS::Value *value_p)
 {
     JS_BeginRequest(context);
     JS_RemoveValueRoot(context, value_p);
@@ -79,15 +79,16 @@ remove_root_jsval(JSContext *context,
  * gjs_rooted_array_append:
  * @context: a #JSContext
  * @array: a #GjsRootedArray created by gjs_rooted_array_new()
- * @value: a jsval
+ * @value: a JS::Value
  *
- * Appends @jsval to @array, calling JS_AddValueRoot on the location where it's stored.
+ * Appends @value to @array, calling JS_AddValueRoot on the location where it's
+ * stored.
  *
  **/
 void
 gjs_rooted_array_append(JSContext        *context,
                         GjsRootedArray *array,
-                        jsval             value)
+                        JS::Value       value)
 {
     GArray *garray;
 
@@ -103,7 +104,7 @@ gjs_rooted_array_append(JSContext        *context,
     }
 
     g_array_append_val(garray, value);
-    add_root_jsval(context, & g_array_index(garray, jsval, garray->len - 1));
+    add_root_jsval(context, & g_array_index(garray, JS::Value, garray->len - 1));
 }
 
 /**
@@ -113,7 +114,7 @@ gjs_rooted_array_append(JSContext        *context,
  * @i: element to return
  * Returns: value of an element
  */
-jsval
+JS::Value
 gjs_rooted_array_get(JSContext        *context,
                      GjsRootedArray *array,
                      int               i)
@@ -130,7 +131,7 @@ gjs_rooted_array_get(JSContext        *context,
         return JSVAL_VOID;
     }
 
-    return g_array_index(garray, jsval, i);
+    return g_array_index(garray, JS::Value, i);
 }
 
 /**
@@ -138,9 +139,9 @@ gjs_rooted_array_get(JSContext        *context,
  *
  * @context: a #JSContext
  * @array: an array
- * Returns: the rooted jsval locations in the array
+ * Returns: the rooted JS::Value locations in the array
  */
-jsval*
+JS::Value *
 gjs_rooted_array_get_data(JSContext      *context,
                           GjsRootedArray *array)
 {
@@ -151,7 +152,7 @@ gjs_rooted_array_get_data(JSContext      *context,
 
     garray = (GArray*) array;
 
-    return (jsval*) garray->data;
+    return (JS::Value *) garray->data;
 }
 
 /**
@@ -159,7 +160,7 @@ gjs_rooted_array_get_data(JSContext      *context,
  *
  * @context: a #JSContext
  * @array: an array
- * Returns: number of jsval in the rooted array
+ * Returns: number of JS::Value in the rooted array
  */
 int
 gjs_rooted_array_get_length (JSContext        *context,
@@ -178,7 +179,8 @@ gjs_rooted_array_get_length (JSContext        *context,
 /**
  * gjs_root_value_locations:
  * @context: a #JSContext
- * @locations: contiguous locations in memory that store jsvals (must be initialized)
+ * @locations: contiguous locations in memory that store JS::Values (must be
+ *   initialized)
  * @n_locations: the number of locations to root
  *
  * Calls JS_AddValueRoot() on each address in @locations.
@@ -186,7 +188,7 @@ gjs_rooted_array_get_length (JSContext        *context,
  **/
 void
 gjs_root_value_locations(JSContext        *context,
-                         jsval            *locations,
+                         JS::Value        *locations,
                          int               n_locations)
 {
     int i;
@@ -197,7 +199,7 @@ gjs_root_value_locations(JSContext        *context,
 
     JS_BeginRequest(context);
     for (i = 0; i < n_locations; i++) {
-        add_root_jsval(context, ((jsval*)locations) + i);
+        add_root_jsval(context, ((JS::Value *)locations) + i);
     }
     JS_EndRequest(context);
 }
@@ -205,7 +207,8 @@ gjs_root_value_locations(JSContext        *context,
 /**
  * gjs_unroot_value_locations:
  * @context: a #JSContext
- * @locations: contiguous locations in memory that store jsvals and have been added as GC roots
+ * @locations: contiguous locations in memory that store JS::Values and have
+ *   been added as GC roots
  * @n_locations: the number of locations to unroot
  *
  * Calls JS_RemoveValueRoot() on each address in @locations.
@@ -213,7 +216,7 @@ gjs_root_value_locations(JSContext        *context,
  **/
 void
 gjs_unroot_value_locations(JSContext *context,
-                           jsval     *locations,
+                           JS::Value *locations,
                            int        n_locations)
 {
     int i;
@@ -224,7 +227,7 @@ gjs_unroot_value_locations(JSContext *context,
 
     JS_BeginRequest(context);
     for (i = 0; i < n_locations; i++) {
-        remove_root_jsval(context, ((jsval*)locations) + i);
+        remove_root_jsval(context, ((JS::Value *)locations) + i);
     }
     JS_EndRequest(context);
 }
@@ -232,7 +235,7 @@ gjs_unroot_value_locations(JSContext *context,
 /**
  * gjs_set_values:
  * @context: a #JSContext
- * @locations: array of jsval
+ * @locations: array of JS::Value
  * @n_locations: the number of elements to set
  * @initializer: what to set each element to
  *
@@ -241,9 +244,9 @@ gjs_unroot_value_locations(JSContext *context,
  **/
 void
 gjs_set_values(JSContext        *context,
-               jsval            *locations,
+               JS::Value        *locations,
                int               n_locations,
-               jsval             initializer)
+               JS::Value         initializer)
 {
     int i;
 
@@ -260,15 +263,15 @@ gjs_set_values(JSContext        *context,
  * gjs_rooted_array_free:
  * @context: a #JSContext
  * @array: a #GjsRootedArray created with gjs_rooted_array_new()
- * @free_segment: whether or not to free and unroot the internal jsval array
+ * @free_segment: whether or not to free and unroot the internal JS::Value array
  *
  * Frees the memory allocated for the #GjsRootedArray. If @free_segment is
- * %TRUE the internal memory block allocated for the jsval array will
+ * %TRUE the internal memory block allocated for the JS::Value array will
  * be freed and unrooted also.
  *
- * Returns: the jsval array if it was not freed
+ * Returns: the JS::Value array if it was not freed
  **/
-jsval*
+JS::Value *
 gjs_rooted_array_free(JSContext        *context,
                       GjsRootedArray *array,
                       gboolean          free_segment)
@@ -281,7 +284,7 @@ gjs_rooted_array_free(JSContext        *context,
     garray = (GArray*) array;
 
     if (free_segment)
-        gjs_unroot_value_locations(context, (jsval*) garray->data, garray->len);
+        gjs_unroot_value_locations(context, (JS::Value *) garray->data, garray->len);
 
-    return (jsval*) g_array_free(garray, free_segment);
+    return (JS::Value *) g_array_free(garray, free_segment);
 }
diff --git a/gjs/jsapi-util-error.cpp b/gjs/jsapi-util-error.cpp
index 36a5852..ce87b0f 100644
--- a/gjs/jsapi-util-error.cpp
+++ b/gjs/jsapi-util-error.cpp
@@ -49,7 +49,7 @@ gjs_throw_valist(JSContext       *context,
 {
     char *s;
     JSBool result;
-    jsval v_constructor, v_message;
+    JS::Value v_constructor, v_message;
     JSObject *err_obj;
 
     s = g_strdup_vprintf(format, args);
diff --git a/gjs/jsapi-util-string.cpp b/gjs/jsapi-util-string.cpp
index b08d902..7e2665f 100644
--- a/gjs/jsapi-util-string.cpp
+++ b/gjs/jsapi-util-string.cpp
@@ -29,9 +29,9 @@
 #include "compat.h"
 
 gboolean
-gjs_string_to_utf8 (JSContext  *context,
-                    const jsval value,
-                    char      **utf8_string_p)
+gjs_string_to_utf8 (JSContext      *context,
+                    const JS::Value value,
+                    char          **utf8_string_p)
 {
     JSString *str;
     gsize len;
@@ -68,7 +68,7 @@ JSBool
 gjs_string_from_utf8(JSContext  *context,
                      const char *utf8_string,
                      gssize      n_bytes,
-                     jsval      *value_p)
+                     JS::Value  *value_p)
 {
     jschar *u16_string;
     glong u16_string_length;
@@ -107,9 +107,9 @@ gjs_string_from_utf8(JSContext  *context,
 }
 
 gboolean
-gjs_string_to_filename(JSContext    *context,
-                       const jsval   filename_val,
-                       char        **filename_string_p)
+gjs_string_to_filename(JSContext      *context,
+                       const JS::Value filename_val,
+                       char          **filename_string_p)
 {
     GError *error;
     gchar *tmp, *filename_string;
@@ -138,7 +138,7 @@ JSBool
 gjs_string_from_filename(JSContext  *context,
                          const char *filename_string,
                          gssize      n_bytes,
-                         jsval      *value_p)
+                         JS::Value  *value_p)
 {
     gsize written;
     GError *error;
@@ -168,7 +168,7 @@ gjs_string_from_filename(JSContext  *context,
 /**
  * gjs_string_get_uint16_data:
  * @context: js context
- * @value: a jsval
+ * @value: a JS::Value
  * @data_p: address to return allocated data buffer
  * @len_p: address to return length of data (number of 16-bit integers)
  *
@@ -180,7 +180,7 @@ gjs_string_from_filename(JSContext  *context,
  **/
 JSBool
 gjs_string_get_uint16_data(JSContext       *context,
-                           jsval            value,
+                           JS::Value        value,
                            guint16        **data_p,
                            gsize           *len_p)
 {
@@ -223,7 +223,7 @@ gjs_get_string_id (JSContext       *context,
                    jsid             id,
                    char           **name_p)
 {
-    jsval id_val;
+    JS::Value id_val;
 
     if (!JS_IdToValue(context, id, &id_val))
         return JS_FALSE;
@@ -250,7 +250,7 @@ gjs_get_string_id (JSContext       *context,
  */
 gboolean
 gjs_unichar_from_string (JSContext *context,
-                         jsval      value,
+                         JS::Value  value,
                          gunichar  *result)
 {
     char *utf8_str;
diff --git a/gjs/jsapi-util.cpp b/gjs/jsapi-util.cpp
index 8adffee..7c8e4cb 100644
--- a/gjs/jsapi-util.cpp
+++ b/gjs/jsapi-util.cpp
@@ -116,14 +116,14 @@ gjs_init_context_standard (JSContext  *context,
 void
 gjs_set_global_slot (JSContext     *context,
                      GjsGlobalSlot  slot,
-                     jsval          value)
+                     JS::Value      value)
 {
     JSObject *global;
     global = JS_GetGlobalObject(context);
     JS_SetReservedSlot(global, JSCLASS_GLOBAL_SLOT_COUNT + slot, value);
 }
 
-jsval
+JS::Value
 gjs_get_global_slot (JSContext     *context,
                      GjsGlobalSlot  slot)
 {
@@ -145,9 +145,9 @@ gjs_object_require_property(JSContext       *context,
                             JSObject        *obj,
                             const char      *obj_description,
                             jsid             property_name,
-                            jsval           *value_p)
+                            JS::Value       *value_p)
 {
-    jsval value;
+    JS::Value value;
     char *name;
 
     value = JSVAL_VOID;
@@ -191,10 +191,10 @@ gjs_throw_constructor_error(JSContext *context)
 
 void
 gjs_throw_abstract_constructor_error(JSContext *context,
-                                     jsval     *vp)
+                                     JS::Value *vp)
 {
-    jsval callee;
-    jsval prototype;
+    JS::Value callee;
+    JS::Value prototype;
     JSClass *proto_class;
     const char *name = "anonymous";
 
@@ -223,15 +223,15 @@ gjs_build_string_array(JSContext   *context,
     if (array_length == -1)
         array_length = g_strv_length(array_values);
 
-    elems = g_array_sized_new(FALSE, FALSE, sizeof(jsval), array_length);
+    elems = g_array_sized_new(FALSE, FALSE, sizeof(JS::Value), array_length);
 
     for (i = 0; i < array_length; ++i) {
-        jsval element;
+        JS::Value element;
         element = STRING_TO_JSVAL(JS_NewStringCopyZ(context, array_values[i]));
         g_array_append_val(elems, element);
     }
 
-    array = JS_NewArrayObject(context, elems->len, (jsval*) elems->data);
+    array = JS_NewArrayObject(context, elems->len, (JS::Value *) elems->data);
     g_array_free(elems, TRUE);
 
     return array;
@@ -315,7 +315,7 @@ gjs_string_readable (JSContext   *context,
  */
 char*
 gjs_value_debug_string(JSContext      *context,
-                       jsval           value)
+                       JS::Value       value)
 {
     JSString *str;
     char *bytes;
@@ -396,7 +396,7 @@ gjs_log_object_props(JSContext      *context,
         goto done;
 
     while (!JSID_IS_VOID(prop_id)) {
-        jsval propval;
+        JS::Value propval;
         char *debugstr;
         char *name = NULL;
 
@@ -475,10 +475,10 @@ gjs_explain_scope(JSContext  *context,
 
 JSBool
 gjs_log_exception_full(JSContext *context,
-                       jsval      exc,
+                       JS::Value  exc,
                        JSString  *message)
 {
-    jsval stack;
+    JS::Value stack;
     JSString *exc_str;
     char *utf8_exception, *utf8_message;
     gboolean is_syntax;
@@ -497,7 +497,7 @@ gjs_log_exception_full(JSContext *context,
                                          gerror->message);
     } else {
         if (JSVAL_IS_OBJECT(exc)) {
-            jsval js_name;
+            JS::Value js_name;
             char *utf8_name;
 
             if (gjs_object_get_property_const(context, JSVAL_TO_OBJECT(exc),
@@ -526,7 +526,7 @@ gjs_log_exception_full(JSContext *context,
     */
 
     if (is_syntax) {
-        jsval js_lineNumber, js_fileName;
+        JS::Value js_lineNumber, js_fileName;
         unsigned lineNumber;
         char *utf8_fileName;
 
@@ -589,7 +589,7 @@ static JSBool
 log_and_maybe_keep_exception(JSContext  *context,
                              gboolean    keep)
 {
-    jsval exc = JSVAL_VOID;
+    JS::Value exc = JSVAL_VOID;
     JSBool retval = JS_FALSE;
 
     JS_BeginRequest(context);
@@ -631,12 +631,14 @@ gjs_log_and_keep_exception(JSContext *context)
 }
 
 static void
-try_to_chain_stack_trace(JSContext *src_context, JSContext *dst_context,
-                         jsval src_exc) {
+try_to_chain_stack_trace(JSContext *src_context,
+                         JSContext *dst_context,
+                         JS::Value  src_exc)
+{
     /* append current stack of dst_context to stack trace for src_exc.
      * we bail if anything goes wrong, just using the src_exc unmodified
      * in that case. */
-    jsval chained, src_stack, dst_stack, new_stack;
+    JS::Value chained, src_stack, dst_stack, new_stack;
     JSString *new_stack_str;
 
     JS_BeginRequest(src_context);
@@ -685,7 +687,7 @@ gjs_move_exception(JSContext      *src_context,
     JS_BeginRequest(dest_context);
 
     /* NOTE: src and dest could be the same. */
-    jsval exc;
+    JS::Value exc;
     if (JS_GetPendingException(src_context, &exc)) {
         if (src_context != dest_context) {
             /* try to add the current stack of dest_context to the
@@ -709,10 +711,10 @@ gjs_move_exception(JSContext      *src_context,
 JSBool
 gjs_call_function_value(JSContext      *context,
                         JSObject       *obj,
-                        jsval           fval,
+                        JS::Value       fval,
                         unsigned        argc,
-                        jsval          *argv,
-                        jsval          *rval)
+                        JS::Value      *argv,
+                        JS::Value      *rval)
 {
     JSBool result;
 
@@ -731,8 +733,8 @@ gjs_call_function_value(JSContext      *context,
 static JSBool
 log_prop(JSContext  *context,
          JSObject   *obj,
-         jsval       id,
-         jsval      *value_p,
+         JS::Value   id,
+         JS::Value  *value_p,
          const char *what)
 {
     if (JSVAL_IS_STRING(id)) {
@@ -759,8 +761,8 @@ log_prop(JSContext  *context,
 JSBool
 gjs_get_prop_verbose_stub(JSContext *context,
                           JSObject  *obj,
-                          jsval      id,
-                          jsval     *value_p)
+                          JS::Value  id,
+                          JS::Value *value_p)
 {
     return log_prop(context, obj, id, value_p, "get");
 }
@@ -768,8 +770,8 @@ gjs_get_prop_verbose_stub(JSContext *context,
 JSBool
 gjs_set_prop_verbose_stub(JSContext *context,
                           JSObject  *obj,
-                          jsval      id,
-                          jsval     *value_p)
+                          JS::Value  id,
+                          JS::Value *value_p)
 {
     return log_prop(context, obj, id, value_p, "set");
 }
@@ -777,8 +779,8 @@ gjs_set_prop_verbose_stub(JSContext *context,
 JSBool
 gjs_add_prop_verbose_stub(JSContext *context,
                           JSObject  *obj,
-                          jsval      id,
-                          jsval     *value_p)
+                          JS::Value  id,
+                          JS::Value *value_p)
 {
     return log_prop(context, obj, id, value_p, "add");
 }
@@ -786,15 +788,15 @@ gjs_add_prop_verbose_stub(JSContext *context,
 JSBool
 gjs_delete_prop_verbose_stub(JSContext *context,
                              JSObject  *obj,
-                             jsval      id,
-                             jsval     *value_p)
+                             JS::Value  id,
+                             JS::Value *value_p)
 {
     return log_prop(context, obj, id, value_p, "delete");
 }
 
-/* get a debug string for type tag in jsval */
+/* get a debug string for type tag in JS::Value */
 const char*
-gjs_get_type_name(jsval value)
+gjs_get_type_name(JS::Value value)
 {
     if (JSVAL_IS_NULL(value)) {
         return "null";
@@ -835,9 +837,9 @@ gjs_get_type_name(jsval value)
  *   undefined throws, but null => 0, false => 0, true => 1.
  */
 JSBool
-gjs_value_to_int64  (JSContext  *context,
-                     const jsval val,
-                     gint64     *result)
+gjs_value_to_int64(JSContext      *context,
+                   const JS::Value val,
+                   gint64         *result)
 {
     if (JSVAL_IS_INT (val)) {
         *result = JSVAL_TO_INT (val);
@@ -866,7 +868,7 @@ gjs_parse_args_valist (JSContext  *context,
                        const char *function_name,
                        const char *format,
                        unsigned    argc,
-                       jsval      *argv,
+                       JS::Value  *argv,
                        va_list     args)
 {
     guint i;
@@ -924,7 +926,7 @@ gjs_parse_args_valist (JSContext  *context,
     for (i = 0, consumed_args = 0, fmt_iter = format; *fmt_iter; fmt_iter++, i++) {
         const char *argname;
         gpointer arg_location;
-        jsval js_value;
+        JS::Value js_value;
         const char *arg_error_message = NULL;
 
         if (*fmt_iter == '|')
@@ -1102,7 +1104,7 @@ gjs_parse_args (JSContext  *context,
                 const char *function_name,
                 const char *format,
                 unsigned    argc,
-                jsval      *argv,
+                JS::Value  *argv,
                 ...)
 {
     va_list args;
@@ -1291,10 +1293,10 @@ gjs_eval_with_scope(JSContext    *context,
                     const char   *script,
                     gssize        script_len,
                     const char   *filename,
-                    jsval        *retval_p)
+                    JS::Value    *retval_p)
 {
     int start_line_number = 1;
-    jsval retval = JSVAL_VOID;
+    JS::Value retval = JSVAL_VOID;
     JSAutoRequest ar(context);
 
     if (script_len < 0)
diff --git a/gjs/jsapi-util.h b/gjs/jsapi-util.h
index 6e98713..3e9dfa7 100644
--- a/gjs/jsapi-util.h
+++ b/gjs/jsapi-util.h
@@ -142,7 +142,7 @@ extern JSFunctionSpec gjs_##cname##_proto_funcs[]; \
 static void gjs_##cname##_finalize(JSFreeOp *fop, JSObject *obj); \
 static JSBool gjs_##cname##_new_resolve(JSContext *context, \
                                         JSObject  *obj, \
-                                        jsval      id, \
+                                        JS::Value  id, \
                                         unsigned   flags, \
                                         JSObject **objp) \
 { \
@@ -164,15 +164,15 @@ static struct JSClass gjs_##cname##_class = { \
     NULL, \
     NULL, NULL, NULL \
 }; \
-jsval gjs_##cname##_create_proto(JSContext *context, JSObject *module, const char *proto_name, JSObject 
*parent) \
+JS::Value gjs_##cname##_create_proto(JSContext *context, JSObject *module, const char *proto_name, JSObject 
*parent) \
 { \
-    jsval rval; \
+    JS::Value rval; \
     JSObject *global = gjs_get_import_global(context); \
     jsid class_name = gjs_intern_string_to_id(context, gjs_##cname##_class.name); \
     if (!JS_GetPropertyById(context, global, class_name, &rval))                       \
         return JSVAL_NULL; \
     if (JSVAL_IS_VOID(rval)) { \
-        jsval value; \
+        JS::Value value; \
         JSObject *prototype = JS_InitClass(context, global,     \
                                  parent, \
                                  &gjs_##cname##_class, \
@@ -207,21 +207,21 @@ gboolean    gjs_init_context_standard        (JSContext       *context,
 
 JSObject*   gjs_get_import_global            (JSContext       *context);
 
-jsval       gjs_get_global_slot              (JSContext       *context,
+JS::Value   gjs_get_global_slot              (JSContext       *context,
                                               GjsGlobalSlot    slot);
 void        gjs_set_global_slot              (JSContext       *context,
                                               GjsGlobalSlot    slot,
-                                              jsval            value);
+                                              JS::Value        value);
 
 gboolean    gjs_object_require_property      (JSContext       *context,
                                               JSObject        *obj,
                                               const char      *obj_description,
                                               jsid             property_name,
-                                              jsval           *value_p);
+                                              JS::Value       *value_p);
 
 JSObject   *gjs_new_object_for_constructor   (JSContext       *context,
                                               JSClass         *clasp,
-                                              jsval           *vp);
+                                              JS::Value       *vp);
 JSBool      gjs_init_class_dynamic           (JSContext       *context,
                                               JSObject        *in_object,
                                               JSObject        *parent_proto,
@@ -238,7 +238,7 @@ JSBool      gjs_init_class_dynamic           (JSContext       *context,
                                               JSObject       **prototype_p);
 void gjs_throw_constructor_error             (JSContext       *context);
 void gjs_throw_abstract_constructor_error    (JSContext       *context,
-                                              jsval           *vp);
+                                              JS::Value       *vp);
 
 JSBool gjs_typecheck_instance                 (JSContext  *context,
                                                JSObject   *obj,
@@ -248,7 +248,7 @@ JSBool gjs_typecheck_instance                 (JSContext  *context,
 JSObject*   gjs_construct_object_dynamic     (JSContext       *context,
                                               JSObject        *proto,
                                               unsigned         argc,
-                                              jsval           *argv);
+                                              JS::Value       *argv);
 JSObject*   gjs_build_string_array           (JSContext       *context,
                                               gssize           array_length,
                                               char           **array_values);
@@ -275,7 +275,7 @@ JSBool      gjs_log_and_keep_exception       (JSContext       *context);
 JSBool      gjs_move_exception               (JSContext       *src_context,
                                               JSContext       *dest_context);
 JSBool      gjs_log_exception_full           (JSContext       *context,
-                                              jsval            exc,
+                                              JS::Value        exc,
                                               JSString        *message);
 
 #ifdef __GJS_UTIL_LOG_H__
@@ -285,52 +285,52 @@ void        gjs_log_object_props             (JSContext       *context,
                                               const char      *prefix);
 #endif
 char*       gjs_value_debug_string           (JSContext       *context,
-                                              jsval            value);
+                                              JS::Value        value);
 void        gjs_explain_scope                (JSContext       *context,
                                               const char      *title);
 JSBool      gjs_call_function_value          (JSContext       *context,
                                               JSObject        *obj,
-                                              jsval            fval,
+                                              JS::Value        fval,
                                               unsigned         argc,
-                                              jsval           *argv,
-                                              jsval           *rval);
+                                              JS::Value       *argv,
+                                              JS::Value       *rval);
 void        gjs_error_reporter               (JSContext       *context,
                                               const char      *message,
                                               JSErrorReport   *report);
 JSObject*   gjs_get_global_object            (JSContext *cx);
 JSBool      gjs_get_prop_verbose_stub        (JSContext       *context,
                                               JSObject        *obj,
-                                              jsval            id,
-                                              jsval           *value_p);
+                                              JS::Value        id,
+                                              JS::Value       *value_p);
 JSBool      gjs_set_prop_verbose_stub        (JSContext       *context,
                                               JSObject        *obj,
-                                              jsval            id,
-                                              jsval           *value_p);
+                                              JS::Value        id,
+                                              JS::Value       *value_p);
 JSBool      gjs_add_prop_verbose_stub        (JSContext       *context,
                                               JSObject        *obj,
-                                              jsval            id,
-                                              jsval           *value_p);
+                                              JS::Value        id,
+                                              JS::Value       *value_p);
 JSBool      gjs_delete_prop_verbose_stub     (JSContext       *context,
                                               JSObject        *obj,
-                                              jsval            id,
-                                              jsval           *value_p);
+                                              JS::Value        id,
+                                              JS::Value       *value_p);
 
 JSBool      gjs_string_to_utf8               (JSContext       *context,
-                                              const            jsval string_val,
+                                              const JS::Value  string_val,
                                               char           **utf8_string_p);
 JSBool      gjs_string_from_utf8             (JSContext       *context,
                                               const char      *utf8_string,
                                               gssize           n_bytes,
-                                              jsval           *value_p);
+                                              JS::Value       *value_p);
 JSBool      gjs_string_to_filename           (JSContext       *context,
-                                              const jsval      string_val,
+                                              const JS::Value  string_val,
                                               char           **filename_string_p);
 JSBool      gjs_string_from_filename         (JSContext       *context,
                                               const char      *filename_string,
                                               gssize           n_bytes,
-                                              jsval           *value_p);
+                                              JS::Value       *value_p);
 JSBool      gjs_string_get_uint16_data       (JSContext       *context,
-                                              jsval            value,
+                                              JS::Value        value,
                                               guint16        **data_p,
                                               gsize           *len_p);
 JSBool      gjs_get_string_id                (JSContext       *context,
@@ -340,20 +340,20 @@ jsid        gjs_intern_string_to_id          (JSContext       *context,
                                               const char      *string);
 
 gboolean    gjs_unichar_from_string          (JSContext       *context,
-                                              jsval            string,
+                                              JS::Value        string,
                                               gunichar        *result);
 
-const char* gjs_get_type_name                (jsval            value);
+const char* gjs_get_type_name                (JS::Value        value);
 
 JSBool      gjs_value_to_int64               (JSContext       *context,
-                                              const jsval      val,
+                                              const JS::Value  val,
                                               gint64          *result);
 
 JSBool      gjs_parse_args                   (JSContext  *context,
                                               const char *function_name,
                                               const char *format,
                                               unsigned   argc,
-                                              jsval     *argv,
+                                              JS::Value  *argv,
                                               ...);
 
 JSBool      gjs_parse_call_args              (JSContext    *context,
@@ -365,26 +365,26 @@ JSBool      gjs_parse_call_args              (JSContext    *context,
 GjsRootedArray*   gjs_rooted_array_new        (void);
 void              gjs_rooted_array_append     (JSContext        *context,
                                                GjsRootedArray *array,
-                                               jsval             value);
-jsval             gjs_rooted_array_get        (JSContext        *context,
+                                               JS::Value       value);
+JS::Value         gjs_rooted_array_get        (JSContext      *context,
                                                GjsRootedArray *array,
                                                int               i);
-jsval*            gjs_rooted_array_get_data   (JSContext        *context,
+JS::Value        *gjs_rooted_array_get_data   (JSContext        *context,
                                                GjsRootedArray *array);
 int               gjs_rooted_array_get_length (JSContext        *context,
                                                GjsRootedArray *array);
-jsval*            gjs_rooted_array_free       (JSContext        *context,
+JS::Value        *gjs_rooted_array_free       (JSContext        *context,
                                                GjsRootedArray *array,
                                                gboolean          free_segment);
 void              gjs_set_values              (JSContext        *context,
-                                               jsval            *locations,
+                                               JS::Value        *locations,
                                                int               n_locations,
-                                               jsval             initializer);
+                                               JS::Value         initializer);
 void              gjs_root_value_locations    (JSContext        *context,
-                                               jsval            *locations,
+                                               JS::Value        *locations,
                                                int               n_locations);
 void              gjs_unroot_value_locations  (JSContext        *context,
-                                               jsval            *locations,
+                                               JS::Value        *locations,
                                                int               n_locations);
 
 /* Functions intended for more "internal" use */
@@ -392,16 +392,16 @@ void              gjs_unroot_value_locations  (JSContext        *context,
 void gjs_maybe_gc (JSContext *context);
 
 JSBool            gjs_context_get_frame_info (JSContext  *context,
-                                              jsval      *stack,
-                                              jsval      *fileName,
-                                              jsval      *lineNumber);
+                                              JS::Value  *stack,
+                                              JS::Value  *fileName,
+                                              JS::Value  *lineNumber);
 
 JSBool            gjs_eval_with_scope        (JSContext    *context,
                                               JSObject     *object,
                                               const char   *script,
                                               gssize        script_len,
                                               const char   *filename,
-                                              jsval        *retval_p);
+                                              JS::Value    *retval_p);
 
 typedef enum {
   GJS_STRING_CONSTRUCTOR,
@@ -438,7 +438,7 @@ jsid              gjs_context_get_const_string  (JSContext       *context,
 gboolean          gjs_object_get_property_const (JSContext       *context,
                                                  JSObject        *obj,
                                                  GjsConstString   property_name,
-                                                 jsval           *value_p);
+                                                 JS::Value       *value_p);
 
 const char * gjs_strip_unix_shebang(const char *script,
                                     gssize     *script_len,
diff --git a/gjs/stack.cpp b/gjs/stack.cpp
index 40b2064..55991c3 100644
--- a/gjs/stack.cpp
+++ b/gjs/stack.cpp
@@ -49,11 +49,11 @@
 
 JSBool
 gjs_context_get_frame_info (JSContext  *context,
-                            jsval      *stack,
-                            jsval      *fileName,
-                            jsval      *lineNumber)
+                            JS::Value  *stack,
+                            JS::Value  *fileName,
+                            JS::Value  *lineNumber)
 {
-    jsval v_constructor;
+    JS::Value v_constructor;
     JSObject *err_obj;
     JSObject *global;
     JSBool ret = JS_FALSE;
@@ -99,7 +99,7 @@ void
 gjs_context_print_stack_stderr(GjsContext *context)
 {
     JSContext *cx = (JSContext*) gjs_context_get_native_context(context);
-    jsval v_stack;
+    JS::Value v_stack;
     char *stack;
 
     g_printerr("== Stack trace for context %p ==\n", context);
diff --git a/modules/cairo-context.cpp b/modules/cairo-context.cpp
index 74dcef6..cc7575b 100644
--- a/modules/cairo-context.cpp
+++ b/modules/cairo-context.cpp
@@ -34,7 +34,7 @@
 static JSBool                                       \
 mname##_func(JSContext *context,                    \
               unsigned   argc,                      \
-              jsval     *vp)                    \
+              JS::Value *vp)                        \
 {                                                   \
     JS::CallArgs argv = JS::CallArgsFromVp (argc, vp);             \
     JSObject *obj = JSVAL_TO_OBJECT(argv.thisv());                  \
@@ -89,7 +89,7 @@ _GJS_CAIRO_CONTEXT_DEFINE_FUNC_BEGIN(method)                               \
       JSObject *array = JS_NewArrayObject(context, 0, NULL);               \
       if (!array)                                                          \
         return JS_FALSE;                                                   \
-      jsval r;                                                             \
+      JS::Value r;                                                         \
       if (!JS_NewNumberValue(context, arg1, &r)) return JS_FALSE;          \
       if (!JS_SetElement(context, array, 0, &r)) return JS_FALSE;          \
       if (!JS_NewNumberValue(context, arg2, &r)) return JS_FALSE;          \
@@ -108,7 +108,7 @@ _GJS_CAIRO_CONTEXT_DEFINE_FUNC_BEGIN(method)                               \
       JSObject *array = JS_NewArrayObject(context, 0, NULL);               \
       if (!array)                                                          \
         return JS_FALSE;                                                   \
-      jsval r;                                                             \
+      JS::Value r;                                                         \
       if (!JS_NewNumberValue(context, arg1, &r)) return JS_FALSE;          \
       if (!JS_SetElement(context, array, 0, &r)) return JS_FALSE;          \
       if (!JS_NewNumberValue(context, arg2, &r)) return JS_FALSE;          \
@@ -127,7 +127,7 @@ _GJS_CAIRO_CONTEXT_DEFINE_FUNC_BEGIN(method)                               \
       JSObject *array = JS_NewArrayObject(context, 0, NULL);               \
       if (!array)                                                          \
         return JS_FALSE;                                                   \
-      jsval r;                                                             \
+      JS::Value r;                                                         \
       if (!JS_NewNumberValue(context, arg1, &r)) return JS_FALSE;          \
       if (!JS_SetElement(context, array, 0, &r)) return JS_FALSE;          \
       if (!JS_NewNumberValue(context, arg2, &r)) return JS_FALSE;          \
@@ -143,7 +143,7 @@ _GJS_CAIRO_CONTEXT_DEFINE_FUNC_END
 #define _GJS_CAIRO_CONTEXT_DEFINE_FUNC0F(method, cfunc)                    \
 _GJS_CAIRO_CONTEXT_DEFINE_FUNC_BEGIN(method)                               \
     double ret;                                                            \
-    jsval retval;                                                          \
+    JS::Value retval;                                                      \
    _GJS_CAIRO_CONTEXT_CHECK_NO_ARGS(method)                                \
     cr = gjs_cairo_context_get_context(context, obj);                      \
     ret = cfunc(cr);                                                       \
@@ -409,7 +409,7 @@ _GJS_CAIRO_CONTEXT_DEFINE_FUNC2FFAFF(userToDeviceDistance, cairo_user_to_device_
 static JSBool
 dispose_func(JSContext *context,
              unsigned   argc,
-             jsval     *vp)
+             JS::Value *vp)
 {
     JS::CallReceiver rec = JS::CallReceiverFromVp(vp);
     JSObject *obj = JSVAL_TO_OBJECT(rec.thisv());
@@ -428,7 +428,7 @@ dispose_func(JSContext *context,
 static JSBool
 appendPath_func(JSContext *context,
                 unsigned   argc,
-                jsval     *vp)
+                JS::Value *vp)
 {
     JS::CallArgs argv = JS::CallArgsFromVp (argc, vp);
     JSObject *obj = JSVAL_TO_OBJECT(argv.thisv());
@@ -456,7 +456,7 @@ appendPath_func(JSContext *context,
 static JSBool
 copyPath_func(JSContext *context,
               unsigned   argc,
-              jsval     *vp)
+              JS::Value *vp)
 {
     JS::CallArgs argv = JS::CallArgsFromVp (argc, vp);
     JSObject *obj = JSVAL_TO_OBJECT(argv.thisv());
@@ -477,7 +477,7 @@ copyPath_func(JSContext *context,
 static JSBool
 copyPathFlat_func(JSContext *context,
                   unsigned   argc,
-                  jsval     *vp)
+                  JS::Value *vp)
 {
     JS::CallArgs argv = JS::CallArgsFromVp (argc, vp);
     JSObject *obj = JSVAL_TO_OBJECT(argv.thisv());
@@ -497,7 +497,7 @@ copyPathFlat_func(JSContext *context,
 static JSBool
 mask_func(JSContext *context,
           unsigned   argc,
-          jsval     *vp)
+          JS::Value *vp)
 {
     JS::CallArgs argv = JS::CallArgsFromVp (argc, vp);
     JSObject *obj = JSVAL_TO_OBJECT(argv.thisv());
@@ -529,7 +529,7 @@ mask_func(JSContext *context,
 static JSBool
 maskSurface_func(JSContext *context,
                  unsigned   argc,
-                 jsval     *vp)
+                 JS::Value *vp)
 {
     JS::CallArgs argv = JS::CallArgsFromVp (argc, vp);
     JSObject *obj = JSVAL_TO_OBJECT(argv.thisv());
@@ -565,7 +565,7 @@ maskSurface_func(JSContext *context,
 static JSBool
 setDash_func(JSContext *context,
              unsigned   argc,
-             jsval     *vp)
+             JS::Value *vp)
 {
     JS::CallArgs argv = JS::CallArgsFromVp (argc, vp);
     JSObject *obj = JSVAL_TO_OBJECT(argv.thisv());
@@ -596,7 +596,7 @@ setDash_func(JSContext *context,
 
     dashes_c = g_array_sized_new (FALSE, FALSE, sizeof(double), len);
     for (i = 0; i < len; ++i) {
-        jsval elem;
+        JS::Value elem;
         double b;
 
         elem = JSVAL_VOID;
@@ -630,7 +630,7 @@ setDash_func(JSContext *context,
 static JSBool
 setSource_func(JSContext *context,
                unsigned   argc,
-               jsval     *vp)
+               JS::Value *vp)
 {
     JS::CallArgs argv = JS::CallArgsFromVp (argc, vp);
     JSObject *obj = JSVAL_TO_OBJECT(argv.thisv());
@@ -664,7 +664,7 @@ setSource_func(JSContext *context,
 static JSBool
 setSourceSurface_func(JSContext *context,
                       unsigned   argc,
-                      jsval     *vp)
+                      JS::Value *vp)
 {
     JS::CallArgs argv = JS::CallArgsFromVp (argc, vp);
     JSObject *obj = JSVAL_TO_OBJECT(argv.thisv());
@@ -701,7 +701,7 @@ setSourceSurface_func(JSContext *context,
 static JSBool
 showText_func(JSContext *context,
               unsigned   argc,
-              jsval     *vp)
+              JS::Value *vp)
 {
     JS::CallArgs argv = JS::CallArgsFromVp (argc, vp);
     JSObject *obj = JSVAL_TO_OBJECT(argv.thisv());
@@ -729,7 +729,7 @@ showText_func(JSContext *context,
 static JSBool
 selectFontFace_func(JSContext *context,
                     unsigned   argc,
-                    jsval     *vp)
+                    JS::Value *vp)
 {
     JS::CallArgs argv = JS::CallArgsFromVp (argc, vp);
     JSObject *obj = JSVAL_TO_OBJECT(argv.thisv());
@@ -760,7 +760,7 @@ selectFontFace_func(JSContext *context,
 static JSBool
 popGroup_func(JSContext *context,
               unsigned   argc,
-              jsval     *vp)
+              JS::Value *vp)
 {
     JS::CallReceiver rec = JS::CallReceiverFromVp(vp);
     JSObject *obj = JSVAL_TO_OBJECT(rec.thisv());
@@ -793,7 +793,7 @@ popGroup_func(JSContext *context,
 static JSBool
 getSource_func(JSContext *context,
                unsigned   argc,
-               jsval     *vp)
+               JS::Value *vp)
 {
     JS::CallReceiver rec = JS::CallReceiverFromVp(vp);
     JSObject *obj = JSVAL_TO_OBJECT(rec.thisv());
@@ -827,7 +827,7 @@ getSource_func(JSContext *context,
 static JSBool
 getTarget_func(JSContext *context,
                unsigned   argc,
-               jsval     *vp)
+               JS::Value *vp)
 {
     JS::CallReceiver rec = JS::CallReceiverFromVp(vp);
     JSObject *obj = JSVAL_TO_OBJECT(rec.thisv());
@@ -861,7 +861,7 @@ getTarget_func(JSContext *context,
 static JSBool
 getGroupTarget_func(JSContext *context,
                     unsigned   argc,
-                    jsval     *vp)
+                    JS::Value *vp)
 {
     JS::CallReceiver rec = JS::CallReceiverFromVp(vp);
     JSObject *obj = JSVAL_TO_OBJECT(rec.thisv());
@@ -1023,7 +1023,7 @@ gjs_cairo_context_get_context(JSContext *context,
 
 static JSBool
 context_to_g_argument(JSContext      *context,
-                      jsval           value,
+                      JS::Value       value,
                       const char     *arg_name,
                       GjsArgumentType argument_type,
                       GITransfer      transfer,
@@ -1046,7 +1046,7 @@ context_to_g_argument(JSContext      *context,
 
 static JSBool
 context_from_g_argument(JSContext  *context,
-                        jsval      *value_p,
+                        JS::Value  *value_p,
                         GArgument  *arg)
 {
     JSObject *obj;
diff --git a/modules/cairo-gradient.cpp b/modules/cairo-gradient.cpp
index 1b5c40f..ed44660 100644
--- a/modules/cairo-gradient.cpp
+++ b/modules/cairo-gradient.cpp
@@ -46,7 +46,7 @@ JSPropertySpec gjs_cairo_gradient_proto_props[] = {
 static JSBool
 addColorStopRGB_func(JSContext *context,
                      unsigned   argc,
-                     jsval     *vp)
+                     JS::Value *vp)
 {
     JS::CallArgs argv = JS::CallArgsFromVp (argc, vp);
     JSObject *obj = JSVAL_TO_OBJECT(argv.thisv());
@@ -75,7 +75,7 @@ addColorStopRGB_func(JSContext *context,
 static JSBool
 addColorStopRGBA_func(JSContext *context,
                       unsigned   argc,
-                      jsval     *vp)
+                      JS::Value *vp)
 {
     JS::CallArgs argv = JS::CallArgsFromVp (argc, vp);
     JSObject *obj = JSVAL_TO_OBJECT(argv.thisv());
diff --git a/modules/cairo-image-surface.cpp b/modules/cairo-image-surface.cpp
index 8f4bc9d..512aa8f 100644
--- a/modules/cairo-image-surface.cpp
+++ b/modules/cairo-image-surface.cpp
@@ -71,7 +71,7 @@ JSPropertySpec gjs_cairo_image_surface_proto_props[] = {
 static JSBool
 createFromPNG_func(JSContext *context,
                    unsigned   argc,
-                   jsval     *vp)
+                   JS::Value *vp)
 {
     JS::CallArgs argv = JS::CallArgsFromVp (argc, vp);
     char *filename;
@@ -102,7 +102,7 @@ createFromPNG_func(JSContext *context,
 static JSBool
 getFormat_func(JSContext *context,
                unsigned   argc,
-               jsval     *vp)
+               JS::Value *vp)
 {
     JS::CallReceiver rec = JS::CallReceiverFromVp(vp);
     JSObject *obj = JSVAL_TO_OBJECT(rec.thisv());
@@ -128,7 +128,7 @@ getFormat_func(JSContext *context,
 static JSBool
 getWidth_func(JSContext *context,
               unsigned   argc,
-              jsval     *vp)
+              JS::Value *vp)
 {
     JS::CallReceiver rec = JS::CallReceiverFromVp(vp);
     JSObject *obj = JSVAL_TO_OBJECT(rec.thisv());
@@ -154,7 +154,7 @@ getWidth_func(JSContext *context,
 static JSBool
 getHeight_func(JSContext *context,
                unsigned   argc,
-               jsval     *vp)
+               JS::Value *vp)
 {
     JS::CallReceiver rec = JS::CallReceiverFromVp(vp);
     JSObject *obj = JSVAL_TO_OBJECT(rec.thisv());
@@ -180,7 +180,7 @@ getHeight_func(JSContext *context,
 static JSBool
 getStride_func(JSContext *context,
                unsigned   argc,
-               jsval     *vp)
+               JS::Value *vp)
 {
     JS::CallReceiver rec = JS::CallReceiverFromVp(vp);
     JSObject *obj = JSVAL_TO_OBJECT(rec.thisv());
diff --git a/modules/cairo-pattern.cpp b/modules/cairo-pattern.cpp
index 2102e4e..e7fb0ab 100644
--- a/modules/cairo-pattern.cpp
+++ b/modules/cairo-pattern.cpp
@@ -60,7 +60,7 @@ JSPropertySpec gjs_cairo_pattern_proto_props[] = {
 static JSBool
 getType_func(JSContext *context,
              unsigned   argc,
-             jsval     *vp)
+             JS::Value *vp)
 {
     JS::CallReceiver rec = JS::CallReceiverFromVp(vp);
     JSObject *obj = JSVAL_TO_OBJECT(rec.thisv());
diff --git a/modules/cairo-private.h b/modules/cairo-private.h
index 50cf28d..8416b11 100644
--- a/modules/cairo-private.h
+++ b/modules/cairo-private.h
@@ -30,14 +30,14 @@ JSBool           gjs_cairo_check_status                 (JSContext       *contex
                                                          cairo_status_t   status,
                                                          const char      *name);
 
-jsval            gjs_cairo_region_create_proto          (JSContext       *context,
+JS::Value        gjs_cairo_region_create_proto          (JSContext       *context,
                                                          JSObject        *module,
                                                          const char      *proto_name,
                                                          JSObject        *parent);
 void             gjs_cairo_region_init                  (JSContext       *context);
 
 
-jsval            gjs_cairo_context_create_proto         (JSContext       *context,
+JS::Value        gjs_cairo_context_create_proto         (JSContext       *context,
                                                          JSObject        *module,
                                                          const char      *proto_name,
                                                          JSObject        *parent);
@@ -50,7 +50,7 @@ void             gjs_cairo_surface_init                 (JSContext       *contex
 
 
 /* cairo_path_t */
-jsval            gjs_cairo_path_create_proto            (JSContext       *context,
+JS::Value        gjs_cairo_path_create_proto            (JSContext       *context,
                                                          JSObject        *module,
                                                          const char      *proto_name,
                                                          JSObject        *parent);
@@ -60,7 +60,7 @@ cairo_path_t *   gjs_cairo_path_get_path                (JSContext       *contex
                                                          JSObject        *path_wrapper);
 
 /* surface */
-jsval            gjs_cairo_surface_create_proto         (JSContext       *context,
+JS::Value        gjs_cairo_surface_create_proto         (JSContext       *context,
                                                          JSObject        *module,
                                                          const char      *proto_name,
                                                          JSObject        *parent);
@@ -75,7 +75,7 @@ cairo_surface_t* gjs_cairo_surface_get_surface          (JSContext       *contex
                                                          JSObject        *object);
 
 /* image surface */
-jsval            gjs_cairo_image_surface_create_proto   (JSContext       *context,
+JS::Value        gjs_cairo_image_surface_create_proto   (JSContext       *context,
                                                          JSObject        *module,
                                                          const char      *proto_name,
                                                          JSObject        *parent);
@@ -86,7 +86,7 @@ JSObject *       gjs_cairo_image_surface_from_surface   (JSContext       *contex
 
 /* postscript surface */
 #ifdef CAIRO_HAS_PS_SURFACE
-jsval            gjs_cairo_ps_surface_create_proto      (JSContext       *context,
+JS::Value        gjs_cairo_ps_surface_create_proto      (JSContext       *context,
                                                          JSObject        *module,
                                                          const char      *proto_name,
                                                          JSObject        *parent);
@@ -96,7 +96,7 @@ JSObject *       gjs_cairo_ps_surface_from_surface       (JSContext       *conte
 
 /* pdf surface */
 #ifdef CAIRO_HAS_PDF_SURFACE
-jsval            gjs_cairo_pdf_surface_create_proto     (JSContext       *context,
+JS::Value        gjs_cairo_pdf_surface_create_proto     (JSContext       *context,
                                                          JSObject        *module,
                                                          const char      *proto_name,
                                                          JSObject        *parent);
@@ -106,7 +106,7 @@ JSObject *       gjs_cairo_pdf_surface_from_surface     (JSContext       *contex
 
 /* svg surface */
 #ifdef CAIRO_HAS_SVG_SURFACE
-jsval            gjs_cairo_svg_surface_create_proto     (JSContext       *context,
+JS::Value        gjs_cairo_svg_surface_create_proto     (JSContext       *context,
                                                          JSObject        *module,
                                                          const char      *proto_name,
                                                          JSObject        *parent);
@@ -115,7 +115,7 @@ JSObject *       gjs_cairo_svg_surface_from_surface     (JSContext       *contex
                                                          cairo_surface_t *surface);
 
 /* pattern */
-jsval            gjs_cairo_pattern_create_proto         (JSContext       *context,
+JS::Value        gjs_cairo_pattern_create_proto         (JSContext       *context,
                                                          JSObject        *module,
                                                          const char      *proto_name,
                                                          JSObject        *parent);
@@ -130,13 +130,13 @@ cairo_pattern_t* gjs_cairo_pattern_get_pattern          (JSContext       *contex
                                                          JSObject        *object);
 
 /* gradient */
-jsval            gjs_cairo_gradient_create_proto        (JSContext       *context,
+JS::Value        gjs_cairo_gradient_create_proto        (JSContext       *context,
                                                          JSObject        *module,
                                                          const char      *proto_name,
                                                          JSObject        *parent);
 
 /* linear gradient */
-jsval            gjs_cairo_linear_gradient_create_proto (JSContext       *context,
+JS::Value        gjs_cairo_linear_gradient_create_proto (JSContext       *context,
                                                          JSObject        *module,
                                                          const char      *proto_name,
                                                          JSObject        *parent);
@@ -144,7 +144,7 @@ JSObject *       gjs_cairo_linear_gradient_from_pattern (JSContext       *contex
                                                          cairo_pattern_t *pattern);
 
 /* radial gradient */
-jsval            gjs_cairo_radial_gradient_create_proto (JSContext       *context,
+JS::Value        gjs_cairo_radial_gradient_create_proto (JSContext       *context,
                                                          JSObject        *module,
                                                          const char      *proto_name,
                                                          JSObject        *parent);
@@ -152,7 +152,7 @@ JSObject *       gjs_cairo_radial_gradient_from_pattern (JSContext       *contex
                                                          cairo_pattern_t *pattern);
 
 /* surface pattern */
-jsval            gjs_cairo_surface_pattern_create_proto (JSContext       *context,
+JS::Value        gjs_cairo_surface_pattern_create_proto (JSContext       *context,
                                                          JSObject        *module,
                                                          const char      *proto_name,
                                                          JSObject        *parent);
@@ -160,7 +160,7 @@ JSObject *       gjs_cairo_surface_pattern_from_pattern (JSContext       *contex
                                                          cairo_pattern_t *pattern);
 
 /* solid pattern */
-jsval            gjs_cairo_solid_pattern_create_proto   (JSContext       *context,
+JS::Value        gjs_cairo_solid_pattern_create_proto   (JSContext       *context,
                                                          JSObject        *module,
                                                          const char      *proto_name,
                                                          JSObject        *parent);
diff --git a/modules/cairo-region.cpp b/modules/cairo-region.cpp
index c46e406..26f9307 100644
--- a/modules/cairo-region.cpp
+++ b/modules/cairo-region.cpp
@@ -65,7 +65,7 @@ fill_rectangle(JSContext *context, JSObject *obj,
     static JSBool                                               \
     method##_func(JSContext *context,                           \
                   unsigned argc,                                \
-                  jsval *vp)                                    \
+                  JS::Value *vp)                                \
     {                                                           \
         PRELUDE;                                                \
         JSObject *other_obj;                                    \
@@ -86,7 +86,7 @@ fill_rectangle(JSContext *context, JSObject *obj,
     static JSBool                                               \
     method##_rectangle_func(JSContext *context,                 \
                             unsigned argc,                      \
-                            jsval *vp)                          \
+                            JS::Value *vp)                      \
     {                                                           \
         PRELUDE;                                                \
         JSObject *rect_obj;                                     \
@@ -117,7 +117,7 @@ static JSBool
 fill_rectangle(JSContext *context, JSObject *obj,
                cairo_rectangle_int_t *rect)
 {
-    jsval val;
+    JS::Value val;
 
     if (!gjs_object_get_property_const(context, obj, GJS_STRING_X, &val))
         return JS_FALSE;
@@ -147,7 +147,7 @@ make_rectangle(JSContext *context,
                cairo_rectangle_int_t *rect)
 {
     JSObject *rect_obj = JS_NewObject(context, NULL, NULL, NULL);
-    jsval val;
+    JS::Value val;
 
     val = INT_TO_JSVAL(rect->x);
     JS_SetProperty(context, rect_obj, "x", &val);
@@ -167,11 +167,11 @@ make_rectangle(JSContext *context,
 static JSBool
 num_rectangles_func(JSContext *context,
                     unsigned argc,
-                    jsval *vp)
+                    JS::Value *vp)
 {
     PRELUDE;
     int n_rects;
-    jsval retval;
+    JS::Value retval;
 
     if (!gjs_parse_call_args(context, "num_rectangles", "", argv))
         return JS_FALSE;
@@ -185,13 +185,13 @@ num_rectangles_func(JSContext *context,
 static JSBool
 get_rectangle_func(JSContext *context,
                    unsigned argc,
-                   jsval *vp)
+                   JS::Value *vp)
 {
     PRELUDE;
     int i;
     JSObject *rect_obj;
     cairo_rectangle_int_t rect;
-    jsval retval;
+    JS::Value retval;
 
     if (!gjs_parse_call_args(context, "get_rectangle", "i", argv, "rect", &i))
         return JS_FALSE;
@@ -291,7 +291,7 @@ gjs_cairo_region_from_region(JSContext *context,
 
 static JSBool
 region_to_g_argument(JSContext      *context,
-                     jsval           value,
+                     JS::Value       value,
                      const char     *arg_name,
                      GjsArgumentType argument_type,
                      GITransfer      transfer,
@@ -314,7 +314,7 @@ region_to_g_argument(JSContext      *context,
 
 static JSBool
 region_from_g_argument(JSContext  *context,
-                       jsval      *value_p,
+                       JS::Value  *value_p,
                        GArgument  *arg)
 {
     JSObject *obj;
diff --git a/modules/cairo-solid-pattern.cpp b/modules/cairo-solid-pattern.cpp
index 12ad155..12672ab 100644
--- a/modules/cairo-solid-pattern.cpp
+++ b/modules/cairo-solid-pattern.cpp
@@ -43,7 +43,7 @@ JSPropertySpec gjs_cairo_solid_pattern_proto_props[] = {
 static JSBool
 createRGB_func(JSContext *context,
                unsigned   argc,
-               jsval     *vp)
+               JS::Value *vp)
 {
     JS::CallArgs argv = JS::CallArgsFromVp (argc, vp);
     double red, green, blue;
@@ -71,7 +71,7 @@ createRGB_func(JSContext *context,
 static JSBool
 createRGBA_func(JSContext *context,
                 unsigned   argc,
-                jsval     *vp)
+                JS::Value *vp)
 {
     JS::CallArgs argv = JS::CallArgsFromVp (argc, vp);
     double red, green, blue, alpha;
diff --git a/modules/cairo-surface-pattern.cpp b/modules/cairo-surface-pattern.cpp
index 7ffebb2..0909fe9 100644
--- a/modules/cairo-surface-pattern.cpp
+++ b/modules/cairo-surface-pattern.cpp
@@ -77,7 +77,7 @@ JSPropertySpec gjs_cairo_surface_pattern_proto_props[] = {
 static JSBool
 setExtend_func(JSContext *context,
                unsigned   argc,
-               jsval     *vp)
+               JS::Value *vp)
 {
     JS::CallArgs argv = JS::CallArgsFromVp (argc, vp);
     JSObject *obj = JSVAL_TO_OBJECT(argv.thisv());
@@ -102,7 +102,7 @@ setExtend_func(JSContext *context,
 static JSBool
 getExtend_func(JSContext *context,
                unsigned   argc,
-               jsval     *vp)
+               JS::Value *vp)
 {
     JS::CallReceiver rec = JS::CallReceiverFromVp(vp);
     JSObject *obj = JSVAL_TO_OBJECT(rec.thisv());
@@ -129,7 +129,7 @@ getExtend_func(JSContext *context,
 static JSBool
 setFilter_func(JSContext *context,
                unsigned   argc,
-               jsval     *vp)
+               JS::Value *vp)
 {
     JS::CallArgs argv = JS::CallArgsFromVp (argc, vp);
     JSObject *obj = JSVAL_TO_OBJECT(argv.thisv());
@@ -154,7 +154,7 @@ setFilter_func(JSContext *context,
 static JSBool
 getFilter_func(JSContext *context,
                unsigned   argc,
-               jsval     *vp)
+               JS::Value *vp)
 {
     JS::CallReceiver rec = JS::CallReceiverFromVp(vp);
     JSObject *obj = JSVAL_TO_OBJECT(rec.thisv());
diff --git a/modules/cairo-surface.cpp b/modules/cairo-surface.cpp
index 47b081d..dd0b1cc 100644
--- a/modules/cairo-surface.cpp
+++ b/modules/cairo-surface.cpp
@@ -60,7 +60,7 @@ JSPropertySpec gjs_cairo_surface_proto_props[] = {
 static JSBool
 writeToPNG_func(JSContext *context,
                 unsigned   argc,
-                jsval     *vp)
+                JS::Value *vp)
 {
     JS::CallArgs argv = JS::CallArgsFromVp (argc, vp);
     JSObject *obj = JSVAL_TO_OBJECT(argv.thisv());
@@ -89,7 +89,7 @@ writeToPNG_func(JSContext *context,
 static JSBool
 getType_func(JSContext *context,
              unsigned   argc,
-             jsval     *vp)
+             JS::Value *vp)
 {
     JS::CallReceiver rec = JS::CallReceiverFromVp(vp);
     JSObject *obj = JSVAL_TO_OBJECT(rec.thisv());
@@ -250,7 +250,7 @@ gjs_cairo_surface_get_surface(JSContext *context,
 
 static JSBool
 surface_to_g_argument(JSContext      *context,
-                      jsval           value,
+                      JS::Value       value,
                       const char     *arg_name,
                       GjsArgumentType argument_type,
                       GITransfer      transfer,
@@ -273,7 +273,7 @@ surface_to_g_argument(JSContext      *context,
 
 static JSBool
 surface_from_g_argument(JSContext  *context,
-                        jsval      *value_p,
+                        JS::Value  *value_p,
                         GArgument  *arg)
 {
     JSObject *obj;
diff --git a/modules/cairo.cpp b/modules/cairo.cpp
index b5dab64..fdf8780 100644
--- a/modules/cairo.cpp
+++ b/modules/cairo.cpp
@@ -60,7 +60,7 @@ JSBool
 gjs_js_define_cairo_stuff(JSContext *context,
                           JSObject **module_out)
 {
-    jsval obj;
+    JS::Value obj;
     JSObject *module;
     JSObject *surface_proto, *pattern_proto, *gradient_proto;
 
diff --git a/modules/console.cpp b/modules/console.cpp
index 9a00070..5527245 100644
--- a/modules/console.cpp
+++ b/modules/console.cpp
@@ -157,12 +157,12 @@ gjs_console_readline(JSContext *cx, char **bufp, FILE *file, const char *prompt)
 JSBool
 gjs_console_interact(JSContext *context,
                      unsigned   argc,
-                     jsval     *vp)
+                     JS::Value *vp)
 {
     JS::CallReceiver rec = JS::CallReceiverFromVp(vp);
     JSObject *object = JSVAL_TO_OBJECT(rec.thisv());
     gboolean eof = FALSE;
-    jsval result;
+    JS::Value result;
     JSString *str;
     GString *buffer = NULL;
     char *temp_buf = NULL;
diff --git a/modules/console.h b/modules/console.h
index bb1e2da..8b6499d 100644
--- a/modules/console.h
+++ b/modules/console.h
@@ -34,7 +34,7 @@ JSBool        gjs_define_console_stuff     (JSContext      *context,
                                             JSObject      **module_out);
 JSBool        gjs_console_interact         (JSContext      *context,
                                             unsigned        argc,
-                                            jsval          *vp);
+                                            JS::Value      *vp);
 
 G_END_DECLS
 
diff --git a/modules/system.cpp b/modules/system.cpp
index 81bd9df..3f6e5b2 100644
--- a/modules/system.cpp
+++ b/modules/system.cpp
@@ -35,13 +35,13 @@
 static JSBool
 gjs_address_of(JSContext *context,
                unsigned   argc,
-               jsval     *vp)
+               JS::Value *vp)
 {
     JS::CallArgs argv = JS::CallArgsFromVp (argc, vp);
     JSObject *target_obj;
     JSBool ret;
     char *pointer_string;
-    jsval retval;
+    JS::Value retval;
 
     if (!gjs_parse_call_args(context, "addressOf", "o", argv, "object", &target_obj))
         return JS_FALSE;
@@ -60,10 +60,10 @@ gjs_address_of(JSContext *context,
 static JSBool
 gjs_refcount(JSContext *context,
              unsigned   argc,
-             jsval     *vp)
+             JS::Value *vp)
 {
     JS::CallArgs argv = JS::CallArgsFromVp (argc, vp);
-    jsval retval;
+    JS::Value retval;
     JSObject *target_obj;
     GObject *obj;
 
@@ -86,7 +86,7 @@ gjs_refcount(JSContext *context,
 static JSBool
 gjs_breakpoint(JSContext *context,
                unsigned   argc,
-               jsval     *vp)
+               JS::Value *vp)
 {
     JS::CallArgs argv = JS::CallArgsFromVp (argc, vp);
     if (!gjs_parse_call_args(context, "breakpoint", "", argv))
@@ -99,7 +99,7 @@ gjs_breakpoint(JSContext *context,
 static JSBool
 gjs_gc(JSContext *context,
        unsigned   argc,
-       jsval     *vp)
+       JS::Value *vp)
 {
     JS::CallArgs argv = JS::CallArgsFromVp (argc, vp);
     if (!gjs_parse_call_args(context, "gc", "", argv))
@@ -112,7 +112,7 @@ gjs_gc(JSContext *context,
 static JSBool
 gjs_exit(JSContext *context,
          unsigned   argc,
-         jsval     *vp)
+         JS::Value *vp)
 {
     JS::CallArgs argv = JS::CallArgsFromVp (argc, vp);
     gint32 ecode;
@@ -124,8 +124,8 @@ gjs_exit(JSContext *context,
 
 static JSBool
 gjs_clear_date_caches(JSContext *context,
-             unsigned   argc,
-             jsval     *vp)
+                      unsigned   argc,
+                      JS::Value *vp)
 {
     JS::CallReceiver rec = JS::CallReceiverFromVp(vp);
     JS_BeginRequest(context);
@@ -157,7 +157,7 @@ gjs_js_define_system_stuff(JSContext  *context,
 {
     GjsContext *gjs_context;
     char *program_name;
-    jsval value;
+    JS::Value value;
     JSBool retval;
     JSObject *module;
 
diff --git a/test/gjs-tests.cpp b/test/gjs-tests.cpp
index 6cade7b..02558c5 100644
--- a/test/gjs-tests.cpp
+++ b/test/gjs-tests.cpp
@@ -99,7 +99,7 @@ gjstest_test_func_gjs_jsapi_util_array(void)
     JSObject *global;
     GjsRootedArray *array;
     int i;
-    jsval value;
+    JS::Value value;
 
     _gjs_unit_test_fixture_begin(&fixture);
     context = fixture.context;
@@ -143,7 +143,7 @@ gjstest_test_func_gjs_jsapi_util_string_js_string_utf8(void)
 
     const char *utf8_string = "\303\211\303\226 foobar \343\203\237";
     char *utf8_result;
-    jsval js_string;
+    JS::Value js_string;
 
     _gjs_unit_test_fixture_begin(&fixture);
     context = fixture.context;
@@ -168,7 +168,7 @@ gjstest_test_func_gjs_jsapi_util_error_throw(void)
     GjsUnitTestFixture fixture;
     JSContext *context;
     JSObject *global;
-    jsval exc, value, previous;
+    JS::Value exc, value, previous;
     char *s = NULL;
     int strcmp_result;
 


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