aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomasz Bursztyka <tomasz.bursztyka@linux.intel.com>2012-08-15 16:00:22 +0300
committerPatrik Flykt <patrik.flykt@linux.intel.com>2012-08-30 09:59:29 +0300
commitd57728f7cf9c1f36c0c3a18fdd31e171fba7699d (patch)
treea952911cfc1488c8b7ece36cf25be6e130944d2c
parent5c6e048be5538f6cb5d639d816a79f1c18b920e9 (diff)
downloadpacrunner-d57728f7cf9c1f36c0c3a18fdd31e171fba7699d.tar.gz
mozjs: Move to spidermonkey js engine due to xulrunner deprecation
-rw-r--r--configure.ac9
-rw-r--r--plugins/mozjs.c58
2 files changed, 2 insertions, 65 deletions
diff --git a/configure.ac b/configure.ac
index 5d1b696..2cc217b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -72,13 +72,8 @@ AC_ARG_ENABLE(pie, AC_HELP_STRING([--enable-pie],
AC_ARG_ENABLE(mozjs, AC_HELP_STRING([--enable-mozjs],
[enable Mozilla Javascript plugin support]))
if (test "${enable_mozjs}" = "yes"); then
- PKG_CHECK_MODULES(MOZJS, mozilla-js >= 1.9, dummy=yes,
- AC_MSG_ERROR(Mozilla Javascript >= 1.9 is required))
-
- mozjs_version=`pkg-config --modversion mozilla-js | cut -d '.' -f 1`
- if test ${mozjs_version} -gt 1; then
- MOZJS_CFLAGS="${MOZJS_CFLAGS} -DMOZJS_VERSION_2_OR_SUPERIOR=1"
- fi
+ PKG_CHECK_MODULES(MOZJS, mozjs185, dummy=yes,
+ AC_MSG_ERROR(Mozilla Javascript >= 1.8 is required))
AC_SUBST(MOZJS_CFLAGS)
AC_SUBST(MOZJS_LIBS)
diff --git a/plugins/mozjs.c b/plugins/mozjs.c
index 651d4af..f96bc94 100644
--- a/plugins/mozjs.c
+++ b/plugins/mozjs.c
@@ -90,8 +90,6 @@ static int resolve(const char *node, char *host, size_t hostlen)
return 0;
}
-#ifdef MOZJS_VERSION_2_OR_SUPERIOR
-
static JSBool myipaddress(JSContext *ctx, uintN argc, jsval *vp)
{
const char *interface;
@@ -141,66 +139,10 @@ static JSBool dnsresolve(JSContext *ctx, uintN argc, jsval *vp)
}
-#else
-
-static JSBool myipaddress(JSContext *ctx, JSObject *obj, uintN argc,
- jsval *argv, jsval *rval)
-{
- const char *interface;
- char address[NI_MAXHOST];
-
- DBG("");
-
- *rval = JSVAL_NULL;
-
- if (current_proxy == NULL)
- return JS_TRUE;
-
- interface = pacrunner_proxy_get_interface(current_proxy);
- if (interface == NULL)
- return JS_TRUE;
-
- if (getaddr(interface, address, sizeof(address)) < 0)
- return JS_TRUE;
-
- DBG("address %s", address);
-
- *rval = STRING_TO_JSVAL(JS_NewStringCopyZ(ctx, address));
-
- return JS_TRUE;
-}
-
-static JSBool dnsresolve(JSContext *ctx, JSObject *obj, uintN argc,
- jsval *argv, jsval *rval)
-{
- char address[NI_MAXHOST];
- char *host = JS_EncodeString(ctx, JS_ValueToString(ctx, argv[0]));
-
- DBG("host %s", host);
-
- *rval = JSVAL_NULL;
-
- if (resolve(host, address, sizeof(address)) < 0)
- goto out;
-
- DBG("address %s", address);
-
- *rval = STRING_TO_JSVAL(JS_NewStringCopyZ(ctx, address));
-
- out:
- JS_free(ctx, host);
- return JS_TRUE;
-}
-#endif
-
static JSClass jscls = {
"global", JSCLASS_GLOBAL_FLAGS,
-#ifdef MOZJS_VERSION_2_OR_SUPERIOR
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub,
JS_StrictPropertyStub,
-#else
- JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub,
-#endif
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, JS_FinalizeStub,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
};