couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@apache.org
Subject svn commit: r800843 - /couchdb/trunk/src/couchdb/couch_js.c
Date Tue, 04 Aug 2009 15:32:37 GMT
Author: davisp
Date: Tue Aug  4 15:32:35 2009
New Revision: 800843

URL: http://svn.apache.org/viewvc?rev=800843&view=rev
Log:
Fix couch_js.c compilation with builds of non-threadsafe Spidermonkey 1.7


Modified:
    couchdb/trunk/src/couchdb/couch_js.c

Modified: couchdb/trunk/src/couchdb/couch_js.c
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_js.c?rev=800843&r1=800842&r2=800843&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_js.c (original)
+++ couchdb/trunk/src/couchdb/couch_js.c Tue Aug  4 15:32:35 2009
@@ -213,8 +213,12 @@
         JS_ReportOutOfMemory(context);
         return JS_FALSE;
     }
+
+#if JS_VERSION > 170
     JS_SetContextThread(sub_context);
     JS_BeginRequest(sub_context);
+#endif
+
     src = JS_GetStringChars(str);
     srclen = JS_GetStringLength(str);
 
@@ -236,9 +240,12 @@
     }
 
 out:
+#if JS_VERSION > 170
     JS_EndRequest(sub_context);
-    JS_DestroyContext(sub_context);
     JS_ClearContextThread(sub_context);
+#endif
+
+    JS_DestroyContext(sub_context);
     return ok;
 }
 
@@ -1225,14 +1232,14 @@
     context = JS_NewContext(runtime, gStackChunkSize);
     if (!context)
         return 1;
-    JS_SetContextThread(context);
-    JS_BeginRequest(context);
     /* FIXME: https://bugzilla.mozilla.org/show_bug.cgi?id=477187 */
     JS_SetErrorReporter(context, PrintError);
 #if JS_VERSION <= 170
     JS_SetBranchCallback(context, BranchCallback);
     JS_ToggleOptions(context, JSOPTION_NATIVE_BRANCH_CALLBACK);
 #else
+    JS_SetContextThread(context);
+    JS_BeginRequest(context);
     JS_SetOperationCallback(context, OperationCallback);
 #endif
     JS_ToggleOptions(context, JSOPTION_XML);
@@ -1264,9 +1271,13 @@
     }
 
     ExecuteScript(context, global, argv[1]);
+
+#if JS_VERSION > 170
     JS_EndRequest(context);
-    JS_DestroyContext(context);
     JS_ClearContextThread(context);
+#endif
+
+    JS_DestroyContext(context);
     JS_DestroyRuntime(runtime);
     JS_ShutDown();
 



Mime
View raw message