Use empty string constructor name when missing
authorKevin Sawicki <kevinsawicki@gmail.com>
Wed, 6 Jul 2016 20:06:48 +0000 (13:06 -0700)
committerKevin Sawicki <kevinsawicki@gmail.com>
Wed, 6 Jul 2016 20:06:48 +0000 (13:06 -0700)
lib/renderer/api/remote.js
spec/api-ipc-spec.js

index b120bed..79fe41e 100644 (file)
@@ -60,7 +60,7 @@ var wrapArgs = function (args, visited) {
 
       ret = {
         type: 'object',
-        name: value.constructor != null ? value.constructor.name : 'Object',
+        name: value.constructor != null ? value.constructor.name : '',
         members: []
       }
       for (prop in value) {
index 6b0222d..2d439af 100644 (file)
@@ -31,10 +31,11 @@ describe('ipc module', function () {
 
     it('should work when object has no prototype', function () {
       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.baz, false)
       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 {})), '')
     })