mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
fix(remote server): allow local paths in extension mode (#34051)
This commit is contained in:
parent
f7c99ee6e3
commit
d9e5ca06bf
@ -32,6 +32,7 @@ import { debugLogger } from '../utils/debugLogger';
|
|||||||
export type ClientType = 'controller' | 'launch-browser' | 'reuse-browser' | 'pre-launched-browser-or-android';
|
export type ClientType = 'controller' | 'launch-browser' | 'reuse-browser' | 'pre-launched-browser-or-android';
|
||||||
|
|
||||||
type Options = {
|
type Options = {
|
||||||
|
allowFSPaths: boolean,
|
||||||
socksProxyPattern: string | undefined,
|
socksProxyPattern: string | undefined,
|
||||||
browserName: string | null,
|
browserName: string | null,
|
||||||
launchOptions: LaunchOptions,
|
launchOptions: LaunchOptions,
|
||||||
@ -60,7 +61,7 @@ export class PlaywrightConnection {
|
|||||||
this._ws = ws;
|
this._ws = ws;
|
||||||
this._preLaunched = preLaunched;
|
this._preLaunched = preLaunched;
|
||||||
this._options = options;
|
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')
|
if (clientType === 'reuse-browser' || clientType === 'pre-launched-browser-or-android')
|
||||||
assert(preLaunched.playwright);
|
assert(preLaunched.playwright);
|
||||||
if (clientType === 'pre-launched-browser-or-android')
|
if (clientType === 'pre-launched-browser-or-android')
|
||||||
@ -284,7 +285,7 @@ function launchOptionsHash(options: LaunchOptions) {
|
|||||||
return JSON.stringify(copy);
|
return JSON.stringify(copy);
|
||||||
}
|
}
|
||||||
|
|
||||||
function filterLaunchOptions(options: LaunchOptions): LaunchOptions {
|
function filterLaunchOptions(options: LaunchOptions, allowFSPaths: boolean): LaunchOptions {
|
||||||
return {
|
return {
|
||||||
channel: options.channel,
|
channel: options.channel,
|
||||||
args: options.args,
|
args: options.args,
|
||||||
@ -296,7 +297,8 @@ function filterLaunchOptions(options: LaunchOptions): LaunchOptions {
|
|||||||
chromiumSandbox: options.chromiumSandbox,
|
chromiumSandbox: options.chromiumSandbox,
|
||||||
firefoxUserPrefs: options.firefoxUserPrefs,
|
firefoxUserPrefs: options.firefoxUserPrefs,
|
||||||
slowMo: options.slowMo,
|
slowMo: options.slowMo,
|
||||||
executablePath: isUnderTest() ? options.executablePath : undefined,
|
executablePath: (isUnderTest() || allowFSPaths) ? options.executablePath : undefined,
|
||||||
|
downloadsPath: allowFSPaths ? options.downloadsPath : undefined,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ export class PlaywrightServer {
|
|||||||
return new PlaywrightConnection(
|
return new PlaywrightConnection(
|
||||||
semaphore.acquire(),
|
semaphore.acquire(),
|
||||||
clientType, ws,
|
clientType, ws,
|
||||||
{ socksProxyPattern: proxyValue, browserName, launchOptions },
|
{ socksProxyPattern: proxyValue, browserName, launchOptions, allowFSPaths: this._options.mode === 'extension' },
|
||||||
{
|
{
|
||||||
playwright: this._preLaunchedPlaywright,
|
playwright: this._preLaunchedPlaywright,
|
||||||
browser: this._options.preLaunchedBrowser,
|
browser: this._options.preLaunchedBrowser,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user