From 3c54e863e633a91429749c259e1196b9c2cc9de7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Thu, 18 Apr 2019 15:50:49 -0500 Subject: [PATCH] SwitcherPopup: Check for type using constructor Classes that are sub-classes of GObject don't use a constructor per se, so we can't check for new.target (as this is undefined) in _init. Then compare the current constructor name instead. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/503 --- js/ui/switcherPopup.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/ui/switcherPopup.js b/js/ui/switcherPopup.js index c28c22910..cd0125786 100644 --- a/js/ui/switcherPopup.js +++ b/js/ui/switcherPopup.js @@ -33,8 +33,8 @@ function primaryModifier(mask) { var SwitcherPopup = GObject.registerClass( class SwitcherPopup extends St.Widget { _init(items) { - if (new.target === SwitcherPopup) - throw new TypeError('Cannot instantiate abstract class ' + new.target.name); + if (this.constructor.name === SwitcherPopup.prototype.constructor.name) + throw new TypeError(`Cannot instantiate abstract class ${this.constructor.name}`); super._init({ style_class: 'switcher-popup', reactive: true,