mirror of
https://github.com/rkd77/elinks.git
synced 2025-09-21 19:46:23 -04:00
Create a global object.
This commit is contained in:
committed by
Miciah Dashiel Butler Masters
parent
60d40b7f50
commit
acb2bb80be
@@ -67,6 +67,14 @@ static JSRuntime *smjs_rt;
|
|||||||
void
|
void
|
||||||
init_smjs(struct module *module)
|
init_smjs(struct module *module)
|
||||||
{
|
{
|
||||||
|
const JSClass global_class = {
|
||||||
|
"global", 0,
|
||||||
|
JS_PropertyStub, JS_PropertyStub,
|
||||||
|
JS_PropertyStub, JS_PropertyStub,
|
||||||
|
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, JS_FinalizeStub
|
||||||
|
};
|
||||||
|
JSObject *global_object;
|
||||||
|
|
||||||
smjs_rt = JS_NewRuntime(1L * 1024L * 1024L);
|
smjs_rt = JS_NewRuntime(1L * 1024L * 1024L);
|
||||||
if (!smjs_rt) return;
|
if (!smjs_rt) return;
|
||||||
|
|
||||||
@@ -74,6 +82,12 @@ init_smjs(struct module *module)
|
|||||||
if (!smjs_ctx) return;
|
if (!smjs_ctx) return;
|
||||||
|
|
||||||
JS_SetErrorReporter(smjs_ctx, error_reporter);
|
JS_SetErrorReporter(smjs_ctx, error_reporter);
|
||||||
|
|
||||||
|
global_object = JS_NewObject(smjs_ctx, (JSClass *) &global_class,
|
||||||
|
NULL, NULL);
|
||||||
|
if (!global_object) return;
|
||||||
|
|
||||||
|
JS_InitStandardClasses(smjs_ctx, global_object);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Reference in New Issue
Block a user