From 59dd7ca9df4fee4d12e7eae57e9046a1935edbc4 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Fri, 27 May 2016 10:46:02 -0700 Subject: [PATCH] Guard against object with no hasOwnProperty --- lib/browser/rpc-server.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/browser/rpc-server.js b/lib/browser/rpc-server.js index fe264cceeeff..fa9841aeecb0 100644 --- a/lib/browser/rpc-server.js +++ b/lib/browser/rpc-server.js @@ -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')) {