summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Joseph Davis <davisp@apache.org>2009-08-04 15:32:35 +0000
committerPaul Joseph Davis <davisp@apache.org>2009-08-04 15:32:35 +0000
commitb060d7edaf20132ff64479503b15960189c222c2 (patch)
tree52f901a1b8559f6e84606df14a24fbe713bec9bc /src
parentaa4a652e1aa2523437bf180d88f89cfca69a682b (diff)
Fix couch_js.c compilation with builds of non-threadsafe Spidermonkey 1.7
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@800843 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r--src/couchdb/couch_js.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/couchdb/couch_js.c b/src/couchdb/couch_js.c
index f05fc4b4..02e0fe4c 100644
--- a/src/couchdb/couch_js.c
+++ b/src/couchdb/couch_js.c
@@ -213,8 +213,12 @@ EvalInContext(JSContext *context, JSObject *obj, uintN argc, jsval *argv,
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 @@ EvalInContext(JSContext *context, JSObject *obj, uintN argc, jsval *argv,
}
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 @@ main(int argc, const char * argv[]) {
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 @@ main(int argc, const char * argv[]) {
}
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();