1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

[spidermonkey] Added the ecmascript.spidermonkey.memory_limit option

128M by default.
This commit is contained in:
Witold Filipczyk 2024-10-09 15:33:50 +02:00
parent 24d3c00a1c
commit 1497f8a0b8
2 changed files with 16 additions and 2 deletions

View File

@ -7,9 +7,11 @@
#include "elinks.h"
#include "config/options.h"
#include "js/spidermonkey-shared.h"
#include <js/Initialization.h>
/** A JSContext that can be used in JS_SetPrivate and JS_GetPrivate
- * when no better one is available. This context has no global
- * object, so scripts cannot be evaluated in it.
@ -35,7 +37,7 @@ spidermonkey_runtime_addref(void)
return 0;
}
main_ctx = JS_NewContext(128 * 1024 * 1024);
main_ctx = JS_NewContext(get_opt_long("ecmascript.spidermonkey.memory_limit", NULL));
if (!main_ctx) {
JS_ShutDown();

View File

@ -703,9 +703,21 @@ spidermonkey_eval_boolback(struct ecmascript_interpreter *interpreter,
return result;
}
static union option_info spidermonkey_options[] = {
INIT_OPT_TREE("ecmascript", N_("Spidermonkey"),
"spidermonkey", OPT_ZERO,
N_("Options specific to Spidermonkey.")),
INIT_OPT_LONG("ecmascript.spidermonkey", N_("Memory limit"),
"memory_limit", OPT_ZERO, 0, LONG_MAX, 128 * 1024 * 1024,
N_("Runtime memory limit in bytes.")),
NULL_OPTION_INFO,
};
struct module spidermonkey_module = struct_module(
/* name: */ N_("SpiderMonkey"),
/* options: */ NULL,
/* options: */ spidermonkey_options,
/* events: */ NULL,
/* submodules: */ NULL,
/* data: */ NULL,