]> spindle.queued.net Git - midori/commitdiff
Use an anonymous function to execute user scripts
authorArnaud Renevier <arenevier@fdn.fr>
Sat, 19 Jul 2008 15:52:03 +0000 (17:52 +0200)
committerChristian Dywan <christian@twotoasts.de>
Sat, 19 Jul 2008 15:52:03 +0000 (17:52 +0200)
midori/midori-addons.c

index 1a21dd27271cb399c036841f9de450edb6bf5481..2f8ddb48e61e25c81d9fab629e5cdf7f1e2303c0 100644 (file)
@@ -176,7 +176,7 @@ _js_script_from_file (JSContextRef js_context,
     {
         /* Wrap the script to prevent global variables */
         gchar* wrapped_script = g_strdup_printf (
-            "var wrapped = function () { %s }; wrapped ();", script);
+            "(function () { %s })();", script);
         if (gjs_script_eval (js_context, wrapped_script, exception))
             result = TRUE;
         g_free (wrapped_script);