mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
🐛 Add toString support to remote functions
This commit is contained in:
@@ -175,6 +175,9 @@ const proxyFunctionProperties = function (remoteMemberFunction, metaId, name) {
|
||||
return true
|
||||
},
|
||||
get: (target, property, receiver) => {
|
||||
if (property === 'toString' && typeof target.toString === 'function') {
|
||||
return target.toString.bind(target)
|
||||
}
|
||||
if (!target.hasOwnProperty(property)) loadRemoteProperties()
|
||||
return target[property]
|
||||
},
|
||||
|
||||
@@ -161,6 +161,11 @@ describe('ipc module', function () {
|
||||
assert.equal(typeof remote.clipboard.readText, 'function')
|
||||
assert.equal(typeof remote.shell.openExternal, 'function')
|
||||
})
|
||||
|
||||
it('returns toString() of original function via toString()', function () {
|
||||
var readText = remote.clipboard.readText
|
||||
assert(readText.toString().startsWith('function'))
|
||||
})
|
||||
})
|
||||
|
||||
describe('remote object in renderer', function () {
|
||||
|
||||
Reference in New Issue
Block a user