1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-10-01 03:36:26 -04:00

Make global_object a global with the new name smjs_global_object and

create smjs_init_global_object to initialise the global.
This commit is contained in:
Miciah Dashiel Butler Masters 2005-12-24 03:40:59 +00:00 committed by Miciah Dashiel Butler Masters
parent 3174c533b0
commit d6ecf895ce
3 changed files with 15 additions and 6 deletions

View File

@ -98,8 +98,6 @@ smjs_load_hooks(void)
void
init_smjs(struct module *module)
{
JSObject *global_object;
smjs_rt = JS_NewRuntime(1L * 1024L * 1024L);
if (!smjs_rt) return;
@ -112,9 +110,9 @@ init_smjs(struct module *module)
JS_SetErrorReporter(smjs_ctx, error_reporter);
global_object = smjs_get_global_object();
smjs_init_global_object();
smjs_elinks_object = smjs_get_elinks_object(global_object);
smjs_elinks_object = smjs_get_elinks_object(smjs_global_object);
smjs_load_hooks();
}

View File

@ -22,7 +22,7 @@ static const JSClass global_class = {
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, JS_FinalizeStub
};
JSObject *
static JSObject *
smjs_get_global_object(void)
{
JSObject *jsobj;
@ -37,3 +37,9 @@ smjs_get_global_object(void)
return jsobj;
}
void
smjs_init_global_object(void)
{
smjs_global_object = smjs_get_global_object();
}

View File

@ -3,6 +3,11 @@
#include "ecmascript/spidermonkey/util.h"
JSObject *smjs_get_global_object(void);
/* The root of the object hierarchy. If object 'foo' has this as its parent,
* you can use foo's method and properties with 'foo.<method|property>'. */
extern JSObject *smjs_global_object;
/* Create the global object and assign it to smjs_global_object. */
void smjs_init_global_object(void);
#endif