fix: correctly return properties on the netLog module (#17545)

This commit is contained in:
trop[bot]
2019-03-27 15:38:10 -07:00
committed by Samuel Attard
parent 46841d7373
commit 5dd735f5b3

View File

@@ -10,8 +10,12 @@ Object.setPrototypeOf(module.exports, new Proxy({}, {
if (!app.isReady()) return
const netLog = session.defaultSession.netLog
if (!Object.getPrototypeOf(netLog).hasOwnProperty(property)) return
// check for properties on the prototype chain that aren't functions
if (typeof netLog[property] !== 'function') return netLog[property]
// Returning a native function directly would throw error.
return (...args) => netLog[property](...args)
},