[gjs] importer: Remove separate define/seal step for importing modules



commit 73c1c2a23ff8eb174f1b7715136f8317414ec9d2
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Fri Sep 27 19:28:09 2013 -0400

    importer: Remove separate define/seal step for importing modules
    
    If we simply set the module in the importer as the last step, this
    can't possibly fail.

 gjs/importer.c |   10 +++-------
 1 files changed, 3 insertions(+), 7 deletions(-)
---
diff --git a/gjs/importer.c b/gjs/importer.c
index 13a1a68..2a5c588 100644
--- a/gjs/importer.c
+++ b/gjs/importer.c
@@ -430,21 +430,17 @@ import_file_on_module(JSContext  *context,
     if (!import_file (context, name, file, &module_obj))
         goto out;
 
-    if (!define_import(context, obj, module_obj, name))
-        goto out;
-
     if (!define_meta_properties(context, module_obj, full_path, name, obj))
         goto out;
 
-    if (!seal_import(context, obj, name))
+    if (!JS_DefineProperty(context, obj,
+                           name, OBJECT_TO_JSVAL(module_obj),
+                           NULL, NULL, GJS_MODULE_PROP_FLAGS))
         goto out;
 
     retval = JS_TRUE;
 
  out:
-    if (!retval)
-        cancel_import(context, obj, name);
-
     g_free (full_path);
 
     return retval;


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