From 0f886dc29b268ad0683e1372a80044a40a981192 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou Date: Fri, 01 Apr 2011 18:55:43 +0000 Subject: Conditionally adapt to JS_CLASS_TRACE removal Upstream removed it in http://hg.mozilla.org/mozilla-central/rev/a7784d11c59b https://bugzilla.gnome.org/show_bug.cgi?id=646471 --- diff --git a/configure.ac b/configure.ac index d185ba1..1c773c0 100644 --- a/configure.ac +++ b/configure.ac @@ -155,11 +155,14 @@ else AC_MSG_ERROR([$JS_PACKAGE >= 1.9.2 is required]) fi +dnl xulrunner 2 checks AC_CHECK_LIB([mozjs], [JS_GetStringBytes], AC_DEFINE([HAVE_JS_GETSTRINGBYTES], [1], [Define if we still have JS_GetStringBytes]),, [$JS_LIBS]) AC_CHECK_LIB([mozjs], [JS_GetFunctionName], AC_DEFINE([HAVE_JS_GETFUNCTIONNAME], [1], [Define if we still have JS_GetFunctionName]),, [$JS_LIBS]) AC_CHECK_LIB([mozjs], [JS_GetStringChars], AC_DEFINE([HAVE_JS_GETSTRINGCHARS], [1], [Define if we still have JS_GetStringChars]),, [$JS_LIBS]) AC_CHECK_LIB([mozjs], [JS_StrictPropertyStub], AC_DEFINE([HAVE_JS_STRICTPROPERTYSTUB], [1], [Define if we have JS_StrictPropertyStub]),, [$JS_LIBS]) AC_CHECK_LIB([mozjs], [JS_GetGlobalForScopeChain], AC_DEFINE([HAVE_JS_GETGLOBALFORSCOPECHAIN], [1], [Define if we have JS_GetGlobalForScopeChain]),, [$JS_LIBS]) +dnl xulrunner 2.2 checks +AC_CHECK_LIB([mozjs], [JS_CLASS_TRACE], AC_DEFINE([HAVE_JS_CLASS_TRACE], [1], [Define if we still have JS_CLASS_TRACE]),, [$JS_LIBS]) AC_MSG_CHECKING([for mozilla-js >= 2 ]) if `$PKG_CONFIG --exists $JS_PACKAGE '>=' 2`; then diff --git a/gi/keep-alive.c b/gi/keep-alive.c index c7149ac..e268eaf 100644 --- a/gi/keep-alive.c +++ b/gi/keep-alive.c @@ -184,8 +184,10 @@ keep_alive_trace(JSTracer *tracer, */ static struct JSClass gjs_keep_alive_class = { "__private_GjsKeepAlive", /* means "new __private_GjsKeepAlive()" works */ - JSCLASS_HAS_PRIVATE | - JSCLASS_MARK_IS_TRACE, /* TraceOp not MarkOp */ +#ifdef HAVE_JS_CLASS_TRACE + JSCLASS_MARK_IS_TRACE | /* TraceOp not MarkOp */ +#endif + JSCLASS_HAS_PRIVATE, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, @@ -200,7 +202,11 @@ static struct JSClass gjs_keep_alive_class = { NULL, NULL, NULL, +#ifdef HAVE_JS_CLASS_TRACE JS_CLASS_TRACE(keep_alive_trace), +#else + keep_alive_trace, +#endif NULL }; -- cgit v0.9 From 82a074e48610cafba0c4061b8267cccaada6be5e Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou Date: Fri, 01 Apr 2011 19:04:57 +0000 Subject: Conditionally adapt to JS_DestroyScript removal Upstream changed the behaviour of several things about JSScripts in http://hg.mozilla.org/mozilla-central/rev/c919a7271ac1 We now have to use a JSObject instead of a JSScript in certain circumstances, and we no longer have to call JS_DestroyScript which no longer exists https://bugzilla.gnome.org/show_bug.cgi?id=646471 --- diff --git a/configure.ac b/configure.ac index 1c773c0..2e23e8e 100644 --- a/configure.ac +++ b/configure.ac @@ -163,6 +163,7 @@ AC_CHECK_LIB([mozjs], [JS_StrictPropertyStub], AC_DEFINE([HAVE_JS_STRICTPROPERTY AC_CHECK_LIB([mozjs], [JS_GetGlobalForScopeChain], AC_DEFINE([HAVE_JS_GETGLOBALFORSCOPECHAIN], [1], [Define if we have JS_GetGlobalForScopeChain]),, [$JS_LIBS]) dnl xulrunner 2.2 checks AC_CHECK_LIB([mozjs], [JS_CLASS_TRACE], AC_DEFINE([HAVE_JS_CLASS_TRACE], [1], [Define if we still have JS_CLASS_TRACE]),, [$JS_LIBS]) +AC_CHECK_LIB([mozjs], [JS_DestroyScript], AC_DEFINE([HAVE_JS_DESTROYSCRIPT], [1], [Define if we still have JS_DestroyScript]),, [$JS_LIBS]) AC_MSG_CHECKING([for mozilla-js >= 2 ]) if `$PKG_CONFIG --exists $JS_PACKAGE '>=' 2`; then diff --git a/modules/console.c b/modules/console.c index ba4b5b6..35d03c1 100644 --- a/modules/console.c +++ b/modules/console.c @@ -161,7 +161,11 @@ gjs_console_interact(JSContext *context, { JSObject *object = JS_THIS_OBJECT(context, vp); gboolean eof = FALSE; +#ifdef HAVE_JS_DESTROYSCRIPT JSScript *script = NULL; +#else + JSObject *script = NULL; +#endif jsval result; JSString *str; GString *buffer = NULL; @@ -219,8 +223,10 @@ gjs_console_interact(JSContext *context, } next: +#ifdef HAVE_JS_DESTROYSCRIPT if (script) JS_DestroyScript(context, script); +#endif g_string_free(buffer, TRUE); } while (!eof); -- cgit v0.9 From 03efd168d1bfc3d3b07b26fda2c2464456df3054 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou Date: Thu, 28 Apr 2011 23:01:03 +0000 Subject: conditonally adapt to JS_BufferIsCompilableUnit changes Upstream added an argument to JS_BufferIsCompilableUnit in commit http://hg.mozilla.org/mozilla-central/rev/a773890b676f We now have to tell if the bytes are utf8 or not. https://bugzilla.gnome.org/show_bug.cgi?id=646471 --- diff --git a/configure.ac b/configure.ac index 2e23e8e..6fd8fb4 100644 --- a/configure.ac +++ b/configure.ac @@ -164,6 +164,7 @@ AC_CHECK_LIB([mozjs], [JS_GetGlobalForScopeChain], AC_DEFINE([HAVE_JS_GETGLOBALF dnl xulrunner 2.2 checks AC_CHECK_LIB([mozjs], [JS_CLASS_TRACE], AC_DEFINE([HAVE_JS_CLASS_TRACE], [1], [Define if we still have JS_CLASS_TRACE]),, [$JS_LIBS]) AC_CHECK_LIB([mozjs], [JS_DestroyScript], AC_DEFINE([HAVE_JS_DESTROYSCRIPT], [1], [Define if we still have JS_DestroyScript]),, [$JS_LIBS]) +AC_CHECK_LIB([mozjs], [JS_DecodeUTF8], AC_DEFINE([HAVE_JS_DECODEUTF8], [1], [Define if we have JS_DecodeUTF8]),, [$JS_LIBS]) AC_MSG_CHECKING([for mozilla-js >= 2 ]) if `$PKG_CONFIG --exists $JS_PACKAGE '>=' 2`; then diff --git a/modules/console.c b/modules/console.c index 35d03c1..d87b4a7 100644 --- a/modules/console.c +++ b/modules/console.c @@ -196,7 +196,11 @@ gjs_console_interact(JSContext *context, g_string_append(buffer, temp_buf); g_free(temp_buf); lineno++; +#ifdef HAVE_JS_DECODEUTF8 + } while (!JS_BufferIsCompilableUnit(context, JS_TRUE, object, buffer->str, buffer->len)); +#else } while (!JS_BufferIsCompilableUnit(context, object, buffer->str, buffer->len)); +#endif script = JS_CompileScript(context, object, buffer->str, buffer->len, "typein", startline); -- cgit v0.9