1
0
mirror of https://github.com/rkd77/elinks.git synced 2025-02-02 15:09:23 -05:00

Create a global object.

This commit is contained in:
Miciah Dashiel Butler Masters 2005-12-18 17:40:13 +00:00 committed by Miciah Dashiel Butler Masters
parent 60d40b7f50
commit acb2bb80be

View File

@ -67,6 +67,14 @@ static JSRuntime *smjs_rt;
void
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);
if (!smjs_rt) return;
@ -74,6 +82,12 @@ init_smjs(struct module *module)
if (!smjs_ctx) return;
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