fix(firefox): properly cleanup networkmanager (#4024)
This commit is contained in:
parent
9782f9c827
commit
ea482c4751
@ -18,6 +18,10 @@ class NetworkManager extends EventEmitter {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dispose() {
|
||||||
|
helper.removeEventListeners(this._eventListeners);
|
||||||
|
}
|
||||||
|
|
||||||
setFrameManager(frameManager) {
|
setFrameManager(frameManager) {
|
||||||
this._frameManager = frameManager;
|
this._frameManager = frameManager;
|
||||||
}
|
}
|
||||||
@ -57,10 +61,6 @@ class NetworkManager extends EventEmitter {
|
|||||||
this._requests.delete(request._id);
|
this._requests.delete(request._id);
|
||||||
this.emit(Events.NetworkManager.RequestFinished, request);
|
this.emit(Events.NetworkManager.RequestFinished, request);
|
||||||
}
|
}
|
||||||
|
|
||||||
dispose() {
|
|
||||||
helper.removeEventListeners(this._eventListeners);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -570,6 +570,7 @@ class Page extends EventEmitter {
|
|||||||
_onClosed() {
|
_onClosed() {
|
||||||
this._isClosed = true;
|
this._isClosed = true;
|
||||||
this._frameManager.dispose();
|
this._frameManager.dispose();
|
||||||
|
this._networkManager.dispose();
|
||||||
helper.removeEventListeners(this._eventListeners);
|
helper.removeEventListeners(this._eventListeners);
|
||||||
this.emit(Events.Page.Close);
|
this.emit(Events.Page.Close);
|
||||||
}
|
}
|
||||||
|
@ -256,7 +256,7 @@ module.exports.addTests = function({testRunner, expect, Errors, CHROME}) {
|
|||||||
process.removeListener('warning', warningHandler);
|
process.removeListener('warning', warningHandler);
|
||||||
expect(warning).toBe(null);
|
expect(warning).toBe(null);
|
||||||
});
|
});
|
||||||
it_fails_ffox('should not leak listeners during bad navigation', async({page, server}) => {
|
it('should not leak listeners during bad navigation', async({page, server}) => {
|
||||||
let warning = null;
|
let warning = null;
|
||||||
const warningHandler = w => warning = w;
|
const warningHandler = w => warning = w;
|
||||||
process.on('warning', warningHandler);
|
process.on('warning', warningHandler);
|
||||||
|
Loading…
Reference in New Issue
Block a user