[gjs] conditonally adapt to JS_BufferIsCompilableUnit changes



commit 03efd168d1bfc3d3b07b26fda2c2464456df3054
Author: Marc-Antoine Perennou <Marc-Antoine Perennou com>
Date:   Fri Apr 29 01:01:03 2011 +0200

    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

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



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