[gjs] ByteArray: don't define the ByteArray class in the global object



commit 03a2147bf7b56d57a35f42b6a4efeb48a1841d30
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Fri Jan 4 00:30:55 2013 +0100

    ByteArray: don't define the ByteArray class in the global object
    
    Otherwise, a ByteArray property appears, which prevents the byteArray
    test from setting it with the module object.
    It was not failing before because the byte array module was not initialized.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=692025

 gjs/byteArray.c |   13 +------------
 1 files changed, 1 insertions(+), 12 deletions(-)
---
diff --git a/gjs/byteArray.c b/gjs/byteArray.c
index 22e074c..0348dda 100644
--- a/gjs/byteArray.c
+++ b/gjs/byteArray.c
@@ -981,8 +981,7 @@ JSBool
 gjs_define_byte_array_stuff(JSContext      *context,
                             JSObject       *in_object)
 {
-    JSObject *global = gjs_get_import_global(context);
-    gjs_byte_array_prototype = JS_InitClass(context, global,
+    gjs_byte_array_prototype = JS_InitClass(context, in_object,
                              NULL,
                              &gjs_byte_array_class,
                              gjs_byte_array_constructor,
@@ -991,20 +990,10 @@ gjs_define_byte_array_stuff(JSContext      *context,
                              &gjs_byte_array_proto_funcs[0],
                              NULL,
                              NULL);
-    jsval rval;
 
     if (gjs_byte_array_prototype == NULL)
         return JS_FALSE;
 
-    if (!gjs_object_require_property(
-            context, global, NULL,
-            "ByteArray", &rval))
-        return JS_FALSE;
-
-    if (!JS_DefineProperty(context, in_object, "ByteArray",
-                           rval, NULL, NULL, GJS_MODULE_PROP_FLAGS))
-        return JS_FALSE;
-
     if (!JS_DefineFunctions(context, in_object, &gjs_byte_array_module_funcs[0]))
         return JS_FALSE;
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]