Guard against object with no hasOwnProperty

This commit is contained in:
Kevin Sawicki 2016-05-27 10:46:02 -07:00
parent 7cf6be07a6
commit 59dd7ca9df

View file

@ -6,6 +6,8 @@ const {ipcMain, isPromise} = electron
const objectsRegistry = require('./objects-registry') const objectsRegistry = require('./objects-registry')
const hasProp = {}.hasOwnProperty
// The internal properties of Function. // The internal properties of Function.
const FUNCTION_PROPERTIES = [ const FUNCTION_PROPERTIES = [
'length', 'name', 'arguments', 'caller', 'prototype' 'length', 'name', 'arguments', 'caller', 'prototype'
@ -67,7 +69,7 @@ let valueToMeta = function (sender, value, optimizeSimpleObject = false) {
meta.type = 'date' meta.type = 'date'
} else if (isPromise(value)) { } else if (isPromise(value)) {
meta.type = 'promise' meta.type = 'promise'
} else if (value.hasOwnProperty('callee') && value.length != null) { } else if (hasProp.call(value, 'callee') && value.length != null) {
// Treat the arguments object as array. // Treat the arguments object as array.
meta.type = 'array' meta.type = 'array'
} else if (optimizeSimpleObject && v8Util.getHiddenValue(value, 'simple')) { } else if (optimizeSimpleObject && v8Util.getHiddenValue(value, 'simple')) {