Adjust test to not use new GObject syntax
The test was backported from a newer gjs version, and uses syntax that isn't available in the version we use. Resolves: #2170044
This commit is contained in:
parent
8f7bb64b5c
commit
f7c564fcd5
@ -1,4 +1,4 @@
|
|||||||
From 5d6724389a16ee4c43ec9207588747d01b9418ef Mon Sep 17 00:00:00 2001
|
From cf128c8d52a3b86177d5231f32c2e156837fa8e7 Mon Sep 17 00:00:00 2001
|
||||||
From: Philip Chimento <philip.chimento@gmail.com>
|
From: Philip Chimento <philip.chimento@gmail.com>
|
||||||
Date: Mon, 14 Nov 2022 22:01:59 -0800
|
Date: Mon, 14 Nov 2022 22:01:59 -0800
|
||||||
Subject: [PATCH] gobject: Guard against null JS wrapper in set/get property
|
Subject: [PATCH] gobject: Guard against null JS wrapper in set/get property
|
||||||
@ -10,9 +10,9 @@ property.
|
|||||||
|
|
||||||
Closes: #510
|
Closes: #510
|
||||||
---
|
---
|
||||||
gi/gobject.cpp | 12 +++++++++
|
gi/gobject.cpp | 12 ++++++++++
|
||||||
installed-tests/js/testIntrospection.js | 35 +++++++++++++++++++++++++
|
installed-tests/js/testIntrospection.js | 31 +++++++++++++++++++++++++
|
||||||
2 files changed, 47 insertions(+)
|
2 files changed, 43 insertions(+)
|
||||||
|
|
||||||
diff --git a/gi/gobject.cpp b/gi/gobject.cpp
|
diff --git a/gi/gobject.cpp b/gi/gobject.cpp
|
||||||
index b86872c2..881c06f8 100644
|
index b86872c2..881c06f8 100644
|
||||||
@ -45,27 +45,23 @@ index b86872c2..881c06f8 100644
|
|||||||
|
|
||||||
JS::RootedObject js_obj(cx, priv->wrapper());
|
JS::RootedObject js_obj(cx, priv->wrapper());
|
||||||
diff --git a/installed-tests/js/testIntrospection.js b/installed-tests/js/testIntrospection.js
|
diff --git a/installed-tests/js/testIntrospection.js b/installed-tests/js/testIntrospection.js
|
||||||
index 5e2ee7df..8716327e 100644
|
index 5e2ee7df..a0ffeefe 100644
|
||||||
--- a/installed-tests/js/testIntrospection.js
|
--- a/installed-tests/js/testIntrospection.js
|
||||||
+++ b/installed-tests/js/testIntrospection.js
|
+++ b/installed-tests/js/testIntrospection.js
|
||||||
@@ -140,6 +140,41 @@ describe('Garbage collection of introspected objects', function () {
|
@@ -140,6 +140,37 @@ describe('Garbage collection of introspected objects', function () {
|
||||||
System.gc();
|
System.gc();
|
||||||
GLib.idle_add(GLib.PRIORITY_LOW, () => done());
|
GLib.idle_add(GLib.PRIORITY_LOW, () => done());
|
||||||
});
|
});
|
||||||
+
|
+
|
||||||
+ // This tests a race condition that would crash; it should warn instead
|
+ // This tests a race condition that would crash; it should warn instead
|
||||||
+ it('handles setting a property from C on an object whose JS wrapper has been collected', function (done) {
|
+ it('handles setting a property from C on an object whose JS wrapper has been collected', function (done) {
|
||||||
+ class SomeObject extends GObject.Object {
|
+ const SomeObject = GObject.registerClass({
|
||||||
+ static [GObject.properties] = {
|
+ Properties: {
|
||||||
+ 'screenfull': GObject.ParamSpec.boolean('screenfull', '', '',
|
+ 'screenfull': GObject.ParamSpec.boolean('screenfull', '', '',
|
||||||
+ GObject.ParamFlags.READWRITE,
|
+ GObject.ParamFlags.READWRITE,
|
||||||
+ false),
|
+ false),
|
||||||
+ };
|
+ },
|
||||||
+
|
+ }, class SomeObject extends GObject.Object {});
|
||||||
+ static {
|
|
||||||
+ GObject.registerClass(this);
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
+
|
||||||
+ GLib.test_expect_message('Gjs', GLib.LogLevelFlags.LEVEL_WARNING,
|
+ GLib.test_expect_message('Gjs', GLib.LogLevelFlags.LEVEL_WARNING,
|
||||||
+ '*property screenfull*');
|
+ '*property screenfull*');
|
||||||
|
Loading…
Reference in New Issue
Block a user