mirror of
https://github.com/rkd77/elinks.git
synced 2025-09-21 19:46:23 -04:00
Factor smjs_get_global_object out of init_smjs.
This commit is contained in:
committed by
Miciah Dashiel Butler Masters
parent
2a0653a9f2
commit
3174c533b0
@@ -12,6 +12,7 @@
|
||||
#include "scripting/scripting.h"
|
||||
#include "scripting/smjs/core.h"
|
||||
#include "scripting/smjs/elinks_object.h"
|
||||
#include "scripting/smjs/global_object.h"
|
||||
#include "scripting/smjs/smjs.h"
|
||||
#include "util/string.h"
|
||||
|
||||
@@ -97,12 +98,6 @@ smjs_load_hooks(void)
|
||||
void
|
||||
init_smjs(struct module *module)
|
||||
{
|
||||
static 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);
|
||||
@@ -117,11 +112,7 @@ init_smjs(struct module *module)
|
||||
|
||||
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);
|
||||
global_object = smjs_get_global_object();
|
||||
|
||||
smjs_elinks_object = smjs_get_elinks_object(global_object);
|
||||
|
||||
|
Reference in New Issue
Block a user