[seed] Fix #657833 - Import GLib namespace when searchPath is initialized. GLib might have extension presen



commit 6ae79c21436f036f36ab7ebfe1b5466ae741f00d
Author: Alexandre Mazari <amazari igalia com>
Date:   Wed Aug 31 12:49:01 2011 +0200

    Fix #657833 - Import GLib namespace when searchPath is initialized. GLib might have extension present in the searchPath. Also makes extension loading exceptions bubble up to the javascript context.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=657833

 extensions/Seed.js.in   |   73 +++++++++++++++++++++++------------------------
 libseed/seed-importer.c |    2 +-
 2 files changed, 37 insertions(+), 38 deletions(-)
---
diff --git a/extensions/Seed.js.in b/extensions/Seed.js.in
index 9acb189..7f10e21 100644
--- a/extensions/Seed.js.in
+++ b/extensions/Seed.js.in
@@ -1,4 +1,39 @@
-GLib = imports.gi.GLib;
+if(!imports.searchPath || (imports.searchPath.length == 0))
+{
+	imports.searchPath = [ "%gnomejsdir%",
+	                       "%pkglibdir%",
+	                       "%pkgdatadir%",
+	                       "/usr/local/lib/seed",
+	                       "/usr/local/share/seed",
+	                       "/usr/lib/seed",
+	                       "/usr/share/seed" ];
+
+        GLib = imports.gi.GLib;
+	if(Seed.argv.length > 1)
+	{
+		__script_path__ = GLib.path_get_dirname(Seed.argv[1]);
+		
+		try
+		{
+			if(!GLib.path_is_absolute(__script_path__))
+			{
+				__script_path__ = GLib.build_filenamev([GLib.get_current_dir(),
+				                                      __script_path__]);
+			}
+		
+			__script_path__ = imports.os.realpath(__script_path__);
+		
+			if(__script_path__ && __script_path__ != "")
+				imports.searchPath.unshift(__script_path__);
+		}
+		catch(e)
+		{
+			print(imports.JSON.stringify(e));
+		}
+	}
+
+	imports.searchPath.unshift(".");
+}
 
 Seed.sprintf = function ()
 {
@@ -170,39 +205,3 @@ Seed.thread_repl = function()
 }
 
 Seed.printf = function () { print(Seed.sprintf.apply(this, arguments)) };
-
-if(!imports.searchPath || (imports.searchPath.length == 0))
-{
-	imports.searchPath = [ "%gnomejsdir%",
-	                       "%pkglibdir%",
-	                       "%pkgdatadir%",
-	                       "/usr/local/lib/seed",
-	                       "/usr/local/share/seed",
-	                       "/usr/lib/seed",
-	                       "/usr/share/seed" ];
-
-	if(Seed.argv.length > 1)
-	{
-		__script_path__ = GLib.path_get_dirname(Seed.argv[1]);
-		
-		try
-		{
-			if(!GLib.path_is_absolute(__script_path__))
-			{
-				__script_path__ = GLib.build_filenamev([GLib.get_current_dir(),
-				                                      __script_path__]);
-			}
-		
-			__script_path__ = imports.os.realpath(__script_path__);
-		
-			if(__script_path__ && __script_path__ != "")
-				imports.searchPath.unshift(__script_path__);
-		}
-		catch(e)
-		{
-			print(imports.JSON.stringify(e));
-		}
-	}
-
-	imports.searchPath.unshift(".");
-}
diff --git a/libseed/seed-importer.c b/libseed/seed-importer.c
index 0c0caf9..a69bf8e 100644
--- a/libseed/seed-importer.c
+++ b/libseed/seed-importer.c
@@ -466,7 +466,7 @@ seed_gi_importer_do_namespace (JSContextRef ctx,
 
   jsextension = g_strdup_printf ("imports.extensions.%s", namespace);
   extension_script = JSStringCreateWithUTF8CString (jsextension);
-  JSEvaluateScript (ctx, extension_script, NULL, NULL, 0, NULL);
+  JSEvaluateScript (ctx, extension_script, NULL, NULL, 0, exception);
   JSStringRelease (extension_script);
   g_free (jsextension);
 



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