Hello community, here is the log from the commit of package gjs for openSUSE:Factory checked in at 2020-06-08 23:48:53 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/gjs (Old) and /work/SRC/openSUSE:Factory/.gjs.new.3606 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "gjs" Mon Jun 8 23:48:53 2020 rev:90 rq:811428 version:1.64.3 Changes: -------- --- /work/SRC/openSUSE:Factory/gjs/gjs.changes 2020-04-29 20:44:15.427935921 +0200 +++ /work/SRC/openSUSE:Factory/.gjs.new.3606/gjs.changes 2020-06-08 23:49:48.174432565 +0200 @@ -1,0 +2,16 @@ +Sun May 31 19:49:27 UTC 2020 - Bjørn Lie <bjorn....@gmail.com> + +- Update to version 1.64.3: + + Closed bugs and merge requests: + - arg: Don't sink GClosure ref if it's a return value. + - overrides/Gtk: Adjust gtk_container_child_set_property() + check. + - 1.63.3: test suite is failing. + - Simplify private pointers. + + Various backports: + - Use memory GSettings backend in tests. + - Update debug message from trimLeft/trimRight to + trimStart/trimEnd. + - Various fixes for potential crash and memory issues. + +------------------------------------------------------------------- Old: ---- gjs-1.64.2.tar.xz New: ---- gjs-1.64.3.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ gjs.spec ++++++ --- /var/tmp/diff_new_pack.4CXEK0/_old 2020-06-08 23:49:50.950441128 +0200 +++ /var/tmp/diff_new_pack.4CXEK0/_new 2020-06-08 23:49:50.954441140 +0200 @@ -17,7 +17,7 @@ Name: gjs -Version: 1.64.2 +Version: 1.64.3 Release: 0 Summary: JavaScript bindings based on gobject-introspection and Mozilla License: MIT AND LGPL-2.0-or-later ++++++ gjs-1.64.2.tar.xz -> gjs-1.64.3.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gjs-1.64.2/NEWS new/gjs-1.64.3/NEWS --- old/gjs-1.64.2/NEWS 2020-04-28 04:53:25.000000000 +0200 +++ new/gjs-1.64.3/NEWS 2020-05-31 19:42:30.593444000 +0200 @@ -1,3 +1,26 @@ +Version 1.64.3 +-------------- + +- Closed bugs and merge requests: + * arg: Don't sink GClosure ref if it's a return value [!426, Philip Chimento] + * overrides/Gtk: Adjust gtk_container_child_set_property() check [!431, + Florian Müllner] + * 1.63.3: test suite is failing [#298, !430, Philip Chimento] + * Simplify private pointers [!434, Philip Chimento] + +- Various backports: + * Use memory GSettings backend in tests [Philip Chimento] + * Update debug message from trimLeft/trimRight to trimStart/trimEnd [Philip + Chimento] + * Various fixes for potential crash and memory issues [Philip Chimento] + +Version 1.58.8 +-------------- + +- Various backports + * 1.63.3: test suite is failing [Philip Chimento] + * Various fixes for potential crash and memory issues [Philip Chimento] + Version 1.64.2 -------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gjs-1.64.2/gi/arg.cpp new/gjs-1.64.3/gi/arg.cpp --- old/gjs-1.64.2/gi/arg.cpp 2020-04-28 04:53:25.000000000 +0200 +++ new/gjs-1.64.3/gi/arg.cpp 2020-05-31 19:42:30.595444000 +0200 @@ -1520,12 +1520,10 @@ nullptr); } -static bool value_to_interface_gi_argument(JSContext* cx, JS::HandleValue value, - GIBaseInfo* interface_info, - GIInfoType interface_type, - GITransfer transfer, - bool expect_object, GIArgument* arg, - bool* report_type_mismatch) { +static bool value_to_interface_gi_argument( + JSContext* cx, JS::HandleValue value, GIBaseInfo* interface_info, + GIInfoType interface_type, GITransfer transfer, bool expect_object, + GIArgument* arg, GjsArgumentType arg_type, bool* report_type_mismatch) { g_assert(report_type_mismatch); GType gtype = G_TYPE_NONE; @@ -1649,8 +1647,14 @@ if (g_type_is_a(gtype, G_TYPE_CLOSURE)) { GClosure* closure = gjs_closure_new_marshaled( cx, JS_GetObjectFunction(obj), "boxed"); - g_closure_ref(closure); - g_closure_sink(closure); + // GI doesn't know about floating GClosure references. We + // guess that if this is a return value going from JS::Value + // to GArgument, it's intended to be passed to a C API that + // will consume the floating reference. + if (arg_type != GJS_ARGUMENT_RETURN_VALUE) { + g_closure_ref(closure); + g_closure_sink(closure); + } arg->v_pointer = closure; return true; } @@ -1960,7 +1964,7 @@ if (!value_to_interface_gi_argument( context, value, interface_info, interface_type, transfer, - expect_object, arg, &report_type_mismatch)) + expect_object, arg, arg_type, &report_type_mismatch)) wrong = true; } break; @@ -3834,6 +3838,7 @@ type_needs_out_release(param_type, type_tag)) { for (i = 0; i < length; i++) { elem.v_pointer = array[i]; + JS::AutoSaveExceptionState saved_exc(context); if (!gjs_g_arg_release_internal(context, GI_TRANSFER_EVERYTHING, param_type, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gjs-1.64.2/gi/function.cpp new/gjs-1.64.3/gi/function.cpp --- old/gjs-1.64.2/gi/function.cpp 2020-04-28 04:53:25.000000000 +0200 +++ new/gjs-1.64.3/gi/function.cpp 2020-05-31 19:42:30.597444000 +0200 @@ -418,14 +418,9 @@ if (!JS_GetElement(context, out_array, elem_idx, &elem)) goto out; - if (!gjs_value_to_g_argument(context, - elem, - &ret_type, - "callback", - GJS_ARGUMENT_ARGUMENT, - transfer, - true, - &argument)) + if (!gjs_value_to_g_argument(context, elem, &ret_type, "callback", + GJS_ARGUMENT_RETURN_VALUE, transfer, + true, &argument)) goto out; set_return_ffi_arg_from_giargument(&ret_type, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gjs-1.64.2/gi/fundamental.cpp new/gjs-1.64.3/gi/fundamental.cpp --- old/gjs-1.64.2/gi/fundamental.cpp 2020-04-28 04:53:25.000000000 +0200 +++ new/gjs-1.64.3/gi/fundamental.cpp 2020-05-31 19:42:30.597444000 +0200 @@ -262,6 +262,7 @@ g_assert(m_unref_function); g_assert(m_set_value_function); g_assert(m_get_value_function); + GJS_INC_COUNTER(fundamental_prototype); } // Overrides GIWrapperPrototype::init(). diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gjs-1.64.2/gi/param.cpp new/gjs-1.64.3/gi/param.cpp --- old/gjs-1.64.2/gi/param.cpp 2020-04-28 04:53:25.000000000 +0200 +++ new/gjs-1.64.3/gi/param.cpp 2020-05-31 19:42:30.600444000 +0200 @@ -45,13 +45,9 @@ #include "gjs/mem-private.h" #include "util/log.h" -typedef struct { - GParamSpec* gparam; // nullptr if we are the prototype and not an instance -} Param; - extern struct JSClass gjs_param_class; -GJS_DEFINE_PRIV_FROM_JS(Param, gjs_param_class) +GJS_DEFINE_PRIV_FROM_JS(GParamSpec, gjs_param_class) /* * The *resolved out parameter, on success, should be false to indicate that id @@ -64,8 +60,7 @@ JS::HandleId id, bool *resolved) { - Param* priv = priv_from_js(context, obj); - if (!priv) { + if (!priv_from_js(context, obj)) { /* instance, not prototype */ *resolved = false; return true; @@ -115,18 +110,14 @@ } static void param_finalize(JSFreeOp*, JSObject* obj) { - Param *priv; - - priv = (Param*) JS_GetPrivate(obj); - gjs_debug_lifecycle(GJS_DEBUG_GPARAM, - "finalize, obj %p priv %p", obj, priv); - if (!priv) + GjsAutoParam param = static_cast<GParamSpec*>(JS_GetPrivate(obj)); + gjs_debug_lifecycle(GJS_DEBUG_GPARAM, "finalize, obj %p priv %p", obj, + param.get()); + if (!param) return; /* wrong class? */ - g_clear_pointer(&priv->gparam, g_param_spec_unref); - GJS_DEC_COUNTER(param); - g_slice_free(Param, priv); + JS_SetPrivate(obj, nullptr); } @@ -225,7 +216,6 @@ GParamSpec *gparam) { JSObject *obj; - Param *priv; if (!gparam) return nullptr; @@ -241,14 +231,12 @@ obj = JS_NewObjectWithGivenProto(context, JS_GetClass(proto), proto); GJS_INC_COUNTER(param); - priv = g_slice_new0(Param); - JS_SetPrivate(obj, priv); - priv->gparam = gparam; + JS_SetPrivate(obj, gparam); g_param_spec_ref (gparam); gjs_debug(GJS_DEBUG_GPARAM, - "JSObject created with param instance %p type %s", - priv->gparam, g_type_name(G_TYPE_FROM_INSTANCE((GTypeInstance*) priv->gparam))); + "JSObject created with param instance %p type %s", gparam, + g_type_name(G_TYPE_FROM_INSTANCE(gparam))); return obj; } @@ -257,14 +245,10 @@ gjs_g_param_from_param(JSContext *context, JS::HandleObject obj) { - Param *priv; - if (!obj) return nullptr; - priv = priv_from_js(context, obj); - - return priv->gparam; + return priv_from_js(context, obj); } bool @@ -273,15 +257,14 @@ GType expected_type, bool throw_error) { - Param *priv; bool result; if (!do_base_typecheck(context, object, throw_error)) return false; - priv = priv_from_js(context, object); + GParamSpec* param = priv_from_js(context, object); - if (!priv->gparam) { + if (!param) { if (throw_error) { gjs_throw_custom(context, JSProto_TypeError, nullptr, "Object is GObject.ParamSpec.prototype, not an object instance - " @@ -292,14 +275,14 @@ } if (expected_type != G_TYPE_NONE) - result = g_type_is_a (G_TYPE_FROM_INSTANCE (priv->gparam), expected_type); + result = g_type_is_a(G_TYPE_FROM_INSTANCE(param), expected_type); else result = true; if (!result && throw_error) { gjs_throw_custom(context, JSProto_TypeError, nullptr, "Object is of type %s - cannot convert to %s", - g_type_name(G_TYPE_FROM_INSTANCE (priv->gparam)), + g_type_name(G_TYPE_FROM_INSTANCE(param)), g_type_name(expected_type)); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gjs-1.64.2/meson.build new/gjs-1.64.3/meson.build --- old/gjs-1.64.2/meson.build 2020-04-28 04:53:25.000000000 +0200 +++ new/gjs-1.64.3/meson.build 2020-05-31 19:42:30.610444000 +0200 @@ -1,4 +1,4 @@ -project('gjs', 'cpp', 'c', version: '1.64.2', license: ['MIT', 'LGPL2+'], +project('gjs', 'cpp', 'c', version: '1.64.3', license: ['MIT', 'LGPL2+'], meson_version: '>= 0.50.0', default_options: ['cpp_std=c++14', 'c_std=c99', 'warning_level=2']) @@ -577,6 +577,7 @@ meson.current_source_dir() / 'installed-tests' / 'extra' / 'lsan.supp')) tests_environment.set('NO_AT_BRIDGE', '1') tests_environment.set('GSETTINGS_SCHEMA_DIR', js_tests_builddir) +tests_environment.set('GSETTINGS_BACKEND', 'memory') tests_environment.set('G_DEBUG', 'fatal-warnings,fatal-criticals') tests_locale = 'N/A' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gjs-1.64.2/modules/cairo-context.cpp new/gjs-1.64.3/modules/cairo-context.cpp --- old/gjs-1.64.2/modules/cairo-context.cpp 2020-04-28 04:53:25.000000000 +0200 +++ new/gjs-1.64.3/modules/cairo-context.cpp 2020-05-31 19:42:30.610444000 +0200 @@ -47,12 +47,13 @@ #include "gjs/macros.h" #include "modules/cairo-private.h" -#define _GJS_CAIRO_CONTEXT_DEFINE_FUNC_BEGIN(mname) \ - GJS_JSAPI_RETURN_CONVENTION \ - static bool mname##_func(JSContext* context, unsigned argc, \ - JS::Value* vp) { \ - GJS_GET_PRIV(context, argc, vp, argv, obj, GjsCairoContext, priv); \ - cairo_t* cr = priv ? priv->cr : nullptr; +#define _GJS_CAIRO_CONTEXT_DEFINE_FUNC_BEGIN(mname) \ + GJS_JSAPI_RETURN_CONVENTION \ + static bool mname##_func(JSContext* context, unsigned argc, \ + JS::Value* vp) { \ + GJS_GET_PRIV(context, argc, vp, argv, obj, cairo_t, cr); \ + if (!cr) \ + return true; #define _GJS_CAIRO_CONTEXT_DEFINE_FUNC_END \ return gjs_cairo_check_status(context, cairo_status(cr), "context"); \ @@ -243,31 +244,17 @@ argv.rval().setUndefined(); \ _GJS_CAIRO_CONTEXT_DEFINE_FUNC_END -typedef struct { - cairo_t * cr; -} GjsCairoContext; - GJS_USE static JSObject *gjs_cairo_context_get_proto(JSContext *); GJS_DEFINE_PROTO_WITH_GTYPE("Context", cairo_context, CAIRO_GOBJECT_TYPE_CONTEXT, JSCLASS_BACKGROUND_FINALIZE) -GJS_DEFINE_PRIV_FROM_JS(GjsCairoContext, gjs_cairo_context_class); - -static void -_gjs_cairo_context_construct_internal(JSContext *context, - JS::HandleObject obj, - cairo_t *cr) -{ - GjsCairoContext *priv; +GJS_DEFINE_PRIV_FROM_JS(cairo_t, gjs_cairo_context_class); - priv = g_slice_new0(GjsCairoContext); - - g_assert(!priv_from_js(context, obj)); - JS_SetPrivate(obj, priv); - - priv->cr = cairo_reference(cr); +static void _gjs_cairo_context_construct_internal(JSObject* obj, cairo_t* cr) { + g_assert(!JS_GetPrivate(obj)); + JS_SetPrivate(obj, cairo_reference(cr)); } GJS_NATIVE_CONSTRUCTOR_DECLARE(cairo_context) @@ -292,7 +279,7 @@ if (!gjs_cairo_check_status(context, cairo_status(cr), "context")) return false; - _gjs_cairo_context_construct_internal(context, object, cr); + _gjs_cairo_context_construct_internal(object, cr); cairo_destroy(cr); GJS_NATIVE_CONSTRUCTOR_FINISH(cairo_context); @@ -301,15 +288,9 @@ } static void gjs_cairo_context_finalize(JSFreeOp*, JSObject* obj) { - GjsCairoContext *priv; - priv = (GjsCairoContext*) JS_GetPrivate(obj); - if (!priv) - return; - - if (priv->cr) - cairo_destroy(priv->cr); - - g_slice_free(GjsCairoContext, priv); + using AutoCairoContext = GjsAutoPointer<cairo_t, cairo_t, cairo_destroy>; + AutoCairoContext cr = static_cast<cairo_t*>(JS_GetPrivate(obj)); + JS_SetPrivate(obj, nullptr); } /* Properties */ @@ -402,9 +383,12 @@ unsigned argc, JS::Value *vp) { - GJS_GET_PRIV(context, argc, vp, rec, obj, GjsCairoContext, priv); + GJS_GET_PRIV(context, argc, vp, rec, obj, cairo_t, cr); + if (!cr) + return true; - g_clear_pointer(&priv->cr, cairo_destroy); + cairo_destroy(cr); + JS_SetPrivate(obj, nullptr); rec.rval().setUndefined(); return true; @@ -416,9 +400,11 @@ unsigned argc, JS::Value *vp) { - GJS_GET_PRIV(context, argc, vp, argv, obj, GjsCairoContext, priv); + GJS_GET_PRIV(context, argc, vp, argv, obj, cairo_t, cr); + if (!cr) + return true; + JS::RootedObject path_wrapper(context); - cairo_t* cr = priv ? priv->cr : nullptr; if (!gjs_parse_call_args(context, "path", argv, "o", "path", &path_wrapper)) @@ -439,9 +425,11 @@ unsigned argc, JS::Value *vp) { - GJS_GET_PRIV(context, argc, vp, argv, obj, GjsCairoContext, priv); + GJS_GET_PRIV(context, argc, vp, argv, obj, cairo_t, cr); + if (!cr) + return true; + cairo_path_t *path; - cairo_t* cr = priv ? priv->cr : nullptr; if (!gjs_parse_call_args(context, "", argv, "")) return false; @@ -457,9 +445,11 @@ unsigned argc, JS::Value *vp) { - GJS_GET_PRIV(context, argc, vp, argv, obj, GjsCairoContext, priv); + GJS_GET_PRIV(context, argc, vp, argv, obj, cairo_t, cr); + if (!cr) + return true; + cairo_path_t *path; - cairo_t* cr = priv ? priv->cr : nullptr; if (!gjs_parse_call_args(context, "", argv, "")) return false; @@ -475,9 +465,11 @@ unsigned argc, JS::Value *vp) { - GJS_GET_PRIV(context, argc, vp, argv, obj, GjsCairoContext, priv); + GJS_GET_PRIV(context, argc, vp, argv, obj, cairo_t, cr); + if (!cr) + return true; + JS::RootedObject pattern_wrapper(context); - cairo_t* cr = priv ? priv->cr : nullptr; if (!gjs_parse_call_args(context, "mask", argv, "o", "pattern", &pattern_wrapper)) @@ -503,10 +495,12 @@ unsigned argc, JS::Value *vp) { - GJS_GET_PRIV(context, argc, vp, argv, obj, GjsCairoContext, priv); + GJS_GET_PRIV(context, argc, vp, argv, obj, cairo_t, cr); + if (!cr) + return true; + JS::RootedObject surface_wrapper(context); double x, y; - cairo_t* cr = priv ? priv->cr : nullptr; if (!gjs_parse_call_args(context, "maskSurface", argv, "off", "surface", &surface_wrapper, @@ -534,9 +528,11 @@ unsigned argc, JS::Value *vp) { - GJS_GET_PRIV(context, argc, vp, argv, obj, GjsCairoContext, priv); + GJS_GET_PRIV(context, argc, vp, argv, obj, cairo_t, cr); + if (!cr) + return true; + guint i; - cairo_t* cr = priv ? priv->cr : nullptr; JS::RootedObject dashes(context); double offset; guint len; @@ -593,9 +589,11 @@ unsigned argc, JS::Value *vp) { - GJS_GET_PRIV(context, argc, vp, argv, obj, GjsCairoContext, priv); + GJS_GET_PRIV(context, argc, vp, argv, obj, cairo_t, cr); + if (!cr) + return true; + JS::RootedObject pattern_wrapper(context); - cairo_t* cr = priv ? priv->cr : nullptr; if (!gjs_parse_call_args(context, "setSource", argv, "o", "pattern", &pattern_wrapper)) @@ -622,10 +620,12 @@ unsigned argc, JS::Value *vp) { - GJS_GET_PRIV(context, argc, vp, argv, obj, GjsCairoContext, priv); + GJS_GET_PRIV(context, argc, vp, argv, obj, cairo_t, cr); + if (!cr) + return true; + JS::RootedObject surface_wrapper(context); double x, y; - cairo_t* cr = priv ? priv->cr : nullptr; if (!gjs_parse_call_args(context, "setSourceSurface", argv, "off", "surface", &surface_wrapper, @@ -654,9 +654,11 @@ unsigned argc, JS::Value *vp) { - GJS_GET_PRIV(context, argc, vp, argv, obj, GjsCairoContext, priv); + GJS_GET_PRIV(context, argc, vp, argv, obj, cairo_t, cr); + if (!cr) + return true; + JS::UniqueChars utf8; - cairo_t* cr = priv ? priv->cr : nullptr; if (!gjs_parse_call_args(context, "showText", argv, "s", "utf8", &utf8)) @@ -678,11 +680,13 @@ unsigned argc, JS::Value *vp) { - GJS_GET_PRIV(context, argc, vp, argv, obj, GjsCairoContext, priv); + GJS_GET_PRIV(context, argc, vp, argv, obj, cairo_t, cr); + if (!cr) + return true; + JS::UniqueChars family; cairo_font_slant_t slant; cairo_font_weight_t weight; - cairo_t* cr = priv ? priv->cr : nullptr; if (!gjs_parse_call_args(context, "selectFontFace", argv, "sii", "family", &family, @@ -705,8 +709,10 @@ unsigned argc, JS::Value *vp) { - GJS_GET_PRIV(context, argc, vp, rec, obj, GjsCairoContext, priv); - cairo_t* cr = priv ? priv->cr : nullptr; + GJS_GET_PRIV(context, argc, vp, rec, obj, cairo_t, cr); + if (!cr) + return true; + cairo_pattern_t *pattern; JSObject *pattern_wrapper; @@ -736,8 +742,10 @@ unsigned argc, JS::Value *vp) { - GJS_GET_PRIV(context, argc, vp, rec, obj, GjsCairoContext, priv); - cairo_t* cr = priv ? priv->cr : nullptr; + GJS_GET_PRIV(context, argc, vp, rec, obj, cairo_t, cr); + if (!cr) + return true; + cairo_pattern_t *pattern; JSObject *pattern_wrapper; @@ -768,8 +776,10 @@ unsigned argc, JS::Value *vp) { - GJS_GET_PRIV(context, argc, vp, rec, obj, GjsCairoContext, priv); - cairo_t* cr = priv ? priv->cr : nullptr; + GJS_GET_PRIV(context, argc, vp, rec, obj, cairo_t, cr); + if (!cr) + return true; + cairo_surface_t *surface; JSObject *surface_wrapper; @@ -800,8 +810,10 @@ unsigned argc, JS::Value *vp) { - GJS_GET_PRIV(context, argc, vp, rec, obj, GjsCairoContext, priv); - cairo_t* cr = priv ? priv->cr : nullptr; + GJS_GET_PRIV(context, argc, vp, rec, obj, cairo_t, cr); + if (!cr) + return true; + cairo_surface_t *surface; JSObject *surface_wrapper; @@ -939,7 +951,7 @@ if (!object) return nullptr; - _gjs_cairo_context_construct_internal(context, object, cr); + _gjs_cairo_context_construct_internal(object, cr); return object; } @@ -948,12 +960,7 @@ gjs_cairo_context_get_context(JSContext *context, JS::HandleObject object) { - GjsCairoContext *priv; - priv = priv_from_js(context, object); - if (!priv) - return nullptr; - - return priv->cr; + return priv_from_js(context, object); } GJS_USE diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gjs-1.64.2/modules/cairo-image-surface.cpp new/gjs-1.64.3/modules/cairo-image-surface.cpp --- old/gjs-1.64.2/modules/cairo-image-surface.cpp 2020-04-28 04:53:25.000000000 +0200 +++ new/gjs-1.64.3/modules/cairo-image-surface.cpp 2020-05-31 19:42:30.611444000 +0200 @@ -64,7 +64,7 @@ if (!gjs_cairo_check_status(context, cairo_surface_status(surface), "surface")) return false; - gjs_cairo_surface_construct(context, object, surface); + gjs_cairo_surface_construct(object, surface); cairo_surface_destroy(surface); GJS_NATIVE_CONSTRUCTOR_FINISH(cairo_image_surface); @@ -110,7 +110,7 @@ gjs_throw(context, "failed to create surface"); return false; } - gjs_cairo_surface_construct(context, surface_wrapper, surface); + gjs_cairo_surface_construct(surface_wrapper, surface); cairo_surface_destroy(surface); argv.rval().setObject(*surface_wrapper); @@ -256,7 +256,7 @@ return nullptr; } - gjs_cairo_surface_construct(context, object, surface); + gjs_cairo_surface_construct(object, surface); return object; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gjs-1.64.2/modules/cairo-linear-gradient.cpp new/gjs-1.64.3/modules/cairo-linear-gradient.cpp --- old/gjs-1.64.2/modules/cairo-linear-gradient.cpp 2020-04-28 04:53:25.000000000 +0200 +++ new/gjs-1.64.3/modules/cairo-linear-gradient.cpp 2020-05-31 19:42:30.611444000 +0200 @@ -63,7 +63,7 @@ if (!gjs_cairo_check_status(context, cairo_pattern_status(pattern), "pattern")) return false; - gjs_cairo_pattern_construct(context, object, pattern); + gjs_cairo_pattern_construct(object, pattern); cairo_pattern_destroy(pattern); GJS_NATIVE_CONSTRUCTOR_FINISH(cairo_linear_gradient); @@ -108,7 +108,7 @@ return nullptr; } - gjs_cairo_pattern_construct(context, object, pattern); + gjs_cairo_pattern_construct(object, pattern); return object; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gjs-1.64.2/modules/cairo-path.cpp new/gjs-1.64.3/modules/cairo-path.cpp --- old/gjs-1.64.2/modules/cairo-path.cpp 2020-04-28 04:53:25.000000000 +0200 +++ new/gjs-1.64.3/modules/cairo-path.cpp 2020-05-31 19:42:30.611444000 +0200 @@ -36,23 +36,16 @@ #include "gjs/macros.h" #include "modules/cairo-private.h" // IWYU pragma: keep -typedef struct { - cairo_path_t *path; -} GjsCairoPath; - GJS_USE static JSObject *gjs_cairo_path_get_proto(JSContext *); GJS_DEFINE_PROTO_ABSTRACT("Path", cairo_path, JSCLASS_BACKGROUND_FINALIZE) -GJS_DEFINE_PRIV_FROM_JS(GjsCairoPath, gjs_cairo_path_class) static void gjs_cairo_path_finalize(JSFreeOp*, JSObject* obj) { - GjsCairoPath *priv; - priv = (GjsCairoPath*) JS_GetPrivate(obj); - if (!priv) - return; - cairo_path_destroy(priv->path); - g_slice_free(GjsCairoPath, priv); + using AutoCairoPath = + GjsAutoPointer<cairo_path_t, cairo_path_t, cairo_path_destroy>; + AutoCairoPath path = static_cast<cairo_path_t*>(JS_GetPrivate(obj)); + JS_SetPrivate(obj, nullptr); } /* Properties */ @@ -78,8 +71,6 @@ gjs_cairo_path_from_path(JSContext *context, cairo_path_t *path) { - GjsCairoPath *priv; - g_return_val_if_fail(context, nullptr); g_return_val_if_fail(path, nullptr); @@ -91,12 +82,8 @@ return nullptr; } - priv = g_slice_new0(GjsCairoPath); - - g_assert(!priv_from_js(context, object)); - JS_SetPrivate(object, priv); - - priv->path = path; + g_assert(!JS_GetPrivate(object)); + JS_SetPrivate(object, path); return object; } @@ -113,14 +100,13 @@ g_return_val_if_fail(cx, nullptr); g_return_val_if_fail(path_wrapper, nullptr); - auto* priv = static_cast<GjsCairoPath*>(JS_GetInstancePrivate( + auto* path = static_cast<cairo_path_t*>(JS_GetInstancePrivate( cx, path_wrapper, &gjs_cairo_path_class, nullptr)); - if (!priv) { + if (!path) { gjs_throw(cx, "Expected Cairo.Path but got %s", JS_GetClass(path_wrapper)->name); return nullptr; } - g_assert(priv->path); - return priv->path; + return path; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gjs-1.64.2/modules/cairo-pattern.cpp new/gjs-1.64.3/modules/cairo-pattern.cpp --- old/gjs-1.64.2/modules/cairo-pattern.cpp 2020-04-28 04:53:25.000000000 +0200 +++ new/gjs-1.64.3/modules/cairo-pattern.cpp 2020-05-31 19:42:30.611444000 +0200 @@ -38,22 +38,15 @@ #include "gjs/macros.h" #include "modules/cairo-private.h" -typedef struct { - cairo_pattern_t *pattern; -} GjsCairoPattern; - GJS_DEFINE_PROTO_ABSTRACT_WITH_GTYPE("Pattern", cairo_pattern, CAIRO_GOBJECT_TYPE_PATTERN, JSCLASS_BACKGROUND_FINALIZE) -GJS_DEFINE_PRIV_FROM_JS(GjsCairoPattern, gjs_cairo_pattern_class) static void gjs_cairo_pattern_finalize(JSFreeOp*, JSObject* obj) { - GjsCairoPattern *priv; - priv = (GjsCairoPattern*) JS_GetPrivate(obj); - if (!priv) - return; - cairo_pattern_destroy(priv->pattern); - g_slice_free(GjsCairoPattern, priv); + using AutoPattern = + GjsAutoPointer<cairo_pattern_t, cairo_pattern_t, cairo_pattern_destroy>; + AutoPattern pattern = static_cast<cairo_pattern_t*>(JS_GetPrivate(obj)); + JS_SetPrivate(obj, nullptr); } /* Properties */ @@ -102,7 +95,6 @@ /** * gjs_cairo_pattern_construct: - * @context: the context * @object: object to construct * @pattern: cairo_pattern to attach to the object * @@ -111,23 +103,12 @@ * * This is mainly used for subclasses where object is already created. */ -void -gjs_cairo_pattern_construct(JSContext *context, - JS::HandleObject object, - cairo_pattern_t *pattern) -{ - GjsCairoPattern *priv; - - g_return_if_fail(context); +void gjs_cairo_pattern_construct(JSObject* object, cairo_pattern_t* pattern) { g_return_if_fail(object); g_return_if_fail(pattern); - priv = g_slice_new0(GjsCairoPattern); - - g_assert(!priv_from_js(context, object)); - JS_SetPrivate(object, priv); - - priv->pattern = cairo_pattern_reference(pattern); + g_assert(!JS_GetPrivate(object)); + JS_SetPrivate(object, cairo_pattern_reference(pattern)); } /** @@ -209,10 +190,5 @@ return nullptr; } - auto* priv = static_cast<GjsCairoPattern*>(JS_GetPrivate(pattern_wrapper)); - if (!priv) - return nullptr; - - g_assert(priv->pattern); - return priv->pattern; + return static_cast<cairo_pattern_t*>(JS_GetPrivate(pattern_wrapper)); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gjs-1.64.2/modules/cairo-pdf-surface.cpp new/gjs-1.64.3/modules/cairo-pdf-surface.cpp --- old/gjs-1.64.2/modules/cairo-pdf-surface.cpp 2020-04-28 04:53:25.000000000 +0200 +++ new/gjs-1.64.3/modules/cairo-pdf-surface.cpp 2020-05-31 19:42:30.611444000 +0200 @@ -70,7 +70,7 @@ "surface")) return false; - gjs_cairo_surface_construct(context, object, surface); + gjs_cairo_surface_construct(object, surface); cairo_surface_destroy(surface); GJS_NATIVE_CONSTRUCTOR_FINISH(cairo_pdf_surface); @@ -113,7 +113,7 @@ return nullptr; } - gjs_cairo_surface_construct(context, object, surface); + gjs_cairo_surface_construct(object, surface); return object; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gjs-1.64.2/modules/cairo-private.h new/gjs-1.64.3/modules/cairo-private.h --- old/gjs-1.64.2/modules/cairo-private.h 2020-04-28 04:53:25.000000000 +0200 +++ new/gjs-1.64.3/modules/cairo-private.h 2020-05-31 19:42:30.611444000 +0200 @@ -80,9 +80,7 @@ JS::HandleObject module, JS::MutableHandleObject proto); -void gjs_cairo_surface_construct (JSContext *context, - JS::HandleObject object, - cairo_surface_t *surface); +void gjs_cairo_surface_construct(JSObject* object, cairo_surface_t* surface); void gjs_cairo_surface_finalize_surface (JSFreeOp *fop, JSObject *object); GJS_JSAPI_RETURN_CONVENTION @@ -147,9 +145,7 @@ JS::HandleObject module, JS::MutableHandleObject proto); -void gjs_cairo_pattern_construct (JSContext *context, - JS::HandleObject object, - cairo_pattern_t *pattern); +void gjs_cairo_pattern_construct(JSObject* object, cairo_pattern_t* pattern); void gjs_cairo_pattern_finalize_pattern (JSFreeOp *fop, JSObject *object); GJS_JSAPI_RETURN_CONVENTION diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gjs-1.64.2/modules/cairo-ps-surface.cpp new/gjs-1.64.3/modules/cairo-ps-surface.cpp --- old/gjs-1.64.2/modules/cairo-ps-surface.cpp 2020-04-28 04:53:25.000000000 +0200 +++ new/gjs-1.64.3/modules/cairo-ps-surface.cpp 2020-05-31 19:42:30.611444000 +0200 @@ -70,7 +70,7 @@ "surface")) return false; - gjs_cairo_surface_construct(context, object, surface); + gjs_cairo_surface_construct(object, surface); cairo_surface_destroy(surface); GJS_NATIVE_CONSTRUCTOR_FINISH(cairo_ps_surface); @@ -121,7 +121,7 @@ return nullptr; } - gjs_cairo_surface_construct(context, object, surface); + gjs_cairo_surface_construct(object, surface); return object; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gjs-1.64.2/modules/cairo-radial-gradient.cpp new/gjs-1.64.3/modules/cairo-radial-gradient.cpp --- old/gjs-1.64.2/modules/cairo-radial-gradient.cpp 2020-04-28 04:53:25.000000000 +0200 +++ new/gjs-1.64.3/modules/cairo-radial-gradient.cpp 2020-05-31 19:42:30.611444000 +0200 @@ -65,7 +65,7 @@ if (!gjs_cairo_check_status(context, cairo_pattern_status(pattern), "pattern")) return false; - gjs_cairo_pattern_construct(context, object, pattern); + gjs_cairo_pattern_construct(object, pattern); cairo_pattern_destroy(pattern); GJS_NATIVE_CONSTRUCTOR_FINISH(cairo_radial_gradient); @@ -110,7 +110,7 @@ return nullptr; } - gjs_cairo_pattern_construct(context, object, pattern); + gjs_cairo_pattern_construct(object, pattern); return object; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gjs-1.64.2/modules/cairo-region.cpp new/gjs-1.64.3/modules/cairo-region.cpp --- old/gjs-1.64.2/modules/cairo-region.cpp 2020-04-28 04:53:25.000000000 +0200 +++ new/gjs-1.64.3/modules/cairo-region.cpp 2020-05-31 19:42:30.611444000 +0200 @@ -46,27 +46,19 @@ #include "gjs/macros.h" #include "modules/cairo-private.h" -typedef struct { - cairo_region_t *region; -} GjsCairoRegion; - GJS_USE static JSObject *gjs_cairo_region_get_proto(JSContext *); GJS_DEFINE_PROTO_WITH_GTYPE("Region", cairo_region, CAIRO_GOBJECT_TYPE_REGION, JSCLASS_BACKGROUND_FINALIZE) -GJS_DEFINE_PRIV_FROM_JS(GjsCairoRegion, gjs_cairo_region_class); static cairo_region_t * get_region(JSContext *context, JS::HandleObject obj) { - GjsCairoRegion *priv = priv_from_js(context, obj); - if (!priv) - return nullptr; - else - return priv->region; + return static_cast<cairo_region_t*>( + JS_GetInstancePrivate(context, obj, &gjs_cairo_region_class, nullptr)); } GJS_JSAPI_RETURN_CONVENTION @@ -75,9 +67,10 @@ JS::HandleObject obj, cairo_rectangle_int_t *rect); -#define PRELUDE \ - GJS_GET_PRIV(context, argc, vp, argv, obj, GjsCairoRegion, priv); \ - cairo_region_t* this_region = priv ? priv->region : nullptr; +#define PRELUDE \ + GJS_GET_THIS(context, argc, vp, argv, obj); \ + auto* this_region = static_cast<cairo_region_t*>(JS_GetInstancePrivate( \ + context, obj, &gjs_cairo_region_class, nullptr)); #define RETURN_STATUS \ return gjs_cairo_check_status(context, cairo_region_status(this_region), "region"); @@ -250,19 +243,10 @@ JSFunctionSpec gjs_cairo_region_static_funcs[] = { JS_FS_END }; -static void -_gjs_cairo_region_construct_internal(JSContext *context, - JS::HandleObject obj, - cairo_region_t *region) -{ - GjsCairoRegion *priv; - - priv = g_slice_new0(GjsCairoRegion); - - g_assert(!priv_from_js(context, obj)); - JS_SetPrivate(obj, priv); - - priv->region = cairo_region_reference(region); +static void _gjs_cairo_region_construct_internal(JSObject* obj, + cairo_region_t* region) { + g_assert(!JS_GetPrivate(obj)); + JS_SetPrivate(obj, cairo_region_reference(region)); } GJS_NATIVE_CONSTRUCTOR_DECLARE(cairo_region) @@ -277,7 +261,7 @@ region = cairo_region_create(); - _gjs_cairo_region_construct_internal(context, object, region); + _gjs_cairo_region_construct_internal(object, region); cairo_region_destroy(region); GJS_NATIVE_CONSTRUCTOR_FINISH(cairo_region); @@ -286,13 +270,10 @@ } static void gjs_cairo_region_finalize(JSFreeOp*, JSObject* obj) { - GjsCairoRegion *priv; - priv = (GjsCairoRegion*) JS_GetPrivate(obj); - if (!priv) - return; - - cairo_region_destroy(priv->region); - g_slice_free(GjsCairoRegion, priv); + using AutoCairoRegion = + GjsAutoPointer<cairo_region_t, cairo_region_t, cairo_region_destroy>; + AutoCairoRegion region = static_cast<cairo_region_t*>(JS_GetPrivate(obj)); + JS_SetPrivate(obj, nullptr); } GJS_JSAPI_RETURN_CONVENTION @@ -306,7 +287,7 @@ if (!object) return nullptr; - _gjs_cairo_region_construct_internal(context, object, region); + _gjs_cairo_region_construct_internal(object, region); return object; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gjs-1.64.2/modules/cairo-solid-pattern.cpp new/gjs-1.64.3/modules/cairo-solid-pattern.cpp --- old/gjs-1.64.2/modules/cairo-solid-pattern.cpp 2020-04-28 04:53:25.000000000 +0200 +++ new/gjs-1.64.3/modules/cairo-solid-pattern.cpp 2020-05-31 19:42:30.611444000 +0200 @@ -140,7 +140,7 @@ return nullptr; } - gjs_cairo_pattern_construct(context, object, pattern); + gjs_cairo_pattern_construct(object, pattern); return object; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gjs-1.64.2/modules/cairo-surface-pattern.cpp new/gjs-1.64.3/modules/cairo-surface-pattern.cpp --- old/gjs-1.64.2/modules/cairo-surface-pattern.cpp 2020-04-28 04:53:25.000000000 +0200 +++ new/gjs-1.64.3/modules/cairo-surface-pattern.cpp 2020-05-31 19:42:30.611444000 +0200 @@ -66,7 +66,7 @@ if (!gjs_cairo_check_status(context, cairo_pattern_status(pattern), "pattern")) return false; - gjs_cairo_pattern_construct(context, object, pattern); + gjs_cairo_pattern_construct(object, pattern); cairo_pattern_destroy(pattern); GJS_NATIVE_CONSTRUCTOR_FINISH(cairo_surface_pattern); @@ -222,7 +222,7 @@ return nullptr; } - gjs_cairo_pattern_construct(context, object, pattern); + gjs_cairo_pattern_construct(object, pattern); return object; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gjs-1.64.2/modules/cairo-surface.cpp new/gjs-1.64.3/modules/cairo-surface.cpp --- old/gjs-1.64.2/modules/cairo-surface.cpp 2020-04-28 04:53:25.000000000 +0200 +++ new/gjs-1.64.3/modules/cairo-surface.cpp 2020-05-31 19:42:30.611444000 +0200 @@ -43,22 +43,15 @@ #include "gjs/macros.h" #include "modules/cairo-private.h" -typedef struct { - cairo_surface_t *surface; -} GjsCairoSurface; - GJS_DEFINE_PROTO_ABSTRACT_WITH_GTYPE("Surface", cairo_surface, CAIRO_GOBJECT_TYPE_SURFACE, JSCLASS_BACKGROUND_FINALIZE) -GJS_DEFINE_PRIV_FROM_JS(GjsCairoSurface, gjs_cairo_surface_class) static void gjs_cairo_surface_finalize(JSFreeOp*, JSObject* obj) { - GjsCairoSurface *priv; - priv = (GjsCairoSurface*) JS_GetPrivate(obj); - if (!priv) - return; - cairo_surface_destroy(priv->surface); - g_slice_free(GjsCairoSurface, priv); + using AutoSurface = + GjsAutoPointer<cairo_surface_t, cairo_surface_t, cairo_surface_destroy>; + AutoSurface surface = static_cast<cairo_surface_t*>(JS_GetPrivate(obj)); + JS_SetPrivate(obj, nullptr); } /* Properties */ @@ -142,7 +135,6 @@ /** * gjs_cairo_surface_construct: - * @context: the context * @object: object to construct * @surface: cairo_surface to attach to the object * @@ -151,23 +143,12 @@ * * This is mainly used for subclasses where object is already created. */ -void -gjs_cairo_surface_construct(JSContext *context, - JS::HandleObject object, - cairo_surface_t *surface) -{ - GjsCairoSurface *priv; - - g_return_if_fail(context); +void gjs_cairo_surface_construct(JSObject* object, cairo_surface_t* surface) { g_return_if_fail(object); g_return_if_fail(surface); - priv = g_slice_new0(GjsCairoSurface); - - g_assert(!priv_from_js(context, object)); - JS_SetPrivate(object, priv); - - priv->surface = cairo_surface_reference(surface); + g_assert(!JS_GetPrivate(object)); + JS_SetPrivate(object, cairo_surface_reference(surface)); } /** @@ -223,7 +204,7 @@ return nullptr; } - gjs_cairo_surface_construct(context, object, surface); + gjs_cairo_surface_construct(object, surface); return object; } @@ -252,12 +233,7 @@ return nullptr; } - auto* priv = static_cast<GjsCairoSurface*>(JS_GetPrivate(surface_wrapper)); - if (!priv) - return nullptr; - - g_assert(priv->surface); - return priv->surface; + return static_cast<cairo_surface_t*>(JS_GetPrivate(surface_wrapper)); } GJS_USE diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gjs-1.64.2/modules/cairo-svg-surface.cpp new/gjs-1.64.3/modules/cairo-svg-surface.cpp --- old/gjs-1.64.2/modules/cairo-svg-surface.cpp 2020-04-28 04:53:25.000000000 +0200 +++ new/gjs-1.64.3/modules/cairo-svg-surface.cpp 2020-05-31 19:42:30.611444000 +0200 @@ -70,7 +70,7 @@ "surface")) return false; - gjs_cairo_surface_construct(context, object, surface); + gjs_cairo_surface_construct(object, surface); cairo_surface_destroy(surface); GJS_NATIVE_CONSTRUCTOR_FINISH(cairo_svg_surface); @@ -113,7 +113,7 @@ return nullptr; } - gjs_cairo_surface_construct(context, object, surface); + gjs_cairo_surface_construct(object, surface); return object; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gjs-1.64.2/modules/core/overrides/GLib.js new/gjs-1.64.3/modules/core/overrides/GLib.js --- old/gjs-1.64.2/modules/core/overrides/GLib.js 2020-04-28 04:53:25.000000000 +0200 +++ new/gjs-1.64.3/modules/core/overrides/GLib.js 2020-05-31 19:42:30.612444000 +0200 @@ -419,17 +419,13 @@ }; this.strchug = function (string) { - // COMPAT: replace with trimStart() in mozjs68 - _warnNotIntrospectable('GLib.strchug()', - 'String.trimLeft() until SpiderMonkey 68, then String.trimStart()'); - return string.trimLeft(); + _warnNotIntrospectable('GLib.strchug()', 'String.trimStart()'); + return string.trimStart(); }; this.strchomp = function (string) { - // COMPAT: replace with trimEnd() in mozjs68 - _warnNotIntrospectable('GLib.strchomp()', - 'String.trimRight() until SpiderMonkey 68, then String.trimEnd()'); - return string.trimRight(); + _warnNotIntrospectable('GLib.strchomp()', 'String.trimEnd()'); + return string.trimEnd(); }; // g_strstrip() is a macro and therefore doesn't even appear in the GIR diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gjs-1.64.2/modules/core/overrides/Gtk.js new/gjs-1.64.3/modules/core/overrides/Gtk.js --- old/gjs-1.64.2/modules/core/overrides/Gtk.js 2020-04-28 04:53:25.000000000 +0200 +++ new/gjs-1.64.3/modules/core/overrides/Gtk.js 2020-05-31 19:42:30.612444000 +0200 @@ -37,7 +37,7 @@ let {GtkWidgetClass} = Legacy.defineGtkLegacyObjects(GObject, Gtk); Gtk.Widget.prototype.__metaclass__ = GtkWidgetClass; - if (Gtk.Container.prototype.child_set_property) { + if (Gtk.Container && Gtk.Container.prototype.child_set_property) { Gtk.Container.prototype.child_set_property = function (child, property, value) { GjsPrivate.gtk_container_child_set_property(this, child, property, value); }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gjs-1.64.2/modules/script/_bootstrap/debugger.js new/gjs-1.64.3/modules/script/_bootstrap/debugger.js --- old/gjs-1.64.2/modules/script/_bootstrap/debugger.js 2020-04-28 04:53:25.000000000 +0200 +++ new/gjs-1.64.3/modules/script/_bootstrap/debugger.js 2020-05-31 19:42:30.613444000 +0200 @@ -233,7 +233,7 @@ style.pretty = true; if (m[1].startsWith('b')) style.brief = true; - return [s.substr(m[0].length).trimLeft(), style]; + return [s.substr(m[0].length).trimStart(), style]; } function doPrint(expr, style) { @@ -749,9 +749,9 @@ // print/b x => ['print', '/b x'] // function breakcmd(cmd) { - cmd = cmd.trimLeft(); + cmd = cmd.trimStart(); if ("!@#$%^&*_+=/?.,<>:;'\"".includes(cmd.substr(0, 1))) - return [cmd.substr(0, 1), cmd.substr(1).trimLeft()]; + return [cmd.substr(0, 1), cmd.substr(1).trimStart()]; var m = /\s+|(?=\/)/.exec(cmd); if (m === null) return [cmd, '']; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gjs-1.64.2/test/gjs-test-call-args.cpp new/gjs-1.64.3/test/gjs-test-call-args.cpp --- old/gjs-1.64.2/test/gjs-test-call-args.cpp 2020-04-28 04:53:25.000000000 +0200 +++ new/gjs-1.64.3/test/gjs-test-call-args.cpp 2020-05-31 19:42:30.614444000 +0200 @@ -24,14 +24,16 @@ union Utf8Unit; } -#define assert_match(str, pattern) \ - G_STMT_START { \ - const char *__s1 = (str), *__s2 = (pattern); \ - if (!g_pattern_match_simple(__s2, __s1)) { \ - g_printerr("**\nExpected \"%s\" to match \"%s\"\n", __s1, __s2); \ - g_assert_not_reached(); \ - } \ - } G_STMT_END +#define assert_match(str, pattern) \ + G_STMT_START { \ + const char *__s1 = (str), *__s2 = (pattern); \ + if (!g_pattern_match_simple(__s2, __s1)) { \ + g_assertion_message(G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ + "assertion failed (\"" #str \ + "\" matches \"" #pattern "\")"); \ + } \ + } \ + G_STMT_END typedef enum _test_enum { ZERO, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gjs-1.64.2/test/gjs-test-coverage.cpp new/gjs-1.64.3/test/gjs-test-coverage.cpp --- old/gjs-1.64.2/test/gjs-test-coverage.cpp 2020-04-28 04:53:25.000000000 +0200 +++ new/gjs-1.64.3/test/gjs-test-coverage.cpp 2020-05-31 19:42:30.614444000 +0200 @@ -360,7 +360,7 @@ fixture->tmp_js_script, fixture->lcov_output); - g_assert(strstr(coverage_data_contents, existing_contents) != NULL); + g_assert_nonnull(strstr(coverage_data_contents, existing_contents)); g_free(coverage_data_contents); } @@ -379,7 +379,7 @@ fixture->lcov_output); /* We have new content in the coverage data */ - g_assert(strlen(existing_contents) != strlen(coverage_data_contents)); + g_assert_cmpstr(existing_contents, !=, coverage_data_contents); g_free(coverage_data_contents); } @@ -482,7 +482,7 @@ g_assert_cmpint(hit_count_num, >, 0); break; default: - g_assert_not_reached(); + g_assert_true(false && "Invalid branch state"); }; } @@ -643,7 +643,7 @@ line = line_starting_with(line + 1, "BRDA:"); } - g_assert_not_reached(); + g_assert_true(false && "BRDA line with line 3 not found"); } static void test_branch_not_hit_written_to_coverage_data(void* fixture_data, @@ -991,14 +991,13 @@ unsigned int lineno = strtol(coverage_line, &comma_ptr, 10); - g_assert(comma_ptr[0] == ','); + g_assert_cmpint(comma_ptr[0], ==, ','); char *end_ptr = NULL; unsigned int value = strtol(&comma_ptr[1], &end_ptr, 10); - g_assert(end_ptr[0] == '\0' || - end_ptr[0] == '\n'); + g_assert_true(end_ptr[0] == '\0' || end_ptr[0] == '\n'); g_assert_cmpuint(lineno, ==, data->expected_lineno); g_assert_cmpuint(value, >, data->expected_to_be_more_than); @@ -1105,7 +1104,7 @@ fixture->tmp_js_script, fixture->lcov_output); - g_assert(strstr(coverage_data_contents, "end_of_record") != NULL); + g_assert_nonnull(strstr(coverage_data_contents, "end_of_record")); g_free(coverage_data_contents); } @@ -1192,10 +1191,10 @@ fixture->base_fixture.lcov_output); const char *first_sf_record = line_starting_with(coverage_data_contents, "SF:"); - g_assert(first_sf_record != NULL); + g_assert_nonnull(first_sf_record); const char *second_sf_record = line_starting_with(first_sf_record + 1, "SF:"); - g_assert(second_sf_record != NULL); + g_assert_nonnull(second_sf_record); g_free(coverage_data_contents); } @@ -1232,7 +1231,7 @@ } } - g_assert_not_reached(); + g_assert_true(false && "Expected source file path to be found in section"); } static void diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gjs-1.64.2/test/gjs-tests.cpp new/gjs-1.64.3/test/gjs-tests.cpp --- old/gjs-1.64.2/test/gjs-tests.cpp 2020-04-28 04:53:25.000000000 +0200 +++ new/gjs-1.64.3/test/gjs-tests.cpp 2020-05-31 19:42:30.615444000 +0200 @@ -133,7 +133,7 @@ g_assert_cmpuint(foo_type, !=, G_TYPE_INVALID); gpointer foo = g_object_new(foo_type, NULL); - g_assert(G_IS_OBJECT(foo)); + g_assert_true(G_IS_OBJECT(foo)); g_object_unref(foo); g_object_unref(context); @@ -171,7 +171,7 @@ GjsUnitTestFixture* fx, const void*) { JS::RootedValue js_string(fx->cx); g_assert_true(gjs_string_from_utf8(fx->cx, VALID_UTF8_STRING, &js_string)); - g_assert(js_string.isString()); + g_assert_true(js_string.isString()); JS::UniqueChars utf8_result = gjs_string_to_utf8(fx->cx, js_string); g_assert_nonnull(utf8_result); @@ -186,15 +186,15 @@ gjs_throw(fx->cx, "This is an exception %d", 42); - g_assert(JS_IsExceptionPending(fx->cx)); + g_assert_true(JS_IsExceptionPending(fx->cx)); JS_GetPendingException(fx->cx, &exc); - g_assert(!exc.isUndefined()); + g_assert_false(exc.isUndefined()); JS::RootedObject exc_obj(fx->cx, &exc.toObject()); JS_GetProperty(fx->cx, exc_obj, "message", &value); - g_assert(value.isString()); + g_assert_true(value.isString()); JS::UniqueChars s = gjs_string_to_utf8(fx->cx, value); g_assert_nonnull(s); @@ -205,21 +205,21 @@ JS_ClearPendingException(fx->cx); - g_assert(!JS_IsExceptionPending(fx->cx)); + g_assert_false(JS_IsExceptionPending(fx->cx)); /* Check that we don't overwrite a pending exception */ JS_SetPendingException(fx->cx, previous); - g_assert(JS_IsExceptionPending(fx->cx)); + g_assert_true(JS_IsExceptionPending(fx->cx)); gjs_throw(fx->cx, "Second different exception %s", "foo"); - g_assert(JS_IsExceptionPending(fx->cx)); + g_assert_true(JS_IsExceptionPending(fx->cx)); exc = JS::UndefinedValue(); JS_GetPendingException(fx->cx, &exc); - g_assert(!exc.isUndefined()); - g_assert(&exc.toObject() == &previous.toObject()); + g_assert_false(exc.isUndefined()); + g_assert_true(&exc.toObject() == &previous.toObject()); } static void test_jsapi_util_string_utf8_nchars_to_js(GjsUnitTestFixture* fx, @@ -328,8 +328,8 @@ char **ret; ret = gjs_g_strv_concat(NULL, 0); - g_assert(ret != NULL); - g_assert(ret[0] == NULL); + g_assert_nonnull(ret); + g_assert_null(ret[0]); g_strfreev(ret); } @@ -350,12 +350,12 @@ stuff[3] = strv3; ret = gjs_g_strv_concat(stuff, 4); - g_assert(ret != NULL); + g_assert_nonnull(ret); g_assert_cmpstr(ret[0], ==, strv0[0]); /* same string */ - g_assert(ret[0] != strv0[0]); /* different pointer */ + g_assert_true(ret[0] != strv0[0]); // different pointer g_assert_cmpstr(ret[1], ==, strv3[0]); - g_assert(ret[1] != strv3[0]); - g_assert(ret[2] == NULL); + g_assert_true(ret[1] != strv3[0]); + g_assert_null(ret[2]); g_strfreev(ret); }