From 0bfebc3d3ff2f9ef4265fbb02a0ea706af942f55 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Tue, 18 May 2021 02:46:12 -0400 Subject: [PATCH] import gjs-1.56.2-5.el8 --- SOURCES/fix-undefined-property-warning.patch | 67 ++++++++++++++++++++ SPECS/gjs.spec | 7 +- 2 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 SOURCES/fix-undefined-property-warning.patch diff --git a/SOURCES/fix-undefined-property-warning.patch b/SOURCES/fix-undefined-property-warning.patch new file mode 100644 index 0000000..098da62 --- /dev/null +++ b/SOURCES/fix-undefined-property-warning.patch @@ -0,0 +1,67 @@ +From 69498c30904c4769de2f7b6a36eb70a8409643d0 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Florian=20M=C3=BCllner?= +Date: Thu, 29 Oct 2020 13:05:23 +0100 +Subject: [PATCH 1/2] gi/object: Check property before access + +... to avoid a harmless but annoying "access to undefined property" +warning in case the property doesn't exist (namely the first time +a non-introspected gtype is accessed). +--- + gi/object.cpp | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/gi/object.cpp b/gi/object.cpp +index e9eba75a..ee66c6f3 100644 +--- a/gi/object.cpp ++++ b/gi/object.cpp +@@ -1599,8 +1599,12 @@ JSObject* gjs_lookup_object_constructor_from_info(JSContext* context, + if (G_UNLIKELY (!in_object)) + return NULL; + ++ bool found; ++ if (!JS_HasProperty(context, in_object, constructor_name, &found)) ++ return NULL; ++ + JS::RootedValue value(context); +- if (!JS_GetProperty(context, in_object, constructor_name, &value)) ++ if (found && !JS_GetProperty(context, in_object, constructor_name, &value)) + return NULL; + + JS::RootedObject constructor(context); +-- +2.28.0 + + +From 23093ef99411a35d8eeedb74948e6c15ed19ba10 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Florian=20M=C3=BCllner?= +Date: Thu, 29 Oct 2020 15:29:59 +0100 +Subject: [PATCH 2/2] gi/fundamental: Check property before access + +... to avoid a harmless but annoying "access to undefined property" +warning in case the property doesn't exist (namely the first time +a non-introspected gtype is accessed). +--- + gi/fundamental.cpp | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/gi/fundamental.cpp b/gi/fundamental.cpp +index 0d5d3f6d..426c7db9 100644 +--- a/gi/fundamental.cpp ++++ b/gi/fundamental.cpp +@@ -322,8 +322,12 @@ gjs_lookup_fundamental_prototype(JSContext *context, + if (G_UNLIKELY (!in_object)) + return NULL; + ++ bool found; ++ if (!JS_HasProperty(context, in_object, constructor_name, &found)) ++ return nullptr; ++ + JS::RootedValue value(context); +- if (!JS_GetProperty(context, in_object, constructor_name, &value)) ++ if (found && !JS_GetProperty(context, in_object, constructor_name, &value)) + return NULL; + + JS::RootedObject constructor(context); +-- +2.28.0 + diff --git a/SPECS/gjs.spec b/SPECS/gjs.spec index 1511da9..7e0eff5 100644 --- a/SPECS/gjs.spec +++ b/SPECS/gjs.spec @@ -5,7 +5,7 @@ Name: gjs Version: 1.56.2 -Release: 4%{?dist} +Release: 5%{?dist} Summary: Javascript Bindings for GNOME # The following files contain code from Mozilla which @@ -17,6 +17,7 @@ URL: https://wiki.gnome.org/Projects/Gjs Source0: https://download.gnome.org/sources/%{name}/1.56/%{name}-%{version}.tar.xz Patch0: 0001-gi-Include-missing-glib-bits.patch +Patch1: fix-undefined-property-warning.patch BuildRequires: cairo-gobject-devel BuildRequires: chrpath @@ -101,6 +102,10 @@ find %{buildroot} -name '*.la' -exec rm -f {} ';' %{_datadir}/installed-tests %changelog +* Tue Nov 17 2020 Florian Müllner - 1.56.2-5 +- Fix undefined property warnings + Related: #1845660 + * Tue Feb 18 2020 Kalev Lember - 1.56.2-4 - Rebuild for mozjs60 s390x fixes - Related: #1803824