/* Base ECMAScript file. Mostly a proxy for specific library backends. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "elinks.h" #include "config/home.h" #include "config/options.h" #include "dialogs/status.h" #include "document/document.h" #include "document/renderer.h" #include "document/view.h" #include "document/xml/renderer.h" #include "document/xml/renderer2.h" #include "ecmascript/ecmascript.h" #ifdef CONFIG_MUJS #include "ecmascript/mujs.h" #else #ifdef CONFIG_QUICKJS #include "ecmascript/quickjs.h" #else #include "ecmascript/spidermonkey.h" #endif #endif #include "ecmascript/timer.h" #include "intl/libintl.h" #include "main/module.h" #include "main/select.h" #include "main/timer.h" #include "osdep/osdep.h" #include "protocol/protocol.h" #include "protocol/uri.h" #include "session/session.h" #include "session/task.h" #include "terminal/terminal.h" #include "terminal/window.h" #include "util/conv.h" #include "util/string.h" #include "viewer/text/draw.h" #include "viewer/text/view.h" /* current_frame() */ #include "viewer/text/form.h" /* <-ecmascript_reset_state() */ #include "viewer/text/vs.h" #include #include #include #include #include std::map map_timer; /* TODO: We should have some kind of ACL for the scripts - i.e. ability to * disallow the scripts to open new windows (or so that the windows are always * directed to tabs, this particular option would be a tristate), disallow * messing with your menubar/statusbar visibility, disallow changing the * statusbar content etc. --pasky */ static union option_info ecmascript_options[] = { INIT_OPT_TREE("", N_("ECMAScript"), "ecmascript", OPT_ZERO, N_("ECMAScript options.")), INIT_OPT_BOOL("ecmascript", N_("Enable"), "enable", OPT_ZERO, 0, N_("Whether to run those scripts inside of documents.")), INIT_OPT_BOOL("ecmascript", N_("Console log"), "enable_console_log", OPT_ZERO, 0, N_("When enabled logs will be appended to ~/.config/elinks/console.log.")), INIT_OPT_BOOL("ecmascript", N_("Script error reporting"), "error_reporting", OPT_ZERO, 0, N_("Open a message box when a script reports an error.")), INIT_OPT_BOOL("ecmascript", N_("Ignore