Use an anonymous function to execute user scripts
This commit is contained in:
parent
fffb6253e1
commit
83285cb052
1 changed files with 1 additions and 1 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue