1
From c7689ebba066a5028bab7202b515a482d63a5e25 Mon Sep 17 00:00:00 2001
2
From: =?UTF-8?q?Michel=20D=C3=A4nzer?= <michel@daenzer.net>
3
Date: Sat, 23 Aug 2014 13:04:21 +0900
4
Subject: Fix JS types in more callbacks
6
Content-Type: text/plain; charset=UTF-8
7
Content-Transfer-Encoding: 8bit
9
Fixes the following JSUnit tests on PPC:
14
testEverythingBasic.js
22
Signed-off-by: Michel Dänzer <michel@daenzer.net>
24
https://bugzilla.gnome.org/show_bug.cgi?id=729554
26
diff --git a/gi/param.cpp b/gi/param.cpp
27
index 7b4b5b5..27918b2 100644
30
@@ -59,10 +59,10 @@ GJS_DEFINE_PRIV_FROM_JS(Param, gjs_param_class)
33
param_new_resolve(JSContext *context,
38
+ JS::HandleObject obj,
41
+ JS::MutableHandleObject objp)
43
GIObjectInfo *info = NULL;
44
GIFunctionInfo *method_info;
45
@@ -70,12 +70,10 @@ param_new_resolve(JSContext *context,
47
JSBool ret = JS_FALSE;
51
- if (!gjs_get_string_id(context, *id, &name))
52
+ if (!gjs_get_string_id(context, id, &name))
53
return JS_TRUE; /* not resolved, but no error */
55
- priv = priv_from_js(context, *obj);
56
+ priv = priv_from_js(context, obj);
59
/* instance, not prototype */
60
@@ -99,12 +97,12 @@ param_new_resolve(JSContext *context,
61
"Defining method %s in prototype for GObject.ParamSpec",
62
g_base_info_get_name( (GIBaseInfo*) method_info));
64
- if (gjs_define_function(context, *obj, G_TYPE_PARAM, method_info) == NULL) {
65
+ if (gjs_define_function(context, obj, G_TYPE_PARAM, method_info) == NULL) {
66
g_base_info_unref( (GIBaseInfo*) method_info);
70
- *objp = *obj; /* we defined the prop in obj */
71
+ objp.set(obj); /* we defined the prop in obj */
74
g_base_info_unref( (GIBaseInfo*) method_info);
75
diff --git a/gjs/importer.cpp b/gjs/importer.cpp
76
index 5bf922f..f4ab160 100644
77
--- a/gjs/importer.cpp
78
+++ b/gjs/importer.cpp
79
@@ -662,10 +662,10 @@ importer_iterator_free(ImporterIterator *iter)
82
importer_new_enumerate(JSContext *context,
84
+ JS::HandleObject object,
88
+ JS::MutableHandleValue statep,
89
+ JS::MutableHandleId idp)
91
ImporterIterator *iter;
93
@@ -679,20 +679,18 @@ importer_new_enumerate(JSContext *context,
95
jsid search_path_name;
98
- *state_p = JSVAL_NULL;
99
+ statep.set(JSVAL_NULL);
102
- *id_p = INT_TO_JSID(0);
103
+ idp.set(INT_TO_JSID(0));
105
- priv = priv_from_js(context, *object);
106
+ priv = priv_from_js(context, object);
109
/* we are enumerating the prototype properties */
112
search_path_name = gjs_context_get_const_string(context, GJS_STRING_SEARCH_PATH);
113
- if (!gjs_object_require_property(context, *object, "importer", search_path_name, &search_path_val))
114
+ if (!gjs_object_require_property(context, object, "importer", search_path_name, &search_path_val))
117
if (!JSVAL_IS_OBJECT(search_path_val)) {
118
@@ -747,7 +745,7 @@ importer_new_enumerate(JSContext *context,
119
init_path = g_build_filename(dirname, MODULE_INIT_FILENAME,
122
- load_module_elements(context, *object, iter, init_path);
123
+ load_module_elements(context, object, iter, init_path);
127
@@ -788,11 +786,9 @@ importer_new_enumerate(JSContext *context,
132
- *state_p = PRIVATE_TO_JSVAL(iter);
133
+ statep.set(PRIVATE_TO_JSVAL(iter));
136
- *id_p = INT_TO_JSID(iter->elements->len);
137
+ idp.set(INT_TO_JSID(iter->elements->len));
141
@@ -800,15 +796,10 @@ importer_new_enumerate(JSContext *context,
142
case JSENUMERATE_NEXT: {
146
- gjs_throw(context, "Enumerate with no iterator set?");
150
- if (JSVAL_IS_NULL(*state_p)) /* Iterating prototype */
151
+ if (JSVAL_IS_NULL(statep)) /* Iterating prototype */
154
- iter = (ImporterIterator*) JSVAL_TO_PRIVATE(*state_p);
155
+ iter = (ImporterIterator*) JSVAL_TO_PRIVATE(statep);
157
if (iter->index < iter->elements->len) {
158
if (!gjs_string_from_utf8(context,
159
@@ -818,7 +809,8 @@ importer_new_enumerate(JSContext *context,
163
- if (!JS_ValueToId(context, element_val, id_p))
165
+ if (!JS_ValueToId(context, element_val, &id))
169
@@ -827,12 +819,12 @@ importer_new_enumerate(JSContext *context,
172
case JSENUMERATE_DESTROY: {
173
- if (state_p && !JSVAL_IS_NULL(*state_p)) {
174
- iter = (ImporterIterator*) JSVAL_TO_PRIVATE(*state_p);
175
+ if (!JSVAL_IS_NULL(statep)) {
176
+ iter = (ImporterIterator*) JSVAL_TO_PRIVATE(statep);
178
importer_iterator_free(iter);
180
- *state_p = JSVAL_NULL;
181
+ statep.set(JSVAL_NULL);