uninstall

This commit is contained in:
Simon Knott 2025-01-24 13:14:06 +01:00
parent e580a4cca2
commit fdad74906e
No known key found for this signature in database
GPG key ID: 8CEDC00028084AEC
2 changed files with 7 additions and 1 deletions

View file

@ -462,6 +462,7 @@ export class BrowserContext extends ChannelOwner<channels.BrowserContextChannel>
this._disposeHarRouters();
this.tracing._resetStackCounter();
this.emit(Events.BrowserContext.Close, this);
this._mockingProxies.forEach(p => p.uninstall(this));
}
async [Symbol.asyncDispose]() {

View file

@ -41,11 +41,16 @@ export class MockingProxy extends ChannelOwner<channels.MockingProxyChannel> {
});
}
installOn(context: BrowserContext): void {
install(context: BrowserContext): void {
context._mockingProxies.add(this);
this._contexts.add(context);
}
uninstall(context: BrowserContext): void {
context._mockingProxies.delete(this);
this._contexts.delete(context);
}
async setInterceptionPatterns(params: channels.MockingProxySetInterceptionPatternsParams) {
await this._channel.setInterceptionPatterns(params);
}