Use empty string constructor name when missing
This commit is contained in:
parent
d67dfd09fd
commit
a9b43a0fc9
2 changed files with 3 additions and 2 deletions
|
@ -60,7 +60,7 @@ var wrapArgs = function (args, visited) {
|
||||||
|
|
||||||
ret = {
|
ret = {
|
||||||
type: 'object',
|
type: 'object',
|
||||||
name: value.constructor != null ? value.constructor.name : 'Object',
|
name: value.constructor != null ? value.constructor.name : '',
|
||||||
members: []
|
members: []
|
||||||
}
|
}
|
||||||
for (prop in value) {
|
for (prop in value) {
|
||||||
|
|
|
@ -31,10 +31,11 @@ describe('ipc module', function () {
|
||||||
|
|
||||||
it('should work when object has no prototype', function () {
|
it('should work when object has no prototype', function () {
|
||||||
var a = remote.require(path.join(fixtures, 'module', 'no-prototype.js'))
|
var a = remote.require(path.join(fixtures, 'module', 'no-prototype.js'))
|
||||||
|
assert.equal(a.foo.constructor.name, '')
|
||||||
assert.equal(a.foo.bar, 'baz')
|
assert.equal(a.foo.bar, 'baz')
|
||||||
assert.equal(a.foo.baz, false)
|
assert.equal(a.foo.baz, false)
|
||||||
assert.equal(a.bar, 1234)
|
assert.equal(a.bar, 1234)
|
||||||
assert.equal(a.getConstructorName(Object.create(null)), 'Object')
|
assert.equal(a.getConstructorName(Object.create(null)), '')
|
||||||
assert.equal(a.getConstructorName(new (class {})), '')
|
assert.equal(a.getConstructorName(new (class {})), '')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue