Merge pull request #5736 from electron/missing-has-own-property

Support objects with no prototype over IPC
This commit is contained in:
Cheng Zhao
2016-05-28 13:42:30 +00:00
3 changed files with 14 additions and 1 deletions

View File

@@ -6,6 +6,8 @@ const {ipcMain, isPromise} = electron
const objectsRegistry = require('./objects-registry')
const hasProp = {}.hasOwnProperty
// The internal properties of Function.
const FUNCTION_PROPERTIES = [
'length', 'name', 'arguments', 'caller', 'prototype'
@@ -67,7 +69,7 @@ let valueToMeta = function (sender, value, optimizeSimpleObject = false) {
meta.type = 'date'
} else if (isPromise(value)) {
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.
meta.type = 'array'
} else if (optimizeSimpleObject && v8Util.getHiddenValue(value, 'simple')) {