From ae42c586f8c978fadf49e2e3530f4a3a5997cd70 Mon Sep 17 00:00:00 2001 From: Miciah Dashiel Butler Masters Date: Thu, 29 Dec 2005 14:19:09 +0000 Subject: [PATCH] Add elinks.home property. --- src/scripting/smjs/elinks_object.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/scripting/smjs/elinks_object.c b/src/scripting/smjs/elinks_object.c index 00719584a..b8f0a95ae 100644 --- a/src/scripting/smjs/elinks_object.c +++ b/src/scripting/smjs/elinks_object.c @@ -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; }