1 From 0f886dc29b268ad0683e1372a80044a40a981192 Mon Sep 17 00:00:00 2001
2 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
3 Date: Fri, 01 Apr 2011 18:55:43 +0000
4 Subject: Conditionally adapt to JS_CLASS_TRACE removal
6 Upstream removed it in http://hg.mozilla.org/mozilla-central/rev/a7784d11c59b
8 https://bugzilla.gnome.org/show_bug.cgi?id=646471
10 diff --git a/configure.ac b/configure.ac
11 index d185ba1..1c773c0 100644
14 @@ -155,11 +155,14 @@ else
15 AC_MSG_ERROR([$JS_PACKAGE >= 1.9.2 is required])
18 +dnl xulrunner 2 checks
19 AC_CHECK_LIB([mozjs], [JS_GetStringBytes], AC_DEFINE([HAVE_JS_GETSTRINGBYTES], [1], [Define if we still have JS_GetStringBytes]),, [$JS_LIBS])
20 AC_CHECK_LIB([mozjs], [JS_GetFunctionName], AC_DEFINE([HAVE_JS_GETFUNCTIONNAME], [1], [Define if we still have JS_GetFunctionName]),, [$JS_LIBS])
21 AC_CHECK_LIB([mozjs], [JS_GetStringChars], AC_DEFINE([HAVE_JS_GETSTRINGCHARS], [1], [Define if we still have JS_GetStringChars]),, [$JS_LIBS])
22 AC_CHECK_LIB([mozjs], [JS_StrictPropertyStub], AC_DEFINE([HAVE_JS_STRICTPROPERTYSTUB], [1], [Define if we have JS_StrictPropertyStub]),, [$JS_LIBS])
23 AC_CHECK_LIB([mozjs], [JS_GetGlobalForScopeChain], AC_DEFINE([HAVE_JS_GETGLOBALFORSCOPECHAIN], [1], [Define if we have JS_GetGlobalForScopeChain]),, [$JS_LIBS])
24 +dnl xulrunner 2.2 checks
25 +AC_CHECK_LIB([mozjs], [JS_CLASS_TRACE], AC_DEFINE([HAVE_JS_CLASS_TRACE], [1], [Define if we still have JS_CLASS_TRACE]),, [$JS_LIBS])
27 AC_MSG_CHECKING([for mozilla-js >= 2 ])
28 if `$PKG_CONFIG --exists $JS_PACKAGE '>=' 2`; then
29 diff --git a/gi/keep-alive.c b/gi/keep-alive.c
30 index c7149ac..e268eaf 100644
33 @@ -184,8 +184,10 @@ keep_alive_trace(JSTracer *tracer,
35 static struct JSClass gjs_keep_alive_class = {
36 "__private_GjsKeepAlive", /* means "new __private_GjsKeepAlive()" works */
37 - JSCLASS_HAS_PRIVATE |
38 - JSCLASS_MARK_IS_TRACE, /* TraceOp not MarkOp */
39 +#ifdef HAVE_JS_CLASS_TRACE
40 + JSCLASS_MARK_IS_TRACE | /* TraceOp not MarkOp */
42 + JSCLASS_HAS_PRIVATE,
46 @@ -200,7 +202,11 @@ static struct JSClass gjs_keep_alive_class = {
50 +#ifdef HAVE_JS_CLASS_TRACE
51 JS_CLASS_TRACE(keep_alive_trace),
60 From 82a074e48610cafba0c4061b8267cccaada6be5e Mon Sep 17 00:00:00 2001
61 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
62 Date: Fri, 01 Apr 2011 19:04:57 +0000
63 Subject: Conditionally adapt to JS_DestroyScript removal
65 Upstream changed the behaviour of several things about JSScripts in
66 http://hg.mozilla.org/mozilla-central/rev/c919a7271ac1
68 We now have to use a JSObject instead of a JSScript in certain circumstances,
69 and we no longer have to call JS_DestroyScript which no longer exists
71 https://bugzilla.gnome.org/show_bug.cgi?id=646471
73 diff --git a/configure.ac b/configure.ac
74 index 1c773c0..2e23e8e 100644
77 @@ -163,6 +163,7 @@ AC_CHECK_LIB([mozjs], [JS_StrictPropertyStub], AC_DEFINE([HAVE_JS_STRICTPROPERTY
78 AC_CHECK_LIB([mozjs], [JS_GetGlobalForScopeChain], AC_DEFINE([HAVE_JS_GETGLOBALFORSCOPECHAIN], [1], [Define if we have JS_GetGlobalForScopeChain]),, [$JS_LIBS])
79 dnl xulrunner 2.2 checks
80 AC_CHECK_LIB([mozjs], [JS_CLASS_TRACE], AC_DEFINE([HAVE_JS_CLASS_TRACE], [1], [Define if we still have JS_CLASS_TRACE]),, [$JS_LIBS])
81 +AC_CHECK_LIB([mozjs], [JS_DestroyScript], AC_DEFINE([HAVE_JS_DESTROYSCRIPT], [1], [Define if we still have JS_DestroyScript]),, [$JS_LIBS])
83 AC_MSG_CHECKING([for mozilla-js >= 2 ])
84 if `$PKG_CONFIG --exists $JS_PACKAGE '>=' 2`; then
85 diff --git a/modules/console.c b/modules/console.c
86 index ba4b5b6..35d03c1 100644
87 --- a/modules/console.c
88 +++ b/modules/console.c
89 @@ -161,7 +161,11 @@ gjs_console_interact(JSContext *context,
91 JSObject *object = JS_THIS_OBJECT(context, vp);
93 +#ifdef HAVE_JS_DESTROYSCRIPT
94 JSScript *script = NULL;
96 + JSObject *script = NULL;
100 GString *buffer = NULL;
101 @@ -219,8 +223,10 @@ gjs_console_interact(JSContext *context,
105 +#ifdef HAVE_JS_DESTROYSCRIPT
107 JS_DestroyScript(context, script);
109 g_string_free(buffer, TRUE);
114 From 03efd168d1bfc3d3b07b26fda2c2464456df3054 Mon Sep 17 00:00:00 2001
115 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
116 Date: Thu, 28 Apr 2011 23:01:03 +0000
117 Subject: conditonally adapt to JS_BufferIsCompilableUnit changes
119 Upstream added an argument to JS_BufferIsCompilableUnit in commit
120 http://hg.mozilla.org/mozilla-central/rev/a773890b676f
121 We now have to tell if the bytes are utf8 or not.
123 https://bugzilla.gnome.org/show_bug.cgi?id=646471
125 diff --git a/configure.ac b/configure.ac
126 index 2e23e8e..6fd8fb4 100644
129 @@ -164,6 +164,7 @@ AC_CHECK_LIB([mozjs], [JS_GetGlobalForScopeChain], AC_DEFINE([HAVE_JS_GETGLOBALF
130 dnl xulrunner 2.2 checks
131 AC_CHECK_LIB([mozjs], [JS_CLASS_TRACE], AC_DEFINE([HAVE_JS_CLASS_TRACE], [1], [Define if we still have JS_CLASS_TRACE]),, [$JS_LIBS])
132 AC_CHECK_LIB([mozjs], [JS_DestroyScript], AC_DEFINE([HAVE_JS_DESTROYSCRIPT], [1], [Define if we still have JS_DestroyScript]),, [$JS_LIBS])
133 +AC_CHECK_LIB([mozjs], [JS_DecodeUTF8], AC_DEFINE([HAVE_JS_DECODEUTF8], [1], [Define if we have JS_DecodeUTF8]),, [$JS_LIBS])
135 AC_MSG_CHECKING([for mozilla-js >= 2 ])
136 if `$PKG_CONFIG --exists $JS_PACKAGE '>=' 2`; then
137 diff --git a/modules/console.c b/modules/console.c
138 index 35d03c1..d87b4a7 100644
139 --- a/modules/console.c
140 +++ b/modules/console.c
141 @@ -196,7 +196,11 @@ gjs_console_interact(JSContext *context,
142 g_string_append(buffer, temp_buf);
145 +#ifdef HAVE_JS_DECODEUTF8
146 + } while (!JS_BufferIsCompilableUnit(context, JS_TRUE, object, buffer->str, buffer->len));
148 } while (!JS_BufferIsCompilableUnit(context, object, buffer->str, buffer->len));
151 script = JS_CompileScript(context, object, buffer->str, buffer->len, "typein",