Skip to content

Commit

Permalink
apply same fix to protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
codebytere committed Mar 24, 2019
1 parent 6b441ed commit 5dea4eb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/browser/api/protocol.ts
Expand Up @@ -11,8 +11,12 @@ Object.setPrototypeOf(protocol, new Proxy({}, {
const protocol = session.defaultSession!.protocol
if (!Object.getPrototypeOf(protocol).hasOwnProperty(property)) return

// check for properties on the prototype chain that aren't functions
const propertyValue = protocol[property as keyof Electron.Protocol]
if (typeof propertyValue !== 'function') return propertyValue

// Returning a native function directly would throw error.
return (...args: any[]) => (protocol[property as keyof Electron.Protocol] as Function)(...args)
return (...args: any[]) => (propertyValue as Function)(...args)
},

ownKeys () {
Expand Down

0 comments on commit 5dea4eb

Please sign in to comment.