Skip to content

[pull] main from microsoft:main #88

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 35 additions & 30 deletions packages/playwright-core/src/server/bidi/bidiBrowser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,40 +47,11 @@ export class BidiBrowser extends Browser {
if ((options as any).__testHookOnConnectToBrowser)
await (options as any).__testHookOnConnectToBrowser();

let proxy: bidi.Session.ManualProxyConfiguration | undefined;
if (options.proxy) {
proxy = {
proxyType: 'manual',
};
const url = new URL(options.proxy.server); // Validate proxy server.
switch (url.protocol) {
case 'http:':
proxy.httpProxy = url.host;
break;
case 'https:':
proxy.httpsProxy = url.host;
break;
case 'socks4:':
proxy.socksProxy = url.host;
proxy.socksVersion = 4;
break;
case 'socks5:':
proxy.socksProxy = url.host;
proxy.socksVersion = 5;
break;
default:
throw new Error('Invalid proxy server protocol: ' + options.proxy.server);
}
if (options.proxy.bypass)
proxy.noProxy = options.proxy.bypass.split(',');
// TODO: support authentication.
}

browser._bidiSessionInfo = await browser._browserSession.send('session.new', {
capabilities: {
alwaysMatch: {
acceptInsecureCerts: false,
proxy,
proxy: getProxyConfiguration(options.proxy),
unhandledPromptBehavior: {
default: bidi.Session.UserPromptHandlerType.Ignore,
},
Expand Down Expand Up @@ -126,6 +97,7 @@ export class BidiBrowser extends Browser {
async doCreateNewContext(options: types.BrowserContextOptions): Promise<BrowserContext> {
const { userContext } = await this._browserSession.send('browser.createUserContext', {
acceptInsecureCerts: options.ignoreHTTPSErrors,
proxy: getProxyConfiguration(options.proxy),
});
const context = new BidiBrowserContext(this, userContext, options);
await context._initialize();
Expand Down Expand Up @@ -473,6 +445,39 @@ function toBidiSameSite(sameSite: channels.SetNetworkCookie['sameSite']): bidi.N
return bidi.Network.SameSite.None;
}

function getProxyConfiguration(proxySettings?: types.ProxySettings): bidi.Session.ManualProxyConfiguration | undefined {
if (!proxySettings)
return undefined;

const proxy: bidi.Session.ManualProxyConfiguration = {
proxyType: 'manual',
};
const url = new URL(proxySettings.server); // Validate proxy server.
switch (url.protocol) {
case 'http:':
proxy.httpProxy = url.host;
break;
case 'https:':
proxy.sslProxy = url.host;
break;
case 'socks4:':
proxy.socksProxy = url.host;
proxy.socksVersion = 4;
break;
case 'socks5:':
proxy.socksProxy = url.host;
proxy.socksVersion = 5;
break;
default:
throw new Error('Invalid proxy server protocol: ' + proxySettings.server);
}
if (proxySettings.bypass)
proxy.noProxy = proxySettings.bypass.split(',');
// TODO: support authentication.

return proxy;
}

export namespace Network {
export const enum SameSite {
Strict = 'strict',
Expand Down
4 changes: 4 additions & 0 deletions packages/trace-viewer/src/ui/actionList.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
limitations under the License.
*/

.action-title > .hbox {
align-items: center;
}

.action-title-line {
display: block;
overflow: hidden;
Expand Down
Loading