[gjs/wip/js24] Add more missing compartment calls
- From: Tim Lunn <timl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/wip/js24] Add more missing compartment calls
- Date: Mon, 14 Oct 2013 23:43:02 +0000 (UTC)
commit 0eef9ecb546aa71e79bc05dce8d6a532e5b6e0e3
Author: Tim Lunn <tim feathertop org>
Date: Tue Oct 15 10:40:42 2013 +1100
Add more missing compartment calls
gi/closure.cpp | 3 +++
gi/function.cpp | 3 +++
gi/object.cpp | 8 ++++++++
gi/value.cpp | 4 ++++
4 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/gi/closure.cpp b/gi/closure.cpp
index 68b3ff5..4058c26 100644
--- a/gi/closure.cpp
+++ b/gi/closure.cpp
@@ -254,6 +254,7 @@ gjs_closure_invoke(GClosure *closure,
{
Closure *c;
JSContext *context;
+ JSObject *global;
c = (Closure*) closure;
@@ -267,6 +268,8 @@ gjs_closure_invoke(GClosure *closure,
context = gjs_runtime_get_context(c->runtime);
JS_BeginRequest(context);
+ global = JS_GetGlobalObject(context);
+ JSAutoCompartment ac(context, global);
if (JS_IsExceptionPending(context)) {
gjs_debug_closure("Exception was pending before invoking callback??? "
diff --git a/gi/function.cpp b/gi/function.cpp
index 6c5d2e0..87bd4da 100644
--- a/gi/function.cpp
+++ b/gi/function.cpp
@@ -169,6 +169,7 @@ gjs_callback_closure(ffi_cif *cif,
void *data)
{
JSContext *context;
+ JSObject *global;
GjsCallbackTrampoline *trampoline;
int i, n_args, n_jsargs, n_outargs;
jsval *jsargs, rval;
@@ -183,6 +184,8 @@ gjs_callback_closure(ffi_cif *cif,
context = gjs_runtime_get_context(trampoline->runtime);
JS_BeginRequest(context);
+ global = JS_GetGlobalObject(context);
+ JSAutoCompartment ac(context, global);
n_args = g_callable_info_get_n_args(trampoline->info);
diff --git a/gi/object.cpp b/gi/object.cpp
index 8feb1ce..0388d2c 100644
--- a/gi/object.cpp
+++ b/gi/object.cpp
@@ -1870,6 +1870,8 @@ gjs_define_object_class(JSContext *context,
JSObject *prototype;
JSObject *constructor;
JSObject *parent_proto;
+ JSObject *global;
+
jsval value;
ObjectInstance *priv;
const char *ns;
@@ -1934,6 +1936,9 @@ gjs_define_object_class(JSContext *context,
constructor_name = g_type_name(gtype);
}
+ global = JS_GetGlobalObject(context);
+ JSAutoCompartment ac(context, global);
+
if (!gjs_init_class_dynamic(context, in_object,
parent_proto,
ns, constructor_name,
@@ -1993,6 +1998,7 @@ gjs_object_from_g_object(JSContext *context,
GObject *gobj)
{
JSObject *obj;
+ JSObject *global;
if (gobj == NULL)
return NULL;
@@ -2012,6 +2018,8 @@ gjs_object_from_g_object(JSContext *context,
proto = gjs_lookup_object_prototype(context, gtype);
JS_BeginRequest(context);
+ global = JS_GetGlobalObject(context);
+ JSAutoCompartment ac(context, global);
obj = JS_NewObjectWithGivenProto(context,
JS_GetClass(proto), proto,
diff --git a/gi/value.cpp b/gi/value.cpp
index 4f2426f..803e5bb 100644
--- a/gi/value.cpp
+++ b/gi/value.cpp
@@ -58,6 +58,8 @@ closure_marshal(GClosure *closure,
{
JSRuntime *runtime;
JSContext *context;
+ JSObject *global;
+
int argc;
jsval *argv;
jsval rval;
@@ -76,6 +78,8 @@ closure_marshal(GClosure *closure,
runtime = gjs_closure_get_runtime(closure);
context = gjs_runtime_get_context(runtime);
JS_BeginRequest(context);
+ global = JS_GetGlobalObject(context);
+ JSAutoCompartment ac(context, global);
argc = n_param_values;
rval = JSVAL_VOID;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]