darkxst

js188 patches

Jan 9th, 2013
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 86.59 KB | None | 0 0
  1. From 03cbb6cc7a5fb8dddd5fb41d3590855fd6a81355 Mon Sep 17 00:00:00 2001
  2. From: Tim Lunn <tim@feathertop.org>
  3. Date: Thu, 3 Jan 2013 12:59:54 +1100
  4. Subject: [PATCH 01/10] JS_BufferIsCompilableUnit API change
  5.  
  6. ---
  7. modules/console.c | 2 +-
  8.  1 file changed, 1 insertion(+), 1 deletion(-)
  9.  
  10. diff --git a/modules/console.c b/modules/console.c
  11. index 71a95b4..a7e204e 100644
  12. --- a/modules/console.c
  13. +++ b/modules/console.c
  14. @@ -190,7 +190,7 @@ gjs_console_interact(JSContext *context,
  15.              g_string_append(buffer, temp_buf);
  16.              g_free(temp_buf);
  17.              lineno++;
  18. -        } while (!JS_BufferIsCompilableUnit(context, object, buffer->str, buffer->len));
  19. +        } while (!JS_BufferIsCompilableUnit(context, JS_TRUE, object, buffer->str, buffer->len));
  20.  
  21.          JS_EvaluateScript(context, object, buffer->str, buffer->len, "typein",
  22.                            startline, &result);
  23. --
  24. 1.8.0
  25.  
  26.  
  27. From 9b1ffc1dd94f03097b2541c90f8d637163946540 Mon Sep 17 00:00:00 2001
  28. From: Tim Lunn <tim@feathertop.org>
  29. Date: Thu, 3 Jan 2013 14:13:45 +1100
  30. Subject: [PATCH 02/10] api change to JS_NumberValue
  31.  
  32. JS_NewNumberValue is depreciated and removed in js188
  33.  
  34. https://bugzilla.gnome.org/show_bug.cgi?id=690982
  35. ---
  36. gi/arg.c                | 36 ++++++++++++++++++++++++------------
  37.  gi/enumeration.c        |  4 ++--
  38.  gi/object.c             |  4 ++--
  39.  gi/value.c              | 23 +++++++++++++++--------
  40.  gjs/byteArray.c         |  3 ++-
  41.  gjs/jsapi-util.c        |  3 ++-
  42.  modules/cairo-context.c | 27 ++++++++++++++++++---------
  43.  modules/mainloop.c      | 18 ++++++++++--------
  44.  8 files changed, 75 insertions(+), 43 deletions(-)
  45.  
  46. diff --git a/gi/arg.c b/gi/arg.c
  47. index 7c019d3..1602b59 100644
  48. --- a/gi/arg.c
  49. +++ b/gi/arg.c
  50. @@ -2377,34 +2377,44 @@ gjs_value_from_g_argument (JSContext  *context,
  51.          break;
  52.  
  53.      case GI_TYPE_TAG_INT32:
  54. -        return JS_NewNumberValue(context, arg->v_int, value_p);
  55. +        *value_p = JS_NumberValue(arg->v_int);
  56. +        return JS_TRUE;
  57.  
  58.      case GI_TYPE_TAG_UINT32:
  59. -        return JS_NewNumberValue(context, arg->v_uint, value_p);
  60. +        *value_p = JS_NumberValue(arg->v_uint);
  61. +        return JS_TRUE;
  62.  
  63.      case GI_TYPE_TAG_INT64:
  64. -        return JS_NewNumberValue(context, arg->v_int64, value_p);
  65. +        *value_p = JS_NumberValue(arg->v_int64);
  66. +        return JS_TRUE;
  67.  
  68.      case GI_TYPE_TAG_UINT64:
  69. -        return JS_NewNumberValue(context, arg->v_uint64, value_p);
  70. +        *value_p = JS_NumberValue(arg->v_uint64);
  71. +        return JS_TRUE;
  72.  
  73.      case GI_TYPE_TAG_UINT16:
  74. -        return JS_NewNumberValue(context, arg->v_uint16, value_p);
  75. +        *value_p = JS_NumberValue(arg->v_uint16);
  76. +        return JS_TRUE;
  77.  
  78.      case GI_TYPE_TAG_INT16:
  79. -        return JS_NewNumberValue(context, arg->v_int16, value_p);
  80. +        *value_p = JS_NumberValue(arg->v_int16);
  81. +        return JS_TRUE;
  82.  
  83.      case GI_TYPE_TAG_UINT8:
  84. -        return JS_NewNumberValue(context, arg->v_uint8, value_p);
  85. +        *value_p = JS_NumberValue(arg->v_uint8);
  86. +        return JS_TRUE;
  87.  
  88.      case GI_TYPE_TAG_INT8:
  89. -        return JS_NewNumberValue(context, arg->v_int8, value_p);
  90. +        *value_p = JS_NumberValue(arg->v_int8);
  91. +        return JS_TRUE;
  92.  
  93.      case GI_TYPE_TAG_FLOAT:
  94. -        return JS_NewNumberValue(context, arg->v_float, value_p);
  95. +        *value_p = JS_NumberValue(arg->v_float);
  96. +        return JS_TRUE;
  97.  
  98.      case GI_TYPE_TAG_DOUBLE:
  99. -        return JS_NewNumberValue(context, arg->v_double, value_p);
  100. +        *value_p = JS_NumberValue(arg->v_double);
  101. +        return JS_TRUE;
  102.  
  103.      case GI_TYPE_TAG_GTYPE:
  104.          {
  105. @@ -2493,7 +2503,8 @@ gjs_value_from_g_argument (JSContext  *context,
  106.  
  107.                  if (_gjs_enum_value_is_valid(context, (GIEnumInfo *)interface_info, value_int64)) {
  108.                      jsval tmp;
  109. -                    if (JS_NewNumberValue(context, value_int64, &tmp))
  110. +                    tmp = JS_NumberValue(value_int64);
  111. +                    if (JSVAL_IS_NUMBER(tmp))
  112.                          value = tmp;
  113.                  }
  114.  
  115. @@ -2504,7 +2515,8 @@ gjs_value_from_g_argument (JSContext  *context,
  116.                  gtype = g_registered_type_info_get_g_type((GIRegisteredTypeInfo*)interface_info);
  117.                  if (_gjs_flags_value_is_valid(context, gtype, value_int64)) {
  118.                      jsval tmp;
  119. -                    if (JS_NewNumberValue(context, value_int64, &tmp))
  120. +                    tmp = JS_NumberValue(value_int64);
  121. +                    if (JSVAL_IS_NUMBER(tmp))
  122.                          value = tmp;
  123.                  }
  124.  
  125. diff --git a/gi/enumeration.c b/gi/enumeration.c
  126. index 67c81db..6ff0d97 100644
  127. --- a/gi/enumeration.c
  128. +++ b/gi/enumeration.c
  129. @@ -84,8 +84,8 @@ gjs_define_enum_value(JSContext    *context,
  130.      gjs_debug(GJS_DEBUG_GENUM,
  131.                "Defining enum value %s (fixed from %s) %" G_GINT64_MODIFIER "d",
  132.                fixed_name, value_name, value_val);
  133. -
  134. -    if (!JS_NewNumberValue(context, value_val, &value_js) ||
  135. +    value_js = JS_NumberValue(value_val);
  136. +    if (!JSVAL_IS_NUMBER(value_js) ||
  137.          !JS_DefineProperty(context, in_object,
  138.                             fixed_name, value_js,
  139.                             NULL, NULL,
  140. diff --git a/gi/object.c b/gi/object.c
  141. index a5aac2e..f35161e 100644
  142. --- a/gi/object.c
  143. +++ b/gi/object.c
  144. @@ -1206,8 +1206,8 @@ real_connect_func(JSContext *context,
  145.                                          signal_detail,
  146.                                          closure,
  147.                                          after);
  148. -
  149. -    if (!JS_NewNumberValue(context, id, &retval)) {
  150. +    retval = JS_NumberValue(id);
  151. +    if (!JSVAL_IS_NUMBER(retval)) {
  152.          g_signal_handler_disconnect(priv->gobj, id);
  153.          goto out;
  154.      }
  155. diff --git a/gi/value.c b/gi/value.c
  156. index 909742d..6cd076f 100644
  157. --- a/gi/value.c
  158. +++ b/gi/value.c
  159. @@ -610,9 +610,10 @@ convert_int_to_enum (JSContext *context,
  160.              v_double = _gjs_enum_from_int ((GIEnumInfo *)info, v);
  161.  
  162.          g_base_info_unref(info);
  163. +        return JS_FALSE;
  164.      }
  165. -
  166. -    return JS_NewNumberValue(context, v_double, value_p);
  167. +    *value_p = JS_NumberValue(v_double);
  168. +    return JS_TRUE;
  169.  }
  170.  
  171.  static JSBool
  172. @@ -653,19 +654,23 @@ gjs_value_from_g_value_internal(JSContext    *context,
  173.      } else if (gtype == G_TYPE_INT) {
  174.          int v;
  175.          v = g_value_get_int(gvalue);
  176. -        return JS_NewNumberValue(context, v, value_p);
  177. +        *value_p = JS_NumberValue(v);
  178. +        return JS_TRUE;
  179.      } else if (gtype == G_TYPE_UINT) {
  180.          uint v;
  181.          v = g_value_get_uint(gvalue);
  182. -        return JS_NewNumberValue(context, v, value_p);
  183. +        *value_p = JS_NumberValue(v);
  184. +        return JS_TRUE;
  185.      } else if (gtype == G_TYPE_DOUBLE) {
  186.          double d;
  187.          d = g_value_get_double(gvalue);
  188. -        return JS_NewNumberValue(context, d, value_p);
  189. +        *value_p = JS_NumberValue(d);
  190. +        return JS_TRUE;
  191.      } else if (gtype == G_TYPE_FLOAT) {
  192.          double d;
  193.          d = g_value_get_float(gvalue);
  194. -        return JS_NewNumberValue(context, d, value_p);
  195. +        *value_p = JS_NumberValue(d);
  196. +        return JS_TRUE;
  197.      } else if (gtype == G_TYPE_BOOLEAN) {
  198.          gboolean v;
  199.          v = g_value_get_boolean(gvalue);
  200. @@ -816,14 +821,16 @@ gjs_value_from_g_value_internal(JSContext    *context,
  201.          g_value_init(&double_value, G_TYPE_DOUBLE);
  202.          g_value_transform(gvalue, &double_value);
  203.          v = g_value_get_double(&double_value);
  204. -        return JS_NewNumberValue(context, v, value_p);
  205. +        *value_p = JS_NumberValue(v);
  206. +        return JS_TRUE;
  207.      } else if (g_value_type_transformable(gtype, G_TYPE_INT)) {
  208.          GValue int_value = { 0, };
  209.          int v;
  210.          g_value_init(&int_value, G_TYPE_INT);
  211.          g_value_transform(gvalue, &int_value);
  212.          v = g_value_get_int(&int_value);
  213. -        return JS_NewNumberValue(context, v, value_p);
  214. +        *value_p = JS_NumberValue(v);
  215. +        return JS_TRUE;
  216.      } else {
  217.          gjs_throw(context,
  218.                    "Don't know how to convert GType %s to JavaScript object",
  219. diff --git a/gjs/byteArray.c b/gjs/byteArray.c
  220. index 825c296..02d0f9b 100644
  221. --- a/gjs/byteArray.c
  222. +++ b/gjs/byteArray.c
  223. @@ -94,7 +94,8 @@ gjs_value_from_gsize(JSContext         *context,
  224.          *value_p = INT_TO_JSVAL(v);
  225.          return JS_TRUE;
  226.      } else {
  227. -        return JS_NewNumberValue(context, v, value_p);
  228. +        *value_p = JS_NumberValue(v);
  229. +        return JS_TRUE;
  230.      }
  231.  }
  232.  
  233. diff --git a/gjs/jsapi-util.c b/gjs/jsapi-util.c
  234. index 6eab2ed..3a4c658 100644
  235. --- a/gjs/jsapi-util.c
  236. +++ b/gjs/jsapi-util.c
  237. @@ -823,7 +823,8 @@ gjs_date_from_time_t (JSContext *context, time_t time)
  238.  
  239.      date_class = JS_GET_CLASS(context, JSVAL_TO_OBJECT (date_prototype));
  240.  
  241. -    if (!JS_NewNumberValue(context, ((double) time) * 1000, &(args[0])))
  242. +    args[0] = JS_NumberValue(((double) time) * 1000);
  243. +    if (!JSVAL_IS_NUMBER(args[0]))
  244.          gjs_fatal("Failed to convert time_t to number");
  245.  
  246.      date = JS_ConstructObjectWithArguments(context, date_class,
  247. diff --git a/modules/cairo-context.c b/modules/cairo-context.c
  248. index 7453494..ea23fdf 100644
  249. --- a/modules/cairo-context.c
  250. +++ b/modules/cairo-context.c
  251. @@ -88,9 +88,11 @@ _GJS_CAIRO_CONTEXT_DEFINE_FUNC_BEGIN(method)                               \
  252.        if (!array)                                                          \
  253.          return JS_FALSE;                                                   \
  254.        jsval r;                                                             \
  255. -      if (!JS_NewNumberValue(context, arg1, &r)) return JS_FALSE;          \
  256. +      r = JS_NumberValue(arg1);                                            \
  257. +      if (!JSVAL_IS_NUMBER(r)) return JS_FALSE;                            \
  258.        if (!JS_SetElement(context, array, 0, &r)) return JS_FALSE;          \
  259. -      if (!JS_NewNumberValue(context, arg2, &r)) return JS_FALSE;          \
  260. +      r = JS_NumberValue(arg2);                                            \
  261. +      if (!JSVAL_IS_NUMBER(r)) return JS_FALSE;                            \
  262.        if (!JS_SetElement(context, array, 1, &r)) return JS_FALSE;          \
  263.        JS_SET_RVAL(context, vp, OBJECT_TO_JSVAL(array));                    \
  264.      }                                                                      \
  265. @@ -107,9 +109,11 @@ _GJS_CAIRO_CONTEXT_DEFINE_FUNC_BEGIN(method)                               \
  266.        if (!array)                                                          \
  267.          return JS_FALSE;                                                   \
  268.        jsval r;                                                             \
  269. -      if (!JS_NewNumberValue(context, arg1, &r)) return JS_FALSE;          \
  270. +      r = JS_NumberValue(arg1);                                            \
  271. +      if (!JSVAL_IS_NUMBER(r)) return JS_FALSE;                            \
  272.        if (!JS_SetElement(context, array, 0, &r)) return JS_FALSE;          \
  273. -      if (!JS_NewNumberValue(context, arg2, &r)) return JS_FALSE;          \
  274. +      r = JS_NumberValue(arg2);                                            \
  275. +      if (!JSVAL_IS_NUMBER(r)) return JS_FALSE;                            \
  276.        if (!JS_SetElement(context, array, 1, &r)) return JS_FALSE;          \
  277.        JS_SET_RVAL(context, vp, OBJECT_TO_JSVAL(array));                    \
  278.      }                                                                      \
  279. @@ -126,13 +130,17 @@ _GJS_CAIRO_CONTEXT_DEFINE_FUNC_BEGIN(method)                               \
  280.        if (!array)                                                          \
  281.          return JS_FALSE;                                                   \
  282.        jsval r;                                                             \
  283. -      if (!JS_NewNumberValue(context, arg1, &r)) return JS_FALSE;          \
  284. +      r = JS_NumberValue(arg1);                                            \
  285. +      if (!JSVAL_IS_NUMBER(r)) return JS_FALSE;                            \
  286.        if (!JS_SetElement(context, array, 0, &r)) return JS_FALSE;          \
  287. -      if (!JS_NewNumberValue(context, arg2, &r)) return JS_FALSE;          \
  288. +      r = JS_NumberValue(arg2);                                            \
  289. +      if (!JSVAL_IS_NUMBER(r)) return JS_FALSE;                            \
  290.        if (!JS_SetElement(context, array, 1, &r)) return JS_FALSE;          \
  291. -      if (!JS_NewNumberValue(context, arg3, &r)) return JS_FALSE;          \
  292. +      r = JS_NumberValue(arg3);                                            \
  293. +      if (!JSVAL_IS_NUMBER(r)) return JS_FALSE;                            \
  294.        if (!JS_SetElement(context, array, 2, &r)) return JS_FALSE;          \
  295. -      if (!JS_NewNumberValue(context, arg4, &r)) return JS_FALSE;          \
  296. +      r = JS_NumberValue(arg4);                                            \
  297. +      if (!JSVAL_IS_NUMBER(r)) return JS_FALSE;                            \
  298.        if (!JS_SetElement(context, array, 3, &r)) return JS_FALSE;          \
  299.        JS_SET_RVAL(context, vp, OBJECT_TO_JSVAL(array));                    \
  300.      }                                                                      \
  301. @@ -145,7 +153,8 @@ _GJS_CAIRO_CONTEXT_DEFINE_FUNC_BEGIN(method)                               \
  302.     _GJS_CAIRO_CONTEXT_CHECK_NO_ARGS(method)                                \
  303.      cr = gjs_cairo_context_get_context(context, obj);                      \
  304.      ret = cfunc(cr);                                                       \
  305. -    if (!JS_NewNumberValue(context, ret, &retval))                         \
  306. +    retval = JS_NumberValue(ret);                                          \
  307. +    if (!JSVAL_IS_NUMBER(retval))                                          \
  308.          return JS_FALSE;                                                   \
  309.      JS_SET_RVAL(context, vp, retval);                                      \
  310.  _GJS_CAIRO_CONTEXT_DEFINE_FUNC_END
  311. diff --git a/modules/mainloop.c b/modules/mainloop.c
  312. index cbf4069..c627736 100644
  313. --- a/modules/mainloop.c
  314. +++ b/modules/mainloop.c
  315. @@ -212,8 +212,8 @@ gjs_timeout_add(JSContext *context,
  316.       */
  317.      g_closure_add_invalidate_notifier(closure, GUINT_TO_POINTER(id),
  318.                                        closure_invalidated);
  319. -
  320. -    if (!JS_NewNumberValue(context, id, &retval))
  321. +    retval = JS_NumberValue(id);
  322. +    if (!JSVAL_IS_NUMBER(retval))
  323.          return JS_FALSE;
  324.      JS_SET_RVAL(context, vp, retval);
  325.  
  326. @@ -255,12 +255,13 @@ gjs_timeout_add_seconds(JSContext *context,
  327.       */
  328.      g_closure_add_invalidate_notifier(closure, GUINT_TO_POINTER(id),
  329.                                        closure_invalidated);
  330. +    retval = JS_NumberValue(id);
  331. +    if (JSVAL_IS_NUMBER(retval)){
  332. +        JS_SET_RVAL(context, vp, retval);
  333. +        return JS_TRUE;
  334. +    }
  335.  
  336. -    if (!JS_NewNumberValue(context, id, &retval))
  337. -        return JS_FALSE;
  338. -    JS_SET_RVAL(context, vp, retval);
  339. -
  340. -    return JS_TRUE;
  341. +    return JS_FALSE;
  342.  }
  343.  
  344.  static JSBool
  345. @@ -302,7 +303,8 @@ gjs_idle_add(JSContext *context,
  346.      g_closure_add_invalidate_notifier(closure, GUINT_TO_POINTER(id),
  347.                                        closure_invalidated);
  348.  
  349. -    if (!JS_NewNumberValue(context, id, &retval))
  350. +    retval = JS_NumberValue(id);
  351. +    if (!JSVAL_IS_NUMBER(retval))
  352.          return JS_FALSE;
  353.      JS_SET_RVAL(context, vp, retval);
  354.  
  355. --
  356. 1.8.0
  357.  
  358.  
  359. From 6ec24216e5435764c30f344124137c61b676bfd1 Mon Sep 17 00:00:00 2001
  360. From: Tim Lunn <tim@feathertop.org>
  361. Date: Thu, 3 Jan 2013 12:59:54 +1100
  362. Subject: [PATCH 03/10] change build version to mozjs188
  363.  
  364. ---
  365. configure.ac            | 2 +-
  366.  gjs-1.0.pc.in           | 2 +-
  367.  gjs-internals-1.0.pc.in | 2 +-
  368.  3 files changed, 3 insertions(+), 3 deletions(-)
  369.  
  370. diff --git a/configure.ac b/configure.ac
  371. index 72e946a..f0a699e 100644
  372. --- a/configure.ac
  373. +++ b/configure.ac
  374. @@ -94,7 +94,7 @@ CFLAGS="$save_CFLAGS"
  375.  
  376.  GOBJECT_INTROSPECTION_REQUIRE([1.33.10])
  377.  
  378. -common_packages="gmodule-2.0 gthread-2.0 gio-2.0 >= glib_required_version mozjs185"
  379. +common_packages="gmodule-2.0 gthread-2.0 gio-2.0 >= glib_required_version mozjs188"
  380.  gjs_packages="gobject-introspection-1.0 libffi $common_packages"
  381.  gjs_cairo_gobject_packages="cairo-gobject $common_packages"
  382.  gjs_cairo_packages="cairo $common_packages"
  383. diff --git a/gjs-1.0.pc.in b/gjs-1.0.pc.in
  384. index e3ae371..ad85fa3 100644
  385. --- a/gjs-1.0.pc.in
  386. +++ b/gjs-1.0.pc.in
  387. @@ -10,7 +10,7 @@ gjs_console=${bindir}/gjs-console
  388.  
  389.  Cflags: -I${includedir}/gjs-1.0
  390.  Requires: gobject-2.0
  391. -Requires.private: gobject-introspection-1.0 mozjs185
  392. +Requires.private: gobject-introspection-1.0 mozjs188
  393.  Libs: -L${libdir} -lgjs
  394.  
  395.  Name: gjs-1.0
  396. diff --git a/gjs-internals-1.0.pc.in b/gjs-internals-1.0.pc.in
  397. index b898b2b..7a86f66 100644
  398. --- a/gjs-internals-1.0.pc.in
  399. +++ b/gjs-internals-1.0.pc.in
  400. @@ -10,7 +10,7 @@ jsdir=@gjsjsdir@
  401.  jsnativedir=@gjsnativedir@
  402.  
  403.  Cflags: -I${includedir}/gjs-1.0
  404. -Requires: gjs-1.0 gobject-introspection-1.0 mozjs185
  405. +Requires: gjs-1.0 gobject-introspection-1.0 mozjs188
  406.  
  407.  Name: gjs-internals-1.0
  408.  Description: Internal API for gjs (for modules and embedders); uses mozjs
  409. --
  410. 1.8.0
  411.  
  412.  
  413. From e0d772130437ae7b7c0399477eb48c8e14b2a5c5 Mon Sep 17 00:00:00 2001
  414. From: Tim Lunn <tim@feathertop.org>
  415. Date: Thu, 3 Jan 2013 13:51:26 +1100
  416. Subject: [PATCH 04/10] define JSVAL_IS_OBJECT
  417.  
  418. JSVAL_IS_OBJECT has been removed, for now just redefine it in compat.h
  419. ---
  420. gjs/compat.h | 3 +++
  421.  1 file changed, 3 insertions(+)
  422.  
  423. diff --git a/gjs/compat.h b/gjs/compat.h
  424. index f5e9634..b2a7e20 100644
  425. --- a/gjs/compat.h
  426. +++ b/gjs/compat.h
  427. @@ -49,6 +49,9 @@ G_BEGIN_DECLS
  428.   * GJS_NATIVE_CONSTRUCTOR_DECLARE:
  429.   * Prototype a constructor.
  430.   */
  431. +
  432. +#define JSVAL_IS_OBJECT(obj) !JSVAL_IS_PRIMITIVE(obj)
  433. +
  434.  #define GJS_NATIVE_CONSTRUCTOR_DECLARE(name)            \
  435.  static JSBool                                           \
  436.  gjs_##name##_constructor(JSContext  *context,           \
  437. --
  438. 1.8.0
  439.  
  440.  
  441. From d18d6feb0e918f8330f875e08082be3d64619637 Mon Sep 17 00:00:00 2001
  442. From: Tim Lunn <tim@feathertop.org>
  443. Date: Thu, 3 Jan 2013 14:36:15 +1100
  444. Subject: [PATCH 05/10] api change JS_GetClass
  445.  
  446. JS_GetClass no longer takes *context as first argument,
  447. consequently the JS_GET_CLASS Macro is also removed.
  448. ---
  449. gi/boxed.c                |  8 ++++----
  450.  gi/gerror.c               |  6 +++---
  451.  gi/object.c               |  4 ++--
  452.  gi/param.c                |  4 ++--
  453.  gi/union.c                |  6 +++---
  454.  gjs/jsapi-dynamic-class.c |  2 +-
  455.  gjs/jsapi-util.c          | 16 ++++++----------
  456.  gjs/stack.c               |  2 +-
  457.  8 files changed, 22 insertions(+), 26 deletions(-)
  458.  
  459. diff --git a/gi/boxed.c b/gi/boxed.c
  460. index f46cec5..bbea2c7 100644
  461. --- a/gi/boxed.c
  462. +++ b/gi/boxed.c
  463. @@ -598,7 +598,7 @@ get_nested_interface_object (JSContext   *context,
  464.      offset = g_field_info_get_offset (field_info);
  465.  
  466.      obj = JS_NewObjectWithGivenProto(context,
  467. -                                     JS_GET_CLASS(context, proto), proto,
  468. +                                     JS_GetClass(proto), proto,
  469.                                       gjs_get_import_global (context));
  470.  
  471.      if (obj == NULL)
  472. @@ -1001,7 +1001,7 @@ gjs_lookup_boxed_class(JSContext    *context,
  473.  
  474.      prototype = gjs_lookup_boxed_prototype(context, info);
  475.  
  476. -    return JS_GET_CLASS(context, prototype);
  477. +    return JS_GetClass(prototype);
  478.  }
  479.  
  480.  static gboolean
  481. @@ -1242,7 +1242,7 @@ gjs_define_boxed_class(JSContext    *context,
  482.      JS_SetPrivate(context, prototype, priv);
  483.  
  484.      gjs_debug(GJS_DEBUG_GBOXED, "Defined class %s prototype is %p class %p in object %p",
  485. -              constructor_name, prototype, JS_GET_CLASS(context, prototype), in_object);
  486. +              constructor_name, prototype, JS_GetClass(prototype), in_object);
  487.  
  488.      priv->can_allocate_directly = struct_is_simple (priv->info);
  489.  
  490. @@ -1284,7 +1284,7 @@ gjs_boxed_from_c_struct(JSContext             *context,
  491.      proto_priv = priv_from_js(context, proto);
  492.  
  493.      obj = JS_NewObjectWithGivenProto(context,
  494. -                                     JS_GET_CLASS(context, proto), proto,
  495. +                                     JS_GetClass(proto), proto,
  496.                                       gjs_get_import_global (context));
  497.  
  498.      GJS_INC_COUNTER(boxed);
  499. diff --git a/gi/gerror.c b/gi/gerror.c
  500. index ad75721..ea36b18 100644
  501. --- a/gi/gerror.c
  502. +++ b/gi/gerror.c
  503. @@ -380,7 +380,7 @@ gjs_lookup_error_class(JSContext    *context,
  504.  
  505.      prototype = gjs_lookup_error_prototype(context, info);
  506.  
  507. -    return JS_GET_CLASS(context, prototype);
  508. +    return JS_GetClass(prototype);
  509.  }
  510.  
  511.  JSBool
  512. @@ -463,7 +463,7 @@ gjs_define_error_class(JSContext    *context,
  513.      JS_SetPrivate(context, prototype, priv);
  514.  
  515.      gjs_debug(GJS_DEBUG_GBOXED, "Defined class %s prototype is %p class %p in object %p",
  516. -              constructor_name, prototype, JS_GET_CLASS(context, prototype), in_object);
  517. +              constructor_name, prototype, JS_GetClass(prototype), in_object);
  518.  
  519.      gjs_define_enum_values(context, constructor, priv->info);
  520.  
  521. @@ -590,7 +590,7 @@ gjs_error_from_gerror(JSContext             *context,
  522.      proto_priv = priv_from_js(context, proto);
  523.  
  524.      obj = JS_NewObjectWithGivenProto(context,
  525. -                                     JS_GET_CLASS(context, proto), proto,
  526. +                                     JS_GetClass(proto), proto,
  527.                                       gjs_get_import_global (context));
  528.  
  529.      GJS_INC_COUNTER(gerror);
  530. diff --git a/gi/object.c b/gi/object.c
  531. index f35161e..04c7a1a 100644
  532. --- a/gi/object.c
  533. +++ b/gi/object.c
  534. @@ -1692,7 +1692,7 @@ gjs_define_object_class(JSContext     *context,
  535.      JS_SetPrivate(context, prototype, priv);
  536.  
  537.      gjs_debug(GJS_DEBUG_GOBJECT, "Defined class %s prototype %p class %p in object %p",
  538. -              constructor_name, prototype, JS_GET_CLASS(context, prototype), in_object);
  539. +              constructor_name, prototype, JS_GetClass(prototype), in_object);
  540.  
  541.      if (info)
  542.          gjs_define_static_methods(context, constructor, gtype, info);
  543. @@ -1753,7 +1753,7 @@ gjs_object_from_g_object(JSContext    *context,
  544.          JS_BeginRequest(context);
  545.  
  546.          obj = JS_NewObjectWithGivenProto(context,
  547. -                                         JS_GET_CLASS(context, proto), proto,
  548. +                                         JS_GetClass(proto), proto,
  549.                                           gjs_get_import_global (context));
  550.  
  551.          JS_EndRequest(context);
  552. diff --git a/gi/param.c b/gi/param.c
  553. index c8594d8..8e6d67d 100644
  554. --- a/gi/param.c
  555. +++ b/gi/param.c
  556. @@ -536,7 +536,7 @@ gjs_define_param_class(JSContext    *context,
  557.          *prototype_p = prototype;
  558.  
  559.      gjs_debug(GJS_DEBUG_GPARAM, "Defined class %s prototype is %p class %p in object %p",
  560. -              constructor_name, prototype, JS_GET_CLASS(context, prototype), in_object);
  561. +              constructor_name, prototype, JS_GetClass(prototype), in_object);
  562.  
  563.      return JS_TRUE;
  564.  }
  565. @@ -561,7 +561,7 @@ gjs_param_from_g_param(JSContext    *context,
  566.      proto = gjs_lookup_param_prototype(context);
  567.  
  568.      obj = JS_NewObjectWithGivenProto(context,
  569. -                                     JS_GET_CLASS(context, proto), proto,
  570. +                                     JS_GetClass(proto), proto,
  571.                                       gjs_get_import_global (context));
  572.  
  573.      GJS_INC_COUNTER(param);
  574. diff --git a/gi/union.c b/gi/union.c
  575. index b21c72a..bfd7501 100644
  576. --- a/gi/union.c
  577. +++ b/gi/union.c
  578. @@ -380,7 +380,7 @@ gjs_lookup_union_class(JSContext    *context,
  579.  
  580.      prototype = gjs_lookup_union_prototype(context, info);
  581.  
  582. -    return JS_GET_CLASS(context, prototype);
  583. +    return JS_GetClass(prototype);
  584.  }
  585.  
  586.  JSBool
  587. @@ -463,7 +463,7 @@ gjs_define_union_class(JSContext    *context,
  588.      JS_SetPrivate(context, prototype, priv);
  589.  
  590.      gjs_debug(GJS_DEBUG_GBOXED, "Defined class %s prototype is %p class %p in object %p",
  591. -              constructor_name, prototype, JS_GET_CLASS(context, prototype), in_object);
  592. +              constructor_name, prototype, JS_GetClass(prototype), in_object);
  593.  
  594.      value = OBJECT_TO_JSVAL(gjs_gtype_create_gtype_wrapper(context, gtype));
  595.      JS_DefineProperty(context, constructor, "$gtype", value,
  596. @@ -507,7 +507,7 @@ gjs_union_from_c_union(JSContext    *context,
  597.      proto = gjs_lookup_union_prototype(context, (GIUnionInfo*) info);
  598.  
  599.      obj = JS_NewObjectWithGivenProto(context,
  600. -                                     JS_GET_CLASS(context, proto), proto,
  601. +                                     JS_GetClass(proto), proto,
  602.                                       gjs_get_import_global (context));
  603.  
  604.      GJS_INC_COUNTER(boxed);
  605. diff --git a/gjs/jsapi-dynamic-class.c b/gjs/jsapi-dynamic-class.c
  606. index d2648d8..e0df4dc 100644
  607. --- a/gjs/jsapi-dynamic-class.c
  608. +++ b/gjs/jsapi-dynamic-class.c
  609. @@ -184,7 +184,7 @@ gjs_typecheck_instance(JSContext *context,
  610.  {
  611.      if (!JS_InstanceOf(context, obj, static_clasp, NULL)) {
  612.          if (throw) {
  613. -            JSClass *obj_class = JS_GET_CLASS(context, obj);
  614. +            JSClass *obj_class = JS_GetClass(obj);
  615.  
  616.              gjs_throw_custom(context, "TypeError",
  617.                               "Object %p is not a subclass of %s, it's a %s",
  618. diff --git a/gjs/jsapi-util.c b/gjs/jsapi-util.c
  619. index 3a4c658..7c9ca02 100644
  620. --- a/gjs/jsapi-util.c
  621. +++ b/gjs/jsapi-util.c
  622. @@ -220,7 +220,7 @@ gjs_throw_abstract_constructor_error(JSContext *context,
  623.      if (JSVAL_IS_OBJECT(callee)) {
  624.          if (gjs_object_get_property(context, JSVAL_TO_OBJECT(callee),
  625.                                      "prototype", &prototype)) {
  626. -            proto_class = JS_GetClass(context, JSVAL_TO_OBJECT(prototype));
  627. +            proto_class = JS_GetClass(JSVAL_TO_OBJECT(prototype));
  628.              name = proto_class->name;
  629.          }
  630.      }
  631. @@ -348,7 +348,7 @@ gjs_value_debug_string(JSContext      *context,
  632.               */
  633.              JSClass *klass;
  634.  
  635. -            klass = JS_GET_CLASS(context, JSVAL_TO_OBJECT(value));
  636. +            klass = JS_GetClass(JSVAL_TO_OBJECT(value));
  637.              if (klass != NULL) {
  638.                  str = JS_NewStringCopyZ(context, klass->name);
  639.                  JS_ClearPendingException(context);
  640. @@ -814,26 +814,22 @@ gjs_date_from_time_t (JSContext *context, time_t time)
  641.      if (!JS_EnterLocalRootScope(context))
  642.          return JSVAL_VOID;
  643.  
  644. -    if (!JS_GetClassObject(context, JS_GetGlobalObject(context), JSProto_Date,
  645. +    if (!JS_GetClassObject(contect, JS_GetGlobalObject(context), JSProto_Date,
  646.                             &date_constructor))
  647.          gjs_fatal("Failed to lookup Date prototype");
  648.  
  649.      if (!JS_GetProperty(context, date_constructor, "prototype", &date_prototype))
  650.          gjs_fatal("Failed to get prototype from Date constructor");
  651.  
  652. -    date_class = JS_GET_CLASS(context, JSVAL_TO_OBJECT (date_prototype));
  653. -
  654.      args[0] = JS_NumberValue(((double) time) * 1000);
  655.      if (!JSVAL_IS_NUMBER(args[0]))
  656.          gjs_fatal("Failed to convert time_t to number");
  657.  
  658. -    date = JS_ConstructObjectWithArguments(context, date_class,
  659. -                                           NULL, NULL, 1, args);
  660. -
  661. +    date = JS_New(context, JSVAL_TO_OBJECT (date_prototype), 1, args);
  662. +    
  663.      result = OBJECT_TO_JSVAL(date);
  664.      JS_LeaveLocalRootScope(context);
  665. -    JS_EndRequest(context);
  666. -
  667. +    JS_EndRequest(context);
  668.      return result;
  669.  }
  670.  
  671. diff --git a/gjs/stack.c b/gjs/stack.c
  672. index 54317d6..aec76ed 100644
  673. --- a/gjs/stack.c
  674. +++ b/gjs/stack.c
  675. @@ -68,7 +68,7 @@ jsvalue_to_string(JSContext* cx, jsval val, gboolean* is_string)
  676.     if (!value_str)
  677.       value = g_strdup("[unknown function]");
  678.        } else {
  679. -   value = g_strdup_printf("[object %s]", JS_GetClass(cx, obj)->name);
  680. +   value = g_strdup_printf("[object %s]", JS_GetClass(obj)->name);
  681.        }
  682.      }
  683.  
  684. --
  685. 1.8.0
  686.  
  687.  
  688. From 6f035d6118002eaef64c0581d70e9e6773ca4038 Mon Sep 17 00:00:00 2001
  689. From: Tim Lunn <tim@feathertop.org>
  690. Date: Thu, 3 Jan 2013 15:08:19 +1100
  691. Subject: [PATCH 06/10] JS_SetPrivate/GetPrivate no longer require context
  692.  argument
  693.  
  694. ---
  695. gi/boxed.c                | 43 +++++++++++++++++++++----------------------
  696.  gi/function.c             | 13 ++++++-------
  697.  gi/gerror.c               |  8 ++++----
  698.  gi/gtype.c                |  8 ++++----
  699.  gi/interface.c            | 14 +++++++-------
  700.  gi/keep-alive.c           |  4 ++--
  701.  gi/ns.c                   | 16 ++++++++--------
  702.  gi/object.c               | 46 +++++++++++++++++++++++-----------------------
  703.  gi/param.c                | 10 +++++-----
  704.  gi/repo.c                 | 14 +++++++-------
  705.  gi/union.c                | 20 ++++++++++----------
  706.  gjs/byteArray.c           | 24 ++++++++++++------------
  707.  gjs/importer.c            | 25 ++++++++++++-------------
  708.  gjs/jsapi-dynamic-class.c |  2 +-
  709.  gjs/jsapi-util.c          | 10 +++++-----
  710.  modules/cairo-context.c   |  2 +-
  711.  modules/cairo-path.c      |  6 +++---
  712.  modules/cairo-pattern.c   |  6 +++---
  713.  modules/cairo-surface.c   |  6 +++---
  714.  19 files changed, 137 insertions(+), 140 deletions(-)
  715.  
  716. diff --git a/gi/boxed.c b/gi/boxed.c
  717. index bbea2c7..2d26301 100644
  718. --- a/gi/boxed.c
  719. +++ b/gi/boxed.c
  720. @@ -116,8 +116,8 @@ gjs_define_static_methods(JSContext    *context,
  721.   */
  722.  static JSBool
  723.  boxed_new_resolve(JSContext *context,
  724. -                  JSObject  *obj,
  725. -                  jsid       id,
  726. +                  JSObject  **obj,
  727. +                  jsid       *id,
  728.                    unsigned   flags,
  729.                    JSObject **objp)
  730.  {
  731. @@ -127,11 +127,11 @@ boxed_new_resolve(JSContext *context,
  732.  
  733.      *objp = NULL;
  734.  
  735. -    if (!gjs_get_string_id(context, id, &name))
  736. +    if (!gjs_get_string_id(context, *id, &name))
  737.          return JS_TRUE; /* not resolved, but no error */
  738.  
  739. -    priv = priv_from_js(context, obj);
  740. -    gjs_debug_jsprop(GJS_DEBUG_GBOXED, "Resolve prop '%s' hook obj %p priv %p", name, obj, priv);
  741. +    priv = priv_from_js(context, *obj);
  742. +    gjs_debug_jsprop(GJS_DEBUG_GBOXED, "Resolve prop '%s' hook obj %p priv %p", name, *obj, priv);
  743.  
  744.      if (priv == NULL)
  745.          goto out; /* wrong class */
  746. @@ -159,7 +159,7 @@ boxed_new_resolve(JSContext *context,
  747.                        g_base_info_get_namespace( (GIBaseInfo*) priv->info),
  748.                        g_base_info_get_name( (GIBaseInfo*) priv->info));
  749.  
  750. -            boxed_proto = obj;
  751. +            boxed_proto = *obj;
  752.  
  753.              if (gjs_define_function(context, boxed_proto, priv->gtype,
  754.                                      (GICallableInfo *)method_info) == NULL) {
  755. @@ -443,13 +443,13 @@ GJS_NATIVE_CONSTRUCTOR_DECLARE(boxed)
  756.      GJS_INC_COUNTER(boxed);
  757.  
  758.      g_assert(priv_from_js(context, object) == NULL);
  759. -    JS_SetPrivate(context, object, priv);
  760. +    JS_SetPrivate(object, priv);
  761.  
  762.      gjs_debug_lifecycle(GJS_DEBUG_GBOXED,
  763.                          "boxed constructor, obj %p priv %p",
  764.                          object, priv);
  765.  
  766. -    proto = JS_GetPrototype(context, object);
  767. +    proto = JS_GetPrototype(object);
  768.      gjs_debug_lifecycle(GJS_DEBUG_GBOXED, "boxed instance __proto__ is %p", proto);
  769.      /* If we're the prototype, then post-construct we'll fill in priv->info.
  770.       * If we are not the prototype, though, then we'll get ->info from the
  771. @@ -606,7 +606,7 @@ get_nested_interface_object (JSContext   *context,
  772.  
  773.      GJS_INC_COUNTER(boxed);
  774.      priv = g_slice_new0(Boxed);
  775. -    JS_SetPrivate(context, obj, priv);
  776. +    JS_SetPrivate(obj, priv);
  777.      priv->info = (GIBoxedInfo*) interface_info;
  778.      g_base_info_ref( (GIBaseInfo*) priv->info);
  779.      priv->gtype = g_registered_type_info_get_g_type ((GIRegisteredTypeInfo*) interface_info);
  780. @@ -619,7 +619,7 @@ get_nested_interface_object (JSContext   *context,
  781.      /* We never actually read the reserved slot, but we put the parent object
  782.       * into it to hold onto the parent object.
  783.       */
  784. -    JS_SetReservedSlot(context, obj, 0,
  785. +    JS_SetReservedSlot(obj, 0,
  786.                         OBJECT_TO_JSVAL (parent_obj));
  787.  
  788.      *value = OBJECT_TO_JSVAL(obj);
  789. @@ -628,8 +628,8 @@ get_nested_interface_object (JSContext   *context,
  790.  
  791.  static JSBool
  792.  boxed_field_getter (JSContext *context,
  793. -                    JSObject  *obj,
  794. -                    jsid       id,
  795. +                    JSObject  **obj,
  796. +                    jsid       *id,
  797.                      jsval     *value)
  798.  {
  799.      Boxed *priv;
  800. @@ -638,11 +638,11 @@ boxed_field_getter (JSContext *context,
  801.      GArgument arg;
  802.      gboolean success = FALSE;
  803.  
  804. -    priv = priv_from_js(context, obj);
  805. +    priv = priv_from_js(context, *obj);
  806.      if (!priv)
  807.          return JS_FALSE;
  808.  
  809. -    field_info = get_field_info(context, priv, id);
  810. +    field_info = get_field_info(context, priv, *id);
  811.      if (!field_info)
  812.          return JS_FALSE;
  813.  
  814. @@ -663,7 +663,7 @@ boxed_field_getter (JSContext *context,
  815.          if (g_base_info_get_type (interface_info) == GI_INFO_TYPE_STRUCT ||
  816.              g_base_info_get_type (interface_info) == GI_INFO_TYPE_BOXED) {
  817.  
  818. -            success = get_nested_interface_object (context, obj, priv,
  819. +            success = get_nested_interface_object (context, *obj, priv,
  820.                                                     field_info, type_info, interface_info,
  821.                                                     value);
  822.  
  823. @@ -808,8 +808,8 @@ out:
  824.  
  825.  static JSBool
  826.  boxed_field_setter (JSContext *context,
  827. -                    JSObject  *obj,
  828. -                    jsid       id,
  829. +                    JSObject  **obj,
  830. +                    jsid       *id,
  831.                      JSBool     strict,
  832.                      jsval     *value)
  833.  {
  834. @@ -817,11 +817,10 @@ boxed_field_setter (JSContext *context,
  835.      GIFieldInfo *field_info;
  836.      gboolean success = FALSE;
  837.  
  838. -    priv = priv_from_js(context, obj);
  839. +    priv = priv_from_js(context, *obj);
  840.      if (!priv)
  841.          return JS_FALSE;
  842. -
  843. -    field_info = get_field_info(context, priv, id);
  844. +    field_info = get_field_info(context, priv, *id);
  845.      if (!field_info)
  846.          return JS_FALSE;
  847.  
  848. @@ -1239,7 +1238,7 @@ gjs_define_boxed_class(JSContext    *context,
  849.  
  850.      g_base_info_ref( (GIBaseInfo*) priv->info);
  851.      priv->gtype = g_registered_type_info_get_g_type ((GIRegisteredTypeInfo*) priv->info);
  852. -    JS_SetPrivate(context, prototype, priv);
  853. +    JS_SetPrivate(prototype, priv);
  854.  
  855.      gjs_debug(GJS_DEBUG_GBOXED, "Defined class %s prototype is %p class %p in object %p",
  856.                constructor_name, prototype, JS_GetClass(prototype), in_object);
  857. @@ -1293,7 +1292,7 @@ gjs_boxed_from_c_struct(JSContext             *context,
  858.      *priv = *proto_priv;
  859.      g_base_info_ref( (GIBaseInfo*) priv->info);
  860.  
  861. -    JS_SetPrivate(context, obj, priv);
  862. +    JS_SetPrivate(obj, priv);
  863.  
  864.      if ((flags & GJS_BOXED_CREATION_NO_COPY) != 0) {
  865.          /* we need to create a JS Boxed which references the
  866. diff --git a/gi/function.c b/gi/function.c
  867. index a37fb85..4b2f89c 100644
  868. --- a/gi/function.c
  869. +++ b/gi/function.c
  870. @@ -1242,15 +1242,15 @@ function_finalize(JSContext *context,
  871.  
  872.  static JSBool
  873.  get_num_arguments (JSContext *context,
  874. -                   JSObject  *obj,
  875. -                   jsid       id,
  876. +                   JSObject  **obj,
  877. +                   jsid       *id,
  878.                     jsval     *vp)
  879.  {
  880.      int n_args, n_jsargs, i;
  881.      jsval retval;
  882.      Function *priv;
  883.  
  884. -    priv = priv_from_js(context, obj);
  885. +    priv = priv_from_js(context, *obj);
  886.  
  887.      if (priv == NULL)
  888.          return JS_FALSE;
  889. @@ -1366,9 +1366,8 @@ static struct JSClass gjs_function_class = {
  890.      JS_ConvertStub,
  891.      function_finalize,
  892.      NULL,
  893. -    NULL,
  894.      function_call,
  895. -    NULL, NULL, NULL, NULL, NULL
  896. +    NULL, NULL
  897.  };
  898.  
  899.  static JSPropertySpec gjs_function_proto_props[] = {
  900. @@ -1549,7 +1548,7 @@ function_new(JSContext      *context,
  901.  
  902.          JS_GetProperty(context, global, "Function", &native_function);
  903.          /* We take advantage from that fact that Function.__proto__ is Function.prototype */
  904. -        parent_proto = JS_GetPrototype(context, JSVAL_TO_OBJECT(native_function));
  905. +        parent_proto = JS_GetPrototype(JSVAL_TO_OBJECT(native_function));
  906.  
  907.          prototype = JS_InitClass(context, global,
  908.                                   /* parent prototype JSObject* for
  909. @@ -1594,7 +1593,7 @@ function_new(JSContext      *context,
  910.      GJS_INC_COUNTER(function);
  911.  
  912.      g_assert(priv_from_js(context, function) == NULL);
  913. -    JS_SetPrivate(context, function, priv);
  914. +    JS_SetPrivate(function, priv);
  915.  
  916.      gjs_debug_lifecycle(GJS_DEBUG_GFUNCTION,
  917.                          "function constructor, obj %p priv %p", function, priv);
  918. diff --git a/gi/gerror.c b/gi/gerror.c
  919. index ea36b18..5fd12b6 100644
  920. --- a/gi/gerror.c
  921. +++ b/gi/gerror.c
  922. @@ -77,13 +77,13 @@ GJS_NATIVE_CONSTRUCTOR_DECLARE(error)
  923.      GJS_INC_COUNTER(gerror);
  924.  
  925.      g_assert(priv_from_js(context, object) == NULL);
  926. -    JS_SetPrivate(context, object, priv);
  927. +    JS_SetPrivate(object, priv);
  928.  
  929.      gjs_debug_lifecycle(GJS_DEBUG_GERROR,
  930.                          "GError constructor, obj %p priv %p",
  931.                          object, priv);
  932.  
  933. -    proto = JS_GetPrototype(context, object);
  934. +    proto = JS_GetPrototype(object);
  935.      gjs_debug_lifecycle(GJS_DEBUG_GERROR, "GError instance __proto__ is %p", proto);
  936.  
  937.      /* If we're the prototype, then post-construct we'll fill in priv->info.
  938. @@ -460,7 +460,7 @@ gjs_define_error_class(JSContext    *context,
  939.      g_base_info_ref( (GIBaseInfo*) priv->info);
  940.      priv->domain = g_quark_from_string (g_enum_info_get_error_domain(priv->info));
  941.  
  942. -    JS_SetPrivate(context, prototype, priv);
  943. +    JS_SetPrivate(prototype, priv);
  944.  
  945.      gjs_debug(GJS_DEBUG_GBOXED, "Defined class %s prototype is %p class %p in object %p",
  946.                constructor_name, prototype, JS_GetClass(prototype), in_object);
  947. @@ -595,7 +595,7 @@ gjs_error_from_gerror(JSContext             *context,
  948.  
  949.      GJS_INC_COUNTER(gerror);
  950.      priv = g_slice_new0(Error);
  951. -    JS_SetPrivate(context, obj, priv);
  952. +    JS_SetPrivate(obj, priv);
  953.      priv->info = info;
  954.      priv->domain = proto_priv->domain;
  955.      g_base_info_ref( (GIBaseInfo*) priv->info);
  956. diff --git a/gi/gtype.c b/gi/gtype.c
  957. index ba3954c..eb8a410 100644
  958. --- a/gi/gtype.c
  959. +++ b/gi/gtype.c
  960. @@ -85,15 +85,15 @@ to_string_func(JSContext *context,
  961.  
  962.  static JSBool
  963.  get_name_func (JSContext *context,
  964. -               JSObject  *obj,
  965. -               jsid       id,
  966. +               JSObject  **obj,
  967. +               jsid       *id,
  968.                 jsval     *vp)
  969.  {
  970.      GType gtype;
  971.      JSBool ret;
  972.      jsval retval;
  973.  
  974. -    gtype = GPOINTER_TO_SIZE(priv_from_js(context, obj));
  975. +    gtype = GPOINTER_TO_SIZE(priv_from_js(context, *obj));
  976.  
  977.      ret = gjs_string_from_utf8(context, g_type_name(gtype), -1, &retval);
  978.      if (ret)
  979. @@ -134,7 +134,7 @@ gjs_gtype_create_gtype_wrapper (JSContext *context,
  980.      if (object == NULL)
  981.          goto out;
  982.  
  983. -    JS_SetPrivate(context, object, GSIZE_TO_POINTER(gtype));
  984. +    JS_SetPrivate(object, GSIZE_TO_POINTER(gtype));
  985.      g_type_set_qdata(gtype, gjs_get_gtype_wrapper_quark(), object);
  986.  
  987.   out:
  988. diff --git a/gi/interface.c b/gi/interface.c
  989. index 43d7019..d223c3c 100644
  990. --- a/gi/interface.c
  991. +++ b/gi/interface.c
  992. @@ -100,8 +100,8 @@ gjs_define_static_methods(JSContext       *context,
  993.  
  994.  static JSBool
  995.  interface_new_resolve(JSContext *context,
  996. -                      JSObject  *obj,
  997. -                      jsid       id,
  998. +                      JSObject  **obj,
  999. +                      jsid      *id,
  1000.                        unsigned   flags,
  1001.                        JSObject **objp)
  1002.  {
  1003. @@ -112,10 +112,10 @@ interface_new_resolve(JSContext *context,
  1004.  
  1005.      *objp = NULL;
  1006.  
  1007. -    if (!gjs_get_string_id(context, id, &name))
  1008. +    if (!gjs_get_string_id(context, *id, &name))
  1009.          return JS_TRUE;
  1010.  
  1011. -    priv = priv_from_js(context, obj);
  1012. +    priv = priv_from_js(context, *obj);
  1013.  
  1014.      if (priv == NULL)
  1015.          goto out;
  1016. @@ -123,14 +123,14 @@ interface_new_resolve(JSContext *context,
  1017.      method_info = g_interface_info_find_method((GIInterfaceInfo*) priv->info, name);
  1018.  
  1019.      if (method_info != NULL) {
  1020. -        if (gjs_define_function(context, obj,
  1021. +        if (gjs_define_function(context, *obj,
  1022.                                  priv->gtype,
  1023.                                  (GICallableInfo*)method_info) == NULL) {
  1024.              g_base_info_unref((GIBaseInfo*)method_info);
  1025.              goto out;
  1026.          }
  1027.  
  1028. -        *objp = obj;
  1029. +        *objp = *obj;
  1030.          g_base_info_unref((GIBaseInfo*)method_info);
  1031.      }
  1032.  
  1033. @@ -231,7 +231,7 @@ gjs_define_interface_class(JSContext       *context,
  1034.      priv->info = info;
  1035.      priv->gtype = g_registered_type_info_get_g_type(priv->info);
  1036.      g_base_info_ref((GIBaseInfo*)priv->info);
  1037. -    JS_SetPrivate(context, prototype, priv);
  1038. +    JS_SetPrivate(prototype, priv);
  1039.  
  1040.      gjs_define_static_methods(context, constructor, priv->gtype, priv->info);
  1041.  
  1042. diff --git a/gi/keep-alive.c b/gi/keep-alive.c
  1043. index 581c9ad..ce56e35 100644
  1044. --- a/gi/keep-alive.c
  1045. +++ b/gi/keep-alive.c
  1046. @@ -133,7 +133,7 @@ keep_alive_trace(JSTracer *tracer,
  1047.  {
  1048.      KeepAlive *priv;
  1049.  
  1050. -    priv = JS_GetPrivate(tracer->context, obj);
  1051. +    priv = JS_GetPrivate(obj);
  1052.  
  1053.      if (priv == NULL) /* prototype */
  1054.          return;
  1055. @@ -251,7 +251,7 @@ gjs_keep_alive_new(JSContext *context)
  1056.      priv->children = g_hash_table_new_full(child_hash, child_equal, NULL, child_free);
  1057.  
  1058.      g_assert(priv_from_js(context, keep_alive) == NULL);
  1059. -    JS_SetPrivate(context, keep_alive, priv);
  1060. +    JS_SetPrivate(keep_alive, priv);
  1061.  
  1062.      gjs_debug_lifecycle(GJS_DEBUG_KEEP_ALIVE,
  1063.                          "keep_alive constructor, obj %p priv %p", keep_alive, priv);
  1064. diff --git a/gi/ns.c b/gi/ns.c
  1065. index 9bf7ef2..8a2d811 100644
  1066. --- a/gi/ns.c
  1067. +++ b/gi/ns.c
  1068. @@ -59,8 +59,8 @@ GJS_DEFINE_PRIV_FROM_JS(Ns, gjs_ns_class)
  1069.   */
  1070.  static JSBool
  1071.  ns_new_resolve(JSContext *context,
  1072. -               JSObject  *obj,
  1073. -               jsid       id,
  1074. +               JSObject  **obj,
  1075. +               jsid      *id,
  1076.                 unsigned   flags,
  1077.                 JSObject **objp)
  1078.  {
  1079. @@ -72,7 +72,7 @@ ns_new_resolve(JSContext *context,
  1080.  
  1081.      *objp = NULL;
  1082.  
  1083. -    if (!gjs_get_string_id(context, id, &name))
  1084. +    if (!gjs_get_string_id(context, *id, &name))
  1085.          return JS_TRUE; /* not resolved, but no error */
  1086.  
  1087.      /* let Object.prototype resolve these */
  1088. @@ -82,8 +82,8 @@ ns_new_resolve(JSContext *context,
  1089.          goto out;
  1090.      }
  1091.  
  1092. -    priv = priv_from_js(context, obj);
  1093. -    gjs_debug_jsprop(GJS_DEBUG_GNAMESPACE, "Resolve prop '%s' hook obj %p priv %p", name, obj, priv);
  1094. +    priv = priv_from_js(context, *obj);
  1095. +    gjs_debug_jsprop(GJS_DEBUG_GNAMESPACE, "Resolve prop '%s' hook obj %p priv %p", name, *obj, priv);
  1096.  
  1097.      if (priv == NULL) {
  1098.          ret = JS_TRUE; /* we are the prototype, or have the wrong class */
  1099. @@ -108,9 +108,9 @@ ns_new_resolve(JSContext *context,
  1100.                g_base_info_get_name(info),
  1101.                g_base_info_get_namespace(info));
  1102.  
  1103. -    if (gjs_define_info(context, obj, info)) {
  1104. +    if (gjs_define_info(context, *obj, info)) {
  1105.          g_base_info_unref(info);
  1106. -        *objp = obj; /* we defined the property in this object */
  1107. +        *objp = *obj; /* we defined the property in this object */
  1108.          ret = JS_TRUE;
  1109.      } else {
  1110.          gjs_debug(GJS_DEBUG_GNAMESPACE,
  1111. @@ -230,7 +230,7 @@ ns_new(JSContext    *context,
  1112.      GJS_INC_COUNTER(ns);
  1113.  
  1114.      g_assert(priv_from_js(context, ns) == NULL);
  1115. -    JS_SetPrivate(context, ns, priv);
  1116. +    JS_SetPrivate(ns, priv);
  1117.  
  1118.      gjs_debug_lifecycle(GJS_DEBUG_GNAMESPACE, "ns constructor, obj %p priv %p", ns, priv);
  1119.  
  1120. diff --git a/gi/object.c b/gi/object.c
  1121. index 04c7a1a..7d24bae 100644
  1122. --- a/gi/object.c
  1123. +++ b/gi/object.c
  1124. @@ -212,7 +212,7 @@ static inline ObjectInstance *
  1125.  proto_priv_from_js(JSContext *context,
  1126.                     JSObject  *obj)
  1127.  {
  1128. -    return priv_from_js(context, JS_GetPrototype(context, obj));
  1129. +    return priv_from_js(context, JS_GetPrototype(obj));
  1130.  }
  1131.  
  1132.  /* a hook on getting a property; set value_p to override property's value.
  1133. @@ -220,8 +220,8 @@ proto_priv_from_js(JSContext *context,
  1134.   */
  1135.  static JSBool
  1136.  object_instance_get_prop(JSContext *context,
  1137. -                         JSObject  *obj,
  1138. -                         jsid       id,
  1139. +                         JSObject  **obj,
  1140. +                         jsid       *id,
  1141.                           jsval     *value_p)
  1142.  {
  1143.      ObjectInstance *priv;
  1144. @@ -231,10 +231,10 @@ object_instance_get_prop(JSContext *context,
  1145.      GValue gvalue = { 0, };
  1146.      JSBool ret = JS_TRUE;
  1147.  
  1148. -    if (!gjs_get_string_id(context, id, &name))
  1149. +    if (!gjs_get_string_id(context, *id, &name))
  1150.          return JS_TRUE; /* not resolved, but no error */
  1151.  
  1152. -    priv = priv_from_js(context, obj);
  1153. +    priv = priv_from_js(context, *obj);
  1154.      gjs_debug_jsprop(GJS_DEBUG_GOBJECT,
  1155.                       "Get prop '%s' hook obj %p priv %p", name, obj, priv);
  1156.  
  1157. @@ -289,8 +289,8 @@ object_instance_get_prop(JSContext *context,
  1158.   */
  1159.  static JSBool
  1160.  object_instance_set_prop(JSContext *context,
  1161. -                         JSObject  *obj,
  1162. -                         jsid       id,
  1163. +                         JSObject  **obj,
  1164. +                         jsid       *id,
  1165.                           JSBool     strict,
  1166.                           jsval     *value_p)
  1167.  {
  1168. @@ -299,10 +299,10 @@ object_instance_set_prop(JSContext *context,
  1169.      GParameter param = { NULL, { 0, }};
  1170.      JSBool ret = JS_TRUE;
  1171.  
  1172. -    if (!gjs_get_string_id(context, id, &name))
  1173. +    if (!gjs_get_string_id(context, *id, &name))
  1174.          return JS_TRUE; /* not resolved, but no error */
  1175.  
  1176. -    priv = priv_from_js(context, obj);
  1177. +    priv = priv_from_js(context, *obj);
  1178.      gjs_debug_jsprop(GJS_DEBUG_GOBJECT,
  1179.                       "Set prop '%s' hook obj %p priv %p", name, obj, priv);
  1180.  
  1181. @@ -397,7 +397,7 @@ find_vfunc_on_parent(GIObjectInfo *info,
  1182.  
  1183.  static JSBool
  1184.  object_instance_new_resolve_no_info(JSContext       *context,
  1185. -                                    JSObject        *obj,
  1186. +                                    JSObject       *obj,
  1187.                                      JSObject       **objp,
  1188.                                      ObjectInstance  *priv,
  1189.                                      char            *name)
  1190. @@ -461,8 +461,8 @@ object_instance_new_resolve_no_info(JSContext       *context,
  1191.   */
  1192.  static JSBool
  1193.  object_instance_new_resolve(JSContext *context,
  1194. -                            JSObject  *obj,
  1195. -                            jsid       id,
  1196. +                            JSObject  **obj,
  1197. +                            jsid      *id,
  1198.                              unsigned   flags,
  1199.                              JSObject **objp)
  1200.  {
  1201. @@ -473,15 +473,15 @@ object_instance_new_resolve(JSContext *context,
  1202.  
  1203.      *objp = NULL;
  1204.  
  1205. -    if (!gjs_get_string_id(context, id, &name))
  1206. +    if (!gjs_get_string_id(context, *id, &name))
  1207.          return JS_TRUE; /* not resolved, but no error */
  1208.  
  1209. -    priv = priv_from_js(context, obj);
  1210. +    priv = priv_from_js(context, *obj);
  1211.  
  1212.      gjs_debug_jsprop(GJS_DEBUG_GOBJECT,
  1213.                       "Resolve prop '%s' hook obj %p priv %p (%s.%s) gobj %p %s",
  1214.                       name,
  1215. -                     obj,
  1216. +                     *obj,
  1217.                       priv,
  1218.                       priv && priv->info ? g_base_info_get_namespace (priv->info) : "",
  1219.                       priv && priv->info ? g_base_info_get_name (priv->info) : "",
  1220. @@ -510,7 +510,7 @@ object_instance_new_resolve(JSContext *context,
  1221.       * we need to look at exposing interfaces. Look up our interfaces through
  1222.       * GType data, and then hope that *those* are introspectable. */
  1223.      if (priv->info == NULL) {
  1224. -        ret = object_instance_new_resolve_no_info(context, obj, objp, priv, name);
  1225. +        ret = object_instance_new_resolve_no_info(context, *obj, objp, priv, name);
  1226.          goto out;
  1227.      }
  1228.  
  1229. @@ -543,7 +543,7 @@ object_instance_new_resolve(JSContext *context,
  1230.              }
  1231.  
  1232.              gjs_define_function(context, obj, priv->gtype, vfunc);
  1233. -            *objp = obj;
  1234. +            *objp = *obj;
  1235.              g_base_info_unref((GIBaseInfo *)vfunc);
  1236.              ret = JS_TRUE;
  1237.              goto out;
  1238. @@ -574,7 +574,7 @@ object_instance_new_resolve(JSContext *context,
  1239.       * https://bugzilla.gnome.org/show_bug.cgi?id=632922
  1240.       */
  1241.      if (method_info == NULL) {
  1242. -        ret = object_instance_new_resolve_no_info(context, obj, objp,
  1243. +        ret = object_instance_new_resolve_no_info(context, *obj, objp,
  1244.                                                    priv, name);
  1245.          goto out;
  1246.      } else {
  1247. @@ -589,12 +589,12 @@ object_instance_new_resolve(JSContext *context,
  1248.                    g_base_info_get_namespace( (GIBaseInfo*) priv->info),
  1249.                    g_base_info_get_name( (GIBaseInfo*) priv->info));
  1250.  
  1251. -        if (gjs_define_function(context, obj, priv->gtype, method_info) == NULL) {
  1252. +        if (gjs_define_function(context, *obj, priv->gtype, method_info) == NULL) {
  1253.              g_base_info_unref( (GIBaseInfo*) method_info);
  1254.              goto out;
  1255.          }
  1256.  
  1257. -        *objp = obj; /* we defined the prop in obj */
  1258. +        *objp = *obj; /* we defined the prop in obj */
  1259.  
  1260.          g_base_info_unref( (GIBaseInfo*) method_info);
  1261.      }
  1262. @@ -838,7 +838,7 @@ init_object_private (JSContext *context,
  1263.      GJS_INC_COUNTER(object);
  1264.  
  1265.      g_assert(priv_from_js(context, object) == NULL);
  1266. -    JS_SetPrivate(context, object, priv);
  1267. +    JS_SetPrivate(object, priv);
  1268.  
  1269.      gjs_debug_lifecycle(GJS_DEBUG_GOBJECT,
  1270.                          "obj instance constructor, obj %p priv %p", object, priv);
  1271. @@ -1026,7 +1026,7 @@ object_instance_trace(JSTracer *tracer,
  1272.      ObjectInstance *priv;
  1273.      GList *iter;
  1274.  
  1275. -    priv = JS_GetPrivate(tracer->context, obj);
  1276. +    priv = JS_GetPrivate(obj);
  1277.  
  1278.      for (iter = priv->signals; iter; iter = iter->next) {
  1279.          ConnectData *cd = iter->data;
  1280. @@ -1689,7 +1689,7 @@ gjs_define_object_class(JSContext     *context,
  1281.          g_base_info_ref( (GIBaseInfo*) priv->info);
  1282.      priv->gtype = gtype;
  1283.      priv->klass = g_type_class_ref (gtype);
  1284. -    JS_SetPrivate(context, prototype, priv);
  1285. +    JS_SetPrivate(prototype, priv);
  1286.  
  1287.      gjs_debug(GJS_DEBUG_GOBJECT, "Defined class %s prototype %p class %p in object %p",
  1288.                constructor_name, prototype, JS_GetClass(prototype), in_object);
  1289. diff --git a/gi/param.c b/gi/param.c
  1290. index 8e6d67d..e305351 100644
  1291. --- a/gi/param.c
  1292. +++ b/gi/param.c
  1293. @@ -68,8 +68,8 @@ find_field_info(GIObjectInfo *info,
  1294.   */
  1295.  static JSBool
  1296.  param_get_prop(JSContext *context,
  1297. -               JSObject  *obj,
  1298. -               jsid       id,
  1299. +               JSObject  **obj,
  1300. +               jsid       *id,
  1301.                 jsval     *value_p)
  1302.  {
  1303.      JSBool success;
  1304. @@ -82,10 +82,10 @@ param_get_prop(JSContext *context,
  1305.      GITypeInfo *type_info = NULL;
  1306.      GIArgument arg;
  1307.  
  1308. -    if (!gjs_get_string_id(context, id, &name))
  1309. +    if (!gjs_get_string_id(context, *id, &name))
  1310.          return JS_TRUE; /* not something we affect, but no error */
  1311.  
  1312. -    priv = priv_from_js(context, obj);
  1313. +    priv = priv_from_js(context, *obj);
  1314.  
  1315.      if (priv == NULL) {
  1316.          g_free(name);
  1317. @@ -566,7 +566,7 @@ gjs_param_from_g_param(JSContext    *context,
  1318.  
  1319.      GJS_INC_COUNTER(param);
  1320.      priv = g_slice_new0(Param);
  1321. -    JS_SetPrivate(context, obj, priv);
  1322. +    JS_SetPrivate(obj, priv);
  1323.      priv->gparam = gparam;
  1324.      g_param_spec_ref (gparam);
  1325.  
  1326. diff --git a/gi/repo.c b/gi/repo.c
  1327. index 86dcd19..ec7d713 100644
  1328. --- a/gi/repo.c
  1329. +++ b/gi/repo.c
  1330. @@ -156,8 +156,8 @@ resolve_namespace_object(JSContext  *context,
  1331.   */
  1332.  static JSBool
  1333.  repo_new_resolve(JSContext *context,
  1334. -                 JSObject  *obj,
  1335. -                 jsid       id,
  1336. +                 JSObject **obj,
  1337. +                 jsid      *id,
  1338.                   unsigned   flags,
  1339.                   JSObject **objp)
  1340.  {
  1341. @@ -167,7 +167,7 @@ repo_new_resolve(JSContext *context,
  1342.  
  1343.      *objp = NULL;
  1344.  
  1345. -    if (!gjs_get_string_id(context, id, &name))
  1346. +    if (!gjs_get_string_id(context, *id, &name))
  1347.          return JS_TRUE; /* not resolved, but no error */
  1348.  
  1349.      /* let Object.prototype resolve these */
  1350. @@ -175,17 +175,17 @@ repo_new_resolve(JSContext *context,
  1351.          strcmp(name, "toString") == 0)
  1352.          goto out;
  1353.  
  1354. -    priv = priv_from_js(context, obj);
  1355. +    priv = priv_from_js(context, *obj);
  1356.      gjs_debug_jsprop(GJS_DEBUG_GREPO, "Resolve prop '%s' hook obj %p priv %p", name, obj, priv);
  1357.  
  1358.      if (priv == NULL) /* we are the prototype, or have the wrong class */
  1359.          goto out;
  1360.  
  1361.      JS_BeginRequest(context);
  1362. -    if (resolve_namespace_object(context, obj, name) == NULL) {
  1363. +    if (resolve_namespace_object(context, *obj, name) == NULL) {
  1364.          ret = JS_FALSE;
  1365.      } else {
  1366. -        *objp = obj; /* store the object we defined the prop in */
  1367. +        *objp = *obj; /* store the object we defined the prop in */
  1368.      }
  1369.      JS_EndRequest(context);
  1370.  
  1371. @@ -293,7 +293,7 @@ repo_new(JSContext *context)
  1372.      GJS_INC_COUNTER(repo);
  1373.  
  1374.      g_assert(priv_from_js(context, repo) == NULL);
  1375. -    JS_SetPrivate(context, repo, priv);
  1376. +    JS_SetPrivate(repo, priv);
  1377.  
  1378.      gjs_debug_lifecycle(GJS_DEBUG_GREPO,
  1379.                          "repo constructor, obj %p priv %p", repo, priv);
  1380. diff --git a/gi/union.c b/gi/union.c
  1381. index bfd7501..e6ad2ff 100644
  1382. --- a/gi/union.c
  1383. +++ b/gi/union.c
  1384. @@ -64,8 +64,8 @@ GJS_DEFINE_PRIV_FROM_JS(Union, gjs_union_class)
  1385.   */
  1386.  static JSBool
  1387.  union_new_resolve(JSContext *context,
  1388. -                  JSObject  *obj,
  1389. -                  jsid       id,
  1390. +                  JSObject **obj,
  1391. +                  jsid      *id,
  1392.                    unsigned   flags,
  1393.                    JSObject **objp)
  1394.  {
  1395. @@ -75,11 +75,11 @@ union_new_resolve(JSContext *context,
  1396.  
  1397.      *objp = NULL;
  1398.  
  1399. -    if (!gjs_get_string_id(context, id, &name))
  1400. +    if (!gjs_get_string_id(context, *id, &name))
  1401.          return JS_TRUE; /* not resolved, but no error */
  1402.  
  1403. -    priv = priv_from_js(context, obj);
  1404. -    gjs_debug_jsprop(GJS_DEBUG_GBOXED, "Resolve prop '%s' hook obj %p priv %p", name, obj, priv);
  1405. +    priv = priv_from_js(context, *obj);
  1406. +    gjs_debug_jsprop(GJS_DEBUG_GBOXED, "Resolve prop '%s' hook obj %p priv %p", name, *obj, priv);
  1407.  
  1408.      if (priv == NULL) {
  1409.          ret = JS_FALSE; /* wrong class */
  1410. @@ -109,7 +109,7 @@ union_new_resolve(JSContext *context,
  1411.                        g_base_info_get_namespace( (GIBaseInfo*) priv->info),
  1412.                        g_base_info_get_name( (GIBaseInfo*) priv->info));
  1413.  
  1414. -            union_proto = obj;
  1415. +            union_proto = *obj;
  1416.  
  1417.              if (gjs_define_function(context, union_proto,
  1418.                                      g_registered_type_info_get_g_type(priv->info),
  1419. @@ -202,13 +202,13 @@ GJS_NATIVE_CONSTRUCTOR_DECLARE(union)
  1420.      GJS_INC_COUNTER(boxed);
  1421.  
  1422.      g_assert(priv_from_js(context, object) == NULL);
  1423. -    JS_SetPrivate(context, object, priv);
  1424. +    JS_SetPrivate(object, priv);
  1425.  
  1426.      gjs_debug_lifecycle(GJS_DEBUG_GBOXED,
  1427.                          "union constructor, obj %p priv %p",
  1428.                          object, priv);
  1429.  
  1430. -    proto = JS_GetPrototype(context, object);
  1431. +    proto = JS_GetPrototype(object);
  1432.      gjs_debug_lifecycle(GJS_DEBUG_GBOXED, "union instance __proto__ is %p", proto);
  1433.  
  1434.      /* If we're the prototype, then post-construct we'll fill in priv->info.
  1435. @@ -460,7 +460,7 @@ gjs_define_union_class(JSContext    *context,
  1436.      priv->info = info;
  1437.      g_base_info_ref( (GIBaseInfo*) priv->info);
  1438.      priv->gtype = gtype;
  1439. -    JS_SetPrivate(context, prototype, priv);
  1440. +    JS_SetPrivate(prototype, priv);
  1441.  
  1442.      gjs_debug(GJS_DEBUG_GBOXED, "Defined class %s prototype is %p class %p in object %p",
  1443.                constructor_name, prototype, JS_GetClass(prototype), in_object);
  1444. @@ -512,7 +512,7 @@ gjs_union_from_c_union(JSContext    *context,
  1445.  
  1446.      GJS_INC_COUNTER(boxed);
  1447.      priv = g_slice_new0(Union);
  1448. -    JS_SetPrivate(context, obj, priv);
  1449. +    JS_SetPrivate(obj, priv);
  1450.      priv->info = info;
  1451.      g_base_info_ref( (GIBaseInfo *) priv->info);
  1452.      priv->gtype = gtype;
  1453. diff --git a/gjs/byteArray.c b/gjs/byteArray.c
  1454. index 02d0f9b..bf4b1b2 100644
  1455. --- a/gjs/byteArray.c
  1456. +++ b/gjs/byteArray.c
  1457. @@ -50,8 +50,8 @@ static JSBool byte_array_set_prop      (JSContext    *context,
  1458.                                          JSBool        strict,
  1459.                                          jsval        *value_p);
  1460.  static JSBool byte_array_new_resolve   (JSContext    *context,
  1461. -                                        JSObject     *obj,
  1462. -                                        jsid          id,
  1463. +                                        JSObject    **obj,
  1464. +                                        jsid         *id,
  1465.                                          unsigned      flags,
  1466.                                          JSObject    **objp);
  1467.  GJS_NATIVE_CONSTRUCTOR_DECLARE(byte_array);
  1468. @@ -360,8 +360,8 @@ byte_array_set_prop(JSContext *context,
  1469.  
  1470.  static JSBool
  1471.  byte_array_new_resolve(JSContext *context,
  1472. -                       JSObject  *obj,
  1473. -                       jsid       id,
  1474. +                       JSObject **obj,
  1475. +                       jsid       *id,
  1476.                         unsigned   flags,
  1477.                         JSObject **objp)
  1478.  {
  1479. @@ -375,7 +375,7 @@ byte_array_new_resolve(JSContext *context,
  1480.      if (priv == NULL)
  1481.          return JS_TRUE; /* prototype, not an instance. */
  1482.  
  1483. -    if (!JS_IdToValue(context, id, &id_val))
  1484. +    if (!JS_IdToValue(context, *id, &id_val))
  1485.          return JS_FALSE;
  1486.  
  1487.      byte_array_ensure_array(priv);
  1488. @@ -395,15 +395,15 @@ byte_array_new_resolve(JSContext *context,
  1489.               * a property but must define it.
  1490.               */
  1491.              if (!JS_DefinePropertyById(context,
  1492. -                                       obj,
  1493. -                                       id,
  1494. +                                       *obj,
  1495. +                                       *id,
  1496.                                         JSVAL_VOID,
  1497.                                         byte_array_get_prop,
  1498.                                         byte_array_set_prop,
  1499.                                         JSPROP_ENUMERATE))
  1500.                  return JS_FALSE;
  1501.  
  1502. -            *objp = obj;
  1503. +            *objp = *obj;
  1504.          }
  1505.      }
  1506.  
  1507. @@ -453,7 +453,7 @@ GJS_NATIVE_CONSTRUCTOR_DECLARE(byte_array)
  1508.      priv = g_slice_new0(ByteArrayInstance);
  1509.      priv->array = gjs_g_byte_array_new(preallocated_length);
  1510.      g_assert(priv_from_js(context, object) == NULL);
  1511. -    JS_SetPrivate(context, object, priv);
  1512. +    JS_SetPrivate(object, priv);
  1513.  
  1514.      GJS_NATIVE_CONSTRUCTOR_FINISH(byte_array);
  1515.  
  1516. @@ -616,7 +616,7 @@ byte_array_new(JSContext *context)
  1517.      priv = g_slice_new0(ByteArrayInstance);
  1518.  
  1519.      g_assert(priv_from_js(context, array) == NULL);
  1520. -    JS_SetPrivate(context, array, priv);
  1521. +    JS_SetPrivate(array, priv);
  1522.  
  1523.      return array;
  1524.  }
  1525. @@ -868,7 +868,7 @@ gjs_byte_array_from_byte_array (JSContext *context,
  1526.  
  1527.      priv = g_slice_new0(ByteArrayInstance);
  1528.      g_assert(priv_from_js(context, object) == NULL);
  1529. -    JS_SetPrivate(context, object, priv);
  1530. +    JS_SetPrivate(object, priv);
  1531.      priv->array = g_byte_array_new();
  1532.      priv->array->data = g_memdup(array->data, array->len);
  1533.      priv->array->len = array->len;
  1534. @@ -897,7 +897,7 @@ gjs_byte_array_from_bytes (JSContext *context,
  1535.  
  1536.      priv = g_slice_new0(ByteArrayInstance);
  1537.      g_assert(priv_from_js(context, object) == NULL);
  1538. -    JS_SetPrivate(context, object, priv);
  1539. +    JS_SetPrivate(object, priv);
  1540.      priv->bytes = g_bytes_ref (bytes);
  1541.  
  1542.      return object;
  1543. diff --git a/gjs/importer.c b/gjs/importer.c
  1544. index 0a4b1c9..7cdf2c3 100644
  1545. --- a/gjs/importer.c
  1546. +++ b/gjs/importer.c
  1547. @@ -751,7 +751,7 @@ importer_iterator_free(ImporterIterator *iter)
  1548.   */
  1549.  static JSBool
  1550.  importer_new_enumerate(JSContext  *context,
  1551. -                       JSObject   *object,
  1552. +                       JSObject   **object,
  1553.                         JSIterateOp enum_op,
  1554.                         jsval      *state_p,
  1555.                         jsid       *id_p)
  1556. @@ -773,12 +773,13 @@ importer_new_enumerate(JSContext  *context,
  1557.          if (id_p)
  1558.              *id_p = INT_TO_JSID(0);
  1559.  
  1560. -        priv = priv_from_js(context, object);
  1561. +        priv = priv_from_js(context, *object);
  1562. +        
  1563.          if (!priv)
  1564.              /* we are enumerating the prototype properties */
  1565.              return JS_TRUE;
  1566.  
  1567. -        if (!gjs_object_require_property(context, object, "importer", "searchPath", &search_path_val))
  1568. +        if (!gjs_object_require_property(context, *object, "importer", "searchPath", &search_path_val))
  1569.              return JS_FALSE;
  1570.  
  1571.          if (!JSVAL_IS_OBJECT(search_path_val)) {
  1572. @@ -941,8 +942,8 @@ importer_new_enumerate(JSContext  *context,
  1573.   */
  1574.  static JSBool
  1575.  importer_new_resolve(JSContext *context,
  1576. -                     JSObject  *obj,
  1577. -                     jsid       id,
  1578. +                     JSObject  **obj,
  1579. +                     jsid *id,
  1580.                       unsigned   flags,
  1581.                       JSObject **objp)
  1582.  {
  1583. @@ -952,7 +953,7 @@ importer_new_resolve(JSContext *context,
  1584.  
  1585.      *objp = NULL;
  1586.  
  1587. -    if (!gjs_get_string_id(context, id, &name))
  1588. +    if (!gjs_get_string_id(context, *id, &name))
  1589.          return JS_FALSE;
  1590.  
  1591.      /* let Object.prototype resolve these */
  1592. @@ -960,16 +961,14 @@ importer_new_resolve(JSContext *context,
  1593.          strcmp(name, "toString") == 0 ||
  1594.          strcmp(name, "__iterator__") == 0)
  1595.          goto out;
  1596. +    priv = priv_from_js(context, *obj);
  1597.  
  1598. -    priv = priv_from_js(context, obj);
  1599. -    gjs_debug_jsprop(GJS_DEBUG_IMPORTER, "Resolve prop '%s' hook obj %p priv %p", name, obj, priv);
  1600. -
  1601. +    gjs_debug_jsprop(GJS_DEBUG_IMPORTER, "Resolve prop '%s' hook obj %p priv %p", name, *obj, priv);
  1602.      if (priv == NULL) /* we are the prototype, or have the wrong class */
  1603.          goto out;
  1604. -
  1605.      JS_BeginRequest(context);
  1606. -    if (do_import(context, obj, priv, name)) {
  1607. -        *objp = obj;
  1608. +    if (do_import(context, *obj, priv, name)) {
  1609. +        *objp = *obj;
  1610.      } else {
  1611.          ret = JS_FALSE;
  1612.      }
  1613. @@ -1078,7 +1077,7 @@ importer_new(JSContext    *context)
  1614.      GJS_INC_COUNTER(importer);
  1615.  
  1616.      g_assert(priv_from_js(context, importer) == NULL);
  1617. -    JS_SetPrivate(context, importer, priv);
  1618. +    JS_SetPrivate(importer, priv);
  1619.  
  1620.      gjs_debug_lifecycle(GJS_DEBUG_IMPORTER,
  1621.                          "importer constructor, obj %p priv %p", importer, priv);
  1622. diff --git a/gjs/jsapi-dynamic-class.c b/gjs/jsapi-dynamic-class.c
  1623. index e0df4dc..ab8c530 100644
  1624. --- a/gjs/jsapi-dynamic-class.c
  1625. +++ b/gjs/jsapi-dynamic-class.c
  1626. @@ -52,7 +52,7 @@ gjs_new_object_for_constructor(JSContext *context,
  1627.      jsval     prototype;
  1628.  
  1629.      callee = JS_CALLEE(context, vp);
  1630. -    parent = JS_GetParent(context, JSVAL_TO_OBJECT (callee));
  1631. +    parent = JS_GetParent(JSVAL_TO_OBJECT (callee));
  1632.  
  1633.      if (!gjs_object_get_property(context, JSVAL_TO_OBJECT (callee), "prototype",
  1634.                                   &prototype))
  1635. diff --git a/gjs/jsapi-util.c b/gjs/jsapi-util.c
  1636. index 7c9ca02..eb91c6d 100644
  1637. --- a/gjs/jsapi-util.c
  1638. +++ b/gjs/jsapi-util.c
  1639. @@ -85,7 +85,7 @@ gjs_runtime_get_context(JSRuntime *runtime)
  1640.  static JSClass global_class = {
  1641.      "GjsGlobal", JSCLASS_GLOBAL_FLAGS,
  1642.      JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
  1643. -    JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, JS_FinalizeStub,
  1644. +    JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub,
  1645.      JSCLASS_NO_OPTIONAL_MEMBERS
  1646.  };
  1647.  
  1648. @@ -481,7 +481,7 @@ gjs_explain_scope(JSContext  *context,
  1649.          g_string_append_printf(chain, "%p %s",
  1650.                                 parent, debug);
  1651.          g_free(debug);
  1652. -        parent = JS_GetParent(context, parent);
  1653. +        parent = JS_GetParent(parent);
  1654.      }
  1655.      gjs_debug(GJS_DEBUG_SCOPE,
  1656.                "  Chain: %s",
  1657. @@ -814,7 +814,7 @@ gjs_date_from_time_t (JSContext *context, time_t time)
  1658.      if (!JS_EnterLocalRootScope(context))
  1659.          return JSVAL_VOID;
  1660.  
  1661. -    if (!JS_GetClassObject(contect, JS_GetGlobalObject(context), JSProto_Date,
  1662. +    if (!JS_GetClassObject(context, JS_GetGlobalObject(context), JSProto_Date,
  1663.                             &date_constructor))
  1664.          gjs_fatal("Failed to lookup Date prototype");
  1665.  
  1666. @@ -826,7 +826,7 @@ gjs_date_from_time_t (JSContext *context, time_t time)
  1667.          gjs_fatal("Failed to convert time_t to number");
  1668.  
  1669.      date = JS_New(context, JSVAL_TO_OBJECT (date_prototype), 1, args);
  1670. -    
  1671. +
  1672.      result = OBJECT_TO_JSVAL(date);
  1673.      JS_LeaveLocalRootScope(context);
  1674.      JS_EndRequest(context);
  1675. @@ -1186,7 +1186,7 @@ gjs_maybe_gc (JSContext *context)
  1676.           */
  1677.          if (rss_size > linux_rss_trigger) {
  1678.              linux_rss_trigger = (gulong) MIN(G_MAXULONG, rss_size * 1.25);
  1679. -            JS_GC(context);
  1680. +            JS_GC(JS_GetRuntime(context));
  1681.          } else if (rss_size < (0.75 * linux_rss_trigger)) {
  1682.              /* If we've shrunk by 75%, lower the trigger */
  1683.              linux_rss_trigger = (rss_size * 1.25);
  1684. diff --git a/modules/cairo-context.c b/modules/cairo-context.c
  1685. index ea23fdf..e22a5a4 100644
  1686. --- a/modules/cairo-context.c
  1687. +++ b/modules/cairo-context.c
  1688. @@ -274,7 +274,7 @@ _gjs_cairo_context_construct_internal(JSContext *context,
  1689.      priv = g_slice_new0(GjsCairoContext);
  1690.  
  1691.      g_assert(priv_from_js(context, obj) == NULL);
  1692. -    JS_SetPrivate(context, obj, priv);
  1693. +    JS_SetPrivate(obj, priv);
  1694.  
  1695.      priv->context = context;
  1696.      priv->object = obj;
  1697. diff --git a/modules/cairo-path.c b/modules/cairo-path.c
  1698. index de59641..48435fd 100644
  1699. --- a/modules/cairo-path.c
  1700. +++ b/modules/cairo-path.c
  1701. @@ -41,7 +41,7 @@ gjs_cairo_path_finalize(JSContext *context,
  1702.                          JSObject  *obj)
  1703.  {
  1704.      GjsCairoPath *priv;
  1705. -    priv = JS_GetPrivate(context, obj);
  1706. +    priv = JS_GetPrivate(obj);
  1707.      if (priv == NULL)
  1708.          return;
  1709.      cairo_path_destroy(priv->path);
  1710. @@ -84,7 +84,7 @@ gjs_cairo_path_from_path(JSContext    *context,
  1711.      priv = g_slice_new0(GjsCairoPath);
  1712.  
  1713.      g_assert(priv_from_js(context, object) == NULL);
  1714. -    JS_SetPrivate(context, object, priv);
  1715. +    JS_SetPrivate(object, priv);
  1716.  
  1717.      priv->context = context;
  1718.      priv->object = object;
  1719. @@ -111,7 +111,7 @@ gjs_cairo_path_get_path(JSContext *context,
  1720.      g_return_val_if_fail(context != NULL, NULL);
  1721.      g_return_val_if_fail(object != NULL, NULL);
  1722.  
  1723. -    priv = JS_GetPrivate(context, object);
  1724. +    priv = JS_GetPrivate(object);
  1725.      if (priv == NULL)
  1726.          return NULL;
  1727.      return priv->path;
  1728. diff --git a/modules/cairo-pattern.c b/modules/cairo-pattern.c
  1729. index 98b64f2..cb52b24 100644
  1730. --- a/modules/cairo-pattern.c
  1731. +++ b/modules/cairo-pattern.c
  1732. @@ -42,7 +42,7 @@ gjs_cairo_pattern_finalize(JSContext *context,
  1733.                             JSObject  *obj)
  1734.  {
  1735.      GjsCairoPattern *priv;
  1736. -    priv = JS_GetPrivate(context, obj);
  1737. +    priv = JS_GetPrivate(obj);
  1738.      if (priv == NULL)
  1739.          return;
  1740.      cairo_pattern_destroy(priv->pattern);
  1741. @@ -114,7 +114,7 @@ gjs_cairo_pattern_construct(JSContext       *context,
  1742.      priv = g_slice_new0(GjsCairoPattern);
  1743.  
  1744.      g_assert(priv_from_js(context, object) == NULL);
  1745. -    JS_SetPrivate(context, object, priv);
  1746. +    JS_SetPrivate(object, priv);
  1747.  
  1748.      priv->context = context;
  1749.      priv->object = object;
  1750. @@ -196,7 +196,7 @@ gjs_cairo_pattern_get_pattern(JSContext *context,
  1751.      g_return_val_if_fail(context != NULL, NULL);
  1752.      g_return_val_if_fail(object != NULL, NULL);
  1753.  
  1754. -    priv = JS_GetPrivate(context, object);
  1755. +    priv = JS_GetPrivate(object);
  1756.      if (priv == NULL)
  1757.          return NULL;
  1758.  
  1759. diff --git a/modules/cairo-surface.c b/modules/cairo-surface.c
  1760. index 1d372df..5926930 100644
  1761. --- a/modules/cairo-surface.c
  1762. +++ b/modules/cairo-surface.c
  1763. @@ -42,7 +42,7 @@ gjs_cairo_surface_finalize(JSContext *context,
  1764.                             JSObject  *obj)
  1765.  {
  1766.      GjsCairoSurface *priv;
  1767. -    priv = JS_GetPrivate(context, obj);
  1768. +    priv = JS_GetPrivate(obj);
  1769.      if (priv == NULL)
  1770.          return;
  1771.      cairo_surface_destroy(priv->surface);
  1772. @@ -152,7 +152,7 @@ gjs_cairo_surface_construct(JSContext       *context,
  1773.      priv = g_slice_new0(GjsCairoSurface);
  1774.  
  1775.      g_assert(priv_from_js(context, object) == NULL);
  1776. -    JS_SetPrivate(context, object, priv);
  1777. +    JS_SetPrivate(object, priv);
  1778.  
  1779.      priv->context = context;
  1780.      priv->object = object;
  1781. @@ -237,7 +237,7 @@ gjs_cairo_surface_get_surface(JSContext *context,
  1782.      g_return_val_if_fail(context != NULL, NULL);
  1783.      g_return_val_if_fail(object != NULL, NULL);
  1784.  
  1785. -    priv = JS_GetPrivate(context, object);
  1786. +    priv = JS_GetPrivate(object);
  1787.      if (priv == NULL)
  1788.          return NULL;
  1789.      return priv->surface;
  1790. --
  1791. 1.8.0
  1792.  
  1793.  
  1794. From bbf064c279c09c4fb1426f407cae3907e21edf72 Mon Sep 17 00:00:00 2001
  1795. From: Tim Lunn <tim@feathertop.org>
  1796. Date: Tue, 8 Jan 2013 07:51:05 +1100
  1797. Subject: [PATCH 07/10] testBoxed: add test for getter
  1798.  
  1799. ---
  1800. test/js/test0030basicBoxed.js | 1 +
  1801.  1 file changed, 1 insertion(+)
  1802.  
  1803. diff --git a/test/js/test0030basicBoxed.js b/test/js/test0030basicBoxed.js
  1804. index 57dbbe3..099d817 100644
  1805. --- a/test/js/test0030basicBoxed.js
  1806. +++ b/test/js/test0030basicBoxed.js
  1807. @@ -4,6 +4,7 @@ var Regress = imports.gi.Regress;
  1808.  function testBasicBoxed() {
  1809.      var a = new Regress.TestSimpleBoxedA();
  1810.      a.some_int = 42;
  1811. +    assertEquals(a.some_int, 42);
  1812.  }
  1813.  
  1814.  gjstestRun();
  1815. --
  1816. 1.8.0
  1817.  
  1818.  
  1819. From abf430bae0065fa4af0a5ceed6de72bc72e799c7 Mon Sep 17 00:00:00 2001
  1820. From: Tim Lunn <tim@feathertop.org>
  1821. Date: Wed, 9 Jan 2013 12:00:15 +1100
  1822. Subject: [PATCH 08/10] update for JSClass prototype changes
  1823.  
  1824. ---
  1825. gi/boxed.c       |  3 +--
  1826.  gi/function.c    |  2 +-
  1827.  gi/gerror.c      | 16 ++++++++--------
  1828.  gi/keep-alive.c  |  6 +-----
  1829.  gi/object.c      | 11 ++++-------
  1830.  gjs/byteArray.c  | 47 +++++++++++++++++++++++------------------------
  1831.  gjs/importer.c   |  2 +-
  1832.  gjs/jsapi-util.h |  3 +--
  1833.  8 files changed, 40 insertions(+), 50 deletions(-)
  1834.  
  1835. diff --git a/gi/boxed.c b/gi/boxed.c
  1836. index 2d26301..7379edb 100644
  1837. --- a/gi/boxed.c
  1838. +++ b/gi/boxed.c
  1839. @@ -940,8 +940,7 @@ static struct JSClass gjs_boxed_class = {
  1840.      boxed_finalize,
  1841.      NULL,
  1842.      NULL,
  1843. -    NULL,
  1844. -    NULL, NULL, NULL, NULL, NULL
  1845. +    NULL, NULL, NULL
  1846.  };
  1847.  
  1848.  static JSPropertySpec gjs_boxed_proto_props[] = {
  1849. diff --git a/gi/function.c b/gi/function.c
  1850. index 4b2f89c..6eaeb39 100644
  1851. --- a/gi/function.c
  1852. +++ b/gi/function.c
  1853. @@ -1367,7 +1367,7 @@ static struct JSClass gjs_function_class = {
  1854.      function_finalize,
  1855.      NULL,
  1856.      function_call,
  1857. -    NULL, NULL
  1858. +    NULL, NULL, NULL
  1859.  };
  1860.  
  1861.  static JSPropertySpec gjs_function_proto_props[] = {
  1862. diff --git a/gi/gerror.c b/gi/gerror.c
  1863. index 5fd12b6..f682a28 100644
  1864. --- a/gi/gerror.c
  1865. +++ b/gi/gerror.c
  1866. @@ -147,11 +147,11 @@ error_finalize(JSContext *context,
  1867.  }
  1868.  
  1869.  static JSBool
  1870. -error_get_domain(JSContext *context, JSObject *obj, jsid id, jsval *vp)
  1871. +error_get_domain(JSContext *context, JSObject **obj, jsid *id, jsval *vp)
  1872.  {
  1873.      Error *priv;
  1874.  
  1875. -    priv = priv_from_js(context, obj);
  1876. +    priv = priv_from_js(context, *obj);
  1877.  
  1878.      if (priv == NULL)
  1879.          return JS_FALSE;
  1880. @@ -161,11 +161,11 @@ error_get_domain(JSContext *context, JSObject *obj, jsid id, jsval *vp)
  1881.  }
  1882.  
  1883.  static JSBool
  1884. -error_get_message(JSContext *context, JSObject *obj, jsid id, jsval *vp)
  1885. +error_get_message(JSContext *context, JSObject **obj, jsid *id, jsval **vp)
  1886.  {
  1887.      Error *priv;
  1888.  
  1889. -    priv = priv_from_js(context, obj);
  1890. +    priv = priv_from_js(context, *obj);
  1891.  
  1892.      if (priv == NULL)
  1893.          return JS_FALSE;
  1894. @@ -180,11 +180,11 @@ error_get_message(JSContext *context, JSObject *obj, jsid id, jsval *vp)
  1895.  }
  1896.  
  1897.  static JSBool
  1898. -error_get_code(JSContext *context, JSObject *obj, jsid id, jsval *vp)
  1899. +error_get_code(JSContext *context, JSObject **obj, jsid *id, jsval *vp)
  1900.  {
  1901.      Error *priv;
  1902.  
  1903. -    priv = priv_from_js(context, obj);
  1904. +    priv = priv_from_js(context, *obj);
  1905.  
  1906.      if (priv == NULL)
  1907.          return JS_FALSE;
  1908. @@ -520,7 +520,8 @@ define_error_properties(JSContext *context,
  1909.      /* find the JS frame that triggered the error */
  1910.      frame = NULL;
  1911.      while (JS_FrameIterator(context, &frame)) {
  1912. -        if (JS_IsScriptFrame(context, frame))
  1913. +        script = JS_GetFrameScript(context, frame);
  1914. +        if (script)
  1915.              break;
  1916.      }
  1917.  
  1918. @@ -530,7 +531,6 @@ define_error_properties(JSContext *context,
  1919.      if (!frame)
  1920.          return;
  1921.  
  1922. -    script = JS_GetFrameScript(context, frame);
  1923.      pc = JS_GetFramePC(context, frame);
  1924.  
  1925.      stack = g_string_new(NULL);
  1926. diff --git a/gi/keep-alive.c b/gi/keep-alive.c
  1927. index ce56e35..a8eea22 100644
  1928. --- a/gi/keep-alive.c
  1929. +++ b/gi/keep-alive.c
  1930. @@ -150,7 +150,6 @@ keep_alive_trace(JSTracer *tracer,
  1931.   */
  1932.  static struct JSClass gjs_keep_alive_class = {
  1933.      "__private_GjsKeepAlive", /* means "new __private_GjsKeepAlive()" works */
  1934. -    JSCLASS_MARK_IS_TRACE | /* TraceOp not MarkOp */
  1935.      JSCLASS_HAS_PRIVATE,
  1936.      JS_PropertyStub,
  1937.      JS_PropertyStub,
  1938. @@ -164,10 +163,7 @@ static struct JSClass gjs_keep_alive_class = {
  1939.      NULL,
  1940.      NULL,
  1941.      NULL,
  1942. -    NULL,
  1943. -    NULL,
  1944. -    JS_CLASS_TRACE(keep_alive_trace),
  1945. -    NULL
  1946. +    keep_alive_trace,
  1947.  };
  1948.  
  1949.  static JSPropertySpec gjs_keep_alive_proto_props[] = {
  1950. diff --git a/gi/object.c b/gi/object.c
  1951. index 7d24bae..0f66481 100644
  1952. --- a/gi/object.c
  1953. +++ b/gi/object.c
  1954. @@ -542,7 +542,7 @@ object_instance_new_resolve(JSContext *context,
  1955.                  goto out;
  1956.              }
  1957.  
  1958. -            gjs_define_function(context, obj, priv->gtype, vfunc);
  1959. +            gjs_define_function(context, *obj, priv->gtype, vfunc);
  1960.              *objp = *obj;
  1961.              g_base_info_unref((GIBaseInfo *)vfunc);
  1962.              ret = JS_TRUE;
  1963. @@ -1436,8 +1436,7 @@ to_string_func(JSContext *context,
  1964.  static struct JSClass gjs_object_instance_class = {
  1965.      "GObject_Object",
  1966.      JSCLASS_HAS_PRIVATE |
  1967. -    JSCLASS_NEW_RESOLVE |
  1968. -    JSCLASS_MARK_IS_TRACE,
  1969. +    JSCLASS_NEW_RESOLVE,
  1970.      JS_PropertyStub,
  1971.      JS_PropertyStub,
  1972.      object_instance_get_prop,
  1973. @@ -1450,10 +1449,8 @@ static struct JSClass gjs_object_instance_class = {
  1974.      NULL,
  1975.      NULL,
  1976.      NULL,
  1977. -    NULL,
  1978. -    NULL,
  1979. -    JS_CLASS_TRACE(object_instance_trace),
  1980. -    NULL,
  1981. +    object_instance_trace,
  1982. +    
  1983.  };
  1984.  
  1985.  static JSBool
  1986. diff --git a/gjs/byteArray.c b/gjs/byteArray.c
  1987. index bf4b1b2..416951c 100644
  1988. --- a/gjs/byteArray.c
  1989. +++ b/gjs/byteArray.c
  1990. @@ -41,12 +41,12 @@ static struct JSObject* gjs_byte_array_prototype;
  1991.  GJS_DEFINE_PRIV_FROM_JS(ByteArrayInstance, gjs_byte_array_class)
  1992.  
  1993.  static JSBool byte_array_get_prop      (JSContext    *context,
  1994. -                                        JSObject     *obj,
  1995. -                                        jsid          id,
  1996. +                                        JSObject     **obj,
  1997. +                                        jsid          *id,
  1998.                                          jsval        *value_p);
  1999.  static JSBool byte_array_set_prop      (JSContext    *context,
  2000. -                                        JSObject     *obj,
  2001. -                                        jsid          id,
  2002. +                                        JSObject     **obj,
  2003. +                                        jsid          *id,
  2004.                                          JSBool        strict,
  2005.                                          jsval        *value_p);
  2006.  static JSBool byte_array_new_resolve   (JSContext    *context,
  2007. @@ -65,16 +65,15 @@ static struct JSClass gjs_byte_array_class = {
  2008.      JSCLASS_NEW_RESOLVE,
  2009.      JS_PropertyStub,
  2010.      JS_PropertyStub,
  2011. -    byte_array_get_prop,
  2012. -    byte_array_set_prop,
  2013. +    (JSPropertyOp)byte_array_get_prop,
  2014. +    (JSStrictPropertyOp)byte_array_set_prop,
  2015.      NULL,
  2016.      (JSResolveOp) byte_array_new_resolve, /* cast due to new sig */
  2017.      JS_ConvertStub,
  2018.      byte_array_finalize,
  2019.      NULL,
  2020.      NULL,
  2021. -    NULL,
  2022. -    NULL, NULL, NULL, NULL, NULL
  2023. +    NULL, NULL, NULL
  2024.  };
  2025.  
  2026.  JSBool
  2027. @@ -206,19 +205,19 @@ byte_array_get_index(JSContext         *context,
  2028.   */
  2029.  static JSBool
  2030.  byte_array_get_prop(JSContext *context,
  2031. -                    JSObject  *obj,
  2032. -                    jsid       id,
  2033. +                    JSObject  **obj,
  2034. +                    jsid       *id,
  2035.                      jsval     *value_p)
  2036.  {
  2037.      ByteArrayInstance *priv;
  2038.      jsval id_value;
  2039.  
  2040. -    priv = priv_from_js(context, obj);
  2041. +    priv = priv_from_js(context, *obj);
  2042.  
  2043.      if (priv == NULL)
  2044.          return JS_TRUE; /* prototype, not an instance. */
  2045.  
  2046. -    if (!JS_IdToValue(context, id, &id_value))
  2047. +    if (!JS_IdToValue(context, *id, &id_value))
  2048.          return JS_FALSE;
  2049.  
  2050.      /* First handle array indexing */
  2051. @@ -226,7 +225,7 @@ byte_array_get_prop(JSContext *context,
  2052.          gsize idx;
  2053.          if (!gjs_value_to_gsize(context, id_value, &idx))
  2054.              return JS_FALSE;
  2055. -        return byte_array_get_index(context, obj, priv, idx, value_p);
  2056. +        return byte_array_get_index(context, *obj, priv, idx, value_p);
  2057.      }
  2058.  
  2059.      /* We don't special-case anything else for now. Regular JS arrays
  2060. @@ -238,14 +237,14 @@ byte_array_get_prop(JSContext *context,
  2061.  
  2062.  static JSBool
  2063.  byte_array_length_getter(JSContext *context,
  2064. -                         JSObject  *obj,
  2065. -                         jsid       id,
  2066. +                         JSObject  **obj,
  2067. +                         jsid       *id,
  2068.                           jsval     *value_p)
  2069.  {
  2070.      ByteArrayInstance *priv;
  2071.      gsize len;
  2072.  
  2073. -    priv = priv_from_js(context, obj);
  2074. +    priv = priv_from_js(context, *obj);
  2075.  
  2076.      if (priv == NULL)
  2077.          return JS_TRUE; /* prototype, not an instance. */
  2078. @@ -259,15 +258,15 @@ byte_array_length_getter(JSContext *context,
  2079.  
  2080.  static JSBool
  2081.  byte_array_length_setter(JSContext *context,
  2082. -                         JSObject  *obj,
  2083. -                         jsid       id,
  2084. +                         JSObject **obj,
  2085. +                         jsid      *id,
  2086.                           JSBool     strict,
  2087.                           jsval     *value_p)
  2088.  {
  2089.      ByteArrayInstance *priv;
  2090.      gsize len = 0;
  2091.  
  2092. -    priv = priv_from_js(context, obj);
  2093. +    priv = priv_from_js(context, *obj);
  2094.  
  2095.      if (priv == NULL)
  2096.          return JS_TRUE; /* prototype, not instance */
  2097. @@ -321,20 +320,20 @@ byte_array_set_index(JSContext         *context,
  2098.   */
  2099.  static JSBool
  2100.  byte_array_set_prop(JSContext *context,
  2101. -                    JSObject  *obj,
  2102. -                    jsid       id,
  2103. +                    JSObject  **obj,
  2104. +                    jsid       *id,
  2105.                      JSBool     strict,
  2106.                      jsval     *value_p)
  2107.  {
  2108.      ByteArrayInstance *priv;
  2109.      jsval id_value;
  2110.  
  2111. -    priv = priv_from_js(context, obj);
  2112. +    priv = priv_from_js(context, *obj);
  2113.  
  2114.      if (priv == NULL)
  2115.          return JS_TRUE; /* prototype, not an instance. */
  2116.  
  2117. -    if (!JS_IdToValue(context, id, &id_value))
  2118. +    if (!JS_IdToValue(context, *id, &id_value))
  2119.          return JS_FALSE;
  2120.  
  2121.      byte_array_ensure_array(priv);
  2122. @@ -345,7 +344,7 @@ byte_array_set_prop(JSContext *context,
  2123.          if (!gjs_value_to_gsize(context, id_value, &idx))
  2124.              return JS_FALSE;
  2125.  
  2126. -        return byte_array_set_index(context, obj, priv, idx, value_p);
  2127. +        return byte_array_set_index(context, *obj, priv, idx, value_p);
  2128.      }
  2129.  
  2130.      /* We don't special-case anything else for now */
  2131. diff --git a/gjs/importer.c b/gjs/importer.c
  2132. index 7cdf2c3..0eb3c1e 100644
  2133. --- a/gjs/importer.c
  2134. +++ b/gjs/importer.c
  2135. @@ -834,7 +834,7 @@ importer_new_enumerate(JSContext  *context,
  2136.              init_path = g_build_filename(dirname, MODULE_INIT_FILENAME,
  2137.                                           NULL);
  2138.  
  2139. -            load_module_elements(context, object, iter, init_path);
  2140. +            load_module_elements(context, *object, iter, init_path);
  2141.  
  2142.              g_free(init_path);
  2143.  
  2144. diff --git a/gjs/jsapi-util.h b/gjs/jsapi-util.h
  2145. index 19406a8..ce72963 100644
  2146. --- a/gjs/jsapi-util.h
  2147. +++ b/gjs/jsapi-util.h
  2148. @@ -145,8 +145,7 @@ static struct JSClass gjs_##cname##_class = { \
  2149.      gjs_##cname##_finalize, \
  2150.      NULL, \
  2151.      NULL, \
  2152. -    NULL, \
  2153. -    NULL, NULL, NULL, NULL, NULL \
  2154. +    NULL, NULL, NULL \
  2155.  }; \
  2156.  jsval gjs_##cname##_create_proto(JSContext *context, JSObject *module, const char *proto_name, JSObject *parent) \
  2157.  { \
  2158. --
  2159. 1.8.0
  2160.  
  2161.  
  2162. From 541363ac63596109a3b55d7e470ea0168c11ad5e Mon Sep 17 00:00:00 2001
  2163. From: Tim Lunn <tim@feathertop.org>
  2164. Date: Wed, 9 Jan 2013 18:54:15 +1100
  2165. Subject: [PATCH 09/10] Misc api changes
  2166.  
  2167. ---
  2168. gjs/context.c         |  6 +++---
  2169.  gjs/jsapi-private.cpp |  2 +-
  2170.  gjs/jsapi-util.c      |  2 +-
  2171.  gjs/stack.c           | 43 ++++++++++++++++++++++---------------------
  2172.  modules/jsUnit.js     |  1 +
  2173.  modules/system.c      |  2 +-
  2174.  test/gjs-tests.c      |  2 +-
  2175.  7 files changed, 30 insertions(+), 28 deletions(-)
  2176.  
  2177. diff --git a/gjs/context.c b/gjs/context.c
  2178. index 79a018a..186bf02 100644
  2179. --- a/gjs/context.c
  2180. +++ b/gjs/context.c
  2181. @@ -571,7 +571,7 @@ gjs_context_constructor (GType                  type,
  2182.       *
  2183.       * JSOPTION_STRICT: Report warnings to error reporter function.
  2184.       */
  2185. -    options_flags = JSOPTION_DONT_REPORT_UNCAUGHT | JSOPTION_STRICT;
  2186. +    options_flags = JSOPTION_DONT_REPORT_UNCAUGHT | JSOPTION_STRICT | JSOPTION_ALLOW_XML;
  2187.  
  2188.  #ifdef JSOPTION_JIT
  2189.      if (!g_getenv("GJS_DISABLE_JIT")) {
  2190. @@ -673,7 +673,7 @@ gjs_context_constructor (GType                  type,
  2191.      }
  2192.  
  2193.      if (js_context->gc_notifications_enabled)
  2194. -        JS_SetGCCallback(js_context->context, gjs_on_context_gc);
  2195. +        JS_SetGCCallback(JS_GetRuntime(js_context->context), gjs_on_context_gc);
  2196.  
  2197.      JS_EndRequest(js_context->context);
  2198.  
  2199. @@ -878,7 +878,7 @@ gjs_context_maybe_gc (GjsContext  *context)
  2200.  void
  2201.  gjs_context_gc (GjsContext  *context)
  2202.  {
  2203. -    JS_GC(context->context);
  2204. +    JS_GC(JS_GetRuntime(context->context));
  2205.  }
  2206.  
  2207.  static gboolean
  2208. diff --git a/gjs/jsapi-private.cpp b/gjs/jsapi-private.cpp
  2209. index 463619f..5f39053 100644
  2210. --- a/gjs/jsapi-private.cpp
  2211. +++ b/gjs/jsapi-private.cpp
  2212. @@ -35,7 +35,7 @@
  2213.  #pragma GCC diagnostic push
  2214.  #pragma GCC diagnostic ignored "-Wstrict-prototypes"
  2215.  #pragma GCC diagnostic ignored "-Winvalid-offsetof"
  2216. -#include <jscntxt.h>
  2217. +#include <jsfriendapi.h>
  2218.  #pragma GCC diagnostic pop
  2219.  
  2220.  void
  2221. diff --git a/gjs/jsapi-util.c b/gjs/jsapi-util.c
  2222. index eb91c6d..f3f2504 100644
  2223. --- a/gjs/jsapi-util.c
  2224. +++ b/gjs/jsapi-util.c
  2225. @@ -102,7 +102,7 @@ gboolean
  2226.  gjs_init_context_standard (JSContext       *context)
  2227.  {
  2228.      JSObject *global;
  2229. -    global = JS_NewCompartmentAndGlobalObject(context, &global_class, NULL);
  2230. +    global = JS_NewGlobalObject(context, &global_class, NULL);
  2231.      if (global == NULL)
  2232.          return FALSE;
  2233.      if (!JS_InitStandardClasses(context, global))
  2234. diff --git a/gjs/stack.c b/gjs/stack.c
  2235. index aec76ed..cd7c767 100644
  2236. --- a/gjs/stack.c
  2237. +++ b/gjs/stack.c
  2238. @@ -100,16 +100,17 @@ format_frame(JSContext* cx, JSStackFrame* fp,
  2239.  
  2240.      (void)JS_EnterLocalRootScope(cx);
  2241.  
  2242. -    if (!JS_IsScriptFrame(cx, fp)) {
  2243. -        g_string_append_printf(buf, "%d [native frame]\n", num);
  2244. -        goto out;
  2245. -    }
  2246. -
  2247.      /* get the info for this stack frame */
  2248.  
  2249.      script = JS_GetFrameScript(cx, fp);
  2250.      pc = JS_GetFramePC(cx, fp);
  2251.  
  2252. +    if (!script) {
  2253. +        g_string_append_printf(buf, "%d [native frame]\n", num);
  2254. +        goto out;
  2255. +    }
  2256. +
  2257. +
  2258.      if (script && pc) {
  2259.          filename = JS_GetScriptFilename(cx, script);
  2260.          lineno =  (guint32) JS_PCToLineNumber(cx, script, pc);
  2261. @@ -143,23 +144,23 @@ format_frame(JSContext* cx, JSStackFrame* fp,
  2262.          char *name = NULL;
  2263.          char *value = NULL;
  2264.          JSPropertyDesc* desc = &call_props.array[i];
  2265. -        if(desc->flags & JSPD_ARGUMENT) {
  2266. -            name = jsvalue_to_string(cx, desc->id, &is_string);
  2267. -            if(!is_string) {
  2268. -                g_free(name);
  2269. -                name = NULL;
  2270. -            }
  2271. -            value = jsvalue_to_string(cx, desc->value, &is_string);
  2272. -
  2273. -            g_string_append_printf(buf, "%s%s%s%s%s%s",
  2274. -                                   named_arg_count ? ", " : "",
  2275. -                                   name ? name :"",
  2276. -                                   name ? " = " : "",
  2277. -                                   is_string ? "\"" : "",
  2278. -                                   value ? value : "?unknown?",
  2279. -                                   is_string ? "\"" : "");
  2280. -            named_arg_count++;
  2281. +
  2282. +        name = jsvalue_to_string(cx, desc->id, &is_string);
  2283. +        if(!is_string) {
  2284. +            g_free(name);
  2285. +            name = NULL;
  2286.          }
  2287. +        value = jsvalue_to_string(cx, desc->value, &is_string);
  2288. +
  2289. +        g_string_append_printf(buf, "%s%s%s%s%s%s",
  2290. +                               named_arg_count ? ", " : "",
  2291. +                               name ? name :"",
  2292. +                               name ? " = " : "",
  2293. +                               is_string ? "\"" : "",
  2294. +                               value ? value : "?unknown?",
  2295. +                               is_string ? "\"" : "");
  2296. +        named_arg_count++;
  2297. +
  2298.          g_free(name);
  2299.          g_free(value);
  2300.      }
  2301. diff --git a/modules/jsUnit.js b/modules/jsUnit.js
  2302. index e260f22..08f7a19 100644
  2303. --- a/modules/jsUnit.js
  2304. +++ b/modules/jsUnit.js
  2305. @@ -450,6 +450,7 @@ function jsUnitSetOnLoad(windowRef, onloadHandler)
  2306.  // GJS: entry point to run all functions named as test*, surrounded by
  2307.  // calls to setUp() and tearDown()
  2308.  function gjstestRun(window_, setUp, tearDown) {
  2309. +  var propName;
  2310.    var rv = 0;
  2311.    var failures = [];
  2312.    if (!window_) window_ = window;
  2313. diff --git a/modules/system.c b/modules/system.c
  2314. index 7ee9a2f..0752649 100644
  2315. --- a/modules/system.c
  2316. +++ b/modules/system.c
  2317. @@ -100,7 +100,7 @@ gjs_gc(JSContext *context,
  2318.      jsval *argv = JS_ARGV(cx, vp);
  2319.      if (!gjs_parse_args(context, "gc", "", argc, argv))
  2320.          return JS_FALSE;
  2321. -    JS_GC(context);
  2322. +    JS_GC(JS_GetRuntime(context));
  2323.      return JS_TRUE;
  2324.  }
  2325.  
  2326. diff --git a/test/gjs-tests.c b/test/gjs-tests.c
  2327. index b92b33e..8fb67d3 100644
  2328. --- a/test/gjs-tests.c
  2329. +++ b/test/gjs-tests.c
  2330. @@ -111,7 +111,7 @@ gjstest_test_func_gjs_jsapi_util_array(void)
  2331.          gjs_rooted_array_append(context, array, value);
  2332.      }
  2333.  
  2334. -    JS_GC(context);
  2335. +    JS_GC(JS_GetRuntime(context));
  2336.  
  2337.      for (i = 0; i < N_ELEMS; i++) {
  2338.          char *ascii;
  2339. --
  2340. 1.8.0
  2341.  
  2342.  
  2343. From 036c5eae914eb57383383ac334b35bc8742563b7 Mon Sep 17 00:00:00 2001
  2344. From: Tim Lunn <tim@feathertop.org>
  2345. Date: Wed, 9 Jan 2013 19:21:24 +1100
  2346. Subject: [PATCH 10/10] byteArray: update PropertySpec for new API
  2347.  
  2348. For some reason the setter fails to get called when JSPROP_SHARED
  2349. is set.
  2350. ---
  2351. gjs/byteArray.c | 6 +++---
  2352.  1 file changed, 3 insertions(+), 3 deletions(-)
  2353.  
  2354. diff --git a/gjs/byteArray.c b/gjs/byteArray.c
  2355. index 416951c..37aad63 100644
  2356. --- a/gjs/byteArray.c
  2357. +++ b/gjs/byteArray.c
  2358. @@ -957,9 +957,9 @@ enum ByteArrayTinyId {
  2359.  
  2360.  static JSPropertySpec gjs_byte_array_proto_props[] = {
  2361.      { "length", BYTE_ARRAY_TINY_ID_LENGTH,
  2362. -      JSPROP_PERMANENT | JSPROP_SHARED,
  2363. -      byte_array_length_getter,
  2364. -      byte_array_length_setter
  2365. +      JSPROP_PERMANENT,
  2366. +      (JSPropertyOp)byte_array_length_getter,
  2367. +      (JSStrictPropertyOp)byte_array_length_setter
  2368.      },
  2369.      { NULL }
  2370.  };
  2371. --
  2372. 1.8.0
Add Comment
Please, Sign In to add comment