[gjs/wip/ptomato/mozjs31prep: 10/15] js: Replace all jsval by JS::Value
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/wip/ptomato/mozjs31prep: 10/15] js: Replace all jsval by JS::Value
- Date: Mon, 19 Sep 2016 04:15:53 +0000 (UTC)
commit 4a782614d686b4c967b5a9fa70726361be2010b8
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 | 8 ++--
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 | 4 +-
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, 519 insertions(+), 511 deletions(-)
---
diff --git a/gi/arg.cpp b/gi/arg.cpp
index 78feef2..3973390 100644
--- a/gi/arg.cpp
+++ b/gi/arg.cpp
@@ -275,7 +275,7 @@ type_needs_out_release(GITypeInfo *type_info,
static bool
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 bool
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,
bool
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;
bool result = false;
@@ -474,7 +474,7 @@ out:
bool
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 bool
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 bool
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;
bool success;
elem = JSVAL_VOID;
@@ -612,7 +612,7 @@ gjs_array_to_intarray(JSContext *context,
static bool
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 bool
gjs_array_to_floatarray(JSContext *context,
- jsval array_value,
+ JS::Value array_value,
unsigned int length,
void **arr_p,
bool 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;
bool success;
@@ -709,7 +709,7 @@ gjs_array_to_floatarray(JSContext *context,
static bool
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 bool
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,
bool result = 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 bool
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);
bool result = true;
for (i = 0; i < length; i ++) {
@@ -875,7 +875,7 @@ is_gvalue_flat_array(GITypeInfo *param_info,
static bool
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 bool
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,
bool
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;
@@ -1654,7 +1654,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,
@@ -1963,7 +1963,7 @@ gjs_g_argument_init_default(JSContext *context,
bool
gjs_value_to_arg(JSContext *context,
- jsval value,
+ JS::Value value,
GIArgInfo *arg_info,
GArgument *arg)
{
@@ -1983,7 +1983,7 @@ gjs_value_to_arg(JSContext *context,
bool
gjs_value_to_explicit_array (JSContext *context,
- jsval value,
+ JS::Value value,
GIArgInfo *arg_info,
GArgument *arg,
gsize *length_p)
@@ -2005,7 +2005,7 @@ gjs_value_to_explicit_array (JSContext *context,
static bool
gjs_array_from_g_list (JSContext *context,
- jsval *value_p,
+ JS::Value *value_p,
GITypeTag list_tag,
GITypeInfo *param_info,
GList *list,
@@ -2013,7 +2013,7 @@ gjs_array_from_g_list (JSContext *context,
{
JSObject *obj;
unsigned int i;
- jsval elem;
+ JS::Value elem;
GArgument arg;
bool result;
@@ -2073,13 +2073,13 @@ gjs_array_from_g_list (JSContext *context,
static bool
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;
bool result;
GITypeTag element_type;
@@ -2215,7 +2215,7 @@ finally:
static bool
gjs_array_from_fixed_size_array (JSContext *context,
- jsval *value_p,
+ JS::Value *value_p,
GITypeInfo *type_info,
gpointer array)
{
@@ -2238,7 +2238,7 @@ gjs_array_from_fixed_size_array (JSContext *context,
bool
gjs_value_from_explicit_array(JSContext *context,
- jsval *value_p,
+ JS::Value *value_p,
GITypeInfo *type_info,
GArgument *arg,
int length)
@@ -2257,7 +2257,7 @@ gjs_value_from_explicit_array(JSContext *context,
static bool
gjs_array_from_boxed_array (JSContext *context,
- jsval *value_p,
+ JS::Value *value_p,
GIArrayType array_type,
GITypeInfo *param_info,
GArgument *arg)
@@ -2294,12 +2294,12 @@ gjs_array_from_boxed_array (JSContext *context,
static bool
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;
bool result;
GITypeTag element_type;
@@ -2403,7 +2403,7 @@ finally:
static bool
gjs_object_from_g_hash (JSContext *context,
- jsval *value_p,
+ JS::Value *value_p,
GITypeInfo *key_param_info,
GITypeInfo *val_param_info,
GHashTable *hash)
@@ -2412,7 +2412,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;
bool result;
@@ -2482,7 +2482,7 @@ gjs_object_from_g_hash (JSContext *context,
bool
gjs_value_from_g_argument (JSContext *context,
- jsval *value_p,
+ JS::Value *value_p,
GITypeInfo *type_info,
GArgument *arg,
bool copy_structs)
@@ -2492,7 +2492,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;
@@ -2598,7 +2598,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;
@@ -2622,7 +2622,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;
}
@@ -2633,7 +2633,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;
}
@@ -2749,14 +2749,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 7d6fc7e..5c09482 100644
--- a/gi/arg.h
+++ b/gi/arg.h
@@ -43,12 +43,12 @@ typedef enum {
} GjsArgumentType;
bool gjs_value_to_arg (JSContext *context,
- jsval value,
+ JS::Value value,
GIArgInfo *arg_info,
GArgument *arg);
bool 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);
bool 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 @@ bool gjs_value_to_g_argument (JSContext *context,
GArgument *arg);
bool gjs_value_from_g_argument (JSContext *context,
- jsval *value_p,
+ JS::Value *value_p,
GITypeInfo *type_info,
GArgument *arg,
bool copy_structs);
bool 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);
bool gjs_array_from_strv (JSContext *context,
- jsval *value_p,
+ JS::Value *value_p,
const char **strv);
bool 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 467d789..4bfa62b 100644
--- a/gi/boxed.cpp
+++ b/gi/boxed.cpp
@@ -63,7 +63,7 @@ static bool struct_is_simple(GIStructInfo *info);
static bool 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 bool
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 bool
boxed_init_from_props(JSContext *context,
JSObject *obj,
Boxed *priv,
- jsval props_value)
+ JS::Value props_value)
{
JSObject *props;
JSObject *iter;
@@ -289,7 +289,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;
@@ -328,10 +328,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);
@@ -350,8 +350,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;
@@ -429,7 +429,7 @@ GJS_NATIVE_CONSTRUCTOR_DECLARE(boxed)
Boxed *proto_priv;
JSObject *proto;
Boxed *source_priv;
- jsval actual_rval;
+ JS::Value actual_rval;
bool retval;
GJS_NATIVE_CONSTRUCTOR_PRELUDE(boxed);
@@ -549,7 +549,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);
@@ -580,7 +580,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;
@@ -706,7 +706,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;
@@ -749,7 +749,7 @@ static bool
boxed_set_field_from_value(JSContext *context,
Boxed *priv,
GIFieldInfo *field_info,
- jsval value)
+ JS::Value value)
{
GITypeInfo *type_info;
GArgument arg;
@@ -892,14 +892,14 @@ define_boxed_class_fields (JSContext *context,
static bool
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;
bool ret = false;
- jsval retval;
+ JS::Value retval;
if (!priv_from_js_with_typecheck(context, obj, &priv))
goto out;
@@ -1139,7 +1139,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 a3d5ef6..da13b75 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 a520111..c7e393f 100644
--- a/gi/closure.h
+++ b/gi/closure.h
@@ -36,8 +36,8 @@ GClosure* gjs_closure_new (JSContext *context,
bool 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);
bool gjs_closure_is_valid (GClosure *closure);
JSObject* gjs_closure_get_callable (GClosure *closure);
diff --git a/gi/enumeration.cpp b/gi/enumeration.cpp
index c9061f8..962e491 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 7b86a25..c65431f 100644
--- a/gi/foreign.cpp
+++ b/gi/foreign.cpp
@@ -139,7 +139,7 @@ gjs_struct_foreign_lookup(JSContext *context,
bool
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,
bool
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 c5186f9..42f3147 100644
--- a/gi/foreign.h
+++ b/gi/foreign.h
@@ -29,7 +29,7 @@
#include "arg.h"
typedef bool (*GjsArgOverrideToGArgumentFunc) (JSContext *context,
- jsval value,
+ JS::Value value,
const char *arg_name,
GjsArgumentType argument_type,
GITransfer transfer,
@@ -37,7 +37,7 @@ typedef bool (*GjsArgOverrideToGArgumentFunc) (JSContext *context,
GArgument *arg);
typedef bool (*GjsArgOverrideFromGArgumentFunc) (JSContext *context,
- jsval *value_p,
+ JS::Value *value_p,
GArgument *arg);
typedef bool (*GjsArgOverrideReleaseGArgumentFunc) (JSContext *context,
GITransfer transfer,
@@ -54,7 +54,7 @@ bool gjs_struct_foreign_register (const char *gi_namespace,
GjsForeignInfo *info);
bool 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 @@ bool gjs_struct_foreign_convert_to_g_argument (JSContext *context,
bool may_be_null,
GArgument *arg);
bool gjs_struct_foreign_convert_from_g_argument (JSContext *context,
- jsval *value_p,
+ JS::Value *value_p,
GIBaseInfo *interface_info,
GArgument *arg);
bool gjs_struct_foreign_release_g_argument (JSContext *context,
diff --git a/gi/function.cpp b/gi/function.cpp
index 5542c22..a29425a 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;
bool 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,
bool is_vfunc)
@@ -669,8 +669,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.
@@ -704,7 +704,7 @@ gjs_invoke_c_function(JSContext *context,
bool 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;
@@ -846,7 +846,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;
@@ -1009,7 +1009,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);
@@ -1026,7 +1026,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);
@@ -1055,7 +1055,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,
@@ -1158,7 +1158,7 @@ release:
GArgument *arg;
bool arg_failed = false;
gint array_length_pos;
- jsval array_length;
+ JS::Value array_length;
GITransfer transfer;
g_assert(next_rval < function->js_out_argc);
@@ -1198,7 +1198,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) {
@@ -1297,7 +1297,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());
@@ -1305,7 +1305,7 @@ function_call(JSContext *context,
bool success;
Function *priv;
- jsval retval;
+ JS::Value retval;
priv = priv_from_js(context, callee);
gjs_debug_marshal(GJS_DEBUG_GFUNCTION,
@@ -1365,7 +1365,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());
@@ -1397,13 +1397,13 @@ get_num_arguments (JSContext *context,
static JSBool
function_to_string (JSContext *context,
guint argc,
- jsval *vp)
+ JS::Value *vp)
{
Function *priv;
gchar *string;
bool free;
JSObject *self;
- jsval retval;
+ JS::Value retval;
bool ret = false;
int i, n_args, n_jsargs;
GString *arg_names_str;
@@ -1675,7 +1675,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 */
@@ -1786,8 +1786,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;
bool result;
@@ -1806,7 +1806,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 8d463d6..45f8ede 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,
bool is_vfunc);
@@ -70,14 +70,14 @@ bool gjs_invoke_c_function_uncached (JSContext *context,
GIFunctionInfo *info,
JSObject *obj,
unsigned argc,
- jsval *argv,
- jsval *rval);
+ JS::Value *argv,
+ JS::Value *rval);
bool 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 e39bc48..e329a49 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;
bool ret = false;
@@ -498,14 +498,14 @@ fundamental_finalize(JSFreeOp *fop,
static bool
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;
bool ret = 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 8209781..530d7bf 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 bool
-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;
bool retval;
@@ -261,11 +263,13 @@ error_to_string(JSContext *context, unsigned argc, jsval *vp)
}
static bool
-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 ee87d63..24843e3 100644
--- a/gi/gtype.cpp
+++ b/gi/gtype.cpp
@@ -64,7 +64,7 @@ gjs_gtype_finalize(JSFreeOp *fop,
static bool
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,7 +72,7 @@ to_string_func(JSContext *context,
GType gtype;
gchar *strval;
bool ret;
- jsval retval;
+ JS::Value retval;
gtype = GPOINTER_TO_SIZE(priv_from_js(context, obj));
@@ -96,7 +96,7 @@ get_name_func (JSContext *context,
{
GType gtype;
bool 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 8a885e6..2ff3291 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 f0e93b9..f81c66f 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,
bool
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 ed36392..f08d5b5 100644
--- a/gi/interface.h
+++ b/gi/interface.h
@@ -39,7 +39,7 @@ bool gjs_define_interface_class (JSContext *context,
bool 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 ecde4fc..f0af71d 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 1b55b2f..2000fd8 100644
--- a/gi/ns.cpp
+++ b/gi/ns.cpp
@@ -130,10 +130,10 @@ static bool
get_name (JSContext *context,
JS::HandleObject obj,
JS::HandleId id,
- jsval *vp)
+ JS::Value *vp)
{
Ns *priv;
- jsval retval;
+ JS::Value retval;
bool ret = false;
priv = priv_from_js(context, obj);
diff --git a/gi/object.cpp b/gi/object.cpp
index 86b2b4a..275a792 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,
bool constructing)
@@ -668,7 +668,7 @@ static bool
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 bool
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)
bool 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 bool
real_connect_func(JSContext *context,
unsigned argc,
- jsval *vp,
+ JS::Value *vp,
bool 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;
bool ret = false;
@@ -1655,7 +1655,7 @@ real_connect_func(JSContext *context,
static bool
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 bool
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 bool
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;
bool failed;
- jsval retval;
+ JS::Value retval;
bool ret = false;
if (!do_base_typecheck(context, obj, true))
@@ -1795,14 +1795,14 @@ emit_func(JSContext *context,
static bool
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;
bool ret = false;
- jsval retval;
+ JS::Value retval;
if (!do_base_typecheck(context, obj, true))
goto out;
@@ -1847,7 +1847,7 @@ struct JSClass gjs_object_instance_class = {
static bool
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 bool
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 bool
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 bool
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 bool
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 bool
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, >ype_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,
bool
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 f4d537b..fdc7156 100644
--- a/gi/object.h
+++ b/gi/object.h
@@ -37,7 +37,7 @@ void gjs_define_object_class (JSContext *context,
JSObject **constructor_p);
bool 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 4f5b737..e99d035 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 ecfb658..d7fe5cc 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;
bool ret = false;
diff --git a/gi/proxyutils.h b/gi/proxyutils.h
index ec7e702..6161f3b 100644
--- a/gi/proxyutils.h
+++ b/gi/proxyutils.h
@@ -35,7 +35,7 @@ bool _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 97a80a6..02e8053 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;
bool ret = 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 e5e8581..318285e 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 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 bool
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;
bool ret = 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 4606eb4..58158ec 100644
--- a/gi/value.cpp
+++ b/gi/value.cpp
@@ -42,7 +42,7 @@
#include <girepository.h>
static bool gjs_value_from_g_value_internal(JSContext *context,
- jsval *value_p,
+ JS::Value *value_p,
const GValue *gvalue,
bool no_copy,
GSignalQuery *signal_query,
@@ -85,7 +85,7 @@ get_signal_info_if_available(GSignalQuery *signal_query)
*/
static bool
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 bool
gjs_value_to_g_value_internal(JSContext *context,
- jsval value,
+ JS::Value value,
GValue *gvalue,
bool 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));
@@ -517,7 +517,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,
@@ -741,7 +741,7 @@ gjs_value_to_g_value_internal(JSContext *context,
return 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),
@@ -758,7 +758,7 @@ gjs_value_to_g_value_internal(JSContext *context,
bool
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);
@@ -766,7 +766,7 @@ gjs_value_to_g_value(JSContext *context,
bool
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);
@@ -774,7 +774,7 @@ gjs_value_to_g_value_no_copy(JSContext *context,
static bool
convert_int_to_enum (JSContext *context,
- jsval *value_p,
+ JS::Value *value_p,
GType gtype,
int v)
{
@@ -800,7 +800,7 @@ convert_int_to_enum (JSContext *context,
static bool
gjs_value_from_g_value_internal(JSContext *context,
- jsval *value_p,
+ JS::Value *value_p,
const GValue *gvalue,
bool no_copy,
GSignalQuery *signal_query,
@@ -811,7 +811,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) {
@@ -1032,7 +1032,7 @@ gjs_value_from_g_value_internal(JSContext *context,
bool
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 f4682fb..ed13f65 100644
--- a/gi/value.h
+++ b/gi/value.h
@@ -30,13 +30,13 @@
G_BEGIN_DECLS
bool gjs_value_to_g_value (JSContext *context,
- jsval value,
+ JS::Value value,
GValue *gvalue);
bool gjs_value_to_g_value_no_copy (JSContext *context,
- jsval value,
+ JS::Value value,
GValue *gvalue);
bool 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 fe41bc7..6465b36 100644
--- a/gjs/byteArray.cpp
+++ b/gjs/byteArray.cpp
@@ -115,7 +115,7 @@ byte_array_ensure_gbytes (ByteArrayInstance *priv)
static bool
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 bool
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 bool
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;
bool ok;
ok = gjs_string_from_utf8(context,
@@ -513,7 +513,7 @@ to_string_func(JSContext *context,
static bool
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 5b05f6e..161b880 100644
--- a/gjs/compat.h
+++ b/gjs/compat.h
@@ -59,7 +59,7 @@ G_BEGIN_DECLS
#define JS_GetGlobalObject(cx) gjs_get_global_object(cx)
-static bool G_GNUC_UNUSED JS_NewNumberValue(JSContext *cx, double d, jsval *rval)
+static bool G_GNUC_UNUSED JS_NewNumberValue(JSContext *cx, double d, JS::Value *rval)
{
*rval = JS_NumberValue(d);
return JSVAL_IS_NUMBER(*rval);
@@ -73,7 +73,7 @@ static bool G_GNUC_UNUSED JS_NewNumberValue(JSContext *cx, double d, jsval *rval
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 d670b62..7d758e0 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)
{
bool ret = false;
- jsval retval;
+ JS::Value retval;
JSAutoCompartment ac(js_context->context, js_context->global);
JSAutoRequest ar(js_context->context);
@@ -756,7 +756,7 @@ bool
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 e44a14e..c176368 100644
--- a/gjs/coverage.cpp
+++ b/gjs/coverage.cpp
@@ -391,11 +391,11 @@ get_absolute_path(const char *path)
typedef bool (*ConvertAndInsertJSVal) (GArray *array,
JSContext *context,
- jsval *element);
+ JS::Value *element);
static bool
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 bool
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 bool
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 bool
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 bool
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;
bool 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);
@@ -1486,7 +1486,7 @@ coverage_get_file_checksum(JSContext *context,
static JSBool
coverage_get_file_contents(JSContext *context,
unsigned argc,
- jsval *vp)
+ JS::Value *vp)
{
bool ret = false;
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
@@ -1552,7 +1552,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,
@@ -1581,7 +1581,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;
@@ -1684,7 +1684,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");
@@ -1714,7 +1714,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 efc8c2d..03f1da1 100644
--- a/gjs/importer.cpp
+++ b/gjs/importer.cpp
@@ -262,7 +262,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);
@@ -307,7 +306,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,
@@ -417,7 +416,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;
@@ -467,7 +466,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)) {
@@ -503,7 +502,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,
@@ -671,7 +670,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;
@@ -713,7 +712,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;
@@ -791,7 +790,7 @@ importer_new_enumerate(JSContext *context,
}
case JSENUMERATE_NEXT: {
- jsval element_val;
+ JS::Value element_val;
if (JSVAL_IS_NULL(statep)) /* Iterating prototype */
return true;
@@ -1120,7 +1119,7 @@ gjs_create_root_importer(JSContext *context,
const char **initial_search_path,
bool 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 d390f6a..543919d 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 7f19fcf..5296f97 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,
bool 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 46609e6..d3a77d2 100644
--- a/gjs/jsapi-util-error.cpp
+++ b/gjs/jsapi-util-error.cpp
@@ -49,7 +49,7 @@ gjs_throw_valist(JSContext *context,
{
char *s;
bool 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 ab9f3a5..51eda5f 100644
--- a/gjs/jsapi-util-string.cpp
+++ b/gjs/jsapi-util-string.cpp
@@ -29,9 +29,9 @@
#include "compat.h"
JSBool
-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 @@ bool
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,
}
JSBool
-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 @@ bool
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,
**/
bool
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 false;
@@ -250,7 +250,7 @@ gjs_get_string_id (JSContext *context,
*/
bool
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 3bdbfd3..b2b95ab 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,
bool
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;
bool 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 bool
log_and_maybe_keep_exception(JSContext *context,
bool keep)
{
- jsval exc = JSVAL_VOID;
+ JS::Value exc = JSVAL_VOID;
bool retval = 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,
bool
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)
{
bool result;
@@ -731,8 +733,8 @@ gjs_call_function_value(JSContext *context,
static bool
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,
bool
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,
bool
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,
bool
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,
bool
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.
*/
bool
-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 fbfe42e..e22a139 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 bool 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 @@ bool 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);
bool 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);
bool gjs_init_class_dynamic (JSContext *context,
JSObject *in_object,
JSObject *parent_proto,
@@ -238,7 +238,7 @@ bool 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);
bool gjs_typecheck_instance (JSContext *context,
JSObject *obj,
@@ -248,7 +248,7 @@ bool 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 @@ bool gjs_log_and_keep_exception (JSContext *context);
bool gjs_move_exception (JSContext *src_context,
JSContext *dest_context);
bool 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);
bool 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);
bool gjs_get_prop_verbose_stub (JSContext *context,
JSObject *obj,
- jsval id,
- jsval *value_p);
+ JS::Value id,
+ JS::Value *value_p);
bool gjs_set_prop_verbose_stub (JSContext *context,
JSObject *obj,
- jsval id,
- jsval *value_p);
+ JS::Value id,
+ JS::Value *value_p);
bool gjs_add_prop_verbose_stub (JSContext *context,
JSObject *obj,
- jsval id,
- jsval *value_p);
+ JS::Value id,
+ JS::Value *value_p);
bool 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);
bool 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);
bool gjs_string_from_filename (JSContext *context,
const char *filename_string,
gssize n_bytes,
- jsval *value_p);
+ JS::Value *value_p);
bool gjs_string_get_uint16_data (JSContext *context,
- jsval value,
+ JS::Value value,
guint16 **data_p,
gsize *len_p);
bool gjs_get_string_id (JSContext *context,
@@ -340,20 +340,20 @@ jsid gjs_intern_string_to_id (JSContext *context,
const char *string);
bool 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);
bool gjs_value_to_int64 (JSContext *context,
- const jsval val,
+ const JS::Value val,
gint64 *result);
bool gjs_parse_args (JSContext *context,
const char *function_name,
const char *format,
unsigned argc,
- jsval *argv,
+ JS::Value *argv,
...);
bool gjs_parse_call_args (JSContext *context,
@@ -365,26 +365,26 @@ bool 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,
bool 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);
bool gjs_context_get_frame_info (JSContext *context,
- jsval *stack,
- jsval *fileName,
- jsval *lineNumber);
+ JS::Value *stack,
+ JS::Value *fileName,
+ JS::Value *lineNumber);
bool 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,
bool 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 697a96f..f6e92aa 100644
--- a/gjs/stack.cpp
+++ b/gjs/stack.cpp
@@ -49,11 +49,11 @@
bool
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;
bool ret = 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 028e70e..a02b81d 100644
--- a/modules/cairo-context.cpp
+++ b/modules/cairo-context.cpp
@@ -34,7 +34,7 @@
static bool \
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()); \
@@ -87,7 +87,7 @@ _GJS_CAIRO_CONTEXT_DEFINE_FUNC_BEGIN(method) \
JSObject *array = JS_NewArrayObject(context, 0, NULL); \
if (!array) \
return false; \
- jsval r; \
+ JS::Value r; \
if (!JS_NewNumberValue(context, arg1, &r)) return false; \
if (!JS_SetElement(context, array, 0, &r)) return false; \
if (!JS_NewNumberValue(context, arg2, &r)) return false; \
@@ -106,7 +106,7 @@ _GJS_CAIRO_CONTEXT_DEFINE_FUNC_BEGIN(method) \
JSObject *array = JS_NewArrayObject(context, 0, NULL); \
if (!array) \
return false; \
- jsval r; \
+ JS::Value r; \
if (!JS_NewNumberValue(context, arg1, &r)) return false; \
if (!JS_SetElement(context, array, 0, &r)) return false; \
if (!JS_NewNumberValue(context, arg2, &r)) return false; \
@@ -125,7 +125,7 @@ _GJS_CAIRO_CONTEXT_DEFINE_FUNC_BEGIN(method) \
JSObject *array = JS_NewArrayObject(context, 0, NULL); \
if (!array) \
return false; \
- jsval r; \
+ JS::Value r; \
if (!JS_NewNumberValue(context, arg1, &r)) return false; \
if (!JS_SetElement(context, array, 0, &r)) return false; \
if (!JS_NewNumberValue(context, arg2, &r)) return false; \
@@ -141,7 +141,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); \
@@ -407,7 +407,7 @@ _GJS_CAIRO_CONTEXT_DEFINE_FUNC2FFAFF(userToDeviceDistance, cairo_user_to_device_
static bool
dispose_func(JSContext *context,
unsigned argc,
- jsval *vp)
+ JS::Value *vp)
{
JS::CallReceiver rec = JS::CallReceiverFromVp(vp);
JSObject *obj = JSVAL_TO_OBJECT(rec.thisv());
@@ -426,7 +426,7 @@ dispose_func(JSContext *context,
static bool
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());
@@ -454,7 +454,7 @@ appendPath_func(JSContext *context,
static bool
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());
@@ -475,7 +475,7 @@ copyPath_func(JSContext *context,
static bool
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());
@@ -495,7 +495,7 @@ copyPathFlat_func(JSContext *context,
static bool
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());
@@ -527,7 +527,7 @@ mask_func(JSContext *context,
static bool
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());
@@ -563,7 +563,7 @@ maskSurface_func(JSContext *context,
static bool
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());
@@ -594,7 +594,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;
@@ -628,7 +628,7 @@ setDash_func(JSContext *context,
static bool
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());
@@ -662,7 +662,7 @@ setSource_func(JSContext *context,
static bool
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());
@@ -699,7 +699,7 @@ setSourceSurface_func(JSContext *context,
static bool
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());
@@ -727,7 +727,7 @@ showText_func(JSContext *context,
static bool
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());
@@ -758,7 +758,7 @@ selectFontFace_func(JSContext *context,
static bool
popGroup_func(JSContext *context,
unsigned argc,
- jsval *vp)
+ JS::Value *vp)
{
JS::CallReceiver rec = JS::CallReceiverFromVp(vp);
JSObject *obj = JSVAL_TO_OBJECT(rec.thisv());
@@ -791,7 +791,7 @@ popGroup_func(JSContext *context,
static bool
getSource_func(JSContext *context,
unsigned argc,
- jsval *vp)
+ JS::Value *vp)
{
JS::CallReceiver rec = JS::CallReceiverFromVp(vp);
JSObject *obj = JSVAL_TO_OBJECT(rec.thisv());
@@ -825,7 +825,7 @@ getSource_func(JSContext *context,
static bool
getTarget_func(JSContext *context,
unsigned argc,
- jsval *vp)
+ JS::Value *vp)
{
JS::CallReceiver rec = JS::CallReceiverFromVp(vp);
JSObject *obj = JSVAL_TO_OBJECT(rec.thisv());
@@ -859,7 +859,7 @@ getTarget_func(JSContext *context,
static bool
getGroupTarget_func(JSContext *context,
unsigned argc,
- jsval *vp)
+ JS::Value *vp)
{
JS::CallReceiver rec = JS::CallReceiverFromVp(vp);
JSObject *obj = JSVAL_TO_OBJECT(rec.thisv());
@@ -1021,7 +1021,7 @@ gjs_cairo_context_get_context(JSContext *context,
static bool
context_to_g_argument(JSContext *context,
- jsval value,
+ JS::Value value,
const char *arg_name,
GjsArgumentType argument_type,
GITransfer transfer,
@@ -1044,7 +1044,7 @@ context_to_g_argument(JSContext *context,
static bool
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 b78f1fb..508cdeb 100644
--- a/modules/cairo-gradient.cpp
+++ b/modules/cairo-gradient.cpp
@@ -46,7 +46,7 @@ JSPropertySpec gjs_cairo_gradient_proto_props[] = {
static bool
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 bool
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 c5b037b..cdf725b 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 bool
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 bool
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 bool
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 bool
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 bool
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 1767852..3ec0da7 100644
--- a/modules/cairo-pattern.cpp
+++ b/modules/cairo-pattern.cpp
@@ -60,7 +60,7 @@ JSPropertySpec gjs_cairo_pattern_proto_props[] = {
static bool
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 cf41efd..3879f4c 100644
--- a/modules/cairo-private.h
+++ b/modules/cairo-private.h
@@ -30,14 +30,14 @@ bool 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 45784f7..439105f 100644
--- a/modules/cairo-region.cpp
+++ b/modules/cairo-region.cpp
@@ -65,7 +65,7 @@ fill_rectangle(JSContext *context, JSObject *obj,
static bool \
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 bool \
method##_rectangle_func(JSContext *context, \
unsigned argc, \
- jsval *vp) \
+ JS::Value *vp) \
{ \
PRELUDE; \
JSObject *rect_obj; \
@@ -117,7 +117,7 @@ static bool
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 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 bool
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 false;
@@ -185,13 +185,13 @@ num_rectangles_func(JSContext *context,
static bool
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 false;
@@ -291,7 +291,7 @@ gjs_cairo_region_from_region(JSContext *context,
static bool
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 bool
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 b35af13..9d06d11 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 bool
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 bool
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 1f1face..c379088 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 bool
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 bool
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 bool
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 bool
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 d1d6c8c..bc00135 100644
--- a/modules/cairo-surface.cpp
+++ b/modules/cairo-surface.cpp
@@ -60,7 +60,7 @@ JSPropertySpec gjs_cairo_surface_proto_props[] = {
static bool
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 bool
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 bool
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 bool
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 68c78be..42de183 100644
--- a/modules/cairo.cpp
+++ b/modules/cairo.cpp
@@ -60,7 +60,7 @@ bool
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 c3bcefb..c9bd8c1 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)
bool
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());
bool 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 bc41be0..2d41d65 100644
--- a/modules/console.h
+++ b/modules/console.h
@@ -34,7 +34,7 @@ bool gjs_define_console_stuff (JSContext *context,
JSObject **module_out);
bool 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 fc5a5f0..3962c6b 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;
bool ret;
char *pointer_string;
- jsval retval;
+ JS::Value retval;
if (!gjs_parse_call_args(context, "addressOf", "o", argv, "object", &target_obj))
return 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;
@@ -85,7 +85,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))
@@ -98,7 +98,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))
@@ -111,7 +111,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;
@@ -123,8 +123,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);
@@ -156,7 +156,7 @@ gjs_js_define_system_stuff(JSContext *context,
{
GjsContext *gjs_context;
char *program_name;
- jsval value;
+ JS::Value value;
bool retval;
JSObject *module;
diff --git a/test/gjs-tests.cpp b/test/gjs-tests.cpp
index 7395f5d..c1d7f69 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]