security: allow to block desktopCapturer.getSources() calls (#15964)
* security: allow to block desktopCapturer.getSources() calls * return empty instead of error * fix: release resources of DesktopCapturer on exit
This commit is contained in:
parent
df0381e76c
commit
547097b036
9 changed files with 76 additions and 16 deletions
|
@ -1,6 +1,6 @@
|
|||
const chai = require('chai')
|
||||
const dirtyChai = require('dirty-chai')
|
||||
const { desktopCapturer, remote } = require('electron')
|
||||
const { desktopCapturer, ipcRenderer, remote } = require('electron')
|
||||
const { screen } = remote
|
||||
const features = process.atomBinding('features')
|
||||
|
||||
|
@ -99,5 +99,14 @@ describe('desktopCapturer', () => {
|
|||
}
|
||||
done()
|
||||
})
|
||||
|
||||
it('returns empty sources when blocked', done => {
|
||||
ipcRenderer.send('handle-next-desktop-capturer-get-sources')
|
||||
desktopCapturer.getSources({ types: ['screen'] }, (error, sources) => {
|
||||
expect(error).to.be.null()
|
||||
expect(sources).to.be.empty()
|
||||
done()
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue