chore: avoid protocol calls on disposed context (#16812)

Otherwise, we always get a failing protocol message when closing a context.
This commit is contained in:
Dmitry Gozman 2022-08-24 17:21:01 -07:00 committed by GitHub
parent 553ecce4f9
commit 2c1723b6f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -227,6 +227,8 @@ export class BrowserContextDispatcher extends Dispatcher<BrowserContext, channel
override _dispose() {
super._dispose();
this._context.setRequestInterceptor(undefined).catch(() => {});
// Avoid protocol calls for the closed context.
if (!this._context.isClosingOrClosed())
this._context.setRequestInterceptor(undefined).catch(() => {});
}
}