[gjs/wip/0-7-14-xulrunner-5: 1/4] Conditionally adapt to JS_DestroyScript removal



commit cef9c0835bfd8be105ff8905083d6b51d9010b8f
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
    
    Conflicts:
    
    	configure.ac

 configure.ac      |    1 +
 modules/console.c |    6 ++++++
 2 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 715f2c3..f81704b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -160,6 +160,7 @@ AC_CHECK_LIB([mozjs], [JS_GetFunctionName], AC_DEFINE([HAVE_JS_GETFUNCTIONNAME],
 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])
+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 49f891b..e6945be 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]