summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/scripts.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/scripts.c b/src/scripts.c
index 7e77c327..50f92b0f 100644
--- a/src/scripts.c
+++ b/src/scripts.c
@@ -284,6 +284,7 @@ inject(JSContextRef ctx, JSContextRef wctx, JSObjectRef function, JSObjectRef th
if (func != NULL && JSObjectIsFunction(ctx, func))
{
JSValueRef wret = JSObjectCallAsFunction(wctx, func, NULL, count, count == 1 ? args : NULL, NULL) ;
+ // This could be replaced with js_context_change
char *retx = js_value_to_json(wctx, wret, -1, NULL);
if (retx)
{
@@ -1666,7 +1667,9 @@ system_spawn(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, siz
}
if (!g_shell_parse_argv(cmdline, &srgc, &srgv, NULL) ||
- !g_spawn_async_with_pipes(NULL, srgv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL, oc != NULL ? &outfd : NULL, ec != NULL ? &errfd : NULL, NULL))
+ !g_spawn_async_with_pipes(NULL, srgv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL,
+ oc != NULL ? &outfd : NULL,
+ ec != NULL ? &errfd : NULL, NULL))
{
js_make_exception(ctx, exc, EXCEPTION("spawning %s failed."), cmdline);
ret |= SPAWN_FAILED;
@@ -1823,10 +1826,8 @@ static JSValueRef
io_dir_names(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exc)
{
if (argc < 1)
- {
- js_make_exception(ctx, exc, EXCEPTION("io.dirNames: missing argument."));
return NIL;
- }
+
JSValueRef ret;
GDir *dir;
char *dir_name = js_value_to_char(ctx, argv[0], PATH_MAX, exc);
@@ -1838,7 +1839,8 @@ io_dir_names(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, siz
if ((dir = g_dir_open(dir_name, 0, NULL)) != NULL)
{
GSList *list = NULL;
- while ((name = g_dir_read_name(dir)) != NULL) {
+ while ((name = g_dir_read_name(dir)) != NULL)
+ {
list = g_slist_prepend(list, (gpointer)js_char_to_value(ctx, name));
}
g_dir_close(dir);
@@ -1906,10 +1908,7 @@ static JSValueRef
io_print(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exc)
{
if (argc == 0)
- {
- js_make_exception(ctx, exc, EXCEPTION("io.print needs an argument."));
return UNDEFINED;
- }
FILE *stream = stdout;
if (argc >= 2)
@@ -1970,10 +1969,7 @@ static JSObjectRef
download_constructor_cb(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef* exception)
{
if (argc<1)
- {
- js_make_exception(ctx, exception, EXCEPTION("Download constructor: missing argument"));
return JSValueToObject(ctx, NIL, NULL);
- }
char *uri = js_value_to_char(ctx, argv[0], -1, exception);
if (uri == NULL)