diff --git a/lib/browser/rpc-server.js b/lib/browser/rpc-server.js index 447b12e3b28..e3f731c9784 100644 --- a/lib/browser/rpc-server.js +++ b/lib/browser/rpc-server.js @@ -279,7 +279,7 @@ ipcMain.on('ELECTRON_BROWSER_CONSTRUCTOR', function (event, id, args) { // Call new with array of arguments. // http://stackoverflow.com/questions/1606797/use-of-apply-with-new-operator-is-this-possible - let obj = new (Function.prototype.bind.apply(constructor, [null].concat(args))) + let obj = new (Function.prototype.bind.apply(constructor, [null].concat(args)))() event.returnValue = valueToMeta(event.sender, obj) } catch (error) { event.returnValue = exceptionToMeta(error) @@ -302,7 +302,7 @@ ipcMain.on('ELECTRON_BROWSER_MEMBER_CONSTRUCTOR', function (event, id, method, a let constructor = objectsRegistry.get(id)[method] // Call new with array of arguments. - let obj = new (Function.prototype.bind.apply(constructor, [null].concat(args))) + let obj = new (Function.prototype.bind.apply(constructor, [null].concat(args)))() event.returnValue = valueToMeta(event.sender, obj) } catch (error) { event.returnValue = exceptionToMeta(error) diff --git a/package.json b/package.json index 9e4064e9a8d..980b78f68ce 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "electabul": "~0.0.4", "electron-docs-linter": "^1.8.2", "request": "*", - "standard": "^7.1.2", + "standard": "^8.4.0", "standard-markdown": "^2.1.1" }, "optionalDependencies": { diff --git a/spec/api-ipc-spec.js b/spec/api-ipc-spec.js index eedab2b24b9..3cd10e971e8 100644 --- a/spec/api-ipc-spec.js +++ b/spec/api-ipc-spec.js @@ -45,7 +45,7 @@ describe('ipc module', function () { assert.equal(a.bar, 1234) assert.equal(a.anonymous.constructor.name, '') assert.equal(a.getConstructorName(Object.create(null)), '') - assert.equal(a.getConstructorName(new (class {})), '') + assert.equal(a.getConstructorName(new (class {})()), '') }) it('should search module from the user app', function () { diff --git a/spec/fixtures/module/no-prototype.js b/spec/fixtures/module/no-prototype.js index 46cc4fe8385..000eb183fff 100644 --- a/spec/fixtures/module/no-prototype.js +++ b/spec/fixtures/module/no-prototype.js @@ -4,7 +4,7 @@ foo.baz = false module.exports = { foo: foo, bar: 1234, - anonymous: new (class {}), + anonymous: new (class {})(), getConstructorName: function (value) { return value.constructor.name }