[gjs/wip/js24: 15/29] Add a wrapper for JS_GetGlobalObject,	although context globals will be going away in the future
- From: Tim Lunn <timl src gnome org>
- To: commits-list gnome org
- Cc: 
- Subject: [gjs/wip/js24: 15/29] Add a wrapper for JS_GetGlobalObject,	although context globals will be going away in the future
- Date: Tue, 15 Oct 2013 02:14:16 +0000 (UTC)
commit 33d46e577b81a84121d8b0b457cf8f701fad2082
Author: Tim Lunn <tim feathertop org>
Date:   Sat Sep 28 10:06:20 2013 +1000
    Add a wrapper for JS_GetGlobalObject, although context globals will be going
    away in the future
 gjs/compat.h          |    2 ++
 gjs/jsapi-private.cpp |    5 +++++
 gjs/jsapi-util.h      |    1 +
 3 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/gjs/compat.h b/gjs/compat.h
index 971899b..b5b617f 100644
--- a/gjs/compat.h
+++ b/gjs/compat.h
@@ -51,6 +51,8 @@ G_BEGIN_DECLS
 
 #define JSVAL_IS_OBJECT(obj) (JSVAL_IS_NULL(obj) || !JSVAL_IS_PRIMITIVE(obj))
 
+#define JS_GetGlobalObject(cx) gjs_get_global_object(cx)
+
 static JSBool G_GNUC_UNUSED JS_NewNumberValue(JSContext *cx, double d, jsval *rval)
     {
         *rval = JS_NumberValue(d);
diff --git a/gjs/jsapi-private.cpp b/gjs/jsapi-private.cpp
index 9950ecd..d7713f6 100644
--- a/gjs/jsapi-private.cpp
+++ b/gjs/jsapi-private.cpp
@@ -75,3 +75,8 @@ gjs_error_reporter(JSContext     *context,
 
     g_log(G_LOG_DOMAIN, level, "JS %s: [%s %d]: %s", warning, report->filename, report->lineno, message);
 }
+
+JSObject *
+gjs_get_global_object(JSContext *cx){
+    return js::GetDefaultGlobalForContext(cx);
+}
diff --git a/gjs/jsapi-util.h b/gjs/jsapi-util.h
index 83ce3d3..fac8890 100644
--- a/gjs/jsapi-util.h
+++ b/gjs/jsapi-util.h
@@ -283,6 +283,7 @@ JSBool      gjs_call_function_value          (JSContext       *context,
 void        gjs_error_reporter               (JSContext       *context,
                                               const char      *message,
                                               JSErrorReport   *report);
+JSObject*   gjs_get_global_object            (JSContext *cx);
 JSBool      gjs_get_prop_verbose_stub        (JSContext       *context,
                                               JSObject        *obj,
                                               jsval            id,
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]