[Freeswitch-svn] [commit] r5373 - in freeswitch/trunk/src/mod/languages: mod_spidermonkey mod_spidermonkey_core_db mod_spidermonkey_etpan mod_spidermonkey_odbc mod_spidermonkey_skel mod_spidermonkey_teletone

Freeswitch SVN anthm at freeswitch.org
Fri Jun 15 13:05:21 EDT 2007


Author: anthm
Date: Fri Jun 15 13:05:20 2007
New Revision: 5373

Modified:
   freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
   freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.h
   freeswitch/trunk/src/mod/languages/mod_spidermonkey_core_db/mod_spidermonkey_core_db.c
   freeswitch/trunk/src/mod/languages/mod_spidermonkey_etpan/mod_spidermonkey_etpan.c
   freeswitch/trunk/src/mod/languages/mod_spidermonkey_odbc/mod_spidermonkey_odbc.c
   freeswitch/trunk/src/mod/languages/mod_spidermonkey_skel/mod_spidermonkey_skel.c
   freeswitch/trunk/src/mod/languages/mod_spidermonkey_teletone/mod_spidermonkey_teletone.c

Log:
Avoiding Initial SegFault *now with lycopene!*

Modified: freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c	(original)
+++ freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c	Fri Jun 15 13:05:20 2007
@@ -45,10 +45,6 @@
 SWITCH_MODULE_DEFINITION(mod_spidermonkey, mod_spidermonkey_load, mod_spidermonkey_shutdown, NULL);
 
 #define METHOD_SANITY_CHECK() do {												\
-if (jss->sanity_code != SANITY_CODE_VAL) {								\
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Object! Avoiding Initial SegFault!\n"); \
-	return JS_TRUE;													\
- }																		\
 if (!jss || !jss->session) {											\
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "You must call the session.originate method before calling this method!\n"); \
 	*rval = BOOLEAN_TO_JSVAL(JS_FALSE);									\
@@ -84,7 +80,7 @@
 
 static JSClass global_class = {
 	"Global", JSCLASS_HAS_PRIVATE,
-	JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub,
+	JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, DEFAULT_SET_PROPERTY,
 	JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, JS_FinalizeStub
 };
 
@@ -299,7 +295,7 @@
 
 JSClass request_class = {
 	"Request", JSCLASS_HAS_PRIVATE,
-	JS_PropertyStub, JS_PropertyStub, request_getProperty, JS_PropertyStub,
+	JS_PropertyStub, JS_PropertyStub, request_getProperty, DEFAULT_SET_PROPERTY,
 	JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, request_destroy, NULL, NULL, NULL, NULL
 };
 
@@ -604,7 +600,7 @@
 
 JSClass event_class = {
 	"Event", JSCLASS_HAS_PRIVATE,
-	JS_PropertyStub, JS_PropertyStub, event_getProperty, JS_PropertyStub,
+	JS_PropertyStub, JS_PropertyStub, event_getProperty, DEFAULT_SET_PROPERTY,
 	JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, event_destroy, NULL, NULL, NULL,
 	event_construct
 };
@@ -2040,6 +2036,7 @@
 	{0}
 };
 
