fix(firefox): properly cleanup networkmanager (#4024)

This commit is contained in:
Andrey Lushnikov 2019-02-15 23:34:01 -08:00 committed by GitHub
parent 9782f9c827
commit ea482c4751
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 5 deletions

View File

@ -18,6 +18,10 @@ class NetworkManager extends EventEmitter {
];
}
dispose() {
helper.removeEventListeners(this._eventListeners);
}
setFrameManager(frameManager) {
this._frameManager = frameManager;
}
@ -57,10 +61,6 @@ class NetworkManager extends EventEmitter {
this._requests.delete(request._id);
this.emit(Events.NetworkManager.RequestFinished, request);
}
dispose() {
helper.removeEventListeners(this._eventListeners);
}
}
/**

View File

@ -570,6 +570,7 @@ class Page extends EventEmitter {
_onClosed() {
this._isClosed = true;
this._frameManager.dispose();
this._networkManager.dispose();
helper.removeEventListeners(this._eventListeners);
this.emit(Events.Page.Close);
}

View File

@ -256,7 +256,7 @@ module.exports.addTests = function({testRunner, expect, Errors, CHROME}) {
process.removeListener('warning', warningHandler);
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;
const warningHandler = w => warning = w;
process.on('warning', warningHandler);