diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js index 1dd182b17..8981bbc96 100644 --- a/js/ui/appDisplay.js +++ b/js/ui/appDisplay.js @@ -98,8 +98,8 @@ function clamp(value, min, max) { class BaseAppView { constructor(params, gridParams) { - if (new.target === BaseAppView) - throw new TypeError('Cannot instantiate abstract class ' + new.target.name); + if (this.constructor === BaseAppView) + throw new TypeError(`Cannot instantiate abstract class ${this.constructor.name}`); gridParams = Params.parse(gridParams, { xAlign: St.Align.MIDDLE, columnLimit: MAX_COLUMNS, diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js index d61d18792..6bbdd3eec 100644 --- a/js/ui/popupMenu.js +++ b/js/ui/popupMenu.js @@ -397,8 +397,8 @@ var PopupImageMenuItem = class extends PopupBaseMenuItem { var PopupMenuBase = class { constructor(sourceActor, styleClass) { - if (new.target === PopupMenuBase) - throw new TypeError('Cannot instantiate abstract class ' + new.target.name); + if (this.constructor === PopupMenuBase) + throw new TypeError(`Cannot instantiate abstract class ${this.constructor.name}`); this.sourceActor = sourceActor; this._parent = null; diff --git a/js/ui/status/keyboard.js b/js/ui/status/keyboard.js index d711a5453..274147fe4 100644 --- a/js/ui/status/keyboard.js +++ b/js/ui/status/keyboard.js @@ -125,8 +125,8 @@ class InputSourceSwitcher extends SwitcherPopup.SwitcherList { var InputSourceSettings = class { constructor() { - if (new.target === InputSourceSettings) - throw new TypeError('Cannot instantiate abstract class ' + new.target.name); + if (this.constructor === InputSourceSettings) + throw new TypeError(`Cannot instantiate abstract class ${this.constructor.name}`); } _emitInputSourcesChanged() { diff --git a/js/ui/status/network.js b/js/ui/status/network.js index e6551f217..9354183d3 100644 --- a/js/ui/status/network.js +++ b/js/ui/status/network.js @@ -167,10 +167,10 @@ var NMConnectionItem = class { }; Signals.addSignalMethods(NMConnectionItem.prototype); -var NMConnectionSection = class { +var NMConnectionSection = class NMConnectionSection { constructor(client) { - if (new.target === NMConnectionSection) - throw new TypeError('Cannot instantiate abstract type ' + new.target.name); + if (this.constructor === NMConnectionSection) + throw new TypeError(`Cannot instantiate abstract type ${this.constructor.name}`); this._client = client; @@ -297,12 +297,13 @@ var NMConnectionSection = class { }; Signals.addSignalMethods(NMConnectionSection.prototype); -var NMConnectionDevice = class extends NMConnectionSection { +var NMConnectionDevice = class NMConnectionDevice extends NMConnectionSection { constructor(client, device) { - if (new.target === NMConnectionDevice) - throw new TypeError('Cannot instantiate abstract type ' + new.target.name); - super(client); + + if (this.constructor === NMConnectionDevice) + throw new TypeError(`Cannot instantiate abstract type ${this.constructor.name}`); + this._device = device; this._description = ''; diff --git a/js/ui/workspace.js b/js/ui/workspace.js index 9c5886144..cf52684c0 100644 --- a/js/ui/workspace.js +++ b/js/ui/workspace.js @@ -786,8 +786,8 @@ var WindowPositionFlags = { var LayoutStrategy = class { constructor(monitor, rowSpacing, columnSpacing) { - if (new.target === LayoutStrategy) - throw new TypeError('Cannot instantiate abstract type ' + new.target.name); + if (this.constructor === LayoutStrategy) + throw new TypeError(`Cannot instantiate abstract type ${this.constructor.name}`); this._monitor = monitor; this._rowSpacing = rowSpacing;