summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Chimento <philip.chimento@gmail.com>2017-04-15 23:50:14 -0700
committerPhilip Chimento <philip.chimento@gmail.com>2017-04-17 21:41:11 -0700
commitac3eb9c0107ef232eba3dba2b94f070fce2626a0 (patch)
treec9c8ccc03c7833fbec97aba6eca65ab07fa8f571
parent56e8665408c617963d42485b5335151cc37e717b (diff)
downloadgjs-ac3eb9c0107ef232eba3dba2b94f070fce2626a0.tar.gz
js: Don't pass global object to JS_NewObject functions
This is optional, and will become disallowed in SpiderMonkey 45. No change in functionality, because leaving it out already causes JS to get the global object internally. https://bugzilla.gnome.org/show_bug.cgi?id=781429
-rw-r--r--gi/boxed.cpp6
-rw-r--r--gi/fundamental.cpp4
-rw-r--r--gi/gerror.cpp3
-rw-r--r--gi/object.cpp5
-rw-r--r--gi/param.cpp3
-rw-r--r--gi/union.cpp3
-rw-r--r--gjs/jsapi-dynamic-class.cpp5
7 files changed, 9 insertions, 20 deletions
diff --git a/gi/boxed.cpp b/gi/boxed.cpp
index 466127fb..e6500d3b 100644
--- a/gi/boxed.cpp
+++ b/gi/boxed.cpp
@@ -564,7 +564,6 @@ get_nested_interface_object(JSContext *context,
return false;
}
- JS::RootedObject global(context, gjs_get_import_global(context));
JS::RootedObject proto(context,
gjs_lookup_generic_prototype(context,
(GIBoxedInfo*) interface_info));
@@ -572,7 +571,7 @@ get_nested_interface_object(JSContext *context,
offset = g_field_info_get_offset (field_info);
- obj = JS_NewObjectWithGivenProto(context, JS_GetClass(proto), proto, global);
+ obj = JS_NewObjectWithGivenProto(context, JS_GetClass(proto), proto);
if (obj == NULL)
return false;
@@ -1222,11 +1221,10 @@ gjs_boxed_from_c_struct(JSContext *context,
"Wrapping struct %s %p with JSObject",
g_base_info_get_name((GIBaseInfo *)info), gboxed);
- JS::RootedObject global(context, gjs_get_import_global(context));
JS::RootedObject proto(context, gjs_lookup_generic_prototype(context, info));
proto_priv = priv_from_js(context, proto);
- obj = JS_NewObjectWithGivenProto(context, JS_GetClass(proto), proto, global);
+ obj = JS_NewObjectWithGivenProto(context, JS_GetClass(proto), proto);
GJS_INC_COUNTER(boxed);
priv = g_slice_new0(Boxed);
diff --git a/gi/fundamental.cpp b/gi/fundamental.cpp
index df3837f3..2242bc8e 100644
--- a/gi/fundamental.cpp
+++ b/gi/fundamental.cpp
@@ -778,9 +778,7 @@ gjs_object_from_g_fundamental(JSContext *context,
if (!proto)
return NULL;
- JS::RootedObject global(context, gjs_get_import_global(context));
- object = JS_NewObjectWithGivenProto(context, JS_GetClass(proto), proto,
- global);
+ object = JS_NewObjectWithGivenProto(context, JS_GetClass(proto), proto);
if (object == NULL)
goto out;
diff --git a/gi/gerror.cpp b/gi/gerror.cpp
index b8035c08..9d4977fc 100644
--- a/gi/gerror.cpp
+++ b/gi/gerror.cpp
@@ -445,11 +445,10 @@ gjs_error_from_gerror(JSContext *context,
g_base_info_get_name((GIBaseInfo *)info));
JS::RootedObject proto(context, gjs_lookup_generic_prototype(context, info));
- JS::RootedObject global(context, gjs_get_import_global(context));
proto_priv = priv_from_js(context, proto);
JS::RootedObject obj(context,
- JS_NewObjectWithGivenProto(context, JS_GetClass(proto), proto, global));
+ JS_NewObjectWithGivenProto(context, JS_GetClass(proto), proto));
GJS_INC_COUNTER(gerror);
priv = g_slice_new0(Error);
diff --git a/gi/object.cpp b/gi/object.cpp
index 4b5ddcf5..2f353a0d 100644
--- a/gi/object.cpp
+++ b/gi/object.cpp
@@ -2035,11 +2035,8 @@ gjs_object_from_g_object(JSContext *context,
if (!proto)
return nullptr;
- JS::RootedObject global(context, gjs_get_import_global(context));
-
JS::RootedObject obj(context,
- JS_NewObjectWithGivenProto(context, JS_GetClass(proto), proto,
- global));
+ JS_NewObjectWithGivenProto(context, JS_GetClass(proto), proto));
if (obj == NULL)
return nullptr;
diff --git a/gi/param.cpp b/gi/param.cpp
index 2dec2c8e..c38eebb0 100644
--- a/gi/param.cpp
+++ b/gi/param.cpp
@@ -260,9 +260,8 @@ gjs_param_from_g_param(JSContext *context,
g_type_name(gparam->owner_type));
JS::RootedObject proto(context, gjs_lookup_param_prototype(context));
- JS::RootedObject global(context, gjs_get_import_global(context));
- obj = JS_NewObjectWithGivenProto(context, JS_GetClass(proto), proto, global);
+ obj = JS_NewObjectWithGivenProto(context, JS_GetClass(proto), proto);
GJS_INC_COUNTER(param);
priv = g_slice_new0(Param);
diff --git a/gi/union.cpp b/gi/union.cpp
index 35c4d8fa..c4ef1037 100644
--- a/gi/union.cpp
+++ b/gi/union.cpp
@@ -405,9 +405,8 @@ gjs_union_from_c_union(JSContext *context,
JS::RootedObject proto(context,
gjs_lookup_generic_prototype(context, (GIUnionInfo*) info));
- JS::RootedObject global(context, gjs_get_import_global(context));
- obj = JS_NewObjectWithGivenProto(context, JS_GetClass(proto), proto, global);
+ obj = JS_NewObjectWithGivenProto(context, JS_GetClass(proto), proto);
GJS_INC_COUNTER(boxed);
priv = g_slice_new0(Union);
diff --git a/gjs/jsapi-dynamic-class.cpp b/gjs/jsapi-dynamic-class.cpp
index 7203fb2a..3d702228 100644
--- a/gjs/jsapi-dynamic-class.cpp
+++ b/gjs/jsapi-dynamic-class.cpp
@@ -79,8 +79,7 @@ gjs_init_class_dynamic(JSContext *context,
*/
if (parent_proto) {
- prototype.set(JS_NewObjectWithGivenProto(context, clasp,
- parent_proto, global));
+ prototype.set(JS_NewObjectWithGivenProto(context, clasp, parent_proto));
} else {
/* JS_NewObject will try to search for clasp prototype in the
* global object, which is wrong, but it's not a problem because
@@ -88,7 +87,7 @@ gjs_init_class_dynamic(JSContext *context,
* constructor is not found (and it won't be found, because we
* never call JS_InitClass).
*/
- prototype.set(JS_NewObject(context, clasp, global));
+ prototype.set(JS_NewObject(context, clasp));
}
if (!prototype)
goto out;