[gjs/wip/ptomato/mozjs31prep] jsapi-util: Root misc functions
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/wip/ptomato/mozjs31prep] jsapi-util: Root misc functions
- Date: Thu, 27 Oct 2016 00:10:25 +0000 (UTC)
commit 6cbab89ed5e52c6040a7560c911cdffd6eff4274
Author: Philip Chimento <philip endlessm com>
Date: Wed Oct 26 16:54:07 2016 -0700
jsapi-util: Root misc functions
This uses rooting for everything else in jsapi-util.cpp that would cause
a compile error in mozjs31.
https://bugzilla.gnome.org/show_bug.cgi?id=742249
gjs/jsapi-util.cpp | 17 +++++++----------
1 files changed, 7 insertions(+), 10 deletions(-)
---
diff --git a/gjs/jsapi-util.cpp b/gjs/jsapi-util.cpp
index b0acd77..c0a5794 100644
--- a/gjs/jsapi-util.cpp
+++ b/gjs/jsapi-util.cpp
@@ -327,15 +327,14 @@ gjs_define_string_array(JSContext *context,
const char **array_values,
unsigned attrs)
{
- JSObject *array;
-
JSAutoRequest ar(context);
- array = gjs_build_string_array(context, array_length, (char **) array_values);
+ JS::RootedObject array(context,
+ gjs_build_string_array(context, array_length, (char **) array_values));
if (array != NULL) {
- if (!JS_DefineProperty(context, in_object,
- array_name, JS::ObjectValue(*array),
+ JS::RootedValue v_array(context, JS::ObjectValue(*array));
+ if (!JS_DefineProperty(context, in_object, array_name, v_array,
NULL, NULL, attrs))
array = NULL;
}
@@ -456,9 +455,7 @@ gjs_value_debug_string(JSContext *context,
/* Specifically the Call object (see jsfun.c in spidermonkey)
* does not have a toString; there may be others also.
*/
- JSClass *klass;
-
- klass = JS_GetClass(&value.toObject());
+ const JSClass *klass = JS_GetClass(&value.toObject());
if (klass != NULL) {
str = JS_NewStringCopyZ(context, klass->name);
JS_ClearPendingException(context);
@@ -496,8 +493,8 @@ gjs_value_debug_string(JSContext *context,
}
static char *
-utf8_exception_from_non_gerror_value(JSContext *cx,
- JS::Value exc)
+utf8_exception_from_non_gerror_value(JSContext *cx,
+ JS::HandleValue exc)
{
char *utf8_exception = NULL;
JSString *exc_str = JS_ValueToString(cx, exc);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]