diff --git a/spec/api-ipc-spec.js b/spec/api-ipc-spec.js index c5e38e83e4db..798c26d87a48 100644 --- a/spec/api-ipc-spec.js +++ b/spec/api-ipc-spec.js @@ -199,6 +199,14 @@ describe('ipc module', function () { }, /setting error/) }) + it('can set a remote property with a remote object', function () { + const foo = remote.require(path.join(fixtures, 'module', 'remote-object-set.js')) + + assert.doesNotThrow(function () { + foo.bar = remote.getCurrentWindow() + }) + }) + it('can construct an object from its member', function () { var call = remote.require(path.join(fixtures, 'module', 'call.js')) var obj = new call.constructor() diff --git a/spec/fixtures/module/remote-object-set.js b/spec/fixtures/module/remote-object-set.js new file mode 100644 index 000000000000..5fefbf5cf36a --- /dev/null +++ b/spec/fixtures/module/remote-object-set.js @@ -0,0 +1,11 @@ +const {BrowserWindow} = require('electron') + +class Foo { + set bar (value) { + if (!(value instanceof BrowserWindow)) { + throw new Error('setting error') + } + } +} + +module.exports = new Foo()