[gjs/wip/0-7-14-xulrunner-5: 2/4] conditonally adapt to JS_BufferIsCompilableUnit changes



commit 3c8396821c78e362c8b3a89a27dcf4d32e25ee05
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 f81704b..270bc46 100644
--- a/configure.ac
+++ b/configure.ac
@@ -161,6 +161,7 @@ AC_CHECK_LIB([mozjs], [JS_GetStringChars], AC_DEFINE([HAVE_JS_GETSTRINGCHARS], [
 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_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 e6945be..8e20db3 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]