+
 static JSBool session_getProperty(JSContext * cx, JSObject * obj, jsval id, jsval * vp)
 {
 	struct js_session *jss = JS_GetPrivate(cx, obj);
@@ -2133,7 +2130,7 @@
 
 JSClass session_class = {
 	"Session", JSCLASS_HAS_PRIVATE,
-	JS_PropertyStub, JS_PropertyStub, session_getProperty, JS_PropertyStub,
+	JS_PropertyStub, JS_PropertyStub, session_getProperty, DEFAULT_SET_PROPERTY,
 	JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, session_destroy, NULL, NULL, NULL,
 	session_construct
 };
@@ -2149,7 +2146,6 @@
 		jss->cx = cx;
 		jss->obj = session_obj;
 		jss->stack_depth = 0;
-		jss->sanity_code = SANITY_CODE_VAL;
 		if ((JS_SetPrivate(cx, session_obj, jss) &&
 			 JS_DefineProperties(cx, session_obj, session_props) && JS_DefineFunctions(cx, session_obj, session_methods))) {
 			return session_obj;
@@ -2170,7 +2166,6 @@
 	memset(jss, 0, sizeof(*jss));
 	jss->cx = cx;
 	jss->obj = obj;
-	jss->sanity_code = SANITY_CODE_VAL;
 	switch_set_flag(jss, S_FREE);
 
 	JS_SetPrivate(cx, obj, jss);
@@ -2513,7 +2508,7 @@
 
 JSClass fileio_class = {
 	"FileIO", JSCLASS_HAS_PRIVATE,
-	JS_PropertyStub, JS_PropertyStub, fileio_getProperty, JS_PropertyStub,
+	JS_PropertyStub, JS_PropertyStub, fileio_getProperty, DEFAULT_SET_PROPERTY,
 	JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, fileio_destroy, NULL, NULL, NULL,
 	fileio_construct
 };

Modified: freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.h
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.h	(original)
+++ freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.h	Fri Jun 15 13:05:20 2007
@@ -122,7 +122,6 @@
 typedef struct sm_module_interface sm_module_interface_t;
 typedef switch_status_t (*spidermonkey_init_t) (const sm_module_interface_t ** module_interface);
 
-#define SANITY_CODE_VAL 424242
 struct js_session {
 	switch_core_session_t *session;
 	JSContext *cx;
@@ -132,9 +131,13 @@
 	JSFunction *on_hangup;
 	int stack_depth;
 	switch_channel_state_t hook_state;
-	int sanity_code;
 };
 
+JSBool DEFAULT_SET_PROPERTY(JSContext * cx, JSObject *obj, jsval id, jsval *vp)
+{
+	return JS_FALSE;
+}
+
 
 
 SWITCH_END_EXTERN_C

Modified: freeswitch/trunk/src/mod/languages/mod_spidermonkey_core_db/mod_spidermonkey_core_db.c
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_spidermonkey_core_db/mod_spidermonkey_core_db.c	(original)
+++ freeswitch/trunk/src/mod/languages/mod_spidermonkey_core_db/mod_spidermonkey_core_db.c	Fri Jun 15 13:05:20 2007
@@ -268,7 +268,7 @@
 
 JSClass db_class = {
 	modname, JSCLASS_HAS_PRIVATE,
-	JS_PropertyStub, JS_PropertyStub, db_getProperty, JS_PropertyStub,
+	JS_PropertyStub, JS_PropertyStub, db_getProperty, DEFAULT_SET_PROPERTY,
 	JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, db_destroy, NULL, NULL, NULL,
 	db_construct
 };

Modified: freeswitch/trunk/src/mod/languages/mod_spidermonkey_etpan/mod_spidermonkey_etpan.c
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_spidermonkey_etpan/mod_spidermonkey_etpan.c	(original)
+++ freeswitch/trunk/src/mod/languages/mod_spidermonkey_etpan/mod_spidermonkey_etpan.c	Fri Jun 15 13:05:20 2007
@@ -216,7 +216,7 @@
 
 JSClass etpan_class = {
 	modname, JSCLASS_HAS_PRIVATE,
-	JS_PropertyStub, JS_PropertyStub, etpan_getProperty, JS_PropertyStub,
+	JS_PropertyStub, JS_PropertyStub, etpan_getProperty, DEFAULT_SET_PROPERTY,
 	JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, etpan_destroy, NULL, NULL, NULL,
 	etpan_construct
 };

Modified: freeswitch/trunk/src/mod/languages/mod_spidermonkey_odbc/mod_spidermonkey_odbc.c
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_spidermonkey_odbc/mod_spidermonkey_odbc.c	(original)
+++ freeswitch/trunk/src/mod/languages/mod_spidermonkey_odbc/mod_spidermonkey_odbc.c	Fri Jun 15 13:05:20 2007
@@ -438,7 +438,7 @@
 
 JSClass odbc_class = {
 	modname, JSCLASS_HAS_PRIVATE,
-	JS_PropertyStub, JS_PropertyStub, odbc_getProperty, JS_PropertyStub,
+	JS_PropertyStub, JS_PropertyStub, odbc_getProperty, DEFAULT_SET_PROPERTY,
 	JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, odbc_destroy, NULL, NULL, NULL,
 	odbc_construct
 };

Modified: freeswitch/trunk/src/mod/languages/mod_spidermonkey_skel/mod_spidermonkey_skel.c
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_spidermonkey_skel/mod_spidermonkey_skel.c	(original)
+++ freeswitch/trunk/src/mod/languages/mod_spidermonkey_skel/mod_spidermonkey_skel.c	Fri Jun 15 13:05:20 2007
@@ -74,7 +74,7 @@
 
 JSClass skel_class = {
 	modname, JSCLASS_HAS_PRIVATE,
-	JS_PropertyStub, JS_PropertyStub, skel_getProperty, JS_PropertyStub,
+	JS_PropertyStub, JS_PropertyStub, skel_getProperty, DEFAULT_SET_PROPERTY,
 	JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, skel_destroy, NULL, NULL, NULL,
 	skel_construct
 };

Modified: freeswitch/trunk/src/mod/languages/mod_spidermonkey_teletone/mod_spidermonkey_teletone.c
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_spidermonkey_teletone/mod_spidermonkey_teletone.c	(original)
+++ freeswitch/trunk/src/mod/languages/mod_spidermonkey_teletone/mod_spidermonkey_teletone.c	Fri Jun 15 13:05:20 2007
@@ -331,7 +331,7 @@
 
 JSClass teletone_class = {
 	modname, JSCLASS_HAS_PRIVATE,
-	JS_PropertyStub, JS_PropertyStub, teletone_getProperty, JS_PropertyStub,
+	JS_PropertyStub, JS_PropertyStub, teletone_getProperty, DEFAULT_SET_PROPERTY,
 	JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, teletone_destroy, NULL, NULL, NULL,
 	teletone_construct
 };



More information about the Freeswitch-svn mailing list