Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package cjs for openSUSE:Factory checked in at 2021-01-21 21:57:18 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/cjs (Old) and /work/SRC/openSUSE:Factory/.cjs.new.28504 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "cjs" Thu Jan 21 21:57:18 2021 rev:17 rq:865362 version:4.8.2 Changes: -------- --- /work/SRC/openSUSE:Factory/cjs/cjs.changes 2021-01-01 21:13:35.183378385 +0100 +++ /work/SRC/openSUSE:Factory/.cjs.new.28504/cjs.changes 2021-01-21 21:57:19.121856067 +0100 @@ -1,0 +2,6 @@ +Thu Jan 14 10:53:44 UTC 2021 - andy great <andythe_gr...@pm.me> + +- Update to version 4.8.2. + * Rebase on gjs 1.66.1. + +------------------------------------------------------------------- Old: ---- cjs-4.8.1.tar.gz New: ---- cjs-4.8.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ cjs.spec ++++++ --- /var/tmp/diff_new_pack.jAYEIK/_old 2021-01-21 21:57:19.653856248 +0100 +++ /var/tmp/diff_new_pack.jAYEIK/_new 2021-01-21 21:57:19.657856250 +0100 @@ -1,7 +1,7 @@ # # spec file for package cjs # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2021 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -21,7 +21,7 @@ %define typelib typelib-1_0-CjsPrivate-1_0 %define __requires_exclude_from ^.*installed-tests.*$ Name: cjs -Version: 4.8.1 +Version: 4.8.2 Release: 0 Summary: JavaScript module used by Cinnamon License: MIT AND (MPL-1.1 OR GPL-2.0-or-later OR LGPL-2.1-or-later) ++++++ cjs-4.8.1.tar.gz -> cjs-4.8.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cjs-4.8.1/cjs/console.cpp new/cjs-4.8.2/cjs/console.cpp --- old/cjs-4.8.1/cjs/console.cpp 2020-12-08 11:14:53.000000000 +0100 +++ new/cjs-4.8.2/cjs/console.cpp 2021-01-12 12:11:08.000000000 +0100 @@ -58,7 +58,7 @@ "Print version of the JS engine and exit" }, { "command", 'c', 0, G_OPTION_ARG_STRING, &command, "Program passed in as a string", "COMMAND" }, { "coverage-prefix", 'C', 0, G_OPTION_ARG_STRING_ARRAY, &coverage_prefixes, "Add the prefix PREFIX to the list of files to generate coverage info for", "PREFIX" }, - { "coverage-output", 0, 0, G_OPTION_ARG_STRING, &coverage_output_path, "Write coverage output to a directory DIR. This option is mandatory when using --coverage-path", "DIR", }, + { "coverage-output", 0, 0, G_OPTION_ARG_STRING, &coverage_output_path, "Write coverage output to a directory DIR. This option is mandatory when using --coverage-prefix", "DIR", }, { "include-path", 'I', 0, G_OPTION_ARG_STRING_ARRAY, &include_path, "Add the directory DIR to the list of directories to search for js files.", "DIR" }, { "profile", 0, G_OPTION_FLAG_OPTIONAL_ARG | G_OPTION_FLAG_FILENAME, G_OPTION_ARG_CALLBACK, reinterpret_cast<void *>(&parse_profile_arg), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cjs-4.8.1/debian/changelog new/cjs-4.8.2/debian/changelog --- old/cjs-4.8.1/debian/changelog 2020-12-08 11:14:53.000000000 +0100 +++ new/cjs-4.8.2/debian/changelog 2021-01-12 12:11:08.000000000 +0100 @@ -1,3 +1,10 @@ +cjs (4.8.2) ulyssa; urgency=medium + + [ Leigh Scott ] + * Rebase on 1.66.1 (#90) + + -- Clement Lefebvre <r...@linuxmint.com> Tue, 12 Jan 2021 11:10:48 +0000 + cjs (4.8.1) ulyssa; urgency=medium [ Leigh Scott ] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cjs-4.8.1/examples/clutter.js new/cjs-4.8.2/examples/clutter.js --- old/cjs-4.8.1/examples/clutter.js 2020-12-08 11:14:53.000000000 +0100 +++ new/cjs-4.8.2/examples/clutter.js 2021-01-12 12:11:08.000000000 +0100 @@ -2,7 +2,7 @@ Clutter.init(null); -let stage = new Clutter.Stage(); +const stage = new Clutter.Stage({visible: true}); let texture = new Clutter.Texture({ filename: 'test.jpg', @@ -14,12 +14,9 @@ return Clutter.EVENT_STOP; }); -let color = new Clutter.Color(); -color.from_string('Black'); +const [, color] = Clutter.Color.from_string('Black'); +stage.background_color = color; -stage.color = color; - -stage.add_actor(texture); -stage.show(); +stage.add_child(texture); Clutter.main(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cjs-4.8.1/gi/arg-cache.cpp new/cjs-4.8.2/gi/arg-cache.cpp --- old/cjs-4.8.1/gi/arg-cache.cpp 2020-12-08 11:14:53.000000000 +0100 +++ new/cjs-4.8.2/gi/arg-cache.cpp 2021-01-12 12:11:08.000000000 +0100 @@ -47,6 +47,7 @@ #include "gi/boxed.h" #include "gi/foreign.h" #include "gi/function.h" +#include "gi/fundamental.h" #include "gi/gerror.h" #include "gi/gtype.h" #include "gi/object.h" @@ -369,11 +370,10 @@ } GJS_JSAPI_RETURN_CONVENTION -static bool gjs_marshal_null_in_in(JSContext*, GjsArgumentCache*, +static bool gjs_marshal_null_in_in(JSContext* cx, GjsArgumentCache* self, GjsFunctionCallState*, GIArgument* arg, JS::HandleValue) { - gjs_arg_unset<void*>(arg); - return true; + return self->handle_nullable(cx, arg); } GJS_JSAPI_RETURN_CONVENTION @@ -688,6 +688,35 @@ } GJS_JSAPI_RETURN_CONVENTION +static bool gjs_marshal_interface_in_in(JSContext* cx, GjsArgumentCache* self, + GjsFunctionCallState*, GIArgument* arg, + JS::HandleValue value) { + if (value.isNull()) + return self->handle_nullable(cx, arg); + + GType gtype = g_registered_type_info_get_g_type(self->contents.info); + g_assert(gtype != G_TYPE_NONE); + + if (!value.isObject()) + return report_gtype_mismatch(cx, self->arg_name, value, gtype); + + JS::RootedObject object(cx, &value.toObject()); + + // Could be a GObject interface that's missing a prerequisite, + // or could be a fundamental + if (ObjectBase::typecheck(cx, object, nullptr, gtype, + GjsTypecheckNoThrow())) { + return ObjectBase::transfer_to_gi_argument( + cx, object, arg, GI_DIRECTION_IN, self->transfer, gtype); + } + + // If this typecheck fails, then it's neither an object nor a + // fundamental + return FundamentalBase::transfer_to_gi_argument( + cx, object, arg, GI_DIRECTION_IN, self->transfer, gtype); +} + +GJS_JSAPI_RETURN_CONVENTION static bool gjs_marshal_object_in_in(JSContext* cx, GjsArgumentCache* self, GjsFunctionCallState*, GIArgument* arg, JS::HandleValue value) { @@ -706,6 +735,25 @@ } GJS_JSAPI_RETURN_CONVENTION +static bool gjs_marshal_fundamental_in_in(JSContext* cx, GjsArgumentCache* self, + GjsFunctionCallState*, + GIArgument* arg, + JS::HandleValue value) { + if (value.isNull()) + return self->handle_nullable(cx, arg); + + GType gtype = g_registered_type_info_get_g_type(self->contents.info); + g_assert(gtype != G_TYPE_NONE); + + if (!value.isObject()) + return report_gtype_mismatch(cx, self->arg_name, value, gtype); + + JS::RootedObject object(cx, &value.toObject()); + return FundamentalBase::transfer_to_gi_argument( + cx, object, arg, GI_DIRECTION_IN, self->transfer, gtype); +} + +GJS_JSAPI_RETURN_CONVENTION static bool gjs_marshal_gtype_struct_instance_in(JSContext* cx, GjsArgumentCache* self, GjsFunctionCallState*, @@ -1092,6 +1140,22 @@ gjs_arg_cache_interface_free, // free }; +static const GjsArgumentMarshallers interface_in_marshallers = { + gjs_marshal_interface_in_in, // in + gjs_marshal_skipped_out, // out + // This is a smart marshaller, no release needed + gjs_marshal_skipped_release, // release + gjs_arg_cache_interface_free, // free +}; + +static const GjsArgumentMarshallers fundamental_in_marshallers = { + gjs_marshal_fundamental_in_in, // in + gjs_marshal_skipped_out, // out + // This is a smart marshaller, no release needed + gjs_marshal_skipped_release, // release + gjs_arg_cache_interface_free, // free +}; + static const GjsArgumentMarshallers union_in_marshallers = { gjs_marshal_union_in_in, // in gjs_marshal_skipped_out, // out @@ -1374,8 +1438,7 @@ return true; } - if (g_type_is_a(gtype, G_TYPE_OBJECT) || - g_type_is_a(gtype, G_TYPE_INTERFACE)) { + if (g_type_is_a(gtype, G_TYPE_OBJECT)) { self->marshallers = &object_in_marshallers; return true; } @@ -1397,6 +1460,16 @@ return true; } + if (G_TYPE_IS_INSTANTIATABLE(gtype)) { + self->marshallers = &fundamental_in_marshallers; + return true; + } + + if (g_type_is_a(gtype, G_TYPE_INTERFACE)) { + self->marshallers = &interface_in_marshallers; + return true; + } + // generic boxed type if (gtype == G_TYPE_NONE && self->transfer != GI_TRANSFER_NOTHING) { // Can't transfer ownership of a structure type not @@ -1576,8 +1649,15 @@ *inc_counter_out = true; GITypeTag type_tag = g_type_info_get_tag(&self->type_info); - if (direction == GI_DIRECTION_OUT && type_tag == GI_TYPE_TAG_INTERFACE && - g_arg_info_is_caller_allocates(arg)) { + if (direction == GI_DIRECTION_OUT && g_arg_info_is_caller_allocates(arg)) { + if (type_tag != GI_TYPE_TAG_INTERFACE) { + gjs_throw(cx, + "Unsupported type %s for argument %s with (out " + "caller-allocates)", + g_type_tag_to_string(type_tag), self->arg_name); + return false; + } + GjsAutoBaseInfo interface_info = g_type_info_get_interface(&self->type_info); g_assert(interface_info); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cjs-4.8.1/gi/arg-inl.h new/cjs-4.8.2/gi/arg-inl.h --- old/cjs-4.8.1/gi/arg-inl.h 2020-12-08 11:14:53.000000000 +0100 +++ new/cjs-4.8.2/gi/arg-inl.h 2021-01-12 12:11:08.000000000 +0100 @@ -167,13 +167,13 @@ template <typename BigT> [[nodiscard]] inline constexpr BigT max_safe_big_number() { - return BigT(1) << std::numeric_limits<double>::digits; + return (BigT(1) << std::numeric_limits<double>::digits) - 1; } template <typename BigT> [[nodiscard]] inline constexpr BigT min_safe_big_number() { if constexpr (std::is_signed_v<BigT>) - return -(max_safe_big_number<BigT>()) + 1; + return -(max_safe_big_number<BigT>()); return std::numeric_limits<BigT>::lowest(); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cjs-4.8.1/gi/function.cpp new/cjs-4.8.2/gi/function.cpp --- old/cjs-4.8.1/gi/function.cpp 2020-12-08 11:14:53.000000000 +0100 +++ new/cjs-4.8.2/gi/function.cpp 2021-01-12 12:11:08.000000000 +0100 @@ -1060,14 +1060,22 @@ static void uninit_cached_function_data (Function *function) { - g_assert(function->info && "Don't know how to free cache without GI info"); - if (function->arguments) { + g_assert(function->info && + "Don't know how to free cache without GI info"); + // Careful! function->arguments is offset by one or two elements inside // the allocated space, so we have to free index -1 or -2. int start_index = g_callable_info_is_method(function->info) ? -2 : -1; - int gi_argc = g_callable_info_get_n_args(function->info); - for (int ix = start_index; ix < gi_argc; ix++) { + int gi_argc = MIN(g_callable_info_get_n_args(function->info), + function->js_in_argc + function->js_out_argc); + + for (int i = 0; i < gi_argc; i++) { + int ix = start_index + i; + + if (!function->arguments[ix].marshallers) + break; + if (function->arguments[ix].marshallers->free) function->arguments[ix].marshallers->free( &function->arguments[ix]); @@ -1077,8 +1085,7 @@ function->arguments = nullptr; } - g_base_info_unref(function->info); - + g_clear_pointer(&function->info, g_base_info_unref); g_function_invoker_destroy(&function->invoker); } @@ -1222,6 +1229,7 @@ gjs_throw(context, "Virtual function not implemented: %s", error->message); + g_clear_error(&error); return false; } @@ -1242,6 +1250,11 @@ GjsArgumentCache* arguments = g_new0(GjsArgumentCache, n_args + offset) + offset; + function->arguments = arguments; + function->info = g_base_info_ref(info); + function->js_in_argc = 0; + function->js_out_argc = 0; + if (is_method && !gjs_arg_cache_build_instance(context, &arguments[-2], info)) return false; @@ -1251,8 +1264,7 @@ &inc_counter)) return false; - int out_argc = inc_counter ? 1 : 0; - int in_argc = 0; + function->js_out_argc = inc_counter ? 1 : 0; for (i = 0; i < n_args; i++) { GIDirection direction; @@ -1271,13 +1283,13 @@ if (inc_counter) { switch (direction) { case GI_DIRECTION_INOUT: - out_argc++; + function->js_out_argc++; [[fallthrough]]; case GI_DIRECTION_IN: - in_argc++; + function->js_in_argc++; break; case GI_DIRECTION_OUT: - out_argc++; + function->js_out_argc++; break; default: g_assert_not_reached(); @@ -1285,14 +1297,6 @@ } } - function->arguments = arguments; - - function->js_in_argc = in_argc; - function->js_out_argc = out_argc; - function->info = info; - - g_base_info_ref((GIBaseInfo*) function->info); - return true; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cjs-4.8.1/installed-tests/js/testGIMarshalling.js new/cjs-4.8.2/installed-tests/js/testGIMarshalling.js --- old/cjs-4.8.1/installed-tests/js/testGIMarshalling.js 2020-12-08 11:14:53.000000000 +0100 +++ new/cjs-4.8.2/installed-tests/js/testGIMarshalling.js 2021-01-12 12:11:08.000000000 +0100 @@ -525,6 +525,14 @@ expect(GIMarshallingTests.garray_utf8_full_out_caller_allocated()) .toEqual(['0', '1', '2']); }).pend('https://gitlab.gnome.org/GNOME/gjs/issues/106'); + + // https://gitlab.gnome.org/GNOME/gjs/-/issues/344 + // the test should be replaced with the one above when issue + // https://gitlab.gnome.org/GNOME/gjs/issues/106 is fixed. + it('marshals as a transfer-full caller-allocated out parameter throws errors', function () { + expect(() => GIMarshallingTests.garray_utf8_full_out_caller_allocated()) + .toThrowError(/Unsupported type array.*\(out caller-allocates\)/); + }); }); // it('marshals boxed structs as a transfer-full return value', function () { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cjs-4.8.1/installed-tests/js/testGLib.js new/cjs-4.8.2/installed-tests/js/testGLib.js --- old/cjs-4.8.1/installed-tests/js/testGLib.js 2020-12-08 11:14:53.000000000 +0100 +++ new/cjs-4.8.2/installed-tests/js/testGLib.js 2021-01-12 12:11:08.000000000 +0100 @@ -133,6 +133,14 @@ numExpectedWarnings = 0; }); + // TODO: Add Regress.func_not_nullable_untyped_gpointer_in and move to testRegress.js + it('GLib.str_hash errors when marshalling null to a not-nullable parameter', function () { + // This tests that we don't marshal null to a not-nullable untyped gpointer. + expect(() => GLib.str_hash(null)).toThrowError( + /Argument [a-z]+ may not be null/ + ); + }); + it('GLib.stpcpy', function () { expect(() => GLib.stpcpy('dest', 'src')).toThrowError(/not introspectable/); }); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cjs-4.8.1/meson.build new/cjs-4.8.2/meson.build --- old/cjs-4.8.1/meson.build 2020-12-08 11:14:53.000000000 +0100 +++ new/cjs-4.8.2/meson.build 2021-01-12 12:11:08.000000000 +0100 @@ -1,4 +1,4 @@ -project('cjs', 'cpp', 'c', version: '4.8.1', license: ['MIT', 'LGPL2+'], +project('cjs', 'cpp', 'c', version: '4.8.2', license: ['MIT', 'LGPL2+'], meson_version: '>= 0.49.2', default_options: ['cpp_std=c++17', 'c_std=c99', 'warning_level=2']) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cjs-4.8.1/test/gjs-tests.cpp new/cjs-4.8.2/test/gjs-tests.cpp --- old/cjs-4.8.1/test/gjs-tests.cpp 2020-12-08 11:14:53.000000000 +0100 +++ new/cjs-4.8.2/test/gjs-tests.cpp 2021-01-12 12:11:08.000000000 +0100 @@ -23,6 +23,7 @@ #include <config.h> +#include <stdint.h> #include <string.h> // for size_t, strlen #include <string> // for u16string, u32string @@ -39,7 +40,9 @@ #include <js/Value.h> #include <js/ValueArray.h> #include <jsapi.h> +#include <jspubtd.h> // for JSProto_Number +#include "gi/arg-inl.h" #include "cjs/context.h" #include "cjs/error-types.h" #include "cjs/jsapi-util.h" @@ -398,6 +401,30 @@ g_message("Temp profiler file not deleted"); } +static void gjstest_test_safe_integer_max(GjsUnitTestFixture* fx, const void*) { + JS::RootedObject number_class_object(fx->cx); + JS::RootedValue safe_value(fx->cx); + + g_assert_true( + JS_GetClassObject(fx->cx, JSProto_Number, &number_class_object)); + g_assert_true(JS_GetProperty(fx->cx, number_class_object, + "MAX_SAFE_INTEGER", &safe_value)); + + g_assert_cmpint(safe_value.toNumber(), ==, max_safe_big_number<int64_t>()); +} + +static void gjstest_test_safe_integer_min(GjsUnitTestFixture* fx, const void*) { + JS::RootedObject number_class_object(fx->cx); + JS::RootedValue safe_value(fx->cx); + + g_assert_true( + JS_GetClassObject(fx->cx, JSProto_Number, &number_class_object)); + g_assert_true(JS_GetProperty(fx->cx, number_class_object, + "MIN_SAFE_INTEGER", &safe_value)); + + g_assert_cmpint(safe_value.toNumber(), ==, min_safe_big_number<int64_t>()); +} + int main(int argc, char **argv) @@ -444,6 +471,11 @@ ADD_JSAPI_UTIL_TEST("debug_string/object-with-complicated-to-string", test_jsapi_util_debug_string_object_with_complicated_to_string); + ADD_JSAPI_UTIL_TEST("gi/args/safe-integer/max", + gjstest_test_safe_integer_max); + ADD_JSAPI_UTIL_TEST("gi/args/safe-integer/min", + gjstest_test_safe_integer_min); + #undef ADD_JSAPI_UTIL_TEST gjs_test_add_tests_for_coverage ();