[gjs] Conditionally adapt to JS_DestroyScript removal



commit 82a074e48610cafba0c4061b8267cccaada6be5e
Author: Marc-Antoine Perennou <Marc-Antoine Perennou com>
Date:   Fri Apr 1 21:04:57 2011 +0200

    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

 configure.ac      |    1 +
 modules/console.c |    6 ++++++
 2 files changed, 7 insertions(+), 0 deletions(-)
---
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);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]