[gjs] importer: complete the jsid conversion



commit 598951402b04e7b238efc7d44627b94d6f2a7bdb
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Mon May 6 23:01:21 2013 +0200

    importer: complete the jsid conversion
    
    Somehow this path was missed, so we would not use the precomputed
    name and instead pass the C string.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=699783

 gjs/context.c  |    3 +--
 gjs/importer.c |   18 +++++++-----------
 gjs/importer.h |    3 +--
 3 files changed, 9 insertions(+), 15 deletions(-)
---
diff --git a/gjs/context.c b/gjs/context.c
index b3af309..e39d290 100644
--- a/gjs/context.c
+++ b/gjs/context.c
@@ -671,8 +671,7 @@ gjs_context_constructor (GType                  type,
      * if it didn't exist) to our global object
      */
     if (!gjs_define_root_importer(js_context->context,
-                                  js_context->global,
-                                  "imports"))
+                                  js_context->global))
         gjs_fatal("Failed to point 'imports' property at root importer");
 
     js_context->profiler = gjs_profiler_new(js_context->runtime);
diff --git a/gjs/importer.c b/gjs/importer.c
index bf0d2e9..45034e1 100644
--- a/gjs/importer.c
+++ b/gjs/importer.c
@@ -1196,7 +1196,6 @@ gjs_create_root_importer(JSContext   *context,
                          gboolean     add_standard_search_path)
 {
     jsval importer;
-    JSBool found;
 
     JS_BeginRequest(context);
 
@@ -1221,27 +1220,24 @@ gjs_create_root_importer(JSContext   *context,
 
 JSBool
 gjs_define_root_importer(JSContext   *context,
-                         JSObject    *in_object,
-                         const char  *importer_name)
+                         JSObject    *in_object)
 {
-    JSObject *global;
     jsval importer;
     JSBool success;
     jsid imports_name;
 
     success = JS_FALSE;
-    global = gjs_get_import_global(context);
     JS_BeginRequest(context);
 
     importer = gjs_get_global_slot(context, GJS_GLOBAL_SLOT_IMPORTS);
     imports_name = gjs_runtime_get_const_string(JS_GetRuntime(context),
                                                 GJS_STRING_IMPORTS);
-    if (!JS_DefineProperty(context, in_object,
-                           importer_name, importer,
-                           NULL, NULL,
-                           GJS_MODULE_PROP_FLAGS)) {
-        gjs_debug(GJS_DEBUG_IMPORTER, "DefineProperty %s on %p failed",
-                  importer_name, in_object);
+    if (!JS_DefinePropertyById(context, in_object,
+                               imports_name, importer,
+                               NULL, NULL,
+                               GJS_MODULE_PROP_FLAGS)) {
+        gjs_debug(GJS_DEBUG_IMPORTER, "DefineProperty imports on %p failed",
+                  in_object);
         goto fail;
     }
 
diff --git a/gjs/importer.h b/gjs/importer.h
index fe60dd9..afd4ab1 100644
--- a/gjs/importer.h
+++ b/gjs/importer.h
@@ -37,8 +37,7 @@ JSBool    gjs_create_root_importer (JSContext   *context,
                                     const char **initial_search_path,
                                     gboolean     add_standard_search_path);
 JSBool    gjs_define_root_importer (JSContext   *context,
-                                    JSObject    *in_object,
-                                    const char  *importer_name);
+                                    JSObject    *in_object);
 JSObject* gjs_define_importer      (JSContext   *context,
                                     JSObject    *in_object,
                                     const char  *importer_name,


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