From: Armaan Bhojwani Date: Sat, 5 Jun 2021 22:29:24 +0000 (-0400) Subject: Log running user script to console X-Git-Tag: v1.0.0~54 X-Git-Url: https://git.armaanb.net/?p=chorizo.git;a=commitdiff_plain;h=c252d89e3de7f28f9393ca9febae581a2fafd883 Log running user script to console --- diff --git a/browser.c b/browser.c index 66fc699..2b52642 100644 --- a/browser.c +++ b/browser.c @@ -1202,10 +1202,14 @@ run_user_scripts(WebKitWebView *web_view) if (scriptdir != NULL) { while ((entry = g_dir_read_name(scriptdir)) != NULL) { path = g_build_filename(base, entry, NULL); + char *jscmd = malloc(strlen(path) + 36); + sprintf(jscmd, "console.log(\"Running userscript %s\");", path); if (g_str_has_suffix(path, ".js")) { if (g_file_get_contents(path, &contents, NULL, NULL)) { + webkit_web_view_run_javascript(web_view, jscmd, NULL, NULL, NULL); webkit_web_view_run_javascript(web_view, contents, NULL, NULL, NULL); g_free(contents); + g_free(jscmd); } } g_free(path);