From 3a3f9aa008e709e0a3c3535434efffb0231e4279 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:21 -0500 Subject: [PATCH] CyclerPopup: 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/altTab.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/ui/altTab.js b/js/ui/altTab.js index fb9c875c8..0212992be 100644 --- a/js/ui/altTab.js +++ b/js/ui/altTab.js @@ -477,8 +477,8 @@ var CyclerList = GObject.registerClass({ var CyclerPopup = GObject.registerClass( class CyclerPopup extends SwitcherPopup.SwitcherPopup { _init() { - if (new.target === CyclerPopup) - throw new TypeError('Cannot instantiate abstract class ' + new.target.name); + if (this.constructor.name === CyclerPopup.prototype.constructor.name) + throw new TypeError(`Cannot instantiate abstract class ${this.constructor.name}`); super._init();