Skip to content

Commit

Permalink
Minor fixes to link agianst SpiderMonkey trunk
Browse files Browse the repository at this point in the history
This patch allows couchjs to link against the SpiderMonkey as it existed
in the mercurial hash 59c1e6bdb11 from [1]. This does *not* ensure
compatibility with CouchDB as there are other things that will also need
to be fixed. Specifically, the anonymous function issue for builtin JS
functions.

[1] http://hg.mozilla.org/mozilla-central/
  • Loading branch information
davisp committed Oct 18, 2011
1 parent 9ffc1df commit 7c989ec
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
8 changes: 8 additions & 0 deletions configure.ac
Expand Up @@ -293,6 +293,14 @@ If you wish to ignore this error pass --enable-js-trunk to ./configure.])],
[[#include <jsapi.h>]])
fi

# Deal with JSScript -> JSObject -> JSScript switcheroo

AC_CHECK_TYPE([JSScript*],
[AC_DEFINE([JSSCRIPT_TYPE], [JSScript*], [Use JSObject* for scripts])],
[AC_DEFINE([JSSCRIPT_TYPE], [JSObject*], [Use JSScript* for scripts])],
[[#include <jsapi.h>]]
)

CPPFLAGS="$OLD_CPPFLAGS"


Expand Down
12 changes: 6 additions & 6 deletions src/couchdb/priv/couch_js/http.c
Expand Up @@ -181,7 +181,7 @@ http_open(JSContext* cx, JSObject* req, jsval mth, jsval url, jsval snc)
goto done;
}

if(mth == JSVAL_VOID) {
if(JSVAL_IS_VOID(mth)) {
JS_ReportError(cx, "You must specify a method.");
goto done;
}
Expand All @@ -203,7 +203,7 @@ http_open(JSContext* cx, JSObject* req, jsval mth, jsval url, jsval snc)

http->method = methid;

if(url == JSVAL_VOID) {
if(JSVAL_IS_VOID(url)) {
JS_ReportError(cx, "You must specify a URL.");
goto done;
}
Expand All @@ -219,7 +219,7 @@ http_open(JSContext* cx, JSObject* req, jsval mth, jsval url, jsval snc)
goto done;
}

if(snc != JSVAL_FALSE) {
if(JSVAL_IS_BOOLEAN(snc) && !JSVAL_TO_BOOLEAN(snc)) {
JS_ReportError(cx, "Synchronous flag must be false.");
goto done;
}
Expand Down Expand Up @@ -255,7 +255,7 @@ http_set_hdr(JSContext* cx, JSObject* req, jsval name, jsval val)
goto done;
}

if(name == JSVAL_VOID)
if(JSVAL_IS_VOID(name))
{
JS_ReportError(cx, "You must speciy a header name.");
goto done;
Expand All @@ -268,7 +268,7 @@ http_set_hdr(JSContext* cx, JSObject* req, jsval name, jsval val)
goto done;
}

if(val == JSVAL_VOID)
if(JSVAL_IS_VOID(val))
{
JS_ReportError(cx, "You must specify a header value.");
goto done;
Expand Down Expand Up @@ -313,7 +313,7 @@ http_send(JSContext* cx, JSObject* req, jsval body)
goto done;
}

if(body != JSVAL_VOID && body != JS_GetEmptyStringValue(cx)) {
if(!JSVAL_IS_VOID(body)) {
bodystr = enc_string(cx, body, &bodylen);
if(!bodystr) {
JS_ReportError(cx, "Failed to encode body.");
Expand Down
2 changes: 1 addition & 1 deletion src/couchdb/priv/couch_js/sm185.c
Expand Up @@ -310,7 +310,7 @@ main(int argc, const char* argv[])
JSObject* global = NULL;
JSCrossCompartmentCall *call = NULL;
JSObject* klass = NULL;
JSObject* script;
JSSCRIPT_TYPE script;
JSString* scriptsrc;
const jschar* schars;
size_t slen;
Expand Down

0 comments on commit 7c989ec

Please sign in to comment.