mirror of
https://github.com/electron/electron.git
synced 2026-05-02 03:00:22 -04:00
refactor: netLog directly uses network service (#18289)
This commit is contained in:
@@ -22,3 +22,31 @@ Object.setPrototypeOf(Cookies.prototype, EventEmitter.prototype)
|
||||
Session.prototype._init = function () {
|
||||
app.emit('session-created', this)
|
||||
}
|
||||
|
||||
const _originalStartLogging = NetLog.prototype.startLogging
|
||||
NetLog.prototype.startLogging = function (path) {
|
||||
this._currentlyLoggingPath = path
|
||||
try {
|
||||
return _originalStartLogging.call(this, path)
|
||||
} catch (e) {
|
||||
this._currentlyLoggingPath = null
|
||||
throw e
|
||||
}
|
||||
}
|
||||
|
||||
const _originalStopLogging = NetLog.prototype.stopLogging
|
||||
NetLog.prototype.stopLogging = function () {
|
||||
this._currentlyLoggingPath = null
|
||||
return _originalStopLogging.call(this)
|
||||
}
|
||||
|
||||
const currentlyLoggingPathDeprecated = deprecate.warnOnce('currentlyLoggingPath')
|
||||
Object.defineProperties(NetLog.prototype, {
|
||||
currentlyLoggingPath: {
|
||||
enumerable: true,
|
||||
get () {
|
||||
currentlyLoggingPathDeprecated()
|
||||
return this._currentlyLoggingPath == null ? '' : this._currentlyLoggingPath
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -14,6 +14,7 @@ function warnOnce (oldName: string, newName?: string) {
|
||||
}
|
||||
|
||||
const deprecate: ElectronInternal.DeprecationUtil = {
|
||||
warnOnce,
|
||||
setHandler: (handler) => { deprecationHandler = handler },
|
||||
getHandler: () => deprecationHandler,
|
||||
warn: (oldName, newName) => {
|
||||
|
||||
Reference in New Issue
Block a user