Skip to content

Commit

Permalink
fix(remote server): allow local paths in extension mode (#34051)
Browse files Browse the repository at this point in the history
  • Loading branch information
dgozman authored Dec 18, 2024
1 parent f7c99ee commit d9e5ca0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions packages/playwright-core/src/remote/playwrightConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import { debugLogger } from '../utils/debugLogger';
export type ClientType = 'controller' | 'launch-browser' | 'reuse-browser' | 'pre-launched-browser-or-android';

type Options = {
allowFSPaths: boolean,
socksProxyPattern: string | undefined,
browserName: string | null,
launchOptions: LaunchOptions,
Expand Down Expand Up @@ -60,7 +61,7 @@ export class PlaywrightConnection {
this._ws = ws;
this._preLaunched = preLaunched;
this._options = options;
options.launchOptions = filterLaunchOptions(options.launchOptions);
options.launchOptions = filterLaunchOptions(options.launchOptions, options.allowFSPaths);
if (clientType === 'reuse-browser' || clientType === 'pre-launched-browser-or-android')
assert(preLaunched.playwright);
if (clientType === 'pre-launched-browser-or-android')
Expand Down Expand Up @@ -284,7 +285,7 @@ function launchOptionsHash(options: LaunchOptions) {
return JSON.stringify(copy);
}

function filterLaunchOptions(options: LaunchOptions): LaunchOptions {
function filterLaunchOptions(options: LaunchOptions, allowFSPaths: boolean): LaunchOptions {
return {
channel: options.channel,
args: options.args,
Expand All @@ -296,7 +297,8 @@ function filterLaunchOptions(options: LaunchOptions): LaunchOptions {
chromiumSandbox: options.chromiumSandbox,
firefoxUserPrefs: options.firefoxUserPrefs,
slowMo: options.slowMo,
executablePath: isUnderTest() ? options.executablePath : undefined,
executablePath: (isUnderTest() || allowFSPaths) ? options.executablePath : undefined,
downloadsPath: allowFSPaths ? options.downloadsPath : undefined,
};
}

Expand Down
2 changes: 1 addition & 1 deletion packages/playwright-core/src/remote/playwrightServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export class PlaywrightServer {
return new PlaywrightConnection(
semaphore.acquire(),
clientType, ws,
{ socksProxyPattern: proxyValue, browserName, launchOptions },
{ socksProxyPattern: proxyValue, browserName, launchOptions, allowFSPaths: this._options.mode === 'extension' },
{
playwright: this._preLaunchedPlaywright,
browser: this._options.preLaunchedBrowser,
Expand Down

0 comments on commit d9e5ca0

Please sign in to comment.