Hello,

this patch tries to avoid repeated initialization of JS context, altough there is already one setup.

Maybe an assert(JS_GetGlobalObject(cx) == NULL) would be better here, because js_newcompartment is not intended to be called twice on the same context?

(fixes an failed assert in spidermonkey when reloading the page)


Greets,
Ole
Index: javascript/jsapi.c
===================================================================
--- javascript/jsapi.c	(Revision 14014)
+++ javascript/jsapi.c	(Arbeitskopie)
@@ -101,6 +101,11 @@
 	if (cx == NULL)
 		goto js_newcompartment_fail;
 
+	window_obj = JS_GetGlobalObject(cx);
+	if(window_obj != NULL){
+		return(window_obj);
+	}
+
 	/* create the window object as the global */
 	window_obj = jsapi_new_window(cx, NULL, win_priv);
 	if (window_obj == NULL) 

Reply via email to