[gjs/wip/ptomato/mozjs31prep: 12/15] compat: Remove JS_GetGlobalObject define
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/wip/ptomato/mozjs31prep: 12/15] compat: Remove JS_GetGlobalObject define
- Date: Mon, 19 Sep 2016 04:16:03 +0000 (UTC)
commit 1aed0a5c47df1aa0908a7cdea57da872f99d3403
Author: Philip Chimento <philip chimento gmail com>
Date: Sun Sep 18 08:17:14 2016 -0700
compat: Remove JS_GetGlobalObject define
As long as we are switching to new SpiderMonkey API, we should get rid of
this define that mimics removed API, since we wrote a function to replace
it.
https://bugzilla.gnome.org/show_bug.cgi?id=742249
gjs/compat.h | 2 --
gjs/coverage.cpp | 4 ++--
gjs/jsapi-util-error.cpp | 2 +-
gjs/jsapi-util.cpp | 6 +++---
test/gjs-tests.cpp | 6 +++---
5 files changed, 9 insertions(+), 11 deletions(-)
---
diff --git a/gjs/compat.h b/gjs/compat.h
index 3229840..892510b 100644
--- a/gjs/compat.h
+++ b/gjs/compat.h
@@ -55,8 +55,6 @@ G_BEGIN_DECLS
* See https://bugzilla.gnome.org/show_bug.cgi?id=622896 for some initial discussion.
*/
-#define JS_GetGlobalObject(cx) gjs_get_global_object(cx)
-
static bool G_GNUC_UNUSED JS_NewNumberValue(JSContext *cx, double d, JS::Value *rval)
{
*rval = JS_NumberValue(d);
diff --git a/gjs/coverage.cpp b/gjs/coverage.cpp
index 3962136..417b895 100644
--- a/gjs/coverage.cpp
+++ b/gjs/coverage.cpp
@@ -1611,7 +1611,7 @@ bootstrap_coverage(GjsCoverage *coverage)
JSContext *context = (JSContext *) gjs_context_get_native_context(priv->context);
JSAutoRequest ar(context);
- JSObject *debuggee = JS_GetGlobalObject(context);
+ JSObject *debuggee = gjs_get_global_object(context);
JS::CompartmentOptions options;
options.setVersion(JSVERSION_LATEST);
JS::RootedObject debugger_compartment(JS_GetRuntime(context),
@@ -1742,7 +1742,7 @@ gjs_coverage_constructed(GObject *object)
JS_SetOptions(context, options_flags);
if (!bootstrap_coverage(coverage)) {
- JSAutoCompartment compartment(context, JS_GetGlobalObject(context));
+ JSAutoCompartment compartment(context, gjs_get_global_object(context));
gjs_log_exception(context);
}
}
diff --git a/gjs/jsapi-util-error.cpp b/gjs/jsapi-util-error.cpp
index b7de3be..c6849a7 100644
--- a/gjs/jsapi-util-error.cpp
+++ b/gjs/jsapi-util-error.cpp
@@ -54,7 +54,7 @@ gjs_throw_valist(JSContext *context,
s = g_strdup_vprintf(format, args);
- JSAutoCompartment compartment(context, JS_GetGlobalObject(context));
+ JSAutoCompartment compartment(context, gjs_get_global_object(context));
JS_BeginRequest(context);
diff --git a/gjs/jsapi-util.cpp b/gjs/jsapi-util.cpp
index 44dd557..0af9ae1 100644
--- a/gjs/jsapi-util.cpp
+++ b/gjs/jsapi-util.cpp
@@ -119,7 +119,7 @@ gjs_set_global_slot (JSContext *context,
JS::Value value)
{
JSObject *global;
- global = JS_GetGlobalObject(context);
+ global = gjs_get_global_object(context);
JS_SetReservedSlot(global, JSCLASS_GLOBAL_SLOT_COUNT + slot, value);
}
@@ -128,7 +128,7 @@ gjs_get_global_slot (JSContext *context,
GjsGlobalSlot slot)
{
JSObject *global;
- global = JS_GetGlobalObject(context);
+ global = gjs_get_global_object(context);
return JS_GetReservedSlot(global, JSCLASS_GLOBAL_SLOT_COUNT + slot);
}
@@ -444,7 +444,7 @@ gjs_explain_scope(JSContext *context,
context,
"");
- global = JS_GetGlobalObject(context);
+ global = gjs_get_global_object(context);
debugstr = gjs_value_debug_string(context, JS::ObjectOrNullValue(global));
gjs_debug(GJS_DEBUG_SCOPE,
" Global: %p %s",
diff --git a/test/gjs-tests.cpp b/test/gjs-tests.cpp
index f6267cf..7c3837f 100644
--- a/test/gjs-tests.cpp
+++ b/test/gjs-tests.cpp
@@ -106,7 +106,7 @@ gjstest_test_func_gjs_jsapi_util_array(void)
array = gjs_rooted_array_new();
- global = JS_GetGlobalObject(context);
+ global = gjs_get_global_object(context);
JSCompartment *oldCompartment = JS_EnterCompartment(context, global);
for (i = 0; i < N_ELEMS; i++) {
@@ -147,7 +147,7 @@ gjstest_test_func_gjs_jsapi_util_string_js_string_utf8(void)
_gjs_unit_test_fixture_begin(&fixture);
context = fixture.context;
- global = JS_GetGlobalObject(context);
+ global = gjs_get_global_object(context);
JSCompartment *oldCompartment = JS_EnterCompartment(context, global);
g_assert(gjs_string_from_utf8(context, utf8_string, -1, &js_string));
@@ -174,7 +174,7 @@ gjstest_test_func_gjs_jsapi_util_error_throw(void)
_gjs_unit_test_fixture_begin(&fixture);
context = fixture.context;
- global = JS_GetGlobalObject(context);
+ global = gjs_get_global_object(context);
JSCompartment *oldCompartment = JS_EnterCompartment(context, global);
/* Test that we can throw */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]