From 32360effa2558b7427c0aa59cf16d1fd622f5be2d784f541b75eb7e30afe9db2 Mon Sep 17 00:00:00 2001 From: Dominique Leuenberger Date: Mon, 4 Dec 2023 12:26:38 +0000 Subject: [PATCH] Accepting request 1130564 from GNOME:Next New stable release OBS-URL: https://build.opensuse.org/request/show/1130564 OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/gjs?expand=0&rev=231 --- ...384aaf15dec6653b1a5400032c2c2e5dc34c.patch | 157 ------------------ gjs-1.78.0.tar.xz | 3 - gjs-1.78.1.tar.xz | 3 + gjs.changes | 14 ++ gjs.spec | 4 +- 5 files changed, 18 insertions(+), 163 deletions(-) delete mode 100644 3cae384aaf15dec6653b1a5400032c2c2e5dc34c.patch delete mode 100644 gjs-1.78.0.tar.xz create mode 100644 gjs-1.78.1.tar.xz diff --git a/3cae384aaf15dec6653b1a5400032c2c2e5dc34c.patch b/3cae384aaf15dec6653b1a5400032c2c2e5dc34c.patch deleted file mode 100644 index dfa5f31..0000000 --- a/3cae384aaf15dec6653b1a5400032c2c2e5dc34c.patch +++ /dev/null @@ -1,157 +0,0 @@ -From 3cae384aaf15dec6653b1a5400032c2c2e5dc34c Mon Sep 17 00:00:00 2001 -From: Philip Chimento -Date: Sun, 17 Sep 2023 09:27:59 -0700 -Subject: [PATCH] module: Canonicalize import specifier before inserting it in - registry - -Use GFile to canonicalize import specifier so that when we import two -different URIs or relative paths that refer to the same location, we don't -get two copies of the same module. - -Closes: #577 ---- - gjs/module.cpp | 26 +++++++++++++++++++++++ - installed-tests/js/jsunit.gresources.xml | 2 ++ - installed-tests/js/modules/sideEffect.js | 5 +++++ - installed-tests/js/modules/sideEffect2.js | 5 +++++ - installed-tests/js/testESModules.js | 17 +++++++++++++++ - 5 files changed, 55 insertions(+) - create mode 100644 installed-tests/js/modules/sideEffect.js - create mode 100644 installed-tests/js/modules/sideEffect2.js - -diff --git a/gjs/module.cpp b/gjs/module.cpp -index ccaad9c3a..7d147ff2e 100644 ---- a/gjs/module.cpp -+++ b/gjs/module.cpp -@@ -8,6 +8,7 @@ - #include - - #include -+#include - #include - - #include -@@ -493,6 +494,25 @@ bool gjs_populate_module_meta(JSContext* cx, JS::HandleValue private_ref, - return true; - } - -+// Canonicalize specifier so that differently-spelled specifiers referring to -+// the same module don't result in duplicate entries in the registry -+static bool canonicalize_specifier(JSContext* cx, -+ JS::MutableHandleString specifier) { -+ JS::UniqueChars specifier_utf8 = JS_EncodeStringToUTF8(cx, specifier); -+ if (!specifier_utf8) -+ return false; -+ -+ GjsAutoUnref file = g_file_new_for_uri(specifier_utf8.get()); -+ GjsAutoChar canonical_specifier = g_file_get_uri(file); -+ JS::ConstUTF8CharsZ chars{canonical_specifier, strlen(canonical_specifier)}; -+ JS::RootedString new_specifier{cx, JS_NewStringCopyUTF8Z(cx, chars)}; -+ if (!new_specifier) -+ return false; -+ -+ specifier.set(new_specifier); -+ return true; -+} -+ - /** - * gjs_module_resolve: - * -@@ -519,6 +539,9 @@ JSObject* gjs_module_resolve(JSContext* cx, JS::HandleValue importingModulePriv, - g_assert(v_loader.isObject()); - JS::RootedObject loader(cx, &v_loader.toObject()); - -+ if (!canonicalize_specifier(cx, &specifier)) -+ return nullptr; -+ - JS::RootedValueArray<2> args(cx); - args[0].set(importingModulePriv); - args[1].setString(specifier); -@@ -637,6 +660,9 @@ bool gjs_dynamic_module_resolve(JSContext* cx, - JS::RootedString specifier( - cx, JS::GetModuleRequestSpecifier(cx, module_request)); - -+ if (!canonicalize_specifier(cx, &specifier)) -+ return false; -+ - JS::RootedObject callback_data(cx, JS_NewPlainObject(cx)); - if (!callback_data || - !JS_DefineProperty(cx, callback_data, "module_request", module_request, -diff --git a/installed-tests/js/jsunit.gresources.xml b/installed-tests/js/jsunit.gresources.xml -index 75c54c901..7c017e34e 100644 ---- a/installed-tests/js/jsunit.gresources.xml -+++ b/installed-tests/js/jsunit.gresources.xml -@@ -31,6 +31,8 @@ - modules/mutualImport/b.js - modules/overrides/GIMarshallingTests.js - modules/say.js -+ modules/sideEffect.js -+ modules/sideEffect2.js - modules/subA/subB/__init__.js - modules/subA/subB/baz.js - modules/subA/subB/foobar.js -diff --git a/installed-tests/js/modules/sideEffect.js b/installed-tests/js/modules/sideEffect.js -new file mode 100644 -index 000000000..5bfcfb258 ---- /dev/null -+++ b/installed-tests/js/modules/sideEffect.js -@@ -0,0 +1,5 @@ -+// SPDX-License-Identifier: MIT OR LGPL-2.0-or-later -+// SPDX-FileCopyrightText: 2023 Philip Chimento -+ -+globalThis.leakyState ??= 0; -+globalThis.leakyState++; -diff --git a/installed-tests/js/modules/sideEffect2.js b/installed-tests/js/modules/sideEffect2.js -new file mode 100644 -index 000000000..5bfcfb258 ---- /dev/null -+++ b/installed-tests/js/modules/sideEffect2.js -@@ -0,0 +1,5 @@ -+// SPDX-License-Identifier: MIT OR LGPL-2.0-or-later -+// SPDX-FileCopyrightText: 2023 Philip Chimento -+ -+globalThis.leakyState ??= 0; -+globalThis.leakyState++; -diff --git a/installed-tests/js/testESModules.js b/installed-tests/js/testESModules.js -index e727c7907..b165521d6 100644 ---- a/installed-tests/js/testESModules.js -+++ b/installed-tests/js/testESModules.js -@@ -12,6 +12,11 @@ import $ from 'resource:///org/gjs/jsunit/modules/exports.js'; - import {NamedExport, data} from 'resource:///org/gjs/jsunit/modules/exports.js'; - import metaProperties from 'resource:///org/gjs/jsunit/modules/importmeta.js'; - -+// These imports should all refer to the same module and import it only once -+import 'resource:///org/gjs/jsunit/modules/sideEffect.js'; -+import 'resource://org/gjs/jsunit/modules/sideEffect.js'; -+import 'resource:///org/gjs/jsunit/modules/../modules/sideEffect.js'; -+ - describe('ES module imports', function () { - it('default import', function () { - expect($).toEqual(5); -@@ -67,6 +72,10 @@ describe('ES module imports', function () { - it('does not expose internal import.meta properties to userland modules', function () { - expect(metaProperties).toEqual(['url']); - }); -+ -+ it('treats equivalent URIs as equal and does not load the module again', function () { -+ expect(globalThis.leakyState).toEqual(1); -+ }); - }); - - describe('Builtin ES modules', function () { -@@ -130,4 +139,12 @@ describe('Dynamic imports', function () { - it('dynamic gi import matches static', async function () { - expect((await import('gi://Gio')).default).toEqual(Gio); - }); -+ -+ it('treats equivalent URIs as equal and does not load the module again', async function () { -+ delete globalThis.leakyState; -+ await import('resource:///org/gjs/jsunit/modules/sideEffect2.js'); -+ await import('resource://org/gjs/jsunit/modules/sideEffect2.js'); -+ await import('resource:///org/gjs/jsunit/modules/../modules/sideEffect2.js'); -+ expect(globalThis.leakyState).toEqual(1); -+ }); - }); --- -GitLab - diff --git a/gjs-1.78.0.tar.xz b/gjs-1.78.0.tar.xz deleted file mode 100644 index 37dc9a0..0000000 --- a/gjs-1.78.0.tar.xz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:fbaa20e0917668830800f92951688f9fc08f01296affd5cdb4b35f750be27dc9 -size 653500 diff --git a/gjs-1.78.1.tar.xz b/gjs-1.78.1.tar.xz new file mode 100644 index 0000000..6c87727 --- /dev/null +++ b/gjs-1.78.1.tar.xz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7e90511c429127c39eac0068c4ac9a353df7e6fbbc646f5f18e8962882c18641 +size 654556 diff --git a/gjs.changes b/gjs.changes index 8a880ba..5cf798f 100644 --- a/gjs.changes +++ b/gjs.changes @@ -1,3 +1,17 @@ +------------------------------------------------------------------- +Sun Dec 3 12:05:14 UTC 2023 - Bjørn Lie + +- Update to version 1.78.1: + + Gtk template signals cause a reference cycle that is not + detected + + Modules from resources may get loaded twice + + docs: add examples for creating cairo image surfaces + + Deadlocks between GJS GC and dconf gsettings when a setting + value is changed + + Gtk3: Fix leak in GtkBuilder template signal connections +- Drop 3cae384aaf15dec6653b1a5400032c2c2e5dc34c.patch: Fixed + upstream + ------------------------------------------------------------------- Thu Oct 26 08:12:24 UTC 2023 - Bjørn Lie diff --git a/gjs.spec b/gjs.spec index 25bb90a..03a716e 100644 --- a/gjs.spec +++ b/gjs.spec @@ -19,15 +19,13 @@ %bcond_with profiling Name: gjs -Version: 1.78.0 +Version: 1.78.1 Release: 0 Summary: JavaScript bindings based on gobject-introspection and Mozilla License: LGPL-2.0-or-later AND MIT Group: Development/Libraries/GNOME URL: https://wiki.gnome.org/Projects/Gjs Source0: https://download.gnome.org/sources/gjs/1.78/%{name}-%{version}.tar.xz -# PATCH-FIX-UPSTREAM 3cae384aaf15dec6653b1a5400032c2c2e5dc34c.patch -- module: Canonicalize import specifier before inserting it in registry -Patch0: https://gitlab.gnome.org/GNOME/gjs/-/commit/3cae384aaf15dec6653b1a5400032c2c2e5dc34c.patch BuildRequires: /usr/bin/dbus-run-session BuildRequires: c++_compiler