fix: implement 'login' event for net.ClientRequest (#21135)

* fix: implement 'login' event for net.ClientRequest (#21096)

* fix patch

* lint

* include mojo header in atom_browser_context.h

* fix compile

* kick ci

* URLRequest -> URLRequestNS

* fix ts

* no ts in js
This commit is contained in:
Jeremy Apthorp
2019-11-21 09:06:23 -08:00
committed by John Kleinschmidt
parent fbe36e2365
commit de428e9a7a
15 changed files with 447 additions and 37 deletions

View File

@@ -247,22 +247,11 @@ class ClientRequest extends EventEmitter {
})
urlRequest.on('login', (event, authInfo, callback) => {
this.emit('login', authInfo, (username, password) => {
// If null or undefined username/password, force to empty string.
if (username === null || username === undefined) {
username = ''
}
if (typeof username !== 'string') {
throw new Error('username must be a string')
}
if (password === null || password === undefined) {
password = ''
}
if (typeof password !== 'string') {
throw new Error('password must be a string')
}
callback(username, password)
})
const handled = this.emit('login', authInfo, callback)
if (!handled) {
// If there were no listeners, cancel the authentication request.
callback()
}
})
if (callback) {