From b100a0b85eb0bd0be73634c37c862b0ec8bce1e6 Mon Sep 17 00:00:00 2001
From: Rob Swindell <rob@synchro.net>
Date: Sat, 6 Mar 2021 02:05:03 -0800
Subject: [PATCH] Add a js.options property to report the option flags used for
 the JS ctx

---
 src/sbbs3/js_internal.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/sbbs3/js_internal.c b/src/sbbs3/js_internal.c
index fff90a36a4..e13b8a5a9f 100644
--- a/src/sbbs3/js_internal.c
+++ b/src/sbbs3/js_internal.c
@@ -41,6 +41,7 @@ enum {
 	,PROP_MAXBYTES
 #endif
 	,PROP_GLOBAL
+	,PROP_OPTIONS
 };
 
 static JSBool js_get(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
@@ -107,6 +108,9 @@ static JSBool js_get(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
 		case PROP_GLOBAL:
 			*vp = OBJECT_TO_JSVAL(JS_GetGlobalObject(cx));	
 			break;
+		case PROP_OPTIONS:
+			*vp = UINT_TO_JSVAL(JS_GetOptions(cx));
+			break;
 	}
 
 	return(JS_TRUE);
@@ -181,6 +185,7 @@ static jsSyncPropertySpec js_properties[] = {
 	{	"max_bytes",		PROP_MAXBYTES,		JSPROP_ENUMERATE,	311 },
 #endif
 	{	"global",			PROP_GLOBAL,		PROP_FLAGS,			314 },
+	{	"options",			PROP_OPTIONS,		PROP_FLAGS,			31802 },
 	{0}
 };
 
@@ -201,6 +206,7 @@ static char* prop_desc[] = {
 	,"maximum number of bytes available for heap"
 #endif
 	,"global (top level) object - <small>READ ONLY</small>"
+	,"option flags - <small>READ ONLY</small>"
 	/* New properties go here... */
 	,"full path and filename of JS file executed"
 	,"directory of executed JS file"
-- 
GitLab