diff options
-rw-r--r-- | installed-tests/js/testGObjectClass.js | 10 | ||||
-rw-r--r-- | modules/core/overrides/GObject.js | 2 |
2 files changed, 12 insertions, 0 deletions
diff --git a/installed-tests/js/testGObjectClass.js b/installed-tests/js/testGObjectClass.js index dede1a91..8f5f4a20 100644 --- a/installed-tests/js/testGObjectClass.js +++ b/installed-tests/js/testGObjectClass.js @@ -909,6 +909,16 @@ describe('GObject virtual function', function () { vfunc_init_async() {} })).toThrow(); }); + + it('are defined also for static virtual functions', () => { + const CustomEmptyGICon = GObject.registerClass({ + Implements: [Gio.Icon], + }, class CustomEmptyGICon extends GObject.Object {}); + expect(Gio.Icon.deserialize).toBeInstanceOf(Function); + expect(CustomEmptyGICon.deserialize).toBe(Gio.Icon.deserialize); + expect(Gio.Icon.new_for_string).toBeInstanceOf(Function); + expect(CustomEmptyGICon.new_for_string).toBe(Gio.Icon.new_for_string); + }); }); describe('GObject creation using base classes without registered GType', function () { diff --git a/modules/core/overrides/GObject.js b/modules/core/overrides/GObject.js index f3dce686..54781526 100644 --- a/modules/core/overrides/GObject.js +++ b/modules/core/overrides/GObject.js @@ -549,6 +549,8 @@ function _init() { // Reverse the interface array to give the last required interface precedence over the first. const requiredInterfaces = [...gobjectInterfaces].reverse(); requiredInterfaces.forEach(iface => + _copyInterfacePrototypeDescriptors(klass, iface)); + requiredInterfaces.forEach(iface => _copyInterfacePrototypeDescriptors(klass.prototype, iface.prototype)); Object.getOwnPropertyNames(klass.prototype) |