fix: crash on invalid zoomFactor (#22673)

This commit is contained in:
Shelley Vohr 2020-03-13 23:13:05 +00:00 committed by GitHub
parent 9c5874306d
commit a4c4c86b9d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 37 additions and 5 deletions

View file

@ -846,6 +846,19 @@ describe('webContents module', () => {
afterEach(closeAllWindows)
it('throws on an invalid zoomFactor', async () => {
const w = new BrowserWindow({ show: false })
await w.loadURL('about:blank')
expect(() => {
w.webContents.setZoomFactor(0.0)
}).to.throw(/'zoomFactor' must be a double greater than 0.0/)
expect(() => {
w.webContents.setZoomFactor(-2.0)
}).to.throw(/'zoomFactor' must be a double greater than 0.0/)
})
it('can set the correct zoom level (functions)', async () => {
const w = new BrowserWindow({ show: false })
try {