Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

browser(firefox): support proxy bypass (#2467)

Andrey Lushnikova26311a18a9a
diff --git a/browser_patches/firefox/BUILD_NUMBER b/browser_patches/firefox/BUILD_NUMBER
index 1343902521..21a801b486 100644
--- a/browser_patches/firefox/BUILD_NUMBER
+++ b/browser_patches/firefox/BUILD_NUMBER
@@ -1 +1 @@
-1102
+1103
diff --git a/browser_patches/firefox/juggler/NetworkObserver.js b/browser_patches/firefox/juggler/NetworkObserver.js
index 60d5c151b5..2605f45655 100644
--- a/browser_patches/firefox/juggler/NetworkObserver.js
+++ b/browser_patches/firefox/juggler/NetworkObserver.js
@@ -166,6 +166,10 @@ class NetworkObserver {
proxyFilter.onProxyFilterResult(defaultProxyInfo);
return;
}
+ if (proxy.bypass.some(domain => channel.URI.host.endsWith(domain))) {
+ proxyFilter.onProxyFilterResult(defaultProxyInfo);
+ return;
+ }
proxyFilter.onProxyFilterResult(protocolProxyService.newProxyInfo(
proxy.type,
proxy.host,
diff --git a/browser_patches/firefox/juggler/protocol/BrowserHandler.js b/browser_patches/firefox/juggler/protocol/BrowserHandler.js
index 27602087a3..5e55801ff2 100644
--- a/browser_patches/firefox/juggler/protocol/BrowserHandler.js
+++ b/browser_patches/firefox/juggler/protocol/BrowserHandler.js
@@ -151,8 +151,8 @@ class BrowserHandler {
this._targetRegistry.browserContextForId(browserContextId).httpCredentials = nullToUndefined(credentials);
}
- async setProxy({browserContextId, type, host, port}) {
- this._targetRegistry.browserContextForId(browserContextId).proxy = { type, host, port };
+ async setProxy({browserContextId, type, host, port, bypass}) {
+ this._targetRegistry.browserContextForId(browserContextId).proxy = { type, host, port, bypass };
}
setRequestInterception({browserContextId, enabled}) {
diff --git a/browser_patches/firefox/juggler/protocol/Protocol.js b/browser_patches/firefox/juggler/protocol/Protocol.js
index fb10b708a4..b96c43547a 100644
--- a/browser_patches/firefox/juggler/protocol/Protocol.js
+++ b/browser_patches/firefox/juggler/protocol/Protocol.js
@@ -263,6 +263,7 @@ const Browser = {
params: {
browserContextId: t.Optional(t.String),
type: t.Enum(['http', 'https', 'socks', 'socks4']),
+ bypass: t.Array(t.String),
host: t.String,
port: t.Number,
},