mirror of
https://github.com/rkd77/elinks.git
synced 2025-01-03 14:57:44 -05:00
Add elinks.home property.
This commit is contained in:
parent
a4be153703
commit
ae42c586f8
@ -6,6 +6,7 @@
|
||||
|
||||
#include "elinks.h"
|
||||
|
||||
#include "config/home.h"
|
||||
#include "ecmascript/spidermonkey/util.h"
|
||||
#include "protocol/uri.h"
|
||||
#include "scripting/scripting.h"
|
||||
@ -19,6 +20,14 @@
|
||||
#include "session/task.h"
|
||||
|
||||
|
||||
static JSBool
|
||||
elinks_get_home(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
{
|
||||
*vp = STRING_TO_JSVAL(JS_NewStringCopyZ(smjs_ctx, elinks_home));
|
||||
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
static JSBool
|
||||
elinks_get_location(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
{
|
||||
@ -102,6 +111,12 @@ smjs_get_elinks_object(void)
|
||||
elinks_get_location, elinks_set_location,
|
||||
JSPROP_ENUMERATE | JSPROP_PERMANENT);
|
||||
|
||||
JS_DefineProperty(smjs_ctx, jsobj, "home", JSVAL_NULL,
|
||||
elinks_get_home, JS_PropertyStub,
|
||||
JSPROP_ENUMERATE
|
||||
| JSPROP_PERMANENT
|
||||
| JSPROP_READONLY);
|
||||
|
||||
return jsobj;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user