merge with context routes

This commit is contained in:
Simon Knott 2025-01-29 09:03:58 +01:00
parent e09f3bca06
commit 6602984401
No known key found for this signature in database
GPG key ID: 8CEDC00028084AEC
2 changed files with 10 additions and 3 deletions

View file

@ -421,7 +421,15 @@ export class BrowserContext extends ChannelOwner<channels.BrowserContextChannel>
private async _updateInterceptionPatterns() {
const patterns = network.RouteHandler.prepareInterceptionPatterns(this._routes);
await this._channel.setNetworkInterceptionPatterns({ patterns });
await this._mockingProxy?.setInterceptionPatterns({ patterns });
await this._updateMockingProxyInterceptionPatterns();
}
async _updateMockingProxyInterceptionPatterns() {
if (!this._mockingProxy)
return;
const pageRoutes = this.pages().flatMap(page => page._routes);
const patterns = network.RouteHandler.prepareInterceptionPatterns(this._routes.concat(pageRoutes));
await this._mockingProxy.setInterceptionPatterns({ patterns });
}
private async _updateWebSocketInterceptionPatterns() {

View file

@ -568,8 +568,7 @@ export class Page extends ChannelOwner<channels.PageChannel> implements api.Page
private async _updateInterceptionPatterns() {
const patterns = RouteHandler.prepareInterceptionPatterns(this._routes);
await this._channel.setNetworkInterceptionPatterns({ patterns });
// TODO: merge this with browserContext patterns
await this._browserContext._mockingProxy?.setInterceptionPatterns({ patterns });
await this._browserContext._updateMockingProxyInterceptionPatterns();
}
private async _updateWebSocketInterceptionPatterns() {