chore: update to standard 12
This commit is contained in:
parent
9e85bdb02c
commit
558fff69e7
198 changed files with 4455 additions and 2940 deletions
|
@ -5,10 +5,10 @@ const path = require('path')
|
|||
const fs = require('fs')
|
||||
const send = require('send')
|
||||
const auth = require('basic-auth')
|
||||
const {closeWindow} = require('./window-helpers')
|
||||
const { closeWindow } = require('./window-helpers')
|
||||
|
||||
const {ipcRenderer, remote} = require('electron')
|
||||
const {ipcMain, session, BrowserWindow, net} = remote
|
||||
const { ipcRenderer, remote } = require('electron')
|
||||
const { ipcMain, session, BrowserWindow, net } = remote
|
||||
|
||||
/* The whole session API doesn't use standard callbacks */
|
||||
/* eslint-disable standard/no-callback-literal */
|
||||
|
@ -40,13 +40,13 @@ describe('session module', () => {
|
|||
|
||||
describe('session.defaultSession', () => {
|
||||
it('returns the default session', () => {
|
||||
assert.equal(session.defaultSession, session.fromPartition(''))
|
||||
assert.strictEqual(session.defaultSession, session.fromPartition(''))
|
||||
})
|
||||
})
|
||||
|
||||
describe('session.fromPartition(partition, options)', () => {
|
||||
it('returns existing session with same partition', () => {
|
||||
assert.equal(session.fromPartition('test'), session.fromPartition('test'))
|
||||
assert.strictEqual(session.fromPartition('test'), session.fromPartition('test'))
|
||||
})
|
||||
|
||||
it('created session is ref-counted', () => {
|
||||
|
@ -54,10 +54,10 @@ describe('session module', () => {
|
|||
const userAgent = 'test-agent'
|
||||
const ses1 = session.fromPartition(partition)
|
||||
ses1.setUserAgent(userAgent)
|
||||
assert.equal(ses1.getUserAgent(), userAgent)
|
||||
assert.strictEqual(ses1.getUserAgent(), userAgent)
|
||||
ses1.destroy()
|
||||
const ses2 = session.fromPartition(partition)
|
||||
assert.notEqual(ses2.getUserAgent(), userAgent)
|
||||
assert.notStrictEqual(ses2.getUserAgent(), userAgent)
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -72,7 +72,7 @@ describe('session module', () => {
|
|||
const port = server.address().port
|
||||
w.loadURL(`${url}:${port}`)
|
||||
w.webContents.on('did-finish-load', () => {
|
||||
w.webContents.session.cookies.get({url}, (error, list) => {
|
||||
w.webContents.session.cookies.get({ url }, (error, list) => {
|
||||
if (error) return done(error)
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
const cookie = list[i]
|
||||
|
@ -97,7 +97,7 @@ describe('session module', () => {
|
|||
value: '1'
|
||||
}, (error) => {
|
||||
assert(error, 'Should have an error')
|
||||
assert.equal(error.message, 'Setting cookie failed')
|
||||
assert.strictEqual(error.message, 'Setting cookie failed')
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
@ -109,7 +109,7 @@ describe('session module', () => {
|
|||
value: '1'
|
||||
}, (error) => {
|
||||
if (error) return done(error)
|
||||
session.defaultSession.cookies.get({url}, (error, list) => {
|
||||
session.defaultSession.cookies.get({ url }, (error, list) => {
|
||||
if (error) return done(error)
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
const cookie = list[i]
|
||||
|
@ -134,7 +134,7 @@ describe('session module', () => {
|
|||
}, (error) => {
|
||||
if (error) return done(error)
|
||||
session.defaultSession.cookies.remove(url, '2', () => {
|
||||
session.defaultSession.cookies.get({url}, (error, list) => {
|
||||
session.defaultSession.cookies.get({ url }, (error, list) => {
|
||||
if (error) return done(error)
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
const cookie = list[i]
|
||||
|
@ -155,31 +155,31 @@ describe('session module', () => {
|
|||
value: '1'
|
||||
}, (error) => {
|
||||
if (error) return done(error)
|
||||
session.defaultSession.cookies.get({url: origin}, (error, list) => {
|
||||
session.defaultSession.cookies.get({ url: origin }, (error, list) => {
|
||||
if (error) return done(error)
|
||||
assert.equal(list.length, 1)
|
||||
assert.equal(list[0].name, 'custom')
|
||||
assert.equal(list[0].value, '1')
|
||||
assert.equal(list[0].domain, 'fake-host')
|
||||
assert.strictEqual(list.length, 1)
|
||||
assert.strictEqual(list[0].name, 'custom')
|
||||
assert.strictEqual(list[0].value, '1')
|
||||
assert.strictEqual(list[0].domain, 'fake-host')
|
||||
done()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
it('emits a changed event when a cookie is added or removed', (done) => {
|
||||
const {cookies} = session.fromPartition('cookies-changed')
|
||||
const { cookies } = session.fromPartition('cookies-changed')
|
||||
|
||||
cookies.once('changed', (event, cookie, cause, removed) => {
|
||||
assert.equal(cookie.name, 'foo')
|
||||
assert.equal(cookie.value, 'bar')
|
||||
assert.equal(cause, 'explicit')
|
||||
assert.equal(removed, false)
|
||||
assert.strictEqual(cookie.name, 'foo')
|
||||
assert.strictEqual(cookie.value, 'bar')
|
||||
assert.strictEqual(cause, 'explicit')
|
||||
assert.strictEqual(removed, false)
|
||||
|
||||
cookies.once('changed', (event, cookie, cause, removed) => {
|
||||
assert.equal(cookie.name, 'foo')
|
||||
assert.equal(cookie.value, 'bar')
|
||||
assert.equal(cause, 'explicit')
|
||||
assert.equal(removed, true)
|
||||
assert.strictEqual(cookie.name, 'foo')
|
||||
assert.strictEqual(cookie.value, 'bar')
|
||||
assert.strictEqual(cause, 'explicit')
|
||||
assert.strictEqual(removed, true)
|
||||
done()
|
||||
})
|
||||
|
||||
|
@ -218,7 +218,7 @@ describe('session module', () => {
|
|||
it('clears localstorage data', (done) => {
|
||||
ipcMain.on('count', (event, count) => {
|
||||
ipcMain.removeAllListeners('count')
|
||||
assert.equal(count, 0)
|
||||
assert.strictEqual(count, 0)
|
||||
done()
|
||||
})
|
||||
w.loadFile(path.join(fixtures, 'api', 'localstorage.html'))
|
||||
|
@ -265,9 +265,9 @@ describe('session module', () => {
|
|||
ipcRenderer.sendSync('set-download-option', false, true)
|
||||
w.loadURL(url)
|
||||
ipcRenderer.once('download-error', (event, downloadUrl, filename, error) => {
|
||||
assert.equal(downloadUrl, url)
|
||||
assert.equal(filename, 'mockFile.txt')
|
||||
assert.equal(error, 'Object has been destroyed')
|
||||
assert.strictEqual(downloadUrl, url)
|
||||
assert.strictEqual(filename, 'mockFile.txt')
|
||||
assert.strictEqual(error, 'Object has been destroyed')
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
@ -294,21 +294,21 @@ describe('session module', () => {
|
|||
return path.relative(path1, path2) === ''
|
||||
}
|
||||
const assertDownload = (event, state, url, mimeType,
|
||||
receivedBytes, totalBytes, disposition,
|
||||
filename, port, savePath, isCustom) => {
|
||||
assert.equal(state, 'completed')
|
||||
assert.equal(filename, 'mock.pdf')
|
||||
receivedBytes, totalBytes, disposition,
|
||||
filename, port, savePath, isCustom) => {
|
||||
assert.strictEqual(state, 'completed')
|
||||
assert.strictEqual(filename, 'mock.pdf')
|
||||
assert.ok(path.isAbsolute(savePath))
|
||||
assert.ok(isPathEqual(savePath, path.join(__dirname, 'fixtures', 'mock.pdf')))
|
||||
if (isCustom) {
|
||||
assert.equal(url, `${protocolName}://item`)
|
||||
assert.strictEqual(url, `${protocolName}://item`)
|
||||
} else {
|
||||
assert.equal(url, `http://127.0.0.1:${port}/`)
|
||||
assert.strictEqual(url, `http://127.0.0.1:${port}/`)
|
||||
}
|
||||
assert.equal(mimeType, 'application/pdf')
|
||||
assert.equal(receivedBytes, mockPDF.length)
|
||||
assert.equal(totalBytes, mockPDF.length)
|
||||
assert.equal(disposition, contentDisposition)
|
||||
assert.strictEqual(mimeType, 'application/pdf')
|
||||
assert.strictEqual(receivedBytes, mockPDF.length)
|
||||
assert.strictEqual(totalBytes, mockPDF.length)
|
||||
assert.strictEqual(disposition, contentDisposition)
|
||||
assert(fs.existsSync(downloadFilePath))
|
||||
fs.unlinkSync(downloadFilePath)
|
||||
}
|
||||
|
@ -319,11 +319,11 @@ describe('session module', () => {
|
|||
ipcRenderer.sendSync('set-download-option', false, false)
|
||||
w.webContents.downloadURL(`${url}:${port}`)
|
||||
ipcRenderer.once('download-done', (event, state, url,
|
||||
mimeType, receivedBytes,
|
||||
totalBytes, disposition,
|
||||
filename, savePath) => {
|
||||
mimeType, receivedBytes,
|
||||
totalBytes, disposition,
|
||||
filename, savePath) => {
|
||||
assertDownload(event, state, url, mimeType, receivedBytes,
|
||||
totalBytes, disposition, filename, port, savePath)
|
||||
totalBytes, disposition, filename, port, savePath)
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
@ -334,19 +334,19 @@ describe('session module', () => {
|
|||
downloadServer.listen(0, '127.0.0.1', () => {
|
||||
const port = downloadServer.address().port
|
||||
const handler = (ignoredError, callback) => {
|
||||
callback({url: `${url}:${port}`})
|
||||
callback({ url: `${url}:${port}` })
|
||||
}
|
||||
protocol.registerHttpProtocol(protocolName, handler, (error) => {
|
||||
if (error) return done(error)
|
||||
ipcRenderer.sendSync('set-download-option', false, false)
|
||||
w.webContents.downloadURL(`${protocolName}://item`)
|
||||
ipcRenderer.once('download-done', (event, state, url,
|
||||
mimeType, receivedBytes,
|
||||
totalBytes, disposition,
|
||||
filename, savePath) => {
|
||||
mimeType, receivedBytes,
|
||||
totalBytes, disposition,
|
||||
filename, savePath) => {
|
||||
assertDownload(event, state, url, mimeType, receivedBytes,
|
||||
totalBytes, disposition, filename, port, savePath,
|
||||
true)
|
||||
totalBytes, disposition, filename, port, savePath,
|
||||
true)
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
@ -363,11 +363,11 @@ describe('session module', () => {
|
|||
webview.downloadURL(`${url}:${port}/`)
|
||||
})
|
||||
ipcRenderer.once('download-done', (event, state, url,
|
||||
mimeType, receivedBytes,
|
||||
totalBytes, disposition,
|
||||
filename, savePath) => {
|
||||
mimeType, receivedBytes,
|
||||
totalBytes, disposition,
|
||||
filename, savePath) => {
|
||||
assertDownload(event, state, url, mimeType, receivedBytes,
|
||||
totalBytes, disposition, filename, port, savePath)
|
||||
totalBytes, disposition, filename, port, savePath)
|
||||
document.body.removeChild(webview)
|
||||
done()
|
||||
})
|
||||
|
@ -381,15 +381,15 @@ describe('session module', () => {
|
|||
ipcRenderer.sendSync('set-download-option', true, false)
|
||||
w.webContents.downloadURL(`${url}:${port}/`)
|
||||
ipcRenderer.once('download-done', (event, state, url,
|
||||
mimeType, receivedBytes,
|
||||
totalBytes, disposition,
|
||||
filename) => {
|
||||
assert.equal(state, 'cancelled')
|
||||
assert.equal(filename, 'mock.pdf')
|
||||
assert.equal(mimeType, 'application/pdf')
|
||||
assert.equal(receivedBytes, 0)
|
||||
assert.equal(totalBytes, mockPDF.length)
|
||||
assert.equal(disposition, contentDisposition)
|
||||
mimeType, receivedBytes,
|
||||
totalBytes, disposition,
|
||||
filename) => {
|
||||
assert.strictEqual(state, 'cancelled')
|
||||
assert.strictEqual(filename, 'mock.pdf')
|
||||
assert.strictEqual(mimeType, 'application/pdf')
|
||||
assert.strictEqual(receivedBytes, 0)
|
||||
assert.strictEqual(totalBytes, mockPDF.length)
|
||||
assert.strictEqual(disposition, contentDisposition)
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
@ -407,15 +407,15 @@ describe('session module', () => {
|
|||
ipcRenderer.sendSync('set-download-option', true, false)
|
||||
w.webContents.downloadURL(`${url}:${port}/?testFilename`)
|
||||
ipcRenderer.once('download-done', (event, state, url,
|
||||
mimeType, receivedBytes,
|
||||
totalBytes, disposition,
|
||||
filename) => {
|
||||
assert.equal(state, 'cancelled')
|
||||
assert.equal(filename, 'download.pdf')
|
||||
assert.equal(mimeType, 'application/pdf')
|
||||
assert.equal(receivedBytes, 0)
|
||||
assert.equal(totalBytes, mockPDF.length)
|
||||
assert.equal(disposition, contentDisposition)
|
||||
mimeType, receivedBytes,
|
||||
totalBytes, disposition,
|
||||
filename) => {
|
||||
assert.strictEqual(state, 'cancelled')
|
||||
assert.strictEqual(filename, 'download.pdf')
|
||||
assert.strictEqual(mimeType, 'application/pdf')
|
||||
assert.strictEqual(receivedBytes, 0)
|
||||
assert.strictEqual(totalBytes, mockPDF.length)
|
||||
assert.strictEqual(disposition, contentDisposition)
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
@ -425,7 +425,7 @@ describe('session module', () => {
|
|||
it('does not display a save dialog and reports the done state as interrupted', (done) => {
|
||||
ipcRenderer.sendSync('set-download-option', false, false)
|
||||
ipcRenderer.once('download-done', (event, state) => {
|
||||
assert.equal(state, 'interrupted')
|
||||
assert.strictEqual(state, 'interrupted')
|
||||
done()
|
||||
})
|
||||
w.webContents.downloadURL(`file://${path.join(__dirname, 'does-not-exist.txt')}`)
|
||||
|
@ -439,7 +439,7 @@ describe('session module', () => {
|
|||
const partitionProtocol = session.fromPartition(partitionName).protocol
|
||||
const protocol = session.defaultSession.protocol
|
||||
const handler = (ignoredError, callback) => {
|
||||
callback({data: 'test', mimeType: 'text/html'})
|
||||
callback({ data: 'test', mimeType: 'text/html' })
|
||||
}
|
||||
|
||||
beforeEach((done) => {
|
||||
|
@ -461,9 +461,9 @@ describe('session module', () => {
|
|||
|
||||
it('does not affect defaultSession', (done) => {
|
||||
protocol.isProtocolHandled(protocolName, (result) => {
|
||||
assert.equal(result, false)
|
||||
assert.strictEqual(result, false)
|
||||
partitionProtocol.isProtocolHandled(protocolName, (result) => {
|
||||
assert.equal(result, true)
|
||||
assert.strictEqual(result, true)
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
@ -477,10 +477,10 @@ describe('session module', () => {
|
|||
|
||||
describe('ses.setProxy(options, callback)', () => {
|
||||
it('allows configuring proxy settings', (done) => {
|
||||
const config = {proxyRules: 'http=myproxy:80'}
|
||||
const config = { proxyRules: 'http=myproxy:80' }
|
||||
session.defaultSession.setProxy(config, () => {
|
||||
session.defaultSession.resolveProxy('http://localhost', (proxy) => {
|
||||
assert.equal(proxy, 'PROXY myproxy:80')
|
||||
assert.strictEqual(proxy, 'PROXY myproxy:80')
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
@ -493,7 +493,7 @@ describe('session module', () => {
|
|||
}
|
||||
session.defaultSession.setProxy(config, () => {
|
||||
session.defaultSession.resolveProxy('http://localhost', (proxy) => {
|
||||
assert.equal(proxy, 'DIRECT')
|
||||
assert.strictEqual(proxy, 'DIRECT')
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
@ -507,7 +507,7 @@ describe('session module', () => {
|
|||
const url = `${scheme}://host`
|
||||
before(() => {
|
||||
if (w != null) w.destroy()
|
||||
w = new BrowserWindow({show: false})
|
||||
w = new BrowserWindow({ show: false })
|
||||
})
|
||||
|
||||
after((done) => {
|
||||
|
@ -535,12 +535,12 @@ describe('session module', () => {
|
|||
|
||||
protocol.registerStringProtocol(scheme, (request, callback) => {
|
||||
if (request.method === 'GET') {
|
||||
callback({data: content, mimeType: 'text/html'})
|
||||
callback({ data: content, mimeType: 'text/html' })
|
||||
} else if (request.method === 'POST') {
|
||||
let uuid = request.uploadData[1].blobUUID
|
||||
assert(uuid)
|
||||
session.defaultSession.getBlobData(uuid, (result) => {
|
||||
assert.equal(result.toString(), postData)
|
||||
assert.strictEqual(result.toString(), postData)
|
||||
done()
|
||||
})
|
||||
}
|
||||
|
@ -580,38 +580,38 @@ describe('session module', () => {
|
|||
})
|
||||
|
||||
it('accepts the request when the callback is called with 0', (done) => {
|
||||
session.defaultSession.setCertificateVerifyProc(({hostname, certificate, verificationResult, errorCode}, callback) => {
|
||||
session.defaultSession.setCertificateVerifyProc(({ hostname, certificate, verificationResult, errorCode }, callback) => {
|
||||
assert(['net::ERR_CERT_AUTHORITY_INVALID', 'net::ERR_CERT_COMMON_NAME_INVALID'].includes(verificationResult), verificationResult)
|
||||
assert([-202, -200].includes(errorCode), errorCode)
|
||||
callback(0)
|
||||
})
|
||||
|
||||
w.webContents.once('did-finish-load', () => {
|
||||
assert.equal(w.webContents.getTitle(), 'hello')
|
||||
assert.strictEqual(w.webContents.getTitle(), 'hello')
|
||||
done()
|
||||
})
|
||||
w.loadURL(`https://127.0.0.1:${server.address().port}`)
|
||||
})
|
||||
|
||||
it('rejects the request when the callback is called with -2', (done) => {
|
||||
session.defaultSession.setCertificateVerifyProc(({hostname, certificate, verificationResult}, callback) => {
|
||||
assert.equal(hostname, '127.0.0.1')
|
||||
assert.equal(certificate.issuerName, 'Intermediate CA')
|
||||
assert.equal(certificate.subjectName, 'localhost')
|
||||
assert.equal(certificate.issuer.commonName, 'Intermediate CA')
|
||||
assert.equal(certificate.subject.commonName, 'localhost')
|
||||
assert.equal(certificate.issuerCert.issuer.commonName, 'Root CA')
|
||||
assert.equal(certificate.issuerCert.subject.commonName, 'Intermediate CA')
|
||||
assert.equal(certificate.issuerCert.issuerCert.issuer.commonName, 'Root CA')
|
||||
assert.equal(certificate.issuerCert.issuerCert.subject.commonName, 'Root CA')
|
||||
assert.equal(certificate.issuerCert.issuerCert.issuerCert, undefined)
|
||||
session.defaultSession.setCertificateVerifyProc(({ hostname, certificate, verificationResult }, callback) => {
|
||||
assert.strictEqual(hostname, '127.0.0.1')
|
||||
assert.strictEqual(certificate.issuerName, 'Intermediate CA')
|
||||
assert.strictEqual(certificate.subjectName, 'localhost')
|
||||
assert.strictEqual(certificate.issuer.commonName, 'Intermediate CA')
|
||||
assert.strictEqual(certificate.subject.commonName, 'localhost')
|
||||
assert.strictEqual(certificate.issuerCert.issuer.commonName, 'Root CA')
|
||||
assert.strictEqual(certificate.issuerCert.subject.commonName, 'Intermediate CA')
|
||||
assert.strictEqual(certificate.issuerCert.issuerCert.issuer.commonName, 'Root CA')
|
||||
assert.strictEqual(certificate.issuerCert.issuerCert.subject.commonName, 'Root CA')
|
||||
assert.strictEqual(certificate.issuerCert.issuerCert.issuerCert, undefined)
|
||||
assert(['net::ERR_CERT_AUTHORITY_INVALID', 'net::ERR_CERT_COMMON_NAME_INVALID'].includes(verificationResult), verificationResult)
|
||||
callback(-2)
|
||||
})
|
||||
|
||||
const url = `https://127.0.0.1:${server.address().port}`
|
||||
w.webContents.once('did-finish-load', () => {
|
||||
assert.equal(w.webContents.getTitle(), url)
|
||||
assert.strictEqual(w.webContents.getTitle(), url)
|
||||
done()
|
||||
})
|
||||
w.loadURL(url)
|
||||
|
@ -631,15 +631,15 @@ describe('session module', () => {
|
|||
}
|
||||
w.webContents.session.createInterruptedDownload(options)
|
||||
ipcRenderer.once('download-created', (event, state, urlChain,
|
||||
mimeType, receivedBytes,
|
||||
totalBytes, filename,
|
||||
savePath) => {
|
||||
assert.equal(state, 'interrupted')
|
||||
assert.deepEqual(urlChain, ['http://127.0.0.1/'])
|
||||
assert.equal(mimeType, 'application/pdf')
|
||||
assert.equal(receivedBytes, 0)
|
||||
assert.equal(totalBytes, 5242880)
|
||||
assert.equal(savePath, filePath)
|
||||
mimeType, receivedBytes,
|
||||
totalBytes, filename,
|
||||
savePath) => {
|
||||
assert.strictEqual(state, 'interrupted')
|
||||
assert.deepStrictEqual(urlChain, ['http://127.0.0.1/'])
|
||||
assert.strictEqual(mimeType, 'application/pdf')
|
||||
assert.strictEqual(receivedBytes, 0)
|
||||
assert.strictEqual(totalBytes, 5242880)
|
||||
assert.strictEqual(savePath, filePath)
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
@ -650,16 +650,16 @@ describe('session module', () => {
|
|||
const rangeServer = http.createServer((req, res) => {
|
||||
let options = { root: fixtures }
|
||||
send(req, req.url, options)
|
||||
.on('error', (error) => { done(error) }).pipe(res)
|
||||
.on('error', (error) => { done(error) }).pipe(res)
|
||||
})
|
||||
ipcRenderer.sendSync('set-download-option', true, false, downloadFilePath)
|
||||
rangeServer.listen(0, '127.0.0.1', () => {
|
||||
const port = rangeServer.address().port
|
||||
const downloadUrl = `http://127.0.0.1:${port}/assets/logo.png`
|
||||
const callback = (event, state, url, mimeType,
|
||||
receivedBytes, totalBytes, disposition,
|
||||
filename, savePath, urlChain,
|
||||
lastModifiedTime, eTag) => {
|
||||
receivedBytes, totalBytes, disposition,
|
||||
filename, savePath, urlChain,
|
||||
lastModifiedTime, eTag) => {
|
||||
if (state === 'cancelled') {
|
||||
const options = {
|
||||
path: savePath,
|
||||
|
@ -673,13 +673,13 @@ describe('session module', () => {
|
|||
ipcRenderer.sendSync('set-download-option', false, false, downloadFilePath)
|
||||
w.webContents.session.createInterruptedDownload(options)
|
||||
} else {
|
||||
assert.equal(state, 'completed')
|
||||
assert.equal(filename, 'logo.png')
|
||||
assert.equal(savePath, downloadFilePath)
|
||||
assert.equal(url, downloadUrl)
|
||||
assert.equal(mimeType, 'image/png')
|
||||
assert.equal(receivedBytes, 14022)
|
||||
assert.equal(totalBytes, 14022)
|
||||
assert.strictEqual(state, 'completed')
|
||||
assert.strictEqual(filename, 'logo.png')
|
||||
assert.strictEqual(savePath, downloadFilePath)
|
||||
assert.strictEqual(url, downloadUrl)
|
||||
assert.strictEqual(mimeType, 'image/png')
|
||||
assert.strictEqual(receivedBytes, 14022)
|
||||
assert.strictEqual(totalBytes, 14022)
|
||||
assert(fs.existsSync(downloadFilePath))
|
||||
fs.unlinkSync(downloadFilePath)
|
||||
rangeServer.close()
|
||||
|
@ -719,8 +719,8 @@ describe('session module', () => {
|
|||
})
|
||||
request.on('login', (info, callback) => {
|
||||
attempt += 1
|
||||
assert.equal(info.scheme, 'basic')
|
||||
assert.equal(info.realm, 'Restricted')
|
||||
assert.strictEqual(info.scheme, 'basic')
|
||||
assert.strictEqual(info.realm, 'Restricted')
|
||||
callback('test', 'test')
|
||||
})
|
||||
request.on('response', (response) => {
|
||||
|
@ -730,8 +730,8 @@ describe('session module', () => {
|
|||
data += chunk
|
||||
})
|
||||
response.on('end', () => {
|
||||
assert.equal(data, 'authenticated')
|
||||
ses.clearAuthCache({type: 'password'}, () => {
|
||||
assert.strictEqual(data, 'authenticated')
|
||||
ses.clearAuthCache({ type: 'password' }, () => {
|
||||
issueLoginRequest(attempt)
|
||||
})
|
||||
})
|
||||
|
@ -756,8 +756,8 @@ describe('session module', () => {
|
|||
|
||||
webview = new WebView()
|
||||
webview.addEventListener('ipc-message', (e) => {
|
||||
assert.equal(e.channel, 'message')
|
||||
assert.deepEqual(e.args, ['SecurityError'])
|
||||
assert.strictEqual(e.channel, 'message')
|
||||
assert.deepStrictEqual(e.args, ['SecurityError'])
|
||||
done()
|
||||
})
|
||||
webview.src = `file://${fixtures}/pages/permissions/midi-sysex.html`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue